6 METHOD(Item, draw, void(Item));
7 METHOD(Item, keyDown, float(Item, float, float, float));
8 METHOD(Item, keyUp, float(Item, float, float, float));
9 METHOD(Item, mouseMove, float(Item, vector));
10 METHOD(Item, mousePress, float(Item, vector));
11 METHOD(Item, mouseDrag, float(Item, vector));
12 METHOD(Item, mouseRelease, float(Item, vector));
13 METHOD(Item, focusEnter, void(Item));
14 METHOD(Item, focusLeave, void(Item));
15 METHOD(Item, resizeNotify, void(Item, vector, vector, vector, vector));
16 METHOD(Item, relinquishFocus, void(Item));
17 METHOD(Item, showNotify, void(Item));
18 METHOD(Item, hideNotify, void(Item));
19 METHOD(Item, toString, string(Item));
20 METHOD(Item, destroy, void(Item));
21 ATTRIB(Item, focused, float, 0)
22 ATTRIB(Item, focusable, float, 0)
23 ATTRIB(Item, allowFocusSound, float, 0)
24 ATTRIB(Item, parent, entity, NULL)
25 ATTRIB(Item, preferredFocusPriority, float, 0)
26 ATTRIB(Item, origin, vector, '0 0 0')
27 ATTRIB(Item, size, vector, '0 0 0')
28 ATTRIB(Item, tooltip, string, string_null)
33 METHOD(Item, destroy, void(Item this))
35 // free memory associated with this
38 METHOD(Item, relinquishFocus, void(Item this))
40 entity par = this.parent;
42 if (par.instanceOfContainer) par.setFocus(par, NULL);
45 METHOD(Item, resizeNotify, void(Item this, vector relOrigin, vector relSize, vector absOrigin, vector absSize))
47 this.origin = absOrigin;
51 int autocvar_menu_showboxes;
52 METHOD(Item, draw, void(Item this))
54 if (!autocvar_menu_showboxes) return;
56 float a = fabs(autocvar_menu_showboxes);
58 // don't draw containers and border images
59 if (this.instanceOfContainer || this.instanceOfBorderImage)
66 // hack to detect multi drawing
67 float r = random() * 3;
68 if (r >= 2) rgb = '1 0 0';
69 else if (r >= 1) rgb = '0 1 0';
72 if (autocvar_menu_showboxes < 0)
74 draw_Fill('0 0 0', '0.5 0.5 0', rgb, a);
75 draw_Fill('0.5 0.5 0', '0.5 0.5 0', rgb, a);
77 else if (autocvar_menu_showboxes > 0)
79 draw_Fill('0 0 0', '1 1 0', rgb, a);
83 METHOD(Item, showNotify, void(Item this))
86 METHOD(Item, hideNotify, void(Item this))
89 METHOD(Item, keyDown, float(Item this, float scan, float ascii, float shift))
91 return 0; // unhandled
94 METHOD(Item, keyUp, float(Item this, float scan, float ascii, float shift))
96 return 0; // unhandled
99 METHOD(Item, mouseMove, float(Item this, vector pos))
101 return 0; // unhandled
104 METHOD(Item, mousePress, float(Item this, vector pos))
106 return 0; // unhandled
109 METHOD(Item, mouseDrag, float(Item this, vector pos))
111 return 0; // unhandled
114 METHOD(Item, mouseRelease, float(Item this, vector pos))
116 return 0; // unhandled
119 METHOD(Item, focusEnter, void(Item this))
121 if (this.allowFocusSound) m_play_focus_sound();
124 METHOD(Item, focusLeave, void(Item this))
127 METHOD(Item, toString, string(Item this))