Class: Glimmer::LibUI::QuitMenuItemProxy
- Inherits:
-
MenuItemProxy
- Object
- ControlProxy
- MenuItemProxy
- Glimmer::LibUI::QuitMenuItemProxy
- Defined in:
- lib/glimmer/libui/quit_menu_item_proxy.rb
Overview
Proxy for LibUI quit menu item object
Follows the Proxy Design Pattern
Constant Summary
Constants inherited from ControlProxy
ControlProxy::BOOLEAN_PROPERTIES, ControlProxy::STRING_PROPERTIES
Instance Attribute Summary
Attributes inherited from ControlProxy
#args, #block, #keyword, #libui, #parent_proxy
Instance Method Summary collapse
Methods inherited from MenuItemProxy
Methods inherited from ControlProxy
#append_properties, #append_property, boolean_to_integer, #content, control_proxies, create, #default_destroy, #destroy, #destroy_child, #enabled, exists?, image_proxies, #initialize, integer_to_boolean, #libui_api_keyword, main_window_proxy, menu_proxies, #method_missing, new_control, #post_add_content, #post_initialize_child, #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
Instance Method Details
#can_handle_listener?(listener_name) ⇒ Boolean
30 31 32 |
# File 'lib/glimmer/libui/quit_menu_item_proxy.rb', line 30 def can_handle_listener?(listener_name) listener_name == 'on_clicked' || super end |
#handle_listener(listener_name, &listener) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/glimmer/libui/quit_menu_item_proxy.rb', line 34 def handle_listener(listener_name, &listener) if listener_name == 'on_clicked' @default_behavior_listener = Proc.new do return_value = listener.call(self) if return_value.is_a?(Numeric) return_value else destroy ::LibUI.quit 0 end end ::LibUI.on_should_quit(&@default_behavior_listener) end end |