1 /** 2 * @class gui 3 * @extends component 4 * @description 5 * A component that provides managed input interaction suitable for 6 * making things like buttons, text boxes, etc. 7 * 8 * Known {@link component} events:</br> 9 * <pre> 10 * - "on-click" 11 * - "on-enter" 12 * - "on-leave" 13 * - "on-drag" 14 * - "on-focus" 15 * - "on-unfocus" 16 * </pre> 17 * 18 * 19 */ 20 function gui() { 21 22 /** 23 * Attempts to grab the input focus for this GUI. 24 * 25 * If a GUI grabs the input focus, other GUI's will not have input events pushed 26 * to them. See {@link sandboxe.gui.ungrabInput} to ungab input from all gui objects globally. 27 */ 28 this.grabInput = function(){}; 29 30 /** 31 * Sets this GUI to be the focused widget. 32 * 33 * Focusing has no inate effect on the GUI except for the return values 34 * from the focus-related set of properties and events. 35 */ 36 this.setFocus = function(){}; 37 38 39 40 41 42 /** 43 * The text to appear above a widget if the mouse hovers over it. 44 * @type {String} 45 */ 46 this.tooltipText = 0.0; 47 48 /** 49 * The width of the gui in 2D coordinates. 50 * @type {Number} 51 */ 52 this.width = 0.0; 53 54 /** 55 * The height of the gui in 2D coordinates. 56 * @type {Number} 57 */ 58 this.height = 0.0; 59 60 /** 61 * Whether the gui is focused. This property is read-only. 62 * @type {Boolean} 63 */ 64 this.focused = false; 65 66 /** 67 * Whether the pointer is hovered over the gui's region. This property is read-only. 68 * @type {Boolean} 69 */ 70 this.hovered = false; 71 72 /** 73 * Whether the pointer clicked in this gui's rectangular region. The property is read-only. 74 * @type {Number} 75 */ 76 this.clicked = false; 77 78 /** 79 * Returns whether the user is attempting to drag this gui. 80 * @type {Boolean} 81 */ 82 this.beingDragged = false; 83 84 /** 85 * The local node of this component. 86 * @type {transform} 87 */ 88 this.node = {}; 89 90 91 92 93 return this; 94 } 95