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

Go to the source code of this file.

Functions

bool InputContainer__changeFocusXY (entity this, vector pos)
 
void InputContainer_focusLeave (entity me)
 
float InputContainer_keyDown (entity me, float scan, float ascii, float shift)
 
float InputContainer_mouseDrag (entity me, vector pos)
 
float InputContainer_mouseMove (entity me, vector pos)
 
float InputContainer_mouseRelease (entity me, vector pos)
 
void InputContainer_resizeNotify (entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
 

Function Documentation

◆ InputContainer__changeFocusXY()

bool InputContainer__changeFocusXY ( entity  this,
vector  pos 
)

Definition at line 86 of file inputcontainer.qc.

References entity(), globalToBox(), NULL, and prev.

87  {
88  entity e = this.itemFromPoint(this, pos);
89  if (e && !e.focusable) e = NULL;
90  entity prev = this.mouseFocusedChild;
91  this.mouseFocusedChild = e;
92  if (e != prev)
93  {
94  this.setFocus(this, e);
95  if (e && e.instanceOfInputContainer)
96  {
97  e.focusedChild = NULL;
98  e._changeFocusXY(e, globalToBox(pos, e.Container_origin, e.Container_size));
99  }
100  }
101  return true; // have focus
102  }
entity() spawn
prev
Definition: all.qh:66
#define NULL
Definition: post.qh:17
+ Here is the call graph for this function:

◆ InputContainer_focusLeave()

void InputContainer_focusLeave ( entity  me)

Definition at line 14 of file inputcontainer.qc.

References NULL, and SUPER.

15  {
16  SUPER(InputContainer).focusLeave(me);
17  me.mouseFocusedChild = NULL;
18  }
#define SUPER(cname)
Definition: oo.qh:219
#define NULL
Definition: post.qh:17

◆ InputContainer_keyDown()

float InputContainer_keyDown ( entity  me,
float  scan,
float  ascii,
float  shift 
)

Definition at line 20 of file inputcontainer.qc.

References entity(), K_ESCAPE, K_TAB, NULL, S_SHIFT, and SUPER.

21  {
22  entity f, ff;
23  if (SUPER(InputContainer).keyDown(me, scan, ascii, shift))
24  return 1;
25  if (scan == K_ESCAPE)
26  {
27  f = me.focusedChild;
28  if (f)
29  {
30  me.setFocus(me, NULL);
31  return 1;
32  }
33  return 0;
34  }
35  if (scan == K_TAB)
36  {
37  f = me.focusedChild;
38  if (shift & S_SHIFT)
39  {
40  if (f)
41  {
42  for (ff = f.prevSibling; ff; ff = ff.prevSibling)
43  {
44  if (!ff.focusable) continue;
45  me.setFocus(me, ff);
46  return 1;
47  }
48  }
49  if (!f || me.isTabRoot)
50  {
51  for (ff = me.lastChild; ff; ff = ff.prevSibling)
52  {
53  if (!ff.focusable) continue;
54  me.setFocus(me, ff);
55  return 1;
56  }
57  return 0; // AIIIIEEEEE!
58  }
59  }
60  else
61  {
62  if (f)
63  {
64  for (ff = f.nextSibling; ff; ff = ff.nextSibling)
65  {
66  if (!ff.focusable) continue;
67  me.setFocus(me, ff);
68  return 1;
69  }
70  }
71  if (!f || me.isTabRoot)
72  {
73  for (ff = me.firstChild; ff; ff = ff.nextSibling)
74  {
75  if (!ff.focusable) continue;
76  me.setFocus(me, ff);
77  return 1;
78  }
79  return 0; // AIIIIEEEEE!
80  }
81  }
82  }
83  return 0;
84  }
float K_ESCAPE
Definition: keycodes.qc:9
const int S_SHIFT
Definition: hud.qh:127
entity() spawn
float K_TAB
Definition: keycodes.qc:7
#define SUPER(cname)
Definition: oo.qh:219
#define NULL
Definition: post.qh:17
+ Here is the call graph for this function:

◆ InputContainer_mouseDrag()

float InputContainer_mouseDrag ( entity  me,
vector  pos 
)

Definition at line 104 of file inputcontainer.qc.

References SUPER.

105  {
106  if (SUPER(InputContainer).mouseDrag(me, pos)) return 1;
107  if (pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1) return 1;
108  return 0;
109  }
#define SUPER(cname)
Definition: oo.qh:219

◆ InputContainer_mouseMove()

float InputContainer_mouseMove ( entity  me,
vector  pos 
)

Definition at line 110 of file inputcontainer.qc.

References METHOD, NULL, SUPER, and vector().

111  {
112  if (me.mouseFocusedChild != me.focusedChild) // if the keyboard moved the focus away
113  me.mouseFocusedChild = NULL; // force focusing
114  if (me._changeFocusXY(me, pos))
115  if (SUPER(InputContainer).mouseMove(me, pos)) return 1;
116  if (pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1) return 1;
117  return 0;
118  }
#define SUPER(cname)
Definition: oo.qh:219
#define NULL
Definition: post.qh:17
+ Here is the call graph for this function:

◆ InputContainer_mouseRelease()

float InputContainer_mouseRelease ( entity  me,
vector  pos 
)

Definition at line 127 of file inputcontainer.qc.

References SUPER.

128  {
129  SUPER(InputContainer).mouseRelease(me, pos); // return value?
130  if (me.focused) // am I still eligible for this? (UGLY HACK, but a mouse event could have changed focus away)
131  if (me._changeFocusXY(me, pos)) return 1;
132  if (pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1) return 1;
133  return 0;
134  }
#define SUPER(cname)
Definition: oo.qh:219

◆ InputContainer_resizeNotify()

void InputContainer_resizeNotify ( entity  me,
vector  relOrigin,
vector  relSize,
vector  absOrigin,
vector  absSize 
)

Definition at line 3 of file inputcontainer.qc.

References SUPER.

4  {
5  SUPER(InputContainer).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
6  /*
7  if(me.parent.instanceOfInputContainer)
8  me.isTabRoot = 0;
9  else
10  me.isTabRoot = 1;
11  */
12  }
#define SUPER(cname)
Definition: oo.qh:219