Class: Tk::BLT::PlotComponent::Element (Ruby 2.3.4)

In Files

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

Class/Module Index [+]

Quicksearch

Tk::BLT::PlotComponent::Element

Public Class Methods

id2obj(chart, id)
 
               # File tk/lib/tkextlib/blt/component.rb, line 685
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={})
 
               # File tk/lib/tkextlib/blt/component.rb, line 693
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={})
 
               # File tk/lib/tkextlib/blt/component.rb, line 738
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)
 
               # File tk/lib/tkextlib/blt/component.rb, line 681
def Element.type2class(type)
  ElementTypeToClass[type]
end
            

Public Instance Methods

activate(*args)
 
               # File tk/lib/tkextlib/blt/component.rb, line 798
def activate(*args)
  @chart.element_activate(@id, *args)
end
            
cget(option)
 
               # File tk/lib/tkextlib/blt/component.rb, line 777
def cget(option)
  # @chart.element_cget(@id, option)
  @chart.__send__(@typename + '_cget', @id, option)
end
            
cget_strict(option)
 
               # File tk/lib/tkextlib/blt/component.rb, line 781
def cget_strict(option)
  @chart.__send__(@typename + '_cget_strict', @id, option)
end
            
cget_tkstring(option)
 
               # File tk/lib/tkextlib/blt/component.rb, line 773
def cget_tkstring(option)
  # @chart.element_cget(@id, option)
  @chart.__send__(@typename + '_cget_tkstring', @id, option)
end
            
closest(x, y, var, keys={})
 
               # File tk/lib/tkextlib/blt/component.rb, line 802
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)
 
               # File tk/lib/tkextlib/blt/component.rb, line 789
def configinfo(key=nil)
  # @chart.element_configinfo(@id, key)
  @chart.__send__(@typename + '_configinfo', @id, key)
end
            
configure(key, value=None)
 
               # File tk/lib/tkextlib/blt/component.rb, line 784
def configure(key, value=None)
  # @chart.element_configure(@id, key, value)
  @chart.__send__(@typename + '_configure', @id, key, value)
  self
end
            
current_configinfo(key=nil)
 
               # File tk/lib/tkextlib/blt/component.rb, line 793
def current_configinfo(key=nil)
  # @chart.current_element_configinfo(@id, key)
  @chart.__send__('current_' << @typename << '_configinfo', @id, key)
end
            
deactivate()
 
               # File tk/lib/tkextlib/blt/component.rb, line 807
def deactivate
  @chart.element_deactivate(@id)
  self
end
            
delete()
 
               # File tk/lib/tkextlib/blt/component.rb, line 812
def delete
  @chart.element_delete(@id)
  self
end
            
exist?()
 
               # File tk/lib/tkextlib/blt/component.rb, line 817
def exist?
  @chart.element_exist?(@id)
end
            
id()
 
               # File tk/lib/tkextlib/blt/component.rb, line 765
def id
  @id
end
            
mutex()
 
               # File tk/lib/tkextlib/blt/component.rb, line 677
def mutex; @mutex; end
            
name()
 
               # File tk/lib/tkextlib/blt/component.rb, line 821
def name
  @element
end
            
to_eval()
 
               # File tk/lib/tkextlib/blt/component.rb, line 769
def to_eval
  @id
end
            
type()
 
               # File tk/lib/tkextlib/blt/component.rb, line 825
def type
  @chart.element_type(@id)
end