summaryrefslogtreecommitdiff
path: root/ext/tk/lib/tk/winfo.rb
blob: c649b4a0c9c8b1af639903488bc2ecb707185c84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
#
# tk/winfo.rb : methods for winfo command
#
module TkWinfo
end

require 'tk'

module TkWinfo
  include Tk
  extend Tk

  TkCommandNames = ['winfo'.freeze].freeze

  def TkWinfo.atom(name, win=nil)
    if win
      number(tk_call_without_enc('winfo', 'atom', '-displayof', win, 
                                 _get_eval_enc_str(name)))
    else
      number(tk_call_without_enc('winfo', 'atom', _get_eval_enc_str(name)))
    end
  end
  def winfo_atom(name)
    TkWinfo.atom(name, self)
  end

  def TkWinfo.atomname(id, win=nil)
    if win
      _fromUTF8(tk_call_without_enc('winfo', 'atomname', 
                                    '-displayof', win, id))
    else
      _fromUTF8(tk_call_without_enc('winfo', 'atomname', id))
    end
  end
  def winfo_atomname(id)
    TkWinfo.atomname(id, self)
  end

  def TkWinfo.cells(win)
    number(tk_call_without_enc('winfo', 'cells', win))
  end
  def winfo_cells
    TkWinfo.cells self
  end

  def TkWinfo.children(win)
    list(tk_call_without_enc('winfo', 'children', win))
  end
  def winfo_children
    TkWinfo.children self
  end

  def TkWinfo.classname(win)
    tk_call_without_enc('winfo', 'class', win)
  end
  def winfo_classname
    TkWinfo.classname self
  end
  alias winfo_class winfo_classname

  def TkWinfo.colormapfull(win)
     bool(tk_call_without_enc('winfo', 'colormapfull', win))
  end
  def winfo_colormapfull
    TkWinfo.colormapfull self
  end

  def TkWinfo.containing(rootX, rootY, win=nil)
    if win
      window(tk_call_without_enc('winfo', 'containing', 
                                 '-displayof', win, rootX, rootY))
    else
      window(tk_call_without_enc('winfo', 'containing', rootX, rootY))
    end
  end
  def winfo_containing(x, y)
    TkWinfo.containing(x, y, self)
  end

  def TkWinfo.depth(win)
    number(tk_call_without_enc('winfo', 'depth', win))
  end
  def winfo_depth
    TkWinfo.depth self
  end

  def TkWinfo.exist?(win)
    bool(tk_call_without_enc('winfo', 'exists', win))
  end
  def winfo_exist?
    TkWinfo.exist? self
  end

  def TkWinfo.fpixels(win, dist)
    number(tk_call_without_enc('winfo', 'fpixels', win, dist))
  end
  def winfo_fpixels(dist)
    TkWinfo.fpixels self, dist
  end

  def TkWinfo.geometry(win)
    tk_call_without_enc('winfo', 'geometry', win)
  end
  def winfo_geometry
    TkWinfo.geometry self
  end

  def TkWinfo.height(win)
    number(tk_call_without_enc('winfo', 'height', win))
  end
  def winfo_height
    TkWinfo.height self
  end

  def TkWinfo.id(win)
    tk_call_without_enc('winfo', 'id', win)
  end
  def winfo_id
    TkWinfo.id self
  end

  def TkWinfo.interps(win=nil)
    if win
      #tk_split_simplelist(tk_call_without_enc('winfo', 'interps',
      #                                        '-displayof', win))
      tk_split_simplelist(tk_call_without_enc('winfo', 'interps',
                                              '-displayof', win),
                          false, true)
    else
      #tk_split_simplelist(tk_call_without_enc('winfo', 'interps'))
      tk_split_simplelist(tk_call_without_enc('winfo', 'interps'), 
                          false, true)
    end
  end
  def winfo_interps
    TkWinfo.interps self
  end

  def TkWinfo.mapped?(win)
    bool(tk_call_without_enc('winfo', 'ismapped', win))
  end
  def winfo_mapped?
    TkWinfo.mapped? self
  end

  def TkWinfo.manager(win)
    tk_call_without_enc('winfo', 'manager', win)
  end
  def winfo_manager
    TkWinfo.manager self
  end

  def TkWinfo.appname(win)
    tk_call('winfo', 'name', win)
  end
  def winfo_appname
    TkWinfo.appname self
  end

  def TkWinfo.parent(win)
    window(tk_call_without_enc('winfo', 'parent', win))
  end
  def winfo_parent
    TkWinfo.parent self
  end

  def TkWinfo.widget(id, win=nil)
    if win
      window(tk_call_without_enc('winfo', 'pathname', '-displayof', win, id))
    else
      window(tk_call_without_enc('winfo', 'pathname', id))
    end
  end
  def winfo_widget(id)
    TkWinfo.widget id, self
  end

  def TkWinfo.pixels(win, dist)
    number(tk_call_without_enc('winfo', 'pixels', win, dist))
  end
  def winfo_pixels(dist)
    TkWinfo.pixels self, dist
  end

  def TkWinfo.reqheight(win)
    number(tk_call_without_enc('winfo', 'reqheight', win))
  end
  def winfo_reqheight
    TkWinfo.reqheight self
  end

  def TkWinfo.reqwidth(win)
    number(tk_call_without_enc('winfo', 'reqwidth', win))
  end
  def winfo_reqwidth
    TkWinfo.reqwidth self
  end

  def TkWinfo.rgb(win, color)
    list(tk_call_without_enc('winfo', 'rgb', win, color))
  end
  def winfo_rgb(color)
    TkWinfo.rgb self, color
  end

  def TkWinfo.rootx(win)
    number(tk_call_without_enc('winfo', 'rootx', win))
  end
  def winfo_rootx
    TkWinfo.rootx self
  end

  def TkWinfo.rooty(win)
    number(tk_call_without_enc('winfo', 'rooty', win))
  end
  def winfo_rooty
    TkWinfo.rooty self
  end

  def TkWinfo.screen(win)
    tk_call('winfo', 'screen', win)
  end
  def winfo_screen
    TkWinfo.screen self
  end

  def TkWinfo.screencells(win)
    number(tk_call_without_enc('winfo', 'screencells', win))
  end
  def winfo_screencells
    TkWinfo.screencells self
  end

  def TkWinfo.screendepth(win)
    number(tk_call_without_enc('winfo', 'screendepth', win))
  end
  def winfo_screendepth
    TkWinfo.screendepth self
  end

  def TkWinfo.screenheight (win)
    number(tk_call_without_enc('winfo', 'screenheight', win))
  end
  def winfo_screenheight
    TkWinfo.screenheight self
  end

  def TkWinfo.screenmmheight(win)
    number(tk_call_without_enc('winfo', 'screenmmheight', win))
  end
  def winfo_screenmmheight
    TkWinfo.screenmmheight self
  end

  def TkWinfo.screenmmwidth(win)
    number(tk_call_without_enc('winfo', 'screenmmwidth', win))
  end
  def winfo_screenmmwidth
    TkWinfo.screenmmwidth self
  end

  def TkWinfo.screenvisual(win)
    tk_call_without_enc('winfo', 'screenvisual', win)
  end
  def winfo_screenvisual
    TkWinfo.screenvisual self
  end

  def TkWinfo.screenwidth(win)
    number(tk_call_without_enc('winfo', 'screenwidth', win))
  end
  def winfo_screenwidth
    TkWinfo.screenwidth self
  end

  def TkWinfo.server(win)
    tk_call('winfo', 'server', win)
  end
  def winfo_server
    TkWinfo.server self
  end

  def TkWinfo.toplevel(win)
    window(tk_call_without_enc('winfo', 'toplevel', win))
  end
  def winfo_toplevel
    TkWinfo.toplevel self
  end

  def TkWinfo.visual(win)
    tk_call_without_enc('winfo', 'visual', win)
  end
  def winfo_visual
    TkWinfo.visual self
  end

  def TkWinfo.visualid(win)
    tk_call_without_enc('winfo', 'visualid', win)
  end
  def winfo_visualid
    TkWinfo.visualid self
  end

  def TkWinfo.visualsavailable(win, includeids=false)
    if includeids
      list(tk_call_without_enc('winfo', 'visualsavailable', 
                               win, "includeids"))
    else
      list(tk_call_without_enc('winfo', 'visualsavailable', win))
    end
  end
  def winfo_visualsavailable(includeids=false)
    TkWinfo.visualsavailable self, includeids
  end

  def TkWinfo.vrootheight(win)
    number(tk_call_without_enc('winfo', 'vrootheight', win))
  end
  def winfo_vrootheight
    TkWinfo.vrootheight self
  end

  def TkWinfo.vrootwidth(win)
    number(tk_call_without_enc('winfo', 'vrootwidth', win))
  end
  def winfo_vrootwidth
    TkWinfo.vrootwidth self
  end

  def TkWinfo.vrootx(win)
    number(tk_call_without_enc('winfo', 'vrootx', win))
  end
  def winfo_vrootx
    TkWinfo.vrootx self
  end

  def TkWinfo.vrooty(win)
    number(tk_call_without_enc('winfo', 'vrooty', win))
  end
  def winfo_vrooty
    TkWinfo.vrooty self
  end

  def TkWinfo.width(win)
    number(tk_call_without_enc('winfo', 'width', win))
  end
  def winfo_width
    TkWinfo.width self
  end

  def TkWinfo.x(win)
    number(tk_call_without_enc('winfo', 'x', win))
  end
  def winfo_x
    TkWinfo.x self
  end

  def TkWinfo.y(win)
    number(tk_call_without_enc('winfo', 'y', win))
  end
  def winfo_y
    TkWinfo.y self
  end

  def TkWinfo.viewable(win)
    bool(tk_call_without_enc('winfo', 'viewable', win))
  end
  def winfo_viewable
    TkWinfo.viewable self
  end

  def TkWinfo.pointerx(win)
    number(tk_call_without_enc('winfo', 'pointerx', win))
  end
  def winfo_pointerx
    TkWinfo.pointerx self
  end

  def TkWinfo.pointery(win)
    number(tk_call_without_enc('winfo', 'pointery', win))
  end
  def winfo_pointery
    TkWinfo.pointery self
  end

  def TkWinfo.pointerxy(win)
    list(tk_call_without_enc('winfo', 'pointerxy', win))
  end
  def winfo_pointerxy
    TkWinfo.pointerxy self
  end
end