~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.DesignerSupport/MonoDevelop.DesignerSupport.Toolbox/Toolbox.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* 
2
 
 * Toolbox.cs - A toolbox widget
3
 
 * 
4
 
 * Authors: 
5
 
 *  Michael Hutchinson <m.j.hutchinson@gmail.com>
6
 
 *  
7
 
 * Copyright (C) 2005 Michael Hutchinson
8
 
 *
9
 
 * This sourcecode is licenced under The MIT License:
10
 
 * 
11
 
 * Permission is hereby granted, free of charge, to any person obtaining
12
 
 * a copy of this software and associated documentation files (the
13
 
 * "Software"), to deal in the Software without restriction, including
14
 
 * without limitation the rights to use, copy, modify, merge, publish,
15
 
 * distribute, sublicense, and/or sell copies of the Software, and to permit
16
 
 * persons to whom the Software is furnished to do so, subject to the
17
 
 * following conditions:
18
 
 * 
19
 
 * The above copyright notice and this permission notice shall be included in
20
 
 * all copies or substantial portions of the Software.
21
 
 *
22
 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23
 
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24
 
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
25
 
 * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
26
 
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
27
 
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
28
 
 * USE OR OTHER DEALINGS IN THE SOFTWARE.
 
1
/* 
 
2
 * Toolbox.cs - A toolbox widget
 
3
 * 
 
4
 * Authors: 
 
5
 *  Michael Hutchinson <m.j.hutchinson@gmail.com>
 
6
 *  
 
7
 * Copyright (C) 2005 Michael Hutchinson
 
8
 *
 
9
 * This sourcecode is licenced under The MIT License:
 
10
 * 
 
11
 * Permission is hereby granted, free of charge, to any person obtaining
 
12
 * a copy of this software and associated documentation files (the
 
13
 * "Software"), to deal in the Software without restriction, including
 
14
 * without limitation the rights to use, copy, modify, merge, publish,
 
15
 * distribute, sublicense, and/or sell copies of the Software, and to permit
 
16
 * persons to whom the Software is furnished to do so, subject to the
 
17
 * following conditions:
 
18
 * 
 
19
 * The above copyright notice and this permission notice shall be included in
 
20
 * all copies or substantial portions of the Software.
 
21
 *
 
22
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 
23
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
24
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
 
25
 * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
 
26
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 
27
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
 
28
 * USE OR OTHER DEALINGS IN THE SOFTWARE.
29
29
 */
30
30
 
31
 
using System;
32
 
using System.Linq;
33
 
using System.Collections.Generic;
 
31
using System;
 
32
using System.Linq;
 
33
using System.Collections.Generic;
34
34
using Gtk;
35
 
using System.Drawing.Design;
 
35
using System.Drawing.Design;
36
36
using MonoDevelop.Core;
37
37
using MonoDevelop.Ide.Gui;
38
 
using MonoDevelop.Components.Commands;
39
 
using MonoDevelop.Components.Docking;
40
 
using MonoDevelop.Ide;
41
 
using Mono.TextEditor;
42
 
 
43
 
namespace MonoDevelop.DesignerSupport.Toolbox
 
38
using MonoDevelop.Components.Commands;
 
39
using MonoDevelop.Components.Docking;
 
40
using MonoDevelop.Ide;
 
41
using Mono.TextEditor;
 
42
using MonoDevelop.Components;
 
43
 
 
44
namespace MonoDevelop.DesignerSupport.Toolbox
44
45
{
45
46
        public class Toolbox : VBox, IPropertyPadProvider, IToolboxConfiguration
46
47
        {
51
52
                
52
53
                ToolboxWidget toolboxWidget;
53
54
                ScrolledWindow scrolledWindow;
54
 
                
55
 
                ToggleButton filterToggleButton;
 
55
                
56
56
                ToggleButton catToggleButton;
57
57
                ToggleButton compactModeToggleButton;
58
 
                Entry filterEntry;
59
 
                bool filterVisible;
60
 
                MonoDevelop.Ide.Gui.PadFontChanger fontChanger;
61
 
                IPadWindow container;
62
 
                Dictionary<string,int> categoryPriorities = new Dictionary<string, int> ();
63
 
                Button toolboxAddButton;
 
58
                SearchEntry filterEntry;
 
59
                MonoDevelop.Ide.Gui.PadFontChanger fontChanger;
 
60
                IPadWindow container;
 
61
                Dictionary<string,int> categoryPriorities = new Dictionary<string, int> ();
 
62
                Button toolboxAddButton;
64
63
                
65
 
                public Toolbox (ToolboxService toolboxService, IPadWindow container)
66
 
                {                       
67
 
                        this.toolboxService = toolboxService;
 
64
                public Toolbox (ToolboxService toolboxService, IPadWindow container)
 
65
                {                       
 
66
                        this.toolboxService = toolboxService;
68
67
                        this.container = container;
69
68
                        
70
69
                        #region Toolbar
71
70
                        DockItemToolbar toolbar = container.GetToolbar (PositionType.Top);
72
 
                
73
 
                        filterToggleButton = new ToggleButton ();
74
 
                        filterToggleButton.Image = new Image (Gtk.Stock.Find, IconSize.Menu);
75
 
                        filterToggleButton.Toggled += new EventHandler (toggleFiltering);
76
 
                        filterToggleButton.TooltipText = GettextCatalog.GetString ("Show search box");
77
 
                        toolbar.Add (filterToggleButton);
 
71
                
 
72
                        filterEntry = new SearchEntry();
 
73
                        filterEntry.Ready = true;
 
74
                        filterEntry.HasFrame = true;
 
75
                        filterEntry.WidthRequest = 150;
 
76
                        filterEntry.Changed += new EventHandler (filterTextChanged);
 
77
                        filterEntry.Show ();
 
78
 
 
79
                        toolbar.Add (filterEntry, true);
78
80
                        
79
81
                        catToggleButton = new ToggleButton ();
80
 
                        catToggleButton.Image = new Image (ImageService.GetPixbuf ("md-design-categorise", IconSize.Menu));
81
 
                        catToggleButton.Toggled += new EventHandler (toggleCategorisation);
82
 
                        catToggleButton.TooltipText = GettextCatalog.GetString ("Show categories");
 
82
                        catToggleButton.Image = new Image (ImageService.GetPixbuf ("md-design-categorise", IconSize.Menu));
 
83
                        catToggleButton.Toggled += new EventHandler (toggleCategorisation);
 
84
                        catToggleButton.TooltipText = GettextCatalog.GetString ("Show categories");
83
85
                        toolbar.Add (catToggleButton);
84
86
                        
85
87
                        compactModeToggleButton = new ToggleButton ();
86
 
                        compactModeToggleButton.Image = new Image (ImageService.GetPixbuf ("md-design-listboxtoggle", IconSize.Menu));
87
 
                        compactModeToggleButton.Toggled += new EventHandler (ToggleCompactMode);
 
88
                        compactModeToggleButton.Image = new Image (ImageService.GetPixbuf ("md-design-listboxtoggle", IconSize.Menu));
 
89
                        compactModeToggleButton.Toggled += new EventHandler (ToggleCompactMode);
88
90
                        compactModeToggleButton.TooltipText = GettextCatalog.GetString ("Use compact display");
89
91
                        toolbar.Add (compactModeToggleButton);
90
 
        
91
 
                        VSeparator sep = new VSeparator ();
92
 
                        toolbar.Add (sep);
93
 
                        
94
 
                        toolboxAddButton = new Button (new Gtk.Image (Gtk.Stock.Add, IconSize.Menu));
95
 
                        toolbar.Add (toolboxAddButton);
96
 
                        toolboxAddButton.TooltipText = GettextCatalog.GetString ("Add toolbox items");
97
 
                        toolboxAddButton.Clicked += new EventHandler (toolboxAddButton_Clicked);
 
92
        
 
93
                        toolboxAddButton = new Button (new Gtk.Image (Gtk.Stock.Add, IconSize.Menu));
 
94
                        toolbar.Add (toolboxAddButton);
 
95
                        toolboxAddButton.TooltipText = GettextCatalog.GetString ("Add toolbox items");
 
96
                        toolboxAddButton.Clicked += new EventHandler (toolboxAddButton_Clicked);
98
97
                        toolbar.ShowAll ();
99
 
                        
100
 
                        filterEntry = new Entry();
101
 
                        filterEntry.WidthRequest = 150;
102
 
                        filterEntry.Changed += new EventHandler (filterTextChanged);
103
 
                        
 
98
 
104
99
                        #endregion
105
100
                        
106
101
                        toolboxWidget = new ToolboxWidget ();
107
102
                        toolboxWidget.SelectedItemChanged += delegate {
108
 
                                selectedNode = this.toolboxWidget.SelectedItem != null ? this.toolboxWidget.SelectedItem.Tag as ItemToolboxNode : null;
 
103
                                selectedNode = this.toolboxWidget.SelectedItem != null ? this.toolboxWidget.SelectedItem.Tag as ItemToolboxNode : null;
109
104
                                toolboxService.SelectItem (selectedNode);
110
105
                        };
111
 
                        this.toolboxWidget.DragBegin += delegate(object sender, Gtk.DragBeginArgs e) {
112
 
                                
113
 
                                if (this.toolboxWidget.SelectedItem != null) {
114
 
                                        this.toolboxWidget.HideTooltipWindow ();
115
 
                                        toolboxService.DragSelectedItem (this.toolboxWidget, e.Context);
116
 
                                }
117
 
                        };
118
 
                        this.toolboxWidget.ActivateSelectedItem += delegate {
119
 
                                toolboxService.UseSelectedItem ();
120
 
                        };
121
 
                        
122
 
                        fontChanger = new MonoDevelop.Ide.Gui.PadFontChanger (toolboxWidget, toolboxWidget.SetCustomFont, toolboxWidget.QueueResize);
 
106
                        this.toolboxWidget.DragBegin += delegate(object sender, Gtk.DragBeginArgs e) {
 
107
                                
 
108
                                if (this.toolboxWidget.SelectedItem != null) {
 
109
                                        this.toolboxWidget.HideTooltipWindow ();
 
110
                                        toolboxService.DragSelectedItem (this.toolboxWidget, e.Context);
 
111
                                }
 
112
                        };
 
113
                        this.toolboxWidget.ActivateSelectedItem += delegate {
 
114
                                toolboxService.UseSelectedItem ();
 
115
                        };
 
116
                        
 
117
                        fontChanger = new MonoDevelop.Ide.Gui.PadFontChanger (toolboxWidget, toolboxWidget.SetCustomFont, toolboxWidget.QueueResize);
123
118
                        
124
119
                        this.toolboxWidget.DoPopupMenu = ShowPopup;
125
120
                        
126
121
                        scrolledWindow = new MonoDevelop.Components.CompactScrolledWindow ();
127
122
                        base.PackEnd (scrolledWindow, true, true, 0);
128
 
                        base.FocusChain = new Gtk.Widget [] { scrolledWindow };
 
123
                        base.FocusChain = new Gtk.Widget [] { scrolledWindow };
129
124
                        
130
125
                        //Initialise self
131
 
                        scrolledWindow.ShadowType = ShadowType.None;
132
 
                        scrolledWindow.VscrollbarPolicy = PolicyType.Automatic;
 
126
                        scrolledWindow.ShadowType = ShadowType.None;
 
127
                        scrolledWindow.VscrollbarPolicy = PolicyType.Automatic;
133
128
                        scrolledWindow.HscrollbarPolicy = PolicyType.Never;
134
129
                        scrolledWindow.WidthRequest = 150;
135
130
                        scrolledWindow.Add (this.toolboxWidget);
140
135
                        Refresh ();
141
136
                        
142
137
                        //set initial state
143
 
                        filterToggleButton.Active = false;
144
138
                        this.toolboxWidget.ShowCategories = catToggleButton.Active = true;
145
 
                        compactModeToggleButton.Active = MonoDevelop.Core.PropertyService.Get ("ToolboxIsInCompactMode", false);
 
139
                        compactModeToggleButton.Active = MonoDevelop.Core.PropertyService.Get ("ToolboxIsInCompactMode", false);
146
140
                        this.toolboxWidget.IsListMode  = !compactModeToggleButton.Active;
147
 
                        this.ShowAll ();
 
141
                        this.ShowAll ();
148
142
                }
149
143
                
150
144
                #region Toolbar event handlers
151
145
                
152
146
                void ToggleCompactMode (object sender, EventArgs e)
153
 
                {
154
 
                        this.toolboxWidget.IsListMode = !compactModeToggleButton.Active;
 
147
                {
 
148
                        this.toolboxWidget.IsListMode = !compactModeToggleButton.Active;
155
149
                        MonoDevelop.Core.PropertyService.Set ("ToolboxIsInCompactMode", compactModeToggleButton.Active);
156
 
                }
157
 
                
158
 
                void toggleFiltering (object sender, EventArgs e)
159
 
                {
160
 
                        if (filterVisible) {
161
 
                                filterEntry.Text = "";
162
 
                                base.Remove (filterEntry);
163
 
                        } else {
164
 
                                base.PackStart (filterEntry, false, false, 4);
165
 
                                filterEntry.Show ();
166
 
                                filterEntry.GrabFocus ();
167
 
                        }
168
 
                        filterVisible = !filterVisible;
169
150
                }
170
151
                
171
152
                void toggleCategorisation (object sender, EventArgs e)
174
155
                }
175
156
                
176
157
                void filterTextChanged (object sender, EventArgs e)
177
 
                {
178
 
                        foreach (Category cat in toolboxWidget.Categories) {
179
 
                                bool hasVisibleChild = false;
180
 
                                foreach (Item child in cat.Items) {
181
 
                                        child.IsVisible = ((ItemToolboxNode) child.Tag).Filter (filterEntry.Text);
182
 
                                        hasVisibleChild |= child.IsVisible;
183
 
                                }
184
 
                                cat.IsVisible = hasVisibleChild;
185
 
                        }
186
 
                        toolboxWidget.QueueDraw ();
 
158
                {
 
159
                        foreach (Category cat in toolboxWidget.Categories) {
 
160
                                bool hasVisibleChild = false;
 
161
                                foreach (Item child in cat.Items) {
 
162
                                        child.IsVisible = ((ItemToolboxNode) child.Tag).Filter (filterEntry.Entry.Text);
 
163
                                        hasVisibleChild |= child.IsVisible;
 
164
                                }
 
165
                                cat.IsVisible = hasVisibleChild;
 
166
                        }
 
167
                        toolboxWidget.QueueDraw ();
 
168
                        toolboxWidget.QueueResize ();
187
169
                }
188
170
                
189
171
                void toolboxAddButton_Clicked (object sender, EventArgs e)
192
174
                }
193
175
                
194
176
                void ShowPopup (Gdk.EventButton evt)
195
 
                {
196
 
                        if (!AllowEditingComponents)
 
177
                {
 
178
                        if (!AllowEditingComponents)
197
179
                                return;
198
180
                        CommandEntrySet eset = IdeApp.CommandService.CreateCommandEntrySet ("/MonoDevelop/DesignerSupport/ToolboxItemContextMenu");
199
181
                        IdeApp.CommandService.ShowContextMenu (this, evt, eset, this);
201
183
 
202
184
                [CommandHandler (MonoDevelop.Ide.Commands.EditCommands.Delete)]
203
185
                internal void OnDeleteItem ()
204
 
                {
205
 
                        if (MessageService.Confirm (GettextCatalog.GetString ("Are you sure you want to remove the selected Item?"), AlertButton.Delete))
 
186
                {
 
187
                        if (MessageService.Confirm (GettextCatalog.GetString ("Are you sure you want to remove the selected Item?"), AlertButton.Delete))
206
188
                                toolboxService.RemoveUserItem (selectedNode);
207
189
                }
208
190
 
209
191
                [CommandUpdateHandler (MonoDevelop.Ide.Commands.EditCommands.Delete)]
210
192
                internal void OnUpdateDeleteItem (CommandInfo info)
211
 
                {
212
 
                        // Hack manually filter out gtk# widgets & container since they cannot be re added
213
 
                        // because they're missing the toolbox attributes.
214
 
                        info.Enabled = selectedNode != null
215
 
                                && (selectedNode.ItemDomain != GtkWidgetDomain
216
 
                                    || (selectedNode.Category != "Widgets" && selectedNode.Category != "Container"));
217
 
                }
218
 
                
 
193
                {
 
194
                        // Hack manually filter out gtk# widgets & container since they cannot be re added
 
195
                        // because they're missing the toolbox attributes.
 
196
                        info.Enabled = selectedNode != null
 
197
                                && (selectedNode.ItemDomain != GtkWidgetDomain
 
198
                                    || (selectedNode.Category != "Widgets" && selectedNode.Category != "Container"));
 
199
                }
 
200
                
219
201
                static readonly string GtkWidgetDomain = GettextCatalog.GetString ("GTK# Widgets");
220
202
                
221
203
                #endregion
222
204
                
223
 
                #region GUI population
224
 
                
225
 
                Dictionary<string, Category> categories = new Dictionary<string, Category> ();
226
 
                void AddItems (IEnumerable<ItemToolboxNode> nodes)
227
 
                {
 
205
                #region GUI population
 
206
                
 
207
                Dictionary<string, Category> categories = new Dictionary<string, Category> ();
 
208
                void AddItems (IEnumerable<ItemToolboxNode> nodes)
 
209
                {
228
210
                        foreach (ItemToolboxNode itbn in nodes) {
229
 
                                Item newItem = new Item (itbn.Icon, itbn.Name, String.IsNullOrEmpty (itbn.Description) ? itbn.Name : itbn.Description, itbn);
230
 
                                if (!categories.ContainsKey (itbn.Category)) {
231
 
                                        var cat = new Category (itbn.Category);
232
 
                                        int prio;
233
 
                                        if (!categoryPriorities.TryGetValue (itbn.Category, out prio))
234
 
                                                prio = -1;
235
 
                                        cat.Priority = prio;
236
 
                                        categories[itbn.Category] = cat;
237
 
                                }
238
 
                                if (newItem.Text != null)
 
211
                                Item newItem = new Item (itbn);
 
212
                                if (!categories.ContainsKey (itbn.Category)) {
 
213
                                        var cat = new Category (itbn.Category);
 
214
                                        int prio;
 
215
                                        if (!categoryPriorities.TryGetValue (itbn.Category, out prio))
 
216
                                                prio = -1;
 
217
                                        cat.Priority = prio;
 
218
                                        categories[itbn.Category] = cat;
 
219
                                }
 
220
                                if (newItem.Text != null)
239
221
                                        categories[itbn.Category].Add (newItem);
240
 
                        }
241
 
                }
 
222
                        }
 
223
                }
242
224
                
243
 
                public void Refresh ()
244
 
                {
245
 
                        // GUI assert here is to catch Bug 434065 - Exception while going to the editor
246
 
                        DispatchService.AssertGuiThread ();
247
 
                        
248
 
                        if (toolboxService.Initializing) {
249
 
                                toolboxWidget.CustomMessage = GettextCatalog.GetString ("Initializing...");
250
 
                                return;
251
 
                        }
252
 
                        
253
 
                        ConfigureToolbar ();
254
 
                        
255
 
                        toolboxWidget.CustomMessage = null;
256
 
                        
257
 
                        categories.Clear ();
258
 
                        AddItems (toolboxService.GetCurrentToolboxItems ());
259
 
                        
260
 
                        Drag.SourceUnset (toolboxWidget);
261
 
                        toolboxWidget.ClearCategories ();
262
 
                        
263
 
                        var cats = categories.Values.ToList ();
264
 
                        cats.Sort ((a,b) => a.Priority != b.Priority ? a.Priority.CompareTo (b.Priority) : a.Text.CompareTo (b.Text));
265
 
                        cats.Reverse ();
266
 
                        foreach (Category category in cats) {
267
 
                                category.IsExpanded = true;
 
225
                public void Refresh ()
 
226
                {
 
227
                        // GUI assert here is to catch Bug 434065 - Exception while going to the editor
 
228
                        DispatchService.AssertGuiThread ();
 
229
                        
 
230
                        if (toolboxService.Initializing) {
 
231
                                toolboxWidget.CustomMessage = GettextCatalog.GetString ("Initializing...");
 
232
                                return;
 
233
                        }
 
234
                        
 
235
                        ConfigureToolbar ();
 
236
                        
 
237
                        toolboxWidget.CustomMessage = null;
 
238
                        
 
239
                        categories.Clear ();
 
240
                        AddItems (toolboxService.GetCurrentToolboxItems ());
 
241
                        
 
242
                        Drag.SourceUnset (toolboxWidget);
 
243
                        toolboxWidget.ClearCategories ();
 
244
                        
 
245
                        var cats = categories.Values.ToList ();
 
246
                        cats.Sort ((a,b) => a.Priority != b.Priority ? a.Priority.CompareTo (b.Priority) : a.Text.CompareTo (b.Text));
 
247
                        cats.Reverse ();
 
248
                        foreach (Category category in cats) {
 
249
                                category.IsExpanded = true;
268
250
                                toolboxWidget.AddCategory (category);
269
 
                        }
270
 
                        toolboxWidget.QueueResize ();
 
251
                        }
 
252
                        toolboxWidget.QueueResize ();
271
253
                        Gtk.TargetEntry[] targetTable = toolboxService.GetCurrentDragTargetTable ();
272
 
                        if (targetTable != null)
273
 
                                Drag.SourceSet (toolboxWidget, Gdk.ModifierType.Button1Mask, targetTable, Gdk.DragAction.Copy | Gdk.DragAction.Move);
274
 
                        compactModeToggleButton.Visible = toolboxWidget.CanIconizeToolboxCategories;
275
 
                }
276
 
                
277
 
                void ConfigureToolbar ()
278
 
                {
279
 
                        // Default configuration
280
 
                        categoryPriorities.Clear ();
281
 
                        toolboxAddButton.Visible = true;
282
 
                        
283
 
                        toolboxService.Customize (container, this);
284
 
                }
285
 
                
286
 
                protected override void OnDestroyed ()
287
 
                {
288
 
                        if (fontChanger != null) {
289
 
                                fontChanger.Dispose ();
290
 
                                fontChanger = null;
291
 
                        }
292
 
                        base.OnDestroyed ();
293
 
                }
294
 
                
295
 
                #endregion
296
 
                
297
 
                #region IPropertyPadProvider
 
254
                        if (targetTable != null)
 
255
                                Drag.SourceSet (toolboxWidget, Gdk.ModifierType.Button1Mask, targetTable, Gdk.DragAction.Copy | Gdk.DragAction.Move);
 
256
                        compactModeToggleButton.Visible = toolboxWidget.CanIconizeToolboxCategories;
 
257
                }
 
258
                
 
259
                void ConfigureToolbar ()
 
260
                {
 
261
                        // Default configuration
 
262
                        categoryPriorities.Clear ();
 
263
                        toolboxAddButton.Visible = true;
 
264
                        
 
265
                        toolboxService.Customize (container, this);
 
266
                }
 
267
                
 
268
                protected override void OnDestroyed ()
 
269
                {
 
270
                        if (fontChanger != null) {
 
271
                                fontChanger.Dispose ();
 
272
                                fontChanger = null;
 
273
                        }
 
274
                        base.OnDestroyed ();
 
275
                }
 
276
                
 
277
                #endregion
 
278
                
 
279
                #region IPropertyPadProvider
298
280
                
299
281
                object IPropertyPadProvider.GetActiveComponent ()
300
 
                {
 
282
                {
301
283
                        return selectedNode;
302
284
                }
303
285
 
304
286
                object IPropertyPadProvider.GetProvider ()
305
 
                {
 
287
                {
306
288
                        return selectedNode;
307
289
                }
308
290
 
312
294
 
313
295
                void IPropertyPadProvider.OnChanged (object obj)
314
296
                {
315
 
                }
316
 
                
317
 
                #endregion
318
 
 
319
 
                #region IToolboxConfiguration implementation
320
 
                public void SetCategoryPriority (string category, int priority)
321
 
                {
322
 
                        categoryPriorities[category] = priority;
323
 
                }
324
 
 
325
 
                public bool AllowEditingComponents {
326
 
                        get {
327
 
                                return toolboxAddButton.Visible;
328
 
                        }
329
 
                        set {
330
 
                                toolboxAddButton.Visible = value;
331
 
                        }
332
 
                }
333
 
                #endregion
334
 
        }
335
 
}
 
297
                }
 
298
                
 
299
                #endregion
 
300
 
 
301
                #region IToolboxConfiguration implementation
 
302
                public void SetCategoryPriority (string category, int priority)
 
303
                {
 
304
                        categoryPriorities[category] = priority;
 
305
                }
 
306
 
 
307
                public bool AllowEditingComponents {
 
308
                        get {
 
309
                                return toolboxAddButton.Visible;
 
310
                        }
 
311
                        set {
 
312
                                toolboxAddButton.Visible = value;
 
313
                        }
 
314
                }
 
315
                #endregion
 
316
        }
 
317
}