protected override void InitializeItem(ToolStripItem item)
        {
            base.InitializeItem(item);

            if (item.GetType() == typeof(ToolStripSeparator))
            {
                var castItem = (ToolStripSeparator)item;
                if (!castItem.IsOnDropDown)
                    item.Margin = new Padding(0, 0, 2, 0);
            }

            if (item.GetType() == typeof(ToolStripButton))
            {
                item.AutoSize = false;
                item.Size = new Size(24, 24);
            }
        }
Exemple #2
0
        protected override void InitializeItem(ToolStripItem item)
        {
            base.InitializeItem(item);

            item.ForeColor = Colors.LightText;

            if (item.GetType() == typeof(ToolStripSeparator))
            {
                item.Margin = new Padding(0, 0, 0, 1);
            }
        }
 public static NewItemsContextMenuStrip GetNewItemDropDown(IComponent component, ToolStripItem currentItem, EventHandler onClick, bool convertTo, IServiceProvider serviceProvider, bool populateCustom)
 {
     NewItemsContextMenuStrip contextMenu = new NewItemsContextMenuStrip(component, currentItem, onClick, convertTo, serviceProvider);
     contextMenu.GroupOrdering.Add("StandardList");
     contextMenu.GroupOrdering.Add("CustomList");
     foreach (ToolStripItem item in GetStandardItemMenuItems(component, onClick, convertTo))
     {
         contextMenu.Groups["StandardList"].Items.Add(item);
         if (convertTo)
         {
             ItemTypeToolStripMenuItem item2 = item as ItemTypeToolStripMenuItem;
             if (((item2 != null) && (currentItem != null)) && (item2.ItemType == currentItem.GetType()))
             {
                 item2.Enabled = false;
             }
         }
     }
     if (populateCustom)
     {
         GetCustomNewItemDropDown(contextMenu, component, currentItem, onClick, convertTo, serviceProvider);
     }
     IUIService service = serviceProvider.GetService(typeof(IUIService)) as IUIService;
     if (service != null)
     {
         contextMenu.Renderer = (ToolStripProfessionalRenderer) service.Styles["VsRenderer"];
         contextMenu.Font = (Font) service.Styles["DialogFont"];
         if (service.Styles["VsColorPanelText"] is System.Drawing.Color)
         {
             contextMenu.ForeColor = (System.Drawing.Color) service.Styles["VsColorPanelText"];
         }
     }
     contextMenu.Populate();
     return contextMenu;
 }
 public static void GetCustomNewItemDropDown(NewItemsContextMenuStrip contextMenu, IComponent component, ToolStripItem currentItem, EventHandler onClick, bool convertTo, IServiceProvider serviceProvider)
 {
     foreach (ToolStripItem item in GetCustomItemMenuItems(component, onClick, convertTo, serviceProvider))
     {
         contextMenu.Groups["CustomList"].Items.Add(item);
         if (convertTo)
         {
             ItemTypeToolStripMenuItem item2 = item as ItemTypeToolStripMenuItem;
             if (((item2 != null) && (currentItem != null)) && (item2.ItemType == currentItem.GetType()))
             {
                 item2.Enabled = false;
             }
         }
     }
     contextMenu.Populate();
 }
 public static ToolStripDropDown GetNewItemDropDown(IComponent component, ToolStripItem currentItem, EventHandler onClick, bool convertTo, IServiceProvider serviceProvider)
 {
     NewItemsContextMenuStrip strip = new NewItemsContextMenuStrip(component, currentItem, onClick, convertTo, serviceProvider);
     strip.GroupOrdering.Add("StandardList");
     strip.GroupOrdering.Add("CustomList");
     foreach (ToolStripItem item in GetStandardItemMenuItems(component, onClick, convertTo))
     {
         strip.Groups["StandardList"].Items.Add(item);
         if (convertTo)
         {
             ItemTypeToolStripMenuItem item2 = item as ItemTypeToolStripMenuItem;
             if (((item2 != null) && (currentItem != null)) && (item2.ItemType == currentItem.GetType()))
             {
                 item2.Enabled = false;
             }
         }
     }
     foreach (ToolStripItem item3 in GetCustomItemMenuItems(component, onClick, convertTo, serviceProvider))
     {
         strip.Groups["CustomList"].Items.Add(item3);
         if (convertTo)
         {
             ItemTypeToolStripMenuItem item4 = item3 as ItemTypeToolStripMenuItem;
             if (((item4 != null) && (currentItem != null)) && (item4.ItemType == currentItem.GetType()))
             {
                 item4.Enabled = false;
             }
         }
     }
     IUIService service = serviceProvider.GetService(typeof(IUIService)) as IUIService;
     if (service != null)
     {
         strip.Renderer = (ToolStripProfessionalRenderer) service.Styles["VsRenderer"];
         strip.Font = (Font) service.Styles["DialogFont"];
     }
     strip.Populate();
     return strip;
 }
 protected override void OnMouseDown(MouseEventArgs e) {
     if(fReorderEnabled) {
         mouseButtons = e.Button;
         draggingItem = GetItemAt(e.Location);
         if((draggingItem != null) && string.Equals(draggingItem.GetType().ToString(), "System.Windows.Forms.ToolStripScrollButton")) {
             draggingItem = null;
         }
     }
     base.OnMouseDown(e);
 }
        public static Hashtable updateMenuEvents(ToolStripItem control, string elementName, string uniqueId)
        {
            Hashtable controlProperties = new Hashtable();
            string eibCOntrolInterfaceName = (typeof(IEIBControl)).Name;
            if (control.GetType().GetInterface(eibCOntrolInterfaceName) != null)
            {

                IEIBControl eibControl = (IEIBControl)control;
                if (eibControl.OnClickValue != null && !eibControl.OnClickValue.Trim().Equals(""))
                {
                    controlProperties.Add(XMLServicesConstants.XmlNodeOnClickElt, eibControl.OnClickValue);
                }
                if (eibControl.OnDoubleClick != null && !eibControl.OnDoubleClick.Trim().Equals(""))
                {
                    controlProperties.Add(XMLServicesConstants.XmlNodeOnDoubleClickElt, eibControl.OnDoubleClick);
                }
                if (eibControl.EnteringValue != null && !eibControl.EnteringValue.Trim().Equals(""))
                {
                    controlProperties.Add(XMLServicesConstants.XmlNodeEnteringElt, eibControl.EnteringValue);
                }
                if (eibControl.ExitingValue != null && !eibControl.ExitingValue.Trim().Equals(""))
                {
                    controlProperties.Add(XMLServicesConstants.XmlNodeExitingElt, eibControl.ExitingValue);
                }
                if (eibControl.DefaultValue != null && !eibControl.DefaultValue.Trim().Equals(""))
                {
                    controlProperties.Add(XMLServicesConstants.XmlNodeDefaultValueElt, eibControl.DefaultValue);
                }
            }
            //EIBControl Settings
            return controlProperties;
        }
        private static IEnumerable<Control> RecursiveGetToolStripItems(ToolStripItem item, Control x)
        {
            if (item is ToolStripDropDownItem)
            {
                foreach (ToolStripItem t in ((ToolStripDropDownItem) item).DropDownItems)
                {
                    if (item.GetType().FullName.IndexOf("MvvmFx.", StringComparison.InvariantCulture) != 0)
                    {
#if WINFORMS
                        yield return new ToolStripItemProxy(t, x.Parent, true);
#else
                        yield return new ToolStripItemProxy(t, x, true);
#endif
                    }
                    foreach (var toolStripItems in RecursiveGetToolStripItems(t, x))
                        yield return toolStripItems;
                }
            }
        }
Exemple #9
0
        public static Hashtable updateMenuEvents(ToolStripItem control, string elementName, string uniqueId)
        {
            Hashtable controlProperties = new Hashtable();
            string eibCOntrolInterfaceName = (typeof(IEIBControl)).Name;
            if (control.GetType().GetInterface(eibCOntrolInterfaceName) != null)
            {

                IEIBControl eibControl = (IEIBControl)control;
                if (eibControl.OnClickValue != null && !eibControl.OnClickValue.Trim().Equals(""))
                {
                    controlProperties.Add(XMLServicesConstants.XmlNodeOnClickElt, eibControl.OnClickValue);
                }
                if (eibControl.OnDoubleClick != null && !eibControl.OnDoubleClick.Trim().Equals(""))
                {
                    controlProperties.Add(XMLServicesConstants.XmlNodeOnDoubleClickElt, eibControl.OnDoubleClick);
                }
                if (eibControl.EnteringValue != null && !eibControl.EnteringValue.Trim().Equals(""))
                {
                    controlProperties.Add(XMLServicesConstants.XmlNodeEnteringElt, eibControl.EnteringValue);
                }
                if (eibControl.ExitingValue != null && !eibControl.ExitingValue.Trim().Equals(""))
                {
                    controlProperties.Add(XMLServicesConstants.XmlNodeExitingElt, eibControl.ExitingValue);
                }
                if (eibControl.DefaultValue != null && !eibControl.DefaultValue.Trim().Equals(""))
                {
                    controlProperties.Add(XMLServicesConstants.XmlNodeDefaultValueElt, eibControl.DefaultValue);
                }
                if (eibControl is EIBPanel)
                {
                    if (((EIBPanel)eibControl).GlobalScripts != null && !((EIBPanel)eibControl).GlobalScripts.Trim().Equals(""))
                    {
                        controlProperties.Add(XMLServicesConstants.XmlNodeGlobalScriptsElt, ((EIBPanel)eibControl).GlobalScripts);
                    }
                }
                if (eibControl is EIBTreeNode)
                {
                    if (((EIBTreeNode)eibControl).OnOpen != null && !((EIBTreeNode)eibControl).OnOpen.Trim().Equals(""))
                    {
                        controlProperties.Add(XMLServicesConstants.XmlNodeOnOpenElt, ((EIBTreeNode)eibControl).OnOpen);
                    }
                }
                if (eibControl is EIBTreeView)
                {
                    if (((EIBTreeView)eibControl).OnSelect != null && !((EIBTreeView)eibControl).OnSelect.Trim().Equals(""))
                    {
                        controlProperties.Add(XMLServicesConstants.XmlNodeOnSelectElt, ((EIBTreeView)eibControl).OnSelect);
                    }
                }
            }
            //EIBControl Settings
            return controlProperties;
        }