diff options
| author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-10-04 09:52:54 +0000 |
|---|---|---|
| committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-10-04 09:52:54 +0000 |
| commit | d3a03c66f41ce4287070f695bcd0562fae0d0881 (patch) | |
| tree | 6ec6b8daf27aca998484ffe9fc43f3eb5ca82439 /ext/tk/lib/tkextlib/tile | |
| parent | 169d8b11dd5b21f656bfc1c8ef33553709af5a20 (diff) | |
| download | ruby-d3a03c66f41ce4287070f695bcd0562fae0d0881.tar.gz ruby-d3a03c66f41ce4287070f695bcd0562fae0d0881.tar.xz ruby-d3a03c66f41ce4287070f695bcd0562fae0d0881.zip | |
* ext/tk/lib/tkextlib/tile.rb, lib/tkextlib/tile/* : support Tile 0.7.6.
* ext/tk/lib/tkextlib/SUPPORT_STATUS: [ruby-talk:211939] check links
of extensions.
* ext/tk/lib/tkextlib/blt/container.rb: define instance methods properly.
* ext/tk/lib/tkextlib/tile/tcombobox.rb: bug fix [ruby-talk:213003].
* ext/tk/lib/tkextlib/tile/tnotebook.rb: ditto.
* ext/tk/lib/tkextlib/tile/treeview.rb: ditto.
* ext/tk/lib/tkextlib/tile/sizegrip.rb: [new] add 'ttk::sizegrip' widget.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@11081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tkextlib/tile')
| -rw-r--r-- | ext/tk/lib/tkextlib/tile/sizegrip.rb | 25 | ||||
| -rw-r--r-- | ext/tk/lib/tkextlib/tile/style.rb | 4 | ||||
| -rw-r--r-- | ext/tk/lib/tkextlib/tile/tcombobox.rb | 6 | ||||
| -rw-r--r-- | ext/tk/lib/tkextlib/tile/tnotebook.rb | 10 | ||||
| -rw-r--r-- | ext/tk/lib/tkextlib/tile/treeview.rb | 53 |
5 files changed, 87 insertions, 11 deletions
diff --git a/ext/tk/lib/tkextlib/tile/sizegrip.rb b/ext/tk/lib/tkextlib/tile/sizegrip.rb new file mode 100644 index 000000000..ea796583b --- /dev/null +++ b/ext/tk/lib/tkextlib/tile/sizegrip.rb @@ -0,0 +1,25 @@ +# +# ttk::sizegrip widget +# by Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp) +# +require 'tk' +require 'tkextlib/tile.rb' + +module Tk + module Tile + class SizeGrip < TkWindow + end + end +end + +class Tk::Tile::SizeGrip < TkWindow + include Tk::Tile::TileWidget + + TkCommandNames = ['::ttk::sizegrip'.freeze].freeze + WidgetClassName = 'TSizegrip'.freeze + WidgetClassNames[WidgetClassName] = self + + def self.style(*args) + [self::WidgetClassName, *(args.map!{|a| _get_eval_string(a)})].join('.') + end +end diff --git a/ext/tk/lib/tkextlib/tile/style.rb b/ext/tk/lib/tkextlib/tile/style.rb index 485a36d7d..59bc4b0d7 100644 --- a/ext/tk/lib/tkextlib/tile/style.rb +++ b/ext/tk/lib/tkextlib/tile/style.rb @@ -52,6 +52,10 @@ class << Tk::Tile::Style end end + def lookup(style, opt, state=None, fallback_value=None) + tk_call('style', 'lookup', style, '-' << opt.to_s, state, fallback_value) + end + include Tk::Tile::ParseStyleLayout def layout(style=nil, spec=nil) diff --git a/ext/tk/lib/tkextlib/tile/tcombobox.rb b/ext/tk/lib/tkextlib/tile/tcombobox.rb index c63ab94db..e8e042fbd 100644 --- a/ext/tk/lib/tkextlib/tile/tcombobox.rb +++ b/ext/tk/lib/tkextlib/tile/tcombobox.rb @@ -39,16 +39,12 @@ class Tk::Tile::TCombobox < Tk::Tile::TEntry end def current - number(tk_send_without_enc('current', idx)) + number(tk_send_without_enc('current')) end def current=(idx) tk_send_without_enc('current', idx) end - def identify(x, y) - tk_send_without_enc('identify', x, y) - end - def set(val) tk_send('set', val) end diff --git a/ext/tk/lib/tkextlib/tile/tnotebook.rb b/ext/tk/lib/tkextlib/tile/tnotebook.rb index abaed8ee9..a928e64b6 100644 --- a/ext/tk/lib/tkextlib/tile/tnotebook.rb +++ b/ext/tk/lib/tkextlib/tile/tnotebook.rb @@ -27,15 +27,15 @@ class Tk::Tile::TNotebook < TkWindow end private :__item_config_cmd - def __item_listval_optkeys + def __item_listval_optkeys(id) [] end private :__item_listval_optkeys - def __item_methodcall_optkeys # { key=>method, ... } + def __item_methodcall_optkeys(id) # { key=>method, ... } {} end - private :__item_listval_optkeys + private :__item_methodcall_optkeys #alias tabcget itemcget alias tabconfigure itemconfigure @@ -104,6 +104,10 @@ class Tk::Tile::TNotebook < TkWindow self end + def selected + window(tk_send_without_enc('select')) + end + def tabs list(tk_send('tabs')) end diff --git a/ext/tk/lib/tkextlib/tile/treeview.rb b/ext/tk/lib/tkextlib/tile/treeview.rb index d3ffbbfa6..6d6074b80 100644 --- a/ext/tk/lib/tkextlib/tile/treeview.rb +++ b/ext/tk/lib/tkextlib/tile/treeview.rb @@ -158,6 +158,10 @@ class Tk::Tile::Treeview < TkWindow end end + def bbox(item, column=None) + list(tk_send('item', 'bbox', item, column)) + end + def children(item) simplelist(tk_send_without_enc('children', item)) end @@ -186,6 +190,7 @@ class Tk::Tile::Treeview < TkWindow end def identify(x, y) + # tile-0.7.2 or previous ret = simplelist(tk_send('identify', x, y)) case ret[0] when 'heading', 'separator', 'cell' @@ -193,6 +198,14 @@ class Tk::Tile::Treeview < TkWindow end end + def row_identify(x, y) + tk_send('identify', 'row', x, y) + end + + def column_identify(x, y) + tk_send('identify', 'column', x, y) + end + def index(item) number(tk_send('index', item)) end @@ -201,11 +214,10 @@ class Tk::Tile::Treeview < TkWindow keys = _symbolkey2str(keys) id = keys.delete('id') if id - tk_send('insert', parent, idx, '-id', id, *hash_kv(keys)) + num_or_str(tk_send('insert', parent, idx, '-id', id, *hash_kv(keys))) else - tk_send('insert', parent, idx, *hash_kv(keys)) + num_or_str(tk_send('insert', parent, idx, *hash_kv(keys))) end - self end def instate(spec, cmd=Proc.new) @@ -270,6 +282,8 @@ class Tk::Tile::Treeview < TkWindow end ret end + alias get_dictionary get_directory + def get(item, col) tk_send('set', item, col) end @@ -277,4 +291,37 @@ class Tk::Tile::Treeview < TkWindow tk_send('set', item, col, value) self end + + def tag_bind(tag, seq, *args) + if TkComm._callback_entry?(args[0]) || !block_given? + cmd = args.shift + else + cmd = Proc.new + end + _bind([@path, 'tag', 'bind', tag], seq, cmd, *args) + self + end + alias tagbind tag_bind + + def tag_bind_append(tag, seq, *args) + if TkComm._callback_entry?(args[0]) || !block_given? + cmd = args.shift + else + cmd = Proc.new + end + _bind_append([@path, 'tag', 'bind', tag], seq, cmd, *args) + self + end + alias tagbind_append tag_bind_append + + def tag_bind_remove(tag, seq) + _bind_remove([@path, 'tag', 'bind', tag], seq) + self + end + alias tagbind_remove tag_bind_remove + + def tag_bindinfo(tag, context=nil) + _bindinfo([@path, 'tag', 'bind', tag], context) + end + alias tagbindinfo tag_bindinfo end |
