示例#1
0
 void MenuOnProcessCmdKey(object sender, FreeCL.UI.ProcessCmdKeyEventArgs e)
 {
     e.Handled = ProcessKey(e.KeyData);
 }
示例#2
0
 void OnMergeMenu(FreeCL.UI.MainMenu owner, System.Windows.Forms.Menu src)
 {
     foreach (System.Windows.Forms.MenuItem item in src.MenuItems)
         HandleChildMenuItems(item);
 }
示例#3
0
 public ToolStripItem AddMenuItem(ToolStripMenuItem owner, int index, FreeCL.UI.Actions.Action action, bool separator)
 {
     if(action != null)
         return AddMenuItem(owner, (int)index, action, separator, action.Text);
     else
         return AddMenuItem(owner, (int)index, action, separator, "");
 }
示例#4
0
        public void SetAction(Component comp, FreeCL.UI.Actions.Action value)
        {
            Debug.Assert(comp != null && value != null);

            if(inInit)
            {
                componentsForInit[comp] = value;
                return;
            }

            Action res = null;
            if (_components.TryGetValue(comp, out res))
            {
                if (value == res)
                {
                    return;
                }
                res.SetComponent(comp, false);
                _components.Remove(comp);
            }

            if (value != Actions.Null)
            {
                value._owner = this;
                value.SetComponent(comp, true);
                _components.Add(comp, value);
            }
        }
示例#5
0
 public ToolStripItem AddMenuItem(CommonMenusEnum menu, CommonItemsEnum index, FreeCL.UI.Actions.Action action)
 {
     return AddMenuItem(menu, (int)index, action);
 }
示例#6
0
 public ToolStripItem AddMenuItem(ToolStripMenuItem owner, int index, FreeCL.UI.Actions.Action action)
 {
     return AddMenuItem(owner, (int)index, action, true);
 }
示例#7
0
        public ToolStripMenuItem GetOrCreateMenuItem(ToolStripMenuItem owner, int index, FreeCL.UI.Actions.Action action, bool separator, string caption)
        {
            if(owner == null)
                throw new ArgumentNullException("owner");

            foreach(ToolStripItem mi in owner.DropDownItems)
            {
                if(mi.Text == caption)
                {
                    return (ToolStripMenuItem)mi;
                }
            }
            return (ToolStripMenuItem)this.AddMenuItem(owner, index, action, separator, caption);
        }
示例#8
0
 public ToolStripItem AddMenuItem(CommonMenusEnum menu, int index, FreeCL.UI.Actions.Action action)
 {
     return AddMenuItem(GetTopMenuItem(menu), index, action);
 }
示例#9
0
        public ToolStripItem GetMenuItem(ToolStripMenuItem owner, int index, FreeCL.UI.Actions.Action action, bool separator)
        {
            if(owner == null)
                throw new ArgumentNullException("owner");

            if(action == null)
                throw new ArgumentNullException("action");

            foreach(ToolStripItem mi in owner.DropDownItems)
            {
                if(mi.MergeIndex == index && ((separator && mi is ToolStripSeparator) || action.Parent.GetAction(mi) == action))
                {
                    return mi;
                }
            }
            return null;
        }
示例#10
0
        public ToolStripItem AddToolStripButton(System.Windows.Forms.ToolStrip owner, int index, FreeCL.UI.Actions.Action action, Type buttonType)
        {
            if(owner == null)
                throw new ArgumentNullException("owner");

            ToolStripItem netsb = (ToolStripItem)Activator.CreateInstance(buttonType);

            if(action != null)
            {
                action.Parent.SetAction(netsb, action);
            }

            netsb.DisplayStyle = ToolStripItemDisplayStyle.Image;
            netsb.MergeIndex = index;
            netsb.MergeAction =	MergeAction.Insert;

            if(index < owner.Items.Count)
                owner.Items.Insert(index, netsb);
            else
                owner.Items.Add(netsb);

            SortItems(owner.Items);

            return netsb;
        }
示例#11
0
 public ToolStripItem AddToolStripButton(CommonToolStripsEnum toolStrip, CommonItemsEnum index, FreeCL.UI.Actions.Action action, Type buttonType)
 {
     return AddToolStripButton(toolStrip, (int)index, action, buttonType);
 }
示例#12
0
 public ToolStripItem AddToolStripButton(CommonToolStripsEnum toolStrip, int index, FreeCL.UI.Actions.Action action, Type buttonType)
 {
     return AddToolStripButton(GetToolStrip(toolStrip), index, action, buttonType);
 }
示例#13
0
        public ToolStripItem AddMenuItem(ToolStripMenuItem owner, int index, FreeCL.UI.Actions.Action action, bool separator, string caption)
        {
            if(owner == null)
                throw new ArgumentNullException("owner");

            ToolStripItem newmi = new ToolStripMenuItem();
            if(action != null)
            {
                action.Parent.SetAction(newmi, action);
            }
            else if(separator)
                newmi = new ToolStripSeparator();
            else
                newmi.Text = caption;

            newmi.MergeIndex = index;
            newmi.MergeAction =	MergeAction.Insert;

            if(index < owner.DropDownItems.Count && index >= 0)
                owner.DropDownItems.Insert(index, newmi);
            else
                owner.DropDownItems.Add(newmi);

            SortItems(owner.DropDownItems);

            return newmi;
        }