Module | TkComm
In: | tk/lib/tk.rb

define TkComm module (step 2: event binding)

### Methods

_at bind bind_all bind_append bind_append_all bind_remove bind_remove_all bindinfo bindinfo_all image_obj install_cmd subst uninstall_cmd

### Included Modules

TkUtil TkEvent

### Classes and Modules

Module TkComm::Tk_CMDTBL
Module TkComm::Tk_WINDOWS

### Constants

WidgetClassNames | = | {}.taint
TkExtlibAutoloadModule | = | [].taint
Tk_IDs | = | ["00000".taint, "00000".taint].freeze # [0]-cmdid, [1]-winid |  | Tk_CMDTBL = {} Tk_WINDOWS = {}
Tk_CMDTBL | = | Object.new |  | for backward compatibility
Tk_WINDOWS | = | Object.new

GET_CONFIGINFO_AS_ARRAY

=

true

GET_CONFIGINFO_AS_ARRAY = false => returns a Hash { opt =>val, … }

                              true  => returns an Array [[opt,val], ... ]

val is a list which includes resource info.

GET_CONFIGINFOwoRES_AS_ARRAY

=

true

for configinfo without resource info; list of [opt, value] pair

              false => returns a Hash { opt=>val, ... }
              true  => returns an Array [[opt,val], ... ]

USE_TCLs_LIST_FUNCTIONS | = | true

### Public Instance methods

_at(x,y=nil)

[Source]

    # File tk/lib/tk.rb, line 182
      def _at(x,y=nil)
        if y
          "@#{Integer(x)},#{Integer(y)}"
        else
          "@#{Integer(x)}"
        end
      end

bind(tagOrClass, context, *args)

def bind(tagOrClass, context, cmd=Proc.new, *args)

      _bind(["bind", tagOrClass], context, cmd, *args)
      tagOrClass

end

[Source]

    # File tk/lib/tk.rb, line 979
      def bind(tagOrClass, context, *args)
        # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
        if TkComm._callback_entry?(args[0]) || !block_given?
          cmd = args.shift
        else
          cmd = Proc.new
        end
        _bind(["bind", tagOrClass], context, cmd, *args)
        tagOrClass
      end

bind_all(context, *args)

def bind_all(context, cmd=Proc.new, *args)

      _bind(['bind', 'all'], context, cmd, *args)
      TkBindTag::ALL

end

[Source]

    # File tk/lib/tk.rb, line 1018
      def bind_all(context, *args)
        # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
        if TkComm._callback_entry?(args[0]) || !block_given?
          cmd = args.shift
        else
          cmd = Proc.new
        end
        _bind(['bind', 'all'], context, cmd, *args)
        TkBindTag::ALL
      end

bind_append(tagOrClass, context, *args)

def bind_append(tagOrClass, context, cmd=Proc.new, *args)

      _bind_append(["bind", tagOrClass], context, cmd, *args)
      tagOrClass

end

[Source]

    # File tk/lib/tk.rb, line 994
      def bind_append(tagOrClass, context, *args)
        # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
        if TkComm._callback_entry?(args[0]) || !block_given?
          cmd = args.shift
        else
          cmd = Proc.new
        end
        _bind_append(["bind", tagOrClass], context, cmd, *args)
        tagOrClass
      end

bind_append_all(context, *args)

def bind_append_all(context, cmd=Proc.new, *args)

      _bind_append(['bind', 'all'], context, cmd, *args)
      TkBindTag::ALL

end

[Source]

    # File tk/lib/tk.rb, line 1033
      def bind_append_all(context, *args)
        # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
        if TkComm._callback_entry?(args[0]) || !block_given?
          cmd = args.shift
        else
          cmd = Proc.new
        end
        _bind_append(['bind', 'all'], context, cmd, *args)
        TkBindTag::ALL
      end

bind_remove(tagOrClass, context)

[Source]

    # File tk/lib/tk.rb, line 1005
      def bind_remove(tagOrClass, context)
        _bind_remove(['bind', tagOrClass], context)
        tagOrClass
      end

bind_remove_all(context)

[Source]

    # File tk/lib/tk.rb, line 1044
      def bind_remove_all(context)
        _bind_remove(['bind', 'all'], context)
        TkBindTag::ALL
      end

bindinfo(tagOrClass, context=nil)

[Source]

    # File tk/lib/tk.rb, line 1010
      def bindinfo(tagOrClass, context=nil)
        _bindinfo(['bind', tagOrClass], context)
      end

bindinfo_all(context=nil)

[Source]

    # File tk/lib/tk.rb, line 1049
      def bindinfo_all(context=nil)
        _bindinfo(['bind', 'all'], context)
      end

image_obj(val)

[Source]

    # File tk/lib/tk.rb, line 596
      def image_obj(val)
        if val =~ /^i(_\d+_)?\d+$/
          TkImage::Tk_IMGTBL[val]? TkImage::Tk_IMGTBL[val] : val
        else
          val
        end
      end

install_cmd(cmd)

[Source]

    # File tk/lib/tk.rb, line 784
      def install_cmd(cmd)
        return '' if cmd == ''
        id = _next_cmd_id
        #Tk_CMDTBL[id] = cmd
        if cmd.kind_of?(TkCallbackEntry)
          TkCore::INTERP.tk_cmd_tbl[id] = cmd
        else
          TkCore::INTERP.tk_cmd_tbl[id] = TkCore::INTERP.get_cb_entry(cmd)
        end
        @cmdtbl = [] unless defined? @cmdtbl
        @cmdtbl.taint unless @cmdtbl.tainted?
        @cmdtbl.push id
        #return Kernel.format("rb_out %s", id);
        return 'rb_out' + TkCore::INTERP._ip_id_ + ' ' + id
      end

subst(str, *opts)

[Source]

    # File tk/lib/tk.rb, line 618
      def subst(str, *opts)
        # opts := :nobackslashes | :nocommands | novariables
        tk_call('subst',
                *(opts.collect{|opt|
                    opt = opt.to_s
                    (opt[0] == ?-)? opt: '-' << opt
                  } << str))
      end

uninstall_cmd(id)

[Source]

    # File tk/lib/tk.rb, line 799
      def uninstall_cmd(id)
        id = $1 if /rb_out\S* (c(_\d+_)?\d+)/ =~ id
        #Tk_CMDTBL.delete(id)
        TkCore::INTERP.tk_cmd_tbl.delete(id)
      end

[Validate]