Class: TkFrameAdapter

Inherits:
TkFrame
  • Object
show all
Includes:
TkMovable
Defined in:
lib/a-tkcommons.rb

Direct Known Subclasses

AGTkSplittedFrames

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TkMovable

#moving_do_move_obj, #moving_do_press, #start_moving, #stop_moving

Constructor Details

#initialize(scope_parent = nil, *args) ⇒ TkFrameAdapter

Returns a new instance of TkFrameAdapter.



199
200
201
202
203
# File 'lib/a-tkcommons.rb', line 199

def initialize(scope_parent=nil, *args)
  super(scope_parent, *args)
  @scope_parent = scope_parent
  @movable = true
end

Instance Attribute Details

#frameObject (readonly)

Returns the value of attribute frame.



198
199
200
# File 'lib/a-tkcommons.rb', line 198

def frame
  @frame
end

Instance Method Details

#add_moved_by(_obj) ⇒ Object



205
206
207
208
# File 'lib/a-tkcommons.rb', line 205

def add_moved_by(_obj)
  @movable = true
  start_moving(_obj, self)
end

#attach_frame(_frame) ⇒ Object



222
223
224
225
226
227
228
229
230
231
# File 'lib/a-tkcommons.rb', line 222

def attach_frame(_frame)
  @frame = _frame
  refresh
  if @movable
    @frame.bind_append("Configure",proc{ refresh})
    @frame.bind_append("Map",proc{refresh})
    @frame.bind_append("Unmap",proc{unplace})
  end
  self
end

#detach_frameObject



210
211
212
213
214
215
216
217
218
219
220
# File 'lib/a-tkcommons.rb', line 210

def detach_frame
  if @frame 
    if @movable
      @frame.bind_remove("Configure") 
      @frame.bind_remove("Map") 
      @frame.bind_remove("Unmap") 
    end
    @frame = nil
    self.unplace
  end
end

#refresh(_x = 0, _y = 0) ⇒ Object



234
235
236
# File 'lib/a-tkcommons.rb', line 234

def refresh(_x=0, _y=0)
  place('in'=>@frame, 'x'=>_x, 'y'=>_y, 'relheight'=> 1, 'relwidth'=>1, 'bordermode'=>'outside')
end