Table of Contents

Class ListBox

Namespace
OmegaGUI.Render
Assembly
OmegaGUI.dll

List box control

public class ListBox : Control
Inheritance
ListBox
Inherited Members
Extension Methods

Constructors

ListBox(Dialog)

Create a new list box control

public ListBox(Dialog parent)

Parameters

parent Dialog

Fields

MainLayer

public const int MainLayer = 0

Field Value

int

SelectionLayer

public const int SelectionLayer = 1

Field Value

int

border

protected int border

Field Value

int

ctrlStyle

protected ListBoxStyle ctrlStyle

Field Value

ListBoxStyle

isDragging

protected bool isDragging

Field Value

bool

itemList

protected List<ListItem> itemList

Field Value

List<ListItem>

margin

protected int margin

Field Value

int

scrollWidth

protected int scrollWidth

Field Value

int

scrollbarControl

protected ScrollBar scrollbarControl

Field Value

ScrollBar

selectedIndex

protected int selectedIndex

Field Value

int

selectedStarted

protected int selectedStarted

Field Value

int

selectionRect

protected Rectangle selectionRect

Field Value

Rectangle

textHeight

protected int textHeight

Field Value

int

textRect

protected Rectangle textRect

Field Value

Rectangle

Properties

CanHaveFocus

Can this control have focus

public override bool CanHaveFocus { get; }

Property Value

bool

this[int]

Indexer for items in the list

public ListItem this[int index] { get; }

Parameters

index int

Property Value

ListItem

NumberItems

Number of items current in the list

public int NumberItems { get; }

Property Value

int

Style

Sets the style of the listbox

public ListBoxStyle Style { get; set; }

Property Value

ListBoxStyle

Methods

AddItem(string, string, object)

Adds an item to the list box control

public void AddItem(string text, string tag, object data)

Parameters

text string
tag string
data object

Clear()

Removes all items from the control

public void Clear()

GetSelectedIndex(int)

For single-selection listbox, returns the index of the selected item. For multi-selection, returns the first selected item after the previousSelected position. To search for the first selected item, the app passes -1 for previousSelected. For subsequent searches, the app passes the returned index back to GetSelectedIndex as. previousSelected. Returns -1 on error or if no item is selected.

public int GetSelectedIndex(int previousSelected)

Parameters

previousSelected int

Returns

int

GetSelectedItem()

Gets the selected item

public ListItem GetSelectedItem()

Returns

ListItem

GetSelectedItem(int)

Gets the selected item

public ListItem GetSelectedItem(int previousSelected)

Parameters

previousSelected int

Returns

ListItem

HandleKeyboard(WindowMessage, IntPtr, IntPtr)

Called when the control needs to handle the keyboard

public override bool HandleKeyboard(WindowMessage msg, IntPtr wParam, IntPtr lParam)

Parameters

msg WindowMessage
wParam IntPtr
lParam IntPtr

Returns

bool

HandleMouse(WindowMessage, Point, IntPtr, IntPtr)

Called when the control should handle the mouse

public override bool HandleMouse(WindowMessage msg, Point pt, IntPtr wParam, IntPtr lParam)

Parameters

msg WindowMessage
pt Point
wParam IntPtr
lParam IntPtr

Returns

bool

InsertItem(int, string, object)

Inserts an item to the list box control

public void InsertItem(int index, string text, object data)

Parameters

index int
text string
data object

OnInitialize()

Initialize the scrollbar control here

public override void OnInitialize()

RaiseDoubleClickEvent(ListBox, bool)

Raises the double click event

protected void RaiseDoubleClickEvent(ListBox sender, bool wasTriggeredByUser)

Parameters

sender ListBox
wasTriggeredByUser bool

RaiseSelectionEvent(ListBox, bool)

Raises the selection event

protected void RaiseSelectionEvent(ListBox sender, bool wasTriggeredByUser)

Parameters

sender ListBox
wasTriggeredByUser bool

RemoveAt(int)

Removes an item at a particular index

public void RemoveAt(int index)

Parameters

index int

Render(Device, float)

Called when the control should be rendered

public override void Render(Device device, float elapsedTime)

Parameters

device Device
elapsedTime float

SelectItem(int)

Selects this item

public void SelectItem(int newIndex)

Parameters

newIndex int

SetBorder(int, int)

Sets the border and margin sizes

public void SetBorder(int borderSize, int marginSize)

Parameters

borderSize int
marginSize int

SetScrollbarWidth(int)

Sets the scroll bar width of this control

public void SetScrollbarWidth(int width)

Parameters

width int

SetSelected(string)

Sets the selected item by text

public void SetSelected(string text)

Parameters

text string

UpdateRectangles()

Update the rectangles for the list box control

protected override void UpdateRectangles()

Events

DoubleClick

public event EventHandler DoubleClick

Event Type

EventHandler

Selection

public event EventHandler Selection

Event Type

EventHandler