ListView

Implements a basic ListView

class ListView : WindowElement , ElementContainer, TextInputListener {}

Constructors

this
this(ListViewHeader header, ListViewItem[] entries, string source, Box position)

Creates an instance of a ListView with the supplied parameters.

Members

Classes

DrawParameters
class DrawParameters

Supplies draw parameters to the items

Functions

addPopUpElement
void addPopUpElement(PopUpElement p)

Puts a PopUpElement on the GUI.

addPopUpElement
void addPopUpElement(PopUpElement p, int x, int y)

Puts a PopUpElement on the GUI at the given position.

bitBLT
void bitBLT(Point target, ABitmap source)

Pastes a bitmap to the given point using blitter, which threats color #0 as transparency.

bitBLT
void bitBLT(Point target, ABitmap source, Box slice)

Pastes a slice of a bitmap to the given point using blitter, which threats color #0 as transparency.

bitBLTPattern
void bitBLTPattern(Box target, ABitmap pattern)

Pastes a repeated bitmap pattern over the specified area.

clear
void clear()

Removes all entries in the list.

clearArea
void clearArea(Box target)

Clears the area within the target

closePopUp
void closePopUp(PopUpElement p)

Closes a single popup element.

draw
void draw()
Undocumented in source. Be warned that the author may not have intended to support it.
drawBox
void drawBox(Box target, ubyte color)

Draws an empty rectangle.

drawBoxPattern
void drawBoxPattern(Box target, ubyte[] pattern)

Draws an empty rectangle with line patterns.

drawFilledBox
void drawFilledBox(Box target, ubyte color)

Draws a filled rectangle with a specified color.

drawLine
void drawLine(Point from, Point to, ubyte color)

Draws a line.

drawLinePattern
void drawLinePattern(Point from, Point to, ubyte[] pattern)

Draws a line pattern.

drawTextML
void drawTextML(Box target, Text text, Point offset)

Draws a multi line text within the given prelimiter.

drawTextSL
void drawTextSL(Box target, Text text, Point offset)

Draws a single line text within the given prelimiter.

dropTextInput
void dropTextInput()

When called, the listener should drop all text input.

endPopUpSession
void endPopUpSession(PopUpElement p)

Ends the popup session and closes all popups.

fill
void fill(Point target, ubyte color, ubyte background)

Fills an area with the specified color.

getAbsolutePosition
Box getAbsolutePosition(WindowElement sender)

Returns the absolute position of the element.

getRasterSizes
int[2] getRasterSizes()
Undocumented in source. Be warned that the author may not have intended to support it.
initTextInput
void initTextInput()

Called if text input should be initialized.

insertAt
ListViewItem insertAt(size_t index, ListViewItem item)

Inserts an element at the given index.

moveEntry
void moveEntry(size_t index, size_t target)

Moves the entry to the given position.

opIndex
ListViewItem opIndex(size_t index)

Accesses data entries in a safe manner.

opIndexAssign
ListViewItem opIndexAssign(ListViewItem value, size_t index)

Accesses data entries in a safe manner.

opOpAssign
ListViewItem opOpAssign(ListViewItem value)

Allows to append a single element to the entry list.

opOpAssign
ListViewItem[] opOpAssign(ListViewItem[] value)

Allows to append multiple elements to the entry list.

passMCE
void passMCE(MouseEventCommons mec, MouseClickEvent mce)

Passes mouse click event

passMME
void passMME(MouseEventCommons mec, MouseMotionEvent mme)

Passes mouse move event

passMWE
void passMWE(MouseEventCommons mec, MouseWheelEvent mwe)

Passes mouse scroll event

recalculateTotalSizes
void recalculateTotalSizes()

Recalculates the total width and height of the list view's field, also generates scrollbars if needed.

refresh
void refresh()

Refreshes the list view. Must be called every time when adding new items is finished.

removeEntry
ListViewItem removeEntry(size_t index)

Removes an item from the entries. Returns the removed entry.

requestCursor
void requestCursor(CursorType type)

Sets the cursor to the given type on request.

requestFocus
void requestFocus(WindowElement sender)

Gives focus to the element if applicable

scroll
int[2] scroll()

Returns the current x and y scroll positions.

scroll
int[2] scroll(int[2] pos)

Sets the scrolling to pos, then returns the new scrolling positions.

scrollBarEventOut
void scrollBarEventOut(Event ev)
Undocumented in source. Be warned that the author may not have intended to support it.
setHeader
void setHeader(ListViewHeader header, ListViewItem[] entries)

Sets a new header, also able to supply new entries.

textEditingEvent
void textEditingEvent(uint timestamp, uint windowID, dstring text, int start, int length)

Passes text editing events to the target, alongside with a window ID and a timestamp.

textInputEvent
void textInputEvent(uint timestamp, uint windowID, dstring text)

Passes the inputted text to the target, alongside with a window ID and a timestamp.

textInputKeyEvent
void textInputKeyEvent(uint timestamp, uint windowID, TextInputKey key, ushort modifier)

Passes text input key events to the target, e.g. cursor keys.

xorBitBLT
void xorBitBLT(Box target, ABitmap pattern)

XOR blits a repeated bitmap pattern over the specified area.

xorBitBLT
void xorBitBLT(Box target, ubyte color)

XOR blits a color index over a specified area.

Properties

editEnable
bool editEnable [@property setter]

Enables or disables the text editing of this element.

editEnable
bool editEnable [@property getter]

Returns true if text editing is enabled.

multicellEditEnable
bool multicellEditEnable [@property setter]

Enables or disables editing for multiple cells. If disabled, the first cell with editing enabled will be able to be edited.

multicellEditEnable
bool multicellEditEnable [@property getter]

Returns true if text editing for multiple cells is enabled.

numEntries
size_t numEntries [@property getter]

Returns the numfer of entries the ListView has.

selectedElement
ListViewItem selectedElement [@property getter]

Returns the currently selected element, or null if none is selected.

value
int value [@property getter]

Returns the number of the selected item, or minus one if nothing is selected.

value
int value [@property setter]

Sets the selected item and then does a redraw. -1 sets selection to none.

Static variables

EDIT_EN
enum EDIT_EN;
Undocumented in source.
INSERT
enum INSERT;
Undocumented in source.
MULTICELL_EDIT_EN
enum MULTICELL_EDIT_EN;
Undocumented in source.
TEXTINPUT_EN
enum TEXTINPUT_EN;
Undocumented in source.

Variables

_header
ListViewHeader _header;

The header of the ListView. Accessed in a safe manner to ensure it's being updated on the output raster.

cursorPos
int cursorPos;

Position of cursor.

drawParams
DrawParameters drawParams;

Holds shared draw parameters that are used when the element is being drawn. Should be set to null otherwise.

entries
ListViewItem[] entries;

Entries in the ListView. Accessed in a safe manner to ensure it's being updated on the output raster and that the number of columns match.

filter
InputFilter filter;

Filters the input to the cell if not null.

hScrollSpeed
int hScrollSpeed;

Horizontal scrolling speed.

hSelection
int hSelection;

Horizontal selection for text editing.

horizSlider
HorizScrollBar horizSlider;

Horizontal scroll bar.

horizTextOffset
int horizTextOffset;

Horizontal text offset if text cannot fit the cell.

onItemSelect
EventDeleg onItemSelect;

Called when an item is selected

onTextInput
EventDeleg onTextInput;

Called when text input is finished and accepted Event value is CellEditEvent

selection
int selection;

Selected item's number, or -1 if none selected.

textArea
Box textArea;

Text editing area.

tselect
int tselect;

Lenght of selected characters.

vScrollSpeed
int vScrollSpeed;

Vertical scrolling speed.

vertSlider
VertScrollBar vertSlider;

Vertical scroll bar.

Inherited Members

From WindowElement

inputHandler
InputHandler inputHandler;

Common input handler, must be set upon program initialization for text input, etc.

position
Box position;

Contains the position of the element. Should be only modified with functions to ensure consistency.

parent
ElementContainer parent;

Points to the container for two-way communication

text
Text text;

Contains the text of the element if any. Should be modified with functions to ensure redraws.

source
string source;

Passed with other event informations when event is caused. Can be something like the name of the instance.

flags
uint flags;

Contains various status flags.

ENABLE_MOUSE_PRESS
enum ENABLE_MOUSE_PRESS;
Undocumented in source.
IS_CLICKED
enum IS_CLICKED;
Undocumented in source.
ENABLE_RCLICK_FLAG
enum ENABLE_RCLICK_FLAG;
Undocumented in source.
IS_PRESSED
enum IS_PRESSED;
Undocumented in source.
IS_CHECKED
enum IS_CHECKED;
Undocumented in source.
IS_FOCUSED
enum IS_FOCUSED;
Undocumented in source.
IS_LHS
enum IS_LHS;
Undocumented in source.
customStyle
StyleSheet customStyle;

Sets a custom style for this element. If not set, then it'll get the style from it's parent.

onDraw
void delegate() onDraw;

Called when drawing is finished

onMouseLClick
EventDeleg onMouseLClick;

Called on left mouseclick released

onMouseRClick
EventDeleg onMouseRClick;

Called on right mouseclick released

onMouseMClick
EventDeleg onMouseMClick;

Called on middle mouseclick released

onMouseMove
EventDeleg onMouseMove;

Called if mouse is moved on object

onMouseScroll
EventDeleg onMouseScroll;

Called if mouse is scrolled on object

lastMousePosition
MouseMotionEvent lastMousePosition;

Stores the last known mouse position for future reference

getText
Text getText()

Returns the text of this element.

setText
void setText(Text s)
Undocumented in source. Be warned that the author may not have intended to support it.
setText
void setText(dstring s)
Undocumented in source. Be warned that the author may not have intended to support it.
state
ElementState state [@property setter]

Sets whether the element is enabled or not.

state
ElementState state [@property getter]

Returns whether the element is enabled or not.

setParent
void setParent(ElementContainer parent)
Undocumented in source. Be warned that the author may not have intended to support it.
draw
void draw()

Updates the output. Every subclass must override it.

getPosition
Box getPosition()
Undocumented in source. Be warned that the author may not have intended to support it.
setPosition
Box setPosition(Box position)
Undocumented in source. Be warned that the author may not have intended to support it.
getSource
string getSource [@property getter]

Returns the source string.

mousePressEvent
bool mousePressEvent [@property getter]

Returns true if the element will generate events on mouse press and mouse release. By default, only release is used.

mousePressEvent
bool mousePressEvent [@property setter]

Returns true if the element will generate events on mouse press and mouse release. By default, only release is used.

getStyleSheet
StyleSheet getStyleSheet()

Returns the next available StyleSheet.

focusGiven
void focusGiven()

Called when an object receives focus.

focusTaken
void focusTaken()

Called when an object loses focus.

cycleFocus
int cycleFocus(int direction)

Cycles the focus on a single element. Returns -1 if end is reached, or the number of remaining elements that are cycleable in the direction.

passKey
void passKey(uint keyCode, ubyte mod)

Passes key events to the focused element when not in text editing mode.

isFocused
bool isFocused [@property getter]

Returns whether the element is focused

isPressed
bool isPressed [@property getter]

Returns whether the element is pressed

isChecked
bool isChecked [@property getter]

Returns whether the element is checked

isChecked
bool isChecked [@property setter]

Sets whether the element is checked

passMCE
void passMCE(MouseEventCommons mec, MouseClickEvent mce)
Undocumented in source. Be warned that the author may not have intended to support it.
passMME
void passMME(MouseEventCommons mec, MouseMotionEvent mme)
Undocumented in source. Be warned that the author may not have intended to support it.
passMWE
void passMWE(MouseEventCommons mec, MouseWheelEvent mwe)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta