private void CreatePanelTab() { WriteBlock.AppendTask(() => { var command = Command.Create(Guid.NewGuid().ToString()); command.Image = Resources.robot; command.Text = "PanelTab Created by EllieWare"; command.IsVisible = true; var tab = PanelTab.Create(command, new TextBox(), Panel.Structure); }); }
void Start() { Panel leftGroupPanel = PanelUtils.CreatePanelFor(leftTab1Content, dynamicPanelsCanvas); Panel rightGroupPanel = PanelUtils.CreatePanelFor(rightTab1Content, dynamicPanelsCanvas); // Set the minimum sizes of the contents associated with the tabs leftGroupPanel[0].MinSize = new Vector2(400f, 200f); rightGroupPanel[0].MinSize = new Vector2(400f, 200f); // Left Panel PanelTab hierarchyTab = leftGroupPanel.GetTab(leftTab1Content); hierarchyTab.Label = " Hierarchy"; hierarchyTab.Icon = null; PanelTab searchTab = leftGroupPanel.AddTab(leftTab2Content); searchTab.Label = " Search"; searchTab.Icon = null; // Right Panel PanelTab inspectorTab = rightGroupPanel.GetTab(rightTab1Content); inspectorTab.Label = " Inspector"; inspectorTab.Icon = null; if (rightTab2Content != null) { PanelTab commandsTab = rightGroupPanel.AddTab(rightTab2Content); commandsTab.Label = " Commands"; commandsTab.Icon = null; } leftGroupPanel.ActiveTab = 0; // leftGroupPanel.DockToRoot(Direction.Left); rightGroupPanel.ActiveTab = 0; // rightGroupPanel.DockToRoot(Direction.Right); dynamicPanelsCanvas.ForceRebuildLayoutImmediate(); leftGroupPanel.ResizeTo(new Vector2(450, 800)); rightGroupPanel.ResizeTo(new Vector2(520, 800)); }
public void Initialize() { // load Commands.xml from disk var execAssy = Assembly.GetExecutingAssembly(); var execAssyDir = Path.GetDirectoryName(execAssy.Location); var cfgXmlFilePath = Path.Combine(execAssyDir, RuntimeConfigFileName); var cfg = RuntimeConfig.LoadFromFile(cfgXmlFilePath); var capsules = new List <CommandCapsule> { new CommandCapsule(RibbonTabId, cfg.RibbonText), new CommandCapsule(ManagerGroupId, cfg.TabText) }; // create TemplateCapsule/s and add to list foreach (var thisCmd in cfg.CommandConfigs) { // load icon which should be next to dll var imgFilePath = Path.Combine(execAssyDir, thisCmd.Image); var img = System.Drawing.Image.FromFile(imgFilePath); var newCmd = new TemplateCapsule(thisCmd.Name, thisCmd.Text, img, thisCmd.Hint, mRoot, mCallback, thisCmd.SpecFileName); capsules.Add(newCmd); } foreach (var commandCapsule in capsules) { commandCapsule.Initialize(); } // load panel icon which should be next to dll var icoFilePath = Path.Combine(execAssyDir, cfg.PanelIcon); var ico = System.Drawing.Image.FromFile(icoFilePath); // create LogWindow and add it to Structure panel var cmd = Command.Create("RobotWare.Runtime.SpaceClaim"); cmd.Image = ico; cmd.Text = cfg.PanelText; cmd.IsVisible = true; var rtTab = PanelTab.Create(cmd, mCallback, Panel.Structure); }
protected override void OnInitialize(Command command) { // Add a keyboard shortcut for this command. // Show manager when Ctrl+M is pressed. const Keys shortcut = Keys.Control | Keys.M; if (Command.GetCommand(shortcut) == null) // else shortcut is already used by another command { command.Shortcuts = new[] { shortcut }; } var cmd = Command.Create("EllieWare.RobotWare.SpaceClaim"); cmd.Image = Resources.robot; cmd.Text = Resources.ManagerText; cmd.IsVisible = true; var mgrCtl = new ManagerCtl(mLicenseWrapper); var mgrTab = PanelTab.Create(cmd, mgrCtl, Panel.Structure); }
public Login() { InitializeComponent(); this.LockSize(); Text = Text.Replace("[0.0]", Program.currentVersion); lblCurrentVersion.Text = "Current Version: " + Program.currentVersion; lblNewestVersion.Text = "Newest Version: " + Program.newestVersion; lblRegisteredUsers.Text = "Registered Users: " + Networking.GetData("registered_user_count"); txtChangelog.Text = Networking.GetData("changelog"); CenterLabel(lblCurrentVersion); CenterLabel(lblNewestVersion); CenterLabel(lblRegisteredUsers); txtUsername.ApplyPlaceholder("username", Color.DarkGray, Color.FromArgb(255, 51, 153, 255)); txtPassword.ApplyPlaceholder("password", Color.DarkGray, Color.FromArgb(255, 51, 153, 255), "*"); PanelTabControl pTab = new PanelTabControl(PanelTabType.ButtonBased, drawBorders: false); LoginTab = new PanelTab(tabLogin, lblLogin, pnlLogin); ChangelogTab = new PanelTab(tabChangelog, lblChangelog, pnlChangelog); pTab.AddTab(LoginTab); pTab.AddTab(ChangelogTab); pTab.TabChanged += (s, e) => tabChanged(s, e); pTab.SelectTab(0); }
public void SelectTab(PanelTab tab, EventArgs e = null) { if (e != null && ((MouseEventArgs)e).Button != MouseButtons.Left) { return; } if (SelectedTab == tab) { return; } foreach (PanelTab ctab in tabs) { if (ctab == tab) { continue; } ctab.pnlBox.Visible = false; if (type == PanelTabType.VerticalAttatched) { ctab.pnlButton.Size = new Size(tab.btnOriginalWidth, ctab.pnlButton.Size.Height); } ctab.pnlButton.BackColor = Color_ButtonBackground; ctab.lblButton.ForeColor = Color_ButtonText; } tab.pnlBox.Visible = true; if (type == PanelTabType.VerticalAttatched) { tab.pnlButton.Size = new Size(tab.btnOriginalWidth + (tab.pnlBox.Location.X - tab.pnlButton.Right) + 1, tab.pnlButton.Size.Height); } tab.pnlButton.BackColor = Color_PanelBackground; tab.lblButton.ForeColor = Color_ButtonTextSelected; tab.pnlButton.BringToFront(); tab.pnlBox.BringToFront(); SelectedTab = tab; OnTabChanged(new EventArgs()); }
public void DrawPanel(object sender, PaintEventArgs e) { Panel p = (Panel)sender; if (p == null) { return; } PanelTab modifying = tabs.Find(tab => tab.pnlBox == p); int panelY = modifying.pnlBox.Location.Y; Pen myPen = new Pen(Color_PanelBackground); if (drawBorders) { ControlPaint.DrawBorder(e.Graphics, p.ClientRectangle, Color_PanelOutline, ButtonBorderStyle.Solid); } if (type == PanelTabType.VerticalAttatched) { // simple attatched appearance e.Graphics.DrawLine(myPen, 0, modifying.pnlButton.Top - (panelY - 1), 0, modifying.pnlButton.Bottom - (panelY + 2)); } else if (type == PanelTabType.ButtonBased) { // simply remove the line at the top if (!parent.IsNull() && parent.type == PanelTabType.VerticalAttatched) { e.Graphics.DrawLine(myPen, 1, 0, modifying.pnlBox.Width - 1, 0); // if it has a parent which is a vertical type, handle attatched appearance PanelTab parentModifying = parent.SelectedTab; int parentPanelY = parentModifying.pnlBox.Location.Y; int topY = parentModifying.pnlButton.Top - (parentPanelY - 1) - panelY; int bottomY = parentModifying.pnlButton.Bottom - (parentPanelY + 2) - panelY; e.Graphics.DrawLine(myPen, 0, topY, 0, bottomY); } } }
private void CreateTabBarWidget(Splitter container, TabBarPlacement placement, float stretch, bool requestTitle) { var tabbedWidget = new TabbedWidget { TabBar = new PanelTabBar(), AllowReordering = true, BarPlacement = TabbedWidget.TabBarPlacement.Bottom, PostPresenter = new SyncDelegatePresenter <TabbedWidget>(w => { w.PrepareRendererState(); var activeTab = (Tab)w.TabBar.Nodes[w.ActiveTabIndex]; var color = ColorTheme.Current.Docking.TabOutline; var a = activeTab.CalcPositionInSpaceOf(w); var start = a * Vector2.Down; var b = a + Vector2.Down * activeTab.ContentHeight; var c = b + activeTab.ContentWidth * Vector2.Right; var d = c - Vector2.Down * activeTab.ContentHeight; var end = start + w.Size * Vector2.Right; Renderer.DrawLine(start, a + Vector2.Right * 0.5f, color); Renderer.DrawLine(a, b, color); Renderer.DrawLine(b + new Vector2(-0.5f, -0.5f), c + new Vector2(0.5f, -0.5f), color); Renderer.DrawLine(c, d, color); Renderer.DrawLine(d + Vector2.Left * 0.5f, end, color); }) }; Widget rootWidget = tabbedWidget; tabbedWidget.FocusScope = new KeyboardFocusScope(tabbedWidget); tabbedWidget.TabBar.OnReordering += args => placement.Placements.Move(args.IndexFrom, args.IndexTo); if (requestTitle) { rootWidget = WrapWithTitle(tabbedWidget, out var closeButton, out var titleLabel); titleLabel.AddChangeWatcher( () => ((Tab)tabbedWidget.TabBar.Nodes[tabbedWidget.ActiveTabIndex]).Text, title => titleLabel.Text = title ); closeButton.Clicked += () => { placement.Placements.Where(p => !p.Hidden).ElementAt(tabbedWidget.ActiveTabIndex).Hidden = true; Refresh(); }; CreateDragBehaviour(placement, rootWidget.Nodes[0].AsWidget, rootWidget); } foreach (var panelPlacement in placement.Placements) { var panel = Model.Panels.First(pan => pan.Id == panelPlacement.Id); panel.ContentWidget.Unlink(); if (panelPlacement.Hidden) { continue; } var tab = new PanelTab { Text = panel.Id, Closable = false, }; tab.Closing += () => { Model.FindPanelPlacement(panel.Id).Hidden = true; Refresh(); }; tabbedWidget.AddTab(tab, new Widget { Id = $"DockPanel<{panel.Id}>", LayoutCell = new LayoutCell(), Layout = new VBoxLayout(), Padding = new Thickness(0, 1), Nodes = { panel.ContentWidget } }, true); CreateDragBehaviour(panelPlacement, tab, panel.ContentWidget); panel.PanelWidget = rootWidget; } tabbedWidget.ActiveTabIndex = 0; container.Nodes.Add(rootWidget); container.Stretches.Add(stretch); }
public ActionResult GetMenu(string id, PerfilViewModel model) { PanelViewModel modelObj = new PanelViewModel(); List <MOptions> lstResult = null; List <MOptions> lstQuery; string strController = string.Empty; MOptions entOpciones = new MOptions(); UserIdentity objUserIdenty = AutenticationManager.GetUser(); Session objSession = new Session() { UserId = AutenticationManager.GetUser().IdUsuario, }; entOpciones.ProfileId = Convert.ToInt32(id); lstResult = new WebApiOptions().GetOptions(entOpciones, objSession); AutenticationManager.SetOpciones(lstResult); AutenticationManager.SetPerfil(Convert.ToInt32(id)); modelObj.PerfilId = id; lstQuery = lstResult.Where(x => x.Action == 1).ToList(); modelObj.Items = new List <PanelTab>(); foreach (var item in lstQuery) { PanelTab pnlTab = new PanelTab(); pnlTab.Items = new List <PanelTabItem>(); pnlTab.Id = "p" + item.OptionId.ToString(); pnlTab.Text = item.Title; var lstN2 = lstResult.Where(a => a.Action == 2 && a.IdFather == item.OptionId); foreach (var itemN2 in lstN2) { PanelTabItem pnlTabItem = new PanelTabItem() { Id = itemN2.OptionId.ToString(), Text = itemN2.Title, IsSeparator = true }; pnlTab.Items.Add(pnlTabItem); var lstN3 = lstResult.Where(a => a.Action == 3 && a.IdFather == itemN2.OptionId); foreach (var itemN3 in lstN3) { pnlTab.Items.Add(new PanelTabItem() { Id = itemN3.OptionId.ToString(), Text = itemN3.Title, Action = string.IsNullOrEmpty(itemN3.Link) ? "" : itemN3.Link }); } } modelObj.Items.Add(pnlTab); } return(PartialView("_TabMenu", modelObj)); }