In Files

  • tk/lib/tk/tk_mac.rb

Parent

Methods

Class/Module Index [+]

Quicksearch

Tk::Mac::IconBitmap

Constants

TkCommandNames

Public Class Methods

new(width, height, keys) click to toggle source
 
               # File tk/lib/tk/tk_mac.rb, line 99
def self.new(width, height, keys)
  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('::tk::mac::iconBitmap',
                                @path, width, height, *hash_kv(keys, true))
          }
        end
        return obj
      end
    end
  end
  (obj = self.allocate).instance_eval{
    Tk_IMGTBL.mutex.synchronize{
      initialize(width, height, keys)
      Tk_IMGTBL[@path] = self
    }
  }
  obj
end
            
new(width, height, keys) click to toggle source
 
               # File tk/lib/tk/tk_mac.rb, line 140
def initialize(width, height, keys)
  @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('::tk::mac::iconBitmap',
                        @path, width, height, *hash_kv(keys, true))
  end
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.