Ejemplo n.º 1
0
        Tab CreateTab(GtkShellDocumentViewItem view)
        {
            var tab = CreateTab(tabstrip, view);

            tab.Activated += TabActivated;
            return(tab);
        }
Ejemplo n.º 2
0
        public void SetViewTitle(GtkShellDocumentViewItem view, string label, Xwt.Drawing.Image icon, string accessibilityDescription)
        {
            var tab = tabstrip.Tabs.FirstOrDefault(t => t.Tag == view);

            if (tab != null)
            {
                UpdateTab(tab, label, icon, accessibilityDescription);
            }
        }
Ejemplo n.º 3
0
        internal static Tab CreateTab(Tabstrip tabstrip, GtkShellDocumentViewItem view)
        {
            var tab = new Tab(tabstrip, view.Title)
            {
                Tag = view
            };

            if (tab.Accessible != null)
            {
                tab.Accessible.Help = view.AccessibilityDescription;
            }
            return(tab);
        }
Ejemplo n.º 4
0
 public void SetRootView(IShellDocumentViewItem view)
 {
     this.view = (GtkShellDocumentViewItem)view;
     if (Child != null)
     {
         Remove(Child);
     }
     if (view != null)
     {
         var widget = (Gtk.Widget)view;
         widget.Show();
         Add(widget);
     }
 }
Ejemplo n.º 5
0
 public void InsertView(int position, GtkShellDocumentViewItem view)
 {
     if (Children.Count > 0)
     {
         var part = 1 / ((double)Children.Count + 1);
         for (int i = 0; i < relativeSplitSizes.Count; i++)
         {
             relativeSplitSizes [i] *= 1 - part;
         }
         relativeSplitSizes.Insert(position, part);
     }
     else
     {
         relativeSplitSizes.Add(1);
     }
     Children.Insert(position, view);
     Rebuild();
 }
        void ShowChildView(GtkShellDocumentViewItem view)
        {
            if (currentContainer.ActiveView != view)
            {
                currentContainer.ActiveView = view;

                // If this container has embedded tabstrips, reset the active tab in all of them except
                // the one that was clicked. Otherwise several active tabs would be visible, one for
                // each tabstrip

                if (attachedChildTabstrips.Contains(view))
                {
                    tabstrip.ActiveTab = -1;
                }

                foreach (var c in attachedChildTabstrips)
                {
                    if (c != view)
                    {
                        c.tabstrip.ActiveTab = -1;
                    }
                }
            }
        }
Ejemplo n.º 7
0
 public void InsertView(int position, GtkShellDocumentViewItem view)
 {
     tabstrip.InsertTab(position, CreateTab(view));
 }
Ejemplo n.º 8
0
 public void ReplaceView(int position, GtkShellDocumentViewItem view)
 {
     tabstrip.ReplaceTab(position, CreateTab(view));
     ShowActiveContent();
 }
Ejemplo n.º 9
0
 public void SetViewTitle(GtkShellDocumentViewItem view, string label, Xwt.Drawing.Image icon, string accessibilityDescription)
 {
 }
Ejemplo n.º 10
0
 public void SelectView(GtkShellDocumentViewItem view)
 {
 }
Ejemplo n.º 11
0
 public void ReplaceView(int position, GtkShellDocumentViewItem view)
 {
     Children [position] = view;
     Rebuild();
 }
        public void SetCurrentMode(DocumentViewContainerMode mode, GtkShellDocumentViewItem newActive)
        {
            if (this.currentMode == mode)
            {
                return;
            }

            // Save current split sizes
            if (currentContainer is GtkShellDocumentViewContainerSplit split)
            {
                splitSizes = split.GetRelativeSplitSizes();
            }

            this.currentMode = mode;

            GtkShellDocumentViewItem        activeView = null;
            List <GtkShellDocumentViewItem> allViews   = null;

            if (currentContainer != null)
            {
                activeView = currentContainer.ActiveView;
                currentContainer.ActiveViewChanged -= Container_ActiveViewChanged;
                allViews = currentContainer.GetAllViews().ToList();
                currentContainer.Widget.Hide();
                currentContainer.RemoveAllViews();
            }

            if (mode == DocumentViewContainerMode.Tabs)
            {
                if (tabsContainer == null)
                {
                    tabsContainer = new GtkShellDocumentViewContainerTabs();
                    rootTabsBox.PackStart(tabsContainer.Widget, true, true, 0);
                }
                currentContainer = tabsContainer;
            }
            else
            {
                if (splitContainer == null)
                {
                    splitContainer = new GtkShellDocumentViewContainerSplit(mode);
                    rootTabsBox.PackStart(splitContainer.Widget, true, true, 0);
                }
                currentContainer = splitContainer;
                if (hasSplit)
                {
                    tabstrip.ActiveTab = tabstrip.TabCount - 1;
                }
            }

            if (allViews != null)
            {
                currentContainer.AddViews(allViews);
            }

            // Restore current split sizes
            if (splitSizes != null && currentContainer is GtkShellDocumentViewContainerSplit newSplit)
            {
                newSplit.SetRelativeSplitSizes(splitSizes);
            }

            currentContainer.ActiveView         = newActive ?? activeView;
            currentContainer.ActiveViewChanged += Container_ActiveViewChanged;
            currentContainer.Widget.Show();

            if (newActive != activeView)
            {
                ActiveViewChanged?.Invoke(this, EventArgs.Empty);
            }

            CurrentModeChanged?.Invoke(this, EventArgs.Empty);
        }