2 CLASS(InputContainer) EXTENDS(Container)
3 METHOD(InputContainer, keyDown, float(entity, float, float, float))
4 METHOD(InputContainer, mouseMove, float(entity, vector))
5 METHOD(InputContainer, mousePress, float(entity, vector))
6 METHOD(InputContainer, mouseRelease, float(entity, vector))
7 METHOD(InputContainer, mouseDrag, float(entity, vector))
8 METHOD(InputContainer, focusLeave, void(entity))
9 METHOD(InputContainer, resizeNotify, void(entity, vector, vector, vector, vector))
11 METHOD(InputContainer, _changeFocusXY, float(entity, vector))
12 ATTRIB(InputContainer, mouseFocusedChild, entity, NULL)
13 ATTRIB(InputContainer, isTabRoot, float, 0)
14 ENDCLASS(InputContainer)
18 void resizeNotifyInputContainer(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
20 resizeNotifyContainer(me, relOrigin, relSize, absOrigin, absSize);
22 if(me.parent.instanceOfInputContainer)
29 void focusLeaveInputContainer(entity me)
31 focusLeaveContainer(me);
32 me.mouseFocusedChild = NULL;
35 float keyDownInputContainer(entity me, float scan, float ascii, float shift)
38 if(keyDownContainer(me, scan, ascii, shift))
45 me.setFocus(me, NULL);
57 for(ff = f.prevSibling; ff; ff = ff.prevSibling)
65 if(!f || me.isTabRoot)
67 for(ff = me.lastChild; ff; ff = ff.prevSibling)
74 return 0; // AIIIIEEEEE!
81 for(ff = f.nextSibling; ff; ff = ff.nextSibling)
89 if(!f || me.isTabRoot)
91 for(ff = me.firstChild; ff; ff = ff.nextSibling)
98 return 0; // AIIIIEEEEE!
105 float _changeFocusXYInputContainer(entity me, vector pos)
108 e = me.mouseFocusedChild;
109 ne = me.itemFromPoint(me, pos);
113 me.mouseFocusedChild = ne;
118 if(ne.instanceOfInputContainer)
120 ne.focusedChild = NULL;
121 ne._changeFocusXY(e, globalToBox(pos, ne.Container_origin, ne.Container_size));
127 float mouseDragInputContainer(entity me, vector pos)
129 if(mouseDragContainer(me, pos))
131 if(pos_x >= 0 && pos_y >= 0 && pos_x < 1 && pos_y < 1)
135 float mouseMoveInputContainer(entity me, vector pos)
137 if(me._changeFocusXY(me, pos))
138 if(mouseMoveContainer(me, pos))
140 if(pos_x >= 0 && pos_y >= 0 && pos_x < 1 && pos_y < 1)
144 float mousePressInputContainer(entity me, vector pos)
146 me.mouseFocusedChild = NULL; // force focusing
147 if(me._changeFocusXY(me, pos))
148 if(mousePressContainer(me, pos))
150 if(pos_x >= 0 && pos_y >= 0 && pos_x < 1 && pos_y < 1)
154 float mouseReleaseInputContainer(entity me, vector pos)
157 r = mouseReleaseContainer(me, pos);
158 if(me.focused) // am I still eligible for this? (UGLY HACK, but a mouse event could have changed focus away)
159 if(me._changeFocusXY(me, pos))
161 if(pos_x >= 0 && pos_y >= 0 && pos_x < 1 && pos_y < 1)