BaseItemWidgetclass

objectBaseScrollWidgetBaseItemWidget
Namespace
Editor
Assembly
Sandbox.Tools
Declaration
public class Editor.BaseItemWidget : Editor.BaseScrollWidget

Constructors1

Showing 1 constructors

Methods58

Showing 58 methods

public T AddItem(T item)PUBLIC

Add given item to this widget.

ParameterTypeDescription
itemT
Returns:T

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

ParameterTypeDescription
itemsIEnumerable<object>
Returns:void

public virtual void Clear()PUBLICVIRTUAL

Remove all items.

Returns:void

public virtual void Dirty(object dirtyObject = null)PUBLICVIRTUAL

ParameterTypeDescription
dirtyObject = nullobject
Returns:void

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

ParameterTypeDescription
textstring
Returns:IEnumerable<object>

protected Editor.VirtualWidget FindVirtualWidget(object obj)PROTECTED

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

ParameterTypeDescription
objobject
Returns:VirtualWidget

protected object GetAtIndex(int i)PROTECTED

Returns the item at given index, or null.

ParameterTypeDescription
iint
Returns:object

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

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

ParameterTypeDescription
evDragEvent
Returns:VirtualWidget

protected virtual string GetTooltip(object obj)PROTECTEDVIRTUAL

Called to retrieve a tooltip for given item.

ParameterTypeDescription
objobject
Returns:string

public virtual bool IsSelected(object obj)PUBLICVIRTUAL

Return true if this item is selected.

ParameterTypeDescription
objobject
Returns:bool

protected int ItemIndex(object item)PROTECTED

Returns the index of given item.

ParameterTypeDescription
itemobject
Returns:int

public virtual void OnDestroyed()PUBLICVIRTUALLIFECYCLE

Returns:void

protected virtual void OnDoubleClick(Editor.MouseEvent e)PROTECTEDVIRTUAL

ParameterTypeDescription
eMouseEvent
Returns:void

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

ParameterTypeDescription
evDragEvent
Returns:void

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

ParameterTypeDescription
evDragEvent
Returns:void

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

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

ParameterTypeDescription
evDragEvent
itemVirtualWidget
Returns:void

protected virtual bool OnDragItem(Editor.VirtualWidget item)PROTECTEDVIRTUAL

Called when we start to drag an item.

ParameterTypeDescription
itemVirtualWidget
Returns:bool

public virtual void OnDragLeave()PUBLICVIRTUAL

Returns:void

protected virtual void OnDragStart()PROTECTEDVIRTUALLIFECYCLE

Returns:void

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

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

ParameterTypeDescription
evDragEvent
itemVirtualWidget
Returns:void

protected virtual void OnHoverChanged(object oldHover, object newHover)PROTECTEDVIRTUAL

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

ParameterTypeDescription
oldHoverobject
newHoverobject
Returns:void

protected virtual void OnItemActivated(object item)PROTECTEDVIRTUAL

ParameterTypeDescription
itemobject
Returns:void

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

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

ParameterTypeDescription
pressedItemVirtualWidget
eMouseEvent
Returns:bool

protected virtual void OnKeyPress(Editor.KeyEvent e)PROTECTEDVIRTUAL

ParameterTypeDescription
eKeyEvent
Returns:void

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

A key has been pressed on this selected item.

ParameterTypeDescription
eKeyEvent
itemobject
Returns:void

protected virtual void OnLayoutChanged()PROTECTEDVIRTUAL

Returns:void

protected virtual void OnMouseMove(Editor.MouseEvent e)PROTECTEDVIRTUAL

ParameterTypeDescription
eMouseEvent
Returns:void

protected virtual void OnMousePress(Editor.MouseEvent e)PROTECTEDVIRTUAL

ParameterTypeDescription
eMouseEvent
Returns:void

protected virtual void OnMouseReleased(Editor.MouseEvent e)PROTECTEDVIRTUAL

ParameterTypeDescription
eMouseEvent
Returns:void

protected virtual void OnPaint()PROTECTEDVIRTUAL

Returns:void

protected virtual void OnResize()PROTECTEDVIRTUAL

Returns:void

protected virtual void OnScrollChanged()PROTECTEDVIRTUAL

Returns:void

protected virtual void OnSelectionAdded(object item)PROTECTEDVIRTUAL

ParameterTypeDescription
itemobject
Returns:void

protected virtual void OnShortcutPressed(Editor.KeyEvent e)PROTECTEDVIRTUAL

ParameterTypeDescription
eKeyEvent
Returns:void

protected virtual void PaintItem(Editor.VirtualWidget item)PROTECTEDVIRTUAL

ParameterTypeDescription
itemVirtualWidget
Returns:void

protected virtual void PaintItemDebug(Editor.VirtualWidget item)PROTECTEDVIRTUAL

ParameterTypeDescription
itemVirtualWidget
Returns:void

protected virtual void Rebuild()PROTECTEDVIRTUAL

Rebuild the panel layout.

Returns:void

public void RemoveItem(object item)PUBLIC

Remove given item from this widget.

ParameterTypeDescription
itemobject
Returns:void

protected virtual object ResolveObject(object obj)PROTECTEDVIRTUAL

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

ParameterTypeDescription
objobject
Returns:object

protected void SelectAll(bool skipEvents = False)PROTECTED

ParameterTypeDescription
skipEvents = Falsebool
Returns:void

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

Select given item.

ParameterTypeDescription
objobjectItem to select.
add = FalseboolWhether to add the item to selection, or replace current selection.
skipEvents = FalseboolDo not invoke events.
Returns:void

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

ParameterTypeDescription
itemsIEnumerable<object>
add = Falsebool
skipEvents = Falsebool
Returns:void

public virtual void SelectItemStartingWith(string text)PUBLICVIRTUAL

ParameterTypeDescription
textstring
Returns:void

public bool SelectMove(int i)PUBLIC

Move the selection pointer by this many positions.

ParameterTypeDescription
iint
Returns:bool

public virtual bool SelectMoveColumn(int positions)PUBLICVIRTUAL

ParameterTypeDescription
positionsint
Returns:bool

public virtual bool SelectMoveRow(int positions)PUBLICVIRTUAL

ParameterTypeDescription
positionsint
Returns:bool

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

Select everything between the current selection pointer and this one.

ParameterTypeDescription
itemobject
skipEvents = Falsebool
Returns:void

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

ParameterTypeDescription
itemsIEnumerable<object>
Returns:void

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

Set the selection state of an item.

ParameterTypeDescription
objobjectItem to set selection state of.
stateboolWhether the item should be selected or not.
skipEvents = FalseboolDo not invoke `Editor.BaseItemWidget.ItemSelected` and `Editor.BaseItemWidget.ItemDeselected`.
Returns:void

public void UnselectAll(bool skipEvents = False)PUBLIC

Unselects all items that are currently selected (if any)

ParameterTypeDescription
skipEvents = FalseboolDo not invoke events.
Returns:void

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

Unselect given item.

ParameterTypeDescription
objobjectItem to deselect.
skipEvents = FalseboolDo not invoke events.
Returns:void

public void UpdateIfDirty()PUBLICPER-FRAME

Returns:void

Properties29

Showing 29 properties

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

Called when right clicking on the item's parent.

Returns:Action

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

The inner of LocalRect with Margin

Returns:Rect

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

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.

Returns:float

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

Called when an item is double left clicked.

Returns:Action<object>

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

Called when an item is clicked.

Returns:Action<object>

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

Called when an item is right clicked.

Returns:Action<object>

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

Called when an item is no longer selected.

Returns:Action<object>

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

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

Returns:Func<object,bool>

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

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

Returns:Action<object>

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

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

Returns:Action<object>

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

Returns:IEnumerable<object>

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

Multiple items have been deselected

Obsolete: Use OnSelectionChanged or ItemSelected instead

Returns:Action<object[]>

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

Called when an item is selected.

Returns:Action<object>

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

Multiple items have been selected

Obsolete: Use OnSelectionChanged or ItemSelected instead

Returns:Action<object[]>

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

Whether to allow selecting multiple items at once.

Returns:bool

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

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

Returns:Action<object[]>

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

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

Returns:Action<object[]>

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

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

Returns:Action<object[]>

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

Returns:bool

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

Selected items.

Returns:IEnumerable<object>

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

Can override an item's selection here.

Returns:Func<object>

protected float Editor.BaseItemWidget.TimeMsPaint { get; set; }PROTECTEDGETSET

Returns:float

protected float Editor.BaseItemWidget.timeMsRebuild { get; set; }PROTECTEDGETSET

Returns:float

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

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

Returns:bool

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