-#ifdef INTERFACE
-CLASS(Container) EXTENDS(Item)
- METHOD(Container, draw, void(entity))
- METHOD(Container, keyUp, float(entity, float, float, float))
- METHOD(Container, keyDown, float(entity, float, float, float))
- METHOD(Container, mouseMove, float(entity, vector))
- METHOD(Container, mousePress, float(entity, vector))
- METHOD(Container, mouseDrag, float(entity, vector))
- METHOD(Container, mouseRelease, float(entity, vector))
- METHOD(Container, focusLeave, void(entity))
- METHOD(Container, resizeNotify, void(entity, vector, vector, vector, vector))
- METHOD(Container, resizeNotifyLie, void(entity, vector, vector, vector, vector, .vector, .vector, .vector))
- METHOD(Container, addItem, void(entity, entity, vector, vector, float))
- METHOD(Container, addItemCentered, void(entity, entity, vector, float))
- METHOD(Container, moveItemAfter, void(entity, entity, entity))
- METHOD(Container, removeItem, void(entity, entity))
- METHOD(Container, setFocus, void(entity, entity))
- METHOD(Container, saveFocus, void(entity))
- METHOD(Container, setAlphaOf, void(entity, entity, float))
- METHOD(Container, itemFromPoint, entity(entity, vector))
- METHOD(Container, showNotify, void(entity))
- METHOD(Container, hideNotify, void(entity))
- METHOD(Container, preferredFocusedGrandChild, entity(entity))
- ATTRIB(Container, focusable, float, 0)
- ATTRIB(Container, firstChild, entity, NULL)
- ATTRIB(Container, lastChild, entity, NULL)
- ATTRIB(Container, focusedChild, entity, NULL)
- ATTRIB(Container, savedFocus, entity, NULL)
- ATTRIB(Container, shown, float, 0)
-
- METHOD(Container, enterSubitem, void(entity, entity))
- METHOD(Container, enterLieSubitem, void(entity, vector, vector, vector, float))
- METHOD(Container, leaveSubitem, void(entity))
-ENDCLASS(Container)
-.entity nextSibling;
-.entity prevSibling;
-.float resized;
-.vector Container_origin;
-.vector Container_size;
-.vector Container_fontscale;
-.float Container_alpha;
-.vector Container_save_shift;
-.vector Container_save_scale;
-.vector Container_save_fontscale;
-.float Container_save_alpha;
-#endif
-
-#ifdef IMPLEMENTATION
-void Container_enterSubitem(entity me, entity sub)
-{
- me.enterLieSubitem(me, sub.Container_origin, sub.Container_size, sub.Container_fontscale, sub.Container_alpha);
-}
-
-void Container_enterLieSubitem(entity me, vector o, vector s, vector f, float a)
-{
- me.Container_save_shift = draw_shift;
- me.Container_save_scale = draw_scale;
- me.Container_save_alpha = draw_alpha;
- me.Container_save_fontscale = draw_fontscale;
-
- draw_shift = boxToGlobal(o, draw_shift, draw_scale);
- draw_scale = boxToGlobalSize(s, draw_scale);
- if(f != '0 0 0')
- draw_fontscale = boxToGlobalSize(f, draw_fontscale);
- draw_alpha *= a;
-}
-
-void Container_leaveSubitem(entity me)
-{
- draw_shift = me.Container_save_shift;
- draw_scale = me.Container_save_scale;
- draw_alpha = me.Container_save_alpha;
- draw_fontscale = me.Container_save_fontscale;
-}
-
-void Container_showNotify(entity me)
-{
- entity e;
- if(me.shown)
- return;
- me.shown = 1;
- for(e = me.firstChild; e; e = e.nextSibling)
- if(e.Container_alpha > 0)
- e.showNotify(e);
-}
-
-void Container_hideNotify(entity me)
-{
- entity e;
- if (!me.shown)
- return;
- me.shown = 0;
- for(e = me.firstChild; e; e = e.nextSibling)
- if(e.Container_alpha > 0)
- e.hideNotify(e);
-}
-
-void Container_setAlphaOf(entity me, entity other, float theAlpha)
-{
- if(theAlpha <= 0)