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 644
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 697
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
            
new(chart, element=nil, keys={}) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 652
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
            
type2class(type) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 640
def Element.type2class(type)
  ElementTypeToClass[type]
end
            

Public Instance Methods

activate(*args) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 753
def activate(*args)
  @chart.element_activate(@id, *args)
end
            
cget(option) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 732
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 736
def cget_strict(option)
  @chart.__send__(@typename + '_cget_strict', @id, option)
end
            
closest(x, y, var, keys={}) click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 757
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 744
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 739
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 748
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 762
def deactivate
  @chart.element_deactivate(@id)
  self
end
            
delete() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 767
def delete
  @chart.element_delete(@id)
  self
end
            
exist?() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 772
def exist?
  @chart.element_exist?(@id)
end
            
id() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 724
def id
  @id
end
            
mutex() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 636
def mutex; @mutex; end
            
name() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 776
def name
  @element
end
            
to_eval() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 728
def to_eval
  @id
end
            
type() click to toggle source
 
               # File tk/lib/tkextlib/blt/component.rb, line 780
def type
  @chart.element_type(@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.

blog comments powered by Disqus