A text input field.
class
|
InputField
|
extends
|
Component
|
||
implements
|
ITextProperty
|
||||
base of
|
InputFieldGeneric
|
The
following
default
Layout
settings
are
defined
for
InputField
objects:
The style class for InputField s.
public
static
readonly
field
|
Class
|
||
type
|
StyleClass
|
The input click of the default action of this component.
public
property
|
Action
{
get
set
}
|
||
type
|
InputClick
|
||
value
|
The input click or None. | ||
inherited
|
Component.Action
|
Remarks:
Defaults to None.
Returns the bounds of this component in the client area of its parent container.
public
property
|
Bounds
{
get
}
|
||
type
|
Box2I
|
||
value
|
The component bounds. | ||
inherited
|
Component.Bounds
|
public
property
|
Cursor
{
get
}
|
||
type
|
int32
|
||
value
|
public
property
|
Editable
{
get
set
}
|
||
type
|
bool
|
||
value
|
Can this component receive the input focus?
public
property
|
Focusable
{
get
set
}
|
||
type
|
bool
|
||
value
|
true
if
the
component
can
receive
the
input
focus,
false
if
not.
|
||
inherited
|
Component.Focusable
|
public
property
|
HasSelection
{
get
}
|
||
type
|
bool
|
||
value
|
Height of this component in its parent containers client area.
public
property
|
Height
{
get
}
|
||
type
|
int32
|
||
value
|
The current component height, in pixels. | ||
inherited
|
Component.Height
|
Does this component has the input focus?
public
virtual
property
|
IsFocussed
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
component
has
the
input
focus,
false
if
not. |
||
inherited
|
Component.IsFocussed
|
public
property
|
IsHighlighted
{
get
}
|
||
type
|
bool
|
||
value
|
|||
inherited
|
Component.IsHighlighted
|
Does the mouse cursor currently hover above this component?
public
property
|
IsHovered
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
the
mouse
cursor
hovers
above
this
component,
false
if
not.
|
||
inherited
|
Component.IsHovered
|
The alignment anchor of this component.
public
property
|
LayoutAlign
{
get
set
}
|
||
type
|
Anchor
|
||
value
|
The anchor. | ||
inherited
|
Component.LayoutAlign
|
Returns the default Layout settings for this component.
public
override
property
|
LayoutDefault
{
get
}
|
||
type
|
Layout
|
||
value
|
The default layout settings. | ||
overrides
|
Component.LayoutDefault
|
Remarks:
The default implementation returns Default.
The fill mode of this component.
public
virtual
property
|
LayoutFill
{
get
set
}
|
||
type
|
Axis
|
||
value
|
The fill mode. | ||
inherited
|
Component.LayoutFill
|
The bounds of this component in its parent containers layout grid.
public
property
|
LayoutGrid
{
get
set
}
|
||
type
|
Box2I
|
||
value
|
The layout grid bounds. | ||
inherited
|
Component.LayoutGrid
|
Defines how the layout grid column resp. row in the components parent container grows.
public
property
|
LayoutGrow
{
get
set
}
|
||
type
|
Axis
|
||
value
|
The axes that will grow. | ||
inherited
|
Component.LayoutGrow
|
The current layout settings of this component.
public
virtual
property
|
LayoutInfo
{
get
set
}
|
||
type
|
Layout
|
||
value
|
The Layout info object. | ||
inherited
|
Component.LayoutInfo
|
The outer margin of this component.
public
property
|
LayoutMargin
{
get
set
}
|
||
type
|
Edging
|
||
value
|
The outer margin. | ||
inherited
|
Component.LayoutMargin
|
Defines how the layout grid column resp. row in the components parent container grows.
public
property
|
LayoutShrink
{
get
set
}
|
||
type
|
Axis
|
||
value
|
The axes that will shrink. | ||
inherited
|
Component.LayoutShrink
|
The requested size of this component, in pixels.
public
property
|
LayoutSize
{
get
set
}
|
||
type
|
Vec2I
|
||
value
|
The requested size. | ||
inherited
|
Component.LayoutSize
|
Returns the lifecycle state of this object.
public
virtual
property
|
LifecycleState
{
get
}
|
||
type
|
LifecycleState
|
||
value
|
The lifecycle state. | ||
inherited
|
Disposable.LifecycleState
|
The components default action has been triggered.
public
property
|
OnAction
{
get
}
|
||
type
|
IEventGeneric<Component>
|
||
value
|
|
The event object. | |
inherited
|
Component.OnAction
|
The parent container of this component.
public
property
|
Parent
{
get
}
|
||
type
|
Container
|
||
value
|
The
parent
container
or
null
if
this
component
is
the
root. |
||
inherited
|
Component.Parent
|
Returns the corners that this component shares with the client area of its parent container.
public
property
|
ParentCorners
{
get
}
|
||
type
|
Corner
|
||
value
|
The shared client area corners. | ||
inherited
|
Component.ParentCorners
|
Returns the edges that this component shares with the client area of its parent container.
public
property
|
ParentEdges
{
get
}
|
||
type
|
Anchor
|
||
value
|
The shared client area edges. | ||
inherited
|
Component.ParentEdges
|
public
property
|
Prompt
{
get
set
}
|
||
type
|
string
|
||
value
|
Scroll height of this component.
public
property
|
ScrollHeight
{
get
}
|
||
type
|
int32
|
||
value
|
The current scroll height, in pixels. | ||
inherited
|
Component.ScrollHeight
|
Returns the size of a single scroll tick.
public
virtual
property
|
ScrollTick
{
get
}
|
||
type
|
int32
|
||
value
|
The scroll tick size, in pixels. | ||
inherited
|
Component.ScrollTick
|
Scroll width of this component.
public
property
|
ScrollWidth
{
get
}
|
||
type
|
int32
|
||
value
|
The current scroll width, in pixels. | ||
inherited
|
Component.ScrollWidth
|
The horizontal scroll position of this component.
public
property
|
ScrollX
{
get
set
}
|
||
type
|
int32
|
||
value
|
The current scroll position. | ||
inherited
|
Component.ScrollX
|
The vertical scroll position of this component.
public
property
|
ScrollY
{
get
set
}
|
||
type
|
int32
|
||
value
|
The current scroll position. | ||
inherited
|
Component.ScrollY
|
public
property
|
SelectionRange
{
get
}
|
||
type
|
RangeI
|
||
value
|
public
property
|
SelectionText
{
get
set
}
|
||
type
|
string
|
||
value
|
The component state.
public
virtual
property
|
State
{
get
set
}
|
||
type
|
ComponentState
|
||
value
|
The component state. | ||
inherited
|
Component.State
|
Returns the style class for this component type.
public
override
property
|
StyleClassType
{
get
}
|
||
type
|
StyleClass
|
||
value
|
The
style
class
(e.g.
'InputField'
for
InputField). |
||
implements
|
Component.StyleClassType
|
Optional style class variant of this component.
public
property
|
StyleClassVariant
{
get
set
}
|
||
type
|
string
|
||
value
|
The
variant
name
or
null . |
||
inherited
|
Component.StyleClassVariant
|
The stylesheet object to use for this user interface element.
public
property
|
Stylesheet
{
get
set
}
|
||
type
|
Stylesheet
|
||
value
|
The
stylesheet
object
to
use
or
null . |
||
inherited
|
Component.Stylesheet
|
The user-defined tag value of this component.
public
property
|
Tag
{
get
set
}
|
||
type
|
int32
|
||
value
|
The
tag
value
or
null . |
||
inherited
|
Component.Tag
|
Remarks:
Defaults
to
-1
.
The text value.
public
property
|
Text
{
get
set
}
|
||
type
|
string
|
||
value
|
The
text
value.
Will
be
replaced
with
the
empty
string
when
null . |
||
implements
|
ITextProperty.Text
|
Remarks:
Defaults
to
the
empty
string
''
.
See also:
StringUtil.IsEmptyOrWhitespaceWidth of this component in its parent containers client area.
public
property
|
Width
{
get
}
|
||
type
|
int32
|
||
value
|
The current component width, in pixels. | ||
inherited
|
Component.Width
|
Creates a new instance of InputField.
public
constructor
|
InputField
(bool editable = true,
string prompt = null)
|
||
params
|
editable
|
Initial
value
for
Editable.
Defaults
to
true .
|
|
prompt
|
Initial
value
for
Prompt.
Defaults
to
null .
|
Acquires a strong reference to this disposable object.
[OwnerReturn, ThreadSafe]
|
||||
public
method
|
AcquireTry
()
|
|||
type
|
IDisposable
|
|||
returns
|
this
if
a
new
strong
reference
has
been
acquired,
null
if
this
object
is
already
being
disposed.
|
|||
inherited
|
Disposable.AcquireTry
|
Remarks:
The object will not be actually disposed by calls to Dispose when there is at least one strong reference left. Code that calls the AcquireTry method is responsible for calling the Dispose method accordingly.
This method is not intended to be used in performance-critical code. It should only be used to high-level resource management.
public
method
|
ClearSelection
()
|
Consumes the given user input event.
public
method
|
ConsumeInput
(InputEvent inputEvent)
|
||
type
|
bool
|
||
params
|
inputEvent
|
The user input event. | |
returns
|
true
if
the
input
event
has
been
consumed,
false
if
not. |
||
inherited
|
Component.ConsumeInput
|
Remarks:
Input events are provided to an IInputConsumer object only if it has the input focus (see FocusGained and FocusLost). Mouse events are provided when the mouse cursor is inside of the input bounds (MouseEnter and MouseLeave). The Closing event can be provided at any time.
Releases all resources held by this object if there are no more strong references to it, decrements the reference counter by one otherwise.
[Dispose, OwnerThis, ThreadSafe]
|
||||
public
method
|
Dispose
()
|
|||
inherited
|
Disposable.Dispose
|
Remarks:
The Dispose method silently returns if the object has already been disposed.
Transfers the input focus to this component.
public
method
|
Focus
()
|
||
returns
|
|
this | |
inherited
|
Component.Focus
|
Attaches this component to the given Graphics context.
public
virtual
method
|
GraphicsAttach
(Graphics graphics)
|
||
params
|
graphics
|
[not-null]
|
The graphics context. |
inherited
|
Component.GraphicsAttach
|
Remarks:
All graphics-related resources should be created here.
Detaches this user interface component from its Graphics context.
public
virtual
method
|
GraphicsDetach
()
|
||
inherited
|
Component.GraphicsDetach
|
Remarks:
All graphics-related resources should be disposed here.
The screen size has changed.
public
virtual
method
|
GraphicsResize
(Vec2I screenSize)
|
||
params
|
screenSize
|
The new screen size, in pixels. | |
inherited
|
Component.GraphicsResize
|
Remarks:
The given screen size is equal to the value of ScreenSize of the Graphics object that has been passed to GraphicsAttach earlier.
public
method
|
MoveCursor
(int32 index,
bool selecting = false)
|
||
params
|
index
|
||
selecting
|
Performs 2D rendering.
public
method
|
Render2D
(Graphics g)
|
||
params
|
g
|
[not-null]
|
The graphics object to use. |
inherited
|
Component.Render2D
|
Remarks:
When this method is called, the given Graphics object has already been initialized for 2D rendering:
(0|0)
refers
to
the
top-left
pixel
of
the
target
rectangle
and
ScreenSize
returns
the
target
rectangle
size.
The
target
rectangle
and
the
clipping
rectangle
can
be
different.
public
method
|
Selection
(int32 start = 0,
int32 end = Maths.MaxInt)
|
||
params
|
start
|
||
end
|
This method is called once per application frame.
public
override
method
|
UpdateFrameTime
(float32 time)
|
||
type
|
bool
|
||
params
|
time
|
[>0]
|
The amount of time that has elapsed since the last frame, in seconds. |
returns
|
true
if
the
object
needs
to
be
presented
again,
false
if
the
current
presentation
is
still
valid.
|
||
overrides
|
Component.UpdateFrameTime
|
Returns the actual margin of this component.
protected
property
|
ActualLayoutMargin
{
get
}
|
||
type
|
Edging
|
||
value
|
The actual margin value. | ||
inherited
|
Component.ActualLayoutMargin
|
Remarks:
The default implementation returns LayoutMargin. Implementing subclasses can perform additional computations here.
Subclasses must call InvalidateLayout with ComputeLayoutGridExtend to notify when ActualLayoutMargin returns a different value.
Returns the actual minimum layout size of this component.
protected
override
property
|
ActualLayoutSize
{
get
}
|
||
type
|
Vec2I
|
||
value
|
The actual minimum layout size. | ||
overrides
|
Component.ActualLayoutSize
|
Remarks:
The default implementation returns LayoutSize. Implementing subclasses can perform additional computations here.
Subclasses must call InvalidateLayout with ComputeLayoutGridExtend to notify when ActualLayoutSize returns a different value.
The current color scheme.
protected
field
|
color
|
||
type
|
ColorScheme
|
||
inherited
|
Component.color
|
The
current
Graphics
object
or
null
if
this
component
is
not
attached.
protected
field
|
graphics
|
||
type
|
Graphics
|
||
inherited
|
Component.graphics
|
Is this component currently attached to a live component hierarchy?
protected
property
|
IsAttached
{
get
}
|
||
type
|
bool
|
||
value
|
true
if
this
component
is
attached
to
a
live
hierarchy,
false
if
not.
|
||
inherited
|
Component.IsAttached
|
The TextFont value for this component.
[Owner]
|
||||
protected
field
|
textFont
|
|||
type
|
PixelFont
|
|||
inherited
|
Component.textFont
|
The TextFontHint value for this component.
[Owner]
|
||||
protected
field
|
textFontHint
|
|||
type
|
PixelFont
|
|||
inherited
|
Component.textFontHint
|
The action click has been performed.
protected
virtual
method
|
ActionClick
()
|
||
inherited
|
Component.ActionClick
|
See also:
Component.ActionNotifies all listeners of the OnAction event.
protected
method
|
ActionNotify
(bool flash = true)
|
||
params
|
flash
|
Render
a
visual
flash
to
indicate
the
action?
Defaults
to
true .
|
|
inherited
|
Component.ActionNotify
|
This method is called each time the Bounds of this component have changed.
[EmptyBody]
|
||||
protected
virtual
method
|
BoundsChanged
()
|
|||
inherited
|
Component.BoundsChanged
|
protected
virtual
method
|
ConsumeAction
(InputEvent action)
|
||
type
|
bool
|
||
params
|
action
|
||
inherited
|
Component.ConsumeAction
|
Processes the given input event.
[EmptyBody]
|
||||
protected
override
method
|
ConsumeKeyboard
(InputEvent key)
|
|||
type
|
bool
|
|||
params
|
key
|
The mouse event. | ||
returns
|
true
if
the
component
has
consumed
the
input
event,
false
if
not.
|
|||
overrides
|
Component.ConsumeKeyboard
|
Processes the given input event.
protected
override
method
|
ConsumeMouse
(InputEvent mouse)
|
||
type
|
bool
|
||
params
|
mouse
|
The mouse event. | |
returns
|
true
if
the
component
has
consumed
the
input
event,
false
if
not.
|
||
overrides
|
Component.ConsumeMouse
|
protected
method
|
Dirty
()
|
||
inherited
|
Component.Dirty
|
Disposes the managed resources held by a concrete subclass. This method will be called at most once per subclass.
protected
override
method
|
DisposeManaged
()
|
||
overrides
|
Component.DisposeManaged
|
Remarks:
This method will only be called when a disposable object is explicitly destroyed by user code calling the Dispose method. It will not be called when the object is collected as garbage by the system.
Overriding methods must call the DisposeManaged method of their base class. The base call should be the last statement.
The DisposeManaged method is called before the DisposeUnmanaged method.
Disposes the unmanaged resources held by a concrete subclass. This method will be called exactly once per subclass.
protected
virtual
method
|
DisposeUnmanaged
()
|
||
inherited
|
Disposable.DisposeUnmanaged
|
Remarks:
Overriding methods must call the DisposeUnmanaged method of their base class. The base call should be the last statement.
The DisposeUnmanaged method is called after the DisposeManaged method.
Performs component specific rendering.
[EmptyBody]
|
||||
protected
override
method
|
DoRender
(Graphics graphics)
|
|||
params
|
graphics
|
The Graphics object to use. | ||
overrides
|
Component.DoRender
|
Applies the current stylesheet settings to this component.
protected
virtual
method
|
DoStylesheetApply
()
|
||
inherited
|
Component.DoStylesheetApply
|
Remarks:
Implementing methods should query fetch style property values and store them somewhere for using them later quickly.
All graphics resources that are acquired during DoStylesheetApply must be properly disposed in GraphicsDetach.
Draws the background rectangle of this component.
protected
method
|
DrawBackground
(bool border,
int32 round = 5)
|
||
params
|
border
|
Draw a border? | |
round
|
Size
of
round
corners.
Defaults
to
5 . |
||
inherited
|
Component.DrawBackground
|
Draws a hint text.
protected
method
|
DrawHint
(string text,
int32 x,
int32 y,
Anchor anchor)
|
||
params
|
text
|
The hint text. | |
x
|
X-coordinate of anchor point. | ||
y
|
Y-coordinate of anchor point. | ||
anchor
|
The text anchor point. | ||
inherited
|
Component.DrawHint
|
Draws a text.
protected
method
|
DrawString
(string text,
int32 x,
int32 y,
Anchor anchor)
|
||
params
|
text
|
The text. | |
x
|
X-coordinate of anchor point. | ||
y
|
Y-coordinate of anchor point. | ||
anchor
|
The text anchor point. | ||
inherited
|
Component.DrawString
|
This method is called when this component has lost or gained the input focus.
[EmptyBody]
|
||||
protected
virtual
method
|
FocusChanged
()
|
|||
inherited
|
Component.FocusChanged
|
Invalidates the layout grid of the parent container of this component.
protected
method
|
InvalidateLayout
(LayoutAction layoutAction = LayoutAction.ComputeLayoutGridExtend)
|
||
params
|
layoutAction
|
The layout action that needs to be performed. Defaults to ComputeLayoutGridExtend. | |
inherited
|
Component.InvalidateLayout
|
This method is called each time the Text value has changed.
[EmptyBody]
|
||||
protected
virtual
method
|
TextChanged
()
|