module TkItemConfigOptkeys - tk-0.2.0 Documentation

# module TkItemConfigOptkeys

### Public Instance Methods

__conv_item_keyonly_opts(id, keys) click to toggle source

    # File lib/tk/itemconfig.rb, line 94
    def __conv_item_keyonly_opts(id, keys)
      return keys unless keys.kind_of?(Hash)
      keyonly = __item_keyonly_optkeys(id)
      keys2 = {}
      keys.each{|k, v|
        optkey = keyonly.find{|kk,vv| kk.to_s == k.to_s}
        if optkey
          defkey, undefkey = optkey
          if v
            keys2[defkey.to_s] = None
          else
            keys2[undefkey.to_s] = None
          end
        else
          keys2[k.to_s] = v
        end
      }
      keys2
    end

itemconfig_hash_kv(id, keys, enc_mode = nil, conf = nil) click to toggle source

    # File lib/tk/itemconfig.rb, line 114
    def itemconfig_hash_kv(id, keys, enc_mode = nil, conf = nil)
      hash_kv(__conv_item_keyonly_opts(id, keys), enc_mode, conf)
    end

### Private Instance Methods

__item_boolval_optkeys(id) click to toggle source

    # File lib/tk/itemconfig.rb, line 27
    def __item_boolval_optkeys(id)
      ['exportselection', 'jump', 'setgrid', 'takefocus']
    end

__item_keyonly_optkeys(id) click to toggle source

    # File lib/tk/itemconfig.rb, line 87
    def __item_keyonly_optkeys(id)  # { def_key=>(undef_key|nil), ... }
      # maybe need to override
      {}
    end

__item_listval_optkeys(id) click to toggle source

    # File lib/tk/itemconfig.rb, line 44
    def __item_listval_optkeys(id)
      []
    end

__item_methodcall_optkeys(id) click to toggle source

    # File lib/tk/itemconfig.rb, line 75
    def __item_methodcall_optkeys(id)  # { key=>method, ... }
      # Use the method for both of get and set.
      # Usually, the 'key' will not be a widget option.
      #
      # maybe need to override
      # {'coords'=>'coords'}
      {}
    end

__item_numlistval_optkeys(id) click to toggle source

    # File lib/tk/itemconfig.rb, line 49
    def __item_numlistval_optkeys(id)
      # maybe need to override
      ['dash', 'activedash', 'disableddash']
    end

__item_numstrval_optkeys(id) click to toggle source

    # File lib/tk/itemconfig.rb, line 22
    def __item_numstrval_optkeys(id)
      []
    end

__item_numval_optkeys(id) click to toggle source

    # File lib/tk/itemconfig.rb, line 17
    def __item_numval_optkeys(id)
      []
    end

__item_optkey_aliases(id) click to toggle source

    # File lib/tk/itemconfig.rb, line 12
    def __item_optkey_aliases(id)
      {}
    end

__item_ruby2val_optkeys(id) click to toggle source

    # File lib/tk/itemconfig.rb, line 67
    def __item_ruby2val_optkeys(id)  # { key=>method, ... }
      # The method is used to convert a ruby's object to a opt-value.
      # When set the value of the option "key", "method.call(id, val)" is called.
      # That is, "-#{key} #{method.call(id, value)}".
      {}
    end

__item_strval_optkeys(id) click to toggle source

    # File lib/tk/itemconfig.rb, line 32
    def __item_strval_optkeys(id)
      # maybe need to override
      [
        'text', 'label', 'show', 'data', 'file', 'maskdata', 'maskfile',
        'activebackground', 'activeforeground', 'background',
        'disabledforeground', 'disabledbackground', 'foreground',
        'highlightbackground', 'highlightcolor', 'insertbackground',
        'selectbackground', 'selectforeground', 'troughcolor'
      ]
    end

__item_tkvariable_optkeys(id) click to toggle source

    # File lib/tk/itemconfig.rb, line 55
    def __item_tkvariable_optkeys(id)
      ['variable', 'textvariable']
    end

__item_val2ruby_optkeys(id) click to toggle source

    # File lib/tk/itemconfig.rb, line 60
    def __item_val2ruby_optkeys(id)  # { key=>method, ... }
      # The method is used to convert a opt-value to a ruby's object.
      # When get the value of the option "key", "method.call(id, val)" is called.
      {}
    end