1 #
2 # tk/winfo.rb : methods for winfo command
3 #
4 module TkWinfo
5 end
6
7 require 'tk'
8
9 module TkWinfo
10 include Tk
11 extend Tk
12
13 TkCommandNames = ['winfo'.freeze].freeze
14
15 def TkWinfo.atom(name, win=nil)
16 if win
17 number(tk_call_without_enc('winfo', 'atom', '-displayof', win,
18 _get_eval_enc_str(name)))
19 else
20 number(tk_call_without_enc('winfo', 'atom', _get_eval_enc_str(name)))
21 end
22 end
23 def winfo_atom(name)
24 TkWinfo.atom(name, self)
25 end
26
27 def TkWinfo.atomname(id, win=nil)
28 if win
29 _fromUTF8(tk_call_without_enc('winfo', 'atomname',
30 '-displayof', win, id))
31 else
32 _fromUTF8(tk_call_without_enc('winfo', 'atomname', id))
33 end
34 end
35 def winfo_atomname(id)
36 TkWinfo.atomname(id, self)
37 end
38
39 def TkWinfo.cells(win)
40 number(tk_call_without_enc('winfo', 'cells', win))
41 end
42 def winfo_cells
43 TkWinfo.cells self
44 end
45
46 def TkWinfo.children(win)
47 list(tk_call_without_enc('winfo', 'children', win))
48 end
49 def winfo_children
50 TkWinfo.children self
51 end
52
53 def TkWinfo.classname(win)
54 tk_call_without_enc('winfo', 'class', win)
55 end
56 def winfo_classname
57 TkWinfo.classname self
58 end
59 alias winfo_class winfo_classname
60
61 def TkWinfo.colormapfull(win)
62 bool(tk_call_without_enc('winfo', 'colormapfull', win))
63 end
64 def winfo_colormapfull
65 TkWinfo.colormapfull self
66 end
67
68 def TkWinfo.containing(rootX, rootY, win=nil)
69 if win
70 window(tk_call_without_enc('winfo', 'containing',
71 '-displayof', win, rootX, rootY))
72 else
73 window(tk_call_without_enc('winfo', 'containing', rootX, rootY))
74 end
75 end
76 def winfo_containing(x, y)
77 TkWinfo.containing(x, y, self)
78 end
79
80 def TkWinfo.depth(win)
81 number(tk_call_without_enc('winfo', 'depth', win))
82 end
83 def winfo_depth
84 TkWinfo.depth self
85 end
86
87 def TkWinfo.exist?(win)
88 bool(tk_call_without_enc('winfo', 'exists', win))
89 end
90 def winfo_exist?
91 TkWinfo.exist? self
92 end
93
94 def TkWinfo.fpixels(win, dist)
95 number(tk_call_without_enc('winfo', 'fpixels', win, dist))
96 end
97 def winfo_fpixels(dist)
98 TkWinfo.fpixels self, dist
99 end
100
101 def TkWinfo.geometry(win)
102 tk_call_without_enc('winfo', 'geometry', win)
103 end
104 def winfo_geometry
105 TkWinfo.geometry self
106 end
107
108 def TkWinfo.height(win)
109 number(tk_call_without_enc('winfo', 'height', win))
110 end
111 def winfo_height
112 TkWinfo.height self
113 end
114
115 def TkWinfo.id(win)
116 tk_call_without_enc('winfo', 'id', win)
117 end
118 def winfo_id
119 TkWinfo.id self
120 end
121
122 def TkWinfo.interps(win=nil)
123 if win
124 #tk_split_simplelist(tk_call_without_enc('winfo', 'interps',
125 # '-displayof', win))
126 tk_split_simplelist(tk_call_without_enc('winfo', 'interps',
127 '-displayof', win),
128 false, true)
129 else
130 #tk_split_simplelist(tk_call_without_enc('winfo', 'interps'))
131 tk_split_simplelist(tk_call_without_enc('winfo', 'interps'),
132 false, true)
133 end
134 end
135 def winfo_interps
136 TkWinfo.interps self
137 end
138
139 def TkWinfo.mapped?(win)
140 bool(tk_call_without_enc('winfo', 'ismapped', win))
141 end
142 def winfo_mapped?
143 TkWinfo.mapped? self
144 end
145
146 def TkWinfo.manager(win)
147 tk_call_without_enc('winfo', 'manager', win)
148 end
149 def winfo_manager
150 TkWinfo.manager self
151 end
152
153 def TkWinfo.appname(win)
154 tk_call('winfo', 'name', win)
155 end
156 def winfo_appname
157 TkWinfo.appname self
158 end
159
160 def TkWinfo.parent(win)
161 window(tk_call_without_enc('winfo', 'parent', win))
162 end
163 def winfo_parent
164 TkWinfo.parent self
165 end
166
167 def TkWinfo.widget(id, win=nil)
168 if win
169 window(tk_call_without_enc('winfo', 'pathname', '-displayof', win, id))
170 else
171 window(tk_call_without_enc('winfo', 'pathname', id))
172 end
173 end
174 def winfo_widget(id)
175 TkWinfo.widget id, self
176 end
177
178 def TkWinfo.pixels(win, dist)
179 number(tk_call_without_enc('winfo', 'pixels', win, dist))
180 end
181 def winfo_pixels(dist)
182 TkWinfo.pixels self, dist
183 end
184
185 def TkWinfo.reqheight(win)
186 number(tk_call_without_enc('winfo', 'reqheight', win))
187 end
188 def winfo_reqheight
189 TkWinfo.reqheight self
190 end
191
192 def TkWinfo.reqwidth(win)
193 number(tk_call_without_enc('winfo', 'reqwidth', win))
194 end
195 def winfo_reqwidth
196 TkWinfo.reqwidth self
197 end
198
199 def TkWinfo.rgb(win, color)
200 list(tk_call_without_enc('winfo', 'rgb', win, color))
201 end
202 def winfo_rgb(color)
203 TkWinfo.rgb self, color
204 end
205
206 def TkWinfo.rootx(win)
207 number(tk_call_without_enc('winfo', 'rootx', win))
208 end
209 def winfo_rootx
210 TkWinfo.rootx self
211 end
212
213 def TkWinfo.rooty(win)
214 number(tk_call_without_enc('winfo', 'rooty', win))
215 end
216 def winfo_rooty
217 TkWinfo.rooty self
218 end
219
220 def TkWinfo.screen(win)
221 tk_call('winfo', 'screen', win)
222 end
223 def winfo_screen
224 TkWinfo.screen self
225 end
226
227 def TkWinfo.screencells(win)
228 number(tk_call_without_enc('winfo', 'screencells', win))
229 end
230 def winfo_screencells
231 TkWinfo.screencells self
232 end
233
234 def TkWinfo.screendepth(win)
235 number(tk_call_without_enc('winfo', 'screendepth', win))
236 end
237 def winfo_screendepth
238 TkWinfo.screendepth self
239 end
240
241 def TkWinfo.screenheight (win)
242 number(tk_call_without_enc('winfo', 'screenheight', win))
243 end
244 def winfo_screenheight
245 TkWinfo.screenheight self
246 end
247
248 def TkWinfo.screenmmheight(win)
249 number(tk_call_without_enc('winfo', 'screenmmheight', win))
250 end
251 def winfo_screenmmheight
252 TkWinfo.screenmmheight self
253 end
254
255 def TkWinfo.screenmmwidth(win)
256 number(tk_call_without_enc('winfo', 'screenmmwidth', win))
257 end
258 def winfo_screenmmwidth
259 TkWinfo.screenmmwidth self
260 end
261
262 def TkWinfo.screenvisual(win)
263 tk_call_without_enc('winfo', 'screenvisual', win)
264 end
265 def winfo_screenvisual
266 TkWinfo.screenvisual self
267 end
268
269 def TkWinfo.screenwidth(win)
270 number(tk_call_without_enc('winfo', 'screenwidth', win))
271 end
272 def winfo_screenwidth
273 TkWinfo.screenwidth self
274 end
275
276 def TkWinfo.server(win)
277 tk_call('winfo', 'server', win)
278 end
279 def winfo_server
280 TkWinfo.server self
281 end
282
283 def TkWinfo.toplevel(win)
284 window(tk_call_without_enc('winfo', 'toplevel', win))
285 end
286 def winfo_toplevel
287 TkWinfo.toplevel self
288 end
289
290 def TkWinfo.visual(win)
291 tk_call_without_enc('winfo', 'visual', win)
292 end
293 def winfo_visual
294 TkWinfo.visual self
295 end
296
297 def TkWinfo.visualid(win)
298 tk_call_without_enc('winfo', 'visualid', win)
299 end
300 def winfo_visualid
301 TkWinfo.visualid self
302 end
303
304 def TkWinfo.visualsavailable(win, includeids=false)
305 if includeids
306 list(tk_call_without_enc('winfo', 'visualsavailable',
307 win, "includeids"))
308 else
309 list(tk_call_without_enc('winfo', 'visualsavailable', win))
310 end
311 end
312 def winfo_visualsavailable(includeids=false)
313 TkWinfo.visualsavailable self, includeids
314 end
315
316 def TkWinfo.vrootheight(win)
317 number(tk_call_without_enc('winfo', 'vrootheight', win))
318 end
319 def winfo_vrootheight
320 TkWinfo.vrootheight self
321 end
322
323 def TkWinfo.vrootwidth(win)
324 number(tk_call_without_enc('winfo', 'vrootwidth', win))
325 end
326 def winfo_vrootwidth
327 TkWinfo.vrootwidth self
328 end
329
330 def TkWinfo.vrootx(win)
331 number(tk_call_without_enc('winfo', 'vrootx', win))
332 end
333 def winfo_vrootx
334 TkWinfo.vrootx self
335 end
336
337 def TkWinfo.vrooty(win)
338 number(tk_call_without_enc('winfo', 'vrooty', win))
339 end
340 def winfo_vrooty
341 TkWinfo.vrooty self
342 end
343
344 def TkWinfo.width(win)
345 number(tk_call_without_enc('winfo', 'width', win))
346 end
347 def winfo_width
348 TkWinfo.width self
349 end
350
351 def TkWinfo.x(win)
352 number(tk_call_without_enc('winfo', 'x', win))
353 end
354 def winfo_x
355 TkWinfo.x self
356 end
357
358 def TkWinfo.y(win)
359 number(tk_call_without_enc('winfo', 'y', win))
360 end
361 def winfo_y
362 TkWinfo.y self
363 end
364
365 def TkWinfo.viewable(win)
366 bool(tk_call_without_enc('winfo', 'viewable', win))
367 end
368 def winfo_viewable
369 TkWinfo.viewable self
370 end
371
372 def TkWinfo.pointerx(win)
373 number(tk_call_without_enc('winfo', 'pointerx', win))
374 end
375 def winfo_pointerx
376 TkWinfo.pointerx self
377 end
378
379 def TkWinfo.pointery(win)
380 number(tk_call_without_enc('winfo', 'pointery', win))
381 end
382 def winfo_pointery
383 TkWinfo.pointery self
384 end
385
386 def TkWinfo.pointerxy(win)
387 list(tk_call_without_enc('winfo', 'pointerxy', win))
388 end
389 def winfo_pointerxy
390 TkWinfo.pointerxy self
391 end
392 end