public RadCommandBarOverflowButton(CommandBarStripElement owner) { this.dialogProvider = new CommandBarCustomizeDialogProvider(); this.owner = owner; this.dropDownMenuElement = new RadDropDownMenu(); this.dropDownMenuElement.MinimumSize = this.owner.OverflowMenuMinSize; this.dropDownMenuElement.MaximumSize = this.owner.OverflowMenuMaxSize; this.dropDownMenuElement.RightToLeft = this.RightToLeft ? System.Windows.Forms.RightToLeft.Yes : System.Windows.Forms.RightToLeft.No; panel = new RadCommandBarOverflowPanelElement(); RadMenuSeparatorItem separator = new RadMenuSeparatorItem(); panel.Visibility = ElementVisibility.Collapsed; separator.Visibility = ElementVisibility.Collapsed; this.dropDownMenuElement.Items.Add(panel); this.dropDownMenuElement.Items.Add(separator); addRemoveButtonsMenuItem = new RadMenuItem(CommandBarLocalizationProvider.CurrentProvider.GetLocalizedString(CommandBarStringId.OverflowMenuAddOrRemoveButtonsText)); this.dropDownMenuElement.Items.Add(addRemoveButtonsMenuItem); this.dropDownMenuElement.Items.Add(new RadMenuSeparatorItem()); this.customizeButtonMenuItem = new RadMenuItem(CommandBarLocalizationProvider.CurrentProvider.GetLocalizedString(CommandBarStringId.OverflowMenuCustomizeText)); this.dropDownMenuElement.Items.Add(customizeButtonMenuItem); this.layout = panel.Layout; this.layout.MaxSize = this.owner.OverflowMenuMaxSize; WireEvents(); }
private void menu_MouseUp(object sender, MouseEventArgs e) { RadDropDownMenu menu = (RadDropDownMenu)sender; RadElement clickedButton = menu.ElementTree.GetElementAtPoint(e.Location); if (clickedButton == null) { return; } if (clickedButton is RadComboBoxElement || clickedButton is RadSplitButtonElement || clickedButton is RadDropDownButtonElement || clickedButton is RadArrowButtonElement || clickedButton.Class == "GalleryPopupButtonButton" || clickedButton.Class == "GalleryDownButton" || clickedButton.Class == "GalleryUpButton" || clickedButton is RadGalleryElement) { return; } menu.ClosePopup(RadPopupCloseReason.Mouse); }
public RadCommandBarOverflowButton(CommandBarStripElement owner) { this.dialogProvider = new CommandBarCustomizeDialogProvider(); this.owner = owner; this.dropDownMenuElement = new RadDropDownMenu((RadElement)this); this.dropDownMenuElement.HorizontalAlignmentCorrectionMode = AlignmentCorrectionMode.SnapToEdges; this.dropDownMenuElement.MinimumSize = this.owner.OverflowMenuMinSize; this.dropDownMenuElement.MaximumSize = this.owner.OverflowMenuMaxSize; this.dropDownMenuElement.RightToLeft = this.RightToLeft ? RightToLeft.Yes : RightToLeft.No; this.panel = new RadCommandBarOverflowPanelElement(); RadMenuSeparatorItem menuSeparatorItem = new RadMenuSeparatorItem(); this.panel.Visibility = ElementVisibility.Collapsed; menuSeparatorItem.Visibility = ElementVisibility.Collapsed; this.dropDownMenuElement.Items.Add((RadItem)this.panel); this.dropDownMenuElement.Items.Add((RadItem)menuSeparatorItem); this.addRemoveButtonsMenuItem = new RadMenuItem(LocalizationProvider <CommandBarLocalizationProvider> .CurrentProvider.GetLocalizedString("OverflowMenuAddOrRemoveButtonsText")); this.dropDownMenuElement.Items.Add((RadItem)this.addRemoveButtonsMenuItem); this.dropDownMenuElement.Items.Add((RadItem) new RadMenuSeparatorItem()); this.customizeButtonMenuItem = new RadMenuItem(LocalizationProvider <CommandBarLocalizationProvider> .CurrentProvider.GetLocalizedString("OverflowMenuCustomizeText")); this.dropDownMenuElement.Items.Add((RadItem)this.customizeButtonMenuItem); this.layout = this.panel.Layout; this.layout.MaxSize = this.owner.OverflowMenuMaxSize; this.WireEvents(); }
public virtual bool ShowContextMenu(IContextMenuProvider contextMenuProvider, Point location) { if (this.rootElement == null) return false; RadDropDownMenu radDropDownMenu = contextMenuProvider.ContextMenu ?? contextMenuProvider.MergeMenus((IContextMenuManager) this); GridViewContextMenuManager.UpdateMenuTheme((GridVisualElement) this.rootElement, radDropDownMenu); ContextMenuOpeningEventArgs args = new ContextMenuOpeningEventArgs(contextMenuProvider, radDropDownMenu); this.rootElement.Template.EventDispatcher.RaiseEvent<ContextMenuOpeningEventArgs>(EventDispatcher.ContextMenuOpening, (object) contextMenuProvider, args); RadDropDownMenu contextMenu = args.ContextMenu; if (args.Cancel || contextMenu == null || contextMenu.Items.Count == 0) return false; if (this.rootElement.RightToLeft) { contextMenu.RightToLeft = RightToLeft.Yes; } else { contextMenu.RightToLeft = RightToLeft.No; contextMenu.HorizontalPopupAlignment = HorizontalPopupAlignment.LeftToLeft; } contextMenu.Show(this.rootElement.ElementTree.Control, location); this.contextMenu = contextMenu; this.contextMenu.PopupClosed += new RadPopupClosedEventHandler(this.ContextMenu_PopupClosed); return true; }
public void UnRegister(RadDropDownMenu menu) { if (!this.DropDowns.Contains(menu)) { return; } this.Suspended = true; if (this.DropDowns.Count > 0) { if (this.DropDowns[0].OwnerElement != null && this.DropDowns[0].OwnerElement.ElementState == ElementState.Loaded) { Control control = this.DropDowns[0].OwnerElement.ElementTree.Control; } this.DropDowns.Remove(menu); } if (this.DropDowns.Count > 0) { this.ActiveDropDown = this.DropDowns[this.DropDowns.Count - 1]; } else { this.Cleanup(); } this.Suspended = false; }
protected override void CreateChildElements() { base.CreateChildElements(); dropDownMenu = new RadDropDownMenu(); dropDownMenu.PopupOpening += delegate(object sender, CancelEventArgs args) { if (!this.RightToLeft) { return; } RadPopupOpeningEventArgs e = args as RadPopupOpeningEventArgs; if (e != null) { e.CustomLocation = new Point(e.CustomLocation.X - (this.dropDownMenu.Size.Width - this.Size.Width), e.CustomLocation.Y); } }; dropDownMenu.PopupOpened += new RadPopupOpenedEventHandler(dropDownMenu_PopupOpened); dropDownMenu.PopupClosed += new RadPopupClosedEventHandler(dropDownMenu_PopupClosed); this.arrowButton = new RadCommandBarArrowButton(); //this is needed because RadCommandBarSplitButton inherits this class if (this.GetType() == typeof(CommandBarDropDownButton)) { this.arrowButton.Class = "CommandBarDropDownButtonArrow"; } arrowButton.MouseEnter += new EventHandler(arrowButton_MouseEnter); arrowButton.MouseLeave += new EventHandler(arrowButton_MouseLeave); this.Children.Add(arrowButton); }
public RadCommandBarOverflowMenuItem( RadCommandBarBaseItem representedItem, RadDropDownMenu ownerMenu) { this.representedItem = representedItem; this.ownerMenu = ownerMenu; if (!string.IsNullOrEmpty(representedItem.DisplayName)) { this.menuElement.Text = this.CheckForLongText(representedItem.DisplayName); } else { this.menuElement.Text = this.CheckForLongText(representedItem.Name); } PropertyInfo property = this.representedItem.GetType().GetProperty(nameof(Image)); if ((object)property != null) { this.menuCheckMark.CheckState = Telerik.WinControls.Enumerations.ToggleState.On; this.Image = (Image)property.GetValue((object)this.representedItem, (object[])null); } if (this.menuElement.Image == null) { this.menuElement.Image = (Image) new Bitmap(16, 16); } else { this.Image = this.Image.GetThumbnailImage(16, 16, (Image.GetThumbnailImageAbort)null, IntPtr.Zero); } if (this.representedItem.VisibleInStrip) { return; } this.menuCheckMark.CheckState = Telerik.WinControls.Enumerations.ToggleState.Off; }
private void OnMenuItem_DropDownOpening(object sender, CancelEventArgs e) { if (this.IsDesignMode) { return; } RadMenuItemBase radMenuItemBase = sender as RadMenuItemBase; if (radMenuItemBase == null) { return; } RadPopupOpeningEventArgs openingEventArgs = e as RadPopupOpeningEventArgs; if (!(radMenuItemBase.Parent is RadDropDownMenuLayout)) { return; } RadDropDownMenuLayout parent = radMenuItemBase.Parent as RadDropDownMenuLayout; openingEventArgs.CustomLocation = new Point(openingEventArgs.CustomLocation.X, parent.ControlBoundingRectangle.Y + this.DropDownMenu.Location.Y); RadDropDownMenu dropDown = radMenuItemBase.DropDown; Size size = new Size(dropDown.Width, parent.ControlBoundingRectangle.Height); dropDown.MinimumSize = size; }
private void CollapseChunkToDropDown() { this.ExpandElementToStep((int)ChunkVisibilityState.Expanded); ExpandableStackLayout.InvalidateAll(this); SizeF thisSize = this.DesiredSize; this.elementWithCaptionLayoutPanel.SuspendThemeRefresh(); this.Children.Remove(this.elementWithCaptionLayoutPanel); this.elementWithCaptionLayoutPanel.ResumeThemeRefresh(); RadItem item = new RadItem(); item.UseNewLayoutSystem = true; item.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren; item.Children.Add(this.elementWithCaptionLayoutPanel); item.MaxSize = new Size(0, thisSize.ToSize().Height); item.MinSize = thisSize.ToSize(); RadDropDownMenu menu = this.dropDownElement.DropDownMenu; //remove left column from Menu RadDropDownMenuElement menuPopup = (RadDropDownMenuElement)menu.PopupElement; StackLayoutPanel menuStack = menuPopup.LayoutPanel as StackLayoutPanel; Debug.Assert(menuStack != null, "Chunk menu stack is null"); menuStack.Orientation = this.Orientation; menuPopup.Layout.LeftColumnMinWidth = 0; this.dropDownElement.Items.Add(item); //fix for Missing theme if chunk is not expanded this.dropDownElement.Visibility = ElementVisibility.Visible; this.CollapseStep = (int)ChunkVisibilityState.Collapsed; menu.SetTheme(); menu.MouseUp += new MouseEventHandler(this.menu_MouseUp); }
protected virtual RadDropDownMenu CreateFilterMenu() { System.Type dataType = this.ViewInfo.GetColumnDataType(this.ColumnIndex); if ((object)dataType == null) { dataType = typeof(string); } CompositeFilterDescriptor descriptor = this.Descriptor as CompositeFilterDescriptor; int descriptorType = (int)CompositeFilterDescriptor.GetDescriptorType(descriptor); RadDropDownMenu radDropDownMenu = new RadDropDownMenu(); foreach (FilterOperationContext filterOperation in FilterOperationContext.GetFilterOperations(dataType)) { RadFilterOperationMenuItem operationMenuItem = new RadFilterOperationMenuItem(filterOperation); operationMenuItem.IsChecked = descriptor == null && operationMenuItem.Operator == this.SelectedFilterOperator; operationMenuItem.Click += new EventHandler(this.FilterMenuItem_Click); operationMenuItem.Text = LocalizationProvider <RadVirtualGridLocalizationProvider> .CurrentProvider.GetLocalizedString(filterOperation.id); radDropDownMenu.Items.Add((RadItem)operationMenuItem); } radDropDownMenu.PopupOpening += new RadPopupOpeningEventHandler(this.contextMenu_PopupOpening); radDropDownMenu.PopupClosed += new RadPopupClosedEventHandler(this.contextMenu_PopupClosed); this.InitializeMenuItemsText(); return(radDropDownMenu); }
public void UnRegister(RadDropDownMenu menu) { //autoCloseElement = null; //autoCloseTimer.Stop(); if (!DropDowns.Contains(menu)) { return; } Suspended = true; RadMenu rootMenu = null; if (DropDowns.Count > 0) { if (DropDowns[0].OwnerElement != null && DropDowns[0].OwnerElement.ElementState == ElementState.Loaded) { rootMenu = DropDowns[0].OwnerElement.ElementTree.Control as RadMenu; } this.DropDowns.Remove(menu); } if (this.DropDowns.Count > 0) { ActiveDropDown = this.DropDowns[this.DropDowns.Count - 1]; } else { Cleanup(); } Suspended = false; }
private void ContextMenu_PopupClosed(object sender, RadPopupClosedEventArgs args) { RadDropDownMenu radDropDownMenu = sender as RadDropDownMenu; if (radDropDownMenu == null) return; radDropDownMenu.PopupClosed -= new RadPopupClosedEventHandler(this.ContextMenu_PopupClosed); this.contextMenu = (RadDropDownMenu) null; }
internal static void UpdateMenuTheme(GridVisualElement gridElement, RadDropDownMenu menu) { if (menu == null) return; string str = gridElement.ElementTree.ThemeName; if (string.IsNullOrEmpty(str)) str = "ControlDefault"; menu.ThemeName = str; }
protected override void CreateContextMenuItems(RadDropDownMenu menu) { base.CreateContextMenuItems(menu); if (!(this.RowInfo is GridViewDataRowInfo)) { return; } this.CreateRowPinningMenuItems(menu); }
public ContextMenuOpeningEventArgs( IContextMenuProvider provider, RadDropDownMenu contextMenu, bool cancel) : base(cancel) { this.contextMenu = contextMenu; this.provider = provider; }
protected override void CreateChildItems(RadElement parent) { base.CreateChildItems(parent); this.navigatorElement = this.CreateNavigatorElement(); parent.Children.Add((RadElement)this.navigatorElement); this.ApplyOrientation(this.navigatorElement.Orientation); this.contextMenu = new RadDropDownMenu(); this.customizeMenuItem = new RadMenuItem(LocalizationProvider <CommandBarLocalizationProvider> .CurrentProvider.GetLocalizedString("ContextMenuCustomizeText")); this.customizeMenuItem.Click += new EventHandler(this.customizeMenuItem_Click); }
protected override void CreateChildItems(RadElement parent) { base.CreateChildItems(parent); this.commandBarElement = new RadCommandBarElement(); this.ApplyOrientation(commandBarElement.Orientation); this.RootElement.Children.Add(this.commandBarElement); this.AutoSize = true; this.contextMenu = new RadDropDownMenu(); this.customizeMenuItem = new RadMenuItem(CommandBarLocalizationProvider.CurrentProvider.GetLocalizedString(CommandBarStringId.ContextMenuCustomizeText)); customizeMenuItem.Click += new EventHandler(customizeMenuItem_Click); }
public LayoutControlDraggableOverlay(RadLayoutControl owner) { this.owner = owner; this.dragDropService = new LayoutControlDragDropService(this.owner, this); this.dragDropService.Stopped += new EventHandler(this.dragDropService_Stopped); this.contextMenu = new RadDropDownMenu(); this.hideMenuItem = new RadMenuItem(LocalizationProvider <LayoutControlLocalizationProvider> .CurrentProvider.GetLocalizedString("ContextMenuHideItemText")); this.hideMenuItem.Click += new EventHandler(this.hideMenuItem_Click); this.contextMenu.Items.Add((RadItem)this.hideMenuItem); LocalizationProvider <LayoutControlLocalizationProvider> .CurrentProviderChanged += new EventHandler(this.UpdateLocalizableStrings); }
protected virtual void EnsureDropDownCreated() { if (this.dropDown != null) { return; } this.dropDown = this.CreateDropDownMenu(); this.dropDown.RightToLeft = this.RightToLeft ? RightToLeft.Yes : RightToLeft.No; this.WireDropDownEvents(); this.OnDropDownCreated(); }
protected virtual void EnsureDropDownCreated() { if (dropDown != null) { return; } this.dropDown = this.CreateDropDownMenu(); this.dropDown.RightToLeft = (this.RightToLeft) ? System.Windows.Forms.RightToLeft.Yes : System.Windows.Forms.RightToLeft.No; this.WireDropDownEvents(); this.OnDropDownCreated(); #region Obsolete //this.dropDown.DropDownOpened += delegate(object sender, EventArgs args) //{ // this.dropDown.Site = this.ElementTree.Control.Site; // this.SetValue(IsPopupShownProperty, true); // this.OnDropDownOpened(EventArgs.Empty); //}; //this.dropDown.PopupOpening += delegate(object sender, CancelEventArgs args) //{ // if (!this.RightToLeft || !(this.ElementTree.Control is RadMenu) ) // { // return; // } // RadPopupOpeningEventArgs e = args as RadPopupOpeningEventArgs; // if (e != null) // { // e.CustomLocation = new Point(e.CustomLocation.X - (this.dropDown.Size.Width - this.Size.Width), e.CustomLocation.Y); // } //}; //this.dropDown.DropDownOpening += delegate(object sender, CancelEventArgs args) //{ // this.OnDropDownOpening(args); //}; //this.dropDown.DropDownClosed += delegate(object sender, RadPopupClosedEventArgs args) //{ // this.SetValue(IsPopupShownProperty, false); // this.OnDropDownClosed(args); //}; //this.dropDown.PopupClosing += delegate(object sender, RadPopupClosingEventArgs args) //{ // this.OnDropDownClosing(args); //}; #endregion }
protected override void CreateChildElements() { base.CreateChildElements(); this.dropDownMenu = new RadDropDownMenu((RadElement)this); this.dropDownMenu.HorizontalAlignmentCorrectionMode = AlignmentCorrectionMode.SnapToEdges; this.WireDropDownEvents(); this.arrowButton = new RadCommandBarArrowButton(); this.arrowButton.Class = "CommandBarDropDownButtonArrow"; this.arrowButton.MouseEnter += new EventHandler(this.arrowButton_MouseEnter); this.arrowButton.MouseLeave += new EventHandler(this.arrowButton_MouseLeave); this.Children.Add((RadElement)this.arrowButton); }
public void SetActiveDropDown(RadDropDownMenu menu) { int index = this.DropDowns.IndexOf(menu); if (index >= 0 && menu != ActiveDropDown) { for (int k = DropDowns.Count - 1; k > index; k--) { DropDowns[k].ClosePopup(RadPopupCloseReason.CloseCalled); } } }
public void SetActiveDropDown(RadDropDownMenu menu) { int num = this.DropDowns.IndexOf(menu); if (num < 0 || menu == this.ActiveDropDown) { return; } for (int index = this.DropDowns.Count - 1; index > num; --index) { this.DropDowns[index].ClosePopup(RadPopupCloseReason.CloseCalled); } }
public override AccessibleObject GetChild(int index) { RadDropDownMenu dropDownMenu = this.buttonElement.DropDownMenu; if (dropDownMenu != null && !dropDownMenu.IsLoaded) { dropDownMenu.LoadElementTree(); dropDownMenu.SetTheme(); dropDownMenu.RootElement.InvalidateMeasure(true); dropDownMenu.RootElement.UpdateLayout(); } return((AccessibleObject)(this.buttonElement.Items[index] as RadMenuItemBase).AccessibleObject); }
public void Register(RadDropDownMenu menu) { if (menu == ActiveDropDown || DropDowns.Contains(menu)) { return; } Suspended = true; if (ActiveDropDown != null) { //ActiveDropDown.Capture = false; if (menu != null && menu.OwnerElement != null && menu.OwnerElement.ElementTree != null) { RadDropDownMenu menuOwner = menu.OwnerElement.ElementTree.Control as RadDropDownMenu; if (menuOwner != null) { int index = DropDowns.IndexOf(menuOwner); while (index < DropDowns.Count - 1) { DropDowns[DropDowns.Count - 1].ClosePopup(RadPopupCloseReason.CloseCalled); } } } } else { if (!InDesignMode) { Application.AddMessageFilter(this); } else { hookMouse = new WindowsHook(WindowsHook.HookType.WH_MOUSE_LL); hookMouse.HookInvoked += new WindowsHook.HookEventHandler(hookMouse_HookInvoked); hookMouse.Install(); } } this.DropDowns.Add(menu); ActiveDropDown = menu; Suspended = false; //if (InDesignMode && selectionService == null) //{ // if (ActiveDropDown.OwnerElement is ISiteProvider) // { // ISite site = (ActiveDropDown.OwnerElement as ISiteProvider).GetSite(); // selectionService = (ISelectionService)site.GetService(typeof(ISelectionService)); // selectionService.SelectionChanged += new EventHandler(selectionService_SelectionChanged); // } //} }
protected virtual RadDropDownMenu CreateDropDownMenu() { RadDropDownMenu radDropDownMenu = (RadDropDownMenu)null; if (this.DropDownCreating != null) { this.DropDownCreating((object)radDropDownMenu, EventArgs.Empty); if (radDropDownMenu != null) { return(radDropDownMenu); } } return(new RadDropDownMenu((RadElement)this)); }
protected override void CreateContextMenuItems(RadDropDownMenu menu) { if (this.GridViewGroupColumn.RootColumnGroup == this.GridViewGroupColumn.Group) { this.CreateColumnPinningMenuItems(menu); } this.CreateColumnChooserMenuItems(menu); if (this.ElementTree == null || this.ElementTree.Control.Site == null) { return; } RadMenuItem radMenuItem = new RadMenuItem("Delete Group"); radMenuItem.Click += new EventHandler(this.deleteItem_Click); menu.Items.Add((RadItem)radMenuItem); }
private void CreateEditMenuItems(RadDropDownMenu contextMenu) { if (!this.IsEditable || this.GridViewElement.Template.GridReadOnly || !this.ViewTemplate.AllowEditRow || this.ColumnInfo.ReadOnly || this.GridViewElement.BeginEditMode == RadGridViewBeginEditMode.BeginEditProgrammatically) { return; } contextMenu.Items.Add((RadItem) new RadMenuSeparatorItem()); RadMenuItem radMenuItem1 = new RadMenuItem(LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("EditMenuItem")); radMenuItem1.Click += new EventHandler(this.Item_Click); contextMenu.Items.Add((RadItem)radMenuItem1); RadMenuItem radMenuItem2 = new RadMenuItem(LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("ClearValueMenuItem")); radMenuItem2.Click += new EventHandler(this.ClearValue_Click); contextMenu.Items.Add((RadItem)radMenuItem2); }
public override RadDropDownMenu MergeMenus( RadDropDownMenu contextMenu, params object[] parameters) { if (contextMenu == null) { return((RadDropDownMenu)null); } int index = contextMenu.Items.Count - 1; if (index >= 0) { contextMenu.Items.RemoveAt(index); } return(contextMenu); }
public virtual RadDropDownMenu MergeMenus( IContextMenuManager contextMenuManager, params object[] parameters) { if (this.oldContextMenu != null) { this.oldContextMenu.Items.Clear(); this.oldContextMenu.Dispose(); } RadDropDownMenu radDropDownMenu = new RadDropDownMenu(); this.TableElement.GetCellElement((GridViewRowInfo) this.ViewInfo.TableHeaderRow, this.ColumnInfo)?.MergeMenus(radDropDownMenu); this.CreateContextMenuItems(radDropDownMenu); this.RowElement?.MergeMenus(radDropDownMenu); this.oldContextMenu = radDropDownMenu; return radDropDownMenu; }