Class: Glimmer::LibUI::ControlProxy::AreaProxy

Inherits:
Glimmer::LibUI::ControlProxy show all
Includes:
FiddleConsumer, Parent, Transformable
Defined in:
lib/glimmer/libui/control_proxy/area_proxy.rb,
lib/glimmer/libui/control_proxy/area_proxy/scrolling_area_proxy.rb

Overview

Proxy for LibUI area objects

Follows the Proxy Design Pattern

Direct Known Subclasses

ScrollingAreaProxy

Defined Under Namespace

Classes: ScrollingAreaProxy

Constant Summary collapse

LISTENERS =
['on_draw', 'on_mouse_event', 'on_mouse_move', 'on_mouse_down', 'on_mouse_up', 'on_mouse_drag_start', 'on_mouse_drag', 'on_mouse_drop', 'on_mouse_crossed', 'on_mouse_enter', 'on_mouse_exit', 'on_drag_broken', 'on_key_event', 'on_key_down', 'on_key_up']
LISTENER_ALIASES =
{
  on_drawn: 'on_draw',
  on_mouse_moved: 'on_mouse_move',
  on_mouse_drag_started: 'on_mouse_drag_start',
  on_mouse_dragged: 'on_mouse_drag',
  on_mouse_dropped: 'on_mouse_drop',
  on_mouse_cross: 'on_mouse_crossed',
  on_mouse_entered: 'on_mouse_enter',
  on_mouse_exited: 'on_mouse_exit',
  on_drag_break: 'on_drag_broken',
}

Constants inherited from Glimmer::LibUI::ControlProxy

BOOLEAN_PROPERTIES, STRING_PROPERTIES, TransformProxy

Class Attribute Summary collapse

Instance Attribute Summary collapse

Attributes inherited from Glimmer::LibUI::ControlProxy

#args, #block, #keyword, #libui, #parent_proxy

Instance Method Summary collapse

Methods included from Parent

#children, #post_initialize_child

Methods included from FiddleConsumer

#fiddle_closure_block_caller

Methods included from Transformable

#apply_transform, #post_initialize_child, #transform, #undo_transform

Methods inherited from Glimmer::LibUI::ControlProxy

#append_properties, #append_property, #can_handle_listener?, constant_symbol, #content, control_proxies, create, #custom_listener_aliases, #custom_listeners, #default_destroy, descendant_keyword_constant_map, #destroy, #destroy_child, #enabled, exists?, #handle_custom_listener, #handle_listener, #has_custom_listener?, image_proxies, #initialize, keyword, main_window_proxy, map_descendant_keyword_constants_for, menu_proxies, #method_missing, new_control, #post_initialize_child, reset_descendant_keyword_constant_map, #respond_to?, #respond_to_libui?, #send_to_libui, #visible, widget_proxy_class, #window_proxy

Constructor Details

This class inherits a constructor from Glimmer::LibUI::ControlProxy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Glimmer::LibUI::ControlProxy

Class Attribute Details

.current_area_draw_paramsObject

this attribute is only populated during on_draw call



36
37
38
# File 'lib/glimmer/libui/control_proxy/area_proxy.rb', line 36

def current_area_draw_params
  @current_area_draw_params
end

Instance Attribute Details

#area_handlerObject (readonly)

Returns the value of attribute area_handler.



56
57
58
# File 'lib/glimmer/libui/control_proxy/area_proxy.rb', line 56

def area_handler
  @area_handler
end

Instance Method Details

#draw(area_draw_params) ⇒ Object



78
79
80
81
# File 'lib/glimmer/libui/control_proxy/area_proxy.rb', line 78

def draw(area_draw_params)
  children.dup.each {|child| child.draw(area_draw_params)}
  on_draw.each {|listener| listener.call(area_draw_params)}
end

#libui_api_keywordObject



58
59
60
# File 'lib/glimmer/libui/control_proxy/area_proxy.rb', line 58

def libui_api_keyword
  'area'
end

#post_add_contentObject



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/glimmer/libui/control_proxy/area_proxy.rb', line 62

def post_add_content
  unless parent_proxy.is_a?(Box)
    original_parent_proxy = @parent_proxy
    @vertical_box_parent_proxy = ControlProxy.create('vertical_box', parent_proxy, []) {} # block prevents calling post add content
    append_properties.each do |property|
      @vertical_box_parent_proxy.append_property(property, append_property(property))
    end
    @vertical_box_parent_proxy.post_add_content
    @parent_proxy = @vertical_box_parent_proxy
    @vertical_box_parent_proxy.post_initialize_child(self)
  else
    super
  end
  install_listeners
end

#redrawObject



83
84
85
# File 'lib/glimmer/libui/control_proxy/area_proxy.rb', line 83

def redraw
  queue_redraw_all
end