1#include "item.qh" 2 3#include "item/container.qh" 4#include "item/borderimage.qh" 5 6 METHOD(Item, destroy, void(Item this)) 7 { 8 // free memory associated with this 9 } 10 11 METHOD(Item, relinquishFocus, void(Item this)) 12 { 13 entity par = this.parent; 14 if (!par) return; 15 if (par.instanceOfContainer) par.setFocus(par, NULL); 16 } 17 18 METHOD(Item, resizeNotify, void(Item this, vector relOrigin, vector relSize, vector absOrigin, vector absSize)) 19 { 20 this.origin = absOrigin; 21 this.size = absSize; 22 } 23 24 int autocvar_menu_showboxes; 25 METHOD(Item, draw, void(Item this)) 26 { 27 if (!autocvar_menu_showboxes) return; 28 vector rgb = '1 0 1'; 29 float a = fabs(autocvar_menu_showboxes); 30 31 // don't draw containers and border images 32 if (this.instanceOfContainer || this.instanceOfBorderImage) 33 { 34 rgb = '0 0 0'; 35 a = 0; 36 } 37 38 #if 0 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'; 43 else rgb = '0 0 1'; 44 #endif 45 if (autocvar_menu_showboxes < 0) 46 { 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); 49 } 50 else if (autocvar_menu_showboxes > 0) 51 { 52 draw_Fill('0 0 0', '1 1 0', rgb, a); 53 } 54 } 55 56 METHOD(Item, showNotify, void(Item this)) 57 {} 58 59 METHOD(Item, hideNotify, void(Item this)) 60 {} 61 62 METHOD(Item, keyDown, float(Item this, float scan, float ascii, float shift)) 63 { 64 return 0; // unhandled 65 } 66 67 METHOD(Item, keyUp, float(Item this, float scan, float ascii, float shift)) 68 { 69 return 0; // unhandled 70 } 71 72 METHOD(Item, mouseMove, float(Item this, vector pos)) 73 { 74 return 0; // unhandled 75 } 76 77 METHOD(Item, mousePress, float(Item this, vector pos)) 78 { 79 return 0; // unhandled 80 } 81 82 METHOD(Item, mouseDrag, float(Item this, vector pos)) 83 { 84 return 0; // unhandled 85 } 86 87 METHOD(Item, mouseRelease, float(Item this, vector pos)) 88 { 89 return 0; // unhandled 90 } 91 92 void m_play_focus_sound(); 93 94 METHOD(Item, focusEnter, void(Item this)) 95 { 96 if (this.allowFocusSound) m_play_focus_sound(); 97 } 98 99 METHOD(Item, focusLeave, void(Item this)) 100 {} 101 102 METHOD(Item, toString, string(Item this)) 103 { 104 return string_null; 105 } 106