In Files

  • tk/lib/tkextlib/ICONS/icons.rb

Class/Module Index [+]

Quicksearch

Tk::ICONS

Constants

PACKAGE_NAME

Public Class Methods

_new(name, keys=nil) click to toggle source
Alias for: new
create(*args) click to toggle source
 
               # File tk/lib/tkextlib/ICONS/icons.rb, line 35
def self.create(*args)  # icon, icon, ..., ?option=>value, ...?
  if args[-1].kind_of?(Hash)
    keys = args.pop
    icons = simplelist(tk_call('::icons::icons', 'create',
                               *(hash_kv(keys) << (args.flatten))))
  else
    icons = simplelist(tk_call('::icons::icons', 'create',
                               args.flatten))
  end

  icons.collect{|icon| self.new(icon, :without_creating=>true)}
end
            
delete(*icons) click to toggle source
 
               # File tk/lib/tkextlib/ICONS/icons.rb, line 48
def self.delete(*icons)  # icon, icon, ...
  icons = icons.flatten
  return if icons.empty?
  icons.map!{|icon|
    if icon.kind_of?(Tk::ICONS)
      Tk_IMGTBL.delete(icon.path)
      icon.name
    elsif icon.to_s =~ /^::icon::(.*)/
      name = $1
      Tk_IMGTBL.delete(icon)
      name
    else
      Tk_IMGTBL.delete("::icon::#{icon}")
      icon
    end
  }
  tk_call('::icons::icons', 'delete', icons)
end
            
new(name, keys=nil) click to toggle source
 
               # File tk/lib/tkextlib/ICONS/icons.rb, line 99
def initialize(name, keys=nil)
  if name.kind_of?(String) && name =~ /^::icon::(.+)$/
      @name = $1
      @path = name
  else
    @name = name.to_s
    @path = "::icon::#{@name}"
  end
  keys = _symbolkey2str(keys)
  unless keys.delete('without_creating')
    tk_call('::icons::icons', 'create', *(hash_kv(keys) << @name))
  end
  Tk_IMGTBL[@path] = self
end
            
new(name, keys=nil) click to toggle source
 
               # File tk/lib/tkextlib/ICONS/icons.rb, line 82
def new(name, keys=nil)
  if obj = Tk_IMGTBL["::icon::#{name}"]
    if keys
      keys = _symbolkey2str(keys)
      unless keys.delete('without_creating')
        tk_call('::icons::icons', 'create', *(hash_kv(keys) << obj.name))
      end
    end
  else
    obj = _new(name, keys)
  end
  obj
end
            
Also aliased as: _new
package_name() click to toggle source
 
               # File tk/lib/tkextlib/ICONS/icons.rb, line 23
def self.package_name
  PACKAGE_NAME
end
            
package_version() click to toggle source
 
               # File tk/lib/tkextlib/ICONS/icons.rb, line 27
def self.package_version
  begin
    TkPackage.require('icons')
  rescue
    ''
  end
end
            
query(*args) click to toggle source
 
               # File tk/lib/tkextlib/ICONS/icons.rb, line 67
def self.query(*args)  # icon, icon, ..., ?option=>value, ...?
  if args[-1].kind_of?(Hash)
    keys = args.pop
    simplelist(tk_call('::icons::icons', 'query',
                       *(hash_kv(keys) << (args.flatten))))
  else
    simplelist(tk_call('::icons::icons', 'query', args.flatten))
  end . map{|inf| list(inf) }
end
            

Public Instance Methods

delete() click to toggle source
 
               # File tk/lib/tkextlib/ICONS/icons.rb, line 118
def delete
  Tk_IMGTBL.delete(@path)
  tk_call('::icons::icons', 'delete', @name)
  self
end
            
name() click to toggle source
 
               # File tk/lib/tkextlib/ICONS/icons.rb, line 114
def name
  @name
end
            
query(keys={}) click to toggle source
 
               # File tk/lib/tkextlib/ICONS/icons.rb, line 124
def query(keys={})
  list(simplelist(tk_call('::icons::icons', 'query',
                           *(hash_kv(keys) << @name))
                  )[0])
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.