public void AddNodeNetworkMenus(MenuStrip menuStripToAddTo) { MenuItem menuItem = menuStripToAddTo.AddItem("NodeNetwork"); menuItem.AddItem("Load NodeNetwork...").Click += new GuiMessage(LoadNodeNetworkClick); menuItem.AddItem("Close NodeNetwork").Click += new GuiMessage(CloseNodeNetworkClick); }
private static void CreateMenuStrip() { MenuStrip menuStrip = GuiManager.AddMenuStrip(); MenuItem menuItem = menuStrip.AddItem("File"); menuItem.AddItem("Load Assembly").Click += LoadAssembly; }
private void OpenWindowWithMenuAndStatusBar(ControlBase control, EventArgs args) { Window window = new Window(this); window.Title = String.Format("Window ({0})", ++m_WindowCount); window.Size = new Size(m_Rand.Next(200, 400), m_Rand.Next(200, 400)); window.Left = m_Rand.Next(700); window.Top = m_Rand.Next(400); window.Padding = new Padding(1, 0, 1, 1); DockLayout layout = new DockLayout(window); MenuStrip menuStrip = new MenuStrip(layout); menuStrip.Dock = Dock.Top; /* File */ { MenuItem root = menuStrip.AddItem("File"); root.Menu.AddItem("Load", "test16.png", "Ctrl+L"); root.Menu.AddItem("Save", String.Empty, "Ctrl+S"); root.Menu.AddItem("Save As..", String.Empty, "Ctrl+A"); root.Menu.AddItem("Quit", String.Empty, "Ctrl+Q").SetAction((c, a) => window.Close()); } /* Resizing */ { MenuItem root = menuStrip.AddItem("Resizing"); root.Menu.AddItem("Disabled").SetAction((c, a) => window.Resizing = Resizing.None); root.Menu.AddItem("Width").SetAction((c, a) => window.Resizing = Resizing.Width); root.Menu.AddItem("Height").SetAction((c, a) => window.Resizing = Resizing.Height); root.Menu.AddItem("Both").SetAction((c, a) => window.Resizing = Resizing.Both); } StatusBar statusBar = new StatusBar(layout); statusBar.Dock = Dock.Bottom; statusBar.Text = "Status bar"; { Button br = new Button(statusBar); br.Text = "Right button"; statusBar.AddControl(br, true); } }
public override void Initialize() { base.Initialize(); ptree = new PropertyTree(panel); tagStrip = new MenuStrip(panel); var root = tagStrip.AddItem("Add tag"); root.Position(Gwen.Pos.Top, 0, 100); root.Menu.Position(Gwen.Pos.Top, 0, 20); root.Clicked += (sender, arguments) => { var menu = sender as MenuItem; menu.Menu.Show(); }; foreach (var tag in TagsContainer.allTags) { root.Menu.AddItem(tag); } root.Menu.AddDivider(); root.Menu.AddItem("Create new tag").SetAction((Base sender, EventArgs arguments) => Console.WriteLine()); //root.Menu.; tagStrip.Hide(); ptree.ShouldDrawBackground = false; Selection.OnSelectionChange += (sender, args) => { var entity = (sender as Func <object>)() as Entity; if (entity != null) { var comps = entity.GetAllComponents(); ptree.RemoveAll(); var prop = ptree.Add("Transform"); prop.Add("Position:", new Gwen.Control.Property.Vector3(prop), entity.Position).ValueChanged += (o, arg) => { var tmpObj = o as PropertyRow <Vector3>; entity.Position = tmpObj.Value; }; prop.Add("Rotation:", new Gwen.Control.Property.Vector3(prop), entity.Rotation).ValueChanged += (o, arg) => { var tmpObj = o as PropertyRow <Vector3>; entity.Rotation = tmpObj.Value; }; prop.Add("Scale:", new Gwen.Control.Property.Vector3(prop), entity.Scale).ValueChanged += (o, arg) => { var tmpObj = o as PropertyRow <Vector3>; entity.Scale = tmpObj.Value; }; foreach (var component in comps) { prop = ptree.Add(component.GetType().Name); var inspector = new DefaultInspector(); inspector.properties = prop; inspector.getTarget = () => component; inspector.OnInitializeGUI(); } ptree.Show(); ptree.SetBounds(0, 25, 200, 200); ptree.ExpandAll(); tagStrip.Show(); } //else //props=Selection.assets [0].GetType ().GetProperties ().Where (p=>p.CanRead && p.CanWrite); }; }
public TextPad(ControlBase parent) : base(parent) { StartPosition = StartPosition.CenterParent; Size = new Size(400, 300); Padding = new Padding(1, 0, 1, 1); Title = "TextPad"; DockLayout layout = new DockLayout(this); layout.Dock = Dock.Fill; MenuStrip menuStrip = new MenuStrip(layout); menuStrip.Dock = Dock.Top; MenuItem fileMenu = menuStrip.AddItem("File"); fileMenu.Menu.AddItem("Open...", String.Empty, "Ctrl+O").SetAction((s, a) => OnOpen(s, a)); fileMenu.Menu.AddItem("Save", String.Empty, "Ctrl+S").SetAction((s, a) => OnSave(s, a)); fileMenu.Menu.AddItem("Save As...").SetAction((s, a) => OnSaveAs(s, a)); fileMenu.Menu.AddItem("Quit", String.Empty, "Ctrl+Q").SetAction((s, a) => Close()); m_Font = Skin.DefaultFont.Copy(); m_Font.FaceName = "Courier New"; StatusBar statusBar = new StatusBar(layout); statusBar.Dock = Dock.Bottom; Label length = new Label(statusBar); length.Margin = new Margin(5, 0, 5, 0); Label label = new Label(statusBar); label.Margin = new Margin(5, 0, 5, 0); label.Text = "Length:"; Label lines = new Label(statusBar); lines.Margin = new Margin(5, 0, 5, 0); label = new Label(statusBar); label.Margin = new Margin(5, 0, 5, 0); label.Text = "Lines:"; m_TextBox = new MultilineTextBox(layout); m_TextBox.Dock = Dock.Fill; m_TextBox.ShouldDrawBackground = false; m_TextBox.Font = m_Font; m_TextBox.TextChanged += (sender, arguments) => { lines.Text = m_TextBox.TotalLines.ToString(); length.Text = m_TextBox.Text.Length.ToString(); }; m_TextBox.Text = ""; m_Path = null; }
public MenuTest(ControlBase parent) : base(parent) { MenuStrip menu = new MenuStrip(parent); var item = menu.AddItem("Test"); item.Menu.AddItem("I'm a menu item"); var chk = item.Menu.AddItem("Check"); chk.IsCheckable = true; chk.IsChecked = true; var ex = item.Menu.AddItem("Expand me"); ex.Menu.AddItem("I was expanded"); item.Menu.AddDivider(); item.Menu.AddItem("Divider^"); item = menu.AddItem("Too many test"); for (int i = 0; i < 30; i++) { item.Menu.AddItem("item " + i); } FlowLayout flow = new FlowLayout(parent); flow.Dock = Dock.Fill; flow.Margin = Margin.Three; ComboBox cb = new ComboBox(flow) { Margin = Margin.Three }; cb.AddItem("Test"); cb.AddItem("Come on combobox"); cb.AddItem("maybe"); cb = new ComboBox(flow); cb.AddItem("Disabled"); cb.AddItem("combobox"); cb.AddItem("maybe"); cb.Disable(); }
public override void Initialize() { base.Initialize(); ptree = new PropertyTree(panel); tagStrip = new MenuStrip(panel); var root = tagStrip.AddItem("Add tag"); root.Position(Gwen.Pos.Top, 0, 100); root.Menu.Position(Gwen.Pos.Top, 0, 20); root.Clicked += (sender, arguments) => { var menu = sender as MenuItem; menu.Menu.Show(); }; foreach (var tag in TagsContainer.allTags) { root.Menu.AddItem(tag); } root.Menu.AddDivider(); root.Menu.AddItem("Create new tag").SetAction((Base sender, EventArgs arguments) => Console.WriteLine()); //root.Menu.; tagStrip.Hide(); ptree.ShouldDrawBackground = false; Selection.OnSelectionChange += (sender, args) => { Console.WriteLine("SelectionChange"); ptree.RemoveAll(); if (sender is Entity entity) { RenderComponents(entity); } //else //props=Selection.assets [0].GetType ().GetProperties ().Where (p=>p.CanRead && p.CanWrite); tagStrip.Show(); ptree.Show(); ptree.SetBounds(0, 25, panel.Width, 200); ptree.ExpandAll(); }; Selection.OnSelectionDirty += (sender, args) => { if (sender is Entity entity) { RenderComponents(entity); } }; }
private void BuildUI() { #region Main Menu var menu = new MenuStrip(_canvas); menu.Dock = Dock.Top; var file = menu.AddItem("File"); file.AddItem("New", string.Empty, "Ctrl+N").Selected += OnCommandSelected; file.AddItem("Save", string.Empty, "Ctrl+S").Selected += OnCommandSelected; file.AddItem("Save As", string.Empty, "Ctrl+Maj+S").Selected += OnCommandSelected; file.AddItem("Load", string.Empty, "Ctrl+L").Selected += OnCommandSelected; file.AddItem("Exit").Selected += OnCommandSelected; var edit = menu.AddItem("Edit"); edit.AddItem("Copy", string.Empty, "Ctrl+C").Selected += OnCommandSelected; edit.AddItem("Cut", string.Empty, "Ctrl+X").Selected += OnCommandSelected; edit.AddItem("Past", string.Empty, "Ctrl+V").Selected += OnCommandSelected; edit.AddItem("Duplicate", string.Empty, "Ctrl+D").Selected += OnCommandSelected; edit.AddItem("Delete", string.Empty, "Suppr").Selected += OnCommandSelected; edit.AddItem("Select All", string.Empty, "Ctrl+A").Selected += OnCommandSelected; edit.AddItem("Settings").Selected += OnCommandSelected; var gameObject = menu.AddItem("GameObject"); gameObject.AddItem("Cube").Selected += OnGameObjectSelected; gameObject.AddItem("Cylinder").Selected += OnGameObjectSelected; gameObject.AddItem("Plane").Selected += OnGameObjectSelected; gameObject.AddItem("Pyramid").Selected += OnGameObjectSelected; gameObject.AddItem("Quad").Selected += OnGameObjectSelected; gameObject.AddItem("Sphere").Selected += OnGameObjectSelected; gameObject.AddItem("Torus").Selected += OnGameObjectSelected; gameObject.AddItem("Camera").Selected += OnGameObjectSelected; var terrain = gameObject.AddItem("Terrain"); terrain.AddItem("Terrain").Selected += OnGameObjectSelected; terrain.AddItem("Lava").Selected += OnGameObjectSelected; terrain.AddItem("Water").Selected += OnGameObjectSelected; var lights = gameObject.AddItem("Light"); lights.AddItem("Directional").Selected += OnGameObjectSelected; lights.AddItem("Point").Selected += OnGameObjectSelected; lights.AddItem("Spot").Selected += OnGameObjectSelected; var component = menu.AddItem("Components"); var pp = component.AddItem("Post Processing"); pp.AddItem("AverageColor").Selected += OnComponentSelected; pp.AddItem("C64").Selected += OnComponentSelected; pp.AddItem("CGA").Selected += OnComponentSelected; pp.AddItem("Convolution").Selected += OnComponentSelected; pp.AddItem("Bloom").Selected += OnComponentSelected; pp.AddItem("Film").Selected += OnComponentSelected; pp.AddItem("FXAA").Selected += OnComponentSelected; pp.AddItem("GlobalFog").Selected += OnComponentSelected; pp.AddItem("MotionBlur").Selected += OnComponentSelected; pp.AddItem("Screen Space Ambient Obscurance").Selected += OnComponentSelected; pp.AddItem("Simple Blur").Selected += OnComponentSelected; pp.AddItem("Vignette").Selected += OnComponentSelected; var help = menu.AddItem("Help"); help.AddItem("About").Selected += OnCommandSelected; #endregion #region Main Dock var mainDock = new DockControl(_canvas); mainDock.Dock = Dock.Fill; mainDock.RightDock.Width = 300; _sceneTreeControl = new TreeControl(_canvas); _sceneTreeControl.Selected += OnSceneTreeNodeSelected; _transformControl = new TransformControl(_canvas); mainDock.RightDock.Add("Scene", _sceneTreeControl); mainDock.RightDock.Add("Inspector", _transformControl); _statusBar = new StatusBar(_canvas); _statusBar.Dock = Dock.Bottom; _statusBar.Text = "C3DE Editor Ready"; #endregion }
public MenuTest(ControlBase parent) : base(parent) { /* Menu Strip */ { MenuStrip menu = new MenuStrip(this); menu.Dock = Dock.Top; /* File */ { MenuItem root = menu.AddItem("File"); root.Menu.AddItem("Load", "test16.png", "Ctrl+L").SetAction(MenuItemSelect); root.Menu.AddItem("Save", String.Empty, "Ctrl+S").SetAction(MenuItemSelect); root.Menu.AddItem("Save As..", String.Empty, "Ctrl+A").SetAction(MenuItemSelect); root.Menu.AddItem("Quit", String.Empty, "Ctrl+Q").SetAction(MenuItemSelect); } /* Russian */ { MenuItem pRoot = menu.AddItem("\u043F\u0438\u0440\u0430\u0442\u0441\u0442\u0432\u043E"); pRoot.Menu.AddItem("\u5355\u5143\u6D4B\u8BD5").SetAction(MenuItemSelect); pRoot.Menu.AddItem("\u0111\u01A1n v\u1ECB th\u1EED nghi\u1EC7m", "test16.png").SetAction(MenuItemSelect); } { MenuItem sRoot = menu.AddItemPath("File/s/d/s/s/d/f"); } /* Embdedded Menu Items */ { MenuItem pRoot = menu.AddItem("Submenu"); MenuItem pCheckable = pRoot.Menu.AddItem("Checkable"); pCheckable.IsCheckable = true; pCheckable.IsCheckable = true; { MenuItem pRootB = pRoot.Menu.AddItem("Two"); pRootB.Menu.AddItem("Two.One"); pRootB.Menu.AddItem("Two.Two"); pRootB.Menu.AddItem("Two.Three"); pRootB.Menu.AddItem("Two.Four"); pRootB.Menu.AddItem("Two.Five"); pRootB.Menu.AddItem("Two.Six"); pRootB.Menu.AddItem("Two.Seven"); pRootB.Menu.AddItem("Two.Eight"); pRootB.Menu.AddItem("Two.Nine", "test16.png"); } pRoot.Menu.AddItem("Three"); pRoot.Menu.AddItem("Four"); pRoot.Menu.AddItem("Five"); { MenuItem pRootB = pRoot.Menu.AddItem("Six"); pRootB.Menu.AddItem("Six.One"); pRootB.Menu.AddItem("Six.Two"); pRootB.Menu.AddItem("Six.Three"); pRootB.Menu.AddItem("Six.Four"); pRootB.Menu.AddItem("Six.Five", "test16.png"); { MenuItem pRootC = pRootB.Menu.AddItem("Six.Six"); pRootC.Menu.AddItem("Sheep"); pRootC.Menu.AddItem("Goose"); { MenuItem pRootD = pRootC.Menu.AddItem("Camel"); pRootD.Menu.AddItem("Eyes"); pRootD.Menu.AddItem("Nose"); { MenuItem pRootE = pRootD.Menu.AddItem("Hair"); pRootE.Menu.AddItem("Blonde"); pRootE.Menu.AddItem("Black"); { MenuItem pRootF = pRootE.Menu.AddItem("Red"); pRootF.Menu.AddItem("Light"); pRootF.Menu.AddItem("Medium"); pRootF.Menu.AddItem("Dark"); } pRootE.Menu.AddItem("Brown"); } pRootD.Menu.AddItem("Ears"); } pRootC.Menu.AddItem("Duck"); } pRootB.Menu.AddItem("Six.Seven"); pRootB.Menu.AddItem("Six.Eight"); pRootB.Menu.AddItem("Six.Nine"); } pRoot.Menu.AddItem("Seven"); } } /* Context Menu Strip */ { Label lblClickMe = new Label(this); lblClickMe.Dock = Dock.Fill; lblClickMe.VerticalAlignment = VerticalAlignment.Center; lblClickMe.Text = "Right Click Me"; m_ContextMenu = new Menu(this); m_ContextMenu.AddItem("Test"); m_ContextMenu.AddItem("Clickable").Clicked += (sender2, args2) => { UnitPrint("Clickable item was clicked"); }; lblClickMe.RightClicked += (sender, args) => { m_ContextMenu.Position = this.CanvasPosToLocal(new Point(args.X, args.Y)); m_ContextMenu.Show(); }; } }