Class: Glimmer::LibUI::ControlProxy::Column::ButtonColumnProxy

Inherits:
Glimmer::LibUI::ControlProxy show all
Includes:
Glimmer::LibUI::ControlProxy::Column, EnableableColumn
Defined in:
lib/glimmer/libui/control_proxy/column/button_column_proxy.rb

Overview

Proxy for LibUI button column objects

Follows the Proxy Design Pattern

Constant Summary

Constants inherited from Glimmer::LibUI::ControlProxy

BOOLEAN_PROPERTIES, STRING_PROPERTIES, TransformProxy

Instance Attribute Summary

Attributes inherited from Glimmer::LibUI::ControlProxy

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

Instance Method Summary collapse

Methods included from EnableableColumn

#enabled

Methods included from Glimmer::LibUI::ControlProxy::Column

#column_index, #index, #initialize, #name

Methods inherited from Glimmer::LibUI::ControlProxy

#append_properties, #append_property, 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, #has_custom_listener?, image_proxies, #initialize, keyword, #libui_api_keyword, main_window_proxy, map_descendant_keyword_constants_for, menu_proxies, #method_missing, new_control, #post_add_content, #post_initialize_child, reset_descendant_keyword_constant_map, #respond_to?, #respond_to_libui?, #send_to_libui, #visible, widget_proxy_class, #window_proxy

Dynamic Method Handling

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

Instance Method Details

#can_handle_listener?(listener_name) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/glimmer/libui/control_proxy/column/button_column_proxy.rb', line 48

def can_handle_listener?(listener_name)
  listener_name == 'on_clicked' || super
end

#handle_listener(listener_name, &listener) ⇒ Object



52
53
54
55
56
57
58
59
# File 'lib/glimmer/libui/control_proxy/column/button_column_proxy.rb', line 52

def handle_listener(listener_name, &listener)
  case listener_name
  when 'on_clicked'
    on_clicked(&listener)
  else
    super
  end
end

#notify_listeners(listener_name, *args) ⇒ Object



61
62
63
64
65
# File 'lib/glimmer/libui/control_proxy/column/button_column_proxy.rb', line 61

def notify_listeners(listener_name, *args)
  @on_clicked_procs&.each do |on_clicked_proc|
    on_clicked_proc.call(*args)
  end
end

#on_clicked(&block) ⇒ Object



37
38
39
40
41
42
43
44
45
46
# File 'lib/glimmer/libui/control_proxy/column/button_column_proxy.rb', line 37

def on_clicked(&block)
  # TODO consider generalizing into custom listeners and moving to ControlProxy
  @on_clicked_procs ||= []
  if block.nil?
    @on_clicked_procs
  else
    @on_clicked_procs << block
    block
  end
end