]> icculus.org git repositories - divverent/nexuiz.git/blob - data/menuqc/system/history.qc
give menu source its own directory
[divverent/nexuiz.git] / data / menuqc / system / history.qc
1 // DP/Nex menu
2 // system/history.qc
3
4
5 /*
6 ===================
7 Menu_History_Push
8 ===================
9 */
10 void( entity pEntity, Menu_History_PopFunction pPopFunction ) Menu_History_Push =
11 {
12         local entity lHistory;
13
14         Menu_KeyHook = Util_NullFunction;
15
16         lHistory = spawn();
17
18         lHistory.type = "MMANAGER_HISTORY";
19         lHistory._prev = Menu_History;
20         lHistory._child = Menu_ActiveItem;
21         lHistory._parent = Menu_ActiveWindow;
22         lHistory._next = pEntity; // "used for"
23         lHistory._destroy = pPopFunction;
24
25         Menu_History = lHistory;
26 };
27
28 /*
29 ===================
30 Menu_History_Pop
31 ===================
32 */
33 void() Menu_History_Pop =
34 {
35         local entity lTemp;
36
37         if( Menu_History == null_entity )
38                 return;
39
40         Menu_KeyHook = Util_NullFunction;
41
42         Menu_ActiveItem = Menu_History._child;
43         Menu_ActiveWindow = Menu_History._parent;
44
45         lTemp = Menu_History;
46         // FIXME: use Menu_DestroyItem
47         Raise_Destroy( lTemp );
48         Menu_History = Menu_History._prev;
49         remove( lTemp );
50 };
51
52 /*
53 ===================
54 Menu_History_Verify
55 ===================
56 */
57 bool( entity pEntity ) Menu_History_Verify =
58 {
59         if( Menu_History == null_entity )
60                 return false;
61
62         if( Menu_History._next == pEntity )
63                 return true;
64         return false;
65 };
66
67 /*
68 ===================
69 Menu_History_Clear
70 ===================
71 */
72 void() Menu_History_Clear =
73 {
74         local entity lEntity;
75
76         lEntity = null_entity;
77         while( ( lEntity = findstring( lEntity, type, "MMANAGER_HISTORY" ) ) != null_entity)
78                 remove( lEntity );
79
80         Menu_History = null_entity;
81 };