2 # tk/panedwindow.rb : treat panedwindow
6 class Tk::PanedWindow<TkWindow
7 TkCommandNames = ['panedwindow'.freeze].freeze
8 WidgetClassName = 'Panedwindow'.freeze
9 WidgetClassNames[WidgetClassName] = self
10 #def create_self(keys)
11 # if keys and keys != None
12 # tk_call_without_enc('panedwindow', @path, *hash_kv(keys, true))
14 # tk_call_without_enc('panedwindow', @path)
21 fail ArgumentError, "no window in arguments" unless keys
22 if keys && keys.kind_of?(Hash)
23 fail ArgumentError, "no window in arguments" if args == []
24 # args = args.collect{|w| (w.kind_of?(TkObject))? w.epath: w }
25 args = args.collect{|w| _epath(w) }
26 #args.push(hash_kv(keys))
27 args.concat(hash_kv(keys))
29 args.push(keys) if keys
30 # args = args.collect{|w| (w.kind_of?(TkObject))? w.epath: w }
31 args = args.collect{|w| _epath(w) }
33 tk_send_without_enc('add', *args)
37 def forget(win, *wins)
39 # tk_send_without_enc('forget', *((w.kind_of?(TkObject))? w.epath: w))
40 tk_send_without_enc('forget', *(wins.collect{|w| _epath(w)}))
48 list(tk_send_without_enc('identify', x, y))
52 list(tk_send_without_enc('proxy', 'coord'))
55 tk_send_without_enc('proxy', 'forget')
59 tk_send_without_enc('proxy', 'place', x, y)
64 list(tk_send('sash', 'coord', index))
66 def sash_dragto(index, x, y)
67 tk_send('sash', 'dragto', index, x, y)
70 def sash_mark(index, x, y)
71 tk_send('sash', 'mark', index, x, y)
74 def sash_place(index, x, y)
75 tk_send('sash', 'place', index, x, y)
79 def panecget_strict(win, key)
80 # win = win.epath if win.kind_of?(TkObject)
82 tk_tcl2ruby(tk_send_without_enc('panecget', win, "-#{key}"))
84 def panecget(win, key)
85 unless TkItemConfigMethod.__IGNORE_UNKNOWN_CONFIGURE_OPTION__
86 panecget_strict(win, key)
89 panecget_strict(win, key)
92 if current_paneconfiginfo(win).has_key?(option.to_s)
93 # not tag error & option is known -> error on known option
96 # not tag error & option is unknown
106 def paneconfigure(win, key, value=nil)
107 # win = win.epath if win.kind_of?(TkObject)
113 # params.push((v.kind_of?(TkObject))? v.epath: v)
114 params.push(_epath(v))
116 tk_send_without_enc('paneconfigure', win, *params)
118 # value = value.epath if value.kind_of?(TkObject)
119 value = _epath(value)
120 tk_send_without_enc('paneconfigure', win, "-#{key}", value)
124 alias pane_config paneconfigure
126 def paneconfiginfo(win, key=nil)
127 if TkComm::GET_CONFIGINFO_AS_ARRAY
128 # win = win.epath if win.kind_of?(TkObject)
131 #conf = tk_split_list(tk_send_without_enc('paneconfigure',
133 conf = tk_split_list(tk_send_without_enc('paneconfigure',
136 conf[0] = conf[0][1..-1]
138 conf[3] = bool(conf[3]) unless conf[3].empty?
139 conf[4] = bool(conf[4]) unless conf[4].empty?
143 #tk_split_simplelist(tk_send_without_enc('paneconfigure',
144 # win)).collect{|conflist|
145 # conf = tk_split_simplelist(conflist)
146 tk_split_simplelist(tk_send_without_enc('paneconfigure', win),
147 false, false).collect{|conflist|
148 conf = tk_split_simplelist(conflist, false, true)
149 conf[0] = conf[0][1..-1]
152 conf[3] = bool(conf[3]) unless conf[3].empty?
153 elsif conf[3].index('{')
154 conf[3] = tk_split_list(conf[3])
156 conf[3] = tk_tcl2ruby(conf[3])
161 conf[4] = bool(conf[4]) unless conf[4].empty?
162 elsif conf[4].index('{')
163 conf[4] = tk_split_list(conf[4])
165 conf[4] = tk_tcl2ruby(conf[4])
168 conf[1] = conf[1][1..-1] if conf.size == 2 # alias info
172 else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
173 # win = win.epath if win.kind_of?(TkObject)
176 #conf = tk_split_list(tk_send_without_enc('paneconfigure',
178 conf = tk_split_list(tk_send_without_enc('paneconfigure',
181 key = conf.shift[1..-1]
183 conf[2] = bool(conf[2]) unless conf[2].empty?
184 conf[3] = bool(conf[3]) unless conf[3].empty?
189 #tk_split_simplelist(tk_send_without_enc('paneconfigure',
190 # win)).each{|conflist|
191 # conf = tk_split_simplelist(conflist)
192 tk_split_simplelist(tk_send_without_enc('paneconfigure', win),
193 false, false).each{|conflist|
194 conf = tk_split_simplelist(conflist, false, true)
195 key = conf.shift[1..-1]
198 conf[2] = bool(conf[2]) unless conf[2].empty?
199 elsif conf[2].index('{')
200 conf[2] = tk_split_list(conf[2])
202 conf[2] = tk_tcl2ruby(conf[2])
207 conf[3] = bool(conf[3]) unless conf[3].empty?
208 elsif conf[3].index('{')
209 conf[3] = tk_split_list(conf[3])
211 conf[3] = tk_tcl2ruby(conf[3])
215 ret[key] = conf[0][1..-1] # alias info
224 alias pane_configinfo paneconfiginfo
226 def current_paneconfiginfo(win, key=nil)
227 if TkComm::GET_CONFIGINFO_AS_ARRAY
229 conf = paneconfiginfo(win, key)
233 paneconfiginfo(win).each{|conf|
234 ret[conf[0]] = conf[4] if conf.size > 2
238 else # ! TkComm::GET_CONFIGINFO_AS_ARRAY
240 paneconfiginfo(win, key).each{|k, conf|
241 ret[k] = conf[-1] if conf.kind_of?(Array)
247 alias current_pane_configinfo current_paneconfiginfo
250 list(tk_send_without_enc('panes'))
254 Tk::Panedwindow = Tk::PanedWindow
255 #TkPanedWindow = Tk::PanedWindow unless Object.const_defined? :TkPanedWindow
256 #TkPanedwindow = Tk::Panedwindow unless Object.const_defined? :TkPanedwindow
257 Tk.__set_toplevel_aliases__(:Tk, Tk::PanedWindow,
258 :TkPanedWindow, :TkPanedwindow)