public KryDockPage(MenuItemElement element, Control content) { _element = element; this.Text = Element.DisplayName; this.TextTitle = Element.DisplayName; this.TextDescription = Element.DisplayName; // Add the control for display inside the page content.Dock = DockStyle.Fill; this.Controls.Add(content); }
public static void ProcessConfigItem(WorkItem workItem, ToolStripPanel toolStripPanel, MenuItemElement menuItem) { if (menuItem.IsContainer) { ToolStrip toolStrip = menuItem.ToToolStrip(); toolStrip.Size = new System.Drawing.Size(442, 25); toolStrip.Text = menuItem.Site; toolStrip.Name = menuItem.Site; toolStrip.ImageScalingSize = new System.Drawing.Size(32, 32); toolStripPanel.Join(toolStrip); workItem.UIExtensionSites.RegisterSite(menuItem.Site, toolStrip); workItem.RootWorkItem.Items.Add(toolStrip, menuItem.Site); } else { foreach (Control control in toolStripPanel.Controls) { ToolStrip toolStrip = control as ToolStrip; toolStrip.ImageScalingSize = new System.Drawing.Size(32, 32); if (toolStrip != null) { if (toolStrip.Name == menuItem.Site) { ToolStripButton toolStripButton = menuItem.ToToolStripItem(); toolStripButton.ToolTipText = menuItem.CommandName; toolStripButton.Name = menuItem.CommandName; toolStripButton.Tag = menuItem.Icon; toolStripButton.Image = menuItem.GetIcon(menuItem.Icon); if (workItem.UIExtensionSites.Contains(menuItem.Site)) { workItem.UIExtensionSites[menuItem.Site].Add<ToolStripButton>(toolStripButton); } if (!String.IsNullOrEmpty(menuItem.CommandName)) workItem.Commands[menuItem.CommandName].AddInvoker(toolStripButton, "Click"); } } } } }
private void CreatePage(MenuItemElement item) { if (item.DisplayType != DisplayType.View) { return; } Type t = Type.GetType(item.SourceType); var ctr = Activator.CreateInstance(t) as Control; ctr.Dock = DockStyle.Fill; var page = new KryptonPage() { Text = item.DisplayName }; page.Controls.Add(ctr); kryptonNavigator1.Pages.Add(page); }
private void Item_Click(object sender, EventArgs e) { if (sender == null) { return; } MenuItemElement element = (sender as ToolStripItem).Tag as MenuItemElement; switch (element.DisplayType) { case DisplayType.Form: break; case DisplayType.View: case DisplayType.Tool: case DisplayType.Func: break; } }
public static void LoadFromConfig(WorkItem workItem, ToolStripPanel toolStripPanel, XmlDocument doc) { XmlConfig xcfg = new XmlConfig(doc); ConfigSetting newplugin = xcfg.Settings["toolstrips"]; foreach (ConfigSetting setting in newplugin.Children()) { if (setting.Name.Contains("comment")) continue; MenuItemElement menuItem = new MenuItemElement(); menuItem.CommandName = setting["commandname"].Value; menuItem.Icon = setting["icon"].Value; menuItem.Label = setting["label"].Value; menuItem.ID = setting["id"].Value == "" ? 0 : Convert.ToInt32(setting["id"].Value); menuItem.Key = setting["key"].Value; menuItem.IsContainer = setting["iscontainer"].Value == "" ? false : true; menuItem.Site = setting["site"].Value; ProcessConfigItem(workItem, toolStripPanel, menuItem); } }
private void CreteMenuItem(MenuItemElement element, ToolStripItemCollection collection, MenuFontLevel level) { ToolStripItem item = null; switch (element.DisplayType) { case DisplayType.None: item = new ToolStripMenuItem(); foreach (MenuItemElement temp in element.Items) { CreteMenuItem(temp, (item as ToolStripMenuItem).DropDownItems, (int)level + 1 > 2 ? MenuFontLevel.Third : level + 1); } break; case DisplayType.Form: case DisplayType.View: case DisplayType.Tool: case DisplayType.Func: item = new ToolStripMenuItem(); item.Click += Item_Click; break; case DisplayType.Partition: item = new ToolStripSeparator(); break; default: break; } if (item != null) { item.Tag = element; item.Text = element.DisplayName; item.Font = FontFactory.GetMenuFont(level); collection.Add(item); } }
public IElement Convert2Element(XmlNode node, IElement parent) { string tagName = node.Name; IElement element = null; switch (tagName) { case APP_FOLDER: element = new AppFolderRanorexElement(); break; case FOLDER: element = new FolderRanorexElement(); break; case ITEM: string name = node.Attributes[NAME].Value; string addcaps = node.Attributes[ADD_CAPS].Value; string capname = node.Attributes[CAP_NAME].Value; switch (capname) { case ElementBase.BUTTON: element = new ButtonElement(); break; case ElementBase.TEXT: if (addcaps.Contains(ACCESSIBLE) || addcaps.Contains(WPFGROUPELEMENT)) { element = new EditableTextElement(); } else { element = new TextElement(); } break; case CONTAINER: element = new ContainerElement(); break; case LISTITEM: element = new ListItemElement(); break; case MENUITEM: element = new MenuItemElement(); break; case TABPAGE: element = new TabPageElement(); break; case TITLEBAR: element = new TitleBarElement(); break; case CHECKBOX: element = new CheckBoxElement(); break; case COMBOBOX: element = new ComboBoxElement(); break; default: element = new RanorexUnknowElement(); break; } break; case VARIABLES: break; } if (element != null) { element.Attributes.Name = node.Attributes[NAME].Value; if (parent != null) { element.Parent = parent; if (parent.Children == null) { parent.Children = new List <IElement>(); } parent.Children.Add(element); } if (node.HasChildNodes) { foreach (XmlNode child in node.ChildNodes) { Convert2Element(child, element); } } } return(element); }
public void Init(IPlayerController player, IHandModeController modeCtl) { // Because these are generated values var primaryModes = modeCtl.PrimaryModes; var gripModes = modeCtl.GripModes; var root = new VStackPanelElement(); var primaryPanel = new WrapPanelElement(); root.Children.Add(new MarginElement { Margin = Vector4.one * -MARGIN, Content = primaryPanel, }); root.Children.Add(new VSpacerElement { Height = 20.0f, }); var gripPanel = new WrapPanelElement(); root.Children.Add(new MarginElement { Margin = Vector4.one * -MARGIN, Content = gripPanel, }); for (int i = 0; i < primaryModes.Count; ++i) { var mode = primaryModes[i]; var item = InstantiateItem(player.ModeMenuItem, ModeMenuItem.ModeType.Primary, i, mode.Name); if (i == modeCtl.CurrPrimaryMode) { item.SetSelected(); } var el = new MenuItemElement(item, Z_GAP); primaryPanel.Children.Add(new MarginElement { Margin = Vector4.one * MARGIN, Content = el, }); } for (int i = 0; i < gripModes.Count; ++i) { var mode = gripModes[i]; var item = InstantiateItem(player.ModeMenuItem, ModeMenuItem.ModeType.Grip, i, mode.Name); if (i == modeCtl.CurrGripMode) { item.SetSelected(); } var el = new MenuItemElement(item, Z_GAP); gripPanel.Children.Add(new MarginElement { Margin = Vector4.one * MARGIN, Content = el, }); } root.Measure(new Vector2(300.0f, float.PositiveInfinity)); root.Arrange(new Rect(root.DesiredSize * -0.5f, root.DesiredSize)); }
public static void ProcessConfigItem(WorkItem workItem, ToolStripPanel toolStripPanel, List<Operation> operation) { IResourceService _resourceService = workItem.Services.Get<IResourceService>(); if (operation == null) return; MenuItemElement menuItem = new MenuItemElement(); foreach (Operation op in operation) { if (op.ContainerYN) { ToolStrip toolStrip = menuItem.ToToolStrip(); //ToolStrip toolStrip = new ToolStrip(); toolStrip.Size = new System.Drawing.Size(442, 25); toolStrip.Text = op.LocationType.ToString(); toolStrip.Name = op.LocationType.ToString(); toolStrip.ImageScalingSize = new System.Drawing.Size(32, 32); toolStripPanel.Join(toolStrip); workItem.UIExtensionSites.RegisterSite(op.LocationType.ToString(), toolStrip); workItem.RootWorkItem.Items.Add(toolStrip, op.LocationType.ToString()); } else { foreach (Control control in toolStripPanel.Controls) { ToolStrip toolStrip = control as ToolStrip; toolStrip.ImageScalingSize = new System.Drawing.Size(32, 32); if (toolStrip != null) { if (toolStrip.Name == op.LocationType.ToString()) { //ToolStripButton toolStripButton = op.ToToolStripItem(); ToolStripButton toolStripButton = new ToolStripButton(); toolStripButton.ToolTipText = op.Name; toolStripButton.Name = op.Name; toolStripButton.Tag = op.NormalResId; toolStripButton.Image = menuItem.GetIcon(op.NormalResId); if (workItem.UIExtensionSites.Contains(op.LocationType.ToString())) { workItem.UIExtensionSites[op.LocationType.ToString()].Add<ToolStripButton>(toolStripButton); } if (!String.IsNullOrEmpty(op.Name)) workItem.Commands[op.Name].AddInvoker(toolStripButton, "Click"); } } } } } }
public static IElement ParseElement(string localizedType, string designedId, string designedName, IElement parent) { IElement element = null; switch (localizedType.ToLower()) { case ElementBase.WINDOW: element = new WindowElement(); element.Attributes.ElementType = ElementBase.WINDOW_TYPE; break; case ElementBase.DIALOG: element = new WindowElement(); element.Attributes.ElementType = ElementBase.DIALOG_TYPE; break; case ElementBase.BUTTON: element = new ButtonElement(); element.Attributes.ElementType = ElementBase.BUTTON_TYPE; break; case ElementBase.COMBO_BOX: element = new ComboBoxElement(); element.Attributes.ElementType = ElementBase.COMBOBOX_TYPE; break; case ElementBase.TEXT: element = new TextElement(); element.Attributes.ElementType = ElementBase.TEXT_TYPE; break; case ElementBase.PANE: element = new ContainerElement(); element.Attributes.ElementType = ElementBase.CONTAINER_TYPE; break; case ElementBase.TITLE_BAR: element = new TitleBarElement(); element.Attributes.ElementType = ElementBase.TITLEBAR_TYPE; break; case ElementBase.MENU_BAR: element = new MenuBarElement(); element.Attributes.ElementType = ElementBase.MENUBAR_TYPE; break; case ElementBase.DOCUMENT: element = new EditableTextElement(); element.Attributes.ElementType = ElementBase.EDITABLETEXT_TYPE; break; case ElementBase.TAB: element = new TabPageElement(); element.Attributes.ElementType = ElementBase.TABPAGE_TYPE; break; case ElementBase.TAB_ITEM: element = new TabItemElement(); element.Attributes.ElementType = ElementBase.TABITEM_TYPE; break; case ElementBase.SCROLL_BAR: element = new ScrollBarElement(); element.Attributes.ElementType = ElementBase.SCROLLBAR_TYPE; break; //case THUMB: case ElementBase.TREE: element = new TreeViewElement(); element.Attributes.ElementType = ElementBase.TREEVIEW_TYPE; break; case ElementBase.TREE_VIEW: element = new TreeViewElement(); element.Attributes.ElementType = ElementBase.TREEVIEW_TYPE; break; case ElementBase.TREE_ITEM: element = new TreeItemElement(); element.Attributes.ElementType = ElementBase.TREEITEM_TYPE; break; case ElementBase.TABLE: element = new TableElement(); element.Attributes.ElementType = ElementBase.TABLE_TYPE; break; //? case ElementBase.HEADER: element = new HeaderElement(); element.Attributes.ElementType = ElementBase.HEADER_TYPE; break; case ElementBase.ITEM: if (parent != null && (parent is TableElement || parent is DatagridElement)) { element = new RowElement(); element.Attributes.ElementType = ElementBase.ROW_TYPE; } break; case ElementBase.LIST: //(listview or checkedlistbox) element = new ListElement(); element.Attributes.ElementType = ElementBase.LIST_TYPE; break; case ElementBase.LIST_VIEW: //(listview or checkedlistbox) element = new ListElement(); element.Attributes.ElementType = ElementBase.LIST_TYPE; break; case ElementBase.LIST_ITEM: //(table) element = new ListItemElement(); element.Attributes.ElementType = ElementBase.LISTITEM_TYPE; break; case ElementBase.EDIT: //textbox element = new EditableTextElement(); element.Attributes.ElementType = ElementBase.EDITABLETEXT_TYPE; break; case ElementBase.CHECK_BOX: element = new CheckBoxElement(); element.Attributes.ElementType = ElementBase.CHECKBOX_TYPE; break; case ElementBase.RADIO_BUTTON: element = new RadioButtonElement(); element.Attributes.ElementType = ElementBase.RADIO_BUTTON_TYPE; break; case ElementBase.CALENDAR: element = new CalendarElement(); element.Attributes.ElementType = "Calendar"; break; case ElementBase.CUSTOM: element = new CustomElement(); element.Attributes.ElementType = "Custom"; break; case ElementBase.DATAGRID: element = new DatagridElement(); element.Attributes.ElementType = "DataGrid"; break; case ElementBase.DATAGRID2: element = new DatagridElement(); element.Attributes.ElementType = "DataGrid"; break; case ElementBase.DATAITEM: element = new DataitemElement(); element.Attributes.ElementType = "dataitem"; break; case ElementBase.GROUP: element = new GroupELement(); element.Attributes.ElementType = ElementBase.GROUP_TYPE; break; case ElementBase.HEADER_ITEM: element = new HeaderItemElement(); element.Attributes.ElementType = "HeaderItem"; break; case ElementBase.HYPERLINK: element = new LinkElement(); element.Attributes.ElementType = "Hyperlink"; break; case ElementBase.IMAGE: element = new ImageElement(); element.Attributes.ElementType = "Image"; break; case ElementBase.MENU: element = new MenuElement(); element.Attributes.ElementType = "Menu"; break; case ElementBase.PROGRESS_BAR: element = new ProgressBarElement(); element.Attributes.ElementType = "ProgressBar"; break; case ElementBase.SEPARATOR: element = new SeparatorElement(); element.Attributes.ElementType = "Separator"; break; case ElementBase.SLIDER: element = new SliderElement(); element.Attributes.ElementType = "Slider"; break; case ElementBase.SPINNER: element = new SpinnerElement(); element.Attributes.ElementType = "Spinner"; break; case ElementBase.SPLIT_BUTTON: element = new SplitButtonElement(); element.Attributes.ElementType = "SplitButton"; break; case ElementBase.STATUS_BAR: element = new StatusBarElement(); element.Attributes.ElementType = "StatusBar"; break; case ElementBase.TOOL_BAR: element = new ToolBarElement(); element.Attributes.ElementType = "ToolBar"; break; case ElementBase.TOOL_TIP: element = new ToolTipElement(); element.Attributes.ElementType = "ToolTip"; break; //? case ElementBase.MENU_ITEM: element = new MenuItemElement(); element.Attributes.ElementType = "MenuItem"; break; case ElementBase.LINK: element = new LinkElement(); element.Attributes.ElementType = ElementBase.LINK_TYPE; break; } if (element == null) { if (parent is TableElement || parent is DatagridElement) { element = new RowElement(); element.Attributes.ElementType = ElementBase.ROW_TYPE; } else if (parent is RowElement) { element = new CellElement(); element.Attributes.ElementType = ElementBase.CELL_TYPE; } else { element = new UnknownELement(); element.Attributes.ElementType = ElementBase.UNKNOWN_TYPE; } } element.Attributes.DesignedId = designedId; return(element); }