Class: GlimR::VScrollBar
- Includes:
- Scrollable
- Defined in:
- lib/glimr/widgets/scrollbar.rb
Constant Summary
Constants included from Layoutable
Instance Attribute Summary
Attributes included from Scrollable
#default_scroll_horiz, #default_scroll_vert, #scroll_x, #scroll_y
Attributes inherited from Layout
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
- #click(o, e) ⇒ Object
- #container=(c) ⇒ Object
- #default_config ⇒ Object
-
#initialize(*a, &b) ⇒ VScrollBar
constructor
A new instance of VScrollBar.
Methods included from Scrollable
#scroll, #scroll_down, #scroll_left, #scroll_right, #scroll_to, #scroll_up
Methods inherited from Layout
#calculate_free_height, #calculate_free_width, #children_change, #fit_height!, #fit_width!, #free_height, #free_width, #horiz_tile, #layout, #vert_tile
Methods inherited from Widget
#activate, #blur, #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) ⇒ VScrollBar
Returns a new instance of VScrollBar.
149 150 151 152 153 154 155 156 |
# File 'lib/glimr/widgets/scrollbar.rb', line 149 def initialize(*a, &b) super attach @up_button, @scroller, @down_button @updater = lambda{|o,e| @scroller.update_knob } self.container = @container on_scroll{ @scroller.knob.scroll_handler if @scroller } self.min_height = @up_button.height + @down_button.height + @scroller.min_height end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class GlimR::EventListener
Instance Method Details
#click(o, e) ⇒ Object
158 159 160 161 162 163 164 165 |
# File 'lib/glimr/widgets/scrollbar.rb', line 158 def click(o,e) case e. when :wheel_down scroll_down when :wheel_up scroll_up end end |
#container=(c) ⇒ Object
167 168 169 170 171 172 |
# File 'lib/glimr/widgets/scrollbar.rb', line 167 def container=(c) @container.remove_event_listener(:layout, @updater) if @container @container = c @container.add_event_listener(:layout, @updater) if @container @scroller.update_knob if @scroller end |
#default_config ⇒ Object
139 140 141 142 143 144 145 146 147 |
# File 'lib/glimr/widgets/scrollbar.rb', line 139 def default_config super.merge( :item_spacing => 0, :expand_height => true, :container => nil, :up_button => ScrollUpButton.new, :down_button => ScrollDownButton.new, :scroller => VScroller.new ) end |