Widget

The widget base class.

Constructors

this
this(UiElement parent)

Construct the widget.

Members

Functions

getKeyboardFocus
string getKeyboardFocus()

Get if the widget can recieve focus during keyboard traversal.

getState
string[] getState()

Get the widget's state.

getStyle
string getStyle()

Get the widget's style.

grid
auto grid(int column, int row, int outerPadding, int innerPadding, int columnSpan, int rowSpan, string sticky)

Geometry method for placing this widget inside its parent using an imaginary grid. Somewhat more direct and intuitive than pack. Choose grid for tabular layouts, and when there's no good reason to choose something else.

inState
bool inState(string[] state)

Test if a widget is in a particular state.

pack
auto pack(int outerPadding, int innerPadding, string side, string fill, string anchor, bool expand)

Geometry method for loosely placing this widget inside its parent using a web browser model. Widgets flow around each other in the available space.

place
auto place(int xPos, int yPos, int width, int height, string anchor, string borderMode)

Geometry method for placing this widget inside its parent using absolute positioning.

place
auto place(double relativeXPos, double relativeYPos, double relativeWidth, double relativeHeight, string anchor, string borderMode)

Geometry method for placing this widget inside its parent using relative positioning. In this case the position and size is specified as a floating-point number between 0.0 and 1.0 relative to the height of the parent. 0.5 means the widget will be half as high as the parent and 1.0 means the widget will have the same height as the parent, and so on.

removeState
auto removeState(string[] state)

Remove the widget's state.

resetState
auto resetState()

Reset the widget's state to default.

setKeyboardFocus
auto setKeyboardFocus(string focus)

Set if the widget can recieve focus during keyboard traversal.

setState
auto setState(string[] state)

Set the widget's state.

setStyle
auto setStyle(string style)

Set the widget's style.

Inherited Members

From UiElement

getClass
string getClass()

Get the widget's class.

setCursor
auto setCursor(string cursor)

Set the widget's cursor.

getCursor
string getCursor()

Get the widget's cursor.

bind
auto bind(string binding, CommandCallback callback)

Bind a callback to a particular event triggered by this element.

unbind
auto unbind(string binding)

Unbind a previous event binding.

destroy
void destroy()

Destroy this element and remove it from the GUI.

getChildIds
string[] getChildIds()

Get the string id's of the immediate children elements.

getWidth
int getWidth()

Get the width of the element.

getHeight
int getHeight()

Get the height of the element.

hwnd
size_t hwnd [@property getter]

Get the platform specific window id. This is equal to the hwnd on Windows or the x11 window id on Linux.

getCursorPos
int[] getCursorPos()

Get the position of the cursor over the element. The cursor position returned is relative to the screen. It is only returned if the cursor is over the element.

getCursorXPos
int getCursorXPos()

Get the horizontal position of the cursor over the element. The cursor position returned is relative to the screen. It is only returned if the cursor is over the element.

getCursorYPos
int getCursorYPos()

Get the vertical position of the cursor over the element. The cursor position returned is relative to the screen. It is only returned if the cursor is over the element.

getScreenWidth
int getScreenWidth()

Get the width of the screen this element is displayed on.

getScreenHeight
int getScreenHeight()

Get the height of the screen this element is displayed on.

getXPos
int getXPos(bool relativeToParent)

Get the horizontal position of the element. The number returned is calculated using the top, left-most pixel of the element including border if one exists.

getYPos
int getYPos(bool relativeToParent)

Get the vertical position of the element. The number returned is calculated using the top, left-most pixel of the element including border if one exists.

enableGeometryAutoSize
auto enableGeometryAutoSize(bool enable)

Set if the element should change it size when requested to do so by a geometry manager.

configureGeometryColumn
auto configureGeometryColumn(int index, int weight, int minSize, int uniformGroup, int pad)

Used by the grid geometry manager. Sets options for grid columns that contain child widgets.

configureGeometryRow
auto configureGeometryRow(int index, int weight, int minSize, int uniformGroup, int pad)

Used by the grid geometry manager. Sets options for grid rows that contain child widgets.

setBusy
auto setBusy(bool busy, string cursor)

Provides a simple means to block keyboard, button, and pointer events from elements, while overriding the cursor with a configurable busy cursor.

isBusy
bool isBusy()

Gets if the element is busy or not.

generateEvent
void generateEvent(string event)

Generates an event and arranges for it to be processed just as if it had come from the operating system. Event provides a basic description of the event, such as <Shift-Button-2> or <<Paste>>. The event argument may have any of the forms allowed for the binding argument of the bind method except that it must consist of a single event pattern only. Certain events, such as key events, require that the window has focus to receive the event properly.

focus
auto focus(bool force)

Set the element to take focus so any key press or key release events for the application are sent to that element. It is also possible to force the operating system to apply focus to the element immediately.

setGrab
auto setGrab(bool enable, bool global)

This command implements simple pointer and keyboard grabs. When a grab is set for a particular element, it restricts all pointer events to the grab window and its descendants. Whenever the pointer is within the grab element, the pointer will behave exactly the same as if there had been no grab at all and all events will be reported in the normal fashion. When the pointer is outside the element, button presses, releases and mouse motion events are reported to the element, and element entry and exit events are ignored. The grab 'owns' the pointer: elements outside the grab will be visible on the screen but they will be insensitive until the grab is released. The tree of elements underneath the grab element can include windows, in which case all windows and their descendants will continue to receive mouse events during the grab.

isGrabbing
bool isGrabbing()

Gets if the element is currently grabbing all events or not.

lower
auto lower(UiElement element)

Lower a window's position in the stacking order.

raise
auto raise(UiElement element)

Raise a window's position in the stacking order.

See Also

Meta