diff options
| author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-12 23:08:32 +0000 |
|---|---|---|
| committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-12 23:08:32 +0000 |
| commit | ab91f35f8f2229085b20a7cfa081f8b85453b718 (patch) | |
| tree | 09bc05d679d0f224a29fee44d10beea321bdc0b5 /ext/tk/lib/tkextlib/bwidget | |
| parent | bc25af2dbfcdd82d1df693683174e01516a669eb (diff) | |
* ext/tk/extconf.rb: New strategy for searching Tcl/Tk libraries.
* ext/tk/*: Support new features of Tcl/Tk8.6b1 and minor bug fixes.
( [KNOWN BUG] Ruby/Tk on Ruby 1.9 will not work on Cygwin. )
* ext/tk/*: Unify sources between Ruby 1.8 & 1.9.
Improve default_widget_set handling.
* ext/tk/*: Multi-TkInterpreter (multi-tk.rb) works on Ruby 1.8 & 1.9.
( [KNOWN BUG] On Ruby 1.8, join to a long term Thread on Tk
callbacks may freeze. On Ruby 1.9, cannot create a second
master interpreter (creating slaves are OK); supported master
interpreter is the default master interpreter only. )
* ext/tk/lib/tkextlib/*: Update supported versions of Tk extensions.
Tcllib 1.8/Tklib 0.4.1 ==> Tcllib 1.11.1/Tklib 0.5
BWidgets 1.7 ==> BWidgets 1.8
TkTable 2.9 ==> TkTable 2.10
TkTreeCtrl 2005-12-02 ==> TkTreeCtrl 2.2.9
Tile 0.8.0/8.5.1 ==> Tile 0.8.3/8.6b1
IncrTcl 2005-02-14 ==> IncrTcl 2008-12-15
TclX 2005-02-07 ==> TclX 2008-12-15
Trofs 0.4.3 ==> Trofs 0.4.4
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tkextlib/bwidget')
29 files changed, 155 insertions, 38 deletions
diff --git a/ext/tk/lib/tkextlib/bwidget/arrowbutton.rb b/ext/tk/lib/tkextlib/bwidget/arrowbutton.rb index 770e5e9ef..13fe9e59b 100644 --- a/ext/tk/lib/tkextlib/bwidget/arrowbutton.rb +++ b/ext/tk/lib/tkextlib/bwidget/arrowbutton.rb @@ -17,5 +17,5 @@ end class Tk::BWidget::ArrowButton TkCommandNames = ['ArrowButton'.freeze].freeze WidgetClassName = 'ArrowButton'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self end diff --git a/ext/tk/lib/tkextlib/bwidget/button.rb b/ext/tk/lib/tkextlib/bwidget/button.rb index 8f3087d09..e139fb670 100644 --- a/ext/tk/lib/tkextlib/bwidget/button.rb +++ b/ext/tk/lib/tkextlib/bwidget/button.rb @@ -17,7 +17,7 @@ end class Tk::BWidget::Button TkCommandNames = ['Button'.freeze].freeze WidgetClassName = 'Button'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'helptext' diff --git a/ext/tk/lib/tkextlib/bwidget/buttonbox.rb b/ext/tk/lib/tkextlib/bwidget/buttonbox.rb index 8d6d21218..a6de33c40 100644 --- a/ext/tk/lib/tkextlib/bwidget/buttonbox.rb +++ b/ext/tk/lib/tkextlib/bwidget/buttonbox.rb @@ -17,7 +17,7 @@ end class Tk::BWidget::ButtonBox TkCommandNames = ['ButtonBox'.freeze].freeze WidgetClassName = 'ButtonBox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self include TkItemConfigMethod diff --git a/ext/tk/lib/tkextlib/bwidget/combobox.rb b/ext/tk/lib/tkextlib/bwidget/combobox.rb index 1c58a4ccb..16143dfbc 100644 --- a/ext/tk/lib/tkextlib/bwidget/combobox.rb +++ b/ext/tk/lib/tkextlib/bwidget/combobox.rb @@ -21,7 +21,12 @@ class Tk::BWidget::ComboBox TkCommandNames = ['ComboBox'.freeze].freeze WidgetClassName = 'ComboBox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self + + def __boolval_optkeys + super() << 'autocomplete' << 'autopost' + end + private :__boolval_optkeys def get_listbox(&b) win = window(tk_send_without_enc('getlistbox')) @@ -35,6 +40,12 @@ class Tk::BWidget::ComboBox win end + def clear_value + tk_send_without_enc('clearvalue') + self + end + alias clearvalue clear_value + def icursor(idx) tk_send_without_enc('icursor', idx) end diff --git a/ext/tk/lib/tkextlib/bwidget/dialog.rb b/ext/tk/lib/tkextlib/bwidget/dialog.rb index 13527f96a..3b0656f02 100644 --- a/ext/tk/lib/tkextlib/bwidget/dialog.rb +++ b/ext/tk/lib/tkextlib/bwidget/dialog.rb @@ -18,12 +18,17 @@ end class Tk::BWidget::Dialog TkCommandNames = ['Dialog'.freeze].freeze WidgetClassName = 'Dialog'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self include TkItemConfigMethod + def __numstrval_optkeys + super() << 'buttonwidth' + end + private :__numstrval_optkeys + def __strval_optkeys - super() << 'title' + super() << 'title' << 'geometry' end private :__strval_optkeys @@ -59,6 +64,13 @@ class Tk::BWidget::Dialog end end + def cget_tkstring(slot) + if slot.to_s == 'relative' + super('parent') + else + super(slot) + end + end def cget_strict(slot) if slot.to_s == 'relative' super('parent') diff --git a/ext/tk/lib/tkextlib/bwidget/entry.rb b/ext/tk/lib/tkextlib/bwidget/entry.rb index a56890f4e..8dc449612 100644 --- a/ext/tk/lib/tkextlib/bwidget/entry.rb +++ b/ext/tk/lib/tkextlib/bwidget/entry.rb @@ -19,7 +19,7 @@ class Tk::BWidget::Entry TkCommandNames = ['Entry'.freeze].freeze WidgetClassName = 'Entry'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'helptext' << 'insertbackground' diff --git a/ext/tk/lib/tkextlib/bwidget/label.rb b/ext/tk/lib/tkextlib/bwidget/label.rb index 88a504aa5..e8d9352c6 100644 --- a/ext/tk/lib/tkextlib/bwidget/label.rb +++ b/ext/tk/lib/tkextlib/bwidget/label.rb @@ -17,7 +17,7 @@ end class Tk::BWidget::Label TkCommandNames = ['Label'.freeze].freeze WidgetClassName = 'Label'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'helptext' diff --git a/ext/tk/lib/tkextlib/bwidget/labelentry.rb b/ext/tk/lib/tkextlib/bwidget/labelentry.rb index 95b40946a..16e7b4693 100644 --- a/ext/tk/lib/tkextlib/bwidget/labelentry.rb +++ b/ext/tk/lib/tkextlib/bwidget/labelentry.rb @@ -21,7 +21,7 @@ class Tk::BWidget::LabelEntry TkCommandNames = ['LabelEntry'.freeze].freeze WidgetClassName = 'LabelEntry'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'helptext' << 'insertbackground' << 'entryfg' << 'entrybg' diff --git a/ext/tk/lib/tkextlib/bwidget/labelframe.rb b/ext/tk/lib/tkextlib/bwidget/labelframe.rb index dc221806e..0710f213f 100644 --- a/ext/tk/lib/tkextlib/bwidget/labelframe.rb +++ b/ext/tk/lib/tkextlib/bwidget/labelframe.rb @@ -18,7 +18,7 @@ end class Tk::BWidget::LabelFrame TkCommandNames = ['LabelFrame'.freeze].freeze WidgetClassName = 'LabelFrame'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'helptext' diff --git a/ext/tk/lib/tkextlib/bwidget/listbox.rb b/ext/tk/lib/tkextlib/bwidget/listbox.rb index 33b69b408..930491c86 100644 --- a/ext/tk/lib/tkextlib/bwidget/listbox.rb +++ b/ext/tk/lib/tkextlib/bwidget/listbox.rb @@ -25,7 +25,7 @@ class Tk::BWidget::ListBox TkCommandNames = ['ListBox'.freeze].freeze WidgetClassName = 'ListBox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self class Event_for_Items < TkEvent::Event def self._get_extra_args_tbl @@ -212,7 +212,7 @@ class Tk::BWidget::ListBox::Item ListItem_TBL = TkCore::INTERP.create_table - (ListItem_ID = ['bw:item'.freeze, '00000'.taint]).instance_eval{ + (ListItem_ID = ['bw:item'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -294,6 +294,9 @@ class Tk::BWidget::ListBox::Item val end + def cget_tkstring(key) + @listbox.itemcget_tkstring(@id, key) + end def cget(key) @listbox.itemcget(@id, key) end diff --git a/ext/tk/lib/tkextlib/bwidget/mainframe.rb b/ext/tk/lib/tkextlib/bwidget/mainframe.rb index de66eaf81..92253bd8d 100644 --- a/ext/tk/lib/tkextlib/bwidget/mainframe.rb +++ b/ext/tk/lib/tkextlib/bwidget/mainframe.rb @@ -18,7 +18,7 @@ end class Tk::BWidget::MainFrame TkCommandNames = ['MainFrame'.freeze].freeze WidgetClassName = 'MainFrame'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'progressfg' @@ -111,6 +111,10 @@ class Tk::BWidget::MainFrame win end + def get_menustate(tag) + tk_send('getmenustate', tag) # return state name string + end + def set_menustate(tag, state) tk_send('setmenustate', tag, state) self diff --git a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb index 9b4653293..7b6261473 100644 --- a/ext/tk/lib/tkextlib/bwidget/messagedlg.rb +++ b/ext/tk/lib/tkextlib/bwidget/messagedlg.rb @@ -17,7 +17,7 @@ end class Tk::BWidget::MessageDlg TkCommandNames = ['MessageDlg'.freeze].freeze WidgetClassName = 'MessageDlg'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def initialize(parent=nil, keys=nil) @relative = '' diff --git a/ext/tk/lib/tkextlib/bwidget/notebook.rb b/ext/tk/lib/tkextlib/bwidget/notebook.rb index 6101fa93e..ed28bcd86 100644 --- a/ext/tk/lib/tkextlib/bwidget/notebook.rb +++ b/ext/tk/lib/tkextlib/bwidget/notebook.rb @@ -19,7 +19,7 @@ class Tk::BWidget::NoteBook TkCommandNames = ['NoteBook'.freeze].freeze WidgetClassName = 'NoteBook'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self class Event_for_Tabs < TkEvent::Event def self._get_extra_args_tbl diff --git a/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb b/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb index fbc2c1125..31bbf1fb8 100644 --- a/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb +++ b/ext/tk/lib/tkextlib/bwidget/pagesmanager.rb @@ -17,7 +17,7 @@ end class Tk::BWidget::PagesManager TkCommandNames = ['PagesManager'.freeze].freeze WidgetClassName = 'PagesManager'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def tagid(id) # id.to_s diff --git a/ext/tk/lib/tkextlib/bwidget/panedwindow.rb b/ext/tk/lib/tkextlib/bwidget/panedwindow.rb index 4d979fd52..54cf06cbd 100644 --- a/ext/tk/lib/tkextlib/bwidget/panedwindow.rb +++ b/ext/tk/lib/tkextlib/bwidget/panedwindow.rb @@ -17,7 +17,12 @@ end class Tk::BWidget::PanedWindow TkCommandNames = ['PanedWindow'.freeze].freeze WidgetClassName = 'PanedWindow'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self + + def __strval_optkeys + super() << 'activator' + end + private :__strval_optkeys def add(keys={}) window(tk_send('add', *hash_kv(keys))) diff --git a/ext/tk/lib/tkextlib/bwidget/panelframe.rb b/ext/tk/lib/tkextlib/bwidget/panelframe.rb index 84bae0768..1cbf91442 100644 --- a/ext/tk/lib/tkextlib/bwidget/panelframe.rb +++ b/ext/tk/lib/tkextlib/bwidget/panelframe.rb @@ -17,7 +17,7 @@ end class Tk::BWidget::PanelFrame TkCommandNames = ['PanelFrame'.freeze].freeze WidgetClassName = 'PanelFrame'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() + ['panelforeground', 'panelbackground'] @@ -47,11 +47,21 @@ class Tk::BWidget::PanelFrame end def items - list(tk_send('items')) + simplelist(tk_send('items')).map{|w| window(w)} end def remove(*wins) tk_send('remove', *wins) self end + + def remove_with_destroy(*wins) + tk_send('remove', '-destroy', *wins) + self + end + + def delete(*wins) # same to 'remove_with_destroy' + tk_send('delete', *wins) + self + end end diff --git a/ext/tk/lib/tkextlib/bwidget/passwddlg.rb b/ext/tk/lib/tkextlib/bwidget/passwddlg.rb index 2c7153333..ea50c87ce 100644 --- a/ext/tk/lib/tkextlib/bwidget/passwddlg.rb +++ b/ext/tk/lib/tkextlib/bwidget/passwddlg.rb @@ -17,7 +17,7 @@ end class Tk::BWidget::PasswdDlg TkCommandNames = ['PasswdDlg'.freeze].freeze WidgetClassName = 'PasswdDlg'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'loginhelptext' << 'loginlabel' << 'logintext' << diff --git a/ext/tk/lib/tkextlib/bwidget/progressbar.rb b/ext/tk/lib/tkextlib/bwidget/progressbar.rb index 0253ce2ad..18eb67349 100644 --- a/ext/tk/lib/tkextlib/bwidget/progressbar.rb +++ b/ext/tk/lib/tkextlib/bwidget/progressbar.rb @@ -16,5 +16,5 @@ end class Tk::BWidget::ProgressBar TkCommandNames = ['ProgressBar'.freeze].freeze WidgetClassName = 'ProgressBar'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self end diff --git a/ext/tk/lib/tkextlib/bwidget/progressdlg.rb b/ext/tk/lib/tkextlib/bwidget/progressdlg.rb index 32600255d..0c0c4540b 100644 --- a/ext/tk/lib/tkextlib/bwidget/progressdlg.rb +++ b/ext/tk/lib/tkextlib/bwidget/progressdlg.rb @@ -19,7 +19,7 @@ end class Tk::BWidget::ProgressDlg TkCommandNames = ['ProgressDlg'.freeze].freeze WidgetClassName = 'ProgressDlg'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def create_self(keys) # NOT create widget for reusing the object diff --git a/ext/tk/lib/tkextlib/bwidget/scrollableframe.rb b/ext/tk/lib/tkextlib/bwidget/scrollableframe.rb index 010c960ec..5bd00d687 100644 --- a/ext/tk/lib/tkextlib/bwidget/scrollableframe.rb +++ b/ext/tk/lib/tkextlib/bwidget/scrollableframe.rb @@ -19,7 +19,7 @@ class Tk::BWidget::ScrollableFrame TkCommandNames = ['ScrollableFrame'.freeze].freeze WidgetClassName = 'ScrollableFrame'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def get_frame(&b) win = window(tk_send_without_enc('getframe')) diff --git a/ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb b/ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb index 3599fd845..ea5a18cc6 100644 --- a/ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb +++ b/ext/tk/lib/tkextlib/bwidget/scrolledwindow.rb @@ -17,7 +17,17 @@ end class Tk::BWidget::ScrolledWindow TkCommandNames = ['ScrolledWindow'.freeze].freeze WidgetClassName = 'ScrolledWindow'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self + + def __strval_optkeys + super() << 'sides' + end + private :__strval_optkeys + + def __boolval_optkeys + super() << 'managed' + end + private :__boolval_optkeys def get_frame(&b) win = window(tk_send_without_enc('getframe')) diff --git a/ext/tk/lib/tkextlib/bwidget/scrollview.rb b/ext/tk/lib/tkextlib/bwidget/scrollview.rb index 0546af2c4..ab27bc91c 100644 --- a/ext/tk/lib/tkextlib/bwidget/scrollview.rb +++ b/ext/tk/lib/tkextlib/bwidget/scrollview.rb @@ -16,7 +16,7 @@ end class Tk::BWidget::ScrollView TkCommandNames = ['ScrollView'.freeze].freeze WidgetClassName = 'ScrollView'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'fill' diff --git a/ext/tk/lib/tkextlib/bwidget/selectcolor.rb b/ext/tk/lib/tkextlib/bwidget/selectcolor.rb index 82bd05eb1..456175e87 100644 --- a/ext/tk/lib/tkextlib/bwidget/selectcolor.rb +++ b/ext/tk/lib/tkextlib/bwidget/selectcolor.rb @@ -24,7 +24,7 @@ class Tk::BWidget::SelectColor TkCommandNames = ['SelectColor'.freeze].freeze WidgetClassName = 'SelectColor'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def dialog(keys={}) newkeys = @keys.dup diff --git a/ext/tk/lib/tkextlib/bwidget/selectfont.rb b/ext/tk/lib/tkextlib/bwidget/selectfont.rb index 71b1afded..23419cb0f 100644 --- a/ext/tk/lib/tkextlib/bwidget/selectfont.rb +++ b/ext/tk/lib/tkextlib/bwidget/selectfont.rb @@ -23,13 +23,18 @@ class Tk::BWidget::SelectFont TkCommandNames = ['SelectFont'.freeze].freeze WidgetClassName = 'SelectFont'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'sampletext' << 'title' end private :__strval_optkeys + def __boolval_optkeys + super() << 'nosizes' + end + private :__boolval_optkeys + def __font_optkeys [] # without fontobj operation end diff --git a/ext/tk/lib/tkextlib/bwidget/separator.rb b/ext/tk/lib/tkextlib/bwidget/separator.rb index d9c3458e5..6d9232121 100644 --- a/ext/tk/lib/tkextlib/bwidget/separator.rb +++ b/ext/tk/lib/tkextlib/bwidget/separator.rb @@ -16,5 +16,5 @@ end class Tk::BWidget::Separator TkCommandNames = ['Separator'.freeze].freeze WidgetClassName = 'Separator'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self end diff --git a/ext/tk/lib/tkextlib/bwidget/spinbox.rb b/ext/tk/lib/tkextlib/bwidget/spinbox.rb index 48358baa5..0a45b045f 100644 --- a/ext/tk/lib/tkextlib/bwidget/spinbox.rb +++ b/ext/tk/lib/tkextlib/bwidget/spinbox.rb @@ -20,7 +20,7 @@ class Tk::BWidget::SpinBox TkCommandNames = ['SpinBox'.freeze].freeze WidgetClassName = 'SpinBox'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __strval_optkeys super() << 'helptext' << 'insertbackground' << 'entryfg' << 'entrybg' diff --git a/ext/tk/lib/tkextlib/bwidget/statusbar.rb b/ext/tk/lib/tkextlib/bwidget/statusbar.rb index 39c678d37..5c5dd43fe 100644 --- a/ext/tk/lib/tkextlib/bwidget/statusbar.rb +++ b/ext/tk/lib/tkextlib/bwidget/statusbar.rb @@ -17,10 +17,10 @@ end class Tk::BWidget::StatusBar TkCommandNames = ['StatusBar'.freeze].freeze WidgetClassName = 'StatusBar'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def __boolval_optkeys - super() << 'showresize' + super() << 'showresize' << 'showseparator' << 'showresizesep' end private :__boolval_optkeys @@ -29,7 +29,17 @@ class Tk::BWidget::StatusBar self end - def delete(*wins) + def remove(*wins) + tk_send('remove', *wins) + self + end + + def remove_with_destroy(*wins) + tk_send('remove', '-destroy', *wins) + self + end + + def delete(*wins) # same to 'remove_with_destroy' tk_send('delete', *wins) self end @@ -47,6 +57,6 @@ class Tk::BWidget::StatusBar end def items - list(tk_send('items')) + simplelist(tk_send('items')).map{|w| window(w)} end end diff --git a/ext/tk/lib/tkextlib/bwidget/titleframe.rb b/ext/tk/lib/tkextlib/bwidget/titleframe.rb index 68534e66e..71879111c 100644 --- a/ext/tk/lib/tkextlib/bwidget/titleframe.rb +++ b/ext/tk/lib/tkextlib/bwidget/titleframe.rb @@ -17,7 +17,7 @@ end class Tk::BWidget::TitleFrame TkCommandNames = ['TitleFrame'.freeze].freeze WidgetClassName = 'TitleFrame'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self def get_frame(&b) win = window(tk_send_without_enc('getframe')) diff --git a/ext/tk/lib/tkextlib/bwidget/tree.rb b/ext/tk/lib/tkextlib/bwidget/tree.rb index 86074ab6f..089c482fe 100644 --- a/ext/tk/lib/tkextlib/bwidget/tree.rb +++ b/ext/tk/lib/tkextlib/bwidget/tree.rb @@ -22,7 +22,7 @@ class Tk::BWidget::Tree TkCommandNames = ['Tree'.freeze].freeze WidgetClassName = 'Tree'.freeze - WidgetClassNames[WidgetClassName] = self + WidgetClassNames[WidgetClassName] ||= self class Event_for_Items < TkEvent::Event def self._get_extra_args_tbl @@ -57,6 +57,37 @@ class Tk::BWidget::Tree end end + def areabind(context, *args) + if TkComm._callback_entry?(args[0]) || !block_given? + cmd = args.shift + else + cmd = Proc.new + end + _bind_for_event_class(Event_for_Items, [path, 'bindArea'], + context, cmd, *args) + self + end + + def areabind_append(context, *args) + if TkComm._callback_entry?(args[0]) || !block_given? + cmd = args.shift + else + cmd = Proc.new + end + _bind_append_for_event_class(Event_for_Items, [path, 'bindArea'], + context, cmd, *args) + self + end + + def areabind_remove(*args) + _bind_remove_for_event_class(Event_for_Items, [path, 'bindArea'], *args) + self + end + + def areabindinfo(*args) + _bindinfo_for_event_class(Event_for_Items, [path, 'bindArea'], *args) + end + #def imagebind(*args) # _bind_for_event_class(Event_for_Items, [path, 'bindImage'], *args) # self @@ -158,6 +189,16 @@ class Tk::BWidget::Tree bool(tk_send('exists', tagid(node))) end + def find(findinfo, confine=None) + Tk::BWidget::Tree::Node.id2obj(self, tk_send(findinfo, confine)) + end + def find_position(x, y, confine=None) + self.find(_at(x,y), confine) + end + def find_line(linenum) + self.find(linenum) + end + def index(node) num_or_str(tk_send('index', tagid(node))) end @@ -167,6 +208,10 @@ class Tk::BWidget::Tree self end + def line(node) + number(tk_send('line', tagid(node))) + end + def move(parent, node, idx) tk_send('move', tagid(parent), tagid(node), idx) self @@ -183,7 +228,7 @@ class Tk::BWidget::Tree end def open?(node) - bool(@tree.itemcget(tagid(node), 'open')) + bool(self.itemcget(tagid(node), 'open')) end def open_tree(node, recurse=None) @@ -264,7 +309,7 @@ class Tk::BWidget::Tree::Node TreeNode_TBL = TkCore::INTERP.create_table - (TreeNode_ID = ['bw:node'.freeze, '00000'.taint]).instance_eval{ + (TreeNode_ID = ['bw:node'.freeze, TkUtil.untrust('00000')]).instance_eval{ @mutex = Mutex.new def mutex; @mutex; end freeze @@ -355,6 +400,9 @@ class Tk::BWidget::Tree::Node val end + def cget_tkstring(key) + @tree.itemcget_tkstring(@id, key) + end def cget(key) @tree.itemcget(@id, key) end @@ -450,4 +498,3 @@ class Tk::BWidget::Tree::Node @tree.visible(@id) end end - |
