Ejemplo n.º 1
0
        public void ShowDropDown()
        {
            int galleryHeight = (int)this.CalculateGalleryHeight(this.Size.Width);

            this.downMenu.MaximumSize = this.GetMaxScreenSize();
            int val1 = Math.Min(galleryHeight, this.downMenu.MaximumSize.Height);

            if (this.ElementTree != null && this.ElementTree.Control is RadControl)
            {
                this.downMenu.ThemeName = ((RadControl)this.ElementTree.Control).ThemeName;
            }
            this.MinSize = this.Size;
            if (this.galleryPopupElement != null)
            {
                this.galleryPopupElement.ClearCollections();
                this.galleryPopupElement.Dispose();
                this.galleryPopupElement = (RadGalleryPopupElement)null;
            }
            SizeF initialSize = new SizeF((float)this.Size.Width, (float)Math.Min(val1, this.downMenu.MaximumSize.Height));
            SizeF minimumSize = new SizeF((float)this.Size.Width, (float)this.Size.Height + this.CalculateGalleryMinHeight());

            this.galleryPopupElement                      = new RadGalleryPopupElement(this.Items, this.Groups, this.Filters, this.Tools, initialSize, minimumSize, this.DropDownSizingMode);
            this.downMenu.Size                            = minimumSize.ToSize();
            this.downMenu.PopupElement                    = (RadElement)this.galleryPopupElement;
            this.downMenu.PopupElement.MinSize            = this.downMenu.Size;
            this.downMenu.VerticalAlignmentCorrectionMode = AlignmentCorrectionMode.SnapToOuterEdges;
            this.downMenu.Show();
            this.UpdatePopUpAfterShow();
            this.downMenu.PopupElement.ZIndex = 1000;
            this.downMenu.BringToFront();
            this.downMenu.PopupElement.BringToFront();
        }
Ejemplo n.º 2
0
        public void ClickFocusedItem()
        {
            RadGalleryPopupElement popupElement = this.PopupElement as RadGalleryPopupElement;

            if (popupElement == null)
            {
                return;
            }
            List <RadElement> descendants = popupElement.GetDescendants(new Predicate <RadElement>(this.IsGaleryItem), TreeTraversalMode.BreadthFirst);

            descendants.Sort(new Comparison <RadElement>(this.GalleryItemsComparison));
            for (int index = 0; index < descendants.Count; ++index)
            {
                if (descendants[index].IsMouseOver)
                {
                    descendants[index].PerformClick();
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        public void ShowDropDown()
        {
            int galleryHeight = (int)this.CalculateGalleryHeight(this.Size.Width);


            this.downMenu.MaximumSize = new Size(0, (int)(SystemInformation.VirtualScreen.Height * 2.0 / 3.0));
            if (this.ElementTree != null && this.ElementTree.Control is RadControl)
            {
                this.downMenu.ThemeName = ((RadControl)this.ElementTree.Control).ThemeName;
            }

            this.MinSize = this.Size;

            if (this.galleryPopupElement != null)
            {
                this.galleryPopupElement.ClearCollections();
                this.galleryPopupElement.Dispose();
                this.galleryPopupElement = null;
            }
            SizeF initialGallerySize = new SizeF(this.Size.Width, Math.Min(galleryHeight, this.downMenu.MaximumSize.Height));
            SizeF minimumGallerySize = new SizeF(this.Size.Width, this.Size.Height + this.CalculateGalleryMinHeight());

            this.galleryPopupElement = new RadGalleryPopupElement(
                this.Items,
                this.Groups,
                this.Filters,
                this.Tools,
                initialGallerySize,
                minimumGallerySize,
                this.DropDownSizingMode);

            this.downMenu.Size                 = minimumGallerySize.ToSize();
            this.downMenu.PopupElement         = this.galleryPopupElement;
            this.downMenu.PopupElement.MinSize = this.downMenu.Size;

            this.downMenu.Show(this, 0, this.dropDownDirection);
            this.UpdatePopUpAfterShow();
            this.downMenu.PopupElement.ZIndex = 1000;
            this.downMenu.BringToFront();
            this.downMenu.PopupElement.BringToFront();
        }
Ejemplo n.º 4
0
        protected override bool ProcessUpDownNavigationKey(bool isUp)
        {
            RadGalleryPopupElement popupElement = this.PopupElement as RadGalleryPopupElement;

            if (popupElement == null)
            {
                return(false);
            }
            List <RadElement> descendants = popupElement.GetDescendants(new Predicate <RadElement>(this.IsGaleryItem), TreeTraversalMode.BreadthFirst);

            descendants.Sort(new Comparison <RadElement>(this.GalleryItemsComparison));
            for (int currentIndex = 0; currentIndex < descendants.Count; ++currentIndex)
            {
                if (descendants[currentIndex].IsMouseOver)
                {
                    if (isUp)
                    {
                        this.FocusItem(descendants[currentIndex], this.FindUpperItem(currentIndex, descendants));
                    }
                    else
                    {
                        this.FocusItem(descendants[currentIndex], this.FindLowerItem(currentIndex, descendants));
                    }
                    return(true);
                }
            }
            if (descendants.Count == 0)
            {
                this.FocusItem((RadElement)null, (RadElement)null);
            }
            else
            {
                this.FocusItem((RadElement)null, descendants[0]);
            }
            return(true);
        }
Ejemplo n.º 5
0
        protected override bool ProcessLeftRightNavigationKey(bool isLeft)
        {
            RadGalleryPopupElement popupElement = this.PopupElement as RadGalleryPopupElement;

            if (popupElement == null)
            {
                return(false);
            }
            List <RadElement> descendants = popupElement.GetDescendants(new Predicate <RadElement>(this.IsGaleryItem), TreeTraversalMode.BreadthFirst);

            descendants.Sort(new Comparison <RadElement>(this.GalleryItemsComparison));
            for (int index = 0; index < descendants.Count; ++index)
            {
                if (descendants[index].IsMouseOver)
                {
                    if (isLeft)
                    {
                        this.FocusItem(descendants[index], index > 0 ? descendants[index - 1] : (RadElement)null);
                    }
                    else
                    {
                        this.FocusItem(descendants[index], index + 1 < descendants.Count ? descendants[index + 1] : (RadElement)null);
                    }
                    return(true);
                }
            }
            if (descendants.Count == 0)
            {
                this.FocusItem((RadElement)null, (RadElement)null);
            }
            else
            {
                this.FocusItem((RadElement)null, isLeft ? descendants[descendants.Count] : descendants[0]);
            }
            return(true);
        }
Ejemplo n.º 6
0
        protected override void CreateChildElements()
        {
            this.filterDropDown                                      = new RadDropDownButtonElement();
            this.filterDropDown.Alignment                            = ContentAlignment.TopLeft;
            this.filterDropDown.ExpandArrowButton                    = true;
            this.filterDropDown.ArrowButton.Arrow.Alignment          = ContentAlignment.MiddleLeft;
            this.filterDropDown.Class                                = "RadGalleryPopupFilterDropDownButton";
            this.filterDropDown.ActionButton.ButtonFillElement.Class = "RadGalleryPopupFilterActionButtonFill";
            this.filterDropDown.ActionButton.BorderElement.Class     = "RadGalleryPopupFilterActionButtonBorder";
            this.filterDropDown.ActionButton.Class                   = "RadGalleryPopupFilterActionButton";
            this.filterDropDown.ArrowButton.Fill.Class               = "RadGalleryPopupFilterArrowButtonFill";
            this.filterDropDown.ArrowButton.Border.Class             = "RadGalleryPopupFilterArrowButtonBorder";
            this.filterDropDown.ArrowButton.Arrow.Class              = "RadGalleryPopupFilterArrowButtonArrow";
            this.filterDropDown.BorderElement.Class                  = "RadGalleryPopupFilterDropDownButtonBorder";

            this.popupGroupsViewport = new RadCanvasViewport();

            this.popupScrollViewer = new RadScrollViewer(this.popupGroupsViewport);
            this.popupScrollViewer.AutoSizeMode          = RadAutoSizeMode.FitToAvailableSize;
            this.popupScrollViewer.HorizontalScrollState = ScrollState.AlwaysHide;
            this.popupScrollViewer.UsePhysicalScrolling  = true;
            this.popupScrollViewer.Class             = "RadGalleryPopupScrollViewer";
            this.popupScrollViewer.FillElement.Class = "RadGalleryPopupScrollViewerFill";

            this.subMenuLayoutPanel           = new RadGalleryMenuLayoutPanel();
            this.subMenuLayoutPanel.Alignment = ContentAlignment.BottomLeft;
            this.subMenuLayoutPanel.Class     = "RadGalleryPoupMenuPanel";

            this.dropDownPanel = new StackLayoutPanel();
            this.dropDownPanel.AutoSizeMode       = RadAutoSizeMode.FitToAvailableSize;
            this.dropDownPanel.Orientation        = System.Windows.Forms.Orientation.Vertical;
            this.dropDownPanel.EqualChildrenWidth = true;

            this.downMenu = new RadGalleryDropDown(this);
            this.WireMenuDropDownEvents();
            this.downMenu.VerticalPopupAlignment   = VerticalPopupAlignment.TopToTop;
            this.downMenu.HorizontalPopupAlignment = HorizontalPopupAlignment.LeftToLeft;
            this.downMenu.AnimationEnabled         = false;

            this.galleryPopupElement = new RadGalleryPopupElement(
                this.Items,
                this.Groups,
                this.Filters,
                this.Tools);
            this.downMenu.PopupElement = this.galleryPopupElement;
            this.downMenu.LoadElementTree();
            this.dropDownPanel.Children.Add(this.filterDropDown);
            this.dropDownPanel.Children.Add(this.popupScrollViewer);
            this.dropDownPanel.Children.Add(this.subMenuLayoutPanel);

            //TODO: perhaps we should implement RadStackViewport to support integral scrolling
            this.inribbonItemsLayoutPanel            = new IntegralScrollWrapPanel();
            this.inribbonItemsLayoutPanel.MaxColumns = this.MaxColumns;
            this.inribbonItemsLayoutPanel.MaxRows    = this.MaxRows;
            this.Items.Owner = this.inribbonItemsLayoutPanel;

            this.upButton                         = new RadImageButtonElement();
            this.upButton.Class                   = "GalleryUpButton";
            this.upButton.Enabled                 = false;
            this.upButton.MinSize                 = arrowButtonsMinSize;
            this.upButton.Click                  += new EventHandler(upButton_Click);
            this.upButton.BorderElement.Class     = "GalleryUpButtonBorder";
            this.upButton.ButtonFillElement.Class = "GalleryArrowButtonFill";

            this.downButton                         = new RadImageButtonElement();
            this.downButton.Class                   = "GalleryDownButton";
            this.downButton.MinSize                 = arrowButtonsMinSize;
            this.downButton.Click                  += new EventHandler(downButton_Click);
            this.downButton.BorderElement.Class     = "GalleryDownButtonBorder";
            this.downButton.ButtonFillElement.Class = "GalleryArrowButtonFill";

            this.popupButton         = new RadImageButtonElement();
            this.popupButton.Class   = "GalleryPopupButtonButton";
            this.popupButton.MinSize = arrowButtonsMinSize;

            this.popupButton.MouseDown              += new System.Windows.Forms.MouseEventHandler(popupButton_MouseDown);
            this.popupButton.BorderElement.Class     = "GalleryPopupButtonButtonBorder";
            this.popupButton.ButtonFillElement.Class = "GalleryArrowButtonFill";

            this.buttonsPanel         = new RadGalleryButtonsLayoutPanel();
            this.buttonsPanel.MaxSize = buttonsPanelMaxSize;
            this.buttonsPanel.SetValue(DropDownEditorLayoutPanel.IsArrowButtonProperty, true);
            this.buttonsPanel.Children.Add(upButton);
            this.buttonsPanel.Children.Add(downButton);
            this.buttonsPanel.Children.Add(popupButton);

            this.inribbonPanel = new DropDownEditorLayoutPanel();
            this.inribbonPanel.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize;

            this.inribbonFillPrimitive       = new FillPrimitive();
            this.inribbonFillPrimitive.Class = "InribbonGalleryFill";

            this.inribbonPanel.Children.Add(this.inribbonItemsLayoutPanel);
            this.inribbonPanel.Children.Add(this.buttonsPanel);

            this.inribbonPanelBorder            = new BorderPrimitive();
            this.inribbonPanelBorder.Visibility = ElementVisibility.Collapsed;
            this.inribbonPanelBorder.Class      = "InribbonGalleryBorder";
            this.Children.Add(this.inribbonPanelBorder);
            this.Children.Add(this.inribbonFillPrimitive);
            this.Children.Add(this.inribbonPanel);
        }