private List <AnimatedPropertySetting> CreateAnimations( RadItem item, bool show) { List <AnimatedPropertySetting> animations = this.GetAnimations(item); if (animations == null) { animations = new List <AnimatedPropertySetting>(); this.SetAnimations(item, animations); } this.AddLocationAnimation(item, animations, show); if (this.opacityAnimation) { this.AddOpacityAnimation(item, animations, show); } else { this.ResetOpacity(item, 1.0); } this.AddScaleAnimation(item, animations, show); item.Visibility = ElementVisibility.Visible; return(animations); }
/// <summary> /// Combines ThemeRoleName with state names using "." as delimiter and sets the result to AttachedElement.Class /// </summary> /// <param name="item"></param> /// <param name="stateNames"></param> protected void SetItemState(RadItem item, params string[] stateNames) { if (item == null) { Debug.Fail("SetElementState called and item parameter is null."); return; } StringBuilder stateStringBuilder = new StringBuilder(); stateStringBuilder.Append(item.ThemeRole); if (stateNames != null && stateNames.Length > 0 && stateNames[0].Length > 0) { if (stateStringBuilder.Length > 0) { stateStringBuilder.Append(stateDelimiter); } stateStringBuilder.Append(string.Join(stateDelimiterString, stateNames)); } item.VisualState = stateStringBuilder.ToString(); }
protected virtual void ArrangeContentCore(RectangleF clientRect) { RectangleF toggleRectangle; RectangleF layoutManagerRect; this.GetArrangeRectangles(clientRect, out toggleRectangle, out layoutManagerRect); if (this.RightToLeft) { toggleRectangle = LayoutUtils.RTLTranslateNonRelative(toggleRectangle, clientRect); layoutManagerRect = LayoutUtils.RTLTranslateNonRelative(layoutManagerRect, clientRect); } if (this.toggleElement.Visibility != ElementVisibility.Collapsed) { this.toggleElement.Arrange(toggleRectangle); } this.Layout.Arrange(layoutManagerRect); RadItem editorElement = this.GetEditorElement((IValueEditor)this.editor); if (!this.IsInEditMode || editorElement == null) { return; } editorElement.Arrange(this.GetEditorArrangeRectangle(clientRect)); }
private void HandleKeyboardNavigation(int dir) { if (this.currentIndex == -1 || this.currentItem == null) { this.currentIndex = 0; this.currentItem = this.Items.Count > 0 ? this.Items[0] : (RadItem)null; } else { this.currentIndex += dir; if (this.currentIndex < 0) { this.currentIndex = this.Items.Count - 1; } if (this.currentIndex >= this.Items.Count) { this.currentIndex = 0; } this.currentItem = this.currentIndex < 0 || this.currentIndex >= this.Items.Count ? (RadItem)null : this.Items[this.currentIndex]; } this.ResetIsCurrentProperties(); BackstageTabItem currentItem = this.currentItem as BackstageTabItem; if (currentItem != null) { this.SelectedItem = currentItem; } else { if (this.currentItem == null) { return; } int num = (int)this.currentItem.SetValue(BackstageButtonItem.IsCurrentProperty, (object)true); } }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); if (ThumbHitTest(e.Location)) { if (this.IsCollapsed) { Expand(); return; } RadItem thumb = GetThumbFromPoint(e.Location); if (thumb == this.splitterElement.PrevNavigationButton) { CollapseToPrev(); } if (thumb == this.splitterElement.NextNavigationButton) { CollapseToNext(); } } if (this.splitTarget != null) { int x = e.X; int left = base.Left; int y = e.Y; int top = base.Top; Rectangle rectangle = this.CalcSplitLine(this.GetSplitSize(e.X, e.Y), 0); int num5 = rectangle.X; int num6 = rectangle.Y; this.SplitEnd(true); } }
internal protected RadItem GetActivatedItem(RadElement element, char charCode) { RadItem testItem = element as RadItem; if (testItem != null) { if ((!string.IsNullOrEmpty(testItem.Text) && testItem.Enabled)) { if (testItem.GetBitState(RadItem.ContainsMnemonicStateKey) && Control.IsMnemonic(charCode, testItem.Text)) { return(testItem); } } if ((!string.IsNullOrEmpty(testItem.Text) && testItem.Enabled)) { if (testItem.GetBitState(RadItem.ContainsMnemonicStateKey) && TelerikHelper.IsPseudoMnemonic(charCode, testItem.Text)) { return(testItem); } } } return(null); }
protected override string EvaluateDisplayTextFor(RadElement element) { RadItem item = element as RadItem; if (item == null) { return(string.Empty); } if (item.StateManager == null) { return(base.EvaluateDisplayTextFor(element)); } string themeRole = item.ThemeRole; string themeEffectiveTypeName = item.GetThemeEffectiveType().Name; if (themeRole == themeEffectiveTypeName) { return(themeEffectiveTypeName); } return(themeRole + " (" + themeEffectiveTypeName + ")"); }
protected override bool CanStart(object context) { RadItem radItem = context as RadItem; if (radItem == null) { return(false); } if (!this.beginPoint.HasValue) { this.beginPoint = new Point?(Control.MousePosition); } Point client = radItem.ElementTree.Control.PointToClient(this.beginPoint.Value); bool flag = ((ISupportDrag)radItem).CanDrag(client); PreviewDragStartEventArgs e = new PreviewDragStartEventArgs((ISupportDrag)radItem); e.CanStart = flag; this.OnPreviewDragStart(e); if (!e.CanStart) { this.beginPoint = new Point?(); } return(e.CanStart); }
public bool Goto(int index) { if (index < -2 || index >= this.Items.Count) { return(false); } if (this.currentIndex == index) { return(true); } BeginRotateEventArgs e = new BeginRotateEventArgs(this.currentIndex, index); this.OnBeginRotate((object)this, e); if (e.Cancel) { return(true); } RadItem itemToHide = this.GetItem(this.currentIndex); RadItem itemToShow = this.GetItem(e.To); this.currentIndex = index; this.SwapItems(itemToHide, itemToShow); return(true); }
private RadItem FindGesturedItem(GestureEventArgs args, RadElement current) { foreach (RadElement child in current.GetChildren(ChildrenListOptions.ZOrdered | ChildrenListOptions.ReverseOrder)) { if (child.ControlBoundingRectangle.Contains(args.Location)) { RadItem radItem = child as RadItem; if (radItem != null) { radItem.CallOnGesture(args); if (args.Handled) { return(radItem); } } RadItem gesturedItem = this.FindGesturedItem(args, child); if (gesturedItem != null) { return(gesturedItem); } } } return((RadItem)null); }
public virtual void AddEditor(IInputEditor editor) { if (editor == null || this.editor == editor) { return; } this.editor = editor; RadItem editorElement = this.GetEditorElement(this.editor); if (editorElement == null || this.Children.Contains((RadElement)editorElement)) { return; } int num = (int)editorElement.SetDefaultValueOverride(VisualElement.ForeColorProperty, (object)Color.FromKnownColor(KnownColor.ControlText)); this.Children.Add((RadElement)editorElement); BaseVirtualGridEditor virtualGridEditor = editor as BaseVirtualGridEditor; if (virtualGridEditor == null || !virtualGridEditor.ClearCellText) { return; } this.Text = string.Empty; }
protected virtual bool PrepareContext() { this.originalMouseCursor = Cursor.Current; RadItem context1 = this.Context as RadItem; if (!context1.Capture) { context1.Capture = true; } ISupportDrag context2 = this.Context as ISupportDrag; PreviewDragHintEventArgs e = new PreviewDragHintEventArgs(context2); this.OnPreviewDragHint(e); if (e.DragHint == null && e.UseDefaultHint) { e.DragHint = context2.GetDragHint(); } this.hintWindow.BackgroundImage = e.DragHint; Size size = e.DragHint != null ? e.DragHint.Size : (context1 == null ? Size.Empty : context1.Size); this.xOutlineFormOffset = size.Width / 2; this.yOutlineFormOffset = size.Height / 2; return(true); }
private void CreateSettingGroup() { RadRibbonBarGroup rbgSetting = new RadRibbonBarGroup(); rbgSetting.Text = "设置"; lblDataSource.Text = "活动数据源:"; List <string> lakeList = GetlakeList(); //if (lakeList != null && lakeList.Count() != 0) //{ // foreach (string item in lakeList) // _dltLakeSetting.Items.Add(item); //} _dltLakeSetting.DropDownStyle = RadDropDownStyle.DropDownList; _dltLakeSetting.SelectedIndex = 0; _dltLakeSetting.DropDownMaxSize = new System.Drawing.Size(85, 200); _dltLakeSetting.DropDownMinSize = new System.Drawing.Size(80, 200); RadRibbonBarButtonGroup grouplakeSetting = new RadRibbonBarButtonGroup(); RadItem[] items = new RadItem[] { lblDataSource, _dltLakeSetting }; grouplakeSetting.Items.AddRange(_dltLakeSetting); grouplakeSetting.Orientation = Orientation.Horizontal; grouplakeSetting.Margin = new Padding(0, 6, 0, 0); grouplakeSetting.ShowBorder = false; RadRibbonBarButtonGroup group1 = new RadRibbonBarButtonGroup(); group1.Items.AddRange(new RadItem[] { /* groupRomance,*/ grouplakeSetting }); group1.Orientation = Orientation.Vertical; group1.ShowBorder = false; //lblLakeRange.Text = "设置区域:"; //List<string> rbgSetting.Items.Add(group1); //_tab.Items.Add(rbgSetting); }
protected internal virtual void PaintKeyMap(Graphics graphics) { List <RadItem> currentKeyMap = this.Behavior.GetCurrentKeyMap(this.Behavior.ActiveKeyMapItem); int num = 1; for (int index1 = 0; index1 < currentKeyMap.Count; ++index1) { RadItem currentKeyMapItem = currentKeyMap[index1]; Rectangle boundingRectangle = currentKeyMapItem.ControlBoundingRectangle; if (currentKeyMapItem.ElementTree != null) { Point customLocation = Point.Empty; int y = boundingRectangle.Y + (int)((double)boundingRectangle.Height * 0.66); customLocation = new Point(boundingRectangle.X + (int)((double)boundingRectangle.Width / 2.0), y); RadKeyTipShowingEventArgs args = new RadKeyTipShowingEventArgs(false, customLocation, this.keyTipFont, Color.White, Color.Black, Color.Gray); if (!this.OnKeyTipShowing(currentKeyMapItem, (CancelEventArgs)args) && currentKeyMapItem.Visibility == ElementVisibility.Visible) { Control control = currentKeyMapItem.ElementTree.Control; Graphics graphics1 = (Graphics)null; if (control != this) { graphics1 = control.CreateGraphics(); } string empty = string.Empty; string keyTip; if (!string.IsNullOrEmpty(currentKeyMapItem.KeyTip)) { keyTip = currentKeyMapItem.KeyTip; } else { bool flag; do { RadItem radItem1 = currentKeyMap[index1]; keyTip = num >= 10 ? ((char)(65 + num - 10)).ToString() : num.ToString(); flag = false; for (int index2 = 0; index2 < currentKeyMap.Count; ++index2) { RadItem radItem2 = currentKeyMap[index2]; if (keyTip == radItem2.KeyTip) { ++num; flag = true; break; } } }while (flag); currentKeyMapItem.KeyTip = keyTip; ++num; } if (graphics1 != null) { this.PaintKeyTip(graphics1, args, keyTip); graphics1.Dispose(); } else { this.PaintKeyTip(graphics, args, keyTip); } } } } }
public TemplateEventArgs(RadItem item) { this.item = item; }
private void ItemChanged(RadItemCollection changed, RadItem target, ItemsChangeOperation operation) { this.invalidateCollapsableChildrenCollection = true; if (operation != ItemsChangeOperation.Inserted && operation != ItemsChangeOperation.Set) { return; } if (target.GetType() == typeof(RadButtonElement)) { RadButtonElement buttonElement = target as RadButtonElement; if (string.IsNullOrEmpty(buttonElement.Class)) { buttonElement.Class = "RibbonBarButtonElement"; } buttonElement.ButtonFillElement.Class = "ButtonInRibbonFill"; buttonElement.BorderElement.Class = "ButtonInRibbonBorder"; } else if (target is RadRibbonBarButtonGroup) { RadRibbonBarButtonGroup buttonGroup = (RadRibbonBarButtonGroup)target; buttonGroup.MinSize = new Size(22, 22); } else if (target is RadComboBoxElement || target is RadDropDownListElement) { target.MinSize = new Size(140, 0); target.StretchVertically = false; target.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren; } else if (target.GetType() == typeof(RadRadioButtonElement)) { target.MinSize = new Size(20, 0); target.StretchVertically = false; target.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren; } else if (target is RadTextBoxElement) { target.MinSize = new Size(140, 0); target.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren; // The border size is more correct in without horizontal padding Padding temp = target.Padding; temp.Left = 0; temp.Right = 0; target.Padding = temp; } else if (target is RadGalleryElement) { target.Padding = new Padding(2, 2, 0, 0); } else if (target.GetType() == typeof(RadCheckBoxElement)) { target.StretchVertically = false; } //Georgi: TODO: Why SplitButton needs special attention and DropDownButton no??? //else if (target is RadSplitButtonElement) //{ // target.StretchHorizontally = false; // target.StretchVertically = false; // target.Children[0].Visibility = ElementVisibility.Hidden; //} target.NotifyParentOnMouseInput = true; }
public void ItemClicked(RadItem item) { }
public override ICollection <string> EvaluateState(RadItem targetItem) { return(new string[1] { this.Name }); }
public RadEditorPopupControlBase(RadItem owner) : base(owner) { this.FadeAnimationType = FadeAnimationType.FadeOut; this.DropShadow = true; }
private void DropDownMenu_ItemSelected(object sender, ItemSelectedEventArgs args) { _currentItem = args.Item; //System.Diagnostics.Debug.WriteLine("DropDownMenu_ItemSelected, " + System.DateTime.Now.ToString("mm:ss fff")); }
public RadMenuItemPopup(RadItem owner) : base((RadElement)owner) { }
public RadItem SelectNextItem(RadItem item, bool forward) { return(this.itemsControlImpl.SelectNextItem(item, forward)); }
public void SelectItem(RadItem item) { this.itemsControlImpl.SelectItem(item); }
private void CreateStackOverflowBehavior() { this.layout = new Telerik.WinControls.Layouts.StackLayoutPanel(); this.layout.Orientation = Orientation.Horizontal; RadMenuContentItem contentItem = new RadMenuContentItem(); foreach (RadItem item in this.items) { if (this.realItemsList == null) { this.realItemsList = new ArrayList(); } if (item as RadFakeElement == null) { if (item.Visibility != ElementVisibility.Collapsed) { if (!this.realItemsList.Contains(item)) { this.realItemsList.Add(item); } } } } for (int i = 0; i < this.realItemsList.Count; i++) { RadItem item = (RadItem)this.realItemsList[i]; if (item.Visibility != ElementVisibility.Collapsed) { if (item as RadFakeElement != null) { this.fakeItemsList.Add(item as RadFakeElement); } if (item.Visibility == ElementVisibility.Hidden) { RadFakeElement element = new RadFakeElement(item); element.Bounds = item.Bounds; element.Margin = item.Margin; this.fakeItemsList.Add(element); this.toolStripItem.Items.Remove(item); this.toolStripItem.Items.Insert(i, element); } } } for (int i = 0; i < this.fakeItemsList.Count; i++) { RadFakeElement element = this.fakeItemsList[i] as RadFakeElement; if (element.AssociatedItem.Visibility != ElementVisibility.Collapsed) { element.AssociatedItem.Visibility = ElementVisibility.Visible; } if (element.AssociatedItem as RadButtonElement != null) { (element.AssociatedItem as RadButtonElement).Padding = new Padding(3, 3, 3, 3); } this.layout.Children.Add(element.AssociatedItem); } if (layout.Children.Count > 0) { contentItem.ContentElement = layout; contentItem.ShouldHandleMouseInput = false; contentItem.MinSize = new Size(164, 0); this.DropDownButton.Items.Add(contentItem); contentItem.Margin = new Padding(0, 5, 5, 0); this.DropDownButton.Items.Add(new RadMenuSeparatorItem()); } }
private void PrepareDropDownMenu() { _ddbeOthers.Items.Clear(); for (int i = 0; i < this.Items.Count; i++) { if (this.Items[i].Visibility == ElementVisibility.Hidden) { RadButtonElement rbe = null; ToolStripItemsOverFlow.RadFakeElement fakeElem = this.Items[i] as ToolStripItemsOverFlow.RadFakeElement; if (fakeElem == null) { rbe = this.Items[i] as RadButtonElement; if (rbe == null) { continue; } } else { rbe = fakeElem.AssociatedItem as RadButtonElement; if (rbe == null) { continue; } } RadItem riExisted = ContainText(_ddbeOthers, rbe.Text); if (riExisted != null) { riExisted.Enabled = rbe.Enabled; continue; } RadMenuItem rmi = new RadMenuItem(); rmi.Text = rbe.Text; rmi.Enabled = rbe.Enabled; System.Diagnostics.Debug.WriteLine("Add item of radDropdownbuttonElment, " + System.DateTime.Now.ToString("mm:ss fff") + "," + rbe.Text); //int myidx = FindInsertPosition(i); //if (myidx >= 0 && myidx < _ddbeOthers.Items.Count) //{ // _ddbeOthers.Items.Insert(myidx, rmi); //} //else //{ // _ddbeOthers.Items.Add(rmi); //} _ddbeOthers.Items.Add(rmi); } else if (this.Items[i].Visibility == ElementVisibility.Collapsed) { continue; } else if (this.Items[i].Visibility == ElementVisibility.Visible) { RadButtonElement rbe = this.Items[i] as RadButtonElement; if (rbe == null) { continue; } RemoveItemByText(_ddbeOthers, rbe.Text); } } }
private void Items_ItemsChanged(RadItemCollection changed, RadItem target, ItemsChangeOperation operation) { this.PerformLayout(); }
public RadFakeElement(RadItem associatedItem) { this.associatedItem = associatedItem; this.Text = this.associatedItem.Text; }
private void DropDownMenu_ItemDeselected(object sender, ItemSelectedEventArgs args) { _currentItem = null; }
/// <summary> /// Initializes the drop down behavior of the drop down items. /// </summary> public void PrepareDropDownItems() { this.lastParent = this.toolStripItem.ParentToolStripElement; this.lastManager = this.toolStripItem.ParentToolStripManager; this.DropDownButton.Items.Clear(); if (this.toolStripItem.ElementTree != null) { this.imageList = this.toolStripItem.ElementTree.ComponentTreeHandler.ImageList; } RadItem addOrRemoveItem = new RadItem(); addOrRemoveItem.Text = RadToolStripLocalizationProvider.CurrentProvider.GetLocalizationString( RadToolStripLocalizationStringId.AddorRemoveButtons); this.CreateStackOverflowBehavior(); this.InvalidateAllToolStripItems(); this.rootItem = new OverflowDropDownMenuItem(addOrRemoveItem, this.toolStripItem, this.imageList); rootItem.AssociatedItem = addOrRemoveItem; this.DropDownButton.Items.Add(rootItem); Graphics g = this.toolStripItem.ElementTree.Control.CreateGraphics(); SizeF stringSize = g.MeasureString(addOrRemoveItem.Text, addOrRemoveItem.Font); this.layout.MinSize = new Size((int)stringSize.Width, 0); this.layout.MaxSize = new Size(this.layout.MinSize.Width, 0); g.Dispose(); foreach (RadToolStripItem toolItem in this.toolStripItem.ParentToolStripElement.Items) { OverflowDropDownMenuItem corresponding = new OverflowDropDownMenuItem(toolItem, this.toolStripItem, this.imageList); corresponding.AssociatedItem = toolItem; foreach (RadItem item in toolItem.Items) { OverflowDropDownMenuItem correspondingItem = new OverflowDropDownMenuItem(item, toolItem, this.imageList); correspondingItem.AssociatedItem = item; correspondingItem.Click += new EventHandler(corresponding_Click); if (item.Visibility == ElementVisibility.Visible) { correspondingItem.IsChecked = true; this.visibleItemsCount++; } else { correspondingItem.IsChecked = false; } corresponding.Items.Add(correspondingItem); } corresponding.Items.Add(new RadMenuSeparatorItem()); RadItem myItem = new RadItem(); myItem.Text = RadToolStripLocalizationProvider.CurrentProvider.GetLocalizationString(RadToolStripLocalizationStringId.ResetToolBar); resetItem = new OverflowDropDownMenuItem(myItem, this.toolStripItem, this.imageList); resetItem.AssociatedItem = myItem; resetItem.Click += new EventHandler(resetItem_Click); corresponding.Items.Add(resetItem); rootItem.Items.Add(corresponding); } RadItem customizeItem = new RadItem(); customizeItem.Text = RadToolStripLocalizationProvider.CurrentProvider.GetLocalizationString(RadToolStripLocalizationStringId.Customize); CustomizeItem = new OverflowDropDownMenuItem(customizeItem, this.toolStripItem, this.imageList); CustomizeItem.AssociatedItem = customizeItem; CustomizeItem.Click += new EventHandler(CustomizeItem_Click); rootItem.Items.Add(new RadMenuSeparatorItem()); rootItem.Items.Add(CustomizeItem); if (!this.showRootItem) { rootItem.Visibility = ElementVisibility.Collapsed; } if (!this.showCustomizeItem) { this.CustomizeItem.Visibility = ElementVisibility.Collapsed; } if (!this.showResetItem) { this.CustomizeItem.Visibility = ElementVisibility.Collapsed; } }
public ItemDataBindingEventArgs(RadItem dataBindingItem, object dataItem) { this.dataBindingItem = dataBindingItem; this.dataItem = dataItem; }