Esempio n. 1
0
        void Rebuild()
        {
            settingSize = true;
            ClearPaneds();
            var currentPaned = paned;
            int currentChild = 1;

            for (int n = 0; n < Children.Count; n++)
            {
                var c = Children [n];
                if (currentChild == 1)
                {
                    currentPaned.Add1(c);
                    currentChild++;
                }
                else if (n < Children.Count - 1)
                {
                    if (!(paned.Child2 is Paned childPaned))
                    {
                        childPaned = CreatePaned();
                        currentPaned.Add2(childPaned);
                    }
                    childPaned.Add1(c);
                    currentPaned = childPaned;
                    currentChild = 2;
                }
                else
                {
                    if (paned.Child2 is Paned childPaned)
                    {
                        paned.Remove(childPaned);
                        childPaned.Destroy();
                    }
                    paned.Add2(c);
                    currentPaned = null;
                }
            }
            if (currentPaned?.Child2 is Paned nextPaned)
            {
                currentPaned.Remove(nextPaned);
                nextPaned.Destroy();
            }
            RestoreSizes();
            settingSize = false;
        }
Esempio n. 2
0
        private MainFrame() : base(WindowType.Toplevel)
        {
            Title = "Tabellarius";
            SetDefaultSize(900, 600);             // Valid default size
            SetPosition(WindowPosition.Center);
            DeleteEvent += new DeleteEventHandler(OnDelete);

            AccelGroup agr = new AccelGroup();

            var mainBox = new VBox(false, 2);
            // Titlebar - mainBox top
            var titleBar = TitleBar.GetInstance();
            // MainToolBar - mainBox middle
            var mainToolBar = MainToolBar.GetInstance();

            // ListFrame - Table left
            var listFrameAdapter = ListFrameAdapter.GetInstance();
            // Toolbar - Table middle
            var middleToolBar = MiddleToolBar.GetInstance();
            // EditFrame - Table right
            var editFrameAdapter = EditFrameAdapter.GetInstance();

            var paneBox = new HBox();

            paneBox.PackStart(listFrameAdapter, true, true, 0);
            paneBox.PackStart(new VSeparator(), false, true, 0);
            paneBox.PackStart(middleToolBar, false, true, 0);
            paneBox.PackStart(new VSeparator(), false, true, 0);
            var paned = new Paned(Orientation.Horizontal);

            paned.Add1(paneBox);
            paned.Add2(editFrameAdapter);
            paned.Position = 500;

            // Pack stuff
            mainBox.PackStart(titleBar, false, true, 0);
            mainBox.PackStart(mainToolBar, false, true, 0);
            mainBox.PackStart(new HSeparator(), false, true, 0);
            mainBox.PackStart(paned, true, true, 0);
            Add(mainBox);
        }