Class: Glimmer::Tk::ListProxy
- Inherits:
-
WidgetProxy
- Object
- WidgetProxy
- Glimmer::Tk::ListProxy
- Defined in:
- lib/glimmer/tk/list_proxy.rb
Overview
Custom list widget implementation
Constant Summary
Constants inherited from WidgetProxy
WidgetProxy::FONTS_PREDEFINED, WidgetProxy::HEXADECIMAL_CHARACTERS
Instance Attribute Summary
Attributes inherited from WidgetProxy
#args, #bind_ids, #children, #destroyed, #keyword, #parent_proxy, #tk
Attributes included from DraggableAndDroppable
Instance Method Summary collapse
-
#initialize(underscored_widget_name, parent_proxy, args) ⇒ ListProxy
constructor
A new instance of ListProxy.
- #widget_custom_attribute_mapping ⇒ Object
Methods inherited from WidgetProxy
#add_observer, #ancestor_proxies, #apply_style, #attribute_argument_normalizers, #attribute_setter, #clear_children, #content, create, #destroy, #disabled, #disabled=, #enabled, #enabled=, #event_generate, #font=, #get_attribute, #grid, #handle_listener, #has_attribute?, #has_attributes_attribute?, #has_state?, #hidden, #hidden=, #image_argument, #inspect, #method_missing, #normalize_attribute_arguments, #on, #post_add_content, #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, #visible, #visible=, #widget_attribute_listener_installers, widget_exists?, widget_proxy_class, #window?
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) ⇒ ListProxy
Returns a new instance of ListProxy.
28 29 30 31 |
# File 'lib/glimmer/tk/list_proxy.rb', line 28 def initialize(, parent_proxy, args) super('treeview', parent_proxy, args) @tk.show = 'tree' end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Glimmer::Tk::WidgetProxy
Instance Method Details
#widget_custom_attribute_mapping ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/glimmer/tk/list_proxy.rb', line 33 def @widget_custom_attribute_mapping ||= { ::Tk::Tile::Treeview => { 'items' => { getter: {name: 'items', invoker: lambda { |, args| tk.children('').map(&:text) }}, setter: {name: 'items=', invoker: lambda { |, args| @tk.delete @tk.children('') args.first.each do |child| @tk.insert('', 'end', :text => child) end }}, }, 'selection' => { getter: {name: 'selection', invoker: lambda { |, args| @tk.selection.map(&:text) }}, setter: {name: 'selection=', invoker: lambda { |, args| selection_args = args.first.is_a?(Array) ? args.first : [args.first] selection_items = selection_args.map do |arg| @tk.children('').detect {|item| item.text == arg} end @tk.selection_set(*selection_items) }}, }, }, } end |