Class: Glimmer::Tk::ScrollbarFrameProxy

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

Overview

Scrolledframe (#scrolledframe_tk attribute) Nested widgets go into the child site (#tk attribute or @scrolledframe_tk.child_site)

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=, #grid, #handle_listener, #has_attributes_attribute?, #has_state?, #image_argument, #initialize, #inspect, #method_missing, #on, #post_initialize_child, #respond_to?, #root_parent_proxy, #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

This class inherits a constructor from Glimmer::Tk::WidgetProxy

Dynamic Method Handling

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

Instance Attribute Details

#canvas_proxyObject (readonly)

Returns the value of attribute canvas_proxy.



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

def canvas_proxy
  @canvas_proxy
end

#container_frame_proxyObject (readonly)

Returns the value of attribute container_frame_proxy.



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

def container_frame_proxy
  @container_frame_proxy
end

#original_parent_proxyObject (readonly)

Returns the value of attribute original_parent_proxy.



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

def original_parent_proxy
  @original_parent_proxy
end

#xscrollbar_proxyObject (readonly)

Returns the value of attribute xscrollbar_proxy.



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

def xscrollbar_proxy
  @xscrollbar_proxy
end

#yscrollbar_proxyObject (readonly)

Returns the value of attribute yscrollbar_proxy.



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

def yscrollbar_proxy
  @yscrollbar_proxy
end

Instance Method Details

#get_attribute(attribute, *args) ⇒ Object



77
78
79
80
81
82
83
84
85
86
# File 'lib/glimmer/tk/scrollbar_frame_proxy.rb', line 77

def get_attribute(attribute, *args)
  case attribute.to_s
  when 'show_yscrollbar'
    @yscrollbar
  when 'show_xscrollbar'
    @xscrollbar
  else
    container_frame_proxy.get_attribute(attribute, *args)
  end
end

#has_attribute?(attribute, *args) ⇒ Boolean

Returns:

  • (Boolean)


39
40
41
42
43
44
45
46
# File 'lib/glimmer/tk/scrollbar_frame_proxy.rb', line 39

def has_attribute?(attribute, *args)
  case attribute.to_s
  when 'yscrollbar', 'xscrollbar'
    true
  else
    container_frame_proxy.has_attribute?(attribute, *args)
  end
end

#post_add_contentObject



31
32
33
34
35
36
37
# File 'lib/glimmer/tk/scrollbar_frame_proxy.rb', line 31

def post_add_content
  @tk.bind('Configure') {
    @canvas_proxy.tk.scrollregion(@canvas_proxy.tk.bbox("all"))
  }
  @canvas_proxy.tk.yscrollcommand {|*args| @yscrollbar_proxy&.set(*args)}
  @canvas_proxy.tk.xscrollcommand {|*args| @xscrollbar_proxy&.set(*args)}
end

#set_attribute(attribute, *args) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/glimmer/tk/scrollbar_frame_proxy.rb', line 48

def set_attribute(attribute, *args)
  case attribute.to_s
  when 'yscrollbar'
    @yscrollbar = args.first
    if @yscrollbar == true
      build_yscrollbar unless @yscrollbar_proxy
    elsif @yscrollbar.is_a?(Glimmer::Tk::WidgetProxy)
      @yscrollbar_proxy.destroy
      build_yscrollbar(@yscrollbar)
    else
      @yscrollbar_proxy.destroy
      @yscrollbar_proxy = nil
    end
  when 'xscrollbar'
    @xscrollbar = args.first
    if @xscrollbar == true
      build_xscrollbar unless @xscrollbar_proxy
    elsif @xscrollbar.is_a?(Glimmer::Tk::WidgetProxy)
      @xscrollbar_proxy.destroy
      build_xscrollbar(@xscrollbar)
    else
      @xscrollbar_proxy.destroy
      @xscrollbar_proxy = nil
    end
  else
    container_frame_proxy.set_attribute(attribute, *args)
  end
end