Class: GlimR::ListItem

Inherits:
HLayout show all
Defined in:
lib/glimr/widgets/list.rb

Overview

A ListItem is a width-filling HLayout with selection event listeners.

Constant Summary

Constants included from Layoutable

GlimR::Layoutable::DIMENSIONS

Instance Attribute Summary

Attributes inherited from Layout

#direction, #item_spacing

Attributes inherited from Widget

#focused, #hover

Attributes included from Layoutable

#align, #valign

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

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, #initialize, #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, #initialize, #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, #initialize, #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, #initialize, #inspect, #pop_state, #push_state, #remove_drawables, #render, #replace_node, #root, #touch!, #visible

Methods included from Configurable

#initialize

Methods included from EventListener

#add_event_listener, #decrement_listener_count, #dispatch_event, #event_root, #increment_listener_count, #initialize, #method_missing, #multicast_event, #process_event, #remove_event_listener

Constructor Details

This class inherits a constructor from GlimR::Widget

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class GlimR::EventListener

Instance Method Details

#add_to_selectionObject



30
31
32
# File 'lib/glimr/widgets/list.rb', line 30

def add_to_selection
  parent.add_to_selection self
end

#click(o, e) ⇒ Object



19
20
21
22
23
# File 'lib/glimr/widgets/list.rb', line 19

def click(o,e)
  if e.button == :left
    parent.select self
  end
end

#default_configObject



11
12
13
14
15
16
17
# File 'lib/glimr/widgets/list.rb', line 11

def default_config
  super.merge(
    :expand_width => true,
    :normal_background => nil,
    :selected_background => nil
  )
end

#deselectObject



34
35
36
# File 'lib/glimr/widgets/list.rb', line 34

def deselect
  parent.deselect self
end

#normalObject



42
43
44
# File 'lib/glimr/widgets/list.rb', line 42

def normal
  self.background = @normal_background
end

#selectObject



25
26
27
28
# File 'lib/glimr/widgets/list.rb', line 25

def select
  selected
  parent.select self
end

#selectedObject



38
39
40
# File 'lib/glimr/widgets/list.rb', line 38

def selected
  self.background = @selected_background
end