Module: Tk::Wm

Includes:
TkComm
Defined in:
lib/tk/wm.rb

Constant Summary collapse

TkCommandNames =
['wm'.freeze].freeze
TOPLEVEL_METHODCALL_OPTKEYS =
{}

Constants included from TkComm

TkComm::GET_CONFIGINFO_AS_ARRAY, TkComm::GET_CONFIGINFOwoRES_AS_ARRAY, TkComm::TkExtlibAutoloadModule, TkComm::Tk_CMDTBL, TkComm::Tk_IDs, TkComm::Tk_WINDOWS, TkComm::USE_TCLs_LIST_FUNCTIONS, TkComm::WidgetClassNames

Constants included from TkUtil

TkUtil::None, TkUtil::RELEASE_DATE

Instance Method Summary collapse

Methods included from TkComm

#_at, #bind, #bind_all, #bind_append, #bind_append_all, #bind_remove, #bind_remove_all, #bindinfo, #bindinfo_all, #image_obj, #install_cmd, #subst, #uninstall_cmd

Methods included from TkEvent

#install_bind, #install_bind_for_event_class

Methods included from TkUtil

_conv_args, #_conv_args, #_fromUTF8, _get_eval_enc_str, #_get_eval_enc_str, #_get_eval_string, _get_eval_string, _symbolkey2str, #_symbolkey2str, #_toUTF8, bool, #bool, callback, eval_cmd, #hash_kv, hash_kv, install_cmd, num_or_str, #num_or_str, number, #number, string, #string, uninstall_cmd

Instance Method Details

#aspect(*args) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/tk/wm.rb', line 14

def aspect(*args)
  if args.length == 0
    list(tk_call_without_enc('wm', 'aspect', path))
  else
    args = args[0] if args.length == 1 && args[0].kind_of?(Array)
    tk_call('wm', 'aspect', path, *args)
    self
  end
end

#attributes(slot = nil, value = None) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/tk/wm.rb', line 25

def attributes(slot=nil,value=None)
  if slot == nil
    lst = tk_split_list(tk_call('wm', 'attributes', path))
    info = {}
    while key = lst.shift
      info[key[1..-1]] = lst.shift
    end
    info
  elsif slot.kind_of? Hash
    tk_call('wm', 'attributes', path, *hash_kv(slot))
    self
  elsif value == None
    tk_call('wm', 'attributes', path, "-#{slot}")
  else
    tk_call('wm', 'attributes', path, "-#{slot}", value)
    self
  end
end

#client(name = None) ⇒ Object



45
46
47
48
49
50
51
52
53
# File 'lib/tk/wm.rb', line 45

def client(name=None)
  if name == None
    tk_call('wm', 'client', path)
  else
    name = '' if name == nil
    tk_call('wm', 'client', path, name)
    self
  end
end

#colormapwindows(*args) ⇒ Object



56
57
58
59
60
61
62
63
64
# File 'lib/tk/wm.rb', line 56

def colormapwindows(*args)
  if args.size == 0
    list(tk_call_without_enc('wm', 'colormapwindows', path))
  else
    args = args[0] if args.length == 1 && args[0].kind_of?(Array)
    tk_call_without_enc('wm', 'colormapwindows', path, *args)
    self
  end
end

#deiconify(ex = true) ⇒ Object



78
79
80
81
82
83
84
85
# File 'lib/tk/wm.rb', line 78

def deiconify(ex = true)
  if ex
    tk_call_without_enc('wm', 'deiconify', path)
  else
    self.iconify
  end
  self
end

#focusmodel(mode = nil) ⇒ Object



87
88
89
90
91
92
93
94
# File 'lib/tk/wm.rb', line 87

def focusmodel(mode = nil)
  if mode
    tk_call_without_enc('wm', 'focusmodel', path, mode)
    self
  else
    tk_call_without_enc('wm', 'focusmodel', path)
  end
end

#frameObject



97
98
99
# File 'lib/tk/wm.rb', line 97

def frame
  tk_call_without_enc('wm', 'frame', path)
end

#geometry(geom = nil) ⇒ Object



101
102
103
104
105
106
107
108
# File 'lib/tk/wm.rb', line 101

def geometry(geom=nil)
  if geom
    tk_call_without_enc('wm', 'geometry', path, geom)
    self
  else
    tk_call_without_enc('wm', 'geometry', path)
  end
end

#group(leader = nil) ⇒ Object



122
123
124
125
126
127
128
129
# File 'lib/tk/wm.rb', line 122

def group(leader = nil)
  if leader
    tk_call('wm', 'group', path, leader)
    self
  else
    window(tk_call('wm', 'group', path))
  end
end

#iconbitmap(bmp = nil) ⇒ Object



132
133
134
135
136
137
138
139
# File 'lib/tk/wm.rb', line 132

def iconbitmap(bmp=nil)
  if bmp
    tk_call_without_enc('wm', 'iconbitmap', path, bmp)
    self
  else
    image_obj(tk_call_without_enc('wm', 'iconbitmap', path))
  end
end

#iconify(ex = true) ⇒ Object



161
162
163
164
165
166
167
168
# File 'lib/tk/wm.rb', line 161

def iconify(ex = true)
  if ex
    tk_call_without_enc('wm', 'iconify', path)
  else
    self.deiconify
  end
  self
end

#iconmask(bmp = nil) ⇒ Object



170
171
172
173
174
175
176
177
# File 'lib/tk/wm.rb', line 170

def iconmask(bmp=nil)
  if bmp
    tk_call_without_enc('wm', 'iconmask', path, bmp)
    self
  else
    image_obj(tk_call_without_enc('wm', 'iconmask', path))
  end
end

#iconname(name = nil) ⇒ Object



180
181
182
183
184
185
186
187
# File 'lib/tk/wm.rb', line 180

def iconname(name=nil)
  if name
    tk_call('wm', 'iconname', path, name)
    self
  else
    tk_call('wm', 'iconname', path)
  end
end

#iconphoto(*imgs) ⇒ Object



142
143
144
145
146
147
148
149
150
151
152
# File 'lib/tk/wm.rb', line 142

def iconphoto(*imgs)
  if imgs.empty?
    @wm_iconphoto = nil unless defined? @wm_iconphoto
    return @wm_iconphoto 
  end

  imgs = imgs[0] if imgs.length == 1 && imgs[0].kind_of?(Array)
  tk_call_without_enc('wm', 'iconphoto', path, *imgs)
  @wm_iconphoto = imgs
  self
end

#iconphoto_default(*imgs) ⇒ Object



155
156
157
158
159
# File 'lib/tk/wm.rb', line 155

def iconphoto_default(*imgs)
  imgs = imgs[0] if imgs.length == 1 && imgs[0].kind_of?(Array)
  tk_call_without_enc('wm', 'iconphoto', path, '-default', *imgs)
  self
end

#iconposition(*args) ⇒ Object



190
191
192
193
194
195
196
197
198
# File 'lib/tk/wm.rb', line 190

def iconposition(*args)
  if args.size == 0
    list(tk_call_without_enc('wm', 'iconposition', path))
  else
    args = args[0] if args.length == 1 && args[0].kind_of?(Array)
    tk_call_without_enc('wm', 'iconposition', path, *args)
    self
  end
end

#iconwindow(win = nil) ⇒ Object



201
202
203
204
205
206
207
208
209
# File 'lib/tk/wm.rb', line 201

def iconwindow(win = nil)
  if win
    tk_call_without_enc('wm', 'iconwindow', path, win)
    self
  else
    w = tk_call_without_enc('wm', 'iconwindow', path)
    (w == '')? nil: window(w)
  end
end

#maxsize(*args) ⇒ Object



212
213
214
215
216
217
218
219
220
# File 'lib/tk/wm.rb', line 212

def maxsize(*args)
  if args.size == 0
    list(tk_call_without_enc('wm', 'maxsize', path))
  else
    args = args[0] if args.length == 1 && args[0].kind_of?(Array)
    tk_call_without_enc('wm', 'maxsize', path, *args)
    self
  end
end

#minsize(*args) ⇒ Object



223
224
225
226
227
228
229
230
231
# File 'lib/tk/wm.rb', line 223

def minsize(*args)
  if args.size == 0
    list(tk_call_without_enc('wm', 'minsize', path))
  else
    args = args[0] if args.length == 1 && args[0].kind_of?(Array)
    tk_call_without_enc('wm', 'minsize', path, *args)
    self
  end
end

#overrideredirect(mode = None) ⇒ Object



234
235
236
237
238
239
240
241
# File 'lib/tk/wm.rb', line 234

def overrideredirect(mode=None)
  if mode == None
    bool(tk_call_without_enc('wm', 'overrideredirect', path))
  else
    tk_call_without_enc('wm', 'overrideredirect', path, mode)
    self
  end
end

#positionfrom(who = None) ⇒ Object



244
245
246
247
248
249
250
251
252
# File 'lib/tk/wm.rb', line 244

def positionfrom(who=None)
  if who == None
    r = tk_call_without_enc('wm', 'positionfrom', path)
    (r == "")? nil: r
  else
    tk_call_without_enc('wm', 'positionfrom', path, who)
    self
  end
end

#protocol(name = nil, cmd = nil, &b) ⇒ Object



255
256
257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/tk/wm.rb', line 255

def protocol(name=nil, cmd=nil, &b)
  if cmd
    tk_call_without_enc('wm', 'protocol', path, name, cmd)
    self
  elsif b
    tk_call_without_enc('wm', 'protocol', path, name, proc(&b))
    self
  elsif name
    result = tk_call_without_enc('wm', 'protocol', path, name)
    (result == "")? nil : tk_tcl2ruby(result)
  else
    tk_split_simplelist(tk_call_without_enc('wm', 'protocol', path))
  end
end

#protocols(kv = nil) ⇒ Object



270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/tk/wm.rb', line 270

def protocols(kv=nil)
  unless kv
    ret = {}
    self.protocol.each{|name|
      ret[name] = self.protocol(name)
    }
    return ret
  end

  unless kv.kind_of?(Hash)
    fail ArgumentError, 'expect a hash of protocol=>command'
  end
  kv.each{|k, v| self.protocol(k, v)}
  self
end

#resizable(*args) ⇒ Object



287
288
289
290
291
292
293
294
295
# File 'lib/tk/wm.rb', line 287

def resizable(*args)
  if args.length == 0
    list(tk_call_without_enc('wm', 'resizable', path)).collect{|e| bool(e)}
  else
    args = args[0] if args.length == 1 && args[0].kind_of?(Array)
    tk_call_without_enc('wm', 'resizable', path, *args)
    self
  end
end

#sizefrom(who = None) ⇒ Object



298
299
300
301
302
303
304
305
306
# File 'lib/tk/wm.rb', line 298

def sizefrom(who=None)
  if who == None
    r = tk_call_without_enc('wm', 'sizefrom', path)
    (r == "")? nil: r
  else
    tk_call_without_enc('wm', 'sizefrom', path, who)
    self
  end
end

#stackorderObject



309
310
311
# File 'lib/tk/wm.rb', line 309

def stackorder
  list(tk_call('wm', 'stackorder', path))
end

#stackorder_isabove(win) ⇒ Object



313
314
315
# File 'lib/tk/wm.rb', line 313

def stackorder_isabove(win)
  bool(tk_call('wm', 'stackorder', path, 'isabove', win))
end

#stackorder_isbelow(win) ⇒ Object



317
318
319
# File 'lib/tk/wm.rb', line 317

def stackorder_isbelow(win)
  bool(tk_call('wm', 'stackorder', path, 'isbelow', win))
end

#state(st = nil) ⇒ Object



321
322
323
324
325
326
327
328
# File 'lib/tk/wm.rb', line 321

def state(st=nil)
  if st
    tk_call_without_enc('wm', 'state', path, st)
    self
  else
    tk_call_without_enc('wm', 'state', path)
  end
end

#title(str = nil) ⇒ Object



331
332
333
334
335
336
337
338
# File 'lib/tk/wm.rb', line 331

def title(str=nil)
  if str
    tk_call('wm', 'title', path, str)
    self
  else
    tk_call('wm', 'title', path)
  end
end

#transient(master = nil) ⇒ Object



341
342
343
344
345
346
347
348
# File 'lib/tk/wm.rb', line 341

def transient(master=nil)
  if master
    tk_call_without_enc('wm', 'transient', path, master)
    self
  else
    window(tk_call_without_enc('wm', 'transient', path))
  end
end

#withdraw(ex = true) ⇒ Object



351
352
353
354
355
356
357
358
# File 'lib/tk/wm.rb', line 351

def withdraw(ex = true)
  if ex
    tk_call_without_enc('wm', 'withdraw', path)
  else
    self.deiconify
  end
  self
end

#wm_command(value = nil) ⇒ Object



67
68
69
70
71
72
73
74
75
# File 'lib/tk/wm.rb', line 67

def wm_command(value=nil)
  if value
    tk_call('wm', 'command', path, value)
    self
  else
    #procedure(tk_call('wm', 'command', path))
    tk_call('wm', 'command', path)
  end
end

#wm_grid(*args) ⇒ Object



111
112
113
114
115
116
117
118
119
# File 'lib/tk/wm.rb', line 111

def wm_grid(*args)
  if args.size == 0
    list(tk_call_without_enc('wm', 'grid', path))
  else
    args = args[0] if args.length == 1 && args[0].kind_of?(Array)
    tk_call_without_enc('wm', 'grid', path, *args)
    self
  end
end