void UpdateTabstrip()
        {
            var hadSplit = hasSplit;

            var hasMultipleViews = currentContainer != null && currentContainer.GetAllViews().Skip(1).Any();

            tabstrip.Visible = hasMultipleViews && (supportedModes & DocumentViewContainerMode.Tabs) != 0;

            hasSplit = (this.supportedModes & DocumentViewContainerMode.VerticalSplit) != 0 || (this.supportedModes & DocumentViewContainerMode.HorizontalSplit) != 0;
            if (hasSplit && !hadSplit)
            {
                var currentActive = tabstrip.ActiveTab;
                var tab           = new Tab(tabstrip, GettextCatalog.GetString("Split"));
                tabstrip.AddTab(tab);
                tabstrip.ActiveTab = currentActive;
                tab.Activated     += TabActivated;
            }
            else if (!hasSplit && hadSplit)
            {
                tabstrip.RemoveTab(tabstrip.TabCount - 1);
            }

            // If this container is showing tabs and it is inside another container, give the parent the
            // chance to show the tabstrip in its own tab area, to avoid tab stacking
            ParentContainer?.UpdateAttachedTabstrips();

            // This might be a container that has children with tabs. Maybe now it is possible to embed the
            // child tabstrips into this container's tab area. Let's try!
            UpdateAttachedTabstrips();
        }
Ejemplo n.º 2
0
 public void AddViews(IEnumerable <GtkShellDocumentViewItem> views)
 {
     foreach (var view in views)
     {
         tabstrip.AddTab(CreateTab(view));
     }
     ShowActiveContent();
 }
Ejemplo n.º 3
0
        void UpdateTabstrip()
        {
            var hadSplit = hasSplit;

            var hasMultipleViews = currentContainer != null && currentContainer.GetAllViews().Skip(1).Any();

            tabstrip.Visible = hasMultipleViews && (supportedModes & DocumentViewContainerMode.Tabs) != 0;

            hasSplit = (this.supportedModes & DocumentViewContainerMode.VerticalSplit) != 0 || (this.supportedModes & DocumentViewContainerMode.HorizontalSplit) != 0;
            if (hasSplit && !hadSplit)
            {
                var currentActive = tabstrip.ActiveTab;
                var tab           = new Tab(tabstrip, GettextCatalog.GetString("Split"));
                tabstrip.AddTab(tab);
                tabstrip.ActiveTab = currentActive;
                tab.Activated     += TabActivated;
            }
            else if (!hasSplit && hadSplit)
            {
                tabstrip.RemoveTab(tabstrip.TabCount - 1);
            }
        }
Ejemplo n.º 4
0
        protected Tab AddButton(string label, IBaseViewContent viewContent)
        {
            CheckCreateSubViewToolbar();
            updating = true;

            Tab tab = new Tab(subViewToolbar, label);

            tab.Tag        = subViewToolbar.TabCount;
            tab.Activated += (sender, e) => { SetCurrentView((int)((Tab)sender).Tag); QueueDraw(); };
            subViewToolbar.AddTab(tab);

            Gtk.VBox widgetBox = new Gtk.VBox();
            widgetBox.Realized += delegate {
                widgetBox.Add(viewContent.Control);
            };

            subViewNotebook.AppendPage(widgetBox, new Gtk.Label());
            widgetBox.ShowAll();

            EnsureToolbarBoxSeparator();
            updating = false;
            return(tab);
        }
Ejemplo n.º 5
0
        protected Tab AddButton(string label, IBaseViewContent viewContent)
        {
            CheckCreateSubViewToolbar();
            updating = true;

            var addedContent = subViewToolbar.TabCount == 0 && IdeApp.Workbench.ActiveDocument == Document;
            var widgetBox    = new Gtk.VBox();
            var tab          = new Tab(subViewToolbar, label)
            {
                Tag = subViewToolbar.TabCount
            };

            // If this is the current displayed document we need to add the control immediately as the tab is already active.
            if (addedContent)
            {
                widgetBox.Add(viewContent.Control);
                widgetBox.Show();
            }

            subViewToolbar.AddTab(tab);
            subViewNotebook.AppendPage(widgetBox, new Gtk.Label());
            tab.Activated += (sender, e) => {
                if (!addedContent)
                {
                    widgetBox.Add(viewContent.Control);
                    widgetBox.Show();
                }
                addedContent = true;
                SetCurrentView((int)((Tab)sender).Tag);
                QueueDraw();
            };

            EnsureToolbarBoxSeparator();
            updating = false;
            return(tab);
        }