abstract class Control
- Control
- Reference
- Object
Direct Known Subclasses
Defined in:
controls/control.crClass Method Summary
Macro Summary
-
action(func)
writing action def name...
- action(key, func)
Instance Method Summary
-
#add(control, x = 0, y = 0)
Makes control a child of this one.
-
#bind_keys
For each bindable function, aka action, if that action exists in the keymap, associate the keymap's key with that action for this specific control.
- #children : Array(Control)
- #dirty : Bool
- #dirty=(dirty : Bool)
-
#focus
called when this control becomes the active control.
-
#focusable?
if this control can take keyboard input Only frames, screens, and non-interactive elements should return false.
- #height
- #height=(height : Int32 | Nil)
- #height? : Int32?
-
#key(k)
by default, key assumes any key press will cause the control to change state.
-
#letter(k)
processes space and any printable character.
- #main_window
- #main_window=(main_window : Nil | MainWindow)
- #main_window? : MainWindow?
-
#other(k)
handles keystrokes that aren't explicitly bound.
- #paint(term)
- #parent
- #parent=(parent : Control | Nil)
- #parent? : Control?
-
#text
should return the text to be painted to the screen
- #user_x : Int32
- #user_y : Int32
-
#verify(child)
pass a child control to this method for verification
- #width
- #width=(width : Int32 | Nil)
- #width? : Int32?
-
#wip_verify_no_overlap
will verify that none of the four corners of new child overlap with an existing child, and that no existing child overlaps any of it's 4 corners with new child.
- #x
- #x=(x : Int32)
- #x? : Int32
- #y
- #y=(y : Int32)
- #y? : Int32
Class Method Detail
Macro Detail
writing action def name... creates an action that can be bound to a key we have this macro include itself again below so that the action gets copy-and-pasted to each subclass. because class vars aren't singletons, subclassing a control removes all action bindings from the subclassed control by default. This undo's that removal.
Instance Method Detail
For each bindable function, aka action, if that action exists in the keymap, associate the keymap's key with that action for this specific control.
called when this control becomes the active control. It will start receiving keystrokes after this point.
if this control can take keyboard input Only frames, screens, and non-interactive elements should return false.
by default, key assumes any key press will cause the control to change state. If you e.g. are at the top of a list, and attempt a prev_item action, the code for prev_action must explicitly set @dirty to false to prevent extraneous repaints. This is purposefully done for developer productivity.
will verify that none of the four corners of new child overlap with an existing child, and that no existing child overlaps any of it's 4 corners with new child.