diff options
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 0000000000..ea796583b0 --- /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 485a36d7d6..59bc4b0d78 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 c63ab94dbe..e8e042fbd9 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 abaed8ee9c..a928e64b61 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 d3ffbbfa6b..6d6074b800 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 |