コード例 #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
        // method only used by DebaterPool
        public void UpdateTeamMembers()
        {
            int shownMembers = teamData.ShownMembers;

            if (shownMembers == 0)
            {
                MiscHelpers.SetIsShown(this, false);
                return;
            }
            else if (shownMembers == vboxTeamMembers.Children.Length)
            {
                // complete Team
                btnExpand.ResetLabelColor();
                Drag.SourceSet(btnExpand,
                               Gdk.ModifierType.Button1Mask,
                               DragDropHelpers.TgtTeam,
                               Gdk.DragAction.Move);
            }
            else
            {
                // incomplete Team
                btnExpand.LabelColor = new Gdk.Color(160, 0, 0);
                Drag.SourceUnset(btnExpand);
            }
            MiscHelpers.SetIsShown(this, true);
        }
コード例 #3
0
 private void UpdateButton()
 {
     if (calendarItem != null && calendarItem.id > 0)
     {
         this.Image = null;
         PangoText.SetText(calendarItem.Text);
         this.TooltipText = calendarItem.FullText;
         this.Relief      = ReliefStyle.Normal;
         Drag.DestUnset(this);
         Drag.SourceSet(this, Gdk.ModifierType.Button1Mask, null, Gdk.DragAction.Move);
         Gdk.Color col = new Gdk.Color();
         Gdk.Color.Parse(calendarItem.Color, ref col);
         logger.Debug("a={0} - {1} - {2}", col.Red, col.Green, col.Blue);
         this.ModifyBg(StateType.Normal, col);
         byte r = (byte)Math.Min(((double)col.Red / ushort.MaxValue) * byte.MaxValue + 30, byte.MaxValue);
         byte g = (byte)Math.Min(((double)col.Green / ushort.MaxValue) * byte.MaxValue + 30, byte.MaxValue);
         byte b = (byte)Math.Min(((double)col.Blue / ushort.MaxValue) * byte.MaxValue + 30, byte.MaxValue);
         col = new Gdk.Color(r, g, b);
         this.ModifyBg(StateType.Prelight, col);
         logger.Debug("b={0} - {1} - {2}", col.Red, col.Green, col.Blue);
         //Tag
         PangoTag.SetText(calendarItem.Tag);
         PangoMessages.SetText(calendarItem.MessageCount + "✉");
     }
     else if (calendarItem != null && calendarItem.id == 0)
     {
         Pango.FontDescription desc = Pango.FontDescription.FromString("Serif Bold 35");
         PangoText.FontDescription = desc;
         PangoText.SetText(calendarItem.Text);
         this.Relief = ReliefStyle.Normal;
         Gdk.Color col = new Gdk.Color();
         Gdk.Color.Parse(calendarItem.Color, ref col);
         this.ModifyBg(StateType.Normal, col);
         this.ModifyBg(StateType.Prelight, col);
     }
     else
     {
         this.Image       = null;
         this.TooltipText = null;
         Drag.SourceUnset(this);
         this.Relief = ReliefStyle.None;
         this.ModifyBg(StateType.Normal);
     }
 }
コード例 #4
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();
        }