TextWidget

static text widget

Constructors

this
this(string ID, string textResourceId)
Undocumented in source.
this
this(string ID, dstring rawText)
Undocumented in source.
this
this(string ID, UIString uitext)
Undocumented in source.

Members

Functions

measure
void measure(int parentWidth, int parentHeight)
Undocumented in source. Be warned that the author may not have intended to support it.
onDraw
void onDraw(DrawBuf buf)
Undocumented in source. Be warned that the author may not have intended to support it.

Properties

maxLines
int maxLines [@property getter]

max lines to show

maxLines
int maxLines [@property setter]

set max lines to show

text
dstring text [@property getter]

get widget text

text
dstring text [@property setter]

set text to show

text
UIString text [@property setter]

set text to show

textResource
string textResource [@property setter]

set text resource ID to show

Variables

_text
UIString _text;
Undocumented in source.

Inherited Members

From Widget

_id
string _id;

widget id

_pos
Rect _pos;

current widget position, set by layout()

_visibility
Visibility _visibility;

widget visibility: either Visible, Invisible, Gone

_styleId
string _styleId;

style id to lookup style in theme

_ownStyle
Style _ownStyle;

own copy of style - to override some of style properties, null of no properties overriden

_state
uint _state;

widget state (set of flags from State enum)

_measuredWidth
int _measuredWidth;

width measured by measure()

_measuredHeight
int _measuredHeight;

height measured by measure()

_needLayout
bool _needLayout;

true to force layout

_needDraw
bool _needDraw;

true to force redraw

_parent
Widget _parent;

parent widget

_window
Window _window;

window (to be used for top level widgets only!)

_trackHover
bool _trackHover;

does widget need to track mouse Hover

trackHover
bool trackHover [@property getter]

mouse movement processing flag (when true, widget will change Hover state while mouse is moving)

trackHover
bool trackHover [@property setter]

set new trackHover flag value (when true, widget will change Hover state while mouse is moving)

getCursorType
uint getCursorType(int x, int y)

returns mouse cursor type for widget

instanceCount
int instanceCount [@property getter]

for debug purposes - number of created widget objects, not yet destroyed

~this
~this()
Undocumented in source.
style
const(Style) style [@property getter]

accessor to style - by lookup in theme by styleId (if style id is not set, theme base style will be used).

style
uint style [@property setter]

accessor to style - by lookup in theme by styleId (if style id is not set, theme base style will be used).

stateStyle
const(Style) stateStyle [@property getter]

returns style for current widget state

ownStyle
Style ownStyle [@property getter]

enforces widget's own style - allows override some of style properties

onThemeChanged
void onThemeChanged()

handle theme change: e.g. reload some themed resources

id
string id [@property getter]

returns widget id, null if not set

id
string id [@property setter]

set widget id

compareId
bool compareId(string id)

compare widget id with specified value, returs true if matches

state
uint state [@property getter]

widget state (set of flags from State enum)

handleFocusChange
void handleFocusChange(bool focused, bool receivedFocusFromKeyboard)

override to handle focus changes

handleCheckChange
void handleCheckChange(bool checked)

override to handle check changes

state
uint state [@property setter]

set new widget state (set of flags from State enum)

setState
uint setState [@property setter]

add state flags (set of flags from State enum)

resetState
uint resetState [@property setter]

remove state flags (set of flags from State enum)

styleId
string styleId [@property getter]

returns widget style id, null if not set

styleId
string styleId [@property setter]

set widget style id

margins
Rect margins [@property getter]

get margins (between widget bounds and its background)

margins
Rect margins [@property setter]

set margins for widget - override one from style

margins
int margins [@property setter]

set margins for widget with the same value for left, top, right, bottom - override one from style

FOCUS_RECT_PADDING
enum FOCUS_RECT_PADDING;
Undocumented in source.
padding
Rect padding [@property getter]

get padding (between background bounds and content of widget)

padding
Rect padding [@property setter]

set padding for widget - override one from style

padding
int padding [@property setter]

set padding for widget to the same value for left, top, right, bottom - override one from style

backgroundColor
uint backgroundColor [@property getter]

returns background color

backgroundColor
uint backgroundColor [@property setter]

set background color for widget - override one from style

backgroundColor
string backgroundColor [@property setter]

set background color for widget - from string like "#5599CC" or "white"

backgroundImageId
string backgroundImageId [@property getter]

background image id

backgroundImageId
string backgroundImageId [@property setter]

background image id

focusRectColors
const(uint[]) focusRectColors [@property getter]

returns colors to draw focus rectangle (one for solid, two for vertical gradient) or null if no focus rect should be drawn for style

_backgroundDrawable
DrawableRef _backgroundDrawable;
Undocumented in source.
backgroundDrawable
DrawableRef backgroundDrawable [@property getter]

background drawable

backgroundDrawable
DrawableRef backgroundDrawable [@property setter]

background drawable

alpha
uint alpha [@property getter]

widget drawing alpha value (0=opaque .. 255=transparent)

alpha
uint alpha [@property setter]

set widget drawing alpha value (0=opaque .. 255=transparent)

textColor
uint textColor [@property getter]

get text color (ARGB 32 bit value)

textColor
uint textColor [@property setter]

set text color (ARGB 32 bit value)

textColor
string textColor [@property setter]

set text color for widget - from string like "#5599CC" or "white"

textFlags
uint textFlags [@property getter]

get text flags (bit set of TextFlag enum values)

textFlags
uint textFlags [@property setter]

set text flags (bit set of TextFlag enum values)

fontFace
string fontFace [@property getter]

returns font face

fontFace
string fontFace [@property setter]

set font face for widget - override one from style

fontItalic
bool fontItalic [@property getter]

returns font style (italic/normal)

fontItalic
bool fontItalic [@property setter]

set font style (italic/normal) for widget - override one from style

fontWeight
ushort fontWeight [@property getter]

returns font weight

fontWeight
int fontWeight [@property setter]

set font weight for widget - override one from style

fontSize
int fontSize [@property getter]

returns font size in pixels

fontSize
int fontSize [@property setter]

set font size for widget - override one from style

fontFamily
FontFamily fontFamily [@property getter]

returns font family

fontFamily
FontFamily fontFamily [@property setter]

set font family for widget - override one from style

alignment
ubyte alignment [@property getter]

returns alignment (combined vertical and horizontal)

alignment
ubyte alignment [@property setter]

sets alignment (combined vertical and horizontal)

valign
Align valign [@property getter]

returns horizontal alignment

halign
Align halign [@property getter]

returns vertical alignment

font
FontRef font [@property getter]

returns font set for widget using style or set manually

text
dstring text [@property getter]

returns widget content text (override to support this)

text
dstring text [@property setter]

sets widget content text (override to support this)

text
UIString text [@property setter]

sets widget content text (override to support this)

handleFontChanged
void handleFontChanged()

override to handle font changes

needLayout
bool needLayout [@property getter]

returns true if layout is required for widget and its children

needDraw
bool needDraw [@property getter]

returns true if redraw is required for widget and its children

animating
bool animating [@property getter]

returns true is widget is being animated - need to call animate() and redraw

animate
void animate(long interval)

animates window; interval is time left from previous draw, in hnsecs (1/10000000 of second)

measuredWidth
measuredWidth [@property getter]

returns measured width (calculated during measure() call)

measuredHeight
measuredHeight [@property getter]

returns measured height (calculated during measure() call)

width
int width [@property getter]

returns current width of widget in pixels

height
int height [@property getter]

returns current height of widget in pixels

top
int top [@property getter]

returns widget rectangle top position

left
int left [@property getter]

returns widget rectangle left position

pos
Rect pos [@property getter]

returns widget rectangle

minWidth
int minWidth [@property getter]

returns min width constraint

maxWidth
int maxWidth [@property getter]

returns max width constraint (SIZE_UNSPECIFIED if no constraint set)

minHeight
int minHeight [@property getter]

returns min height constraint

maxHeight
int maxHeight [@property getter]

returns max height constraint (SIZE_UNSPECIFIED if no constraint set)

maxWidth
int maxWidth [@property setter]

set max width constraint (SIZE_UNSPECIFIED for no constraint)

minWidth
int minWidth [@property setter]

set max width constraint (0 for no constraint)

maxHeight
int maxHeight [@property setter]

set max height constraint (SIZE_UNSPECIFIED for no constraint)

minHeight
int minHeight [@property setter]

set max height constraint (0 for no constraint)

layoutWidth
int layoutWidth [@property getter]

returns layout width options (WRAP_CONTENT, FILL_PARENT, some constant value or percent but only for one widget in layout)

layoutHeight
int layoutHeight [@property getter]

returns layout height options (WRAP_CONTENT, FILL_PARENT, some constant value or percent but only for one widget in layout)

layoutWeight
int layoutWeight [@property getter]

returns layout weight (while resizing to fill parent, widget will be resized proportionally to this value)

layoutWidth
int layoutWidth [@property setter]

sets layout width options (WRAP_CONTENT, FILL_PARENT, or some constant value)

layoutHeight
int layoutHeight [@property setter]

sets layout height options (WRAP_CONTENT, FILL_PARENT, or some constant value)

layoutWeight
int layoutWeight [@property setter]

sets layout weight (while resizing to fill parent, widget will be resized proportionally to this value)

fillParent
Widget fillParent()

sets layoutWidth=FILL_PARENT and layoutHeight=FILL_PARENT

fillHorizontal
Widget fillHorizontal()

sets layoutWidth=FILL_PARENT

fillVertical
Widget fillVertical()

sets layoutHeight=FILL_PARENT

visibility
Visibility visibility [@property getter]

returns widget visibility (Visible, Invisible, Gone)

visibility
Visibility visibility [@property setter]

sets widget visibility (Visible, Invisible, Gone)

isPointInside
bool isPointInside(int x, int y)

returns true if point is inside of this widget

enabled
bool enabled [@property getter]

return true if state has State.Enabled flag set

enabled
bool enabled [@property setter]

change enabled state

_clickable
bool _clickable;
Undocumented in source.
clickable
bool clickable [@property getter]

when true, user can click this control, and get onClick listeners called

clickable
bool clickable [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
canClick
bool canClick [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
_checkable
bool _checkable;
Undocumented in source.
checkable
bool checkable [@property getter]

when true, control supports Checked state

checkable
bool checkable [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
canCheck
bool canCheck [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
_checked
bool _checked;
Undocumented in source.
checked
bool checked [@property getter]

get checked state

checked
bool checked [@property setter]

set checked state

_focusable
bool _focusable;
Undocumented in source.
focusable
bool focusable [@property getter]

whether widget can be focused

focusable
bool focusable [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
focused
bool focused [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
wantsKeyTracking
bool wantsKeyTracking [@property getter]

override and return true to track key events even when not focused

_action
Action _action;
Undocumented in source.
action
const(Action) action [@property getter]

action to emit on click

action
Action action [@property setter]

action to emit on click

action
Action action [@property setter]

action to emit on click

updateActionState
bool updateActionState(Action a, bool force, bool allowDefault)

ask for update state of some action (unles force=true, checks window flag actionsUpdateRequested), returns true if action state is changed

updateActionState
void updateActionState(bool force)

call to update state for action (if action is assigned for widget)

handleActionStateChanged
void handleActionStateChanged()

called when state of action assigned on widget is changed

updateStateFromAction
void updateStateFromAction(Action a)

apply enabled, visibile and checked state for this widget from action's state

requestActionsUpdate
void requestActionsUpdate(bool immediateUpdate)

set action update request flag, will be cleared after redraw

_tooltipText
UIString _tooltipText;
Undocumented in source.
tooltipText
dstring tooltipText [@property getter]

tooltip text - when not empty, widget will show tooltips automatically; for advanced tooltips - override hasTooltip and createTooltip

tooltipText
dstring tooltipText [@property setter]

tooltip text - when not empty, widget will show tooltips automatically; for advanced tooltips - override hasTooltip and createTooltip

tooltipText
UIString tooltipText [@property setter]

tooltip text - when not empty, widget will show tooltips automatically; for advanced tooltips - override hasTooltip and createTooltip

hasTooltip
bool hasTooltip [@property getter]

returns true if widget has tooltip to show

createTooltip
Widget createTooltip(int mouseX, int mouseY, uint alignment, int x, int y)

will be called from window once tooltip request timer expired; if null is returned, popup will not be shown; you can change alignment and position of popup here

scheduleTooltip
void scheduleTooltip(long delay, uint alignment, int x, int y)

schedule tooltip

_focusGroup
bool _focusGroup;
Undocumented in source.
focusGroup
bool focusGroup [@property getter]

When focus group is set for some parent widget, focus from one of containing widgets can be moved using keyboard only to one of other widgets containing in it and cannot bypass bounds of focusGroup.

focusGroup
bool focusGroup [@property setter]

set focus group flag for container widget

focusGroupFocused
bool focusGroupFocused [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
setWindowFocusedFlag
bool setWindowFocusedFlag(bool flg)
Undocumented in source. Be warned that the author may not have intended to support it.
focusGroupFocused
bool focusGroupFocused [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
focusGroupWidget
Widget focusGroupWidget()

find nearest parent of this widget with focusGroup flag, returns topmost parent if no focusGroup flag set to any of parents.

_tabOrder
ushort _tabOrder;
Undocumented in source.
tabOrder
ushort tabOrder [@property getter]

tab order - hint for focus movement using Tab/Shift+Tab

tabOrder
ushort tabOrder [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
handleMoveFocusUsingKeys
bool handleMoveFocusUsingKeys(KeyEvent event)
Undocumented in source. Be warned that the author may not have intended to support it.
visible
bool visible [@property getter]

returns true if this widget and all its parents are visible

canFocus
bool canFocus [@property getter]

returns true if widget is focusable and visible and enabled

setFocus
Widget setFocus(FocusReason reason)

sets focus to this widget or suitable focusable child, returns previously focused widget

findFocusableChild
Widget findFocusableChild(bool defaultOnly)

searches children for first focusable item, returns null if not found

hideSoftKeyboard
void hideSoftKeyboard()
showSoftKeyboard
void showSoftKeyboard()

Shows system virtual keyabord where applicable

_acceleratorMap
ActionMap _acceleratorMap;
Undocumented in source.
acceleratorMap
ActionMap acceleratorMap [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
handleAction
bool handleAction(Action a)

override to handle specific actions

handleActionStateRequest
bool handleActionStateRequest(Action a)

override to handle specific actions state (e.g. change enabled state for supported actions)

dispatchAction
bool dispatchAction(Action a)

call to dispatch action

handleClick
bool handleClick()
Undocumented in source. Be warned that the author may not have intended to support it.
cancelLayout
void cancelLayout()
Undocumented in source. Be warned that the author may not have intended to support it.
setTimer
ulong setTimer(long intervalMillis)

set new timer to call onTimer() after specified interval (for recurred notifications, return true from onTimer)

cancelTimer
void cancelTimer(ulong timerId)

cancel timer - pass value returned from setTimer() as timerId parameter

onTimer
bool onTimer(ulong id)

handle timer; return true to repeat timer event after next interval, false cancel timer

findKeyAction
Action findKeyAction(uint keyCode, uint flags)

map key to action

onKeyEvent
bool onKeyEvent(KeyEvent event)

process key event, return true if event is processed.

onEvent
bool onEvent(CustomEvent event)

handle custom event

executeInUiThread
void executeInUiThread(void delegate() runnable)

execute delegate later in UI thread if this widget will be still available (can be used to modify UI from background thread, or just to postpone execution of action)

onMouseEvent
bool onMouseEvent(MouseEvent event)

process mouse event; return true if event is processed by widget.

click
Signal!OnClickHandler click;

on click event listener (bool delegate(Widget))

checkChange
Signal!OnCheckHandler checkChange;

checked state change event listener (bool delegate(Widget, bool))

focusChange
Signal!OnFocusHandler focusChange;

focus state change event listener (bool delegate(Widget, bool))

keyEvent
Signal!OnKeyHandler keyEvent;

key event listener (bool delegate(Widget, KeyEvent)) - return true if event is processed by handler

keyToAction
Listener!OnKeyActionHandler keyToAction;

action by key lookup handler

onAction
Signal!OnActionHandler onAction;

action handlers

mouseEvent
Signal!OnMouseHandler mouseEvent;

mouse event listener (bool delegate(Widget, MouseEvent)) - return true if event is processed by handler

addOnClickListener
Widget addOnClickListener(bool delegate(Widget) listener)

helper function to add onCheckChangeListener in method chain

addOnCheckChangeListener
Widget addOnCheckChangeListener(bool delegate(Widget, bool) listener)

helper function to add onCheckChangeListener in method chain

addOnFocusChangeListener
Widget addOnFocusChangeListener(bool delegate(Widget, bool) listener)

helper function to add onFocusChangeListener in method chain

requestLayout
void requestLayout()

request relayout of widget and its children

invalidate
void invalidate()

request redraw

measuredContent
void measuredContent(int parentWidth, int parentHeight, int contentWidth, int contentHeight)

helper function for implement measure() when widget's content dimensions are known

measure
void measure(int parentWidth, int parentHeight)

Measure widget according to desired width and height constraints. (Step 1 of two phase layout).

layout
void layout(Rect rc)

Set widget rectangle to specified value and layout widget contents. (Step 2 of two phase layout).

drawFocusRect
void drawFocusRect(DrawBuf buf, Rect rc)

draws focus rectangle, if enabled in styles

onDraw
void onDraw(DrawBuf buf)

Draw widget at its position to buffer

applyMargins
void applyMargins(Rect rc)

Helper function: applies margins to rectangle

applyPadding
void applyPadding(Rect rc)

Helper function: applies padding to rectangle

applyAlign
void applyAlign(Rect rc, Point sz, Align ha, Align va)

Applies alignment for content of size sz - set rectangle rc to aligned value of content inside of initial value of rc.

applyAlign
void applyAlign(Rect rc, Point sz)

Applies alignment for content of size sz - set rectangle rc to aligned value of content inside of initial value of rc.

onMenuItemAction
bool onMenuItemAction(Action action)
Undocumented in source. Be warned that the author may not have intended to support it.
_popupMenu
MenuItem _popupMenu;
Undocumented in source.
popupMenu
MenuItem popupMenu [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
popupMenu
MenuItem popupMenu [@property setter]
Undocumented in source. Be warned that the author may not have intended to support it.
canShowPopupMenu
bool canShowPopupMenu(int x, int y)

returns true if widget can show popup menu (e.g. by mouse right click at point x,y)

showPopupMenu
void showPopupMenu(int x, int y)

shows popup menu at (x,y)

isActionEnabled
bool isActionEnabled(Action action)

override to change popup menu items state

childCount
int childCount [@property getter]

returns number of children of this widget

child
inout(Widget) child(int index)

returns child by index

addChild
Widget addChild(Widget item)

adds child, returns added item

addChildren
Widget addChildren(Widget[] items)

adds child, returns added item

insertChild
Widget insertChild(Widget item, int index)

inserts child at given index, returns inserted item

removeChild
Widget removeChild(int index)

removes child, returns removed item

removeChild
Widget removeChild(string id)

removes child by ID, returns removed item

removeChild
Widget removeChild(Widget child)

removes child, returns removed item

childIndex
int childIndex(Widget item)

returns index of widget in child list, -1 if passed widget is not a child of this widget

isChild
bool isChild(Widget item, bool deepSearch)

returns true if item is child of this widget (when deepSearch == true - returns true if item is this widget or one of children inside children tree).

childById
T childById(string id, bool deepSearch)

find child of specified type T by id, returns null if not found or cannot be converted to type T

parent
Widget parent [@property getter]

returns parent widget, null for top level widget

parent
Widget parent [@property setter]

sets parent for widget

window
Window window [@property getter]

returns window (if widget or its parent is attached to window)

window
Window window [@property setter]

sets window (to be used for top level widget from Window implementation). TODO: hide it from API?

removeAllChildren
void removeAllChildren(bool destroyObj)
Undocumented in source. Be warned that the author may not have intended to support it.
setStringProperty
bool setStringProperty(string name, string value)

set string property value, for ML loaders

setDstringProperty
bool setDstringProperty(string name, dstring value)

set string property value, for ML loaders

setUistringProperty
bool setUistringProperty(string name, UIString value)

set string property value, for ML loaders

setStringListValueListProperty
bool setStringListValueListProperty(string propName, StringListValue[] values)

StringListValue list values

setUIStringListProperty
bool setUIStringListProperty(string propName, UIString[] values)

UIString list values

setBoolProperty
bool setBoolProperty(string name, bool value)

set string property value, for ML loaders

setDoubleProperty
bool setDoubleProperty(string name, double value)

set double property value, for ML loaders

setIntProperty
bool setIntProperty(string name, int value)

set int property value, for ML loaders

setRectProperty
bool setRectProperty(string name, Rect value)

set Rect property value, for ML loaders

Meta