|
cangine
|
Editable text-field game object. More...
#include <inputfield_object.hpp>


Public Member Functions | |
| InputField () | |
| Constructs an input field with a default style. | |
| void | setContent (std::string contentIn) |
| Sets the field's text content and refreshes the view. | |
| void | setPlaceholder (std::string placeholderIn) |
| Sets the placeholder text shown when empty. | |
| void | setCursorPos (int posIn) |
| Sets the caret position and refreshes the view. | |
| void | setWidth (float widthIn) |
| Sets the field width. | |
| void | setHeight (float heightIn) |
| Sets the field height (and scales the font to match). | |
| void | setBorderWidth (float widthIn) |
| Sets the border thickness. | |
| void | setPlaceHolderColor (Color colorIn) |
| Sets the placeholder text color. | |
| void | setBorderColor (Color colorIn) |
| Sets the border color when unfocused. | |
| void | setBorderColorFocus (Color colorIn) |
| Sets the border color when focused. | |
| void | setCursorColor (Color colorIn) |
| Sets the caret color. | |
| void | setBackgroundColor (Color colorIn) |
| Sets the field background color. | |
| void | setColor (Color colorIn) |
| Sets the text color. | |
| void | setOnReturn (std::function< void(std::string)> functionIn) |
| Sets the callback invoked when Enter is pressed. | |
| InputFieldComponent * | getIFC () |
| Returns the underlying input field component. | |
| const std::string & | getContent () const |
| Returns the current content. | |
| const std::string & | getPlaceholder () const |
| Returns the placeholder text. | |
| int | getCursorPos () const |
| Returns the caret position. | |
| float | getWidth () const |
| Returns the field width. | |
| float | getHeight () const |
| Returns the field height. | |
| float | getBorderWidth () const |
| Returns the border thickness. | |
| const Color & | getPlaceholderColor () const |
| Returns the placeholder text color. | |
| const Color & | getBorderColor () const |
| Returns the unfocused border color. | |
| const Color & | getBorderColorFocus () const |
| Returns the focused border color. | |
| const Color & | getCursorColor () const |
| Returns the caret color. | |
| const Color & | getBackgroundColor () const |
| Returns the background color. | |
| const Color & | getColor () const |
| Returns the text color. | |
Public Member Functions inherited from cangine::GameObject | |
| GameObject () | |
| virtual | ~GameObject () |
| virtual void | onUpdate (double deltaTime) |
| Per-frame update hook. | |
| virtual void | onMouseEvent (const MouseEvent *e) |
| Mouse event hook. | |
| virtual void | onDisable () |
| Called when the object becomes inactive. | |
| virtual void | onEnable () |
| Called when the object becomes active. | |
| void | destroy () |
| Marks the object for destruction by the ObjectManager. | |
| template<typename T > | |
| void | appendComponent (T *component) |
| Attaches an existing component to this object. | |
| template<typename T > | |
| void | destroyComponent () |
| Destroys and removes the first component of a type. | |
| template<typename T > | |
| T * | getComponent () |
| Returns the first attached component of a type. | |
| template<typename T > | |
| std::vector< T * > | getComponents () |
| Returns all attached components of a type. | |
| template<typename T , typename... Args> | |
| T * | newComponent (Args &&... args) |
| Constructs a component in place and attaches it. | |
| void | setActive (bool a) |
| Activates or deactivates the object. | |
| bool | isActive () |
| Reports whether the object is active. | |
Private Attributes | |
| InputFieldComponent * | ifc |
| Component implementing the input field. | |
Editable text-field game object.
A thin convenience wrapper around InputFieldComponent, exposing getters and setters for the field's content, style and the on-return callback so it can be configured without touching the component.
| cangine::InputField::InputField | ( | ) |
Constructs an input field with a default style.
Returns the background color.
Returns the unfocused border color.
Returns the focused border color.
|
inline |
Returns the border thickness.
Returns the text color.
|
inline |
Returns the current content.
Returns the caret color.
|
inline |
Returns the caret position.
|
inline |
Returns the field height.
|
inline |
Returns the underlying input field component.
|
inline |
Returns the placeholder text.
Returns the placeholder text color.
|
inline |
Returns the field width.
Sets the field background color.
| colorIn | New color. |
Sets the border color when unfocused.
| colorIn | New color. |
Sets the border color when focused.
| colorIn | New color. |
Sets the border thickness.
| widthIn | New border width in pixels. |
Sets the text color.
| colorIn | New color. |
|
inline |
Sets the field's text content and refreshes the view.
| contentIn | New content string. |
Sets the caret color.
| colorIn | New color. |
Sets the caret position and refreshes the view.
| posIn | New caret index into the content. |
Sets the field height (and scales the font to match).
| heightIn | New height in pixels. |
Sets the callback invoked when Enter is pressed.
| functionIn | Callback receiving the field content. |
|
inline |
Sets the placeholder text shown when empty.
| placeholderIn | New placeholder string. |
Sets the placeholder text color.
| colorIn | New color. |
Sets the field width.
| widthIn | New width in pixels. |
|
private |
Component implementing the input field.