Class: Glimmer::LibUI::ControlProxy::MenuItemProxy::RadioMenuItemProxy

Inherits:
Glimmer::LibUI::ControlProxy::MenuItemProxy show all
Defined in:
lib/glimmer/libui/control_proxy/menu_item_proxy/radio_menu_item_proxy.rb

Overview

Proxy for LibUI radio menu item object

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 inherited from Glimmer::LibUI::ControlProxy::MenuItemProxy

#libui_api_keyword

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, #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

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

#checked(value = nil) ⇒ Object Also known as: checked?, set_checked, checked=



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/glimmer/libui/control_proxy/menu_item_proxy/radio_menu_item_proxy.rb', line 32

def checked(value = nil)
  if !value.nil?
    if Glimmer::LibUI.integer_to_boolean(value) != checked?
      super
      if Glimmer::LibUI.integer_to_boolean(value)
        (@parent_proxy.children - [self]).select {|c| c.is_a?(MenuItemProxy)}.each do |menu_item|
          menu_item.checked = false
        end
      end
    end
  end
end

#handle_listener(listener_name, &listener) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/glimmer/libui/control_proxy/menu_item_proxy/radio_menu_item_proxy.rb', line 48

def handle_listener(listener_name, &listener)
  if listener_name.to_s == 'on_clicked'
    radio_listener = Proc.new do
      self.checked = true if !checked?
      listener.call(self)
    end
    super(listener_name, &radio_listener)
  else
    super
  end
end