コード例 #1
0
ファイル: ToolboxPad.cs プロジェクト: dgjbss/MonoDevelopWin
        protected override void Initialize(IPadWindow window)
        {
            base.Initialize(window);
#if MAC
            this.window = window;
            toolbox     = new Toolbox.MacToolbox(DesignerSupport.Service.ToolboxService, window);
            widget      = new GtkNSViewHost(toolbox);

            widget.DragDataGet += Widget_DragDataGet;
            widget.DragBegin   += Widget_DragBegin;
            widget.DragEnd     += Widget_DragEnd;

            this.window.PadContentShown  += Container_PadContentShown;
            this.window.PadContentHidden += Container_PadContentHidden;

            toolbox.DragSourceSet += Toolbox_DragSourceSet;
            toolbox.DragBegin     += Toolbox_DragBegin;

            widget.ShowAll();

            toolbox.Refresh();
#else
            widget = new Toolbox.Toolbox(DesignerSupport.Service.ToolboxService, window);
#endif
        }
コード例 #2
0
ファイル: ToolboxPad.cs プロジェクト: dgjbss/MonoDevelopWin
        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();
        }
コード例 #3
0
ファイル: ToolboxPad.cs プロジェクト: wzq0621/monodevelop
        protected override void Initialize(IPadWindow window)
        {
            base.Initialize(window);
#if MAC
            this.window             = window;
            toolbox                 = new Toolbox.MacToolbox(DesignerSupport.Service.ToolboxService, window);
            widget                  = GtkMacInterop.NSViewToGtkWidget(toolbox);
            widget.CanFocus         = true;
            widget.Sensitive        = true;
            widget.KeyPressEvent   += toolbox.OnKeyPressed;
            widget.KeyReleaseEvent += toolbox.KeyReleased;

            widget.DragBegin += Widget_DragBegin;
            widget.DragEnd   += Widget_DragEnd;
            widget.Focused   += Widget_Focused;

            this.window.PadContentShown  += Container_PadContentShown;
            this.window.PadContentHidden += Container_PadContentHidden;

            toolbox.ContentFocused += Toolbox_ContentFocused;
            toolbox.DragSourceSet  += Toolbox_DragSourceSet;
            toolbox.DragBegin      += Toolbox_DragBegin;

            widget.ShowAll();
#else
            widget = new Toolbox.Toolbox(DesignerSupport.Service.ToolboxService, window);
#endif
        }
コード例 #4
0
ファイル: ToolboxPad.cs プロジェクト: wzq0621/monodevelop
        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();
        }
コード例 #5
0
        protected override void Initialize(IPadWindow container)
        {
            base.Initialize(container);
#if MAC
            toolbox                 = new Toolbox.MacToolbox(DesignerSupport.Service.ToolboxService, container);
            widget                  = GtkMacInterop.NSViewToGtkWidget(toolbox);
            widget.CanFocus         = true;
            widget.Sensitive        = true;
            widget.KeyPressEvent   += toolbox.OnKeyPressed;
            widget.KeyReleaseEvent += toolbox.KeyReleased;

            widget.DragBegin += (o, args) => {
                if (!isDragging)
                {
                    DesignerSupport.Service.ToolboxService.DragSelectedItem(widget, args.Context);
                    isDragging = true;
                }
            };

            widget.DragEnd += (o, args) => {
                isDragging = false;
            };

            widget.Focused += (s, e) => {
                toolbox.FocusSelectedView();
            };

            toolbox.ContentFocused += (s, e) => {
                if (!widget.HasFocus)
                {
                    widget.HasFocus = true;
                    toolbox.FocusSelectedView();
                }
            };
            toolbox.DragSourceSet += (s, e) => {
                targets = new Gtk.TargetList();
                targets.AddTable(e);
            };
            toolbox.DragBegin += (object sender, EventArgs e) => {
                if (!isDragging)
                {
                    Gtk.Drag.SourceUnset(widget);

                    // Gtk.Application.CurrentEvent and other copied gdk_events seem to have a problem
                    // when used as they use gdk_event_copy which seems to crash on de-allocating the private slice.
                    IntPtr currentEvent = GtkWorkarounds.GetCurrentEventHandle();
                    Gtk.Drag.Begin(widget, targets, Gdk.DragAction.Copy | Gdk.DragAction.Move, 1, new Gdk.Event(currentEvent));

                    // gtk_drag_begin does not store the event, so we're okay
                    GtkWorkarounds.FreeEvent(currentEvent);
                }
            };

            widget.ShowAll();
#else
            widget = new Toolbox.Toolbox(DesignerSupport.Service.ToolboxService, container);
#endif
        }
コード例 #6
0
ファイル: ToolboxPad.cs プロジェクト: alinen/monodevelop
 public override void Dispose()
 {
     if (widget != null)
     {
         widget.KeyPressEvent   -= toolbox.OnKeyPressed;
         widget.KeyReleaseEvent -= toolbox.KeyReleased;
         widget.Destroy();
         widget.Dispose();
         widget = null;
     }
     if (toolbox != null)
     {
         toolbox.Dispose();
         toolbox = null;
     }
     base.Dispose();
 }