tk 0.1.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +2 -0
  3. data/MANUAL_tcltklib.eng +0 -2
  4. data/MANUAL_tcltklib.ja +0 -2
  5. data/README.ActiveTcl +1 -1
  6. data/README.md +53 -1
  7. data/ext/tk/extconf.rb +4 -2
  8. data/ext/tk/old-extconf.rb +0 -1
  9. data/ext/tk/tcltklib.c +47 -149
  10. data/ext/tk/tkutil/extconf.rb +0 -2
  11. data/ext/tk/tkutil/tkutil.c +6 -9
  12. data/lib/multi-tk.rb +99 -320
  13. data/lib/remote-tk.rb +8 -25
  14. data/lib/tk.rb +49 -130
  15. data/lib/tk/autoload.rb +3 -3
  16. data/lib/tk/bgerror.rb +2 -2
  17. data/lib/tk/bindtag.rb +1 -1
  18. data/lib/tk/canvas.rb +7 -15
  19. data/lib/tk/canvastag.rb +11 -19
  20. data/lib/tk/entry.rb +1 -1
  21. data/lib/tk/font.rb +1 -1
  22. data/lib/tk/fontchooser.rb +1 -1
  23. data/lib/tk/grid.rb +4 -4
  24. data/lib/tk/image.rb +1 -1
  25. data/lib/tk/itemconfig.rb +4 -4
  26. data/lib/tk/itemfont.rb +3 -3
  27. data/lib/tk/listbox.rb +1 -1
  28. data/lib/tk/menu.rb +4 -4
  29. data/lib/tk/menuspec.rb +0 -1
  30. data/lib/tk/msgcat.rb +5 -5
  31. data/lib/tk/namespace.rb +14 -34
  32. data/lib/tk/optiondb.rb +3 -74
  33. data/lib/tk/optionobj.rb +1 -1
  34. data/lib/tk/scale.rb +3 -3
  35. data/lib/tk/scrollable.rb +4 -2
  36. data/lib/tk/selection.rb +5 -4
  37. data/lib/tk/text.rb +9 -17
  38. data/lib/tk/textmark.rb +1 -1
  39. data/lib/tk/texttag.rb +7 -15
  40. data/lib/tk/timer.rb +2 -2
  41. data/lib/tk/tk_mac.rb +18 -18
  42. data/lib/tk/validation.rb +6 -37
  43. data/lib/tk/variable.rb +10 -8
  44. data/lib/tk/virtevent.rb +1 -1
  45. data/lib/tk/winfo.rb +1 -1
  46. data/lib/tkextlib/blt/barchart.rb +0 -17
  47. data/lib/tkextlib/blt/bitmap.rb +1 -1
  48. data/lib/tkextlib/blt/component.rb +40 -40
  49. data/lib/tkextlib/blt/dragdrop.rb +6 -6
  50. data/lib/tkextlib/blt/graph.rb +0 -17
  51. data/lib/tkextlib/blt/stripchart.rb +0 -17
  52. data/lib/tkextlib/blt/tabset.rb +16 -31
  53. data/lib/tkextlib/blt/tree.rb +6 -6
  54. data/lib/tkextlib/blt/treeview.rb +14 -14
  55. data/lib/tkextlib/blt/watch.rb +1 -1
  56. data/lib/tkextlib/bwidget/labelentry.rb +6 -14
  57. data/lib/tkextlib/bwidget/listbox.rb +13 -29
  58. data/lib/tkextlib/bwidget/notebook.rb +6 -14
  59. data/lib/tkextlib/bwidget/progressdlg.rb +2 -2
  60. data/lib/tkextlib/bwidget/spinbox.rb +6 -14
  61. data/lib/tkextlib/bwidget/tree.rb +19 -35
  62. data/lib/tkextlib/itcl/incr_tcl.rb +2 -2
  63. data/lib/tkextlib/itk/incr_tk.rb +7 -29
  64. data/lib/tkextlib/iwidgets/calendar.rb +0 -15
  65. data/lib/tkextlib/iwidgets/entryfield.rb +1 -22
  66. data/lib/tkextlib/iwidgets/notebook.rb +2 -2
  67. data/lib/tkextlib/iwidgets/promptdialog.rb +1 -1
  68. data/lib/tkextlib/iwidgets/scrolledcanvas.rb +6 -14
  69. data/lib/tkextlib/iwidgets/spinner.rb +1 -1
  70. data/lib/tkextlib/iwidgets/tabnotebook.rb +2 -2
  71. data/lib/tkextlib/iwidgets/tabset.rb +1 -1
  72. data/lib/tkextlib/pkg_checker.rb +1 -1
  73. data/lib/tkextlib/tcllib/crosshair.rb +2 -2
  74. data/lib/tkextlib/tcllib/ctext.rb +2 -2
  75. data/lib/tkextlib/tcllib/plotchart.rb +5 -5
  76. data/lib/tkextlib/tcllib/tablelist_core.rb +3 -3
  77. data/lib/tkextlib/tcllib/validator.rb +6 -6
  78. data/lib/tkextlib/tile.rb +1 -2
  79. data/lib/tkextlib/tile/style.rb +1 -1
  80. data/lib/tkextlib/tile/treeview.rb +15 -22
  81. data/lib/tkextlib/tkDND/tkdnd.rb +63 -24
  82. data/lib/tkextlib/tkHTML/htmlwidget.rb +1 -1
  83. data/lib/tkextlib/tktable/tktable.rb +2 -2
  84. data/lib/tkextlib/treectrl/tktreectrl.rb +13 -21
  85. data/lib/tkextlib/vu/pie.rb +1 -1
  86. data/sample/binding_sample.rb +2 -2
  87. data/sample/cmd_res_test.rb +1 -1
  88. data/sample/demos-en/widget +21 -21
  89. data/sample/demos-jp/widget +4 -4
  90. data/sample/multi-ip_sample.rb +0 -3
  91. data/sample/multi-ip_sample2.rb +1 -1
  92. data/sample/resource.en +3 -3
  93. data/sample/resource.ja +3 -3
  94. data/sample/tcltklib/sample1.rb +2 -2
  95. data/sample/tkballoonhelp.rb +2 -2
  96. data/sample/tkextlib/tkHTML/ss.rb +0 -6
  97. data/sample/tkmulticolumnlist.rb +2 -2
  98. data/sample/tkmultilistframe.rb +2 -2
  99. data/sample/tkoptdb.rb +14 -16
  100. data/tk.gemspec +7 -8
  101. metadata +13 -15
  102. data/ChangeLog.tkextlib +0 -949
  103. data/old-README.tcltklib.ja +0 -159
  104. data/sample/binstr_usage.rb +0 -46
  105. data/sample/remote-ip_sample2.rb +0 -57
  106. data/sample/safe-tk.rb +0 -132
  107. data/sample/tkoptdb-safeTk.rb +0 -74
  108. data/sample/tktree.rb +0 -104
  109. data/sample/tktree.tcl +0 -305
data/lib/tk/variable.rb CHANGED
@@ -17,7 +17,7 @@ class TkVariable
17
17
  #TkVar_ID_TBL = {}
18
18
  TkVar_CB_TBL = TkCore::INTERP.create_table
19
19
  TkVar_ID_TBL = TkCore::INTERP.create_table
20
- (Tk_VARIABLE_ID = ["v".freeze, TkUtil.untrust("00000")]).instance_eval{
20
+ (Tk_VARIABLE_ID = ["v".freeze, "00000"]).instance_eval{
21
21
  @mutex = Mutex.new
22
22
  def mutex; @mutex; end
23
23
  freeze
@@ -27,7 +27,7 @@ class TkVariable
27
27
  TkVar_ID_TBL.mutex.synchronize{ TkVar_ID_TBL.clear }
28
28
  }
29
29
 
30
- major, minor, type, patchlevel = TclTkLib.get_version
30
+ major, minor, _, _ = TclTkLib.get_version
31
31
  USE_OLD_TRACE_OPTION_STYLE = (major < 8) || (major == 8 && minor < 4)
32
32
 
33
33
  #TkCore::INTERP.add_tk_procs('rb_var', 'args',
@@ -131,9 +131,9 @@ class TkVariable
131
131
  self
132
132
  end
133
133
  alias default_value= set_default_value
134
- def default_proc(cmd = Proc.new)
134
+ def default_proc(cmd = nil, &block)
135
135
  @def_default = :proc
136
- @default_val = cmd
136
+ @default_val = cmd || block
137
137
  self
138
138
  end
139
139
 
@@ -1372,7 +1372,8 @@ end
1372
1372
  end
1373
1373
  private :_check_trace_opt
1374
1374
 
1375
- def trace(opts, cmd = Proc.new)
1375
+ def trace(opts, cmd = nil, &block)
1376
+ cmd ||= block
1376
1377
  opts = _check_trace_opt(opts)
1377
1378
  (@trace_var ||= []).unshift([opts,cmd])
1378
1379
 
@@ -1412,7 +1413,8 @@ end
1412
1413
  self
1413
1414
  end
1414
1415
 
1415
- def trace_element(elem, opts, cmd = Proc.new)
1416
+ def trace_element(elem, opts, cmd = nil, &block)
1417
+ cmd ||= block
1416
1418
  if @elem
1417
1419
  fail(RuntimeError,
1418
1420
  "invalid for a TkVariable which denotes an element of Tcl's array")
@@ -1770,11 +1772,11 @@ module Tk
1770
1772
  begin
1771
1773
  INTERP._invoke_without_enc('global', 'auto_path')
1772
1774
  auto_path = INTERP._invoke('set', 'auto_path')
1773
- rescue => e
1775
+ rescue
1774
1776
  begin
1775
1777
  INTERP._invoke_without_enc('global', 'env')
1776
1778
  auto_path = INTERP._invoke('set', 'env(TCLLIBPATH)')
1777
- rescue => e
1779
+ rescue
1778
1780
  auto_path = Tk::LIBRARY
1779
1781
  end
1780
1782
  end
data/lib/tk/virtevent.rb CHANGED
@@ -10,7 +10,7 @@ class TkVirtualEvent<TkObject
10
10
 
11
11
  TkCommandNames = ['event'.freeze].freeze
12
12
 
13
- (TkVirtualEventID = ["VirtEvent".freeze, TkUtil.untrust("00000")]).instance_eval{
13
+ (TkVirtualEventID = ["VirtEvent".freeze, "00000"]).instance_eval{
14
14
  @mutex = Mutex.new
15
15
  def mutex; @mutex; end
16
16
  freeze
data/lib/tk/winfo.rb CHANGED
@@ -239,7 +239,7 @@ module TkWinfo
239
239
  TkWinfo.screendepth self
240
240
  end
241
241
 
242
- def TkWinfo.screenheight (win)
242
+ def TkWinfo.screenheight(win)
243
243
  number(tk_call_without_enc('winfo', 'screenheight', win))
244
244
  end
245
245
  def winfo_screenheight
@@ -33,23 +33,6 @@ module Tk::BLT
33
33
  end
34
34
  private :__tkvariable_optkeys
35
35
 
36
- =begin
37
- BarElement_ID = ['blt_barchart_bar'.freeze, TkUtil.untrust('00000')].freeze
38
-
39
- def bar(elem=nil, keys={})
40
- if elem.kind_of?(Hash)
41
- keys = elem
42
- elem = nil
43
- end
44
- unless elem
45
- elem = BarElement_ID.join(TkCore::INTERP._ip_id_).freeze
46
- BarElement_ID[1].succ!
47
- end
48
- tk_send('bar', elem, keys)
49
- Element.new(self, elem, :without_creating=>true)
50
- end
51
- =end
52
-
53
36
  def extents(item)
54
37
  num_or_str(tk_send_without_enc('extents', item))
55
38
  end
@@ -15,7 +15,7 @@ module Tk::BLT
15
15
 
16
16
  BITMAP_ID_TBL = TkCore::INTERP.create_table
17
17
 
18
- (BITMAP_ID = ['blt_bitmap_id'.freeze, TkUtil.untrust('00000')]).instance_eval{
18
+ (BITMAP_ID = ['blt_bitmap_id'.freeze, '00000']).instance_eval{
19
19
  @mutex = Mutex.new
20
20
  def mutex; @mutex; end
21
21
  freeze
@@ -84,13 +84,13 @@ module Tk::BLT
84
84
  private :__item_pathname
85
85
 
86
86
  def axis_cget_tkstring(id, option)
87
- ret = itemcget_tkstring(['axis', tagid(id)], option)
87
+ itemcget_tkstring(['axis', tagid(id)], option)
88
88
  end
89
89
  def axis_cget(id, option)
90
- ret = itemcget(['axis', tagid(id)], option)
90
+ itemcget(['axis', tagid(id)], option)
91
91
  end
92
92
  def axis_cget_strict(id, option)
93
- ret = itemcget_strict(['axis', tagid(id)], option)
93
+ itemcget_strict(['axis', tagid(id)], option)
94
94
  end
95
95
  def axis_configure(*args)
96
96
  slot = args.pop
@@ -414,7 +414,7 @@ module Tk::BLT
414
414
  #################
415
415
 
416
416
  class Axis < TkObject
417
- (OBJ_ID = ['blt_chart_axis'.freeze, TkUtil.untrust('00000')]).instance_eval{
417
+ (OBJ_ID = ['blt_chart_axis'.freeze, '00000']).instance_eval{
418
418
  @mutex = Mutex.new
419
419
  def mutex; @mutex; end
420
420
  freeze
@@ -536,7 +536,7 @@ module Tk::BLT
536
536
  if cmd
537
537
  configure('command', cmd)
538
538
  elsif b
539
- configure('command', Proc.new(&b))
539
+ configure('command', b)
540
540
  else
541
541
  cget('command')
542
542
  end
@@ -672,7 +672,7 @@ module Tk::BLT
672
672
  ElementID_TBL.mutex.synchronize{ ElementID_TBL.clear }
673
673
  }
674
674
 
675
- (OBJ_ID = ['blt_chart_element'.freeze, TkUtil.untrust('00000')]).instance_eval{
675
+ (OBJ_ID = ['blt_chart_element'.freeze, '00000']).instance_eval{
676
676
  @mutex = Mutex.new
677
677
  def mutex; @mutex; end
678
678
  freeze
@@ -923,13 +923,13 @@ module Tk::BLT
923
923
 
924
924
  def self.new(chart, keys={})
925
925
  obj = nil
926
- LegenedID_TBL.mutex.synchronize{
927
- unless (obj = LegenedID_TBL[chart.path])
926
+ LegendID_TBL.mutex.synchronize{
927
+ unless (obj = LegendID_TBL[chart.path])
928
928
  (obj = self.allocate).instance_eval{
929
929
  @parent = @chart = chart
930
930
  @cpath = @chart.path
931
931
  @path = @id = 'crosshairs'
932
- Legend::LegenedID_TBL[@cpath] = self
932
+ Legend::LegendID_TBL[@cpath] = self
933
933
  }
934
934
  end
935
935
  }
@@ -991,7 +991,7 @@ module Tk::BLT
991
991
  #################
992
992
 
993
993
  class Pen < TkObject
994
- (OBJ_ID = ['blt_chart_pen'.freeze, TkUtil.untrust('00000')]).instance_eval{
994
+ (OBJ_ID = ['blt_chart_pen'.freeze, '00000']).instance_eval{
995
995
  @mutex = Mutex.new
996
996
  def mutex; @mutex; end
997
997
  freeze
@@ -1425,20 +1425,20 @@ module Tk::BLT
1425
1425
  end
1426
1426
  end
1427
1427
 
1428
- def _component_bind(target, tag, context, *args)
1429
- if TkComm._callback_entry?(args[0]) || !block_given?
1428
+ def _component_bind(target, tag, context, *args, &block)
1429
+ if TkComm._callback_entry?(args[0]) || !block
1430
1430
  cmd = args.shift
1431
1431
  else
1432
- cmd = Proc.new
1432
+ cmd = block
1433
1433
  end
1434
1434
  _bind([path, target, 'bind', tagid(tag)], context, cmd, *args)
1435
1435
  self
1436
1436
  end
1437
- def _component_bind_append(target, tag, context, *args)
1438
- if TkComm._callback_entry?(args[0]) || !block_given?
1437
+ def _component_bind_append(target, tag, context, *args, &block)
1438
+ if TkComm._callback_entry?(args[0]) || !block
1439
1439
  cmd = args.shift
1440
1440
  else
1441
- cmd = Proc.new
1441
+ cmd = block
1442
1442
  end
1443
1443
  _bind_append([path, target, 'bind', tagid(tag)], context, cmd, *args)
1444
1444
  self
@@ -1947,20 +1947,20 @@ module Tk::BLT
1947
1947
  def current_xaxis_configinfo(slot=nil)
1948
1948
  current_itemconfiginfo('xaxis', slot)
1949
1949
  end
1950
- def xaxis_bind(context, *args)
1951
- if TkComm._callback_entry?(args[0]) || !block_given?
1950
+ def xaxis_bind(context, *args, &block)
1951
+ if TkComm._callback_entry?(args[0]) || !block
1952
1952
  cmd = args.shift
1953
1953
  else
1954
- cmd = Proc.new
1954
+ cmd = block
1955
1955
  end
1956
1956
  _bind([path, 'xaxis', 'bind'], context, cmd, *args)
1957
1957
  self
1958
1958
  end
1959
- def xaxis_bind_append(context, *args)
1960
- if TkComm._callback_entry?(args[0]) || !block_given?
1959
+ def xaxis_bind_append(context, *args, &block)
1960
+ if TkComm._callback_entry?(args[0]) || !block
1961
1961
  cmd = args.shift
1962
1962
  else
1963
- cmd = Proc.new
1963
+ cmd = block
1964
1964
  end
1965
1965
  _bind_append([path, 'xaxis', 'bind'], context, cmd, *args)
1966
1966
  self
@@ -2022,20 +2022,20 @@ module Tk::BLT
2022
2022
  def current_x2axis_configinfo(slot=nil)
2023
2023
  current_itemconfiginfo('x2axis', slot)
2024
2024
  end
2025
- def x2axis_bind(context, *args)
2026
- if TkComm._callback_entry?(args[0]) || !block_given?
2025
+ def x2axis_bind(context, *args, &block)
2026
+ if TkComm._callback_entry?(args[0]) || !block
2027
2027
  cmd = args.shift
2028
2028
  else
2029
- cmd = Proc.new
2029
+ cmd = block
2030
2030
  end
2031
2031
  _bind([path, 'x2axis', 'bind'], context, cmd, *args)
2032
2032
  self
2033
2033
  end
2034
- def x2axis_bind_append(context, *args)
2035
- if TkComm._callback_entry?(args[0]) || !block_given?
2034
+ def x2axis_bind_append(context, *args, &block)
2035
+ if TkComm._callback_entry?(args[0]) || !block
2036
2036
  cmd = args.shift
2037
2037
  else
2038
- cmd = Proc.new
2038
+ cmd = block
2039
2039
  end
2040
2040
  _bind_append([path, 'x2axis', 'bind'], context, cmd, *args)
2041
2041
  self
@@ -2097,20 +2097,20 @@ module Tk::BLT
2097
2097
  def current_yaxis_configinfo(slot=nil)
2098
2098
  current_itemconfiginfo('yaxis', slot)
2099
2099
  end
2100
- def yaxis_bind(context, *args)
2101
- if TkComm._callback_entry?(args[0]) || !block_given?
2100
+ def yaxis_bind(context, *args, &block)
2101
+ if TkComm._callback_entry?(args[0]) || !block
2102
2102
  cmd = args.shift
2103
2103
  else
2104
- cmd = Proc.new
2104
+ cmd = block
2105
2105
  end
2106
2106
  _bind([path, 'yaxis', 'bind'], context, cmd, *args)
2107
2107
  self
2108
2108
  end
2109
- def yaxis_bind_append(context, *args)
2110
- if TkComm._callback_entry?(args[0]) || !block_given?
2109
+ def yaxis_bind_append(context, *args, &block)
2110
+ if TkComm._callback_entry?(args[0]) || !block
2111
2111
  cmd = args.shift
2112
2112
  else
2113
- cmd = Proc.new
2113
+ cmd = block
2114
2114
  end
2115
2115
  _bind_append([path, 'yaxis', 'bind'], context, cmd, *args)
2116
2116
  self
@@ -2172,20 +2172,20 @@ module Tk::BLT
2172
2172
  def current_y2axis_configinfo(slot=nil)
2173
2173
  current_itemconfiginfo('y2axis', slot)
2174
2174
  end
2175
- def y2axis_bind(context, *args)
2176
- if TkComm._callback_entry?(args[0]) || !block_given?
2175
+ def y2axis_bind(context, *args, &block)
2176
+ if TkComm._callback_entry?(args[0]) || !block
2177
2177
  cmd = args.shift
2178
2178
  else
2179
- cmd = Proc.new
2179
+ cmd = block
2180
2180
  end
2181
2181
  _bind([path, 'y2axis', 'bind'], context, cmd, *args)
2182
2182
  self
2183
2183
  end
2184
- def y2axis_bind_append(context, *args)
2185
- if TkComm._callback_entry?(args[0]) || !block_given?
2184
+ def y2axis_bind_append(context, *args, &block)
2185
+ if TkComm._callback_entry?(args[0]) || !block
2186
2186
  cmd = args.shift
2187
2187
  else
2188
- cmd = Proc.new
2188
+ cmd = block
2189
2189
  end
2190
2190
  _bind_append([path, 'y2axis', 'bind'], context, cmd, *args)
2191
2191
  self
@@ -204,16 +204,16 @@ module Tk::BLT
204
204
  _setup_subst_table(KEY_TBL, PROC_TBL)
205
205
  end
206
206
 
207
- def self.source_handler(win, datatype, cmd=Proc.new, *args)
207
+ def self.source_handler(win, datatype, cmd=nil, *args, &block)
208
208
  _bind_for_event_class(DnD_Handle,
209
209
  ['::blt::drag&drop', 'source', win, 'handler'],
210
- cmd, *args)
210
+ cmd || block, *args)
211
211
  end
212
212
 
213
- def self.target_handler(win, datatype, cmd=Proc.new, *args)
213
+ def self.target_handler(win, datatype, cmd=nil, *args, &block)
214
214
  _bind_for_event_class(DnD_Handle,
215
215
  ['::blt::drag&drop', 'target', win, 'handler'],
216
- cmd, *args)
216
+ cmd || block, *args)
217
217
  end
218
218
 
219
219
  ###################################
@@ -255,8 +255,8 @@ module Tk::BLT
255
255
  tk_call('::blt::drag&drop', 'drop', win, x, y)
256
256
  end
257
257
 
258
- def self.errors(cmd=Proc.new)
259
- tk_call('::blt::drag&drop', 'errors', cmd)
258
+ def self.errors(cmd=nil, &block)
259
+ tk_call('::blt::drag&drop', 'errors', cmd || block)
260
260
  end
261
261
 
262
262
  def self.active
@@ -27,23 +27,6 @@ module Tk::BLT
27
27
  end
28
28
  private :__strval_optkeys
29
29
 
30
- =begin
31
- BarElement_ID = ['blt_graph_bar'.freeze, TkUtil.untrust('00000')].freeze
32
-
33
- def bar(elem=nil, keys={})
34
- if elem.kind_of?(Hash)
35
- keys = elem
36
- elem = nil
37
- end
38
- unless elem
39
- elem = BarElement_ID.join(TkCore::INTERP._ip_id_).freeze
40
- BarElement_ID[1].succ!
41
- end
42
- tk_send('bar', elem, keys)
43
- Element.new(self, elem, :without_creating=>true)
44
- end
45
- =end
46
-
47
30
  def extents(item)
48
31
  num_or_str(tk_send_without_enc('extents', item))
49
32
  end
@@ -28,23 +28,6 @@ module Tk::BLT
28
28
  end
29
29
  private :__strval_optkeys
30
30
 
31
- =begin
32
- BarElement_ID = ['blt_stripchart_bar'.freeze, TkUtil.untrust('00000')].freeze
33
-
34
- def bar(elem=nil, keys={})
35
- if elem.kind_of?(Hash)
36
- keys = elem
37
- elem = nil
38
- end
39
- unless elem
40
- elem = BarElement_ID.join(TkCore::INTERP._ip_id_).freeze
41
- BarElement_ID[1].succ!
42
- end
43
- tk_send('bar', elem, keys)
44
- Element.new(self, elem, :without_creating=>true)
45
- end
46
- =end
47
-
48
31
  def extents(item)
49
32
  num_or_str(tk_send_without_enc('extents', item))
50
33
  end
@@ -14,7 +14,7 @@ module Tk::BLT
14
14
 
15
15
  TabID_TBL = TkCore::INTERP.create_table
16
16
 
17
- (TabsetTab_ID = ['blt_tabset_tab'.freeze, TkUtil.untrust('00000')]).instance_eval{
17
+ (TabsetTab_ID = ['blt_tabset_tab'.freeze, '00000']).instance_eval{
18
18
  @mutex = Mutex.new
19
19
  def mutex; @mutex; end
20
20
  freeze
@@ -97,30 +97,22 @@ module Tk::BLT
97
97
  end
98
98
  end
99
99
 
100
- #def bind(context, cmd=Proc.new, *args)
101
- # @t.tab_bind(@id, context, cmd, *args)
102
- # self
103
- #end
104
- def bind(context, *args)
100
+ def bind(context, *args, &block)
105
101
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
106
- if TkComm._callback_entry?(args[0]) || !block_given?
102
+ if TkComm._callback_entry?(args[0]) || !block
107
103
  cmd = args.shift
108
104
  else
109
- cmd = Proc.new
105
+ cmd = block
110
106
  end
111
107
  @t.tab_bind(@id, context, cmd, *args)
112
108
  self
113
109
  end
114
- #def bind_append(context, cmd=Proc.new, *args)
115
- # @t.tab_bind_append(@id, context, cmd, *args)
116
- # self
117
- #end
118
- def bind_append(context, *args)
110
+ def bind_append(context, *args, &block)
119
111
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
120
- if TkComm._callback_entry?(args[0]) || !block_given?
112
+ if TkComm._callback_entry?(args[0]) || !block
121
113
  cmd = args.shift
122
114
  else
123
- cmd = Proc.new
115
+ cmd = block
124
116
  end
125
117
  @t.tab_bind_append(@id, context, cmd, *args)
126
118
  self
@@ -289,30 +281,23 @@ module Tk::BLT
289
281
  end
290
282
  alias highlight activate
291
283
 
292
- #def tabbind(tag, context, cmd=Proc.new, *args)
293
- # _bind([path, "bind", tagid(tag)], context, cmd, *args)
294
- # self
295
- #end
296
- def tabbind(tag, context, *args)
284
+ def tabbind(tag, context, *args, &block)
297
285
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
298
- if TkComm._callback_entry?(args[0]) || !block_given?
286
+ if TkComm._callback_entry?(args[0]) || !block
299
287
  cmd = args.shift
300
288
  else
301
- cmd = Proc.new
289
+ cmd = block
302
290
  end
303
291
  _bind([path, "bind", tagid(tag)], context, cmd, *args)
304
292
  self
305
293
  end
306
- #def tabbind_append(tag, context, cmd=Proc.new, *args)
307
- # _bind_append([path, "bind", tagid(tag)], context, cmd, *args)
308
- # self
309
- #end
310
- def tabbind_append(tag, context, *args)
294
+
295
+ def tabbind_append(tag, context, *args, &block)
311
296
  # if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
312
- if TkComm._callback_entry?(args[0]) || !block_given?
297
+ if TkComm._callback_entry?(args[0]) || !block
313
298
  cmd = args.shift
314
299
  else
315
- cmd = Proc.new
300
+ cmd = block
316
301
  end
317
302
  _bind_append([path, "bind", tagid(tag)], context, cmd, *args)
318
303
  self
@@ -482,8 +467,8 @@ module Tk::BLT
482
467
  window(tk_send('tab', 'tearoff', tagindex(index), parent))
483
468
  end
484
469
 
485
- def xscrollcommand(cmd=Proc.new)
486
- configure_cmd 'scrollcommand', cmd
470
+ def xscrollcommand(cmd=nil, &block)
471
+ configure_cmd('scrollcommand', cmd || block)
487
472
  self
488
473
  end
489
474
  alias scrollcommand xscrollcommand