Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
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 81 of file inputcontainer.qc.

82 {
83 entity e = this.itemFromPoint(this, pos);
84 if (e && !e.focusable) e = NULL;
85 entity prev = this.mouseFocusedChild;
86 this.mouseFocusedChild = e;
87 if (e != prev)
88 {
89 this.setFocus(this, e);
90 if (e && e.instanceOfInputContainer)
91 {
92 e.focusedChild = NULL;
93 e._changeFocusXY(e, globalToBox(pos, e.Container_origin, e.Container_size));
94 }
95 }
96 return true; // have focus
97 }
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
prev
Definition all.qh:71
vector globalToBox(vector v, vector theOrigin, vector theScale)
Definition draw.qc:30
#define NULL
Definition post.qh:14

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

◆ InputContainer_focusLeave()

void InputContainer_focusLeave ( entity me)

Definition at line 9 of file inputcontainer.qc.

10 {
11 SUPER(InputContainer).focusLeave(me);
12 me.mouseFocusedChild = NULL;
13 }
#define SUPER(cname)
Definition oo.qh:231

References entity(), NULL, and SUPER.

◆ InputContainer_keyDown()

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

Definition at line 15 of file inputcontainer.qc.

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

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

◆ InputContainer_mouseDrag()

float InputContainer_mouseDrag ( entity me,
vector pos )

Definition at line 99 of file inputcontainer.qc.

100 {
101 if (SUPER(InputContainer).mouseDrag(me, pos)) return 1;
102 if (pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1) return 1;
103 return 0;
104 }

References entity(), SUPER, and vector.

◆ InputContainer_mouseMove()

float InputContainer_mouseMove ( entity me,
vector pos )

Definition at line 105 of file inputcontainer.qc.

106 {
107 if (me.mouseFocusedChild != me.focusedChild) // if the keyboard moved the focus away
108 me.mouseFocusedChild = NULL; // force focusing
109 if (me._changeFocusXY(me, pos))
110 if (SUPER(InputContainer).mouseMove(me, pos)) return 1;
111 if (pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1) return 1;
112 return 0;
113 }

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

◆ InputContainer_mouseRelease()

float InputContainer_mouseRelease ( entity me,
vector pos )

Definition at line 122 of file inputcontainer.qc.

123 {
124 SUPER(InputContainer).mouseRelease(me, pos); // return value?
125 if (me.focused) // am I still eligible for this? (UGLY HACK, but a mouse event could have changed focus away)
126 if (me._changeFocusXY(me, pos)) return 1;
127 if (pos.x >= 0 && pos.y >= 0 && pos.x < 1 && pos.y < 1) return 1;
128 return 0;
129 }

References entity(), SUPER, and vector.

◆ InputContainer_resizeNotify()

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

Definition at line 3 of file inputcontainer.qc.

4 {
5 SUPER(InputContainer).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
6 //me.isTabRoot = !me.parent.instanceOfInputContainer;
7 }

References entity(), SUPER, and vector.