mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@11081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
feafc46363
commit
438e33e3d2
10 changed files with 147 additions and 42 deletions
25
ext/tk/lib/tkextlib/tile/sizegrip.rb
Normal file
25
ext/tk/lib/tkextlib/tile/sizegrip.rb
Normal file
|
@ -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
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue