|
UFO: Alien Invasion
|
This node allow to edit a cvar text with the keyboard. When we click on the node, we active the edition, we can validate it with the ''RETURN'' key, or abort it with ''ESCAPE'' key. A validation fire a scriptable callback event. We can custom the mouse behaviour when we click outside the node in edition mode. It can validate or abort the edition. More...
#include "../ui_main.h"#include "../ui_nodes.h"#include "../ui_font.h"#include "../ui_parse.h"#include "../ui_behaviour.h"#include "../ui_input.h"#include "../ui_render.h"#include "../ui_sprite.h"#include "../ui_lua.h"#include "ui_node_textentry.h"#include "ui_node_abstractnode.h"#include "ui_node_panel.h"#include "../../client.h"#include "../../../shared/utf8.h"#include "../../../common/scripts_lua.h"#include <SDL.h>
Go to the source code of this file.
Macros | |
| #define | EXTRADATA_TYPE textEntryExtraData_t |
| #define | EXTRADATA(node) |
| #define | MAX_CVAR_EDITING_LENGTH 256 /* MAXCMDLINE */ |
Functions | |
| void | UI_TextEntry_SetBackgroundByName (uiNode_t *node, const char *name) |
| set background sprite | |
| static void | UI_TextEntryNodeValidateEdition (uiNode_t *node) |
| callback from the keyboard | |
| static void | UI_TextEntryNodeAbortEdition (uiNode_t *node) |
| callback from the keyboard | |
| void | UI_TextEntryNodeFocus (uiNode_t *node, const uiCallContext_t *context) |
| force edition of a textentry node | |
| void | UI_TextEntryNodeUnFocus (uiNode_t *node, const uiCallContext_t *context) |
| force exit the edit mode of a textentry node | |
| static void | UI_TextEntryNodeEdit (uiNode_t *node, unsigned int unicode) |
| edit the current cvar with a char | |
| void | UI_RegisterTextEntryNode (uiBehaviour_t *behaviour) |
Variables | |
| static const char | CURSOR_ON = '|' |
| static const char | CURSOR_OFF = ' ' |
| static const char | HIDECHAR = '*' |
| static char | cvarValueBackup [MAX_CVAR_EDITING_LENGTH] |
| static cvar_t * | editedCvar = nullptr |
| static bool | isAborted = false |
This node allow to edit a cvar text with the keyboard. When we click on the node, we active the edition, we can validate it with the ''RETURN'' key, or abort it with ''ESCAPE'' key. A validation fire a scriptable callback event. We can custom the mouse behaviour when we click outside the node in edition mode. It can validate or abort the edition.
allow to edit text without any cvar
add a custom max size
Definition in file ui_node_textentry.cpp.
| #define EXTRADATA | ( | node | ) |
Definition at line 54 of file ui_node_textentry.cpp.
Referenced by UI_TextEntryNodeAbortEdition(), and UI_TextEntryNodeEdit().
| #define EXTRADATA_TYPE textEntryExtraData_t |
Definition at line 53 of file ui_node_textentry.cpp.
| #define MAX_CVAR_EDITING_LENGTH 256 /* MAXCMDLINE */ |
Definition at line 61 of file ui_node_textentry.cpp.
Referenced by UI_TextEntryNodeEdit().
| void UI_RegisterTextEntryNode | ( | uiBehaviour_t * | behaviour | ) |
Definition at line 367 of file ui_node_textentry.cpp.
References EXTRADATA_TYPE, uiBehaviour_t::extraDataSize, uiBehaviour_t::lua_SWIG_typeinfo, uiBehaviour_t::manager, uiBehaviour_t::name, UI_RegisterExtradataNodeProperty, UI_RegisterNodeMethod(), UI_RegisterOveridedNodeProperty, UI_SWIG_TypeQuery(), UI_TextEntryNodeFocus(), UI_TextEntryNodeUnFocus(), V_BOOL, V_INT, V_UI_ACTION, and V_UI_SPRITEREF.
set background sprite
Definition at line 71 of file ui_node_textentry.cpp.
References name, UI_EXTRADATA, and UI_GetSpriteByName().
Referenced by uiTextEntryNode_t_set_background().
callback from the keyboard
Definition at line 97 of file ui_node_textentry.cpp.
References Cvar_ForceSet(), cvarValueBackup, editedCvar, EXTRADATA, and UI_ExecuteEventActions().
Referenced by uiTextEntryNode::onFocusLost().
edit the current cvar with a char
Definition at line 205 of file ui_node_textentry.cpp.
References Cvar_ForceSet(), editedCvar, EXTRADATA, K_BACKSPACE, K_DEL, length, MAX_CVAR_EDITING_LENGTH, Q_strncpyz(), unicode, UTF8_delete_char_at(), UTF8_encoded_len(), UTF8_insert_char_at(), and UTF8_strlen().
Referenced by uiTextEntryNode::onKeyPressed().
| void UI_TextEntryNodeFocus | ( | uiNode_t * | node, |
| const uiCallContext_t * | context ) |
force edition of a textentry node
Definition at line 118 of file ui_node_textentry.cpp.
References UI_HasFocus(), and UI_RequestFocus().
Referenced by UI_RegisterTextEntryNode(), and uiTextEntryNode_t_focus().
| void UI_TextEntryNodeUnFocus | ( | uiNode_t * | node, |
| const uiCallContext_t * | context ) |
force exit the edit mode of a textentry node
Definition at line 130 of file ui_node_textentry.cpp.
References UI_HasFocus(), and UI_RemoveFocus().
Referenced by UI_RegisterTextEntryNode(), and uiTextEntryNode_t_unfocus().
callback from the keyboard
Definition at line 79 of file ui_node_textentry.cpp.
References cvarValueBackup, editedCvar, uiNode_t::lua_onChange, uiNode_t::onChange, UI_ExecuteEventActions(), and UI_ExecuteLuaEventScript().
Referenced by uiTextEntryNode::onFocusLost(), and uiTextEntryNode::onKeyPressed().
|
static |
Use as the cursor when we edit the text - invisible
Definition at line 57 of file ui_node_textentry.cpp.
Referenced by uiTextEntryNode::draw().
|
static |
Use as the cursor when we edit the text - visible
Definition at line 56 of file ui_node_textentry.cpp.
Referenced by uiTextEntryNode::draw().
|
static |
Definition at line 64 of file ui_node_textentry.cpp.
Referenced by uiTextEntryNode::onFocusGained(), UI_TextEntryNodeAbortEdition(), and UI_TextEntryNodeValidateEdition().
Definition at line 65 of file ui_node_textentry.cpp.
Referenced by uiTextEntryNode::onFocusGained(), uiTextEntryNode::onFocusLost(), uiTextEntryNode::onKeyPressed(), UI_TextEntryNodeAbortEdition(), UI_TextEntryNodeEdit(), and UI_TextEntryNodeValidateEdition().
|
static |
use as a mask for password
Definition at line 58 of file ui_node_textentry.cpp.
Referenced by uiTextEntryNode::draw().
|
static |
Definition at line 66 of file ui_node_textentry.cpp.
Referenced by uiTextEntryNode::onFocusGained(), uiTextEntryNode::onFocusLost(), and uiTextEntryNode::onKeyPressed().