Class: Tk::TreeCtrl::NotifyEvent

Inherits:
TkUtil::CallbackSubst show all
Defined in:
ext/lib/tkextlib/treectrl/tktreectrl.rb,
ext/lib/tkextlib/treectrl/tktreectrl.rb

Constant Summary collapse

KEY_TBL =
<‘%’ subst-key char>, <proc type char>, <instance var (accessor) name>
[
  [ ?c, ?n, :item_num ], 
  [ ?d, ?s, :detail ], 
  [ ?D, ?l, :items ], 
  [ ?e, ?e, :event ], 
  [ ?I, ?n, :id ], 
  [ ?l, ?n, :lower_bound ], 
  [ ?p, ?n, :active_id ], 
  [ ?P, ?e, :pattern ], 
  [ ?S, ?l, :sel_items ], 
  [ ?T, ?w, :widget ], 
  [ ?u, ?n, :upper_bound ], 
  [ ?W, ?o, :object ], 
  [ ??, ?x, :parm_info ], 
  nil
]
PROC_TBL =
<proc type char>, <proc/method to convert tcl-str to ruby-obj>
[
  [ ?n, TkComm.method(:num_or_str) ], 
  [ ?s, TkComm.method(:string) ], 
  [ ?l, TkComm.method(:list) ], 
  [ ?w, TkComm.method(:window) ], 

  [ ?e, proc{|val|
      case val
      when /^<<[^<>]+>>$/
        TkVirtualEvent.getobj(val[1..-2])
      when /^<[^<>]+>$/
        val[1..-2]
      else
        val
      end
    }
  ], 

  [ ?o, proc{|val| TkComm.tk_tcl2ruby(val)} ], 

  [ ?x, proc{|val|
      begin
        inf = {}
        Hash[*(TkComm.list(val))].each{|k, v|
          if keyinfo = KEY_TBL.assoc(k[0])
            if cmd = PROC_TBL.assoc(keyinfo[1])
              begin
                new_v = cmd.call(v)
                v = new_v
              rescue
              end
            end
          end
          inf[k] = v
        }
        inf
      rescue
        val
      end
    } ], 

  nil
]

Method Summary

Methods inherited from TkUtil::CallbackSubst

_define_attribute_aliases, _get_all_subst_keys, _get_extra_args_tbl, _get_subst_key, _setup_subst_table, _sym2subst, #initialize, inspect, ret_val, scan_args, subst_arg

Constructor Details

This class inherits a constructor from TkUtil::CallbackSubst