Class | TkImage
In: | tk/lib/tk/image.rb
Parent: | TkObject

### Methods

delete height inuse itemtype names new new types width

### Included Modules

Tk

### Constants

TkCommandNames | = | ['image'.freeze].freeze
Tk_IMGTBL | = | TkCore::INTERP.create_table
Tk_Image_ID | = | ['i'.freeze, '00000'.taint].freeze

### Public Class methods

names()

[Source]

    # File tk/lib/tk/image.rb, line 87
      def TkImage.names
        Tk.tk_call_without_enc('image', 'names').split.collect!{|id|
          (Tk_IMGTBL[id])? Tk_IMGTBL[id] : id
        }
      end

new(keys=nil)

[Source]

    # File tk/lib/tk/image.rb, line 17
      def self.new(keys=nil)
        if keys.kind_of?(Hash)
          name = nil
          if keys.key?(:imagename)
            name = keys[:imagename]
          elsif keys.key?('imagename')
            name = keys['imagename']
          end
          if name
            if name.kind_of?(TkImage)
              obj = name
            else
              name = _get_eval_string(name)
              obj = Tk_IMGTBL[name]
            end
            if obj
              if !(keys[:without_creating] || keys['without_creating'])
                keys = _symbolkey2str(keys)
                keys.delete('imagename')
                keys.delete('without_creating')
                obj.instance_eval{
                  tk_call_without_enc('image', 'create',
                                      @type, @path, *hash_kv(keys, true))
                }
              end
              return obj
            end
          end
        end
        super(keys)
      end

new(keys=nil)

[Source]

    # File tk/lib/tk/image.rb, line 49
      def initialize(keys=nil)
        @path = nil
        without_creating = false
        if keys.kind_of?(Hash)
          keys = _symbolkey2str(keys)
          @path = keys.delete('imagename')
          without_creating = keys.delete('without_creating')
        end
        unless @path
          # @path = Tk_Image_ID.join('')
          @path = Tk_Image_ID.join(TkCore::INTERP._ip_id_)
          Tk_Image_ID[1].succ!
        end
        unless without_creating
          tk_call_without_enc('image', 'create',
                              @type, @path, *hash_kv(keys, true))
        end
        Tk_IMGTBL[@path] = self
      end

types()

[Source]

    # File tk/lib/tk/image.rb, line 93
      def TkImage.types
        Tk.tk_call_without_enc('image', 'types').split
      end

### Public Instance methods

delete()

[Source]

    # File tk/lib/tk/image.rb, line 69
      def delete
        Tk_IMGTBL.delete(@id) if @id
        tk_call_without_enc('image', 'delete', @path)
        self
      end

height()

[Source]

    # File tk/lib/tk/image.rb, line 74
      def height
        number(tk_call_without_enc('image', 'height', @path))
      end

inuse()

[Source]

    # File tk/lib/tk/image.rb, line 77
      def inuse
        bool(tk_call_without_enc('image', 'inuse', @path))
      end

itemtype()

[Source]

    # File tk/lib/tk/image.rb, line 80
      def itemtype
        tk_call_without_enc('image', 'type', @path)
      end

width()

[Source]

    # File tk/lib/tk/image.rb, line 83
      def width
        number(tk_call_without_enc('image', 'width', @path))
      end

[Validate]