Xonotic
modalcontroller.qh
Go to the documentation of this file.
1 #pragma once
2 
3 // modal dialog controller
4 // handles a stack of dialog elements
5 // each element can have one of the following states:
6 // 0: hidden (fading out)
7 // 1: visible (zooming in)
8 // 2: greyed out (inactive)
9 // While an animation is running, no item has focus. When an animation is done,
10 // the topmost item gets focus.
11 // The items are assumed to be added in overlapping order, that is, the lowest
12 // window must get added first.
13 //
14 // Possible uses:
15 // - to control a modal dialog:
16 // - show modal dialog: me.showChild(me, childItem, buttonAbsOrigin, buttonAbsSize, 0) // childItem also gets focus
17 // - dismiss modal dialog: me.hideChild(me, childItem, 0) // childItem fades out and relinquishes focus
18 // - show first screen in m_show: me.hideAll(me, 1); me.showChild(me, me.firstChild, '0 0 0', '0 0 0', 1);
19 // - to show a temporary dialog instead of the menu (teamselect): me.hideAll(me, 1); me.showChild(me, teamSelectDialog, '0 0 0', '0 0 0', 1);
20 // - as a tabbed dialog control:
21 // - to initialize: me.hideAll(me, 1); me.showChild(me, me.firstChild, '0 0 0', '0 0 0', 1);
22 // - to show a tab: me.hideChild(me, currentTab, 0); me.showChild(me, newTab, buttonAbsOrigin, buttonAbsSize, 0);
23 
24 #include "container.qh"
26  METHOD(ModalController, resizeNotify, void(entity, vector, vector, vector, vector));
27  METHOD(ModalController, draw, void(entity));
28  METHOD(ModalController, showChild, void(entity, entity, vector, vector, float));
29  METHOD(ModalController, hideChild, void(entity, entity, float));
30  METHOD(ModalController, hideAll, void(entity, float));
31  METHOD(ModalController, addItem, void(entity, entity, vector, vector, float));
32  METHOD(ModalController, addTab, void(entity, entity, entity));
33 
34  METHOD(ModalController, initializeDialog, void(entity, entity));
35 
36  METHOD(ModalController, switchState, void(entity, entity, float, float));
39  ATTRIB(ModalController, previousButton, entity);
40  ATTRIB(ModalController, fadedAlpha, float, 0.3);
42 
45 .vector origin;
46 .vector size;
47 void TabButton_Click(entity button, entity tab); // assumes a button has set the above fields to its own absolute origin, its size, and the tab to activate
48 void DialogOpenButton_Click(entity button, entity tab); // assumes a button has set the above fields to its own absolute origin, its size, and the tab to activate
49 void DialogOpenButton_Click_withCoords(entity button, entity tab, vector theOrigin, vector theSize);
50 void DialogCloseButton_Click(entity button, entity tab); // assumes a button has set the above fields to the tab to close
float ModalController_state
CLASS(Object) Object
Definition: oo.qh:318
entity() spawn
#define METHOD(cname, name, prototype)
Definition: oo.qh:257
void DialogCloseButton_Click(entity button, entity tab)
#define ATTRIB(...)
Definition: oo.qh:136
void DialogOpenButton_Click(entity button, entity tab)
entity tabSelectingButton
vector(float skel, float bonenum) _skel_get_boneabs_hidden
#define ENDCLASS(cname)
Definition: oo.qh:269
void TabButton_Click(entity button, entity tab)
vector origin
vector size
void DialogOpenButton_Click_withCoords(entity button, entity tab, vector theOrigin, vector theSize)