public void ReplaceVScrollBar(Gtk.Widget widget)
 {
     if (vScrollBar != null)
     {
         vScrollBar.Unparent();
         vScrollBar.Destroy();
     }
     this.vScrollBar        = widget;
     this.vScrollBar.Parent = this;
     this.vScrollBar.Show();
 }
예제 #2
0
        public override void Dispose()
        {
            content.ContentChanged -= new EventHandler(OnTextContentChanged);
            content.DirtyChanged   -= new EventHandler(OnTextDirtyChanged);
            IdeApp.Workbench.ActiveDocumentChanged -= new EventHandler(OnActiveDocumentChanged);
            content.Dispose();

            // Remove and destroy the contents of the Notebook, since the destroy event is
            // not propagated to pages in some gtk versions.

            foreach (Gtk.Widget cw in notebook.Children)
            {
                Gtk.Widget lw = notebook.GetTabLabel(cw);
                notebook.Remove(cw);
                cw.Destroy();
                if (lw != null)
                {
                    lw.Destroy();
                }
            }
            content = null;
            box     = null;

            base.Dispose();
        }
예제 #3
0
        void EndEditing()
        {
            if (editSession != null)
            {
                bool cancel = editSession.CancelChanges;

                Remove(currentEditor);
                currentEditor.Destroy();
                currentEditor = null;

                if (editSession != null)
                {
                    editSession.Dispose();
                }

                editSession      = null;
                currentEditorRow = null;

                if (!cancel)
                {
                    SetSelection(null);
                }

                QueueDraw();

                if (EndedEdit != null)
                {
                    EndedEdit.Invoke(this, new PropertyGrid.EndedEditEventArgs {
                        Canceled = cancel
                    });
                }
            }
        }
예제 #4
0
        void ShowMenu()
        {
            if (hoverIndex < 0)
            {
                return;
            }

            Gtk.Widget widget = createMenuForItem(hoverIndex);
            if (widget == null)
            {
                return;
            }
            widget.Hidden += delegate {
                menuVisible = false;
                QueueDraw();

                //FIXME: for some reason the menu's children don't get activated if we destroy
                //directly here, so use a timeout to delay it
                GLib.Timeout.Add(100, delegate {
                    widget.Destroy();
                    return(false);
                });
            };
            menuVisible = true;
            if (widget is Menu)
            {
                ((Menu)widget).Popup(null, null, PositionFunc, 0, Gtk.Global.CurrentEventTime);
            }
            else
            {
                PositionWidget(widget);
                widget.ShowAll();
            }
        }
예제 #5
0
        public override void DefaultDispose(object target)
        {
            /*IDisposable disp = target as IDisposable;
             * if (disp != null)
             *  disp.Dispose();*/

            DriverWidget dw = target as DriverWidget;

            if (dw != null)
            {
                Gtk.Widget w = dw.NativeObject as Gtk.Widget;
                if (w != null)
                {
                    w.Destroy();
                    w.Dispose();
                }
            }
            else
            {
                IDisposable di = target as IDisposable;
                if (di != null)
                {
                    di.Dispose();
                }
            }
        }
예제 #6
0
        public override void Dispose()
        {
            if (window != null)
            {
                window.PadContentShown  -= Container_PadContentShown;
                window.PadContentHidden -= Container_PadContentHidden;
                window = null;
            }

            if (widget != null)
            {
                widget.DragDataGet -= Widget_DragDataGet;
                widget.DragBegin   -= Widget_DragBegin;
                widget.DragEnd     -= Widget_DragEnd;
                widget.Destroy();
                widget.Dispose();
                widget = null;
            }
            if (toolbox != null)
            {
                toolbox.DragBegin     -= Toolbox_DragBegin;
                toolbox.DragSourceSet -= Toolbox_DragSourceSet;
                toolbox.Dispose();
                toolbox = null;
            }
            base.Dispose();
        }
예제 #7
0
        public override void Dispose()
        {
            if (window != null)
            {
                window.PadContentShown  -= Container_PadContentShown;
                window.PadContentHidden -= Container_PadContentHidden;
                window = null;
            }

            if (widget != null)
            {
                widget.DragBegin       -= Widget_DragBegin;
                widget.DragEnd         -= Widget_DragEnd;
                widget.Focused         -= Widget_Focused;
                widget.KeyPressEvent   -= toolbox.OnKeyPressed;
                widget.KeyReleaseEvent -= toolbox.KeyReleased;
                widget.Destroy();
                widget.Dispose();
                widget = null;
            }
            if (toolbox != null)
            {
                toolbox.ContentFocused -= Toolbox_ContentFocused;
                toolbox.DragBegin      -= Toolbox_DragBegin;
                toolbox.DragSourceSet  -= Toolbox_DragSourceSet;
                toolbox.Dispose();
                toolbox = null;
            }
            base.Dispose();
        }
예제 #8
0
 public void ClearChild()
 {
     if (Child != null)
     {
         Gtk.Widget w = Child;
         Remove(w);
         w.Destroy();
     }
 }
예제 #9
0
            public void SetLabel(Gtk.Widget page, Gdk.Pixbuf icon, string label)
            {
                Pango.EllipsizeMode oldMode = Pango.EllipsizeMode.End;

                this.page = page;
                if (Child != null)
                {
                    if (labelWidget != null)
                    {
                        oldMode = labelWidget.Ellipsize;
                    }
                    Gtk.Widget oc = Child;
                    Remove(oc);
                    oc.Destroy();
                }

                Gtk.HBox box = new HBox();
                box.Spacing = 2;

                if (icon != null)
                {
                    tabIcon = new Gtk.Image(icon);
                    tabIcon.Show();
                    box.PackStart(tabIcon, false, false, 0);
                }
                else
                {
                    tabIcon = null;
                }

                if (!string.IsNullOrEmpty(label))
                {
                    labelWidget           = new Gtk.Label(label);
                    labelWidget.UseMarkup = true;
                    labelWidget.Xalign    = 0;
                    box.PackStart(labelWidget, true, true, 0);
                }
                else
                {
                    labelWidget = null;
                }

                Add(box);

                // Get the required size before setting the ellipsize property, since ellipsized labels
                // have a width request of 0
                ShowAll();
                labelWidth = SizeRequest().Width;

                if (labelWidget != null)
                {
                    labelWidget.Ellipsize = oldMode;
                }
                UpdateVisualStyle();
            }
        void UpdateBuilderEditor()
        {
            if (currentEditor != null)
            {
                editorBox.Remove(currentEditor);
                currentEditor.Destroy();
            }

            currentEditor   = new PackageBuilderEditor(currentBuilder);
            editorBox.Child = currentEditor;
            editorBox.ShowAll();
        }
 public void RemoveButton(int npage)
 {
     if (notebook == null)
     {
         return;
     }
     notebook.RemovePage(npage);
     Gtk.Widget cw = Children [npage];
     Remove(cw);
     cw.Destroy();
     ShowPage(0);
 }
예제 #12
0
 public void RemoveButton(int npage)
 {
     if (npage >= toolbar.Children.Length)
     {
         return;
     }
     notebook.RemovePage(npage);
     Gtk.Widget cw = toolbar.Children [npage];
     toolbar.Remove(cw);
     cw.Destroy();
     ShowPage(0);
 }
예제 #13
0
 void EndEditing()
 {
     if (editSession != null)
     {
         Remove(currentEditor);
         currentEditor.Destroy();
         editSession.Dispose();
         editSession      = null;
         currentEditorRow = null;
         QueueDraw();
     }
 }
예제 #14
0
파일: MainWindow.cs 프로젝트: bwn13/ad
		private void addPage (Widget widget, string label) {
		HBox hBox = new HBox ();
		hBox.Add(new Label (label));
		Button button = new Button (new Image (Stock.Cancel, IconSize.Button ));
		hBox.Add (button);
		hBox.ShowAll();
		notebook1.AppendPage (widget, new Label(label));

		button.Clicked += delegate {
			widget.Destroy ();
		};

		}
예제 #15
0
 void DisposeEditor()
 {
     if (currentEditor != null)
     {
         if (currentEditor is NodeEditorWidget)
         {
             ((NodeEditorWidget)currentEditor).Save();
         }
         editorBox.Remove(currentEditor);
         currentEditor.Destroy();
         currentEditor = null;
     }
 }
예제 #16
0
 internal void EndEditing()
 {
     if (editSession != null)
     {
         Remove(currentEditor);
         currentEditor.Destroy();
         currentEditor = null;
         editSession.Dispose();
         editSession      = null;
         currentEditorRow = null;
         parentGrid.Populate(saveEditSession: false);
         QueueDraw();
     }
 }
예제 #17
0
        private void AddPage(Widget widget)
        {
            HBox hbox = new HBox();
            hbox.PackStart(new Label("Label"));
            Button closeButton = new Button("X");
            closeButton.Relief = ReliefStyle.None;
            closeButton.FocusOnClick = false;
            closeButton.Clicked += delegate {
                hbox.Destroy();
                widget.Destroy();
            };

            hbox.PackStart(closeButton);
            hbox.ShowAll();
            notebook.AppendPage(widget, hbox);
            notebook.ShowAll();
        }
예제 #18
0
		static void TableRemoveRow (Table table, uint row, Widget column1, Widget column2, bool destroy)
		{
			uint rows = table.NRows;
			
			foreach (var child in table.Children) {
				var tr = (Table.TableChild) table[child];
				uint bottom = tr.BottomAttach;
				uint top = tr.TopAttach;
				
				if (top >= row && top < rows) {
					tr.BottomAttach = bottom - 1;
					tr.TopAttach = top - 1;
				}
			}
			
			if (column1 != null) {
				table.Remove (column1);
				if (destroy)
					column1.Destroy ();
			}
			
			if (column2 != null) {
				table.Remove (column2);
				if (destroy)
					column2.Destroy ();
			}
			
			table.NRows--;
		}
예제 #19
0
        public void SetLabel(Gtk.Widget page, Xwt.Drawing.Image icon, string label)
        {
            string labelNoSpaces = label != null?label.Replace(' ', '-') : null;

            this.label = label;
            this.page  = page;
            if (Child != null)
            {
                Gtk.Widget oc = Child;
                Remove(oc);
                oc.Destroy();
            }

            if (label != null)
            {
                Accessible.Name        = $"DockTab.{labelNoSpaces}";
                Accessible.Description = GettextCatalog.GetString("Switch to the {0} tab", label);
                Accessible.SetTitle(label);
                Accessible.SetLabel(label);
            }

            Gtk.HBox box = new HBox();
            box.Accessible.SetShouldIgnore(true);
            box.Spacing = -2;

            if (icon == null)
            {
                icon = ImageService.GetIcon("md-empty");
            }

            tabIcon = new ImageView(icon);
            tabIcon.Accessible.SetShouldIgnore(true);
            tabIcon.Show();
            box.PackStart(tabIcon, false, false, 3);

            if (!string.IsNullOrEmpty(label))
            {
                labelWidget = new ExtendedLabel(label);
                // Ignore the label because the title tab already contains its name
                labelWidget.Accessible.SetShouldIgnore(true);
                labelWidget.UseMarkup = true;
                labelWidget.Name      = label;
                var alignLabel = new Alignment(0.0f, 0.5f, 1, 1);
                alignLabel.Accessible.SetShouldIgnore(true);
                alignLabel.BottomPadding = 0;
                alignLabel.RightPadding  = 15;
                alignLabel.Add(labelWidget);
                box.PackStart(alignLabel, false, false, 0);
            }
            else
            {
                labelWidget = null;
            }

            btnDock             = new ImageButton();
            btnDock.Image       = pixAutoHide;
            btnDock.TooltipText = GettextCatalog.GetString("Auto Hide");
            btnDock.CanFocus    = false;
//			btnDock.WidthRequest = btnDock.HeightRequest = 17;
            btnDock.Clicked          += OnClickDock;
            btnDock.ButtonPressEvent += (o, args) => args.RetVal = true;
            btnDock.WidthRequest      = btnDock.SizeRequest().Width;
            btnDock.Name              = string.Format("btnDock_{0}", labelNoSpaces ?? string.Empty);
            UpdateDockButtonAccessibilityLabels();

            btnClose             = new ImageButton();
            btnClose.Image       = pixClose;
            btnClose.TooltipText = GettextCatalog.GetString("Close");
            btnClose.CanFocus    = false;
//			btnClose.WidthRequest = btnClose.HeightRequest = 17;
            btnClose.WidthRequest = btnDock.SizeRequest().Width;
            btnClose.Clicked     += delegate {
                item.Visible = false;
            };
            btnClose.ButtonPressEvent += (o, args) => args.RetVal = true;
            btnClose.Name              = string.Format("btnClose_{0}", labelNoSpaces ?? string.Empty);
            string realLabel, realHelp;

            if (string.IsNullOrEmpty(label))
            {
                realLabel = GettextCatalog.GetString("Close pad");
                realHelp  = GettextCatalog.GetString("Close the pad");
            }
            else
            {
                realLabel = GettextCatalog.GetString("Close {0}", label);
                realHelp  = GettextCatalog.GetString("Close the {0} pad", label);
            }
            btnClose.Accessible.SetLabel(realLabel);
            btnClose.Accessible.Description = realHelp;

            Gtk.Alignment al = new Alignment(0, 0.5f, 1, 1);
            al.Accessible.SetShouldIgnore(true);
            HBox btnBox = new HBox(false, 0);

            btnBox.Accessible.SetShouldIgnore(true);
            btnBox.PackStart(btnDock, false, false, 3);
            btnBox.PackStart(btnClose, false, false, 1);
            al.Add(btnBox);
            box.PackEnd(al, false, false, 3);

            Add(box);

            // Get the required size before setting the ellipsize property, since ellipsized labels
            // have a width request of 0
            box.ShowAll();
            Show();

            minWidth = tabIcon.SizeRequest().Width + al.SizeRequest().Width + 10;

            UpdateBehavior();
            UpdateVisualStyle();
        }
        public void SetLabel(Gtk.Widget page, Gdk.Pixbuf icon, string label)
        {
            this.label = label;
            this.page  = page;
            if (Child != null)
            {
                Gtk.Widget oc = Child;
                Remove(oc);
                oc.Destroy();
            }

            Gtk.HBox box = new HBox();
            box.Spacing = 2;

            if (icon != null)
            {
                tabIcon = new Gtk.Image(icon);
                tabIcon.Show();
                box.PackStart(tabIcon, false, false, 0);
            }
            else
            {
                tabIcon = null;
            }

            if (!string.IsNullOrEmpty(label))
            {
                labelWidget = new ExtendedLabel(label);
                labelWidget.DropShadowVisible = true;
                labelWidget.UseMarkup         = true;
                box.PackStart(labelWidget, true, true, 0);
            }
            else
            {
                labelWidget = null;
            }

            btnDock             = new ImageButton();
            btnDock.Image       = pixAutoHide;
            btnDock.TooltipText = GettextCatalog.GetString("Auto Hide");
            btnDock.CanFocus    = false;
//			btnDock.WidthRequest = btnDock.HeightRequest = 17;
            btnDock.Clicked          += OnClickDock;
            btnDock.ButtonPressEvent += (o, args) => args.RetVal = true;
            btnDock.WidthRequest      = btnDock.SizeRequest().Width;

            btnClose             = new ImageButton();
            btnClose.Image       = pixClose;
            btnClose.TooltipText = GettextCatalog.GetString("Close");
            btnClose.CanFocus    = false;
//			btnClose.WidthRequest = btnClose.HeightRequest = 17;
            btnClose.WidthRequest = btnDock.SizeRequest().Width;
            btnClose.Clicked     += delegate {
                item.Visible = false;
            };
            btnClose.ButtonPressEvent += (o, args) => args.RetVal = true;

            Gtk.Alignment al     = new Alignment(0, 0, 1, 1);
            HBox          btnBox = new HBox(false, 3);

            btnBox.PackStart(btnDock, false, false, 0);
            btnBox.PackStart(btnClose, false, false, 0);
            al.Add(btnBox);
            al.LeftPadding = 3;
            al.TopPadding  = 1;
            box.PackEnd(al, false, false, 0);

            Add(box);

            // Get the required size before setting the ellipsize property, since ellipsized labels
            // have a width request of 0
            box.ShowAll();
            Show();

            UpdateBehavior();
            UpdateVisualStyle();
        }
        public void SetTitle(Gtk.Widget page, Gdk.Pixbuf icon, string label)
        {
            this.label = label;
            this.page  = page;
            if (Child != null)
            {
                Gtk.Widget oc = Child; // keep a handle to the Child widget to prevent it from being garbage collected
                Remove(oc);            // remove Child from parent. After this, Child==null

                oc.Destroy();          // now that no reference from the parent points to the child anymore, destroy it.
                //oc.Dispose();          // not sure if this is additionally needed to .Destroy()
            }

            Gtk.HBox box = new HBox();
            box.Spacing = 2;

            if (icon != null)
            {
                tabIcon = new Gtk.Image(icon);
                tabIcon.Show();
                box.PackStart(tabIcon, false, false, 0);
            }
            else
            {
                tabIcon = null;
            }

            if (!string.IsNullOrEmpty(label))
            {
                labelWidget = new ExtendedLabel(label);
                labelWidget.DropShadowVisible = true;
                labelWidget.UseMarkup         = true;
                box.PackStart(labelWidget, true, true, 0);
            }
            else
            {
                labelWidget = null;
            }

            btnDock             = new ImageButton();
            btnDock.Image       = pixAutoHide;
            btnDock.TooltipText = "Minimize"; // previous text "Auto Hide" was misleading
            btnDock.CanFocus    = false;
//       btnDock.WidthRequest = btnDock.HeightRequest = 17;
            btnDock.Clicked          += OnClickDock;
            btnDock.ButtonPressEvent += (o, args) => args.RetVal = true;
            btnDock.WidthRequest      = btnDock.SizeRequest().Width;

            btnClose             = new ImageButton();
            btnClose.Image       = pixClose;
            btnClose.TooltipText = "Close";
            btnClose.CanFocus    = false;
//       btnClose.WidthRequest = btnClose.HeightRequest = 17;
            btnClose.WidthRequest      = btnDock.SizeRequest().Width;
            btnClose.Clicked          += delegate { item.Close(); };
            btnClose.ButtonPressEvent += (o, args) => args.RetVal = true;

            Gtk.Alignment al     = new Alignment(0, 0, 1, 1);
            HBox          btnBox = new HBox(false, 3);

            btnBox.PackStart(btnDock, false, false, 0);
            btnBox.PackStart(btnClose, false, false, 0);
            al.Add(btnBox);
            al.LeftPadding = 3;
            al.TopPadding  = 1;
            box.PackEnd(al, false, false, 0);

            Add(box);

            // Get the required size before setting the ellipsize property, since ellipsized labels
            // have a width request of 0
            box.ShowAll();
            Show();

            UpdateBehavior();
            UpdateVisualStyle();
        }
예제 #22
0
        public void SetLabel(Gtk.Widget page, Xwt.Drawing.Image icon, string label)
        {
            this.label = label;
            this.page  = page;
            if (Child != null)
            {
                Gtk.Widget oc = Child;
                Remove(oc);
                oc.Destroy();
            }

            Gtk.HBox box = new HBox();
            box.Spacing = -2;

            if (icon == null)
            {
                icon = ImageService.GetIcon("md-empty");
            }

            tabIcon = new ImageView(icon);
            tabIcon.Show();
            box.PackStart(tabIcon, false, false, 3);

            if (!string.IsNullOrEmpty(label))
            {
                labelWidget           = new ExtendedLabel(label);
                labelWidget.UseMarkup = true;
                labelWidget.Name      = label;
                var alignLabel = new Alignment(0.0f, 0.5f, 1, 1);
                alignLabel.BottomPadding = 0;
                alignLabel.RightPadding  = 15;
                alignLabel.Add(labelWidget);
                box.PackStart(alignLabel, false, false, 0);
            }
            else
            {
                labelWidget = null;
            }

            btnDock             = new ImageButton();
            btnDock.Image       = pixAutoHide;
            btnDock.TooltipText = GettextCatalog.GetString("Auto Hide");
            btnDock.CanFocus    = false;
//			btnDock.WidthRequest = btnDock.HeightRequest = 17;
            btnDock.Clicked          += OnClickDock;
            btnDock.ButtonPressEvent += (o, args) => args.RetVal = true;
            btnDock.WidthRequest      = btnDock.SizeRequest().Width;
            btnDock.Name              = string.Format("btnDock_{0}", label ?? string.Empty);

            btnClose             = new ImageButton();
            btnClose.Image       = pixClose;
            btnClose.TooltipText = GettextCatalog.GetString("Close");
            btnClose.CanFocus    = false;
//			btnClose.WidthRequest = btnClose.HeightRequest = 17;
            btnClose.WidthRequest = btnDock.SizeRequest().Width;
            btnClose.Clicked     += delegate {
                item.Visible = false;
            };
            btnClose.ButtonPressEvent += (o, args) => args.RetVal = true;
            btnClose.Name              = string.Format("btnClose_{0}", label ?? string.Empty);

            Gtk.Alignment al     = new Alignment(0, 0.5f, 1, 1);
            HBox          btnBox = new HBox(false, 0);

            btnBox.PackStart(btnDock, false, false, 3);
            btnBox.PackStart(btnClose, false, false, 1);
            al.Add(btnBox);
            box.PackEnd(al, false, false, 3);

            Add(box);

            // Get the required size before setting the ellipsize property, since ellipsized labels
            // have a width request of 0
            box.ShowAll();
            Show();

            UpdateBehavior();
            UpdateVisualStyle();
        }
		void RemoveFromTable (Widget widget)
		{
			configurationTable.Remove (widget);
			widget.Destroy ();
		}
예제 #24
0
 void DestroyPanel(Widget panel)
 {
     if (panel is IPanel) {
         (panel as IPanel).BackEvent -= BackClicked;
     }
     panel.Destroy ();
     panel.Dispose ();
     System.GC.Collect ();
 }