In Files

  • tk/lib/tk/image.rb
  • tk/lib/tk/textimage.rb
  • tk/lib/tkextlib/treectrl/tktreectrl.rb

Class/Module Index [+]

Quicksearch

TkImage

Public Class Methods

names() click to toggle source
 
               # File tk/lib/tk/image.rb, line 105
def TkImage.names
  Tk_IMGTBL.mutex.synchronize{
    Tk.tk_call_without_enc('image', 'names').split.collect!{|id|
      (Tk_IMGTBL[id])? Tk_IMGTBL[id] : id
    }
  }
end
            
new(keys=nil) click to toggle source
 
               # File tk/lib/tk/image.rb, line 24
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 = nil
        Tk_IMGTBL.mutex.synchronize{
          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
  (obj = self.allocate).instance_eval{
    Tk_IMGTBL.mutex.synchronize{
      initialize(keys)
      Tk_IMGTBL[@path] = self
    }
  }
  obj
end
            
new(keys=nil) click to toggle source
 
               # File tk/lib/tk/image.rb, line 65
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
    Tk_Image_ID.mutex.synchronize{
      @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
end
            
types() click to toggle source
 
               # File tk/lib/tk/image.rb, line 113
def TkImage.types
  Tk.tk_call_without_enc('image', 'types').split
end
            

Public Instance Methods

delete() click to toggle source
 
               # File tk/lib/tk/image.rb, line 85
def delete
  Tk_IMGTBL.mutex.synchronize{
    Tk_IMGTBL.delete(@id) if @id
  }
  tk_call_without_enc('image', 'delete', @path)
  self
end
            
height() click to toggle source
 
               # File tk/lib/tk/image.rb, line 92
def height
  number(tk_call_without_enc('image', 'height', @path))
end
            
inuse() click to toggle source
 
               # File tk/lib/tk/image.rb, line 95
def inuse
  bool(tk_call_without_enc('image', 'inuse', @path))
end
            
itemtype() click to toggle source
 
               # File tk/lib/tk/image.rb, line 98
def itemtype
  tk_call_without_enc('image', 'type', @path)
end
            
mutex() click to toggle source
 
               # File tk/lib/tk/image.rb, line 16
def mutex; @mutex; end
            
width() click to toggle source
 
               # File tk/lib/tk/image.rb, line 101
def width
  number(tk_call_without_enc('image', 'width', @path))
end