s&box docs

public class Editor.BaseItemWidget : Editor.BaseScrollWidget

Constructors

Showing 1 constructors

Methods

Showing 58 methods

public T AddItem(T item)

Add given item to this widget.

public void AddItems(System.Collections.Generic.IEnumerable`1<object> items)

public virtual void Clear()

Remove all items.

public virtual void Dirty(object dirtyObject = null)

Parameters

  • dirtyObject: Default: null

protected virtual System.Collections.Generic.IEnumerable`1<object> FindItemsThatStartWith(string text)

protected Editor.VirtualWidget FindVirtualWidget(object obj)

Given an object, try to find the virtual widget. This can of course return null if the item isn't visible

protected object GetAtIndex(int i)

Returns the item at given index, or null.

protected virtual Editor.VirtualWidget GetDragItem(Editor.Widget.DragEvent ev)

Get the virtual item to use as a drop target for a given drag event

public Editor.VirtualWidget GetItemAt(Vector2 localPosition)

Get the virtual item at this local position.

protected virtual string GetTooltip(object obj)

Called to retrieve a tooltip for given item.

public virtual bool IsSelected(object obj)

Return true if this item is selected.

protected int ItemIndex(object item)

Returns the index of given item.

public virtual void OnDestroyed()

protected virtual void OnDoubleClick(Editor.MouseEvent e)

public virtual void OnDragDrop(Editor.Widget.DragEvent ev)

public virtual void OnDragHover(Editor.Widget.DragEvent ev)

protected virtual void OnDragHoverItem(Editor.Widget.DragEvent ev, Editor.VirtualWidget item)

Called when a dragged item is being hovered over this widget. This is the place to make drag and drop previews.

protected virtual bool OnDragItem(Editor.VirtualWidget item)

Called when we start to drag an item.

public virtual void OnDragLeave()

protected virtual void OnDragStart()

protected virtual void OnDropOnItem(Editor.Widget.DragEvent ev, Editor.VirtualWidget item)

Called when an item is drag and dropped onto this widget.

protected virtual void OnHoverChanged(object oldHover, object newHover)

Hover has changed, neither of these objects are guaranteed to be non null.

protected virtual void OnItemActivated(object item)

protected virtual void OnItemContextMenu(Editor.VirtualWidget pressedItem, Editor.MouseEvent e)

The item has been right clicked

protected virtual Editor.DropAction OnItemDrag(Editor.BaseItemWidget.ItemDragEvent e)

Called when a dragged item is being hovered over this widget. This is the place to make drag and drop previews.

protected virtual bool OnItemPressed(Editor.VirtualWidget pressedItem, Editor.MouseEvent e)

Allows over-riding mouse press on an item, without click or selection. Return true to allow default behavior.

protected virtual void OnKeyPress(Editor.KeyEvent e)

protected virtual void OnKeyPressOnItem(Editor.KeyEvent e, object item)

A key has been pressed on this selected item.

protected virtual void OnLayoutChanged()

protected virtual void OnMouseMove(Editor.MouseEvent e)

protected virtual void OnMousePress(Editor.MouseEvent e)

protected virtual void OnMouseReleased(Editor.MouseEvent e)

protected virtual void OnPaint()

protected virtual void OnResize()

protected virtual void OnScrollChanged()

protected virtual void OnSelectionAdded(object item)

protected virtual void OnShortcutPressed(Editor.KeyEvent e)

protected virtual void Rebuild()

Rebuild the panel layout.

public void RemoveItem(object item)

Remove given item from this widget.

protected virtual object ResolveObject(object obj)

For derived classes where the object is wrapped in another class (i.e. TreeView)

protected void SelectAll(bool skipEvents = False)

Parameters

  • skipEvents: Default: False

public void SelectItem(object obj, bool add = False, bool skipEvents = False)

Select given item.

Parameters

  • obj: Item to select.
  • add: Whether to add the item to selection, or replace current selection. Default: False
  • skipEvents: Do not invoke events. Default: False

public void SelectItems(System.Collections.Generic.IEnumerable`1<object> items, bool add = False, bool skipEvents = False)

Parameters

  • add: Default: False
  • skipEvents: Default: False

public virtual void SelectItemStartingWith(string text)

public bool SelectMove(int i)

Move the selection pointer by this many positions.

public virtual bool SelectMoveColumn(int positions)

public virtual bool SelectMoveRow(int positions)

protected virtual void SelectTo(object item, bool skipEvents = False)

Select everything between the current selection pointer and this one.

Parameters

  • skipEvents: Default: False

public void SetItems(System.Collections.Generic.IEnumerable`1<object> items)

protected virtual void SetSelected(object obj, bool state, bool skipEvents = False)

Set the selection state of an item.

Parameters

  • obj: Item to set selection state of.
  • state: Whether the item should be selected or not.
  • skipEvents: Do not invoke `Editor.BaseItemWidget.ItemSelected` and `Editor.BaseItemWidget.ItemDeselected`. Default: False

public void UnselectAll(bool skipEvents = False)

Unselects all items that are currently selected (if any)

Parameters

  • skipEvents: Do not invoke events. Default: False

public void UnselectItem(object obj, bool skipEvents = False)

Unselect given item.

Parameters

  • obj: Item to deselect.
  • skipEvents: Do not invoke events. Default: False

public void UpdateIfDirty()

Properties

Showing 29 properties

public System.Action Editor.BaseItemWidget.BodyContextMenu { get; set; }

Called when right clicking on the item's parent.

public Sandbox.Rect Editor.BaseItemWidget.CanvasRect { get; set; }

The inner of LocalRect with Margin

public float Editor.BaseItemWidget.DragDropTargetClosestThreshold { get; set; }

Gets or sets the maximum distance, in pixels, at which a target is considered close enough for drag-and-drop when in BodyDropTarget.Closest mode. operations.

public System.Action`1<object> Editor.BaseItemWidget.ItemActivated { get; set; }

Called when an item is double left clicked.

public System.Action`1<object> Editor.BaseItemWidget.ItemClicked { get; set; }

Called when an item is clicked.

public System.Action`1<object> Editor.BaseItemWidget.ItemContextMenu { get; set; }

Called when an item is right clicked.

public System.Action`1<object> Editor.BaseItemWidget.ItemDeselected { get; set; }

Called when an item is no longer selected.

public System.Func`2<object,bool> Editor.BaseItemWidget.ItemDrag { get; set; }

Called to see whether or not we can drag a specific item.

public System.Action`1<object> Editor.BaseItemWidget.ItemHoverEnter { get; set; }

Called when an item is hovered by the user's cursor.

public System.Action`1<object> Editor.BaseItemWidget.ItemHoverLeave { get; set; }

Called when an item is no longer hovered by the user's cursor.

public System.Collections.Generic.IEnumerable`1<object> Editor.BaseItemWidget.Items { get; set; }

public System.Action`1<object[]> Editor.BaseItemWidget.ItemsDeselected { get; set; }Obsolete

Multiple items have been deselected

Obsolete: Use OnSelectionChanged or ItemSelected instead

public System.Action`1<object> Editor.BaseItemWidget.ItemSelected { get; set; }

Called when an item is selected.

public System.Action`1<object[]> Editor.BaseItemWidget.ItemsSelected { get; set; }Obsolete

Multiple items have been selected

Obsolete: Use OnSelectionChanged or ItemSelected instead

public bool Editor.BaseItemWidget.MultiSelect { get; set; }

Whether to allow selecting multiple items at once.

public System.Action`1<object[]> Editor.BaseItemWidget.OnBeforeDeselection { get; set; }

Called before selection is changed on deselection. When multiple items are affected this will only be called once.

public System.Action`1<object[]> Editor.BaseItemWidget.OnBeforeSelection { get; set; }

Called before selection is changed on selection. When multiple items are affected this will only be called once.

public System.Action`1<object[]> Editor.BaseItemWidget.OnSelectionChanged { get; set; }

Called when selection has changed. When multiple items are affected this will only be called once.

public virtual bool Editor.BaseItemWidget.ProvidesDebugMode { get; set; }

public System.Collections.Generic.IEnumerable`1<object> Editor.BaseItemWidget.SelectedItems { get; set; }

Selected items.

public System.Func`1<object> Editor.BaseItemWidget.SelectionOverride { get; set; }

Can override an item's selection here.

public bool Editor.BaseItemWidget.ToggleSelect { get; set; }

If set, selecting an item will not deselect all already selected items, clicking a selected item will deselect it.

Metadata

FieldValue
NamespaceEditor
Typeclass
AssemblySandbox.Tools
Doc IDT:Editor.BaseItemWidget

On this page

Constructorspublic BaseItemWidget(Editor.Widget parent = null)Methodspublic T AddItem(T item)public System.Void AddItems(System.Collections.Generic.IEnumerable`1<System.Object> items)public virtual System.Void Clear()public virtual System.Void Dirty(System.Object dirtyObject = null)protected virtual System.Collections.Generic.IEnumerable`1<System.Object> FindItemsThatStartWith(System.String text)protected Editor.VirtualWidget FindVirtualWidget(System.Object obj)protected System.Object GetAtIndex(System.Int32 i)protected virtual Editor.VirtualWidget GetDragItem(Editor.Widget.DragEvent ev)public Editor.VirtualWidget GetItemAt(Vector2 localPosition)protected virtual System.String GetTooltip(System.Object obj)public virtual System.Boolean IsSelected(System.Object obj)protected System.Int32 ItemIndex(System.Object item)protected virtual Editor.DropAction OnBodyDragDrop(Editor.BaseItemWidget.ItemDragEvent ev)public virtual System.Void OnDestroyed()protected virtual System.Void OnDoubleClick(Editor.MouseEvent e)public virtual System.Void OnDragDrop(Editor.Widget.DragEvent ev)public virtual System.Void OnDragHover(Editor.Widget.DragEvent ev)protected virtual System.Void OnDragHoverItem(Editor.Widget.DragEvent ev, Editor.VirtualWidget item)protected virtual System.Boolean OnDragItem(Editor.VirtualWidget item)public virtual System.Void OnDragLeave()protected virtual System.Void OnDragStart()protected virtual System.Void OnDropOnItem(Editor.Widget.DragEvent ev, Editor.VirtualWidget item)protected virtual System.Void OnHoverChanged(System.Object oldHover, System.Object newHover)protected virtual System.Void OnItemActivated(System.Object item)protected virtual System.Void OnItemContextMenu(Editor.VirtualWidget pressedItem, Editor.MouseEvent e)protected virtual Editor.DropAction OnItemDrag(Editor.BaseItemWidget.ItemDragEvent e)protected virtual System.Boolean OnItemPressed(Editor.VirtualWidget pressedItem, Editor.MouseEvent e)protected virtual System.Void OnKeyPress(Editor.KeyEvent e)protected virtual System.Void OnKeyPressOnItem(Editor.KeyEvent e, System.Object item)protected virtual System.Void OnLayoutChanged()protected virtual System.Void OnMouseMove(Editor.MouseEvent e)protected virtual System.Void OnMousePress(Editor.MouseEvent e)protected virtual System.Void OnMouseReleased(Editor.MouseEvent e)protected virtual System.Void OnPaint()protected virtual System.Void OnResize()protected virtual System.Void OnScrollChanged()protected virtual System.Void OnSelectionAdded(System.Object item)protected virtual System.Void OnShortcutPressed(Editor.KeyEvent e)protected virtual System.Void PaintItem(Editor.VirtualWidget item)protected virtual System.Void PaintItemDebug(Editor.VirtualWidget item)protected virtual System.Void Rebuild()public System.Void RemoveItem(System.Object item)protected virtual System.Object ResolveObject(System.Object obj)public virtual System.Void ScrollTo(System.Object target)public virtual System.Void ScrollTo(System.Single targetPosition, System.Single height)protected System.Void SelectAll(System.Boolean skipEvents = False)public System.Void SelectItem(System.Object obj, System.Boolean add = False, System.Boolean skipEvents = False)public System.Void SelectItems(System.Collections.Generic.IEnumerable`1<System.Object> items, System.Boolean add = False, System.Boolean skipEvents = False)public virtual System.Void SelectItemStartingWith(System.String text)public System.Boolean SelectMove(System.Int32 i)public virtual System.Boolean SelectMoveColumn(System.Int32 positions)public virtual System.Boolean SelectMoveRow(System.Int32 positions)protected virtual System.Void SelectTo(System.Object item, System.Boolean skipEvents = False)public System.Void SetItems(System.Collections.Generic.IEnumerable`1<System.Object> items)protected virtual System.Void SetSelected(System.Object obj, System.Boolean state, System.Boolean skipEvents = False)public System.Void UnselectAll(System.Boolean skipEvents = False)public System.Void UnselectItem(System.Object obj, System.Boolean skipEvents = False)public System.Void UpdateIfDirty()Propertiespublic System.Action Editor.BaseItemWidget.BodyContextMenu { get; set; }public Editor.BaseItemWidget.DragDropTarget Editor.BaseItemWidget.BodyDropTarget { get; set; }public Sandbox.Rect Editor.BaseItemWidget.CanvasRect { get; set; }public Editor.BaseItemWidget.ItemDragEvent Editor.BaseItemWidget.CurrentItemDragEvent { get; set; }public System.Single Editor.BaseItemWidget.DragDropTargetClosestThreshold { get; set; }public System.Action`1<System.Object> Editor.BaseItemWidget.ItemActivated { get; set; }public System.Action`1<System.Object> Editor.BaseItemWidget.ItemClicked { get; set; }public System.Action`1<System.Object> Editor.BaseItemWidget.ItemContextMenu { get; set; }public System.Action`1<System.Object> Editor.BaseItemWidget.ItemDeselected { get; set; }public System.Func`2<System.Object,System.Boolean> Editor.BaseItemWidget.ItemDrag { get; set; }public System.Action`1<System.Object> Editor.BaseItemWidget.ItemHoverEnter { get; set; }public System.Action`1<System.Object> Editor.BaseItemWidget.ItemHoverLeave { get; set; }public System.Action`1<Editor.VirtualWidget> Editor.BaseItemWidget.ItemPaint { get; set; }public System.Collections.Generic.IEnumerable`1<System.Object> Editor.BaseItemWidget.Items { get; set; }public System.Action`1<System.Object[]> Editor.BaseItemWidget.ItemsDeselected { get; set; }public System.Action`1<System.Object> Editor.BaseItemWidget.ItemSelected { get; set; }public System.Action`1<System.Object[]> Editor.BaseItemWidget.ItemsSelected { get; set; }public Sandbox.UI.Margin Editor.BaseItemWidget.Margin { get; set; }public System.Boolean Editor.BaseItemWidget.MultiSelect { get; set; }public System.Action`1<System.Object[]> Editor.BaseItemWidget.OnBeforeDeselection { get; set; }public System.Action`1<System.Object[]> Editor.BaseItemWidget.OnBeforeSelection { get; set; }public System.Action`1<System.Object[]> Editor.BaseItemWidget.OnSelectionChanged { get; set; }public virtual System.Boolean Editor.BaseItemWidget.ProvidesDebugMode { get; set; }public System.Collections.Generic.IEnumerable`1<System.Object> Editor.BaseItemWidget.SelectedItems { get; set; }public Sandbox.SelectionSystem Editor.BaseItemWidget.Selection { get; set; }public System.Func`1<System.Object> Editor.BaseItemWidget.SelectionOverride { get; set; }protected System.Single Editor.BaseItemWidget.TimeMsPaint { get; set; }protected System.Single Editor.BaseItemWidget.timeMsRebuild { get; set; }public System.Boolean Editor.BaseItemWidget.ToggleSelect { get; set; }Metadata