예제 #1
0
		public Category (Tiles.TileGroupInfo info, int columns)
		{
			WidgetFlags |= WidgetFlags.NoWindow;

			header = new Gtk.HBox (false, 0);

			headerExpander = new Gtk.Expander ("<big><b>" + GLib.Markup.EscapeText (info.Name) + "</b></big>");
			((Gtk.Label) headerExpander.LabelWidget).SetAlignment (0.0f, 0.5f);
			headerExpander.UseMarkup = true;
			headerExpander.UseUnderline = true;
			headerExpander.Show ();
			header.PackStart (headerExpander, true, true, 0);

			headerExpander.Activated += OnActivated;
			
			scope = Tiles.Utils.TileGroupToScopeType(info.Group);
			
			position = new Gtk.Label ();
			position.ModifyFg (Gtk.StateType.Normal, position.Style.Base (Gtk.StateType.Selected));
			header.PackStart (position, false, false, 0);
			position.Show ();

			prev = MakeButton (header, Gtk.Stock.GoBack, OnPrev);
			next = MakeButton (header, Gtk.Stock.GoForward, OnNext);

			header.Show ();
			header.Parent = this;
			header.SizeRequested += HeaderSizeRequested;

			tiles = new SortedTileList (Beagle.Search.SortType.Relevance);
			Columns = columns;

			UpdateButtons ();
			Expanded = true;	
		}
예제 #2
0
		public Tile (Hit hit, Query query) : base ()
		{
			base.AboveChild = true;
			base.AppPaintable = true;
			base.CanFocus = true;

			this.hit = hit;
			this.query = query;
			this.timestamp = hit.Timestamp;
			this.score = hit.Score;

			Gtk.Drag.SourceSet (this, Gdk.ModifierType.Button1Mask, targets,
					    Gdk.DragAction.Copy | Gdk.DragAction.Move);

			int pad = (int)StyleGetProperty ("focus-line-width") + (int)StyleGetProperty ("focus-padding") + 1;

			hbox = new Gtk.HBox (false, 5);
			hbox.BorderWidth = (uint)(pad + Style.Xthickness);
			hbox.Show ();

			icon = new Gtk.Image ();
			icon.Show ();
			hbox.PackStart (icon, false, false, 0);

			Add (hbox);
		}
예제 #3
0
		public DockItemContainer (DockFrame frame, DockItem item)
		{
			this.item = item;

			mainBox = new VBox ();
			Add (mainBox);

			mainBox.ResizeMode = Gtk.ResizeMode.Queue;
			mainBox.Spacing = 0;
			
			ShowAll ();
			
			mainBox.PackStart (item.GetToolbar (PositionType.Top).Container, false, false, 0);
			
			HBox hbox = new HBox ();
			hbox.Show ();
			hbox.PackStart (item.GetToolbar (PositionType.Left).Container, false, false, 0);
			
			contentBox = new HBox ();
			contentBox.Show ();
			hbox.PackStart (contentBox, true, true, 0);
			
			hbox.PackStart (item.GetToolbar (PositionType.Right).Container, false, false, 0);
			
			mainBox.PackStart (hbox, true, true, 0);
			
			mainBox.PackStart (item.GetToolbar (PositionType.Bottom).Container, false, false, 0);
		}
예제 #4
0
        public Category(Tiles.TileGroupInfo info, int columns)
        {
            WidgetFlags |= WidgetFlags.NoWindow;

            header = new Gtk.HBox(false, 0);

            headerExpander = new Gtk.Expander("<big><b>" + GLib.Markup.EscapeText(info.Name) + "</b></big>");
            ((Gtk.Label)headerExpander.LabelWidget).SetAlignment(0.0f, 0.5f);
            headerExpander.UseMarkup    = true;
            headerExpander.UseUnderline = true;
            headerExpander.Show();
            header.PackStart(headerExpander, true, true, 0);

            headerExpander.Activated += OnActivated;

            scope = Tiles.Utils.TileGroupToScopeType(info.Group);

            position = new Gtk.Label();
            position.ModifyFg(Gtk.StateType.Normal, position.Style.Base(Gtk.StateType.Selected));
            header.PackStart(position, false, false, 0);
            position.Show();

            prev = MakeButton(header, Gtk.Stock.GoBack, OnPrev);
            next = MakeButton(header, Gtk.Stock.GoForward, OnNext);

            header.Show();
            header.Parent         = this;
            header.SizeRequested += HeaderSizeRequested;

            tiles   = new SortedTileList(Beagle.Search.SortType.Relevance);
            Columns = columns;

            UpdateButtons();
            Expanded = true;
        }
예제 #5
0
        public NotebookTabLabel(string title)
        {
            Button button = new Button ();
            button.Image = new Gtk.Image (Stock.Close, IconSize.Menu);
            button.TooltipText = "Close Tab";
            button.Relief = ReliefStyle.None;

            RcStyle rcStyle = new RcStyle ();
            rcStyle.Xthickness = 0;
            rcStyle.Ythickness = 0;
            button.ModifyStyle (rcStyle);

            button.FocusOnClick = false;
            button.Clicked += OnCloseClicked;
            button.Show ();

            Label label = new Label (title);
            label.UseMarkup = false;
            label.UseUnderline = false;
            label.Show ();

            HBox hbox = new HBox (false, 0);
            hbox.Spacing = 0;
            hbox.Add (label);
            hbox.Add (button);
            hbox.Show ();

            this.Add (hbox);
        }
 private void OnFilterItemSelected(object sender, EventArgs a)
 {
     if (!FilterBar.Visible)
     {
         FilterBar.Show();
     }
     FilterEntry.GrabFocus();
 }
예제 #7
0
파일: MessageBar.cs 프로젝트: rubenv/tripod
        public MessageBar () : base (0.0f, 0.5f, 1.0f, 0.0f)
        {
            win = new Window (WindowType.Popup);
            win.Name = "gtk-tooltips";
            win.EnsureStyle ();
            win.StyleSet += delegate {
                Style = win.Style;
            };

            HBox shell_box = new HBox ();
            shell_box.Spacing = 10;

            box = new HBox ();
            box.Spacing = 10;

            image = new AnimatedImage ();
            try {
                image.Pixbuf = Gtk.IconTheme.Default.LoadIcon ("process-working", 22, IconLookupFlags.NoSvg);
                image.FrameHeight = 22;
                image.FrameWidth = 22;
                Spinning = false;
                image.Load ();
            } catch {
            }

            label = new WrapLabel ();
            label.Show ();

            box.PackStart (image, false, false, 0);
            box.PackStart (label, true, true, 0);
            box.Show ();

            button_box = new HBox ();
            button_box.Spacing = 3;

            close_button = new Button (new Image (Stock.Close, IconSize.Menu));
            close_button.Relief = ReliefStyle.None;
            close_button.Clicked += delegate { Hide (); };
            close_button.ShowAll ();
            close_button.Hide ();

            shell_box.PackStart (box, true, true, 0);
            shell_box.PackStart (button_box, false, false, 0);
            shell_box.PackStart (close_button, false, false, 0);
            shell_box.Show ();

            Add (shell_box);

            EnsureStyle ();

            BorderWidth = 3;
        }
예제 #8
0
        public DiscoverWindow()
            : base(Gtk.WindowType.Toplevel)
        {
            this.Title = "LinuxGUITest";
            this.DeleteEvent += new DeleteEventHandler(OnDeleteEvent);
            this.WindowPosition = Gtk.WindowPosition.Center;

            _Provider = DeviceProviderRegistry.CreateSupportedDeviceProvider();

            _Provider.DeviceFound += new EventHandler<DeviceInfoEventArgs>(DeviceFound);
            _Provider.DeviceLost += new EventHandler<DeviceInfoEventArgs>(DeviceLost);

            _UpdateThread = new Thread(new ThreadStart(UpdateFunction));
            _UpdateThread.Start();

            _HBox = new HBox(true, 0);
            _HBox.Homogeneous = false;
            this.Add(_HBox);
            _HBox.Show();

            Gtk.TreeView tree = new Gtk.TreeView();
            tree.WidthRequest = 250;
            tree.HeightRequest = 300;
            _HBox.PackStart(tree);

            // new column
            Gtk.TreeViewColumn devicetypeColumn = new Gtk.TreeViewColumn();
            devicetypeColumn.Title = "Type";
            Gtk.CellRendererText devicetypeCell = new CellRendererText();
            devicetypeColumn.PackStart(devicetypeCell, true);
            devicetypeColumn.AddAttribute(devicetypeCell, "text", 0);

            // new column
            Gtk.TreeViewColumn detailsColumn = new Gtk.TreeViewColumn();
            detailsColumn.Title = "Details";
            Gtk.CellRendererText detailseCell = new CellRendererText();
            detailsColumn.PackStart(detailseCell, true);
            detailsColumn.AddAttribute(detailseCell, "text", 1);

            tree.AppendColumn(devicetypeColumn);
            tree.AppendColumn(detailsColumn);
            _ListStore = new Gtk.ListStore(typeof(string), typeof(string));

            tree.Model = _ListStore;

            _HBox.ShowAll();

            LogLine("Searching for wii devices...");
            _Provider.StartDiscovering();
        }
예제 #9
0
        public windowVTETerminal(String Name, int Columns, int Rows, String FontString)
        {
            HBox hbox = new HBox ();
            term = new Terminal ();
            term.CursorBlinks = true;
            term.MouseAutohide = false;
            term.ScrollOnKeystroke = true;
            term.DeleteBinding = TerminalEraseBinding.Auto;
            term.BackspaceBinding = TerminalEraseBinding.Auto;
            term.FontFromString = FontString;
            term.Emulation = "xterm";
            term.Encoding = "UTF-8";

            term.SetSize(Columns,Rows);

            VScrollbar vscroll = new VScrollbar (term.Adjustment);
            hbox.PackStart (term);
            hbox.PackStart (vscroll);

            //			Gdk.Color white = new Gdk.Color ();
            //			Gdk.Color.Parse ("white", ref white);
            //
            //			Gdk.Color black = new Gdk.Color ();
            //			Gdk.Color.Parse ("black", ref black);
            //			term.SetColors (black, white, new Gdk.Color[]{}, 16);

            term.ButtonPressEvent += (o, args) =>
            {
                Write(args.Event.Button.ToString());
            };

            this.CanFocus = true;

            term.Show ();
            hbox.Show ();
            vscroll.Show ();
            this.Add (hbox);
            ShowAll ();

            KeyPress += (Gdk.Key key) =>
            {
                if (LocalEcho) Write(key.ToString());

                if (shellStream!=null && shellStream.CanWrite)
                    {
                         shellStream.WriteByte((byte)key);
                         shellStream.Flush();
                    }
            };
        }
예제 #10
0
 public TypeKindChooserDialog()
     : base(GettextCatalog.GetString ("Choose a type"))
 {
     Gtk.HBox hbox = new Gtk.HBox();
     base.VBox.Add (hbox);
     Gtk.VBox vbox;
     // box 1
     vbox = new Gtk.VBox ();
     hbox.Add (vbox);
     AddButton (vbox, GettextCatalog.GetString ("Activity"), SetActivity);
     _selection = "Activity";
     AddButton (vbox, GettextCatalog.GetString ("Actor"), SetActor);
     AddButton (vbox, GettextCatalog.GetString ("Artifact"), SetArtifact);
     AddButton (vbox, GettextCatalog.GetString ("Association"), SetAssociation);
     AddButton (vbox, GettextCatalog.GetString ("AssociationClass"), SetAssociationClass);
     AddButton (vbox, GettextCatalog.GetString ("Class"), SetClass);
     AddButton (vbox, GettextCatalog.GetString ("Collaboration"), SetCollaboration);
     vbox.Show ();
     // box 2
     vbox = new Gtk.VBox();
     hbox.Add (vbox);
     AddButton (vbox, GettextCatalog.GetString ("CommunicationPath"), SetCommunicationPath);
     AddButton (vbox, GettextCatalog.GetString ("Component"), SetComponent);
     AddButton (vbox, GettextCatalog.GetString ("DataType"), SetDataType);
     AddButton (vbox, GettextCatalog.GetString ("DeploymentSpecification"), SetDeploymentSpecification);
     AddButton (vbox, GettextCatalog.GetString ("Device"), SetDevice);
     AddButton (vbox, GettextCatalog.GetString ("Enumeration"), SetEnumeration);
     AddButton (vbox, GettextCatalog.GetString ("ExecutionEnvironment"), SetExecutionEnvironment);
     vbox.Show ();
     // box 3
     vbox = new Gtk.VBox ();
     hbox.Add (vbox);
     AddButton (vbox, GettextCatalog.GetString ("Extension"), SetExtension);
     AddButton (vbox, GettextCatalog.GetString ("InformationItem"), SetInformationItem);
     AddButton (vbox, GettextCatalog.GetString ("Interaction"), SetInteraction);
     AddButton (vbox, GettextCatalog.GetString ("Interface"), SetInterface);
     AddButton (vbox, GettextCatalog.GetString ("Node"), SetNode);
     AddButton (vbox, GettextCatalog.GetString ("PrimitiveType"), SetPrimitiveType);
     AddButton (vbox, GettextCatalog.GetString ("ProtocolStateMachine"), SetProtocolStateMachine);
     vbox.Show ();
     // box 4
     vbox = new Gtk.VBox ();
     hbox.Add (vbox);
     AddButton (vbox, GettextCatalog.GetString ("Signal"), SetSignal);
     AddButton (vbox, GettextCatalog.GetString ("StateMachine"), SetStateMachine);
     AddButton (vbox, GettextCatalog.GetString ("Stereotype"), SetStereotype);
     AddButton (vbox, GettextCatalog.GetString ("UseCase"), SetUseCase);
     vbox.Show ();
     hbox.Show ();
 }
예제 #11
0
        public ProfileComboBoxConfigurable(MediaProfileManager manager, string configurationId, Box parent)
        {
            HBox editor = new HBox();

            configuration_id = configurationId;
            combo = new ProfileComboBox(manager);
            combo.Show();

            button = new ProfileConfigureButton(configurationId);
            button.ComboBox = combo;
            button.Show();

            editor.Spacing = 5;
            editor.PackStart(combo, true, true, 0);
            editor.PackStart(button, false, false, 0);
            editor.Show();

            ProfileConfiguration config = manager.GetActiveProfileConfiguration (configurationId);

            if (config != null) {
                Combo.SetActiveProfile(config.Profile);
            }

            description = new DescriptionLabel (delegate {
                var profile = Combo.ActiveProfile;
                return profile != null ? profile.Description : "";
            });

            Combo.Changed += delegate {
                if(Combo.ActiveProfile != null) {
                    Hyena.Log.DebugFormat ("Setting active encoding profile: {0} (saved to {1})",
                        Combo.ActiveProfile.Name, configurationId);
                    ProfileConfiguration.SaveActiveProfile (Combo.ActiveProfile, configurationId);
                    description.Update ();
                }
            };

            Combo.StateChanged += delegate {
                if (Combo.State == StateType.Insensitive && description.Parent != null) {
                    ((Container)parent ?? this).Remove (description);
                } else if (description.Parent == null) {
                    description.PackInto (parent ?? this, parent != null);
                }
            };

            Spacing = 5;
            PackStart (editor, true, true, 0);
            description.PackInto (parent ?? this, parent != null);
        }
예제 #12
0
        public ModeButton()
        {
            this.Events |= EventMask.PointerMotionMask
                        |  EventMask.ButtonPressMask
                        |  EventMask.VisibilityNotifyMask;

            this.VisibilityNotifyEvent += delegate { this.QueueDraw (); };

            m_box = new HBox (true, 6);
            m_box.BorderWidth = 6;
            this.Add (m_box);
            m_box.Show ();

            m_button = new Button ();
            m_box.PackStart (m_button, false, false, 0);
        }
예제 #13
0
        public void add_toolbar(string name, Toolbar toolbar)
        {
            Gtk.Label label = new Label(name);
            label.SetSizeRequest((int)Sugar.Style.TOOLBOX_TAB_LABEL_WIDTH, -1);
            label.SetAlignment(0.0f, 0.5f);

            Gtk.HBox toolbar_box = new HBox();
            toolbar_box.PackStart(toolbar,true, true, Sugar.Style.TOOLBOX_HORIZONTAL_PADDING);

            toolbar_box.ExposeEvent += _toolbar_box_expose_cb;
            _notebook.AppendPage(toolbar_box, label);
            toolbar_box.Show();

            if (_notebook.NPages>1) {
                _notebook.ShowTabs=true;
            //				_separator.Show();
            }
        }
예제 #14
0
        public MenuButton()
        {
            hbox = new HBox ();

            Image = new Image ();
            hbox.PackStart (Image, false, false, 1);
            Image.Show ();

            this.titleLabel = new Label ();
            this.titleLabel.Xalign = 0;
            hbox.PackStart (this.titleLabel, true, true, 1);
            this.titleLabel.Show ();

            this.arrow = new Arrow (ArrowType.Down, ShadowType.None);
            hbox.PackStart (arrow, false, false, 1);
            arrow.Show ();

            this.Add (hbox);
            hbox.Show ();
        }
		public ColorEditor(object @object, PropertyInfo info) : base(@object, info) {
			HBox box = new HBox();
			box.Spacing = 6;
			box.Show();
			
			this.mColorButton = new ColorButton();
			this.mColorButton.Show();
			box.PackStart(this.mColorButton, false, true, 0);
			
			this.mAlphaScale = new HScale(0, 1, 0.0001);
			this.mAlphaScale.Show();
			box.PackStart(this.mAlphaScale, true, true, 0);
			
			this.Add(box);
			
			this.Revert();
			
			this.mColorButton.ColorSet += this.OnDirtyAction;
			this.mAlphaScale.ValueChanged += this.OnDirtyAction;
		}
예제 #16
0
		static void SetButtonIcon (Button button, string stockIcon)
		{
			Alignment alignment = new Alignment (0.5f, 0.5f, 0f, 0f);
			Label label = new Label (button.Label);
			HBox hbox = new HBox (false, 2);
			Image image = new Image ();
			
			image.Pixbuf = Stetic.IconLoader.LoadIcon (button, stockIcon, IconSize.Button);
			image.Show ();
			hbox.Add (image);
			
			label.Show ();
			hbox.Add (label);
			
			hbox.Show ();
			alignment.Add (hbox);
			
			button.Child.Destroy ();
			
			alignment.Show ();
			button.Add (alignment);
		}
예제 #17
0
		public MenuButton (string label, Menu menu, ArrowType arrow_type) : base ()
		{
			HBox hbox = new HBox ();
			
			this.image = new Image ();
			hbox.PackStart (this.image, false, false, 1);
			image.Show ();

			this.label = new Label (label);
			this.label.Xalign = 0;
			hbox.PackStart (this.label, true, true, 1);
			this.label.Show ();

			this.arrow = new Arrow (arrow_type, ShadowType.None);
			hbox.PackStart (arrow, false, false, 1);
			arrow.Show ();

			Menu = menu;

			this.Add (hbox);
			hbox.Show ();
		}
예제 #18
0
        private void InitializeForm()
        {
            XML form = FormHelper.LoadGladeXML("WbpReportResult.glade", "hboReportResultRoot");

            form.Autoconnect(this);

            btnClose.SetChildImage(FormHelper.LoadImage("Icons.Cancel24.png"));
            btnPrint.SetChildImage(FormHelper.LoadImage("Icons.Print24.png"));
            btnExport.SetChildImage(FormHelper.LoadImage("Icons.Export24.png"));
            btnSum.SetChildImage(FormHelper.LoadImage("Icons.Sum24.png"));
            btnView.SetChildImage(FormHelper.LoadImage("Icons.Visualizer24.png"));
            btnRefresh.SetChildImage(FormHelper.LoadImage("Icons.Refresh24.png"));

            Image icon = FormHelper.LoadImage("Icons.Report32.png");

            algReportResultIcon.Add(icon);
            icon.Show();

            Add(hboReportResultRoot);
            hboReportResultRoot.Show();
            hboReportResultRoot.KeyPressEvent += WbpReportResult_KeyPressEvent;
            OuterKeyPressed += WbpReportResult_KeyPressEvent;

            btnPrint.Clicked  += btnPrint_Clicked;
            btnExport.Clicked += btnExport_Clicked;
            btnSum.Toggled    += btnSum_Toggled;
            btnView.Clicked   += btnView_Clicked;
            lblRows.Visible    = false;

            SetVisualizer(new TableVisualizer());

            InitializeStrings();
            visualizer.Initialize(qSetObject, visualizerSettings);

            BusinessDomain.FeedbackProvider.TrackEvent("Report", ReportTypeName);
        }
예제 #19
0
		void Build ()
		{
			Title = GettextCatalog.GetString ("Exception Caught");
			DefaultHeight = 350;
			DefaultWidth = 500;
			VBox.Spacing = 0;

			VBox.PackStart (CreateExceptionHeader (), false, true, 0);

			var vbox = new VBox (false, 0);

			vbox.PackStart (CreateSeparator (), false, true, 0);
			vbox.PackStart (CreateExceptionValueTreeView (), true, true, 0);
			vbox.PackStart (CreateSeparator (), false, true, 0);
			vbox.PackStart (CreateStackTraceTreeView (), true, true, 0);
			vbox.PackStart (CreateSeparator (), false, true, 0);
			vbox.Show ();

			VBox.PackStart (vbox, true, true, 0);

			var actionArea = new HBox (false, 12) { BorderWidth = 6 };

			OnlyShowMyCodeCheckbox = new CheckButton (GettextCatalog.GetString ("_Only show my code."));
			OnlyShowMyCodeCheckbox.Toggled += OnlyShowMyCodeToggled;
			OnlyShowMyCodeCheckbox.Show ();

			var alignment = new Alignment (0.0f, 0.5f, 0.0f, 0.0f) { Child = OnlyShowMyCodeCheckbox };
			alignment.Show ();

			actionArea.PackStart (alignment, true, true, 0);
			actionArea.PackStart (CreateButtonBox (), false, true, 0);
			actionArea.Show ();

			VBox.PackStart (actionArea, false, true, 0);
			ActionArea.Hide ();
		}
예제 #20
0
        public HIGMessageDialog(Gtk.Window parent,
					 Gtk.DialogFlags flags,
					 Gtk.MessageType type,
					 Gtk.ButtonsType buttons,
					 string          title,
					 string          header,
					 string          msg)
            : base()
        {
            HasSeparator = false;
            BorderWidth = 5;
            Resizable = false;
            Title = title;

            VBox.Spacing = 12;
            ActionArea.Layout = Gtk.ButtonBoxStyle.End;

            accel_group = new Gtk.AccelGroup ();
            AddAccelGroup (accel_group);

            Gtk.HBox hbox = new Gtk.HBox (false, 12);
            hbox.BorderWidth = 5;
            hbox.Show ();
            VBox.PackStart (hbox, false, false, 0);

            Gtk.Image image = null;

            switch (type) {
            case Gtk.MessageType.Error:
                image = new Gtk.Image (Gtk.Stock.DialogError,
                               Gtk.IconSize.Dialog);
                break;
            case Gtk.MessageType.Question:
                image = new Gtk.Image (Gtk.Stock.DialogQuestion,
                               Gtk.IconSize.Dialog);
                break;
            case Gtk.MessageType.Info:
                image = new Gtk.Image (Gtk.Stock.DialogInfo,
                               Gtk.IconSize.Dialog);
                break;
            case Gtk.MessageType.Warning:
                image = new Gtk.Image (Gtk.Stock.DialogWarning,
                               Gtk.IconSize.Dialog);
                break;
            }

            image.Show ();
            image.Yalign = 0;
            hbox.PackStart (image, false, false, 0);

            label_vbox = new Gtk.VBox (false, 8);
            label_vbox.Show ();
            hbox.PackStart (label_vbox, true, true, 0);

            string message = String.Format ("<span weight='bold' size='larger'>{0}" +
                              "</span>\n",
                              header);

            Gtk.Label label;

            label = new Gtk.Label (message);
            label.UseMarkup = true;
            label.Justify = Gtk.Justification.Left;
            label.LineWrap = true;
            label.SetAlignment (0.0f, 0.5f);
            label.Show ();
            label_vbox.PackStart (label, false, false, 0);

            label = new Gtk.Label (msg);
            label.UseMarkup = true;
            label.Justify = Gtk.Justification.Left;
            label.LineWrap = true;
            label.SetAlignment (0.0f, 0.5f);
            label.Show ();
            label_vbox.PackStart (label, false, false, 0);

            switch (buttons) {
            case Gtk.ButtonsType.None:
                break;
            case Gtk.ButtonsType.Ok:
                AddButton (Gtk.Stock.Ok, Gtk.ResponseType.Ok, true);
                break;
            case Gtk.ButtonsType.Close:
                AddButton (Gtk.Stock.Close, Gtk.ResponseType.Close, true);
                break;
            case Gtk.ButtonsType.Cancel:
                AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, true);
                break;
            case Gtk.ButtonsType.YesNo:
                AddButton (Gtk.Stock.No, Gtk.ResponseType.No, false);
                AddButton (Gtk.Stock.Yes, Gtk.ResponseType.Yes, true);
                break;
            case Gtk.ButtonsType.OkCancel:
                AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, false);
                AddButton (Gtk.Stock.Ok, Gtk.ResponseType.Ok, true);
                break;
            }

            if (parent != null)
                TransientFor = parent;

            if ((int) (flags & Gtk.DialogFlags.Modal) != 0)
                Modal = true;

            if ((int) (flags & Gtk.DialogFlags.DestroyWithParent) != 0)
                DestroyWithParent = true;
        }
예제 #21
0
		public DockItemContainer (DockFrame frame, DockItem item)
		{
			this.frame = frame;
			this.item = item;
			
			ResizeMode = Gtk.ResizeMode.Queue;
			Spacing = 0;
			
			title = new Gtk.Label ();
			title.Xalign = 0;
			title.Xpad = 3;
			title.UseMarkup = true;
			title.Ellipsize = Pango.EllipsizeMode.End;
			
			btnDock = new Button (new Gtk.Image (pixAutoHide));
			btnDock.Relief = ReliefStyle.None;
			btnDock.CanFocus = false;
			btnDock.WidthRequest = btnDock.HeightRequest = 17;
			btnDock.Clicked += OnClickDock;
			
			btnClose = new Button (new Gtk.Image (pixClose));
			btnClose.TooltipText = Catalog.GetString ("Hide");
			btnClose.Relief = ReliefStyle.None;
			btnClose.CanFocus = false;
			btnClose.WidthRequest = btnClose.HeightRequest = 17;
			btnClose.Clicked += delegate {
				item.Visible = false;
			};
			
			HBox box = new HBox (false, 0);
			box.PackStart (title, true, true, 0);
			box.PackEnd (btnClose, false, false, 0);
			box.PackEnd (btnDock, false, false, 0);
			
			headerAlign = new Alignment (0.0f, 0.0f, 1.0f, 1.0f);
			headerAlign.TopPadding = headerAlign.BottomPadding = headerAlign.RightPadding = headerAlign.LeftPadding = 1;
			headerAlign.Add (box);
			
			header = new EventBox ();
			header.Events |= Gdk.EventMask.KeyPressMask | Gdk.EventMask.KeyReleaseMask;
			header.ButtonPressEvent += HeaderButtonPress;
			header.ButtonReleaseEvent += HeaderButtonRelease;
			header.MotionNotifyEvent += HeaderMotion;
			header.KeyPressEvent += HeaderKeyPress;
			header.KeyReleaseEvent += HeaderKeyRelease;
			header.Add (headerAlign);
			header.ExposeEvent += HeaderExpose;
			header.Realized += delegate {
				header.GdkWindow.Cursor = handCursor;
			};
			
			foreach (Widget w in new Widget [] { header, btnDock, btnClose }) {
				w.EnterNotifyEvent += HeaderEnterNotify;
				w.LeaveNotifyEvent += HeaderLeaveNotify;
			}
			
			PackStart (header, false, false, 0);
			ShowAll ();
			
			PackStart (item.GetToolbar (PositionType.Top).Container, false, false, 0);
			
			HBox hbox = new HBox ();
			hbox.Show ();
			hbox.PackStart (item.GetToolbar (PositionType.Left).Container, false, false, 0);
			
			contentBox = new HBox ();
			contentBox.Show ();
			hbox.PackStart (contentBox, true, true, 0);
			
			hbox.PackStart (item.GetToolbar (PositionType.Right).Container, false, false, 0);
			
			PackStart (hbox, true, true, 0);
			
			PackStart (item.GetToolbar (PositionType.Bottom).Container, false, false, 0);
			
			UpdateBehavior ();
		}
예제 #22
0
		private void Init()
		{
			Logger.Debug("Called Init");
			this.Icon = Utilities.GetIcon ("giver-48", 48);
			// Update the window title
			this.Title = string.Format ("Giver Preferences");	
			
			//this.DefaultSize = new Gdk.Size (300, 500); 	
			this.VBox.Spacing = 0;
			this.VBox.BorderWidth = 0;
			this.SetDefaultSize (450, 100);


			this.AddButton(Stock.Close, Gtk.ResponseType.Ok);
            this.DefaultResponse = ResponseType.Ok;


			// Start with an event box to paint the background white
			EventBox eb = new EventBox();
			eb.Show();
			eb.BorderWidth = 0;
            eb.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255));
            eb.ModifyBase(StateType.Normal, new Gdk.Color(255,255,255));

			VBox mainVBox = new VBox();
			mainVBox.BorderWidth = 10;
			mainVBox.Spacing = 5;
			mainVBox.Show ();
			eb.Add(mainVBox);
			this.VBox.PackStart(eb);

			Label label = new Label();
			label.Show();
			label.Justify = Gtk.Justification.Left;
            label.SetAlignment (0.0f, 0.5f);
			label.LineWrap = false;
			label.UseMarkup = true;
			label.UseUnderline = false;
			label.Markup = "<span weight=\"bold\" size=\"large\">Your Name</span>";
			mainVBox.PackStart(label, true, true, 0);

			// Name Box at the top of the Widget
			HBox nameBox = new HBox();
			nameBox.Show();
			nameEntry = new Entry();
			nameEntry.Show();
			nameBox.PackStart(nameEntry, true, true, 0);
			nameBox.Spacing = 10;
			mainVBox.PackStart(nameBox, false, false, 0);
	
			label = new Label();
			label.Show();
			label.Justify = Gtk.Justification.Left;
            label.SetAlignment (0.0f, 0.5f);
			label.LineWrap = false;
			label.UseMarkup = true;
			label.UseUnderline = false;
			label.Markup = "<span weight=\"bold\" size=\"large\">Your Picture</span>";
			mainVBox.PackStart(label, true, true, 0);
		
			Gtk.Table table = new Table(4, 3, false);
			table.Show();
			// None Entry
			noneButton = new RadioButton((Gtk.RadioButton)null);
			noneButton.Show();
			table.Attach(noneButton, 0, 1, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
			VBox vbox = new VBox();
			vbox.Show();
			Gtk.Image image = new Image(Utilities.GetIcon("computer", 48));
			image.Show();
			vbox.PackStart(image, false, false, 0);
			label = new Label("None");
			label.Show();
			vbox.PackStart(label, false, false, 0);
			table.Attach(vbox, 1, 2, 0 ,1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
			vbox = new VBox();
			vbox.Show();
			table.Attach(vbox, 2,3,1,2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0);

			// Local Entry
			localButton = new RadioButton(noneButton);
			localButton.Show();
			table.Attach(localButton, 0, 1, 1, 2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
			vbox = new VBox();
			vbox.Show();
			localImage = new Image(Utilities.GetIcon("stock_person", 48));
			localImage.Show();
			vbox.PackStart(localImage, false, false, 0);
			label = new Label("File");
			label.Show();
			vbox.PackStart(label, false, false, 0);
			table.Attach(vbox, 1, 2, 1 ,2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
			photoButton = new Button("Change Photo");
			photoButton.Show();
			table.Attach(photoButton, 2,3,1,2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

			// Web Entry
			webButton = new RadioButton(noneButton);
			webButton.Show();
			table.Attach(webButton, 0, 1, 2, 3, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
			vbox = new VBox();
			vbox.Show();
			image = new Image(Utilities.GetIcon("web-browser", 48));
			image.Show();
			vbox.PackStart(image, false, false, 0);
			label = new Label("Web Link");
			label.Show();
			vbox.PackStart(label, false, false, 0);
			table.Attach(vbox, 1, 2, 2 ,3, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
			webEntry = new Entry();
			webEntry.Show();
			table.Attach(webEntry, 2,3,2,3, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0);

			// Gravatar Entry
			gravatarButton = new RadioButton(noneButton);
			gravatarButton.Show();
			table.Attach(gravatarButton, 0, 1, 3, 4, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
			vbox = new VBox();
			vbox.Show();
			image = new Image(Utilities.GetIcon("gravatar", 48));
			image.Show();
			vbox.PackStart(image, false, false, 0);
			label = new Label("Gravatar");
			label.Show();
			vbox.PackStart(label, false, false, 0);
			table.Attach(vbox, 1, 2, 3 ,4, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
			gravatarEntry = new Entry();
			gravatarEntry.Show();
			table.Attach(gravatarEntry, 2,3,3,4, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0);

			mainVBox.PackStart(table, true, true, 0);


			label = new Label();
			label.Show();
			label.Justify = Gtk.Justification.Left;
            label.SetAlignment (0.0f, 0.5f);
			label.LineWrap = false;
			label.UseMarkup = true;
			label.UseUnderline = false;
			label.Markup = "<span weight=\"bold\" size=\"large\">Your File Location</span>";
			mainVBox.PackStart(label, true, true, 0);
	
			fileLocationButton = new FileChooserButton("Select storage location",
			    FileChooserAction.SelectFolder);
			fileLocationButton.Show();

			mainVBox.PackStart(fileLocationButton, true, true, 0);

			table = new Table(2, 3, false);
			table.Show();

			// Port number section
			label = new Label();
			label.Show();
			label.Justify = Gtk.Justification.Left;
			label.SetAlignment (0.0f, 0.5f);
			label.LineWrap = false;
			label.UseMarkup = true;
			label.UseUnderline = false;
			label.Markup = "<span weight=\"bold\" size=\"large\">Port Number</span>";
			mainVBox.PackStart(label, true, true, 0);

			// any port Entry
			anyPortButton = new RadioButton((Gtk.RadioButton)null);
			anyPortButton.Show();
			table.Attach(anyPortButton, 0, 1, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

			vbox = new VBox();
			vbox.Show();

			label = new Label ();
			label.Show ();
			label.Justify = Gtk.Justification.Left;
			label.SetAlignment (0.0f, 0.5f);
			label.LineWrap = false;
			label.UseMarkup = true;
			label.UseUnderline = false;
			label.Markup = "Any available port";
			vbox.PackStart(label, false, false, 0);
			table.Attach(vbox, 1, 2, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

			// fixed port Entry
			fixedPortButton = new RadioButton(anyPortButton);
			fixedPortButton.Show();
			table.Attach(fixedPortButton, 0, 1, 1, 2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

			label = new Label ();
			label.Show ();
			label.Justify = Gtk.Justification.Left;
			label.SetAlignment (0.0f, 0.5f);
			label.LineWrap = false;
			label.UseMarkup = true;
			label.UseUnderline = false;
			label.Markup = "Use a fixed port";
			table.Attach(label, 1, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0);

			portNumberEntry = new Entry();
			portNumberEntry.Show();
			table.Attach(portNumberEntry, 2, 3, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0);

			mainVBox.PackStart(table, true, true, 0);

			DeleteEvent += WindowDeleted;
		}
예제 #23
0
 void on_radiobutton_dist_fixed_toggled(object o, EventArgs args)
 {
     hbox_distance_fixed.Show();
     vbox_distance_variable.Hide();
 }
예제 #24
0
		void ShowDirectoryPathUI ()
		{
			if (labelPath != null)
				return;
			
			// We want to add the Path combo box right below the Scope 
			uint row = TableGetRowForItem (tableFindAndReplace, labelScope) + 1;
			
			// DirectoryScope
			labelPath = new Label {
				LabelProp = GettextCatalog.GetString ("_Path:"),
				UseUnderline = true, 
				Xalign = 0f
			};
			labelPath.Show ();
			
			hboxPath = new HBox ();
			comboboxentryPath = new ComboBoxEntry ();
			comboboxentryPath.Destroyed += ComboboxentryPathDestroyed;
			LoadHistory ("MonoDevelop.FindReplaceDialogs.PathHistory", comboboxentryPath);
			comboboxentryPath.Show ();
			hboxPath.PackStart (comboboxentryPath);
			
			labelPath.MnemonicWidget = comboboxentryPath;
			
			buttonBrowsePaths = new Button { Label = "..." };
			buttonBrowsePaths.Clicked += ButtonBrowsePathsClicked;
			buttonBrowsePaths.Show ();
			hboxPath.PackStart (buttonBrowsePaths, false, false, 0);
			hboxPath.Show ();
			
			// Add the Directory Path row to the table
			TableAddRow (tableFindAndReplace, row++, labelPath, hboxPath);
			
			// Add a checkbox for searching the directory recursively...
			checkbuttonRecursively = new CheckButton {
				Label = GettextCatalog.GetString ("Re_cursively"),
				Active = properties.Get ("SearchPathRecursively", true),
				UseUnderline = true
			};
			
			checkbuttonRecursively.Destroyed += CheckbuttonRecursivelyDestroyed;
			checkbuttonRecursively.Show ();
			
			TableAddRow (tableFindAndReplace, row, null, checkbuttonRecursively);
		}
예제 #25
0
public SyncTitleConflictDialog (Note existingNote, IList<string> noteUpdateTitles) :
		base (Catalog.GetString ("Note Conflict"), null, Gtk.DialogFlags.Modal)
		{
			this.existingNote = existingNote;
			this.noteUpdateTitles = noteUpdateTitles;

			// Suggest renaming note by appending " (old)" to the existing title
			string suggestedRenameBase = existingNote.Title + Catalog.GetString (" (old)");
			string suggestedRename = suggestedRenameBase;
			for (int i = 1; !IsNoteTitleAvailable (suggestedRename); i++)
				suggestedRename = suggestedRenameBase + " " + i.ToString();

			VBox outerVBox = new VBox (false, 12);
			outerVBox.BorderWidth = 12;
			outerVBox.Spacing = 8;

			HBox hbox = new HBox (false, 8);
			Image image = new Image (GuiUtils.GetIcon (Gtk.Stock.DialogWarning, 48)); // TODO: Is this the right icon?
			image.Show ();
			hbox.PackStart (image, false, false, 0);

			VBox vbox = new VBox (false, 8);

			headerLabel = new Label ();
			headerLabel.UseMarkup = true;
			headerLabel.Xalign = 0;
			headerLabel.UseUnderline = false;
			headerLabel.Show ();
			vbox.PackStart (headerLabel, false, false, 0);

			messageLabel = new Label ();
			messageLabel.Xalign = 0;
			messageLabel.UseUnderline = false;
			messageLabel.LineWrap = true;
			messageLabel.Wrap = true;
			messageLabel.Show ();
			vbox.PackStart (messageLabel, false, false, 0);

			vbox.Show ();
			hbox.PackStart (vbox, true, true, 0);

			hbox.Show ();
			outerVBox.PackStart (hbox);
			VBox.PackStart (outerVBox);

			Gtk.HBox renameHBox = new Gtk.HBox ();
			renameRadio = new Gtk.RadioButton (Catalog.GetString ("Rename local note:"));
			renameRadio.Toggled += radio_Toggled;
			Gtk.VBox renameOptionsVBox = new Gtk.VBox ();

			renameEntry = new Gtk.Entry (suggestedRename);
			renameEntry.Changed += renameEntry_Changed;
			renameUpdateCheck = new Gtk.CheckButton (Catalog.GetString ("Update links in referencing notes"));
			renameOptionsVBox.PackStart (renameEntry);
			//renameOptionsVBox.PackStart (renameUpdateCheck); // This seems like a superfluous option
			renameHBox.PackStart (renameRadio);
			renameHBox.PackStart (renameOptionsVBox);
			VBox.PackStart (renameHBox);

			deleteExistingRadio = new Gtk.RadioButton (renameRadio, Catalog.GetString ("Overwrite local note"));
			deleteExistingRadio.Toggled += radio_Toggled;
			VBox.PackStart (deleteExistingRadio);

			alwaysDoThisCheck = new Gtk.CheckButton (Catalog.GetString ("Always perform this action"));
			VBox.PackStart (alwaysDoThisCheck);

			continueButton = (Gtk.Button) AddButton (Gtk.Stock.GoForward, Gtk.ResponseType.Accept);

			// Set initial dialog text
			HeaderText = Catalog.GetString ("Note conflict detected");
			MessageText = string.Format (Catalog.GetString ("The server version of \"{0}\" conflicts with your local note."
			                             + "  What do you want to do with your local note?"),
			                             existingNote.Title);

			ShowAll ();
		}
예제 #26
0
		// TODO: Possible to make Tomboy not crash if quit while dialog is up?
		public SyncDialog ()
: base (string.Empty,
		        null,
		        Gtk.DialogFlags.DestroyWithParent)
		{
			progressBarTimeoutId = 0;

			SetSizeRequest (400, -1);
			HasSeparator = false;

			// Outer box. Surrounds all of our content.
			VBox outerVBox = new VBox (false, 12);
			outerVBox.BorderWidth = 6;
			outerVBox.Show ();
			VBox.PackStart (outerVBox, true, true, 0);

			// Top image and label
			HBox hbox = new HBox (false, 12);
			hbox.Show ();
			outerVBox.PackStart (hbox, false, false, 0);

			image = new Image (GuiUtils.GetIcon ("tomboy", 48));
			image.Xalign = 0;
			image.Yalign = 0;
			image.Show ();
			hbox.PackStart (image, false, false, 0);

			// Label header and message
			VBox vbox = new VBox (false, 6);
			vbox.Show ();
			hbox.PackStart (vbox, true, true, 0);

			headerLabel = new Label ();
			headerLabel.UseMarkup = true;
			headerLabel.Xalign = 0;
			headerLabel.UseUnderline = false;
			headerLabel.LineWrap = true;
			headerLabel.Show ();
			vbox.PackStart (headerLabel, false, false, 0);

			messageLabel = new Label ();
			messageLabel.Xalign = 0;
			messageLabel.UseUnderline = false;
			messageLabel.LineWrap = true;
			messageLabel.SetSizeRequest (250, -1);
			messageLabel.Show ();
			vbox.PackStart (messageLabel, false, false, 0);

			progressBar = new Gtk.ProgressBar ();
			progressBar.Orientation = Gtk.ProgressBarOrientation.LeftToRight;
			progressBar.BarStyle = ProgressBarStyle.Continuous;
			progressBar.ActivityBlocks = 30;
			progressBar.Show ();
			outerVBox.PackStart (progressBar, false, false, 0);

			progressLabel = new Label ();
			progressLabel.UseMarkup = true;
			progressLabel.Xalign = 0;
			progressLabel.UseUnderline = false;
			progressLabel.LineWrap = true;
			progressLabel.Wrap = true;
			progressLabel.Show ();
			outerVBox.PackStart (progressLabel, false, false, 0);

			// Expander containing TreeView
			expander = new Gtk.Expander (Catalog.GetString ("Details"));
			expander.Spacing = 6;
			expander.Activated += OnExpanderActivated;
			expander.Show ();
			outerVBox.PackStart (expander, true, true, 0);

			// Contents of expander
			Gtk.VBox expandVBox = new Gtk.VBox ();
			expandVBox.Show ();
			expander.Add (expandVBox);

			// Scrolled window around TreeView
			Gtk.ScrolledWindow scrolledWindow = new Gtk.ScrolledWindow ();
			scrolledWindow.ShadowType = Gtk.ShadowType.In;
			scrolledWindow.SetSizeRequest (-1, 200);
			scrolledWindow.Show ();
			expandVBox.PackStart (scrolledWindow, true, true, 0);

			// Create model for TreeView
			model = new Gtk.TreeStore (typeof (string), typeof (string));

			// Create TreeView, attach model
			Gtk.TreeView treeView = new Gtk.TreeView ();
			treeView.Model = model;
			treeView.RowActivated += OnRowActivated;
			treeView.Show ();
			scrolledWindow.Add (treeView);

			// Set up TreeViewColumns
			Gtk.TreeViewColumn column = new Gtk.TreeViewColumn (
			        Catalog.GetString ("Note Title"),
			        new Gtk.CellRendererText (), "text", 0);
			column.SortColumnId = 0;
			column.Resizable = true;
			treeView.AppendColumn (column);

			column = new Gtk.TreeViewColumn (
			        Catalog.GetString ("Status"),
			        new Gtk.CellRendererText (), "text", 1);
			column.SortColumnId = 1;
			column.Resizable = true;
			treeView.AppendColumn (column);

			// Button to close dialog.
			closeButton = (Gtk.Button) AddButton (Gtk.Stock.Close, Gtk.ResponseType.Close);
			closeButton.Sensitive = false;
		}
예제 #27
0
		void Build ()
		{
			Title = GettextCatalog.GetString ("Exception Caught");
			DefaultHeight = 500;
			DefaultWidth = 600;
			VBox.Spacing = 0;

			VBox.PackStart (CreateExceptionHeader (), false, true, 0);

			var paned = new VPaned ();
			paned.Add1 (CreateExceptionValueTreeView ());
			paned.Add2 (CreateStackTraceTreeView ());
			paned.Show ();

			var vbox = new VBox (false, 0);
			vbox.PackStart (CreateSeparator (), false, true, 0);
			vbox.PackStart (paned, true, true, 0);
			vbox.PackStart (CreateSeparator (), false, true, 0);
			vbox.Show ();

			VBox.PackStart (vbox, true, true, 0);

			var actionArea = new HBox (false, 12) { BorderWidth = 6 };

			OnlyShowMyCodeCheckbox = new CheckButton (GettextCatalog.GetString ("_Only show my code."));
			OnlyShowMyCodeCheckbox.Toggled += OnlyShowMyCodeToggled;
			OnlyShowMyCodeCheckbox.Show ();
			OnlyShowMyCodeCheckbox.Active = DebuggingService.GetUserOptions ().ProjectAssembliesOnly;

			var alignment = new Alignment (0.0f, 0.5f, 0.0f, 0.0f) { Child = OnlyShowMyCodeCheckbox };
			alignment.Show ();

			actionArea.PackStart (alignment, true, true, 0);
			actionArea.PackStart (CreateButtonBox (), false, true, 0);
			actionArea.Show ();

			VBox.PackStart (actionArea, false, true, 0);
			ActionArea.Hide ();
		}
예제 #28
0
        public TaskGroup(string groupName, DateTime rangeStart,
						  DateTime rangeEnd, IEnumerable<Task> tasks)
        {
            hideWhenEmpty = true;

            // TODO: Add a date time event watcher so that when we rollover to
            // a new day, we can update the rangeStart and rangeEnd times.  The
            // ranges will be used to determine whether tasks fit into certain
            // groups in the main TaskWindow.  Reference Tomboy's NoteOfTheDay
            // add-in for code that reacts on day changes.

            filteredTasks = CreateModel (rangeStart, rangeEnd, tasks);

            filteredTasks.ShowCompletedTasks = GtkApplication.Instance.Preferences.GetBool (
                Preferences.ShowCompletedTasksKey);
            GtkApplication.Instance.Preferences.SettingChanged += OnSettingChanged;

            // TODO: Add something to watch events so that the group will
            // automatically refilter and display/hide itself accordingly.

            //
            // Build the UI
            //

            //
            // Group Header
            //
            //			Gtk.EventBox eb = new Gtk.EventBox();
            //			eb.Show();
            //			eb.BorderWidth = 0;
            //			eb.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(211,215,199));
            //			eb.ModifyBase(Gtk.StateType.Normal, new Gdk.Color(211,215,199));
            Gtk.HBox headerHBox = new Gtk.HBox (false, 0);

            header = new Gtk.Label ();
            header.UseMarkup = true;
            header.UseUnderline = false;
            header.Markup = GetHeaderMarkup (groupName);
            header.Xalign = 0;

            header.Show ();

            //			eb.Add(header);
            //			PackStart (eb, false, false, 0);
            headerHBox.PackStart (header, false, false, 0);

            // spacer
            Gtk.Label spacerLabel = new Gtk.Label (string.Empty);
            spacerLabel.Show ();
            headerHBox.PackStart (spacerLabel, true, true, 0);

            extraWidgetHBox = new Gtk.HBox (false, 0);
            extraWidgetHBox.Show ();
            headerHBox.PackStart (extraWidgetHBox, false, false, 0);
            headerHBox.Show ();
            PackStart (headerHBox, false, false, 5);

            //
            // Group TreeView
            //
            treeView = new TaskTreeView (filteredTasks);
            treeView.Show ();
            PackStart (treeView, true, true, 0);

            treeView.NumberOfTasksChanged += OnNumberOfTasksChanged;
            treeView.RowActivated += OnRowActivated;
            treeView.ButtonPressEvent += OnButtonPressed;
        }
예제 #29
0
        protected TaskListWindow(TaskManager manager)
            : base(Catalog.GetString("To Do List"))
        {
            this.manager  = manager;
            this.IconName = "tomboy";
            this.SetDefaultSize(500, 300);
            this.sort_column = SortColumn.CompletionDate;

            AddAccelGroup(Tomboy.ActionManager.UI.AccelGroup);

            action_group = new Gtk.ActionGroup("TaskList");
            action_group.Add(new Gtk.ActionEntry [] {
                new Gtk.ActionEntry("TaskListFileMenuAction", null,
                                    Catalog.GetString("_File"), null, null, null),

                new Gtk.ActionEntry("NewTaskAction", Gtk.Stock.New,
                                    Catalog.GetString("New _Task"), "<Control>T",
                                    Catalog.GetString("Create a new task"), null),

                new Gtk.ActionEntry("OpenTaskAction", String.Empty,
                                    Catalog.GetString("_Options..."), "<Control>O",
                                    Catalog.GetString("Open the selected task"), null),

                new Gtk.ActionEntry("CloseTaskListWindowAction", Gtk.Stock.Close,
                                    Catalog.GetString("_Close"), "<Control>W",
                                    Catalog.GetString("Close this window"), null),

                new Gtk.ActionEntry("TaskListEditMenuAction", null,
                                    Catalog.GetString("_Edit"), null, null, null),

                new Gtk.ActionEntry("DeleteTaskAction", Gtk.Stock.Preferences,
                                    Catalog.GetString("_Delete"), "Delete",
                                    Catalog.GetString("Delete the selected task"), null),

                new Gtk.ActionEntry("OpenOriginNoteAction", null,
                                    Catalog.GetString("Open Associated _Note"), null,
                                    Catalog.GetString("Open the note containing the task"), null),

                new Gtk.ActionEntry("TaskListViewMenuAction", null,
                                    Catalog.GetString("_View"), null, null, null),

                new Gtk.ActionEntry("TaskListHelpMenuAction", null,
                                    Catalog.GetString("_Help"), null, null, null),

                new Gtk.ActionEntry("ShowTaskHelpAction", Gtk.Stock.Help,
                                    Catalog.GetString("_Contents"), "F1",
                                    Catalog.GetString("Tasks Help"), null)
            });

            action_group.Add(new Gtk.ToggleActionEntry [] {
                new Gtk.ToggleActionEntry("ShowCompletedTasksAction", null,
                                          Catalog.GetString("Show _Completed Tasks"), null,
                                          Catalog.GetString("Show completed tasks in the list"), null, true),

                new Gtk.ToggleActionEntry("ShowDueDateColumnAction", null,
                                          Catalog.GetString("Show _Due Date Column"), null,
                                          Catalog.GetString("Show the due date column in the list"), null, true),

                new Gtk.ToggleActionEntry("ShowPriorityColumnAction", null,
                                          Catalog.GetString("Show _Priority Column"), null,
                                          Catalog.GetString("Show the priority column in the list"), null, true)
            });

            Tomboy.ActionManager.UI.InsertActionGroup(action_group, 0);

            menu_bar = CreateMenuBar();

            MakeTasksTree();
            tree.Show();

            // Update on changes to tasks
            TaskManager.TaskAdded         += OnTaskAdded;
            TaskManager.TaskDeleted       += OnTaskDeleted;
            TaskManager.TaskStatusChanged += OnTaskStatusChanged;

            tasks_sw                  = new Gtk.ScrolledWindow();
            tasks_sw.ShadowType       = Gtk.ShadowType.In;
            tasks_sw.VscrollbarPolicy = Gtk.PolicyType.Automatic;
            tasks_sw.HscrollbarPolicy = Gtk.PolicyType.Automatic;

            // Reign in the window size if there are notes with long
            // names, or a lot of notes...

            Gtk.Requisition tree_req = tree.SizeRequest();
            if (tree_req.Height > 420)
            {
                tasks_sw.HeightRequest = 420;
            }

            if (tree_req.Width > 480)
            {
                tasks_sw.WidthRequest = 480;
            }

            tasks_sw.Add(tree);
            tasks_sw.Show();

            task_count        = new Gtk.Label();
            task_count.Xalign = 0;
            task_count.Show();

            Gtk.HBox status_box = new Gtk.HBox(false, 8);
            status_box.PackStart(task_count, true, true, 0);
            status_box.Show();

            Gtk.VBox vbox = new Gtk.VBox(false, 8);
            vbox.BorderWidth = 6;
            vbox.PackStart(tasks_sw, true, true, 0);
            vbox.PackStart(status_box, false, false, 0);
            vbox.Show();

            // Use another VBox to place the MenuBar
            // right at thetop of the window.
            content_vbox = new Gtk.VBox(false, 0);
            content_vbox.PackStart(menu_bar, false, false, 0);
            content_vbox.PackStart(vbox, true, true, 0);
            content_vbox.Show();

            this.Add(content_vbox);
            this.DeleteEvent   += OnDelete;
            this.KeyPressEvent += OnKeyPressed;             // For Escape

            SetUpTreeModel();
        }
예제 #30
0
        public TaskGroup(string groupName, DateTime rangeStart,
                         DateTime rangeEnd, Gtk.TreeModel tasks)
        {
            hideWhenEmpty = true;

            // TODO: Add a date time event watcher so that when we rollover to
            // a new day, we can update the rangeStart and rangeEnd times.  The
            // ranges will be used to determine whether tasks fit into certain
            // groups in the main TaskWindow.  Reference Tomboy's NoteOfTheDay
            // add-in for code that reacts on day changes.

            filteredTasks = CreateModel(rangeStart, rangeEnd, tasks);

            filteredTasks.ShowCompletedTasks =
                Application.Preferences.GetBool(
                    Preferences.ShowCompletedTasksKey);
            Application.Preferences.SettingChanged += OnSettingChanged;

            // TODO: Add something to watch events so that the group will
            // automatically refilter and display/hide itself accordingly.

            //
            // Build the UI
            //

            //
            // Group Header
            //
//			Gtk.EventBox eb = new Gtk.EventBox();
//			eb.Show();
//			eb.BorderWidth = 0;
//			eb.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(211,215,199));
//			eb.ModifyBase(Gtk.StateType.Normal, new Gdk.Color(211,215,199));
            Gtk.HBox headerHBox = new Gtk.HBox(false, 0);

            header              = new Gtk.Label();
            header.UseMarkup    = true;
            header.UseUnderline = false;
            header.Markup       = GetHeaderMarkup(groupName);
            header.Xalign       = 0;

            header.Show();

//			eb.Add(header);
//			PackStart (eb, false, false, 0);
            headerHBox.PackStart(header, false, false, 0);

            // spacer
            Gtk.Label spacerLabel = new Gtk.Label(string.Empty);
            spacerLabel.Show();
            headerHBox.PackStart(spacerLabel, true, true, 0);

            extraWidgetHBox = new Gtk.HBox(false, 0);
            extraWidgetHBox.Show();
            headerHBox.PackStart(extraWidgetHBox, false, false, 0);
            headerHBox.Show();
            PackStart(headerHBox, false, false, 5);

            //
            // Group TreeView
            //
            treeView = new TaskTreeView(filteredTasks);
            treeView.Show();
            PackStart(treeView, true, true, 0);

            treeView.NumberOfTasksChanged += OnNumberOfTasksChanged;
            treeView.RowActivated         += OnRowActivated;
            treeView.ButtonPressEvent     += OnButtonPressed;
        }
예제 #31
0
		Widget CreateExceptionHeader ()
		{
			var icon = new Image (WarningIconPixbuf);
			icon.Show ();

			var hbox = new HBox (false, 12) { BorderWidth = 12 };
			hbox.PackStart (icon, false, true, 0);
			hbox.PackStart (CreateExceptionInfoHeader (), true, true, 0);
			hbox.Show ();

			return hbox;
		}
예제 #32
0
		void Build ()
		{
			Title = GettextCatalog.GetString ("Exception Caught");
			DefaultWidth = 500;
			DefaultHeight = 500;
			HeightRequest = 350;
			WidthRequest = 350;
			VBox.Foreach (VBox.Remove);
			VBox.PackStart (CreateExceptionHeader (), false, true, 0);
			paned = new VPanedThin ();
			paned.GrabAreaSize = 10;
			paned.Pack1 (CreateStackTraceTreeView (), true, false);
			paned.Pack2 (CreateExceptionValueTreeView (), true, false);
			paned.Show ();
			var vbox = new VBox (false, 0);
			var whiteBackground = new EventBox ();
			whiteBackground.Show ();
			whiteBackground.ModifyBg (StateType.Normal, Ide.Gui.Styles.PrimaryBackgroundColor.ToGdkColor ());
			whiteBackground.Add (vbox);
			hadInnerException = HasInnerException ();
			if (hadInnerException) {
				vbox.PackStart (new VBox (), false, false, 6);
				vbox.PackStart (CreateInnerExceptionMessage (), false, true, 0);
				vbox.ShowAll ();
			}
			vbox.PackStart (paned, true, true, 0);
			vbox.Show ();

			if (hadInnerException) {
				var box = new HBox ();
				box.PackStart (CreateInnerExceptionsTree (), false, false, 0);
				box.PackStart (whiteBackground, true, true, 0);
				box.Show ();
				VBox.PackStart (box, true, true, 0);
				DefaultWidth = 900;
				DefaultHeight = 700;
				WidthRequest = 550;
				HeightRequest = 450;
			} else {
				VBox.PackStart (whiteBackground, true, true, 0);
			}
			var actionArea = new HBox (false, 0) { BorderWidth = 14 };

			OnlyShowMyCodeCheckbox = new CheckButton (GettextCatalog.GetString ("_Only show my code."));
			OnlyShowMyCodeCheckbox.Toggled += OnlyShowMyCodeToggled;
			OnlyShowMyCodeCheckbox.Show ();
			OnlyShowMyCodeCheckbox.Active = DebuggingService.GetUserOptions ().ProjectAssembliesOnly;

			var alignment = new Alignment (0.0f, 0.5f, 0.0f, 0.0f) { Child = OnlyShowMyCodeCheckbox };
			alignment.Show ();

			actionArea.PackStart (alignment, true, true, 0);
			actionArea.PackStart (CreateButtonBox (), false, true, 0);
			actionArea.PackStart (new VBox (), false, true, 3); // dummy just to take extra 6px at end to make it 20pixels
			actionArea.ShowAll ();

			VBox.PackStart (actionArea, false, true, 0);
		}
예제 #33
0
파일: Util.cs 프로젝트: MrJoe/lat
        public HIGMessageDialog(Gtk.Window parent,
                                Gtk.DialogFlags flags,
                                Gtk.MessageType type,
                                Gtk.ButtonsType buttons,
                                string header,
                                string msg)
            : base()
        {
            HasSeparator = false;
            BorderWidth  = 5;
            Resizable    = false;
            Title        = "";

            VBox.Spacing      = 12;
            ActionArea.Layout = Gtk.ButtonBoxStyle.End;

            accel_group = new Gtk.AccelGroup();
            AddAccelGroup(accel_group);

            Gtk.HBox hbox = new Gtk.HBox(false, 12);
            hbox.BorderWidth = 5;
            hbox.Show();
            VBox.PackStart(hbox, false, false, 0);

            Gtk.Image image = null;

            switch (type)
            {
            case Gtk.MessageType.Error:
                image = new Gtk.Image(Gtk.Stock.DialogError,
                                      Gtk.IconSize.Dialog);
                break;

            case Gtk.MessageType.Question:
                image = new Gtk.Image(Gtk.Stock.DialogQuestion,
                                      Gtk.IconSize.Dialog);
                break;

            case Gtk.MessageType.Info:
                image = new Gtk.Image(Gtk.Stock.DialogInfo,
                                      Gtk.IconSize.Dialog);
                break;

            case Gtk.MessageType.Warning:
                image = new Gtk.Image(Gtk.Stock.DialogWarning,
                                      Gtk.IconSize.Dialog);
                break;
            }

            image.Show();
            hbox.PackStart(image, false, false, 0);

            Gtk.VBox label_vbox = new Gtk.VBox(false, 0);
            label_vbox.Show();
            hbox.PackStart(label_vbox, true, true, 0);

            string title = String.Format("<span weight='bold' size='larger'>{0}" +
                                         "</span>\n",
                                         header);

            Gtk.Label label;

            label           = new Gtk.Label(title);
            label.UseMarkup = true;
            label.Justify   = Gtk.Justification.Left;
            label.LineWrap  = true;
            label.SetAlignment(0.0f, 0.5f);
            label.Show();
            label_vbox.PackStart(label, false, false, 0);

            label           = new Gtk.Label(msg);
            label.UseMarkup = true;
            label.Justify   = Gtk.Justification.Left;
            label.LineWrap  = true;
            label.SetAlignment(0.0f, 0.5f);
            label.Show();
            label_vbox.PackStart(label, false, false, 0);

            switch (buttons)
            {
            case Gtk.ButtonsType.None:
                break;

            case Gtk.ButtonsType.Ok:
                AddButton(Gtk.Stock.Ok, Gtk.ResponseType.Ok, true);
                break;

            case Gtk.ButtonsType.Close:
                AddButton(Gtk.Stock.Close, Gtk.ResponseType.Close, true);
                break;

            case Gtk.ButtonsType.Cancel:
                AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, true);
                break;

            case Gtk.ButtonsType.YesNo:
                AddButton(Gtk.Stock.No, Gtk.ResponseType.No, false);
                AddButton(Gtk.Stock.Yes, Gtk.ResponseType.Yes, true);
                break;

            case Gtk.ButtonsType.OkCancel:
                AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, false);
                AddButton(Gtk.Stock.Ok, Gtk.ResponseType.Ok, true);
                break;
            }

            if (parent != null)
            {
                TransientFor = parent;
            }

            if ((int)(flags & Gtk.DialogFlags.Modal) != 0)
            {
                Modal = true;
            }

            if ((int)(flags & Gtk.DialogFlags.DestroyWithParent) != 0)
            {
                DestroyWithParent = true;
            }
        }
예제 #34
0
    public static void Main(string[] args)
    {
        if(args.Length != 1) {
            Console.WriteLine("Usage: gtkHelloWorld num, where num is 1, 2, or 3");
            return(1);
        }

        int which = Convert.ToInt32(args[0]);
        var window = new Window("packingdemo");
        window.DeleteEvent += Delete_Event;
        window.BorderWidth = 10;

        var box1 = new VBox(false, 0);

        switch(which) {
            case 1:
                var label = new Label("gtk_hbox_new(FALSE, 0);");
                var box2 = new HBox(false, 0);
                label.SetAlignment(0, 0);
                box1.PackStart(label, false, false, 0);
                label.Show();

                box2 = MakeBox(false, 0, false, false, 0);
                box1.PackStart(box2, false, false, 0);
                box2.Show();

                box2 = MakeBox(false, 0, true, false, 0);
                box1.PackStart(box2, false, false, 0);
                box2.Show();

                box2 = MakeBox(false, 0, true, true, 0);
                box1.PackStart(box2, false, false, 0);
                box2.Show();

                var separator = new HSeparator();

                box1.PackStart(separator, false, true, 5);
                separator.Show();

                box1 = new VBox(true, 0);
                label = new Label("gtk_hbox_new(TRUE, 0);");
                label.SetAlignment(0, 0);
                box1.PackStart(label, false, false, 0);
                label.Show();

                box2 = MakeBox(true, 0, true, true, 0);
                box1.PackStart(box2, false, false, 0);
                box2.Show();

                box2 = MakeBox(true, 0, true, true, 0);
                box1.PackStart(box2, false, false, 0);
                box2.Show();

                separator = new HSeparator();

                box1.PackStart(separator, false, true, 5);
                separator.Show();
                break;
            case 2:
                break;
        }
    }
		Gtk.Widget AddFeature (ISolutionItemFeature feature)
		{
			Gtk.HBox cbox = new Gtk.HBox ();
			CheckButton check = null;
			
			Label fl = new Label ();
			fl.Wrap = true;
			fl.WidthRequest = 630;
			fl.Markup = "<b>" + feature.Title + "</b>\n<small>" + feature.Description + "</small>";
			bool enabledByDefault = feature.GetSupportLevel (parentCombine, entry) == FeatureSupportLevel.Enabled;

			if (enabledByDefault) {
				Alignment al = new Alignment (0,0,0,0);
				al.SetPadding (6,6,6,6);
				al.Add (fl);
				cbox.PackStart (al, false, false, 0);
			}
			else {
				check = new CheckButton ();
				check.Image = fl;
				cbox.PackStart (check, false, false, 0);
				check.ModifyBg (StateType.Prelight, Style.MidColors [(int)StateType.Normal]);
				check.BorderWidth = 3;
			}
			EventBox eb = new EventBox ();
			if (!enabledByDefault) {
				eb.Realized += delegate {
					eb.GdkWindow.Cursor = handCursor;
				};
			}
			eb.ModifyBg (StateType.Normal, Style.MidColors[(int)StateType.Normal]);
			eb.Add (cbox);
			eb.ShowAll ();
			box.PackStart (eb, false, false, 0);
			
			HBox fbox = new HBox ();
			Gtk.Widget editor = feature.CreateFeatureEditor (parentCombine, entry);
			if (editor != null) {
				Label sp = new Label ("");
				sp.WidthRequest = 24;
				sp.Show ();
				fbox.PackStart (sp, false, false, 0);
				editor.Show ();
				fbox.PackStart (editor, false, false, 0);
				box.PackStart (fbox, false, false, 0);
			}
			
			if (check != null) {
				ISolutionItemFeature f = feature;
				check.Toggled += delegate {
					OnClickFeature (f, check, fbox, editor);
				};
			} else {
				fbox.Show ();
			}
			return editor;
		}
예제 #36
0
		public TaskOptionsDialog(Gtk.Window parent,
		                         Gtk.DialogFlags flags,
		                         Task task)
: base (Catalog.GetString ("Task Options"), parent, flags)
		{
			HasSeparator = false;
			//BorderWidth = 0;
			Resizable = false;
			//Decorated = false;
			this.SetDefaultSize (400, 300);
			this.task = task;

//   Frame frame = new Frame();
//   frame.Shadow = ShadowType.Out;
//   frame.Show();
//   VBox.PackStart (frame, true, true, 0);

			VBox vbox = new VBox (false, 6);
			vbox.BorderWidth = 6;
			vbox.Show ();
			VBox.PackStart (vbox, true, true, 0);
//   frame.Add (vbox);

			ActionArea.Layout = Gtk.ButtonBoxStyle.End;

			accel_group = new Gtk.AccelGroup ();
			AddAccelGroup (accel_group);

//   Gtk.Label l = new Gtk.Label (
//     string.Format (
//      "<span weight=\"bold\">{0}</span>",
//      Catalog.GetString ("Task Options")));
//   l.UseMarkup = true;
//   l.Show ();
//   vbox.PackStart (l, false, false, 0);

			///
			/// Summary
			///
			Gtk.Label l = new Label (Catalog.GetString ("_Summary:"));
			l.Xalign = 0;
			l.Show ();
			vbox.PackStart (l, false, false, 0);

			summary_entry = new Gtk.Entry ();
			l.MnemonicWidget = summary_entry;
			summary_entry.Text = task.Summary;
			summary_entry.Show ();
			vbox.PackStart (summary_entry, false, false, 0);

			///
			/// Details
			///
			l = new Label (Catalog.GetString ("_Details:"));
			l.Xalign = 0;
			l.Show ();
			vbox.PackStart (l, false, false, 0);

			details_text_view = new TextView ();
			l.MnemonicWidget = details_text_view;
			details_text_view.WrapMode = WrapMode.Word;
			details_text_view.Show ();

			ScrolledWindow sw = new ScrolledWindow ();
			sw.ShadowType = Gtk.ShadowType.EtchedIn;
			sw.Add (details_text_view);
			sw.Show ();

			vbox.PackStart (sw, true, true, 0);

			///
			/// Completion Checkbox
			///
			HBox hbox = new Gtk.HBox (false, 4);

			completed_check_button = new Gtk.CheckButton (
			        task.IsComplete ?
			        Catalog.GetString ("_Completed:") :
			        Catalog.GetString ("_Complete"));
			if (task.IsComplete)
				completed_check_button.Active = true;
			completed_check_button.UseUnderline = true;
			completed_check_button.Toggled += OnCompletedCheckButtonToggled;
			completed_check_button.Show ();
			hbox.PackStart (completed_check_button, false, false, 0);

			completed_label = new Gtk.Label (
			        task.IsComplete ?
			        GuiUtils.GetPrettyPrintDate (task.CompletionDate, true) :
			        string.Empty);
			completed_label.Xalign = 0;
			completed_label.Show ();
			hbox.PackStart (completed_label, true, true, 0);

			hbox.Show ();
			vbox.PackStart (hbox, false, false, 0);

			///
			/// Due Date
			///
			hbox = new HBox (false, 4);
			due_date_check_button = new CheckButton (Catalog.GetString ("Due Date:"));
			if (task.DueDate != DateTime.MinValue)
				due_date_check_button.Active = true;
			due_date_check_button.Toggled += OnDueDateCheckButtonToggled;
			due_date_check_button.Show ();
			hbox.PackStart (due_date_check_button, false, false, 0);

			due_date_button =
			        new Gtk.Extras.DateButton (task.DueDate, false);
			if (task.DueDate == DateTime.MinValue)
				due_date_button.Sensitive = false;
			due_date_button.Show ();
			hbox.PackStart (due_date_button, false, false, 0);

			// Spacer
			hbox.PackStart (new Gtk.Label (string.Empty), true, true, 0);

			hbox.Show ();
			vbox.PackStart (hbox, false, false, 0);

			///
			/// Priority
			///
			hbox = new HBox (false, 4);
			priority_check_button = new CheckButton (Catalog.GetString ("Priority:"));
			if (task.Priority != TaskPriority.Undefined)
				priority_check_button.Active = true;
			priority_check_button.Toggled += OnPriorityCheckButtonToggled;
			priority_check_button.Show ();
			hbox.PackStart (priority_check_button, false, false, 0);

			priority_combo_box = ComboBox.NewText ();
			priority_combo_box.AppendText (Catalog.GetString ("None"));
			priority_combo_box.AppendText (Catalog.GetString ("Low"));
			priority_combo_box.AppendText (Catalog.GetString ("Normal"));
			priority_combo_box.AppendText (Catalog.GetString ("High"));
			if (task.Priority == TaskPriority.Undefined)
				priority_combo_box.Sensitive = false;
			priority_combo_box.Active = (int) task.Priority;
			priority_combo_box.Changed += OnPriorityComboBoxChanged;
			priority_combo_box.Show ();
			hbox.PackStart (priority_combo_box, false, false, 0);

			// Spacer
			hbox.PackStart (new Gtk.Label (string.Empty), true, true, 0);
			hbox.Show ();
			vbox.PackStart (hbox, false, false, 0);

			AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, false);
			AddButton (Gtk.Stock.Save, Gtk.ResponseType.Ok, true);

//   if (parent != null)
//    TransientFor = parent;

//   if ((int) (flags & Gtk.DialogFlags.Modal) != 0)
//    Modal = true;

//   if ((int) (flags & Gtk.DialogFlags.DestroyWithParent) != 0)
//    DestroyWithParent = true;
		}
예제 #37
0
        private void Init()
        {
            sepBox = null;
            preview = false;

            rootAdd = new Gtk.EventBox ();
            rootAdd.VisibleWindow = false;
            rootAdd.CanFocus = true;
            rootAdd.DragMotion  += HandleDragMotion;
            rootAdd.DragDataReceived += HandleDragDataReceived;
            rootAdd.DragLeave  += HandleDragLeave;

            help = new Gtk.Label ("<i>" + Catalog.GetString ("Drag tags here to search for them") + "</i>");
            help.UseMarkup = true;
            help.Visible = true;

            rootBox = new HBox();
            rootBox.Add (help);
            rootBox.Show ();

            rootAdd.Child = rootBox;
            rootAdd.Show ();

            Gtk.Drag.DestSet (rootAdd, DestDefaults.All, tag_dest_target_table,
                      DragAction.Copy | DragAction.Move );

            PackEnd (rootAdd, true, true, 0);

            rootTerm = new OrTerm (null, null);
        }
예제 #38
0
        public StationEditor(DatabaseTrackInfo track)
            : base()
        {
            AccelGroup accel_group = new AccelGroup ();
            AddAccelGroup (accel_group);

            Title = String.Empty;
            SkipTaskbarHint = true;
            Modal = true;

            this.track = track;

            string title = track == null
                ? Catalog.GetString ("Add new radio station")
                : Catalog.GetString ("Edit radio station");

            BorderWidth = 6;
            DefaultResponse = ResponseType.Ok;
            Modal = true;

            ContentArea.Spacing = 6;

            HBox split_box = new HBox ();
            split_box.Spacing = 12;
            split_box.BorderWidth = 6;

            Image image = new Image ();
            image.IconSize = (int)IconSize.Dialog;
            image.IconName = "radio";
            image.Yalign = 0.0f;
            image.Show ();

            VBox main_box = new VBox ();
            main_box.BorderWidth = 5;
            main_box.Spacing = 10;

            Label header = new Label ();
            header.Markup = String.Format ("<big><b>{0}</b></big>", GLib.Markup.EscapeText (title));
            header.Xalign = 0.0f;
            header.Show ();

            Label message = new Label ();
            message.Text = Catalog.GetString ("Enter the Genre, Title and URL of the radio station you wish to add. A description is optional.");
            message.Xalign = 0.0f;
            message.Wrap = true;
            message.Show ();

            table = new Table (5, 2, false);
            table.RowSpacing = 6;
            table.ColumnSpacing = 6;

            genre_entry = ComboBoxText.NewWithEntry ();

            foreach (string genre in ServiceManager.DbConnection.QueryEnumerable<string> ("SELECT DISTINCT Genre FROM CoreTracks ORDER BY Genre")) {
                if (!String.IsNullOrEmpty (genre)) {
                    genre_entry.AppendText (genre);
                }
            }

            if (track != null && !String.IsNullOrEmpty (track.Genre)) {
                genre_entry.Entry.Text = track.Genre;
            }

            AddRow (Catalog.GetString ("Station Genre:"), genre_entry);

            name_entry        = AddEntryRow (Catalog.GetString ("Station Name:"));
            stream_entry      = AddEntryRow (Catalog.GetString ("Stream URL:"));
            creator_entry     = AddEntryRow (Catalog.GetString ("Station Creator:"));
            description_entry = AddEntryRow (Catalog.GetString ("Description:"));

            rating_entry = new RatingEntry ();
            HBox rating_box = new HBox ();
            rating_box.PackStart (rating_entry, false, false, 0);
            AddRow (Catalog.GetString ("Rating:"), rating_box);

            table.ShowAll ();

            main_box.PackStart (header, false, false, 0);
            main_box.PackStart (message, false, false, 0);
            main_box.PackStart (table, false, false, 0);
            main_box.Show ();

            split_box.PackStart (image, false, false, 0);
            split_box.PackStart (main_box, true, true, 0);
            split_box.Show ();

            ContentArea.PackStart (split_box, true, true, 0);

            Button cancel_button = new Button (Stock.Cancel);
            cancel_button.CanDefault = false;
            cancel_button.UseStock = true;
            cancel_button.Show ();
            AddActionWidget (cancel_button, ResponseType.Close);

            cancel_button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Escape,
                0, Gtk.AccelFlags.Visible);

            save_button = new Button (Stock.Save);
            save_button.CanDefault = true;
            save_button.UseStock = true;
            save_button.Sensitive = false;
            save_button.Show ();
            AddActionWidget (save_button, ResponseType.Ok);

            save_button.AddAccelerator ("activate", accel_group, (uint)Gdk.Key.Return,
                0, Gtk.AccelFlags.Visible);

            name_entry.HasFocus = true;

            if (track != null) {
                if (!String.IsNullOrEmpty (track.TrackTitle)) {
                    name_entry.Text = track.TrackTitle;
                }

                if (!String.IsNullOrEmpty (track.Uri.AbsoluteUri)) {
                    stream_entry.Text = track.Uri.AbsoluteUri;
                }

                if (!String.IsNullOrEmpty (track.Comment)) {
                    description_entry.Text = track.Comment;
                }

                if (!String.IsNullOrEmpty (track.ArtistName)) {
                    creator_entry.Text = track.ArtistName;
                }

                rating_entry.Value = track.Rating;
            }

            error_container = new Alignment (0.0f, 0.0f, 1.0f, 1.0f);
            error_container.TopPadding = 6;
            HBox error_box = new HBox ();
            error_box.Spacing = 4;

            Image error_image = new Image ();
            error_image.Stock = Stock.DialogError;
            error_image.IconSize = (int)IconSize.Menu;
            error_image.Show ();

            error = new Label ();
            error.Xalign = 0.0f;
            error.Show ();

            error_box.PackStart (error_image, false, false, 0);
            error_box.PackStart (error, true, true, 0);
            error_box.Show ();

            error_container.Add (error_box);

            table.Attach (error_container, 0, 2, 6, 7, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            genre_entry.Entry.Changed += OnFieldsChanged;
            name_entry.Changed += OnFieldsChanged;
            stream_entry.Changed += OnFieldsChanged;

            OnFieldsChanged (this, EventArgs.Empty);
        }