summaryrefslogtreecommitdiffstats
path: root/ext/tk/lib/tkextlib/bwidget
diff options
context:
space:
mode:
Diffstat (limited to 'ext/tk/lib/tkextlib/bwidget')
-rw-r--r--ext/tk/lib/tkextlib/bwidget/labelentry.rb26
-rw-r--r--ext/tk/lib/tkextlib/bwidget/listbox.rb56
-rw-r--r--ext/tk/lib/tkextlib/bwidget/notebook.rb38
-rw-r--r--ext/tk/lib/tkextlib/bwidget/spinbox.rb26
-rw-r--r--ext/tk/lib/tkextlib/bwidget/tree.rb56
5 files changed, 171 insertions, 31 deletions
diff --git a/ext/tk/lib/tkextlib/bwidget/labelentry.rb b/ext/tk/lib/tkextlib/bwidget/labelentry.rb
index 7a6a7f01d..1425ef773 100644
--- a/ext/tk/lib/tkextlib/bwidget/labelentry.rb
+++ b/ext/tk/lib/tkextlib/bwidget/labelentry.rb
@@ -23,13 +23,31 @@ class Tk::BWidget::LabelEntry
WidgetClassName = 'LabelEntry'.freeze
WidgetClassNames[WidgetClassName] = self
- def entrybind(*args)
- _bind([path, 'bind'], *args)
+ #def entrybind(*args)
+ # _bind([path, 'bind'], *args)
+ # self
+ #end
+ def entrybind(context, *args)
+ if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind([path, 'bind'], context, cmd, *args)
self
end
- def entrybind_append(*args)
- _bind_append([path, 'bind'], *args)
+ #def entrybind_append(*args)
+ # _bind_append([path, 'bind'], *args)
+ # self
+ #end
+ def entrybind_append(context, *args)
+ if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_append([path, 'bind'], context, cmd, *args)
self
end
diff --git a/ext/tk/lib/tkextlib/bwidget/listbox.rb b/ext/tk/lib/tkextlib/bwidget/listbox.rb
index 9f505703f..7f218c923 100644
--- a/ext/tk/lib/tkextlib/bwidget/listbox.rb
+++ b/ext/tk/lib/tkextlib/bwidget/listbox.rb
@@ -44,13 +44,33 @@ class Tk::BWidget::ListBox
end
end
- def imagebind(*args)
- _bind_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
+ #def imagebind(*args)
+ # _bind_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
+ # self
+ #end
+ def imagebind(context, *args)
+ if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_for_event_class(Event_for_Items, [path, 'bindImage'],
+ context, cmd, *args)
self
end
- def imagebind_append(*args)
- _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
+ #def imagebind_append(*args)
+ # _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
+ # self
+ #end
+ def imagebind_append(context, *args)
+ if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'],
+ context, cmd, *args)
self
end
@@ -63,13 +83,33 @@ class Tk::BWidget::ListBox
_bindinfo_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
end
- def textbind(*args)
- _bind_for_event_class(Event_for_Items, [path, 'bindText'], *args)
+ #def textbind(*args)
+ # _bind_for_event_class(Event_for_Items, [path, 'bindText'], *args)
+ # self
+ #end
+ def textbind(context, *args)
+ if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_for_event_class(Event_for_Items, [path, 'bindText'],
+ context, cmd, *args)
self
end
- def textbind_append(*args)
- _bind_append_for_event_class(Event_for_Items, [path, 'bindText'], *args)
+ #def textbind_append(*args)
+ # _bind_append_for_event_class(Event_for_Items, [path, 'bindText'], *args)
+ # self
+ #end
+ def textbind_append(context, *args)
+ if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_append_for_event_class(Event_for_Items, [path, 'bindText'],
+ context, cmd, *args)
self
end
diff --git a/ext/tk/lib/tkextlib/bwidget/notebook.rb b/ext/tk/lib/tkextlib/bwidget/notebook.rb
index aba222ff8..8888ab224 100644
--- a/ext/tk/lib/tkextlib/bwidget/notebook.rb
+++ b/ext/tk/lib/tkextlib/bwidget/notebook.rb
@@ -41,13 +41,33 @@ class Tk::BWidget::NoteBook
end
end
- def tabbind(*args)
- _bind_for_event_class(Event_for_Tabs, [path, 'bindtabs'], *args)
+ #def tabbind(*args)
+ # _bind_for_event_class(Event_for_Tabs, [path, 'bindtabs'], *args)
+ # self
+ #end
+ def tabbind(context, *args)
+ if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_for_event_class(Event_for_Tabs, [path, 'bindtabs'],
+ context, cmd, *args)
self
end
- def tabbind_append(*args)
- _bind_append_for_event_class(Event_for_Tabs, [path, 'bindtabs'], *args)
+ #def tabbind_append(*args)
+ # _bind_append_for_event_class(Event_for_Tabs, [path, 'bindtabs'], *args)
+ # self
+ #end
+ def tabbind_append(context, *args)
+ if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_append_for_event_class(Event_for_Tabs, [path, 'bindtabs'],
+ context, cmd, *args)
self
end
@@ -105,9 +125,13 @@ class Tk::BWidget::NoteBook
list(tk_send('pages', first, last))
end
- def raise(page=None)
- tk_send('raise', page)
- self
+ def raise(page=nil)
+ if page
+ tk_send('raise', page)
+ self
+ else
+ tk_send('raise')
+ end
end
def see(page)
diff --git a/ext/tk/lib/tkextlib/bwidget/spinbox.rb b/ext/tk/lib/tkextlib/bwidget/spinbox.rb
index 4380e3835..66501ed70 100644
--- a/ext/tk/lib/tkextlib/bwidget/spinbox.rb
+++ b/ext/tk/lib/tkextlib/bwidget/spinbox.rb
@@ -22,13 +22,31 @@ class Tk::BWidget::SpinBox
WidgetClassName = 'SpinBox'.freeze
WidgetClassNames[WidgetClassName] = self
- def entrybind(*args)
- _bind([path, 'bind'], *args)
+ #def entrybind(*args)
+ # _bind([path, 'bind'], *args)
+ # self
+ #end
+ def entrybind(context, *args)
+ if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind([path, 'bind'], context, cmd, *args)
self
end
- def entrybind_append(*args)
- _bind_append([path, 'bind'], *args)
+ #def entrybind_append(*args)
+ # _bind_append([path, 'bind'], *args)
+ # self
+ #end
+ def entrybind_append(context, *args)
+ if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_append([path, 'bind'], context, cmd, *args)
self
end
diff --git a/ext/tk/lib/tkextlib/bwidget/tree.rb b/ext/tk/lib/tkextlib/bwidget/tree.rb
index 9a49a96bb..16ca8e892 100644
--- a/ext/tk/lib/tkextlib/bwidget/tree.rb
+++ b/ext/tk/lib/tkextlib/bwidget/tree.rb
@@ -41,13 +41,33 @@ class Tk::BWidget::Tree
end
end
- def imagebind(*args)
- _bind_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
+ #def imagebind(*args)
+ # _bind_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
+ # self
+ #end
+ def imagebind(context, *args)
+ if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_for_event_class(Event_for_Items, [path, 'bindImage'],
+ context, cmd, *args)
self
end
- def imagebind_append(*args)
- _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
+ #def imagebind_append(*args)
+ # _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
+ # self
+ #end
+ def imagebind_append(context, *args)
+ if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_append_for_event_class(Event_for_Items, [path, 'bindImage'],
+ context, cmd, *args)
self
end
@@ -60,13 +80,33 @@ class Tk::BWidget::Tree
_bindinfo_for_event_class(Event_for_Items, [path, 'bindImage'], *args)
end
- def textbind(*args)
- _bind_for_event_class(Event_for_Items, [path, 'bindText'], *args)
+ #def textbind(*args)
+ # _bind_for_event_class(Event_for_Items, [path, 'bindText'], *args)
+ # self
+ #end
+ def textbind(context, *args)
+ if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_for_event_class(Event_for_Items, [path, 'bindText'],
+ context, cmd, *args)
self
end
- def textbind_append(*args)
- _bind_append_for_event_class(Event_for_Items, [path, 'bindText'], *args)
+ #def textbind_append(*args)
+ # _bind_append_for_event_class(Event_for_Items, [path, 'bindText'], *args)
+ # self
+ #end
+ def textbind_append(context, *args)
+ if args[0].kind_of?(Proc) || args[0].kind_of?(Method)
+ cmd = args.shift
+ else
+ cmd = Proc.new
+ end
+ _bind_append_for_event_class(Event_for_Items, [path, 'bindText'],
+ context, cmd, *args)
self
end