void Refresh()
        {
            IDesignArea    area    = wrapper.GetDesignArea();
            ActionTreeNode selNode = null;

            foreach (Gtk.Widget w in table.Children)
            {
                ActionMenuItem ami = w as ActionMenuItem;
                if (area.IsSelected(w) && ami != null)
                {
                    selNode = ami.Node;
                    area.ResetSelection(w);
                }
                table.Remove(w);
            }

            Fill();

            ActionMenuItem mi = FindMenuItem(selNode);

            if (mi != null)
            {
                mi.Select();
            }

            GLib.Timeout.Add(50, new GLib.TimeoutHandler(RepositionSubmenu));
        }
Esempio n. 2
0
        void Refresh()
        {
            Widget      wrapper = Widget.Lookup(this);
            IDesignArea area    = wrapper.GetDesignArea();

            if (area == null)
            {
                return;
            }

            ActionTreeNode selNode = null;

            foreach (Gtk.Widget w in Children)
            {
                CustomMenuBarItem it = w as CustomMenuBarItem;
                if (it != null && area.IsSelected(it.ActionMenuItem))
                {
                    selNode = it.ActionMenuItem.Node;
                    area.ResetSelection(it.ActionMenuItem);
                }
                Remove(w);
            }

            FillMenu(actionTree);

            if (selNode != null)
            {
                ActionMenuItem mi = FindMenuItem(selNode);
                if (mi != null)
                {
                    mi.Select();
                }
            }
        }
        void OnEditingDone(object ob, EventArgs args)
        {
            Widget wrapper = Stetic.Wrapper.Widget.Lookup(this);

            if (wrapper == null)
            {
                return;
            }

            IDesignArea area = wrapper.GetDesignArea();

            if (area == null)   // The toolbar may be disposed before ending editing
            {
                return;
            }

            ActionToolItem item = (ActionToolItem)ob;

            item.EditingDone -= OnEditingDone;

            if (item.Node.Action.GtkAction.Label.Length == 0 && item.Node.Action.GtkAction.StockId == null)
            {
                area.ResetSelection(item);
                using (wrapper.UndoManager.AtomicChange)
                {
                    actionTree.Children.Remove(item.Node);
                    wrapper.LocalActionGroups [0].Actions.Remove(item.Node.Action);
                }
            }
        }
Esempio n. 4
0
        protected void UpdateSelectionStatus()
        {
            IDesignArea      area = GetDesignArea();
            IObjectSelection sel  = area.GetSelection();

            sel.Disposed -= OnSelectionDisposed;
            sel.Drag     -= HandleItemDrag;

            area.ResetSelection(this);

            sel           = area.SetSelection(this, this);
            sel.Drag     += HandleItemDrag;
            sel.Disposed += OnSelectionDisposed;
        }
Esempio n. 5
0
        void OnEditingDone(object ob, EventArgs args)
        {
            ActionMenuItem item = (ActionMenuItem)ob;

            item.EditingDone -= OnEditingDone;
            Widget wrapper = Widget.Lookup(this);

            if (item.Node.Action.GtkAction.Label.Length == 0 && item.Node.Action.GtkAction.StockId == null)
            {
                IDesignArea area = wrapper.GetDesignArea();
                area.ResetSelection(item);
                using (wrapper.UndoManager.AtomicChange) {
                    actionTree.Children.Remove(item.Node);
                    wrapper.LocalActionGroups [0].Actions.Remove(item.Node.Action);
                }
            }
        }
        public void Unselect()
        {
            // Unselects any selected item
            Widget      wrapper = Stetic.Wrapper.Widget.Lookup(this);
            IDesignArea area    = wrapper.GetDesignArea();

            if (area != null)
            {
                foreach (Gtk.Widget w in Children)
                {
                    CustomToolbarItem it = w as CustomToolbarItem;
                    if (it != null)
                    {
                        area.ResetSelection(it.ActionToolItem);
                    }
                }
            }
        }
        internal void ResetSelection()
        {
            if (OpenSubmenu != null)
            {
                OpenSubmenu.ResetSelection();
            }
            IDesignArea area = wrapper.GetDesignArea();

            if (area != null)
            {
                foreach (Gtk.Widget w in table.Children)
                {
                    ActionMenuItem ami = w as ActionMenuItem;
                    if (ami != null)
                    {
                        area.ResetSelection(w);
                    }
                }
            }
        }
Esempio n. 8
0
        void OnEditDone(object sender, EventArgs args)
        {
            ActionMenuItem item = (ActionMenuItem)sender;

            item.EditingDone -= OnEditDone;
            if (item.Node.Action.GtkAction.Label.Length > 0 || item.Node.Action.GtkAction.StockId != null)
            {
                actionGroup.Actions.Add(item.Node.Action);
            }
            else
            {
                IDesignArea designArea = GetDesignArea();
                designArea.ResetSelection(item);
                item.Detach();
                item.Node.Dispose();
                items.Remove(item);
                item.Destroy();
                PlaceAddLabel(actionGroup.Actions.Count);
                ShowAll();
            }
        }
Esempio n. 9
0
        void OnEditingDone(object ob, MenuItemEditEventArgs args)
        {
            ActionMenuItem item = (ActionMenuItem)ob;

            item.EditingDone -= OnEditingDone;
            if (item.Node.Action.GtkAction.Label.Length == 0 && item.Node.Action.GtkAction.StockId == null)
            {
                IDesignArea area = wrapper.GetDesignArea();
                area.ResetSelection(item);
                using (wrapper.UndoManager.AtomicChange) {
                    nodes.Remove(item.Node);
                    wrapper.LocalActionGroups [0].Actions.Remove(item.Node.Action);
                }
                SelectLastItem();
            }
            else
            {
                if (args.ExitKey == Gdk.Key.Up || args.ExitKey == Gdk.Key.Down)
                {
                    ProcessKey(item, args.ExitKey, Gdk.ModifierType.None);
                }
            }
        }
Esempio n. 10
0
        public void Unselect()
        {
            // Unselects any selected item and hides any open submenu menu
            Widget wrapper = Widget.Lookup(this);

            if (OpenSubmenu != null)
            {
                OpenSubmenu.ResetSelection();
            }
            IDesignArea area = wrapper.GetDesignArea();

            if (area != null)
            {
                foreach (Gtk.Widget w in Children)
                {
                    CustomMenuBarItem it = w as CustomMenuBarItem;
                    if (it != null)
                    {
                        area.ResetSelection(it.ActionMenuItem);
                    }
                }
            }
            OpenSubmenu = null;
        }