]> icculus.org git repositories - divverent/nexuiz.git/blob - data/source/system/item.qh
restructure
[divverent/nexuiz.git] / data / source / system / item.qh
1 // DP/Nex Menu
2 // system/item.qh
3
4 enumflags {
5         RUNFLAG_TEMPLATE,
6
7         RUNFLAG_HADMOUSE,
8         RUNFLAG_MOUSEINAREA,
9
10         RUNFLAG_CHILDDRAWONLY,
11         RUNFLAG_CHILDDRAWUPDATEONLY,
12
13         RUNFLAG_HIDDEN,
14         RUNFLAG_CLIPPED,        // used to distinguish between intentionally hidden and casaully hidden
15         RUNFLAG_NOSELECT,
16
17         RUNFLAG_USERSELECT,
18
19         RUNFLAG_DELETEFRAME,
20         RUNFLAG_DELETETOGGLE,
21
22         RUNFLAG_SPAWNED         // set after the spawn function has been called
23 };
24
25 typedef void() event;
26 typedef bool(float,float) keyEvent;
27 typedef void(bool,bool) selectEvent;
28
29 ///////////
30 // [Item] fields
31 ///
32
33 .entity chain;
34
35 // controly type
36 .string type;
37
38 // managing stuff
39 .entity _parent;
40 .string parent;
41
42 //.entity _history;     // used to set up the history -> selectdown prefers _history over _parent
43
44 .string name;
45
46 .entity _next, _prev;           // point to the next, respectively, the previous item
47
48 .entity _child;                 // points to the first child
49
50 // updating stuff
51 .float orderPos;        // if FLAG_NOSELECT or FLAG_HIDDEN is set, it cant be selected
52                                         // has to be set always to a correct value or to 0 then it is set
53 .float flag;
54 .float _runFlag;
55
56 // drawing
57 .vector pos;
58 .vector size;
59
60 .vector origin;
61
62 // event cache fields
63 .vector _cache_origin;
64 .vector _cache_clip_pos;
65 .vector _cache_clip_size;
66
67 // function pointers
68 .event init;    // called once at object creation
69 .event reinit;
70 .event destroy;
71 .event mouseEnter;
72 .event mouseLeave;
73 .event update;
74 .selectEvent select;
75 .event action;
76 .event draw;
77 .keyEvent key; // if it returns TRUE, the key was processed by the function
78
79 // hidden function pointers - actually these are called by the manager
80 // and they call the normal ones (used to make controls more generic
81 .event _reinit; // called in performreinit
82 .event _destroy;        // called when the item is removed -> menu_removeitem
83 .event _mouseEnter;
84 .event _mouseLeave;
85 .event _update;
86 .selectEvent _select;
87 .event _draw;
88 .keyEvent _key;
89
90 /////////////////////
91 // Helper Functions
92 ///
93
94 // default control functions - assign only to the _* event functions
95 // (assigning to the 'normal' event functions will crash the vm !)
96 // are used by ITEM_CUSTOM and can be used to test new ITEMs easily
97 void()  DefCt_Reinit;
98 void()  DefCt_Destroy;
99 bool( float pKey, float pAscii )  DefCt_Key;
100 void()  DefCt_Draw;
101 void()  DefCt_MouseEnter;
102 void()  DefCt_MouseLeave;
103 void()  DefCt_Update;
104 void( bool pSelect, bool pUser )  DefCt_Select;
105
106 // use this to raise an event from another item or function
107 void( entity pEntity ) Raise_Reinit;
108 void( entity pEntity ) Raise_Destroy;
109 bool( entity pEntity, float pKey, float pAscii)  Raise_Key;
110 void( entity pEntity ) Raise_Draw;
111 void( entity pEntity ) Raise_MouseEnter;
112 void( entity pEntity ) Raise_MouseLeave;
113 void( entity pEntity ) Raise_Update;
114 void( entity pEntity, bool pSelect, bool pUser ) Raise_Select;
115
116 // safe call the event control functions (only used by the mcontrols function)
117 void()  CtCall_Init;
118 void()  CtCall_Reinit;
119 void()  CtCall_Destroy;
120 bool( float pKey, float pAscii)  CtCall_Key;
121 void()  CtCall_Draw;
122 void()  CtCall_MouseEnter;
123 void()  CtCall_MouseLeave;
124 void()  CtCall_Action;
125 void()  CtCall_Update;
126 void( bool pSelect, bool pUser )  CtCall_Select;