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, TextField, DropDownList and ProgressBar).
Direct Known Subclasses
Instance Attribute Summary collapse
-
#anchor ⇒ Object
readonly
:nodoc:.
-
#anchor_offset_x ⇒ Object
readonly
:nodoc:.
-
#anchor_offset_y ⇒ Object
readonly
:nodoc:.
-
#enabled ⇒ Object
Determines whether the control is enabled, i.e., will process user input.
-
#h ⇒ Object
readonly
The height of the component.
-
#panel ⇒ Object
:nodoc:.
-
#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.).
-
#text ⇒ Object
readonly
The text of the component.
-
#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:.
-
#set_position(x, y) ⇒ Object
Sets the position of the component.
-
#update ⇒ Object
:nodoc:.
Constructor Details
#initialize(x, y, font, text, text_color, disabled_text_color) ⇒ Component
:nodoc:
60 61 62 63 64 65 66 67 68 |
# File 'lib/minigl/forms.rb', line 60 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
#anchor ⇒ Object (readonly)
:nodoc:
43 44 45 |
# File 'lib/minigl/forms.rb', line 43 def anchor @anchor end |
#anchor_offset_x ⇒ Object (readonly)
:nodoc:
43 44 45 |
# File 'lib/minigl/forms.rb', line 43 def anchor_offset_x @anchor_offset_x end |
#anchor_offset_y ⇒ Object (readonly)
:nodoc:
43 44 45 |
# File 'lib/minigl/forms.rb', line 43 def anchor_offset_y @anchor_offset_y end |
#enabled ⇒ Object
Determines whether the control is enabled, i.e., will process user input.
46 47 48 |
# File 'lib/minigl/forms.rb', line 46 def enabled @enabled end |
#h ⇒ Object (readonly)
The height of the component
38 39 40 |
# File 'lib/minigl/forms.rb', line 38 def h @h end |
#panel ⇒ Object
:nodoc:
58 59 60 |
# File 'lib/minigl/forms.rb', line 58 def panel @panel 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.
56 57 58 |
# File 'lib/minigl/forms.rb', line 56 def params @params end |
#text ⇒ Object (readonly)
The text of the component
41 42 43 |
# File 'lib/minigl/forms.rb', line 41 def text @text end |
#visible ⇒ Object
Determines whether the control is visible, i.e., will be drawn in the screen and process user input, if enabled.
50 51 52 |
# File 'lib/minigl/forms.rb', line 50 def visible @visible end |
#w ⇒ Object (readonly)
The width of the component
35 36 37 |
# File 'lib/minigl/forms.rb', line 35 def w @w end |
#x ⇒ Object (readonly)
The horizontal coordinate of the component
29 30 31 |
# File 'lib/minigl/forms.rb', line 29 def x @x end |
#y ⇒ Object (readonly)
The vertical coordinate of the component
32 33 34 |
# File 'lib/minigl/forms.rb', line 32 def y @y end |
Instance Method Details
#set_position(x, y) ⇒ Object
Sets the position of the component. Parameters:
- x
-
The new x coordinate.
- y
-
The new y coordinate.
76 77 78 |
# File 'lib/minigl/forms.rb', line 76 def set_position(x, y) @x = x; @y = y end |
#update ⇒ Object
:nodoc:
70 |
# File 'lib/minigl/forms.rb', line 70 def update; end |