コード例 #1
0
        public void Refresh()
        {
            // GUI assert here is to catch Bug 434065 - Exception while going to the editor
            DispatchService.AssertGuiThread();

            if (toolboxService.Initializing)
            {
                toolboxWidget.CustomMessage = GettextCatalog.GetString("Initializing...");
                return;
            }

            toolboxWidget.CustomMessage = null;

            categories.Clear();
            AddItems(toolboxService.GetCurrentToolboxItems());

            Drag.SourceUnset(toolboxWidget);
            toolboxWidget.ClearCategories();
            foreach (Category category in categories.Values)
            {
                category.IsExpanded = true;
                toolboxWidget.AddCategory(category);
            }
            toolboxWidget.QueueResize();
            Gtk.TargetEntry[] targetTable = toolboxService.GetCurrentDragTargetTable();
            if (targetTable != null)
            {
                Drag.SourceSet(toolboxWidget, Gdk.ModifierType.Button1Mask, targetTable, Gdk.DragAction.Copy | Gdk.DragAction.Move);
            }
            compactModeToggleButton.Visible = toolboxWidget.CanIconizeToolboxCategories;
        }
コード例 #2
0
        public void Refresh()
        {
            // GUI assert here is to catch Bug 434065 - Exception while going to the editor
            Runtime.AssertMainThread();

            if (toolboxService.Initializing)
            {
                toolboxWidget.CustomMessage = GettextCatalog.GetString("Initializing...");
                return;
            }

            ConfigureToolbar();

            toolboxWidget.CustomMessage = null;

            categories.Clear();
            AddItems(toolboxService.GetCurrentToolboxItems());

            Drag.SourceUnset(toolboxWidget);
            toolboxWidget.ClearCategories();

            var cats = categories.Values.ToList();

            cats.Sort((a, b) => a.Priority != b.Priority ? a.Priority.CompareTo(b.Priority) : a.Text.CompareTo(b.Text));
            cats.Reverse();
            foreach (Category category in cats)
            {
                category.IsExpanded = true;
                toolboxWidget.AddCategory(category);
            }
            toolboxWidget.QueueResize();
            Gtk.TargetEntry[] targetTable = toolboxService.GetCurrentDragTargetTable();
            if (targetTable != null)
            {
                Drag.SourceSet(toolboxWidget, Gdk.ModifierType.Button1Mask, targetTable, Gdk.DragAction.Copy | Gdk.DragAction.Move);
            }
            compactModeToggleButton.Visible = toolboxWidget.CanIconizeToolboxCategories;
            refilter();
        }