abstract class Control

Direct Known Subclasses

Defined in:

controls/control.cr

Class Method Summary

Macro Summary

Instance Method Summary

Class Method Detail

def self.name_to_action #

[View source]

Macro Detail

macro action(func) #

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.


[View source]
macro action(key, func) #

[View source]

Instance Method Detail

def add(control, x = 0, y = 0) #

Makes control a child of this one.


[View source]
def 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.


[View source]
def children : Array(Control) #

[View source]
def dirty : Bool #

[View source]
def dirty=(dirty : Bool) #

[View source]
def focus #

called when this control becomes the active control. It will start receiving keystrokes after this point.


[View source]
abstract def focusable? #

if this control can take keyboard input Only frames, screens, and non-interactive elements should return false.


[View source]
def height #

[View source]
def height=(height : Int32 | Nil) #

[View source]
def height? : Int32? #

[View source]
def key(k) #

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.


[View source]
def letter(k) #

processes space and any printable character.


[View source]
def main_window #

[View source]
def main_window=(main_window : Nil | MainWindow) #

[View source]
def main_window? : MainWindow? #

[View source]
def other(k) #

handles keystrokes that aren't explicitly bound.


[View source]
def paint(term) #

[View source]
def parent #

[View source]
def parent=(parent : Control | Nil) #

[View source]
def parent? : Control? #

[View source]
abstract def text #

should return the text to be painted to the screen


[View source]
def user_x : Int32 #

[View source]
def user_y : Int32 #

[View source]
def verify(child) #

pass a child control to this method for verification


[View source]
def width #

[View source]
def width=(width : Int32 | Nil) #

[View source]
def width? : Int32? #

[View source]
def 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.


[View source]
def x #

[View source]
def x=(x : Int32) #

[View source]
def x? : Int32 #

[View source]
def y #

[View source]
def y=(y : Int32) #

[View source]
def y? : Int32 #

[View source]