Extended maintenance of Ruby 1.9.3 ended on February 23, 2015. Read more

In Files

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

Class/Module Index [+]

Quicksearch

Tk::BLT::Tabset::Tab

Public Class Methods

id2obj(tabset, id) click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 26
def self.id2obj(tabset, id)
  tpath = tabset.path
  TabID_TBL.mutex.synchronize{
    if TabID_TBL[tpath]
      TabID_TBL[tpath][id]? TabID_TBL[tpath][id]: id
    else
      id
    end
  }
end
            
new(parent, pos, name, keys) click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 70
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', '-name', @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
      pos = 'end' unless pos
      tk_call(@tpath, 'insert', pos, @id, keys)
    end
  else
    pos = 'end' unless pos
    TabsetTab_ID.mutex.synchronize{
      @path = @id = TabsetTab_ID.join(TkCore::INTERP._ip_id_)
      TabsetTab_ID[1].succ!
    }
    tk_call(@tpath, 'insert', pos, @id, keys)
  end
end
            
new(parent, pos=nil, name=nil, keys={}) click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 37
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
            

Public Instance Methods

bind(context, *args) click to toggle source

def bind(context, cmd=Proc.new, *args)

@t.tab_bind(@id, context, cmd, *args)
self

end

 
               # File tk/lib/tkextlib/blt/tabset.rb, line 103
def bind(context, *args)
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
  if TkComm._callback_entry?(args[0]) || !block_given?
    cmd = args.shift
  else
    cmd = Proc.new
  end
  @t.tab_bind(@id, context, cmd, *args)
  self
end
            
bind_append(context, *args) click to toggle source

def #bind_append(context, cmd=Proc.new, *args)

@t.tab_bind_append(@id, context, cmd, *args)
self

end

 
               # File tk/lib/tkextlib/blt/tabset.rb, line 117
def bind_append(context, *args)
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
  if TkComm._callback_entry?(args[0]) || !block_given?
    cmd = args.shift
  else
    cmd = Proc.new
  end
  @t.tab_bind_append(@id, context, cmd, *args)
  self
end
            
bind_remove(context) click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 127
def bind_remove(context)
  @t.tab_bind_remove(@id, context)
  self
end
            
bindinfo(context=nil) click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 131
def bindinfo(context=nil)
  @t.tab_bindinfo(@id, context)
end
            
cget(*args) click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 138
def cget(*args)
  @t.tab_cget(@id, *args)
end
            
cget_strict(*args) click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 141
def cget_strict(*args)
  @t.tab_cget_strict(@id, *args)
end
            
cget_tkstring(*args) click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 135
def cget_tkstring(*args)
  @t.tab_cget_tkstring(@id, *args)
end
            
configinfo(*args) click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 147
def configinfo(*args)
  @t.tab_configinfo(@id, *args)
end
            
configure(*args) click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 144
def configure(*args)
  @t.tab_configure(@id, *args)
end
            
current_configinfo(*args) click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 150
def current_configinfo(*args)
  @t.current_tab_configinfo(@id, *args)
end
            
delete() click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 154
def delete()
  @t.delete(@id)
  TabID_TBL.mutex.synchronize{
    TabID_TBL[@tpath].delete(@id)
  }
  self
end
            
focus() click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 166
def focus()
  @t.focus(self.index)
end
            
get_name() click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 162
def get_name()
  @id.dup
end
            
index() click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 170
def index()
  @t.index_name(@id)
end
            
invoke() click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 174
def invoke()
  @t.invoke(self.index)
end
            
move_after(idx) click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 181
def move_after(idx)
  @t.move_after(self.index, idx)
end
            
move_before(idx) click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 178
def move_before(idx)
  @t.move_before(self.index, idx)
end
            
mutex() click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 18
def mutex; @mutex; end
            
perforation_highlight(mode) click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 185
def perforation_highlight(mode)
  @t.perforation_highlight(self.index, mode)
end
            
perforation_invoke() click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 188
def perforation_invoke()
  @t.perforation_invoke(self.index)
end
            
see() click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 192
def see()
  @t.see(self.index)
end
            
tearoff(name=None) click to toggle source
 
               # File tk/lib/tkextlib/blt/tabset.rb, line 196
def tearoff(name=None)
  @t.tab_tearoff(self.index, *args)
end