Class | Tk::Winico
In: | tk/lib/tkextlib/winico/winico.rb
Parent: | TkObject

### Methods

_config_keys delete destroy icon_info id id2obj info info new new_from_file new_from_resource package_name package_version set_window

### Classes and Modules

Class Tk::Winico::Winico_callback

### Constants

PACKAGE_NAME | = | 'winico'.freeze
WinicoID_TBL | = | TkCore::INTERP.create_table

### Public Class methods

_config_keys()

[Source]

    # File tk/lib/tkextlib/winico/winico.rb, line 145
        def self._config_keys
          ['callback']
        end

icon_info(id)

[Source]

    # File tk/lib/tkextlib/winico/winico.rb, line 49
      def self.icon_info(id)
        simplelist(Tk.tk_call('winico', 'info', id)).collect{|inf|
          h = Hash[*list(inf)]
          h.keys.each{|k| h[k[1..-1]] = h.delete(k)}
        }
      end

id2obj(id)

[Source]

    # File tk/lib/tkextlib/winico/winico.rb, line 39
      def self.id2obj(id)
        (WinicoID_TBL.key?(id))? WinicoID_TBL[id] : id
      end

info()

[Source]

    # File tk/lib/tkextlib/winico/winico.rb, line 43
      def self.info
        simplelist(Tk.tk_call('winico', 'info')).collect{|id|
          Tk::Winico.id2obj(id)
        }
      end

new(file_name, resource_name=nil, winico_id=nil)

[Source]

    # File tk/lib/tkextlib/winico/winico.rb, line 66
      def initialize(file_name, resource_name=nil, winico_id=nil)
        if resource_name
          # from resource
          if file_name
            @id = Tk.tk_call('winico', 'load', resource_name, file_name)
          else
            @id = Tk.tk_call('winico', 'load', resource_name)
          end
        elsif file_name
          # from .ico file
          @id = Tk.tk_call('winico', 'createfrom', file_name)
        elsif winico_id
          @id = winico_id
        else
          fail ArgumentError,
               "must be given proper information from where loading icons"
        end
        @path = @id
        WinicoID_TBL[@id] = self
      end

new_from_file(file_name)

[Source]

    # File tk/lib/tkextlib/winico/winico.rb, line 58
      def self.new_from_file(file_name)
        self.new(file_name)
      end

new_from_resource(resource_name, file_name = nil)

[Source]

    # File tk/lib/tkextlib/winico/winico.rb, line 62
      def self.new_from_resource(resource_name, file_name = nil)
        self.new(file_name, resource_name)
      end

package_name()

[Source]

    # File tk/lib/tkextlib/winico/winico.rb, line 21
        def self.package_name
          PACKAGE_NAME
        end

package_version()

[Source]

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

### Public Instance methods

delete()

[Source]

    # File tk/lib/tkextlib/winico/winico.rb, line 97
      def delete
        tk_call('winico', 'delete', @id)
        WinicoID_TBL.delete(@id)
        self
      end

destroy()

Alias for delete

id()

[Source]

    # File tk/lib/tkextlib/winico/winico.rb, line 87
      def id
        @id
      end

info()

[Source]

    # File tk/lib/tkextlib/winico/winico.rb, line 104
      def info
        Tk::Winico.icon_info(@id)
      end

set_window(win_id, *opts)

[Source]

    # File tk/lib/tkextlib/winico/winico.rb, line 91
      def set_window(win_id, *opts) # opts := ?'big'|'small'?, ?pos?
        # NOTE:: the window, which is denoted by win_id, MUST BE MAPPED.
        #        If not, then this may fail or crash.
        tk_call('winico', 'setwindow', win_id, @id, *opts)
      end

[Validate]