Class: Tk::ICONS

Class | Tk::ICONS
In: | tk/lib/tkextlib/ICONS/icons.rb
Parent: | TkImage

### Methods

create delete delete name new new package_name package_version query query

### Constants

PACKAGE_NAME | = | 'icons'.freeze

### Public Class methods

create(*args)

[Source]

    # File tk/lib/tkextlib/ICONS/icons.rb, line 34
        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)

[Source]

    # File tk/lib/tkextlib/ICONS/icons.rb, line 47
        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)

[Source]

    # File tk/lib/tkextlib/ICONS/icons.rb, line 78
        def self.new(name, keys=nil)
          unless obj = Tk_IMGTBL["::icon::#{name}"]
            obj = allocate()
            obj.instance_eval{initialize(name, keys)}
          end
          obj
        end

new(name, keys=nil)

[Source]

    # File tk/lib/tkextlib/ICONS/icons.rb, line 86
        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

package_name()

[Source]

    # File tk/lib/tkextlib/ICONS/icons.rb, line 22
        def self.package_name
          PACKAGE_NAME
        end

package_version()

[Source]

    # File tk/lib/tkextlib/ICONS/icons.rb, line 26
        def self.package_version
          begin
            TkPackage.require('icons')
          rescue
            ''
          end
        end

query(*args)

[Source]

    # File tk/lib/tkextlib/ICONS/icons.rb, line 66
        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()

[Source]

    # File tk/lib/tkextlib/ICONS/icons.rb, line 105
        def delete
          Tk_IMGTBL.delete(@path)
          tk_call('::icons::icons', 'delete', @name)
          self
        end

name()

[Source]

    # File tk/lib/tkextlib/ICONS/icons.rb, line 101
        def name
          @name
        end

query(keys={})

[Source]

    # File tk/lib/tkextlib/ICONS/icons.rb, line 111
        def query(keys={})
          list(simplelist(tk_call('::icons::icons', 'query',
                                   *(hash_kv(keys) << @name))
                          )[0])
        end

[Validate]