public override AccessibleObject HitTest(int x, int y) { BaseListViewVisualItem elementAtPoint = this.ListView.ElementTree.GetElementAtPoint(this.ListView.PointToClient(new Point(x, y))) as BaseListViewVisualItem; if (elementAtPoint != null) { return((AccessibleObject) new ListViewDataItemAccessibleObject(elementAtPoint.Data)); } return((AccessibleObject)null); }
protected override void HandleItemDrop( BaseListViewVisualItem draggedItem, DraggableLayoutControlItem target) { base.HandleItemDrop(draggedItem, target); if (draggedItem.Data != null && draggedItem.Data.Group == this.HiddenItemsGroup && !(draggedItem.Data.Tag is LayoutControlItemBase)) { return; } (this.cardViewElement.ViewElement as CardListViewElement)?.UpdateItemsLayout(); }
protected override void InitializeEditor( BaseListViewVisualItem visualItem, ISupportInitialize initializable, IInputEditor editor) { this.ActiveEditor.Initialize((object)visualItem, this.SelectedItem[this.CurrentColumn]); initializable?.EndInit(); this.OnEditorInitialized(new ListViewItemEditorInitializedEventArgs(visualItem, (IValueEditor)editor)); this.ActiveEditor.BeginEdit(); this.cachedOldValue = this.SelectedItem[this.CurrentColumn]; }
protected override void OnLostFocus() { base.OnLostFocus(); BaseListViewVisualItem ownerElement = this.OwnerElement as BaseListViewVisualItem; if (ownerElement == null || !ownerElement.IsInValidState(true) || (ownerElement.ElementTree.Control.Focused || ownerElement.ElementTree.Control.ContainsFocus)) { return; } ownerElement.Data.Owner.EndEdit(); }
protected override void OnLostFocus() { BaseListViewVisualItem visualItem = this.OwnerElement as BaseListViewVisualItem; if (visualItem != null && visualItem.IsInValidState(true) && !visualItem.ElementTree.Control.Focused && !visualItem.ElementTree.Control.ContainsFocus) { visualItem.Data.Owner.EndEdit(); } }
public override void OnLostFocus() { BaseListViewVisualItem itemElement = this.OwnerElement as BaseListViewVisualItem; if (itemElement != null && itemElement.IsInValidState(true) && !itemElement.ElementTree.Control.Focused && !itemElement.ElementTree.Control.ContainsFocus) { itemElement.Data.Owner.EndEdit(); } }
public override void OnValueChanged() { base.OnValueChanged(); if (!((BaseDropDownListEditorElement)this.EditorElement).IsPopupOpen) { BaseListViewVisualItem itemElement = this.OwnerElement as BaseListViewVisualItem; if (itemElement != null && itemElement.Data.Owner != null && itemElement.Data.Owner.IsEditing) { itemElement.Data.Owner.EndEdit(); } } }
protected override void EnsureItemVisibleVerticalCore(ListViewDataItem item) { if (this.Orientation == Orientation.Horizontal) { this.EnsureItemVisibleHorizontal(item); } else { int val1 = 0; BaseListViewVisualItem element1 = this.GetElement(item); if (element1 == null) { this.Scroller.ScrollToItem(item); this.Scroller.Scrollbar.PerformLargeDecrement(1); this.ViewElement.UpdateLayout(); element1 = this.GetElement(item); } if (element1 != null) { if (element1.ControlBoundingRectangle.Bottom <= this.ViewElement.ControlBoundingRectangle.Bottom) { return; } this.EnsureItemVisible(item); } else { ListViewTraverser enumerator = (ListViewTraverser)this.Scroller.Traverser.GetEnumerator(); while (enumerator.MoveNext()) { val1 = Math.Max(val1, (int)this.ViewElement.ElementProvider.GetElementSize(enumerator.Current).Height + this.ItemSpacing); if (enumerator.Current.IsLastInRow) { this.SetScrollValue(this.VScrollBar, this.VScrollBar.Value + val1); val1 = 0; this.UpdateLayout(); BaseListViewVisualItem element2 = this.GetElement(item); if (element2 != null) { if (element2.ControlBoundingRectangle.Bottom <= this.ViewElement.ControlBoundingRectangle.Bottom) { break; } this.EnsureItemVisible(item); break; } } } } } }
protected override bool IsDropTargetValid(ISupportDrop dropTarget) { BaseListViewVisualItem listViewVisualItem = dropTarget as BaseListViewVisualItem; if (listViewVisualItem != null) { return(listViewVisualItem.Data != this.draggedItem); } if (dropTarget is BaseListViewElement) { return(true); } return(base.IsDropTargetValid(dropTarget)); }
public override Size GetDragHintSize(ISupportDrop target) { BaseListViewVisualItem listViewVisualItem = target as BaseListViewVisualItem; if (listViewVisualItem == null || this.DragHint == null) { return(Size.Empty); } if (this.Orientation == Orientation.Horizontal) { return(new Size(listViewVisualItem.Size.Width, this.DragHint.Image.Size.Height)); } return(new Size(this.DragHint.Image.Size.Width, listViewVisualItem.Size.Height)); }
public override void OnValueChanged() { base.OnValueChanged(); if (((PopupEditorBaseElement)this.EditorElement).IsPopupOpen) { return; } BaseListViewVisualItem ownerElement = this.OwnerElement as BaseListViewVisualItem; if (ownerElement == null || ownerElement.Data.Owner == null || !ownerElement.Data.Owner.IsEditing) { return; } ownerElement.Data.Owner.EndEdit(); }
protected virtual System.Type GetDragContext(ISupportDrag dragInstance) { BaseListViewVisualItem listViewVisualItem = dragInstance as BaseListViewVisualItem; if (listViewVisualItem == null) { return((System.Type)null); } if ((object)(listViewVisualItem.Data.Tag as System.Type) != null) { return((System.Type)listViewVisualItem.Data.Tag); } if (listViewVisualItem.Data.Tag != null) { return(listViewVisualItem.Data.Tag.GetType()); } return((System.Type)null); }
protected override void EnsureItemVisibleVertical(ListViewDataItem item) { if (this.Orientation == Orientation.Vertical) { base.EnsureItemVisibleVertical(item); } else { if (item == null) { return; } BaseListViewVisualItem element = this.GetElement(item); if (element == null) { this.UpdateLayout(); if (this.ViewElement.Children.Count <= 0) { return; } if (this.GetItemIndex(item) <= this.GetItemIndex(((BaseListViewVisualItem)this.ViewElement.Children[0]).Data)) { this.Scroller.ScrollToItem(item, false); } else { this.EnsureItemVisibleVerticalCore(item); } } else if (element.ControlBoundingRectangle.Right > this.ViewElement.ControlBoundingRectangle.Right) { this.SetScrollValue(this.HScrollBar, this.HScrollBar.Value + (element.ControlBoundingRectangle.Right - this.ViewElement.ControlBoundingRectangle.Right)); } else { if (element.ControlBoundingRectangle.Left >= this.ViewElement.ControlBoundingRectangle.Left) { return; } this.SetScrollValue(this.HScrollBar, this.HScrollBar.Value - (this.ViewElement.ControlBoundingRectangle.Left - element.ControlBoundingRectangle.Left)); } } }
protected override void OnKeyDown(KeyEventArgs e) { BaseListViewVisualItem ownerElement = this.OwnerElement as BaseListViewVisualItem; if (ownerElement == null) { return; } switch (e.KeyCode) { case Keys.Return: if (e.Modifiers == Keys.Shift) { break; } ownerElement.Data.Owner.EndEdit(); break; case Keys.Escape: ownerElement.Data.Owner.CancelEdit(); break; case Keys.Up: if (this.Multiline && (this.selectionLength != 0 || !this.isAtFirstLine)) { break; } ownerElement.Data.Owner.EndEdit(); ownerElement.Data.Owner.ProcessKeyDown(e); break; case Keys.Down: if (this.Multiline && (this.selectionLength != 0 || !this.isAtLastLine)) { break; } ownerElement.Data.Owner.EndEdit(); ownerElement.Data.Owner.ProcessKeyDown(e); break; } }
protected virtual LayoutControlItemBase CreateNewItem( BaseListViewVisualItem draggedItem) { LayoutControlItemBase layoutControlItemBase = (LayoutControlItemBase)null; if (draggedItem.Data == this.groupItem) { LayoutControlGroupItem controlGroupItem = new LayoutControlGroupItem(); controlGroupItem.Text = this.GetString("NewGroupDefaultText"); layoutControlItemBase = (LayoutControlItemBase)controlGroupItem; } else if (draggedItem.Data == this.separatorItem) { layoutControlItemBase = (LayoutControlItemBase) new LayoutControlSeparatorItem(); } else if (draggedItem.Data == this.splitterItem) { layoutControlItemBase = (LayoutControlItemBase) new LayoutControlSplitterItem(); } else if (draggedItem.Data == this.labelItem) { LayoutControlLabelItem controlLabelItem = new LayoutControlLabelItem(); controlLabelItem.Text = this.GetString("NewLabelDefaultText"); layoutControlItemBase = (LayoutControlItemBase)controlLabelItem; } else if (draggedItem.Data == this.emptySpaceItem) { LayoutControlLabelItem controlLabelItem = new LayoutControlLabelItem(); controlLabelItem.DrawText = false; layoutControlItemBase = (LayoutControlItemBase)controlLabelItem; } else if (draggedItem.Data == this.tabbedGroupItem) { layoutControlItemBase = (LayoutControlItemBase) new LayoutControlTabbedGroup(); } if (layoutControlItemBase != null) { layoutControlItemBase.AllowDelete = true; } return(layoutControlItemBase); }
public override Point GetDragHintLocation( BaseListViewVisualItem visualItem, Point mouseLocation) { if (this.Orientation == Orientation.Horizontal) { return(base.GetDragHintLocation(visualItem, mouseLocation)); } Rectangle screen = visualItem.ElementTree.Control.RectangleToScreen(visualItem.ControlBoundingRectangle); Padding empty = Padding.Empty; RadImageShape dragHint = this.DragHint; if (dragHint == null) { return(Point.Empty); } int width = dragHint.Image.Size.Width; Padding margins = dragHint.Margins; return(new Point((mouseLocation.X <= visualItem.Size.Width / 2 ? screen.X : screen.Right) - width / 2, screen.Y - margins.Top)); }
protected virtual void OnDragServiceDragDrop(object sender, RadDropEventArgs e) { e.Handled = true; this.layoutControl.DragOverlay.SetPreviewRectangle(Rectangle.Empty); DraggableLayoutControlItem hitTarget1 = e.HitTarget as DraggableLayoutControlItem; DraggableLayoutControlOverlayElement hitTarget2 = e.HitTarget as DraggableLayoutControlOverlayElement; BaseListViewVisualItem dragInstance = e.DragInstance as BaseListViewVisualItem; if (hitTarget2 != null) { this.HandleDropOnEmptyContainer(hitTarget2, dragInstance); } else { if (hitTarget1 == null) { return; } this.HandleItemDrop(dragInstance, hitTarget1); } }
protected override void OnKeyDown(KeyEventArgs e) { BaseDropDownListEditorElement editorElement = this.EditorElement as BaseDropDownListEditorElement; this.selectionStart = editorElement.SelectionStart; BaseListViewVisualItem ownerElement = this.OwnerElement as BaseListViewVisualItem; if (ownerElement == null) { return; } if (e.KeyCode == Keys.Return && e.Modifiers != Keys.Control) { ownerElement.Data.Owner.EndEdit(); } else if (e.KeyCode == Keys.Escape) { ownerElement.Data.Owner.CancelEdit(); e.Handled = true; } else if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right) { if (editorElement.DropDownStyle != RadDropDownStyle.DropDownList) { return; } e.Handled = true; } else { if (e.KeyCode != Keys.Down || e.Modifiers != Keys.Alt) { return; } ((PopupEditorBaseElement)this.EditorElement).ShowPopup(); e.Handled = true; } }
protected virtual void HandleDropOnEmptyContainer( DraggableLayoutControlOverlayElement overlayElement, BaseListViewVisualItem draggedItem) { LayoutControlDraggableOverlay control = overlayElement.ElementTree.Control as LayoutControlDraggableOverlay; LayoutControlItemBase layoutControlItemBase; if (draggedItem.Data.Group == this.hiddenItemsGroup) { LayoutControlItemBase tag = draggedItem.Data.Tag as LayoutControlItemBase; if (tag == null) { return; } this.layoutControl.HiddenItems.Remove((RadItem)tag); layoutControlItemBase = tag; } else { layoutControlItemBase = this.CreateNewItem(draggedItem); } control.Owner.Items.Add((RadItem)layoutControlItemBase); control.Owner.ContainerElement.RebuildLayoutTree(); }
protected virtual SizeF ArrangeUngroupedHorizontal(SizeF finalSize) { float x = this.clientRect.X + this.ScrollOffset.Width; float y = this.clientRect.Y; float val1_1 = 0.0f; float val1_2 = 0.0f; foreach (RadElement child in this.Children) { BaseListViewVisualItem listViewVisualItem = child as BaseListViewVisualItem; if (listViewVisualItem != null && listViewVisualItem.Data != null) { Size size = this.ElementProvider.GetElementSize(listViewVisualItem.Data).ToSize(); if ((double)y + (double)size.Height > (double)this.clientRect.Bottom && (double)y != (double)this.clientRect.Y) { y = this.clientRect.Y; x += val1_2 + (float)this.ItemSpacing; val1_2 = (float)size.Width; } val1_1 = Math.Max(val1_1, (float)size.Height); val1_2 = Math.Max(val1_2, (float)size.Width); if ((double)x == (double)this.clientRect.X && this.Grouped && (this.owner.Owner.Groups.Count > 0 && !this.owner.Owner.FullRowSelect)) { x += (float)this.owner.Owner.GroupIndent; } RectangleF rectangleF = new RectangleF(new PointF(x, y), (SizeF)size); if (this.RightToLeft) { rectangleF = LayoutUtils.RTLTranslateNonRelative(rectangleF, this.clientRect); } child.Arrange(rectangleF); y += (float)(size.Height + this.ItemSpacing); } } return(finalSize); }
public ListViewVisualItemCancelEventArgs(BaseListViewVisualItem visualItem, bool cancel) : base(cancel) { this.visualItem = visualItem; }
public ListViewVisualItemCancelEventArgs(BaseListViewVisualItem visualItem) { this.visualItem = visualItem; }
public ListViewItemEditedEventArgs(BaseListViewVisualItem visualItem, IValueEditor editor, bool canceled) : base(visualItem) { this.editor = editor; this.canceled = canceled; }
protected virtual void HandleDragDrop(RadDropEventArgs e) { RadElement hitTarget1 = e.HitTarget as RadElement; BaseListViewVisualItem targetElement = e.HitTarget as BaseListViewVisualItem; BaseListViewElement hitTarget2 = e.HitTarget as BaseListViewElement; if (hitTarget1 != null) { targetElement = this.owner.ViewElement.GetVisualItemAt(hitTarget1.PointToControl(e.DropLocation)); } ListViewDataItem listViewDataItem = targetElement?.Data; bool flag = false; if (listViewDataItem != null) { listViewDataItem.Owner.ListSource.BeginUpdate(); if (this.owner.ViewElement.ShouldDropAfter(targetElement, e.DropLocation)) { ITraverser <ListViewDataItem> enumerator = this.owner.ViewElement.Scroller.Traverser.GetEnumerator() as ITraverser <ListViewDataItem>; enumerator.Position = (object)listViewDataItem; flag = !enumerator.MoveNext(); listViewDataItem = enumerator.Current; } int newIndex = this.owner.ListSource.IndexOf(listViewDataItem); if (this.draggedItems != null) { foreach (ListViewDataItem draggedItem in this.draggedItems) { int oldIndex = this.owner.ListSource.IndexOf(draggedItem); this.owner.ListSource.Move(oldIndex, newIndex); if (oldIndex > newIndex) { ++newIndex; } } } else if (this.draggedItem != null) { int num1 = this.owner.ListSource.IndexOf(this.draggedItem); if (flag) { int num2 = this.owner.ListSource.Count - 1; } else if (num1 < newIndex) { --newIndex; } this.owner.ListSource.Move(this.owner.ListSource.IndexOf(this.draggedItem), newIndex); } listViewDataItem.Owner.ListSource.EndUpdate(); listViewDataItem.Owner.ViewElement.Scroller.UpdateScrollValue(); } else { if (hitTarget2 == null) { return; } hitTarget2.Owner.ListSource.BeginUpdate(); if (this.draggedItems != null) { foreach (ListViewDataItem draggedItem in this.draggedItems) { hitTarget2.Owner.ListSource.Move(this.owner.ListSource.IndexOf(draggedItem), this.owner.ListSource.Count - 1); } } else if (this.draggedItem != null) { hitTarget2.Owner.ListSource.Move(this.owner.ListSource.IndexOf(this.draggedItem), this.owner.ListSource.Count - 1); } hitTarget2.Owner.ListSource.EndUpdate(); hitTarget2.Owner.ViewElement.Scroller.UpdateScrollValue(); } }
protected virtual void HandleDropBetweenListViews(RadDropEventArgs e) { RadElement hitTarget = e.HitTarget as RadElement; BaseListViewVisualItem listViewVisualItem = e.HitTarget as BaseListViewVisualItem; BaseListViewElement baseListViewElement = e.HitTarget as BaseListViewElement; if (listViewVisualItem != null && baseListViewElement == null) { baseListViewElement = listViewVisualItem.Data.Owner.ViewElement; } ListViewDataItem data; if (hitTarget != null) { Point control = hitTarget.PointToControl(e.DropLocation); if (listViewVisualItem == null) { listViewVisualItem = baseListViewElement.GetVisualItemAt(control); } data = listViewVisualItem?.Data; } else { data = listViewVisualItem?.Data; } if (data != null) { data.Owner.ListSource.BeginUpdate(); int index = data.Owner.ListSource.IndexOf(data); if (e.DropLocation.Y > listViewVisualItem.Size.Height / 2) { ++index; } if (this.draggedItems != null) { foreach (ListViewDataItem draggedItem in this.draggedItems) { this.owner.ListSource.Remove(draggedItem); data.Owner.ListSource.Insert(index, draggedItem); ++index; } } else if (this.draggedItem != null) { this.owner.ListSource.Remove(this.draggedItem); data.Owner.ListSource.Insert(index, this.draggedItem); } data.Owner.ListSource.EndUpdate(); data.Owner.ViewElement.Scroller.UpdateScrollValue(); } else { if (baseListViewElement == null) { return; } baseListViewElement.Owner.ListSource.BeginUpdate(); if (this.draggedItems != null) { foreach (ListViewDataItem draggedItem in this.draggedItems) { this.owner.ListSource.Remove(draggedItem); baseListViewElement.Owner.ListSource.Add(draggedItem); } } else if (this.draggedItem != null) { this.owner.ListSource.Remove(this.draggedItem); baseListViewElement.Owner.ListSource.Add(this.draggedItem); } baseListViewElement.Owner.ListSource.EndUpdate(); baseListViewElement.Owner.ViewElement.Scroller.UpdateScrollValue(); } }
public ListViewVisualItemCreatingEventArgs(BaseListViewVisualItem visualItem, ListViewType viewType) { this.visualItem = visualItem; this.listViewType = viewType; }
public ListViewItemEditorInitializedEventArgs(BaseListViewVisualItem visualItem, IValueEditor editor) : base(visualItem) { this.editor = editor; }
public ListViewVisualItemEventArgs(BaseListViewVisualItem item) { this.item = item; }
protected override System.Drawing.SizeF ArrangeOverride(System.Drawing.SizeF finalSize) { RectangleF clientRect = new RectangleF(Padding.Left, Padding.Top, finalSize.Width - Padding.Horizontal, finalSize.Height - Padding.Vertical); float x = clientRect.X, y = clientRect.Y; if (this.Orientation == System.Windows.Forms.Orientation.Vertical) { y += this.ScrollOffset.Height; } else { x += this.ScrollOffset.Width; } float maxHeight = 0; float maxWidth = 0; foreach (RadElement element in this.Children) { BaseListViewVisualItem visualItem = element as BaseListViewVisualItem; if (visualItem == null || visualItem.Data == null) { continue; } Size iconSize = this.ElementProvider.GetElementSize(visualItem.Data).ToSize(); maxHeight = Math.Max(maxHeight, iconSize.Height); maxWidth = Math.Max(maxWidth, iconSize.Width); if (element is BaseListViewGroupVisualItem) { if (x != clientRect.X) { x = clientRect.X; y += maxHeight; maxHeight = iconSize.Height; } element.Arrange(new RectangleF(new PointF(x, y), iconSize)); x = clientRect.X; y += iconSize.Height + this.ItemSpacing; } else { if (x + iconSize.Width > clientRect.Right && this.Orientation == Orientation.Vertical) { x = clientRect.X; y += maxHeight + this.ItemSpacing; maxHeight = iconSize.Height; } else if (y + iconSize.Height > clientRect.Bottom && this.Orientation == Orientation.Horizontal) { y = clientRect.Y; x += maxWidth + this.ItemSpacing; maxWidth = iconSize.Width; } if (x == clientRect.X && this.owner.Owner.ShowGroups && (this.owner.Owner.EnableCustomGrouping || this.owner.Owner.EnableGrouping) && (this.owner.Owner.Groups.Count > 0) && !this.owner.Owner.FullRowSelect) { x += this.owner.Owner.GroupIndent; } element.Arrange(new RectangleF(new PointF(x, y), iconSize)); if (this.Orientation == Orientation.Vertical) { x += iconSize.Width + this.ItemSpacing; } else { y += iconSize.Height + this.ItemSpacing; } } } return(finalSize); }
public ListViewItemValidatingEventArgs(BaseListViewVisualItem visualItem, object oldValue, object newValue) : base(visualItem.Data) { this.oldValue = oldValue; this.newValue = newValue; }