Class: TkFrameAdapter
- Inherits:
-
TkFrame
- Object
- TkFrame
- TkFrameAdapter
- Defined in:
- lib/a-tkcommons.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#frame ⇒ Object
readonly
include TkMovable.
Instance Method Summary collapse
- #attach_frame(_frame) ⇒ Object
-
#detach_frame ⇒ Object
def add_moved_by(_obj) @movable = true start_moving(_obj, self) end.
-
#initialize(scope_parent = nil, args = nil) ⇒ TkFrameAdapter
constructor
A new instance of TkFrameAdapter.
- #is_pack? ⇒ Boolean
- #is_place? ⇒ Boolean
- #refresh(_x = 0, _y = 0) ⇒ Object
- #unmap ⇒ Object
Constructor Details
#initialize(scope_parent = nil, args = nil) ⇒ TkFrameAdapter
Returns a new instance of TkFrameAdapter.
267 268 269 270 271 272 273 274 275 |
# File 'lib/a-tkcommons.rb', line 267 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 |
Instance Attribute Details
#frame ⇒ Object (readonly)
include TkMovable
266 267 268 |
# File 'lib/a-tkcommons.rb', line 266 def frame @frame end |
Instance Method Details
#attach_frame(_frame) ⇒ Object
302 303 304 305 306 307 308 309 310 311 312 |
# File 'lib/a-tkcommons.rb', line 302 def attach_frame(_frame) @frame = _frame @frame_manager = TkWinfo.manager(@frame) refresh # if @movable # @frame.bind_append("Configure",proc{refresh}) # @frame.bind_append("Map",proc{refresh}) # @frame.bind_append("Unmap",proc{unmap if TkWinfo.mapped?(@frame)}) # end self end |
#detach_frame ⇒ Object
def add_moved_by(_obj)
@movable = true
start_moving(_obj, self)
end
282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/a-tkcommons.rb', line 282 def detach_frame if @frame # if @movable # @frame.bind_remove("Configure") # @frame.bind_remove("Map") # @frame.bind_remove("Unmap") # end @frame = nil self.unmap end end |
#is_pack? ⇒ Boolean
318 319 320 |
# File 'lib/a-tkcommons.rb', line 318 def is_pack? @frame_manager == 'pack' end |
#is_place? ⇒ Boolean
314 315 316 |
# File 'lib/a-tkcommons.rb', line 314 def is_place? @frame_manager == 'place' || @frame_manager.nil? || @frame_manager == '' end |
#refresh(_x = 0, _y = 0) ⇒ Object
322 323 324 325 326 327 328 |
# File 'lib/a-tkcommons.rb', line 322 def refresh(_x=0, _y=0) if is_place? place('in'=>@frame, 'x'=>_x, 'y'=>_y, 'relheight'=> 1, 'relwidth'=>1, 'bordermode'=>'outside') elsif is_pack? pack('in'=>@frame, 'fill'=>'both', 'expand'=>true) end end |
#unmap ⇒ Object
294 295 296 297 298 299 300 |
# File 'lib/a-tkcommons.rb', line 294 def unmap if is_place? self.unplace elsif is_pack? self.unpack end end |