Class: TkComponent::Builder::PanedWindow

Inherits:
TkItem
  • Object
show all
Defined in:
lib/tk_component/builder/tk_item.rb

Direct Known Subclasses

HPanedWindow, VPanedWindow

Instance Attribute Summary

Attributes inherited from TkItem

#native_item

Instance Method Summary collapse

Methods inherited from TkItem

#apply_internal_grid, #apply_option, #apply_options, create, #focus, #initialize, #native_item_class, #remove, #set_event_handler, #set_event_handlers, #set_grid

Constructor Details

This class inherits a constructor from TkComponent::Builder::TkItem

Instance Method Details

#builtObject



445
446
447
448
449
450
451
452
453
454
455
# File 'lib/tk_component/builder/tk_item.rb', line 445

def built
  # We need to synchronize children items to the panned window
  added_panes = self.native_item.winfo_children - self.native_item.panes
  removed_panes = self.native_item.panes - self.native_item.winfo_children
  added_panes.each do |child|
    self.native_item.add(child, weight: 1)
  end
  removed_panes.each do |child|
    self.native_item.forget(child)
  end
end

#create_native_item(parent_native_item, name, options = {}, grid = {}, event_handlers = []) ⇒ Object



441
442
443
# File 'lib/tk_component/builder/tk_item.rb', line 441

def create_native_item(parent_native_item, name, options = {}, grid = {}, event_handlers = [])
  native_item_class(parent_native_item, name, options, grid, event_handlers).new(parent_native_item, orient: orient)
end

#orientObject



457
458
459
# File 'lib/tk_component/builder/tk_item.rb', line 457

def orient
  raise "#{self.class.to_s} shouldn't be instantiated directly. Use 'H' or 'V' subclasses"
end