Пример #1
0
        /**
         * Returns the sidebar instance for the specified tab.
         */

        private VerticalSidebar GetSidebar(string tabId)
        {
            VerticalSidebar sidebar = (VerticalSidebar)_tabSidebars [tabId];

            if (sidebar == null)
            {
                throw new ArgumentException("Invalid tab ID " + tabId, "tabId");
            }
            return(sidebar);
        }
Пример #2
0
        protected override void OnSizeChanged(EventArgs e)
        {
            base.OnSizeChanged(e);
            VerticalSidebar sidebar = _newActiveSidebar ?? _activeSidebar;

            if (sidebar != null && sidebar.Expanded)
            {
                ExpandedWidth = Width;
            }
        }
Пример #3
0
        /**
         * Returns the tab ID for the specified sidebar instance.
         */

        private string GetSidebarTab(VerticalSidebar sidebar)
        {
            foreach (DictionaryEntry de in _tabSidebars)
            {
                if (de.Value == sidebar)
                {
                    return((string)de.Key);
                }
            }
            return("<unknown>");
        }
Пример #4
0
        /**
         * Registers a tab and creates a sidebar for it.
         */

        public void RegisterTab(string tabId, string[] resourceTypes, int linkType)
        {
            VerticalSidebar sidebar = new VerticalSidebar();

            sidebar.Dock        = DockStyle.Fill;
            sidebar.Side        = SidebarSide.Left;
            sidebar.ColorScheme = _colorScheme;
            sidebar.Visible     = false;
            Controls.Add(sidebar);
            sidebar.Size         = ClientSize;
            _tabSidebars [tabId] = sidebar;

            CreateDefaultPane(tabId, resourceTypes, linkType);
        }
Пример #5
0
        public AbstractViewPane ActivateViewPane(string tabId, string paneId)
        {
            VerticalSidebar sidebar = _activeSidebar;

            if (sidebar == null || sidebar != _tabSidebars [tabId])
            {
                return(null);
            }

            AbstractViewPane pane = sidebar.GetPane(paneId);

            if (pane == null)
            {
                return(null);
            }

            sidebar.ActivatePane(paneId);
            if (_activeSidebar != sidebar)
            {
                // one more check for tab switch caused by message processing during activation
                return(null);
            }
            return(pane);
        }
Пример #6
0
        /// <summary>
        /// Shows the sidebar for the specified tab.
        /// </summary>
        public void ShowPanesForTab(string tabId, SidebarState state)
        {
            _currentTabID = tabId;
            Core.UIManager.BeginUpdateSidebar();

            VerticalSidebar sidebar = GetSidebar(tabId);

            if (sidebar != _activeSidebar)
            {
                _newActiveSidebar = sidebar;
                if (!_populatedSidebars.Contains(tabId))
                {
                    _populatedSidebars.Add(tabId);
                    sidebar.PopulateViewPanes();

                    if (state == null)
                    {
                        sidebar.BeginUpdate();
                        AbstractViewPane pane = sidebar.GetPane(StandardViewPanes.ViewsCategories);
                        if (pane != null)
                        {
                            sidebar.ActivatePane(StandardViewPanes.ViewsCategories);
                        }

                        string structurePaneID = (string)_resourceStructurePanes [tabId];
                        if (structurePaneID != null)
                        {
                            sidebar.ActivatePane(structurePaneID);
                        }
                        sidebar.EndUpdate();
                    }
                }
                sidebar.UpdateActiveWorkspace();
                if (state != null)
                {
                    sidebar.CurrentState = state;
                }

                if (_activeSidebar != null)
                {
                    _activeSidebar.ExpandedChanged -= OnActiveSidebarExpandedChanged;
                }
                sidebar.ExpandedChanged += OnActiveSidebarExpandedChanged;
                Expanded = sidebar.Expanded;
//                Width = Expanded ? ExpandedWidth : sidebar.CollapsedWidth;
                Width = Expanded ? ExpandedWidth : 0;
            }
            else
            {
                sidebar.UpdateActiveWorkspace();
                if (state != null)
                {
                    sidebar.CurrentState = state;
                }
            }

            if (sidebar != _activeSidebar)
            {
                sidebar.Visible = true;
                if (_activeSidebar != null)
                {
                    _activeSidebar.Visible = false;
                }
                _activeSidebar = sidebar;
                if (ContainsFocus)
                {
                    _activeSidebar.FocusActivePane();
                }
            }

            Core.UIManager.EndUpdateSidebar();
            _newActiveSidebar = null;
        }
Пример #7
0
        /**
         * Registers a pane to be shown in the sidebar for the specified tab.
         */

        public void AddPane(string tabID, string paneID, AbstractViewPane viewPane, string caption, Image icon)
        {
            VerticalSidebar sidebar = GetSidebar(tabID);

            sidebar.RegisterPane(viewPane, paneID, caption, icon);
        }