Пример #1
0
        private void SelectItem(QuickNavigatorListItem item)
        {
            if (this.selectedItem != null)
            {
                this.selectedItem.IsActive = false;
            }

            RadScrollLayoutPanel scrollPanel = item.FindAncestor <RadScrollLayoutPanel>();

            if (scrollPanel != null)
            {
                scrollPanel.ScrollElementIntoView(item);
            }

            this.selectedItem                 = item;
            this.selectedItem.IsActive        = true;
            this.navigatorElement.Header.Text = item.Text;
            this.navigatorElement.Footer.Text = item.Text;

            //update preview
            if (this.settings.ShowPreview)
            {
                this.UpdatePreview();
            }
        }
Пример #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseDown(MouseEventArgs e)
        {
            //attempt to change selection
            Point pt = new Point(e.X, e.Y);
            QuickNavigatorListItem item = this.ElementTree.GetElementAtPoint(pt) as QuickNavigatorListItem;

            if (item != null && item != this.selectedItem)
            {
                this.SelectItem(item);
            }

            //we are not above an item, proceed with the default implementation
            if (item == null)
            {
                base.OnMouseDown(e);
                return;
            }

            //close the owning form
            QuickNavigatorPopup owner = this.FindForm() as QuickNavigatorPopup;

            if (owner != null)
            {
                this.Capture = false;
                owner.Close();
            }
        }
Пример #3
0
        private QuickNavigatorListItem CreateListItem(DockWindow pane)
        {
            QuickNavigatorListItem element = (QuickNavigatorListItem)Activator.CreateInstance(this.settings.ListItemType);

            element.ImagePrimitive.ImageLayout = ImageLayout.Zoom;
            element.Image = pane.Image;
            element.Text  = pane.Text;
            element.TextElement.TextWrap            = false;
            element.TextElement.AutoEllipsis        = true;
            element.TextElement.StretchHorizontally = true;
            element.TextElement.StretchVertically   = true;
            element.TextElement.AutoSize            = true;
            element.MinSize = this.settings.ListItemSize;
            //pass the associated pane as a Tag
            element.Tag = pane;

            return(element);
        }
Пример #4
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;
                }
            }
        }