Exemplo n.º 1
0
        /// <summary>
        /// Moves the current selection to the right.
        /// </summary>
        internal void NavigateRight()
        {
            if (this.selectedItem == null)
            {
                return;
            }

            QuickNavigatorList owningList = this.selectedItem.Owner;
            WrapLayoutPanel    itemsPanel = owningList.ItemsPanel;
            int index = itemsPanel.Children.IndexOf(this.selectedItem);

            int newIndex = index + this.settings.ItemsPerColumn;

            if (newIndex > itemsPanel.Children.Count - 1)
            {
                //move the selection to the document window list
                if (owningList == this.navigatorElement.ToolWindowList &&
                    this.navigatorElement.DocumentWindowList.Visibility == ElementVisibility.Visible)
                {
                    itemsPanel = this.navigatorElement.DocumentWindowList.ItemsPanel;
                    newIndex   = index - (this.docPaneColumns - 1) * this.settings.ItemsPerColumn;
                    newIndex   = Math.Max(0, newIndex);
                    newIndex   = Math.Min(itemsPanel.Children.Count - 1, newIndex);
                }
            }

            if (newIndex >= 0 && newIndex < itemsPanel.Children.Count)
            {
                this.SelectItem((QuickNavigatorListItem)itemsPanel.Children[newIndex]);
            }
        }
Exemplo n.º 2
0
        private void InitDocumentPaneList()
        {
            QuickNavigatorList docList = this.navigatorElement.DocumentWindowList;

            docList.Header.Text = this.settings.DocumentPaneListHeader;
            Size itemSize = this.settings.ListItemSize;

            //calculate the size of the tool pane list
            int colItemCount  = Math.Min(this.docPanes.Count, this.settings.ItemsPerColumn);
            int docListWidth  = this.docPaneColumns * itemSize.Width + (this.docPaneColumns - 1) * settings.ColumnSpacing;
            int docListHeight = colItemCount * this.settings.ListItemSize.Height;

            //adjust pane's settings
            docList.ItemsPanel.ItemWidth  = itemSize.Width;
            docList.ItemsPanel.ItemHeight = itemSize.Height;
            //we need to set the Min-max size in order to achieve a fixed size
            Size minMax = new Size(docListWidth, 0);

            docList.MinSize            = minMax;
            docList.MaxSize            = minMax;
            docList.ItemsPanel.MaxSize = new Size(0, docListHeight);

            //retrieve the size of the header
            Size headerSize = this.GetDesiredSize(docList.Header);

            docListWidth              = Math.Max(headerSize.Width, docListWidth);
            docListHeight            += headerSize.Height;
            this.paneListHeaderHeight = Math.Max(headerSize.Height, this.paneListHeaderHeight);
            if (headerSize.Height > 0)
            {
                docListHeight += docList.Header.Margin.Bottom;
            }

            //remmeber the metrics
            this.docPaneSize = new Size(docListWidth, docListHeight);
            if (this.toolPaneSize.Width > 0)
            {
                //add spacing for the document pane
                this.docPaneSize.Width += this.settings.ColumnSpacing;
                docList.Margin          = new Padding(this.settings.ColumnSpacing, 0, 0, 0);
            }

            //check whether we will display a horizontal scrollbar
            int desiredColumns = this.docPanes.Count / this.settings.ItemsPerColumn;

            if (this.docPanes.Count % this.settings.ItemsPerColumn > 0)
            {
                desiredColumns++;
            }

            if (desiredColumns > this.docPaneColumns)
            {
                this.docPaneSize.Height += SystemInformation.HorizontalScrollBarHeight;
            }
        }
Exemplo n.º 3
0
        private void PopulateItems(QuickNavigatorList list, IEnumerable panes)
        {
            WrapLayoutPanel itemsList = list.ItemsPanel;

            foreach (DockWindow pane in panes)
            {
                QuickNavigatorListItem item = this.CreateListItem(pane);
                item.Owner = list;
                itemsList.Children.Add(item);

                //detect the active item
                if (pane == this.activeWindow)
                {
                    this.navigatorElement.Header.Text = pane.Text;
                    this.selectedItem = item;
                }
            }
        }
Exemplo n.º 4
0
        private void ModifySelectedIndex(int correction)
        {
            QuickNavigatorList owningList = this.selectedItem.Owner;
            WrapLayoutPanel    itemsPanel = owningList.ItemsPanel;
            int index = itemsPanel.Children.IndexOf(this.selectedItem);

            int newIndex = index + correction;

            if (newIndex < 0)
            {
                newIndex = itemsPanel.Children.Count - 1;
            }
            else if (newIndex > itemsPanel.Children.Count - 1)
            {
                newIndex = 0;
            }

            if (newIndex >= 0 && newIndex < itemsPanel.Children.Count)
            {
                this.SelectItem((QuickNavigatorListItem)itemsPanel.Children[newIndex]);
            }
        }