Class: MiniGL::Component
- Inherits:
-
Object
- Object
- MiniGL::Component
- Defined in:
- lib/minigl/forms.rb
Overview
This class is an abstract ancestor for all form components (Button, ToggleButton and TextField).
Direct Known Subclasses
Instance Attribute Summary collapse
-
#enabled ⇒ Object
Determines whether the control is enabled, i.e., will process user input.
-
#h ⇒ Object
readonly
The height of the component.
-
#params ⇒ Object
A container for any parameters to be passed to the code blocks called in response to events of the control (click of a button, change of the text in a text field, etc.).
-
#visible ⇒ Object
Determines whether the control is visible, i.e., will be drawn in the screen and process user input, if enabled.
-
#w ⇒ Object
readonly
The width of the component.
-
#x ⇒ Object
readonly
The horizontal coordinate of the component.
-
#y ⇒ Object
readonly
The vertical coordinate of the component.
Instance Method Summary collapse
-
#initialize(x, y, font, text, text_color, disabled_text_color) ⇒ Component
constructor
:nodoc:.
Constructor Details
#initialize(x, y, font, text, text_color, disabled_text_color) ⇒ Component
:nodoc:
32 33 34 35 36 37 38 39 40 |
# File 'lib/minigl/forms.rb', line 32 def initialize(x, y, font, text, text_color, disabled_text_color) # :nodoc: @x = x @y = y @font = font @text = text @text_color = text_color @disabled_text_color = disabled_text_color @enabled = @visible = true end |
Instance Attribute Details
#enabled ⇒ Object
Determines whether the control is enabled, i.e., will process user input.
20 21 22 |
# File 'lib/minigl/forms.rb', line 20 def enabled @enabled end |
#h ⇒ Object (readonly)
The height of the component
17 18 19 |
# File 'lib/minigl/forms.rb', line 17 def h @h end |
#params ⇒ Object
A container for any parameters to be passed to the code blocks called in response to events of the control (click of a button, change of the text in a text field, etc.). More detail can be found in the constructor for each specific component class.
30 31 32 |
# File 'lib/minigl/forms.rb', line 30 def params @params end |
#visible ⇒ Object
Determines whether the control is visible, i.e., will be drawn in the screen and process user input, if enabled.
24 25 26 |
# File 'lib/minigl/forms.rb', line 24 def visible @visible end |
#w ⇒ Object (readonly)
The width of the component
14 15 16 |
# File 'lib/minigl/forms.rb', line 14 def w @w end |
#x ⇒ Object (readonly)
The horizontal coordinate of the component
8 9 10 |
# File 'lib/minigl/forms.rb', line 8 def x @x end |
#y ⇒ Object (readonly)
The vertical coordinate of the component
11 12 13 |
# File 'lib/minigl/forms.rb', line 11 def y @y end |