3 #include "item/container.qh"
4 #include "item/borderimage.qh"
6 METHOD(MenuItem, destroy, void(MenuItem this))
8 // free memory associated with this
11 METHOD(MenuItem, relinquishFocus, void(MenuItem this))
13 entity par = this.parent;
15 if (par.instanceOfContainer) par.setFocus(par, NULL);
18 METHOD(MenuItem, resizeNotify, void(MenuItem this, vector relOrigin, vector relSize, vector absOrigin, vector absSize))
20 this.origin = absOrigin;
24 int autocvar_menu_showboxes;
25 METHOD(MenuItem, draw, void(MenuItem this))
27 if (!autocvar_menu_showboxes) return;
29 float a = fabs(autocvar_menu_showboxes);
31 // don't draw containers and border images
32 if (this.instanceOfContainer || this.instanceOfBorderImage)
39 // hack to detect multi drawing
40 float r = random() * 3;
41 if (r >= 2) rgb = '1 0 0';
42 else if (r >= 1) rgb = '0 1 0';
45 if (autocvar_menu_showboxes < 0)
47 draw_Fill('0 0 0', '0.5 0.5 0', rgb, a);
48 draw_Fill('0.5 0.5 0', '0.5 0.5 0', rgb, a);
50 else if (autocvar_menu_showboxes > 0)
52 draw_Fill('0 0 0', '1 1 0', rgb, a);
56 METHOD(MenuItem, showNotify, void(MenuItem this))
59 METHOD(MenuItem, hideNotify, void(MenuItem this))
62 METHOD(MenuItem, keyDown, float(MenuItem this, float scan, float ascii, float shift))
64 return 0; // unhandled
67 METHOD(MenuItem, keyUp, float(MenuItem this, float scan, float ascii, float shift))
69 return 0; // unhandled
72 METHOD(MenuItem, mouseMove, float(MenuItem this, vector pos))
74 return 0; // unhandled
77 METHOD(MenuItem, mousePress, bool(MenuItem this, vector pos))
79 return false; // unhandled
82 METHOD(MenuItem, mouseDrag, float(MenuItem this, vector pos))
84 return 0; // unhandled
87 METHOD(MenuItem, mouseRelease, float(MenuItem this, vector pos))
89 return 0; // unhandled
92 void m_play_focus_sound();
94 METHOD(MenuItem, focusEnter, void(MenuItem this))
96 if (this.allowFocusSound) m_play_focus_sound();
99 METHOD(MenuItem, focusLeave, void(MenuItem this))
102 METHOD(MenuItem, toString, string(MenuItem this))