Exemplo n.º 1
0
        public override AccessibleObject GetChild(int index)
        {
            RadApplicationMenuButtonElement owner    = this.Owner as RadApplicationMenuButtonElement;
            RadApplicationMenuDropDown      dropDown = owner.DropDownMenu as RadApplicationMenuDropDown;
            int count = base.GetChildCount();

            if (index < count)
            {
                return(base.GetChild(index));
            }

            index -= count;
            count  = dropDown.RightColumnItems.Count;

            if (index < count)
            {
                RadMenuItemBase menuItemBase = dropDown.RightColumnItems[index] as RadMenuItemBase;
                return(menuItemBase.AccessibleObject);
            }

            index -= count;
            RadMenuItemBase button = dropDown.ButtonItems[index] as RadMenuItemBase;

            return(button.AccessibleObject);
        }
Exemplo n.º 2
0
        public override int GetChildCount()
        {
            RadApplicationMenuButtonElement owner    = this.Owner as RadApplicationMenuButtonElement;
            RadApplicationMenuDropDown      dropDown = owner.DropDownMenu as RadApplicationMenuDropDown;

            return(base.GetChildCount() + dropDown.RightColumnItems.Count + dropDown.ButtonItems.Count);
        }
        protected override RadDropDownButtonPopup CreateDropDown()
        {
            RadApplicationMenuDropDown applicationMenuDropDown = new RadApplicationMenuDropDown(this);

            applicationMenuDropDown.RightToLeft         = this.RightToLeft ? RightToLeft.Yes : RightToLeft.No;
            applicationMenuDropDown.ThemeClassName      = typeof(RadApplicationMenuButtonElement).Namespace + ".RadApplicationMenuDropDown";
            applicationMenuDropDown.Items.ItemsChanged += new ItemChangedDelegate(this.OnItemsChanged);
            return((RadDropDownButtonPopup)applicationMenuDropDown);
        }
        protected override RadDropDownButtonPopup CreateDropDown()
        {
            RadApplicationMenuDropDown menu = new RadApplicationMenuDropDown(this);

            menu.RightToLeft         = (this.RightToLeft) ? System.Windows.Forms.RightToLeft.Yes : System.Windows.Forms.RightToLeft.No;
            menu.ThemeClassName      = typeof(RadApplicationMenuButtonElement).Namespace + ".RadApplicationMenuDropDown";
            menu.Items.ItemsChanged += new ItemChangedDelegate(OnItemsChanged);
            return(menu);
        }
        protected override void ShowCore(Point point, int ownerOffset, RadDirection popupDirection)
        {
            RadApplicationMenuDropDown        dropDown    = (RadApplicationMenuDropDown)this.ElementTree.Control;
            RadApplicationMenuDropDownElement menuElement = dropDown.PopupElement as RadApplicationMenuDropDownElement;

            if (menuElement != null && !this.IsDesignMode)
            {
                Size size = menuElement.TopRightContentElement.Layout.Size;
                size.Width  -= 3;
                size.Height -= 3;
                this.PopupElement.MinSize = size;
                this.PopupElement.SetValue(RadDropDownMenuElement.DropDownPositionProperty, DropDownPosition.RightPopupContent);
            }

            base.ShowCore(point, ownerOffset, popupDirection);
        }
Exemplo n.º 6
0
        protected override SizeF MeasureOverride(SizeF availableSize)
        {
            if (this.ElementTree == null)
            {
                return(base.MeasureOverride(availableSize));
            }

            RadDropDownMenu            menu    = this.ElementTree.Control as RadDropDownMenu;
            RadApplicationMenuDropDown appMenu = null;

            if (menu != null && menu.OwnerElement != null && menu.OwnerElement.IsInValidState(true))
            {
                appMenu = menu.OwnerElement.ElementTree.Control as RadApplicationMenuDropDown;
            }

            if (appMenu != null)
            {
                availableSize.Width = appMenu.RightColumnWidth - 5;
            }

            foreach (RadElement element in this.Children)
            {
                RadMenuItem menuItem = element as RadMenuItem;
                if (menuItem != null)
                {
                    menuItem.Measure(availableSize);
                    leftColumnWidth      = Math.Max(leftColumnWidth, menuItem.LeftColumnElement.DesiredSize.Width);
                    rightColumnWidth     = Math.Max(rightColumnWidth, menuItem.RightColumnElement.DesiredSize.Width);
                    leftColumnMaxPadding = Math.Max(leftColumnMaxPadding, menuItem.Padding.Left + menuItem.BorderThickness.Left + menuItem.Margin.Left);
                }
            }
            leftColumnWidth = Math.Max(leftColumnWidth, LeftColumnMinWidth);

            SizeF preferredSize = base.MeasureOverride(availableSize);

            preferredSize.Width  += leftColumnWidth;
            preferredSize.Width  += this.Padding.Horizontal;
            preferredSize.Height += this.Padding.Vertical;

            if (appMenu != null)
            {
                preferredSize.Width = appMenu.RightColumnWidth - 5;
            }

            return(preferredSize);
        }
Exemplo n.º 7
0
        public override AccessibleObject GetChild(int index)
        {
            RadApplicationMenuDropDown dropDownMenu = (this.OwnerElement as RadApplicationMenuButtonElement).DropDownMenu as RadApplicationMenuDropDown;
            int childCount = base.GetChildCount();

            if (index < childCount)
            {
                return(base.GetChild(index));
            }
            index -= childCount;
            int count = dropDownMenu.RightColumnItems.Count;

            if (index < count)
            {
                return((AccessibleObject)(dropDownMenu.RightColumnItems[index] as RadMenuItemBase).AccessibleObject);
            }
            index -= count;
            return((AccessibleObject)(dropDownMenu.ButtonItems[index] as RadMenuItemBase).AccessibleObject);
        }
Exemplo n.º 8
0
        protected override SizeF MeasureOverride(SizeF availableSize)
        {
            if (this.ElementTree == null)
            {
                return(base.MeasureOverride(availableSize));
            }
            RadDropDownMenu            control = this.ElementTree.Control as RadDropDownMenu;
            RadApplicationMenuDropDown applicationMenuDropDown = (RadApplicationMenuDropDown)null;

            if (control != null && control.OwnerElement != null && control.OwnerElement.IsInValidState(true))
            {
                applicationMenuDropDown = control.OwnerElement.ElementTree.Control as RadApplicationMenuDropDown;
            }
            if (applicationMenuDropDown != null)
            {
                availableSize.Width = (float)(applicationMenuDropDown.RightColumnWidth - 5);
            }
            foreach (RadElement child in this.Children)
            {
                RadMenuItem radMenuItem = child as RadMenuItem;
                if (radMenuItem != null)
                {
                    radMenuItem.Measure(availableSize);
                    this.leftColumnWidth      = Math.Max(this.leftColumnWidth, radMenuItem.LeftColumnElement.DesiredSize.Width);
                    this.rightColumnWidth     = Math.Max(this.rightColumnWidth, radMenuItem.RightColumnElement.DesiredSize.Width);
                    this.leftColumnMaxPadding = Math.Max(this.leftColumnMaxPadding, (float)(radMenuItem.Padding.Left + radMenuItem.BorderThickness.Left + radMenuItem.Margin.Left));
                }
            }
            this.leftColumnWidth = Math.Max(this.leftColumnWidth, (float)this.LeftColumnMinWidth);
            SizeF sizeF = base.MeasureOverride(availableSize);

            sizeF.Width  += (float)this.RightColumnPadding;
            sizeF.Width  += (float)this.Padding.Horizontal;
            sizeF.Height += (float)this.Padding.Vertical;
            if (applicationMenuDropDown != null)
            {
                sizeF.Width = (float)(applicationMenuDropDown.RightColumnWidth - 5);
            }
            return(sizeF);
        }