Class Control
A control class
Usage:
c = Control!
Functions
control.getMixinsClass (control) | get the class where mixins can be inserted. |
Tables
control.boxOverrides | list of functions to override when boundingbox is of type Box. |
control.circleOverrides | list of functions to override when boundingbox is of type Circle. |
control.polyOverrides | list of functions to override when boundingbox is of type Polygon. |
Methods
control\new (boxT, __name) | constructor. |
control\getId () | gets control id |
control\getRoot () | getter for the root control. |
control\getBoundingBox () | getter for the boundingbox. |
control\localToGlobal (x, y) | converts a local position to window position. |
control\globalToLocal (x, y) | converts a window position to local position. |
control\setParent (p) | setter for the content parent. |
control\getParent () | getter for the content parent. |
control\addChild (child, depth) | attach a a child to the content entity. |
control\setAnchor (x, y) | setter for the content anchor. |
control\getAnchor () | getter for the content anchor. |
control\setAnchorX (x) | setter for the content anchorX. |
control\getAnchorX () | getter for the content anchorX. |
control\setAnchorY (y) | setter for the content anchorY. |
control\getAnchorY () | getter for the content anchorY. |
control\setPosition (x, y) | setter for the content position. |
control\getPosition () | getter for the content position. |
control\setX (x) | setter for the content x position. |
control\getX () | getter for the content x position. |
control\setY (y) | setter for the content y position. |
control\getY () | getter for the content y position. |
control\getSize () | getter for the control size. |
control\getWidth () | getter for the control width. |
control\getHeight () | getter for the control height. |
control\setWidth (w) | setter for the content width. |
control\setHeight (h) | setter for the content height. |
control\setSize (width, height) | setter for the control size. |
control\setEnabled (enabled) | setter for the control enabled property. |
control\isEnabled () | getter for the control enabled property. |
control\setChildrenEnabled (enabled) | setter for the control childrenEnabled property. |
control\isChildrenEnabled () | getter for the control childrenEnabled property. |
control\setDepth (depth) | setter for the control depth property. |
control\getDepth () | getter for the control depth. |
control\removeChild (id) | remove an attached child. |
control\dropChildren () | drops the control children. |
control\disableChildren () | disables the control children. |
control\enableChildren () | enables the control children. |
control\on (event, callback, target) | attaches a handler to an event. |
control\update (dt) | updates the ROOT. |
control\setVisible (bool) | sets visible. |
control\getVisible () | getter for visible property. |
control\draw () | draws the control. |
control\setUpdateWhenFocused (updateWhenFocused) | sets updateWhenFocused (if true the UI_UPDATE event will be triggred when the control is clicked.). |
control\setLabel (l) | sets control label (Mainly for debug) |
control\getLabel () | gets control label (Mainly for debug) |
control\setNotifyParent (bool) | sets notifyParent |
control\getNotifyParent (bool) | gets notifyParent |
Functions
- control.getMixinsClass (control)
-
get the class where mixins can be inserted.
Parameters:
- control
Returns:
-
table
{mixinTable, boolean(If mixin class was created)}
Tables
- control.boxOverrides
- list of functions to override when boundingbox is of type Box.
- control.circleOverrides
- list of functions to override when boundingbox is of type Circle.
- control.polyOverrides
- list of functions to override when boundingbox is of type Polygon.
Methods
- control\new (boxT, __name)
-
constructor.
Parameters:
- control\getId ()
-
gets control id
Returns:
-
string
id
- control\getRoot ()
-
getter for the root control.
Returns:
-
Control
root
- control\getBoundingBox ()
-
getter for the boundingbox.
Returns:
-
table
boundingBox
- control\localToGlobal (x, y)
-
converts a local position to window position.
Parameters:
- x number
- y number
Returns:
-
table
boundingBox
- control\globalToLocal (x, y)
-
converts a window position to local position.
Parameters:
- x number
- y number
Returns:
-
table
boundingBox
- control\setParent (p)
-
setter for the content parent.
Parameters:
- p Content
- control\getParent ()
-
getter for the content parent.
Returns:
-
Content
p
- control\addChild (child, depth)
-
attach a a child to the content entity.
Parameters:
- child Content
- depth number
- control\setAnchor (x, y)
-
setter for the content anchor.
Parameters:
- x number
- y number
- control\getAnchor ()
-
getter for the content anchor.
Returns:
-
table
anchor
- control\setAnchorX (x)
-
setter for the content anchorX.
Parameters:
- x number
- control\getAnchorX ()
-
getter for the content anchorX.
Returns:
-
number
anchorX
- control\setAnchorY (y)
-
setter for the content anchorY.
Parameters:
- y number
- control\getAnchorY ()
-
getter for the content anchorY.
Returns:
-
number
anchorY
- control\setPosition (x, y)
-
setter for the content position.
Parameters:
- x number
- y number
- control\getPosition ()
-
getter for the content position.
Returns:
-
table
position
- control\setX (x)
-
setter for the content x position.
Parameters:
- x number
- control\getX ()
-
getter for the content x position.
Returns:
-
number
x
- control\setY (y)
-
setter for the content y position.
Parameters:
- y number
- control\getY ()
-
getter for the content y position.
Returns:
-
number
y
- control\getSize ()
-
getter for the control size.
Returns:
- control\getWidth ()
-
getter for the control width.
Returns:
-
number
- control\getHeight ()
-
getter for the control height.
Returns:
-
number
- control\setWidth (w)
-
setter for the content width.
Parameters:
- w number
- control\setHeight (h)
-
setter for the content height.
Parameters:
- h number
- control\setSize (width, height)
-
setter for the control size.
Parameters:
- width number
- height number
- control\setEnabled (enabled)
-
setter for the control enabled property.
Parameters:
- enabled boolean
- control\isEnabled ()
-
getter for the control enabled property.
Returns:
-
boolean
enabled
- control\setChildrenEnabled (enabled)
-
setter for the control childrenEnabled property.
Parameters:
- enabled boolean
- control\isChildrenEnabled ()
-
getter for the control childrenEnabled property.
Returns:
-
boolean
childrenEnabled
- control\setDepth (depth)
-
setter for the control depth property.
Parameters:
- depth number
- control\getDepth ()
-
getter for the control depth.
Returns:
-
number
depth
- control\removeChild (id)
-
remove an attached child.
Parameters:
- id number
- control\dropChildren ()
- drops the control children.
- control\disableChildren ()
- disables the control children.
- control\enableChildren ()
- enables the control children.
- control\on (event, callback, target)
-
attaches a handler to an event.
Parameters:
- event
- callback
- target
See also:
- control\update (dt)
-
updates the ROOT.
the root is the only ctrl that should be calling this method.
The Conform method will take care of the rest.
Parameters:
- dt number
- control\setVisible (bool)
-
sets visible.
Parameters:
- bool boolean
- control\getVisible ()
-
getter for visible property.
Returns:
-
boolean
visible
- control\draw ()
- draws the control.
- control\setUpdateWhenFocused (updateWhenFocused)
-
sets updateWhenFocused (if true the UI_UPDATE event will be triggred when the control is clicked.).
Parameters:
- updateWhenFocused boolean
- control\setLabel (l)
-
sets control label (Mainly for debug)
Parameters:
- l string
- control\getLabel ()
-
gets control label (Mainly for debug)
Returns:
-
string
l
- control\setNotifyParent (bool)
-
sets notifyParent
Parameters:
- bool bool
- control\getNotifyParent (bool)
-
gets notifyParent
Parameters:
- bool bool