示例#1
0
        //----------------------------------------------------------------------
        public NotebookPane(MainMenuManager _manager)
            : base(_manager)
        {
            //------------------------------------------------------------------
            var notebook = new NuclearUI.Notebook(Manager.MenuScreen);

            AddChild(notebook);

            notebook.HasClosableTabs = true;

            var homeTab = new NuclearUI.NotebookTab(notebook, "Home", null);

            homeTab.IsPinned = true;
            notebook.Tabs.Add(homeTab);

            var createTab = new NuclearUI.Button(Manager.MenuScreen, "Create tab");

            createTab.AnchoredRect = NuclearUI.AnchoredRect.CreateFull(10);

            int iTabCounter = 0;

            createTab.ClickHandler = delegate {
                var tab = new NuclearUI.NotebookTab(notebook, string.Format("Tab {0}", ++iTabCounter), null);

                notebook.Tabs.Add(tab);
            };

            homeTab.PageGroup.AddChild(createTab);
        }
示例#2
0
        //----------------------------------------------------------------------
        public NotebookTab( Notebook _notebook, string _strText, Texture2D _iconTex )
            : base(_notebook.Screen)
        {
            mNotebook       = _notebook;
            Parent          = _notebook;

            mLabel          = new Label( Screen, "", Anchor.Start, Screen.Style.DefaultTextColor );
            mIcon           = new Image( Screen, _iconTex );

            mTooltip        = new Tooltip( Screen, "" );

            mCloseButton    = new Button( Screen, new Button.ButtonStyle( 5, null, null, Screen.Style.NotebookTabCloseHover, Screen.Style.NotebookTabCloseDown, null, 0, 0 ), "", Screen.Style.NotebookTabClose, Anchor.Center );
            mCloseButton.Parent = this;
            mCloseButton.Padding = new Box(0);
            mCloseButton.ClickHandler = delegate {
                mNotebook.Tabs.Remove( this );

                Screen.Focus( mNotebook );

                if( mNotebook.TabClosedHandler != null )
                {
                    mNotebook.TabClosedHandler( this );
                }
            };

            Text            = _strText;

            PageGroup       = new Group( Screen );
            PageGroup.Parent = this;
        }