public MenuEditor(EIBMenuBar menuBar) { InitializeComponent(); if (menuBar != null) { currentMenuBar = menuBar; } ResetMenuEditor(menuBar); }
public void RepaintAll() { //currentBaseWindow.baseFrame.Controls.Clear(); Graphics g = Graphics.FromHwnd(currentBaseWindow.baseFrame.Handle); g.Clear(currentBaseWindow.baseFrame.BackColor); foreach (IEIBControl control in Controlpool) { if (((Control)control).Controls.Count > 0) { if (!(control is UserControl) && !(control is EIBTabControl) && !(control is EIBMenuBar)) { ((Control)control).Controls.Clear(); } } parentExpose parents = ControlPool.parentControls[control]; if (control is IEIBControl && parents.parent != null) { if (control is EIBTabControl) { foreach (EIBTabPage tabPage in ((EIBTabControl)control).TabPages) { if (!EIBControlCollection.TabPagelist.ContainsKey(tabPage.Name)) { EIBControlCollection.TabPagelist.Add(tabPage.Name, tabPage.Name); } } if (!EIBControlCollection.TabControllist.ContainsKey(((EIBTabControl)control).Name)) { EIBControlCollection.TabControllist.Add(((EIBTabControl)control).Name, ((EIBTabControl)control).Name); } } if (control is EIBTabPage) { if (!EIBControlCollection.TabPagelist.ContainsKey(((Control)control).Name)) { EIBControlCollection.TabPagelist.Add(((Control)control).Name, ((Control)control).Name); } } if (control is EIBMenuBar) { EIBMenuBar.RefreshInList(control); } parents.parent.Controls.Add((Control)control); } else { currentBaseWindow.baseFrame.Controls.Add((Control)control); } } eventManager.handleControlClick(currentBaseWindow.baseFrame, new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0)); }
public void ResetMenuEditor(EIBMenuBar menuBar) { foreach (EIBMenu menuItem in ((ToolStrip)menuBar.Controls[0]).Items) { if (!string.IsNullOrEmpty(menuItem.Text)) { TreeNode tn = new TreeNode(menuItem.Text); tn.Name = menuItem.Name; treeView1.Nodes.Add(tn); parseMenuItem(menuItem, tn); nodeMenus.Add(tn.Name, menuItem); } } }
public static void saveXMLofMenu(Control menuControl) { EIBMenuBar menuBar = (EIBMenuBar)menuControl; foreach (EIBMenu menu in menuBar.CurrentToolStrip.Items) { Hashtable controlProperties = EIBXMLServices.updateMenuSettings(menu, menu.Name, menu.Name); Hashtable eventProperties = EIBXMLServices.updateMenuEvents(menu, menu.Name.ToLower(), menu.Name.ToLower()); XmlNode xmlNode = EIBXMLServices.writeElement(((IEIBControl)menuControl).ParentXmlNode, EIBControlList.GetRenderingElement(menu.GetType().Name), controlProperties, eventProperties); foreach (EIBMenuItem menuItem in menu.DropDownItems) { Hashtable menuItemProperties = EIBXMLServices.updateMenuSettings(menuItem, menuItem.Name, menuItem.Name); Hashtable menuEventProperties = EIBXMLServices.updateMenuEvents(menuItem, menuItem.Name.ToLower(), menuItem.Name.ToLower()); EIBXMLServices.writeElement(xmlNode, EIBControlList.GetRenderingElement(menuItem.GetType().Name), menuItemProperties, menuEventProperties); } } }
public static object CreateControl(string ctrlName, string partialName) { try { Control ctrl = null; //ToolStripMenuItem menu; //ToolStripButton menuItem; switch (ctrlName) { case "EIBButton": ctrl = new EIBButton(); break; case "EIBApplet": ctrl = new EIBApplet(); break; case "EIBLattice": ctrl = new EIBLattice(); break; case "EIBSchedular": ctrl = new EIBSchedular(); break; case "EIBDatePicker": ctrl = new EIBDatePicker(); break; case "EIBTime": ctrl = new EIBTime(); break; case "EIBCheckbox": ctrl = new EIBCheckbox(); break; case "EIBCombobox": ctrl = new EIBCombobox(); break; case "EIBLabel": ctrl = new EIBLabel(); break; case "EIBLine": ctrl = new EIBLine(); break; case "EIBPanel": ctrl = new EIBPanel(); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBJasper": ctrl = new EIBJasper(); break; case "EIBRadioGroup": ctrl = new EIBRadioGroup(); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBPicture": ctrl = new EIBPicture(); break; case "EIBRadioButton": ctrl = new EIBRadioButton(); break; case "EIBTabControl": ctrl = new EIBTabControl(); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBTabPage": ctrl = new EIBTabPage(); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBSearch": ctrl = new EIBSearch(); break; case "EIBListbox": ctrl = new EIBListbox(); break; case "EIBGrid": ctrl = new EIBGrid(); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBTable": ctrl = new EIBTable(); break; case "EIBRelation": ctrl = new EIBRelation(); break; case "EIBTextBox": ctrl = new EIBTextBox(); break; case "EIBTreeView": ctrl = new EIBTreeView(); break; case "EIBMenuBar": ctrl = new EIBMenuBar(false); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBNode": ctrl = new EIBNode(); break; case "EIBNodeRelation": ctrl = new EIBNodeRelation(); break; case "EIBColumn": ctrl = new EIBColumn(); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBScrollableRow": ctrl = new EIBScrollableRow(); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBBrowse": ctrl = new EIBBrowse(); break; case "EIBVMenuBar": ctrl = new EIBVMenuBar(false); DragDropHandler.RegisterControl(ctrl, true, true); break; case "EIBMenu": return(new EIBMenu()); case "EIBMenuItem": return(new EIBMenuItem()); /* * case "EIBTreeNode": * ctrl = new EIBTreeNode(); * break; */ default: Assembly controlAsm = Assembly.LoadWithPartialName(partialName); Type controlType = controlAsm.GetType(partialName + "." + ctrlName); ctrl = (Control)Activator.CreateInstance(controlType); break; } return(ctrl); } catch (Exception ex) { System.Diagnostics.Trace.WriteLine("create control failed:" + ex.Message); return(new Control()); } }