5 me.enterLieSubitem(me, sub.Container_origin, sub.Container_size, sub.Container_fontscale, sub.Container_alpha);
34 for (e = me.firstChild; e; e = e.nextSibling)
35 if (e.Container_alpha > 0) e.showNotify(e);
41 if (!me.shown)
return;
43 for (e = me.firstChild; e; e = e.nextSibling)
44 if (e.Container_alpha > 0) e.hideNotify(e);
57 other.Container_alpha = theAlpha;
65 for (e = me.firstChild; e; e = e.nextSibling)
69 me.enterLieSubitem(me, o, s, e.(fontScaleField), e.Container_alpha);
76 for (e = me.firstChild; e; e = e.nextSibling)
83 me.enterLieSubitem(me, o, s, e.(fontScaleField), e.Container_alpha);
89 SUPER(
Container).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
101 for (e = me.lastChild; e; e = e.prevSibling)
103 o = e.Container_origin;
104 s = e.Container_size;
105 if (pos.x < o.x)
continue;
106 if (pos.y < o.y)
continue;
107 if (pos.x >= o.x + s.x)
continue;
108 if (pos.y >= o.y + s.y)
continue;
118 me.focusable =
false;
119 for (e = me.firstChild; e; e = e.nextSibling)
121 if (e.focusable) me.focusable =
true;
122 if (e.Container_alpha < 0.003)
124 me.enterSubitem(me, e);
134 me.setFocus(me,
NULL);
144 me.enterSubitem(me, f);
145 r = f.keyUp(f, scan, ascii, shift);
159 me.enterSubitem(me, f);
160 r = f.keyDown(f, scan, ascii, shift);
174 me.enterSubitem(me, f);
175 r = f.mouseMove(f,
globalToBox(pos, f.Container_origin, f.Container_size));
183 entity f = this.focusedChild;
195 if (v.x < 0 || v.x > 1 || v.y < 0 || v.y > 1)
197 bool r = f.mousePress(f, v);
210 me.enterSubitem(me, f);
211 r = f.mouseDrag(f,
globalToBox(pos, f.Container_origin, f.Container_size));
224 me.enterSubitem(me, f);
225 r = f.mouseRelease(f,
globalToBox(pos, f.Container_origin, f.Container_size));
234 me.addItem(me,
other,
'0.5 0.5 0' - 0.5 * theSize, theSize, theAlpha);
239 me.addItem(me,
other,
'1 0.5 0' - 0.5 * theSize, theSize, theAlpha);
244 if (
other.parent)
error(
"Can't add already added item!");
246 if (
other.focusable) me.focusable =
true;
250 theOrigin.x -= 0.5 * (theSize.x - 1);
255 theOrigin.y -= 0.5 * (theSize.y - 1);
258 theOrigin.x =
bound(0, theOrigin.x, 1 - theSize.x);
259 theOrigin.y =
bound(0, theOrigin.y, 1 - theSize.y);
262 other.Container_origin = theOrigin;
263 other.Container_size = theSize;
267 other.Container_alpha = theAlpha;
272 if (l) l.nextSibling =
other;
273 else me.firstChild =
other;
275 other.prevSibling = l;
277 me.lastChild =
other;
282 if (
other.parent != me)
error(
"Can't remove from wrong container!");
284 if (
other.focusable) me.focusable =
false;
289 n =
other.nextSibling;
290 p =
other.prevSibling;
292 if (p) p.nextSibling = n;
293 else me.firstChild = n;
295 if (n) n.prevSibling = p;
296 else me.lastChild = p;
301 if (me.focusedChild ==
other)
return;
305 me.focusedChild.focused =
false;
306 me.focusedChild.focusLeave(me.focusedChild);
307 me.focusedChild =
NULL;
312 if (!me.focused)
error(
"Trying to set focus in a non-focused control!");
316 me.focusedChild = me.savedFocus;
317 me.savedFocus =
NULL;
318 me.focusedChild.focused =
true;
319 me.focusedChild.focusEnter(me.focusedChild);
321 if (me.focusedChild.instanceOfContainer)
322 me.focusedChild.setFocus(me.focusedChild, me.focusedChild.savedFocus);
326 me.focusedChild =
other;
327 me.focusedChild.focused =
true;
328 me.focusedChild.focusEnter(me.focusedChild);
335 me.savedFocus = me.focusedChild;
337 if (me.focusedChild.instanceOfContainer) me.focusedChild.saveFocus(me.focusedChild);
345 if (
other.parent != me)
error(
"Can't move in wrong container!");
347 n =
other.nextSibling;
348 p =
other.prevSibling;
350 if (p) p.nextSibling = n;
351 else me.firstChild = n;
353 if (n) n.prevSibling = p;
354 else me.lastChild = p;
359 else other.nextSibling = me.firstChild;
362 else me.firstChild =
other;
365 else me.lastChild =
other;
375 for (e = me.firstChild; e; e = e.nextSibling)
377 if (e.instanceOfContainer)
379 e2 = e.preferredFocusedGrandChild(e);
381 if (!
best ||
best.preferredFocusPriority < e2.preferredFocusPriority)
best = e2;
384 if (!
best ||
best.preferredFocusPriority < e.preferredFocusPriority)
best = e;
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
virtual void leaveSubitem()
virtual void enterSubitem()
virtual void mousePress()
void Container_resizeNotifyLie(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize,.vector originField,.vector sizeField,.vector fontScaleField)
void Container_saveFocus(entity me)
void Container_resizeNotify(entity me, vector relOrigin, vector relSize, vector absOrigin, vector absSize)
float Container_mouseRelease(entity me, vector pos)
void Container_setFocus(entity me, entity other)
void Container_draw(entity me)
void Container_addItemRightCentered(entity me, entity other, vector theSize, float theAlpha)
void Container_hideNotify(entity me)
void Container_removeItem(entity me, entity other)
void Container_addItem(entity me, entity other, vector theOrigin, vector theSize, float theAlpha)
void Container_leaveSubitem(entity me)
void Container_setAlphaOf(entity me, entity other, float theAlpha)
float Container_keyUp(entity me, float scan, float ascii, float shift)
float Container_mouseDrag(entity me, vector pos)
entity Container_itemFromPoint(entity me, vector pos)
void Container_enterSubitem(entity me, entity sub)
void Container_showNotify(entity me)
float Container_keyDown(entity me, float scan, float ascii, float shift)
void Container_moveItemAfter(entity me, entity other, entity dest)
void Container_addItemCentered(entity me, entity other, vector theSize, float theAlpha)
entity Container_preferredFocusedGrandChild(entity me)
void Container_enterLieSubitem(entity me, vector o, vector s, vector f, float a)
float Container_mouseMove(entity me, vector pos)
void Container_focusLeave(entity me)
vector Container_fontscale
#define METHOD(cname, name, prototype)