In Files

  • tk/lib/tkextlib/blt/tabnotebook.rb

Class/Module Index [+]

Quicksearch

Tk::BLT::Tabnotebook::Tab

Public Class Methods

new(parent, pos=nil, name=nil, keys={}) click to toggle source
 
               # File tk/lib/tkextlib/blt/tabnotebook.rb, line 18
def self.new(parent, pos=nil, name=nil, keys={})
  if pos.kind_of?(Hash)
    keys = pos
    name = nil
    pos  = nil
  end
  if name.kind_of?(Hash)
    keys = name
    name = nil
  end
  obj = nil
  TabID_TBL.mutex.synchronize{
    if name && TabID_TBL[parent.path] && TabID_TBL[parent.path][name]
      obj = TabID_TBL[parent.path][name]
      if pos
        if pos.to_s == 'end'
          obj.move_after('end')
        else
          obj.move_before(pos)
        end
      end
      obj.configure if keys && ! keys.empty?
    else
      (obj = self.allocate).instance_eval{
        initialize(parent, pos, name, keys)
        TabID_TBL[@tpath] = {} unless TabID_TBL[@tpath]
        TabID_TBL[@tpath][@id] = self
      }
    end
  }
  obj
end
            
new(parent, pos, name, keys) click to toggle source
 
               # File tk/lib/tkextlib/blt/tabnotebook.rb, line 51
def initialize(parent, pos, name, keys)
  @t = parent
  @tpath = parent.path
  if name
    @path = @id = name
    unless (list(tk_call(@tpath, 'tab', 'names', @id)).empty?)
      if pos
        idx = tk_call(@tpath, 'index', @id)
        if pos.to_s == 'end'
          tk_call(@tpath, 'move', idx, 'after', 'end')
        else
          tk_call(@tpath, 'move', idx, 'before', pos)
        end
      end
      tk_call(@tpath, 'tab', 'configure', @id, keys)
    else
      fail ArgumentError, "can't find tab \"#{@id}\" in #{@t}"
    end
  else
    pos = 'end' unless pos
    @path = @id = tk_call(@tpath, 'insert', pos, keys)
  end
end
            

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.