In Files

  • tk/lib/tkextlib/vu/pie.rb

Methods

Class/Module Index [+]

Quicksearch

Tk::Vu::NamedPieSlice

Public Class Methods

new(parent, name, *args) click to toggle source
 
               # File tk/lib/tkextlib/vu/pie.rb, line 236
def self.new(parent, name, *args)
  obj = nil
  SliceID_TBL.mutex.synchronize{
    if SliceID_TBL[parent.path] && SliceID_TBL[parent.path][name]
      obj = SliceID_TBL[parent.path][name]
    else
      #super(parent, name, *args)
      unless parent.kind_of?(Tk::Vu::Pie)
        fail ArgumentError, "expect a Tk::Vu::Pie instance for 1st argument"
      end
      obj = self.allocate
      obj.instance_eval{
        @parent = @pie = parent
        @ppath = parent.path
        @path = @id = name.to_s
        SliceID_TBL[@ppath] = {} unless SliceID_TBL[@ppath]
        SliceID_TBL[@ppath][@id] = self
      }
    end
  }
  obj.instance_eval{
    if args[-1].kind_of?(Hash)
      keys = args.unshift
    end
    @pie.set(@id, *args)
    configure(keys)
  }

  obj
end
            
new(parent, name, *args) click to toggle source
 
               # File tk/lib/tkextlib/vu/pie.rb, line 267
def initialize(parent, name, *args)
  # dummy:: not called by 'new' method
  unless parent.kind_of?(Tk::Vu::Pie)
    fail ArgumentError, "expect a Tk::Vu::Pie instance for 1st argument"
  end
  @parent = @pie = parent
  @ppath = parent.path
  @path = @id = name.to_s
  SliceID_TBL.mutex.synchronize{
    SliceID_TBL[@ppath] = {} unless SliceID_TBL[@ppath]
    SliceID_TBL[@ppath][@id] = self
  }

  if args[-1].kind_of?(Hash)
    keys = args.unshift
  end
  @pie.set(@id, *args)
  configure(keys)
end