Xonotic
inputbox.qc File Reference
#include "inputbox.qh"
+ Include dependency graph for inputbox.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

entity makeXonoticInputBox (float doEditColorCodes, string theCvar)
 
entity makeXonoticInputBox_T (float doEditColorCodes, string theCvar, string theTooltip)
 
void XonoticInputBox_configureXonoticInputBox (entity me, float doEditColorCodes, string theCvar, string theTooltip)
 
void XonoticInputBox_focusLeave (entity me)
 
float XonoticInputBox_keyDown (entity me, float key, float ascii, float shift)
 
void XonoticInputBox_loadCvars (entity me)
 
void XonoticInputBox_saveCvars (entity me)
 
void XonoticInputBox_setText (entity me, string val)
 

Function Documentation

◆ makeXonoticInputBox()

entity makeXonoticInputBox ( float  doEditColorCodes,
string  theCvar 
)

Definition at line 10 of file inputbox.qc.

References makeXonoticInputBox_T(), and string_null.

11 {
12  return makeXonoticInputBox_T(doEditColorCodes, theCvar, string_null);
13 }
string string_null
Definition: nil.qh:9
entity makeXonoticInputBox_T(float doEditColorCodes, string theCvar, string theTooltip)
Definition: inputbox.qc:3
+ Here is the call graph for this function:

◆ makeXonoticInputBox_T()

entity makeXonoticInputBox_T ( float  doEditColorCodes,
string  theCvar,
string  theTooltip 
)

Definition at line 3 of file inputbox.qc.

References entity(), and NEW.

Referenced by makeXonoticInputBox().

4 {
5  entity me;
6  me = NEW(XonoticInputBox);
7  me.configureXonoticInputBox(me, doEditColorCodes, theCvar, theTooltip);
8  return me;
9 }
#define NEW(cname,...)
Definition: oo.qh:105
entity() spawn
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ XonoticInputBox_configureXonoticInputBox()

void XonoticInputBox_configureXonoticInputBox ( entity  me,
float  doEditColorCodes,
string  theCvar,
string  theTooltip 
)

Definition at line 14 of file inputbox.qc.

References setZonedTooltip(), string_null, and strlen().

15 {
16  me.configureInputBox(me, "", 0, me.fontSize, me.image);
17  me.editColorCodes = doEditColorCodes;
18  me.controlledCvar = (theCvar) ? theCvar : string_null;
19  me.loadCvars(me);
20  setZonedTooltip(me, theTooltip, theCvar);
21  me.cursorPos = strlen(me.text);
22 }
string string_null
Definition: nil.qh:9
+ Here is the call graph for this function:

◆ XonoticInputBox_focusLeave()

void XonoticInputBox_focusLeave ( entity  me)

Definition at line 23 of file inputbox.qc.

24 {
25  me.saveCvars(me);
26 }

◆ XonoticInputBox_keyDown()

float XonoticInputBox_keyDown ( entity  me,
float  key,
float  ascii,
float  shift 
)

Definition at line 53 of file inputbox.qc.

References K_ENTER, K_KP_ENTER, and SUPER.

54 {
55  float r;
56  r = 0;
57  if(key == K_ENTER || key == K_KP_ENTER)
58  {
59  if(me.controlledCvar)
60  {
61  me.saveCvars(me);
62  r = 1;
63  }
64  if(me.onEnter)
65  me.onEnter(me, me.onEnterEntity);
66  }
67  if(SUPER(XonoticInputBox).keyDown(me, key, ascii, shift))
68  r = 1;
69  return r;
70 }
float K_KP_ENTER
Definition: keycodes.qc:74
#define SUPER(cname)
Definition: oo.qh:219
float K_ENTER
Definition: keycodes.qc:8

◆ XonoticInputBox_loadCvars()

void XonoticInputBox_loadCvars ( entity  me)

Definition at line 40 of file inputbox.qc.

References cvar_string(), and SUPER.

41 {
42  if (!me.controlledCvar)
43  return;
44  SUPER(XonoticInputBox).setText(me, cvar_string(me.controlledCvar));
45 }
#define SUPER(cname)
Definition: oo.qh:219
+ Here is the call graph for this function:

◆ XonoticInputBox_saveCvars()

void XonoticInputBox_saveCvars ( entity  me)

Definition at line 46 of file inputbox.qc.

References CheckSendCvars(), and cvar_set().

47 {
48  if (!me.controlledCvar)
49  return;
50  cvar_set(me.controlledCvar, me.text);
51  CheckSendCvars(me, me.controlledCvar);
52 }
+ Here is the call graph for this function:

◆ XonoticInputBox_setText()

void XonoticInputBox_setText ( entity  me,
string  val 
)

Definition at line 27 of file inputbox.qc.

References SUPER.

28 {
29  if(me.text != val)
30  {
31  SUPER(XonoticInputBox).setText(me, val);
32  if(me.onChange)
33  me.onChange(me, me.onChangeEntity);
34  if(me.saveImmediately)
35  me.saveCvars(me);
36  }
37  else
38  SUPER(XonoticInputBox).setText(me, val);
39 }
#define SUPER(cname)
Definition: oo.qh:219