Class: Glimmer::Tk::MenuProxy

Inherits:
WidgetProxy show all
Defined in:
lib/glimmer/tk/menu_proxy.rb

Constant Summary

Constants inherited from WidgetProxy

WidgetProxy::FONTS_PREDEFINED

Instance Attribute Summary collapse

Attributes inherited from WidgetProxy

#args, #bind_ids, #children, #destroyed, #keyword, #parent_proxy, #tk

Attributes included from DraggableAndDroppable

#on_drag_motion_block

Instance Method Summary collapse

Methods inherited from WidgetProxy

#add_observer, #ancestor_proxies, #apply_style, #attribute_setter, #content, create, #destroy, #font=, #get_attribute, #grid, #handle_listener, #has_attribute?, #has_attributes_attribute?, #has_state?, #image_argument, #inspect, #method_missing, #on, #post_initialize_child, #respond_to?, #root_parent_proxy, #set_attribute, #style=, tk_widget_class_for, #tk_widget_has_attribute_getter_setter?, #tk_widget_has_attribute_setter?, #toplevel_parent_proxy, #unbind_all, #widget_attribute_listener_installers, #widget_custom_attribute_mapping, widget_exists?, widget_proxy_class

Methods included from DraggableAndDroppable

#drag_source=, #drop_target=, #handle_listener, #make_draggable, #make_droppable, #make_non_draggable, #make_non_droppable, #on_drag_start_block=, #on_drop_block=, #textvariable_defined?

Constructor Details

#initialize(underscored_widget_name, parent_proxy, args, &block) ⇒ MenuProxy

Returns a new instance of MenuProxy.



29
30
31
32
# File 'lib/glimmer/tk/menu_proxy.rb', line 29

def initialize(underscored_widget_name, parent_proxy, args, &block)
  @options = args.last.is_a?(Hash) ? args.last : {}
  super
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Glimmer::Tk::WidgetProxy

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



27
28
29
# File 'lib/glimmer/tk/menu_proxy.rb', line 27

def options
  @options
end

Instance Method Details

#application?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/glimmer/tk/menu_proxy.rb', line 57

def application?
  @args.first == :application
end

#help?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/glimmer/tk/menu_proxy.rb', line 45

def help?
  label == 'Help'
end

#labelObject



41
42
43
# File 'lib/glimmer/tk/menu_proxy.rb', line 41

def label
  @options[:label]
end

#post_add_contentObject



34
35
36
37
38
39
# File 'lib/glimmer/tk/menu_proxy.rb', line 34

def post_add_content
  case @parent_proxy
  when ToplevelProxy
    @parent_proxy.tk['menu'] = @tk
  end
end

#system?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/glimmer/tk/menu_proxy.rb', line 53

def system?
  label == 'System'
end

#window?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/glimmer/tk/menu_proxy.rb', line 49

def window?
  label == 'Window'
end