class TkFrameAdapter

Attributes

frame[R]

include TkMovable

Public Class Methods

new(scope_parent=nil, args=nil) click to toggle source
Calls superclass method
# File lib/a-tkcommons.rb, line 268
def initialize(scope_parent=nil, args=nil)
  newargs =  Arcadia.style('panel')
  if !args.nil?
    newargs.update(args) 
  end
  super(scope_parent, newargs)
  @scope_parent = scope_parent
  #@movable = false
end

Public Instance Methods

attach_frame(_frame, _extension = nil, _frame_index=0) click to toggle source
# File lib/a-tkcommons.rb, line 291
  def attach_frame(_frame, _extension = nil, _frame_index=0)
    if _frame.kind_of?(Tk::ScrollFrame)
      _frame = _frame.baseframe
    end
    @frame = _frame
    refresh_layout_manager
    self.map
    if _extension
      @frame.bind("Map", proc{
        if _extension.frame_raised?(_frame_index)
          @frame.raise
        else
          @frame.lower
        end
      })

      
#      ffw = Arcadia.instance.layout.frame(_extension.frame_domain(_frame_index),_extension.name)
#      if ffw
#        ffw.bind("Map", proc{
#          if _extension.frame_raised?(_frame_index)
#            p "pack"
#            @frame.pack
#            @frame.raise
#          else
#            p "unpack"
#            @frame.lower
#            @frame.unpack
#          end
#        })
#      end
    else
      self.bind("Map", proc{@frame.raise})
    end
    self
  end
detach_frame() click to toggle source

def add_moved_by(_obj)

@movable = true
start_moving(_obj, self)

end

# File lib/a-tkcommons.rb, line 283
def detach_frame
  if @frame
    self.bind_remove("Map")
    self.unmap(@manager_forced_to_frame)
    @frame = nil
  end
end
is_pack?() click to toggle source
# File lib/a-tkcommons.rb, line 344
def is_pack?
  @frame_manager == 'pack'
end
is_place?() click to toggle source
# File lib/a-tkcommons.rb, line 340
def is_place?
  @frame_manager == 'place' || is_undefined?
end
is_undefined?() click to toggle source
# File lib/a-tkcommons.rb, line 336
def is_undefined?
  @frame_manager.nil? || @frame_manager == ''
end
layout_manager() click to toggle source
# File lib/a-tkcommons.rb, line 328
def layout_manager
  @frame_manager
end
map(_layout_manager=nil) click to toggle source
# File lib/a-tkcommons.rb, line 348
def map(_layout_manager=nil)
  if _layout_manager == "place" || (_layout_manager.nil? && is_place?) 
    if is_undefined? && _layout_manager
      @frame.place('x'=>0, 'y'=>0, 'relheight'=> 1, 'relwidth'=>1, 'bordermode'=>'outside')
      @manager_forced_to_frame = "place" 
    end
    place('in'=>@frame, 'x'=>0, 'y'=>0, 'relheight'=> 1, 'relwidth'=>1, 'bordermode'=>'outside')
  elsif _layout_manager == "pack" || (_layout_manager.nil? && is_pack?)
    if is_undefined? && _layout_manager
      @frame.pack('fill'=>'both', :padx=>0, :pady=>0,  'expand'=>'yes')
      @manager_forced_to_frame = "pack" 
    end
    pack('in'=>@frame, 'fill'=>'both', :padx=>0, :pady=>0,  'expand'=>'yes')
  end
end
refresh_layout_manager() click to toggle source
# File lib/a-tkcommons.rb, line 332
def refresh_layout_manager
  @frame_manager = TkWinfo.manager(@frame)
end
unmap(_layout_manager=nil) click to toggle source
# File lib/a-tkcommons.rb, line 364
def unmap(_layout_manager=nil)
  if _layout_manager == "place" || (_layout_manager.nil? && is_place?)
    self.unplace
    @frame.unplace if @frame && @manager_forced_to_frame == "place"
  elsif _layout_manager == "pack" || (_layout_manager.nil? && is_pack?)
    self.unpack
    @frame.unpack if @frame  && @manager_forced_to_frame == "pack"
  end
end