TextBox

Fancy text box with builtin regular expression-based validation.

Remark: This class overrides nanogui.Widget.mIconExtraScale to be 0.8f, which affects all subclasses of this Widget. Subclasses must explicitly set a different value if needed (e.g., in their constructor).

class TextBox : Widget {}

Constructors

this
this(Widget parent, string value)
Undocumented in source.

Members

Enums

Alignment
enum Alignment

How to align the text in the text box.

SpinArea
enum SpinArea

The location (if any) for the spin area.

Functions

alignment
Alignment alignment()
Undocumented in source. Be warned that the author may not have intended to support it.
alignment
void alignment(Alignment al)
Undocumented in source. Be warned that the author may not have intended to support it.
callback
bool delegate(string str) callback()

The callback to execute when the value of this TextBox has changed.

callback
void callback(bool delegate(string str) callback)

Sets the callback to execute when the value of this TextBox has changed.

checkFormat
bool checkFormat(string input, string format)
Undocumented in source. Be warned that the author may not have intended to support it.
copySelection
bool copySelection()
Undocumented in source. Be warned that the author may not have intended to support it.
cursor
void cursor(Cursor value)
Undocumented in source. Be warned that the author may not have intended to support it.
cursorIndex2Position
float cursorIndex2Position(int index, float lastx, const(NVGGlyphPosition)[] glyphs)
Undocumented in source. Be warned that the author may not have intended to support it.
defaultValue
string defaultValue()
Undocumented in source. Be warned that the author may not have intended to support it.
defaultValue
void defaultValue(string defaultValue)
Undocumented in source. Be warned that the author may not have intended to support it.
deleteSelection
bool deleteSelection()
Undocumented in source. Be warned that the author may not have intended to support it.
draw
void draw(NanoContext ctx)
Undocumented in source. Be warned that the author may not have intended to support it.
editable
bool editable()
Undocumented in source. Be warned that the author may not have intended to support it.
editable
void editable(bool editable)
Undocumented in source. Be warned that the author may not have intended to support it.
focusEvent
bool focusEvent(bool focused)
Undocumented in source. Be warned that the author may not have intended to support it.
format
string format()

Return the underlying regular expression specifying valid formats

format
void format(string format)

Specify a regular expression specifying valid formats

keyboardCharacterEvent
bool keyboardCharacterEvent(dchar codepoint)
Undocumented in source. Be warned that the author may not have intended to support it.
keyboardEvent
bool keyboardEvent(int key, int scancode, KeyAction action, int modifiers)
Undocumented in source. Be warned that the author may not have intended to support it.
mouseButtonEvent
bool mouseButtonEvent(Vector2i p, MouseButton button, bool down, int modifiers)
Undocumented in source. Be warned that the author may not have intended to support it.
mouseDragEvent
bool mouseDragEvent(Vector2i p, Vector2i rel, MouseButton button, int modifiers)
Undocumented in source. Be warned that the author may not have intended to support it.
mouseMotionEvent
bool mouseMotionEvent(Vector2i p, Vector2i rel, MouseButton button, int modifiers)
Undocumented in source. Be warned that the author may not have intended to support it.
pasteFromClipboard
void pasteFromClipboard()
Undocumented in source. Be warned that the author may not have intended to support it.
placeholder
string placeholder()

Return the placeholder text to be displayed while the text box is empty.

placeholder
void placeholder(string placeholder)

Specify a placeholder text to be displayed while the text box is empty.

position2CursorIndex
int position2CursorIndex(float posx, float lastx, const(NVGGlyphPosition)[] glyphs)
Undocumented in source. Be warned that the author may not have intended to support it.
preferredSize
Vector2i preferredSize(NanoContext ctx)
Undocumented in source. Be warned that the author may not have intended to support it.
spinArea
SpinArea spinArea(Vector2i pos)
Undocumented in source. Be warned that the author may not have intended to support it.
spinnable
bool spinnable()
Undocumented in source. Be warned that the author may not have intended to support it.
spinnable
void spinnable(bool spinnable)
Undocumented in source. Be warned that the author may not have intended to support it.
theme
void theme(Theme theme)

Set the Theme used to draw this widget

units
string units()
Undocumented in source. Be warned that the author may not have intended to support it.
units
void units(string units)
Undocumented in source. Be warned that the author may not have intended to support it.
unitsImage
auto unitsImage()
Undocumented in source. Be warned that the author may not have intended to support it.
unitsImage
void unitsImage(NVGImage image)
Undocumented in source. Be warned that the author may not have intended to support it.
updateCursor
void updateCursor(NanoContext ctx, float lastx, const(NVGGlyphPosition)[] glyphs)
Undocumented in source. Be warned that the author may not have intended to support it.
value
string value()
Undocumented in source. Be warned that the author may not have intended to support it.
value
void value(string value)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

mAlignment
Alignment mAlignment;
Undocumented in source.
mCallback
bool delegate(string str) mCallback;
Undocumented in source.
mCommitted
bool mCommitted;
Undocumented in source.
mCursorPos
int mCursorPos;
Undocumented in source.
mDefaultValue
string mDefaultValue;
Undocumented in source.
mEditable
bool mEditable;
Undocumented in source.
mFormat
string mFormat;
Undocumented in source.
mLastClick
double mLastClick;
Undocumented in source.
mMouseDownModifier
int mMouseDownModifier;
Undocumented in source.
mMouseDownPos
Vector2i mMouseDownPos;
Undocumented in source.
mMouseDragPos
Vector2i mMouseDragPos;
Undocumented in source.
mMousePos
Vector2i mMousePos;
Undocumented in source.
mPlaceholder
string mPlaceholder;
Undocumented in source.
mSelectionPos
int mSelectionPos;
Undocumented in source.
mSpinnable
bool mSpinnable;
Undocumented in source.
mTextOffset
float mTextOffset;
Undocumented in source.
mUnits
string mUnits;
Undocumented in source.
mUnitsImage
NVGImage mUnitsImage;
Undocumented in source.
mValidFormat
bool mValidFormat;
Undocumented in source.
mValue
string mValue;
Undocumented in source.
mValueTemp
string mValueTemp;
Undocumented in source.

Inherited Members

From Widget

parent
Widget parent()

Return the parent widget

parent
auto parent()

Return the parent widget

parent
void parent(Widget parent)

Set the parent widget

layout
Layout layout()

Return the used nanogui.layout.Layout generator

layout
auto layout()

Return the used nanogui.layout.Layout generator

layout
void layout(Layout layout)

Set the used nanogui.layout.Layout generator

theme
const(Theme) theme()

Return the nanogui.theme.Theme used to draw this widget

theme
void theme(Theme theme)

Set the nanogui.theme.Theme used to draw this widget

position
Vector2i position()

Return the position relative to the parent widget

position
void position(Vector2i pos)

Set the position relative to the parent widget

absolutePosition
Vector2i absolutePosition()

Return the absolute position on screen

size
Vector2i size()

Return the size of the widget

size
void size(Vector2i size)

set the size of the widget

width
int width()

Return the width of the widget

width
void width(int width)

Set the width of the widget

height
int height()

Return the height of the widget

height
void height(int height)

Set the height of the widget

fixedSize
void fixedSize(Vector2i fixedSize)

Set the fixed size of this widget

fixedSize
Vector2i fixedSize()

Return the fixed size

fixedWidth
int fixedWidth()

Return the fixed width (see fixedSize)

fixedHeight
int fixedHeight()

Return the fixed height (see fixedSize)

fixedWidth
void fixedWidth(int width)

Set the fixed width (see fixedSize)

fixedHeight
void fixedHeight(int height)

Set the fixed height (see fixedSize)

visible
bool visible()

Return whether or not the widget is currently visible (assuming all parents are visible)

visible
void visible(bool visible)

Set whether or not the widget is currently visible (assuming all parents are visible)

visibleRecursive
bool visibleRecursive()

Check if this widget is currently visible, taking parent widgets into account

childCount
int childCount()

Return the number of child widgets

children
auto children()

Return the list of child widgets of the current widget

addChild
void addChild(int index, Widget widget)

Add a child widget to the current widget at the specified index.

addChild
void addChild(Widget widget)

Convenience function which appends a widget at the end

removeChild
void removeChild(int index)

Remove a child widget by index

removeChild
void removeChild(Widget widget)

Remove a child widget by value

childAt
auto childAt(int index)

Retrieves the child at the specific position

childAt
auto childAt(int index)

Retrieves the child at the specific position

childIndex
int childIndex(Widget widget)

Returns the index of a specific child or -1 if not found

add
auto add(Args args)

Variadic shorthand notation to construct and add a child widget

window
Window window()

Walk up the hierarchy and return the parent window

screen
Screen screen()

Walk up the hierarchy and return the parent screen

setId
void setId(string id)

Associate this widget with an ID value (optional)

id
auto id()

Return the ID value associated with this widget, if any

enabled
bool enabled()

Return whether or not this widget is currently enabled

enabled
void enabled(bool enabled)

Set whether or not this widget is currently enabled

focused
bool focused()

Return whether or not this widget is currently focused

focused
void focused(bool focused)

Set whether or not this widget is currently focused

requestFocus
void requestFocus()

Request the focus to be moved to this widget

tooltip
string tooltip()
Undocumented in source. Be warned that the author may not have intended to support it.
tooltip
void tooltip(string tooltip)
Undocumented in source. Be warned that the author may not have intended to support it.
fontSize
int fontSize()

Return current font size. If not set the default of the current theme will be returned

fontSize
void fontSize(int fontSize)

Set the font size of this widget

hasFontSize
bool hasFontSize()

Return whether the font size is explicitly specified for this widget

iconExtraScale
float iconExtraScale()

The amount of extra scaling applied to *icon* fonts. See nanogui.Widget.mIconExtraScale.

iconExtraScale
void iconExtraScale(float scale)

Sets the amount of extra scaling applied to *icon* fonts. See nanogui.Widget.mIconExtraScale.

cursor
Cursor cursor()

Return a pointer to the cursor of the widget

cursor
void cursor(Cursor value)

Set the cursor of the widget

contains
bool contains(Vector2i p)
bool contains(Vector2f p)

Check if the widget contains a certain position

findWidget
Widget findWidget(Vector2i p)

Determine the widget located at the given position value (recursive)

mouseButtonEvent
bool mouseButtonEvent(Vector2i p, MouseButton button, bool down, int modifiers)

Handle a mouse button event (default implementation: propagate to children)

mouseMotionEvent
bool mouseMotionEvent(Vector2i p, Vector2i rel, MouseButton button, int modifiers)

Handle a mouse motion event (default implementation: propagate to children)

mouseDragEvent
bool mouseDragEvent(Vector2i p, Vector2i rel, MouseButton button, int modifiers)

Handle a mouse drag event (default implementation: do nothing)

mouseEnterEvent
bool mouseEnterEvent(Vector2i p, bool enter)

Handle a mouse enter/leave event (default implementation: record this fact, but do nothing)

scrollEvent
bool scrollEvent(Vector2i p, Vector2f rel)

Handle a mouse scroll event (default implementation: propagate to children)

focusEvent
bool focusEvent(bool focused)

Handle a focus change event (default implementation: record the focus status, but do nothing)

keyboardEvent
bool keyboardEvent(int key, int scancode, KeyAction action, int modifiers)

Handle a keyboard event (default implementation: do nothing)

keyboardCharacterEvent
bool keyboardCharacterEvent(dchar codepoint)

Handle text input (UTF-32 format) (default implementation: do nothing)

preferredSize
Vector2i preferredSize(NanoContext ctx)

Compute the preferred size of the widget

preferredSize
Vector2i preferredSize(NanoContext ctx, Widget skipped)

Compute the preferred size of the widget considering its child except skipped one (for example button panel of window)

performLayout
void performLayout(NanoContext ctx)

Invoke the associated layout generator to properly place child widgets, if any

draw
void draw(NanoContext ctx)

Draw the widget (and all child widgets)

~this
~this()

Free all resources used by the widget and any children

icon_scale
float icon_scale()

Convenience definition for subclasses to get the full icon scale for this class of Widget. It simple returns the value mTheme.mIconScale * this.mIconExtraScale.

mParent
Widget mParent;
Undocumented in source.
mTheme
Theme mTheme;
Undocumented in source.
mLayout
Layout mLayout;
Undocumented in source.
mId
string mId;
Undocumented in source.
mPos
Vector2i mPos;
mSize
Vector2i mSize;
mFixedSize
Vector2i mFixedSize;
Undocumented in source.
mChildren
Array!Widget mChildren;
Undocumented in source.
mVisible
bool mVisible;

Whether or not this Widget is currently visible. When a Widget is not currently visible, no time is wasted executing its drawing method.

mEnabled
bool mEnabled;

Whether or not this Widget is currently enabled. Various different kinds of derived types use this to determine whether or not user input will be accepted. For example, when `mEnabled == false`, the state of a CheckBox cannot be changed, or a TextBox will not allow new input.

mFocused
bool mFocused;
mMouseFocus
bool mMouseFocus;
Undocumented in source.
mTooltip
string mTooltip;
Undocumented in source.
mFontSize
int mFontSize;
Undocumented in source.
mIconExtraScale
float mIconExtraScale;

The amount of extra icon scaling used in addition the the theme's default icon font scale. Default value is `1.0`, which implies that icon_scale simply returns the value of nanogui.Theme.mIconScale.

mCursor
Cursor mCursor;
Undocumented in source.

Meta