53#define EXTRADATA_TYPE textEntryExtraData_t
54#define EXTRADATA(node) UI_EXTRADATA(node, EXTRADATA_TYPE)
61#define MAX_CVAR_EDITING_LENGTH 256
73 UI_EXTRADATA(node, textEntryExtraData_s).background = sprite;
170 const char* cvarRef =
"*cvar:";
177 SDL_StartTextInput();
180 SDL_Rect r = {
static_cast<int>(pos[0]),
static_cast<int>(pos[1]),
static_cast<int>(node->
box.
size[0]),
static_cast<int>(node->
box.
size[1])};
181 SDL_SetTextInputRect(&r);
223 int length = strlen(buffer);
227 if (
length + charLength >=
sizeof(buffer))
231 if (insertedLength > 0)
296 const float* textColor;
304 }
else if (node->
state) {
305 textColor = node->
color;
308 textColor = node->
color;
369 behaviour->
name =
"textentry";
int CL_Milliseconds(void)
void R_Color(const vec4_t rgba)
Change the color to given value.
void draw(uiNode_t *node) override
void onLeftClick(uiNode_t *node, int x, int y) override
Called when the user click with the right mouse button.
bool onKeyPressed(uiNode_t *node, unsigned int key, unsigned short unicode) override
Called when we press a key when the node got the focus.
void onFocusLost(uiNode_t *node) override
Called when the node lost the focus.
void onFocusGained(uiNode_t *node) override
Called when the node got the focus.
void onLoading(uiNode_t *node) override
Call before the script initialization of the node.
Primary header for client.
cvar_t * Cvar_ForceSet(const char *varName, const char *value)
Will set the variable even if NOSET or LATCH.
cvar_t * Cvar_Get(const char *var_name, const char *var_value, int flags, const char *desc)
Init or return a cvar.
QGL_EXTERN GLuint GLsizei GLsizei * length
QGL_EXTERN GLuint GLsizei GLsizei GLint GLenum GLchar * name
align_t
We need this here for checking the boundaries from script values.
Header for lua script functions.
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
char const * Q_strstart(char const *str, char const *start)
Matches the start of a string.
This is a cvar definition. Cvars can be user modified and used in our menus e.g.
node behaviour, how a node work
Contain the context of the calling of a function.
Atomic structure used to define most of the UI.
struct uiAction_s * onChange
struct uiAction_s * onClick
void UI_ExecuteEventActions(uiNode_t *source, const uiAction_t *firstAction)
const struct value_s * UI_RegisterNodeMethod(uiBehaviour_t *behaviour, const char *name, uiNodeMethod_t function)
Register a node method to a behaviour.
#define UI_RegisterOveridedNodeProperty(BEHAVIOUR, NAME)
Initialize a property which override an inherited property. It is yet only used for the documentation...
#define UI_RegisterExtradataNodeProperty(BEHAVIOUR, NAME, TYPE, EXTRADATATYPE, ATTRIBUTE)
Initialize a property from extradata of node.
const char * UI_GetFontFromNode(const uiNode_t *const node)
Return the font for a specific node or default font.
bool UI_ExecuteLuaEventScript(uiNode_t *node, LUA_EVENT event)
Executes a lua event handler.
bool UI_ExecuteLuaEventScript_XY(uiNode_t *node, LUA_EVENT event, int x, int y)
Executes a lua event handler with (x,y) argument.
Basic lua initialization for the ui.
void * UI_SWIG_TypeQuery(const char *name)
This function queries the SWIG type table for a type information structure. It is used in combination...
void UI_GetNodeAbsPos(const uiNode_t *node, vec2_t pos)
Returns the absolute position of a node.
SharedPtr< uiNode > UINodePtr
static const char HIDECHAR
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
#define MAX_CVAR_EDITING_LENGTH
void UI_TextEntryNodeFocus(uiNode_t *node, const uiCallContext_t *context)
force edition of a textentry node
static void UI_TextEntryNodeValidateEdition(uiNode_t *node)
callback from the keyboard
static const char CURSOR_OFF
static cvar_t * editedCvar
static const char CURSOR_ON
static void UI_TextEntryNodeAbortEdition(uiNode_t *node)
callback from the keyboard
static char cvarValueBackup[MAX_CVAR_EDITING_LENGTH]
void UI_RegisterTextEntryNode(uiBehaviour_t *behaviour)
void UI_TextEntry_SetBackgroundByName(uiNode_t *node, const char *name)
set background sprite
#define UI_EXTRADATA(NODE, TYPE)
const char * UI_GetReferenceString(const uiNode_t *const node, const char *ref)
int UI_DrawStringInBox(const char *fontID, align_t align, int x, int y, int width, int height, const char *text, longlines_t method)
draw a line into a bounding box
void UI_DrawSpriteInBox(bool flip, const uiSprite_t *sprite, uiSpriteStatus_t status, int posX, int posY, int sizeX, int sizeY)
uiSprite_t * UI_GetSpriteByName(const char *name)
Return an sprite by is name.
int UTF8_delete_char_at(char *s, int pos)
Delete a whole (possibly multibyte) character from a string.
int UTF8_insert_char_at(char *s, int n, int pos, int c)
Insert a (possibly multibyte) UTF-8 character into a string.
size_t UTF8_strlen(const char *str)
Count the number of character (not the number of bytes) of a zero termination string.
char * UTF8_strncpyz(char *dest, const char *src, size_t limit)
UTF8 capable string copy function.
int UTF8_encoded_len(int c)
#define Vector4Set(v, r, g, b, a)