Class: GlimR::CheckboxButton
- Inherits:
-
EmptyButton
- Object
- SceneObject
- Model
- Widget
- EmptyButton
- GlimR::CheckboxButton
- Defined in:
- lib/glimr/widgets/checkbox.rb
Direct Known Subclasses
Constant Summary
Constants included from Layoutable
Instance Attribute Summary collapse
-
#state ⇒ Object
Returns the value of attribute state.
Attributes inherited from EmptyButton
#background, #cover, #down, #down_background, #down_cover, #hover_indicator, #label, #up_background, #up_cover
Attributes inherited from Widget
Attributes included from Layoutable
Attributes inherited from Model
#geometry, #material, #shader, #texture, #transform
Attributes inherited from SceneObject
#children, #drawables, #mtime, #parent, #viewport
Attributes included from EventListener
#event_listeners, #listener_count
Instance Method Summary collapse
- #activate(o, e) ⇒ Object
- #default_config ⇒ Object
-
#initialize(*a, &b) ⇒ CheckboxButton
constructor
A new instance of CheckboxButton.
- #toggle ⇒ Object
Methods inherited from EmptyButton
#button_down, #button_up, #focus_indicator=, #focused=, #key_down, #key_up, #label_model=, #load_image, load_image, #mouse_down, #mouse_out, #mouse_over, #mouse_up
Methods inherited from Widget
#blur, #click, #focus, for, #key_down, #key_up, #lock, #mouse_down, #mouse_move, #mouse_out, #mouse_over, #mouse_up, #unlock
Methods included from Layoutable
#attach, #children_change, #constant_size?, #detach, #expand!, #expand?, #expand_height, #expand_to_max_height!, #expand_to_max_width!, #expand_width, #fit_height!, #fit_to_children!, #fit_width!, #free_height, #free_width, #full_depth, #full_height, #full_width, #inner_depth, #inner_height, #inner_width, #inspect, #layout, #layoutable_children, #margin, #margin=, #max_height=, #max_width=, #min_height=, #min_width=, #padding, #padding=, #parent=, #size_changing, size_changing_accessor, #tell_children_of_size_change, #x=, #y=
Methods inherited from Model
#absolute_transform, #apply, #inspect, #pop_state, #push_state
Methods inherited from SceneObject
#<<, #absolute_geometry, #absolute_material, #absolute_shader, #absolute_texture, #absolute_transform, #absolute_transform_for_drawing, #add_drawables, #apply, #attach, #clone, #detach, #detach_self, #inspect, #pop_state, #push_state, #remove_drawables, #render, #replace_node, #root, #touch!, #visible
Methods included from EventListener
#add_event_listener, #decrement_listener_count, #dispatch_event, #event_root, #increment_listener_count, #method_missing, #multicast_event, #process_event, #remove_event_listener
Constructor Details
#initialize(*a, &b) ⇒ CheckboxButton
Returns a new instance of CheckboxButton.
54 55 56 57 58 59 60 |
# File 'lib/glimr/widgets/checkbox.rb', line 54 def initialize(*a, &b) super if @state @state = false self.state = true end end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class GlimR::EventListener
Instance Attribute Details
#state ⇒ Object
Returns the value of attribute state.
42 43 44 |
# File 'lib/glimr/widgets/checkbox.rb', line 42 def state @state end |
Instance Method Details
#activate(o, e) ⇒ Object
62 63 64 |
# File 'lib/glimr/widgets/checkbox.rb', line 62 def activate(o,e) self.state = !state end |
#default_config ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/glimr/widgets/checkbox.rb', line 44 def default_config super.merge( :state => false, :up_background => "checkbox_bg.png", :down_background => "checkbox_checked_bg.png", :margin => 2, :label_down_offset => [0,0] ) end |
#toggle ⇒ Object
66 67 68 69 70 71 |
# File 'lib/glimr/widgets/checkbox.rb', line 66 def toggle @up_background, @down_background = @down_background, @up_background @up_cover, @down_cover = @down_cover, @up_cover @up_label_model, @down_label_model = @down_label_model, @up_label_model end |