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

In Files

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

Class/Module Index [+]

Quicksearch

Tk::BLT::PlotComponent::Element

Public Class Methods

id2obj(chart, id) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 684
def Element.id2obj(chart, id)
  cpath = chart.path
  ElementID_TBL.mutex.synchronize{
    return id unless ElementID_TBL[cpath]
    ElementID_TBL[cpath][id]? ElementID_TBL[cpath][id]: id
  }
end
            
new(chart, element=nil, keys={}) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 692
def self.new(chart, element=nil, keys={})
  if element.kind_of?(Hash)
    keys = element
    element = nil
  end
  if keys
    keys = _symbolkey2str(keys)
    not_create = keys.delete('without_creating')
  else
    not_create = false
  end

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

  obj.configure(keys) if obj && ! keys.empty?
  obj
end
            
new(chart, element=nil, keys={}) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 737
def initialize(chart, element=nil, keys={})
  # dummy:: not called by 'new' method

  if element.kind_of?(Hash)
    keys = element
    element = nil
  end
  if element
    @element = @id = element.to_s
  else
    OBJ_ID.mutex.synchronize{
      @element = @id = OBJ_ID.join(TkCore::INTERP._ip_id_).freeze
      OBJ_ID[1].succ!
    }
  end
  @path = @id
  @parent = @chart = chart
  @cpath = @chart.path
  @typename = self.class::ElementTypeName
  # Element::ElementID_TBL[@cpath][@element] = self
  keys = _symbolkey2str(keys)
  unless keys.delete('without_creating')
    # @chart.element_create(@element, keys)
    tk_call(@chart, @typename, 'create', @element, keys)
  end
end
            
type2class(type) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 680
def Element.type2class(type)
  ElementTypeToClass[type]
end
            

Public Instance Methods

activate(*args) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 797
def activate(*args)
  @chart.element_activate(@id, *args)
end
            
cget(option) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 776
def cget(option)
  # @chart.element_cget(@id, option)
  @chart.__send__(@typename + '_cget', @id, option)
end
            
cget_strict(option) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 780
def cget_strict(option)
  @chart.__send__(@typename + '_cget_strict', @id, option)
end
            
cget_tkstring(option) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 772
def cget_tkstring(option)
  # @chart.element_cget(@id, option)
  @chart.__send__(@typename + '_cget_tkstring', @id, option)
end
            
closest(x, y, var, keys={}) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 801
def closest(x, y, var, keys={})
  # @chart.element_closest(x, y, var, @id, keys)
  @chart.__send__(@typename + '_closest', x, y, var, @id, keys)
end
            
configinfo(key=nil) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 788
def configinfo(key=nil)
  # @chart.element_configinfo(@id, key)
  @chart.__send__(@typename + '_configinfo', @id, key)
end
            
configure(key, value=None) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 783
def configure(key, value=None)
  # @chart.element_configure(@id, key, value)
  @chart.__send__(@typename + '_configure', @id, key, value)
  self
end
            
current_configinfo(key=nil) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 792
def current_configinfo(key=nil)
  # @chart.current_element_configinfo(@id, key)
  @chart.__send__('current_' << @typename << '_configinfo', @id, key)
end
            
deactivate() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 806
def deactivate
  @chart.element_deactivate(@id)
  self
end
            
delete() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 811
def delete
  @chart.element_delete(@id)
  self
end
            
exist?() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 816
def exist?
  @chart.element_exist?(@id)
end
            
id() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 764
def id
  @id
end
            
mutex() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 676
def mutex; @mutex; end
            
name() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 820
def name
  @element
end
            
to_eval() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 768
def to_eval
  @id
end
            
type() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 824
def type
  @chart.element_type(@id)
end