Пример #1
0
        public PanelManager(IGUIContext ctx)
            : base(ctx)
        {
            MenuPanel = new Panel("menupanel", Docking.Top);
            AddChild(MenuPanel);

            StatusPanel = new Panel("statuspanel", Docking.Bottom);
            AddChild(StatusPanel);

            MainMenu = new GuiMenu("mainmenu");
            MenuBar  = new MenuBar("mainmenubar", MainMenu);
            ToolBar  = new ToolBar("maintoolbar", MainMenu);

            MenuPanel.AddChild(MenuBar);
            MenuPanel.AddChild(ToolBar);

            StatusBar = new StatusBar("mainstatusbar");
            StatusPanel.AddChild(StatusBar);

            LeftSideBar = new ScrollableContainer("leftsidebar", Docking.Left);
            AddChild(LeftSideBar);

            MainSplitter = new SplitContainer("mainsplitter", SplitOrientation.Vertical, -0.25f);
            AddChild(MainSplitter);

            TabMain = new TabContainer("maintabs");
            MainSplitter.Panel1.AddChild(TabMain);

            RightSideBarVisible = false;
        }
Пример #2
0
        public ApplicationWindow(string caption, int width, int height)
            : base(caption, width, height)
        {
            Name = "ApplicationWindow";

            MainMenu  = new GuiMenu("mainmenu");
            MenuPanel = AddChild(new MenuPanel(MainMenu));
            MenuPanel.WebsiteTitle = "Visit the Kroll-Software Website..";
            MenuPanel.WebsiteURL   = "http://www.kroll-software.ch";

            StatusPanel = AddChild(new Panel("statuspanel", Docking.Bottom));

            StatusBar = StatusPanel.AddChild(new StatusBar("mainstatusbar"));

            MainSplitter = AddChild(new ComplexSplitContainer("mainsplitter", Docking.Fill, new DarkGradientPanelWidgetStyle()));
            MainSplitter.PanelBottomCollapsed  = true;
            MainSplitter.PanelRightCollapsed   = true;
            MainSplitter.SplitterLeft.Distance = 200;

            TabMain      = MainSplitter.PanelCenter.AddChild(new TabContainer("maintabs"));
            TabMain.Dock = Docking.Fill;

            /******/
            LeftSideMenu                = MainSplitter.PanelLeft.AddChild(new SideMenuContainer("leftmenu", MenuPanel.MainMenu));
            LeftSideMenu.Dock           = Docking.Fill;
            LeftSideMenu.MenuBar.Close += (object sender, EventArgs e) => this.LeftSideBarVisible = false;
            MainSplitter.SplitterLeft.MinDistanceNear = LeftSideMenu.MinSize.Width;

            MenuPanel.InitMenu();
            //initialized = true;
        }
Пример #3
0
        public void ShowContextMenu(PointF location, IGuiMenuItem[] items)
        {
            GuiMenu menu = new GuiMenu("contextmenu");

            menu.AddRange(items);
            ShowContextMenu(location, menu);
        }
Пример #4
0
        public GuiMenuItem(string name, string text, char icon = (char)0)
        {
            Name       = name;
            Text       = text;
            ImageIndex = (uint)icon;
            Children   = new GuiMenu("sub");

            Visible       = true;
            Enabled       = true;
            ShowOnToolBar = true;
            Rank          = _rank++;
            //Collapsed = true;
        }
Пример #5
0
        public IGuiMenu MergeMenus(IGuiMenu menu1, IGuiMenu menu2)
        {
            if (menu1 == null || menu1.Count == 0)
            {
                return(menu2);
            }
            if (menu2 == null || menu2.Count == 0)
            {
                return(menu1);
            }
            GuiMenu m = new GuiMenu(menu1.Name + "+" + menu2.Name);
            int     i = 0;

            while (i < menu1.Count)
            {
                m.Add(menu1.Children [i++]);
            }
            if (!m.Last().IsSeparator)
            {
                m.Add(new GuiMenuItem("mergeseparator", "-"));
            }
            i = 0;
            while (i < menu2.Count && menu2.Children [i].IsSeparator)
            {
                i++;
            }
            while (i < menu2.Count)
            {
                IGuiMenuItem itm = menu2.Children [i++];
                if (itm.IsSeparator)
                {
                    if (!m.Last().IsSeparator)
                    {
                        m.Add(itm);
                    }
                }
                else if (m.FindItem(itm.Name) == null)
                {
                    m.Add(itm);
                }
            }
            while (m.Count > 0 && m.Last().IsSeparator)
            {
                m.RemoveAt(m.Count - 1);
            }
            return(m);
        }
Пример #6
0
        protected ToolBarBase(string name, IGuiMenu menu, IWidgetStyle style)
            : base(name, Docking.Top, style)
        {
            IsMenu = true;
            Menu   = menu;
            if (Menu == null)
            {
                Menu = new GuiMenu(name + "_menu");
            }

            this.ZIndex  = 1000;
            this.Padding = new Padding(3, 2, 3, 2);
            MinSize      = new Size(0, 16);

            CanFocus = false;
            TabIndex = -1;

            RefreshMenu();
        }
Пример #7
0
        public IGuiMenu GetAutoContextMenu(Widget w)
        {
            GuiMenu m        = new GuiMenu("auto");
            int     sepCount = 0;

            MenuCommandDefinitions.Interfaces.Values.Where(t => t.Commands.Count > 0 && w.HasInterface(t.InterfaceType))
            .OrderBy(g => g.Commands.First().MenuItem.Rank)
            .ForEach(g => {
                g.Commands.Select(c => c.MenuItem).OrderBy(x => x.Rank)
                .ForEach(m.Add);
                m.Add(new GuiMenuItem("sep" + sepCount++, "-"));
            });

            while (m.Count > 0 && m.Last().IsSeparator)
            {
                m.RemoveAt(m.Count - 1);
            }

            return(m);
        }