In Files

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

Class/Module Index [+]

Quicksearch

Tk::BLT::PlotComponent::Pen

Constants

OBJ_ID
PenID_TBL

Public Class Methods

id2obj(chart, id) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 1006
def self.id2obj(chart, id)
  cpath = chart.path
  PenID_TBL.mutex.synchronize{
    return id unless PenID_TBL[cpath]
    PenID_TBL[cpath][id]? PenID_TBL[cpath][id]: id
  }
end
            
new(chart, pen=nil, keys={}) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 1058
def initialize(chart, pen=nil, keys={})
  if pen.kind_of?(Hash)
    keys = pen
    pen = nil
  end
  if pen
    @pen = @id = pen.to_s
  else
    OBJ_ID.mutex.synchronize{
      @pen = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
      OBJ_ID[1].succ!
    }
  end
  @path = @id
  @parent = @chart = chart
  @cpath = @chart.path
  Pen::PenID_TBL[@cpath][@pen] = self
  keys = _symbolkey2str(keys)
  unless keys.delete('without_creating')
    # @chart.pen_create(@pen, keys)
    tk_call(@chart, 'pen', 'create', @pen, keys)
  end
end
            
new(chart, pen=nil, keys={}) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 1014
def self.new(chart, pen=nil, keys={})
  if pen.kind_of?(Hash)
    keys = pen
    pen = nil
  end
  if keys
    keys = _symbolkey2str(keys)
    not_create = keys.delete('without_creating')
  else
    not_create = false
  end

  obj = nil
  PenID_TBL.mutex.synchronize{
    chart_path = chart.path
    PenID_TBL[chart_path] ||= {}
    if pen && PenID_TBL[chart_path][pen]
      obj = PenID_TBL[chart_path][pen]
    else
      (obj = self.allocate).instance_eval{
        if pen
          @pen = @id = pen.to_s
        else
          OBJ_ID.mutex.synchronize{
            @pen = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
            OBJ_ID[1].succ!
          }
        end
        @path = @id
        @parent = @chart = chart
        @cpath = @chart.path
        Pen::PenID_TBL[@cpath][@pen] = self
        unless not_create
          tk_call(@chart, 'pen', 'create', @pen, keys)
          return obj
        end
      }
    end
  }

  obj.configure(keys) if obj && ! keys.empty?
  obj
end
            

Public Instance Methods

cget(option) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 1093
def cget(option)
  @chart.pen_cget(@id, option)
end
            
cget_strict(option) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 1096
def cget_strict(option)
  @chart.pen_cget_strict(@id, option)
end
            
cget_tkstring(option) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 1090
def cget_tkstring(option)
  @chart.pen_cget_tkstring(@id, option)
end
            
configinfo(key=nil) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 1103
def configinfo(key=nil)
  @chart.pen_configinfo(@id, key)
end
            
configure(key, value=None) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 1099
def configure(key, value=None)
  @chart.pen_configure(@id, key, value)
  self
end
            
current_configinfo(key=nil) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 1106
def current_configinfo(key=nil)
  @chart.current_pen_configinfo(@id, key)
end
            
delete() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 1110
def delete
  @chart.pen_delete(@id)
  self
end
            
id() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 1082
def id
  @id
end
            
mutex() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 996
def mutex; @mutex; end
            
name() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 1115
def name
  @pen
end
            
to_eval() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 1086
def to_eval
  @id
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.