Class: MiniGL::Component

Inherits:
Object
  • Object
show all
Defined in:
lib/minigl/forms.rb

Overview

This class is an abstract ancestor for all form components (Button, ToggleButton and TextField).

Direct Known Subclasses

Button, DropDownList, ProgressBar, TextField

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#enabledObject

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

#hObject (readonly)

The height of the component



17
18
19
# File 'lib/minigl/forms.rb', line 17

def h
  @h
end

#paramsObject

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

#visibleObject

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

#wObject (readonly)

The width of the component



14
15
16
# File 'lib/minigl/forms.rb', line 14

def w
  @w
end

#xObject (readonly)

The horizontal coordinate of the component



8
9
10
# File 'lib/minigl/forms.rb', line 8

def x
  @x
end

#yObject (readonly)

The vertical coordinate of the component



11
12
13
# File 'lib/minigl/forms.rb', line 11

def y
  @y
end