Class Tk::BLT::PlotComponent::Element
In: tk/lib/tkextlib/blt/component.rb
Parent: TkObject

Methods

activate   cget   closest   configinfo   configure   current_configinfo   deactivate   delete   exist?   id   id2obj   name   new   new   to_eval   type   type2class  

Constants

ElementTypeName = 'element'
ElementTypeToClass = { ElementTypeName=>self }
ElementID_TBL = TkCore::INTERP.create_table
OBJ_ID = ['blt_chart_element'.freeze, '00000'.taint].freeze
OBJ_TBL = {}

Public Class methods

[Source]

# File tk/lib/tkextlib/blt/component.rb, line 514
      def Element.id2obj(chart, id)
        cpath = chart.path
        return id unless OBJ_TBL[cpath]
        OBJ_TBL[cpath][id]? OBJ_TBL[cpath][id]: id
      end

[Source]

# File tk/lib/tkextlib/blt/component.rb, line 532
      def initialize(chart, element=nil, keys={})
        if element.kind_of?(Hash)
          keys = element
          element = nil
        end
        if element
          @element = @id = element.to_s
        else
          @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::OBJ_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

[Source]

# File tk/lib/tkextlib/blt/component.rb, line 520
      def self.new(chart, element=nil, keys={})
        if element.kind_of?(Hash)
          keys = element
          element = nil
        end
        OBJ_TBL[chart.path] = {} unless OBJ_TBL[chart.path]
        if element && OBJ_TBL[chart.path][element]
          return OBJ_TBL[chart.path][element]
        end
        super(chart, element, keys)
      end

[Source]

# File tk/lib/tkextlib/blt/component.rb, line 510
      def Element.type2class(type)
        ElementTypeToClass[type]
      end

Public Instance methods

[Source]

# File tk/lib/tkextlib/blt/component.rb, line 581
      def activate(*args)
        @chart.element_activate(@id, *args)
      end

[Source]

# File tk/lib/tkextlib/blt/component.rb, line 563
      def cget(option)
        # @chart.element_cget(@id, option)
        @chart.__send__(@typename + '_cget', @id, option)
      end

[Source]

# File tk/lib/tkextlib/blt/component.rb, line 585
      def closest(x, y, var, keys={})
        # @chart.element_closest(x, y, var, @id, keys)
        @chart.__send__(@typename + '_closest', x, y, var, @id, keys)
      end

[Source]

# File tk/lib/tkextlib/blt/component.rb, line 572
      def configinfo(key=nil)
        # @chart.element_configinfo(@id, key)
        @chart.__send__(@typename + '_configinfo', @id, key)
      end

[Source]

# File tk/lib/tkextlib/blt/component.rb, line 567
      def configure(key, value=None)
        # @chart.element_configure(@id, key, value)
        @chart.__send__(@typename + '_configure', @id, key, value)
        self
      end

[Source]

# File tk/lib/tkextlib/blt/component.rb, line 576
      def current_configinfo(key=nil)
        # @chart.current_element_configinfo(@id, key)
        @chart.__send__('current_' << @typename << '_configinfo', @id, key)
      end

[Source]

# File tk/lib/tkextlib/blt/component.rb, line 590
      def deactivate
        @chart.element_deactivate(@id)
        self
      end

[Source]

# File tk/lib/tkextlib/blt/component.rb, line 595
      def delete
        @chart.element_delete(@id)
        self
      end

[Source]

# File tk/lib/tkextlib/blt/component.rb, line 600
      def exist?
        @chart.element_exist?(@id)
      end

[Source]

# File tk/lib/tkextlib/blt/component.rb, line 555
      def id
        @id
      end

[Source]

# File tk/lib/tkextlib/blt/component.rb, line 604
      def name
        @element
      end

[Source]

# File tk/lib/tkextlib/blt/component.rb, line 559
      def to_eval
        @id
      end

[Source]

# File tk/lib/tkextlib/blt/component.rb, line 608
      def type
        @chart.element_type(@id)
      end

[Validate]