In Files

  • tk/lib/tk/wm.rb

Class/Module Index [+]

Quicksearch

Tk::Wm

Public Class Methods

aspect(win, *args) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 16
def Wm.aspect(win, *args)
  if args.length == 0
    list(tk_call_without_enc('wm', 'aspect', win.epath))
  else
    args = args[0] if args.length == 1 && args[0].kind_of?(Array)
    tk_call('wm', 'aspect', win.epath, *args)
    win
  end
end
            
attributes(win, slot=nil,value=TkComm::None) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 31
def Wm.attributes(win, slot=nil,value=TkComm::None)
  if slot == nil
    lst = tk_split_list(tk_call('wm', 'attributes', win.epath))
    info = {}
    while key = lst.shift
      info[key[1..-1]] = lst.shift
    end
    info
  elsif slot.kind_of? Hash
    tk_call('wm', 'attributes', win.epath, *hash_kv(slot))
    win
  elsif value == TkComm::None
    tk_call('wm', 'attributes', win.epath, "-#{slot}")
  else
    tk_call('wm', 'attributes', win.epath, "-#{slot}", value)
    win
  end
end
            
client(win, name=TkComm::None) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 55
def Wm.client(win, name=TkComm::None)
  if name == TkComm::None
    tk_call('wm', 'client', win.epath)
  else
    name = '' if name == nil
    tk_call('wm', 'client', win.epath, name)
    win
  end
end
            
colormapwindows(win, *args) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 70
def Wm.colormapwindows(win, *args)
  if args.size == 0
    list(tk_call_without_enc('wm', 'colormapwindows', win.epath))
  else
    args = args[0] if args.length == 1 && args[0].kind_of?(Array)
    tk_call_without_enc('wm', 'colormapwindows', win.epath, *args)
    win
  end
end
            
command(win, value=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 85
def Wm.command(win, value=nil)
  if value
    tk_call('wm', 'command', win.epath, value)
    win
  else
    #procedure(tk_call('wm', 'command', win.epath))
    tk_call('wm', 'command', win.epath)
  end
end
            
deiconify(win, ex = true) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 99
def Wm.deiconify(win, ex = true)
  if ex
    tk_call_without_enc('wm', 'deiconify', win.epath)
  else
    Wm.iconify(win)
  end
  win
end
            
focusmodel(win, mode = nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 112
def Wm.focusmodel(win, mode = nil)
  if mode
    tk_call_without_enc('wm', 'focusmodel', win.epath, mode)
    win
  else
    tk_call_without_enc('wm', 'focusmodel', win.epath)
  end
end
            
forget(win) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 126
def Wm.forget(win)
  # Tcl/Tk 8.5+
  # work with dockable frames
  tk_call_without_enc('wm', 'forget', win.epath)
  win
end
            
frame(win) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 136
def Wm.frame(win)
  tk_call_without_enc('wm', 'frame', win.epath)
end
            
geometry(win, geom=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 144
def Wm.geometry(win, geom=nil)
  if geom
    tk_call_without_enc('wm', 'geometry', win.epath, geom)
    win
  else
    tk_call_without_enc('wm', 'geometry', win.epath)
  end
end
            
grid(win, *args) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 158
def Wm.grid(win, *args)
  if args.size == 0
    list(tk_call_without_enc('wm', 'grid', win.epath))
  else
    args = args[0] if args.length == 1 && args[0].kind_of?(Array)
    tk_call_without_enc('wm', 'grid', win.epath, *args)
    win
  end
end
            
group(win, leader = nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 172
def Wm.group(win, leader = nil)
  if leader
    tk_call('wm', 'group', win.epath, leader)
    win
  else
    window(tk_call('wm', 'group', win.epath))
  end
end
            
iconbitmap(win, bmp=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 186
def Wm.iconbitmap(win, bmp=nil)
  if bmp
    tk_call_without_enc('wm', 'iconbitmap', win.epath, bmp)
    win
  else
    image_obj(tk_call_without_enc('wm', 'iconbitmap', win.epath))
  end
end
            
iconify(win, ex = true) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 229
def Wm.iconify(win, ex = true)
  if ex
    tk_call_without_enc('wm', 'iconify', win.epath)
  else
    Wm.deiconify(win)
  end
  win
end
            
iconmask(win, bmp=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 242
def Wm.iconmask(win, bmp=nil)
  if bmp
    tk_call_without_enc('wm', 'iconmask', win.epath, bmp)
    win
  else
    image_obj(tk_call_without_enc('wm', 'iconmask', win.epath))
  end
end
            
iconname(win, name=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 256
def Wm.iconname(win, name=nil)
  if name
    tk_call('wm', 'iconname', win.epath, name)
    win
  else
    tk_call('wm', 'iconname', win.epath)
  end
end
            
iconphoto(win, *imgs) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 200
def Wm.iconphoto(win, *imgs)
  if imgs.empty?
    win.instance_eval{
      @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', win.epath, *imgs)
  win.instance_eval{ @wm_iconphoto = imgs  }
  win
end
            
iconphoto_default(win, *imgs) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 219
def Wm.iconphoto_default(win, *imgs)
  imgs = imgs[0] if imgs.length == 1 && imgs[0].kind_of?(Array)
  tk_call_without_enc('wm', 'iconphoto', win.epath, '-default', *imgs)
  win
end
            
iconposition(win, *args) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 270
def Wm.iconposition(win, *args)
  if args.size == 0
    list(tk_call_without_enc('wm', 'iconposition', win.epath))
  else
    args = args[0] if args.length == 1 && args[0].kind_of?(Array)
    tk_call_without_enc('wm', 'iconposition', win.epath, *args)
    win
  end
end
            
iconwindow(win, iconwin = nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 285
def Wm.iconwindow(win, iconwin = nil)
  if iconwin
    tk_call_without_enc('wm', 'iconwindow', win.epath, iconwin)
    win
  else
    w = tk_call_without_enc('wm', 'iconwindow', win.epath)
    (w == '')? nil: window(w)
  end
end
            
manage(win) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 300
def Wm.manage(win)
  # Tcl/Tk 8.5+ feature
  tk_call_without_enc('wm', 'manage', win.epath)
  win
end
            
maxsize(win, *args) click to toggle source

def ::manage(win, use_id = nil)

# Tcl/Tk 8.5+ feature
# --------------------------------------------------------------
# In the future release, I want to support to embed the 'win'
# into the container which has window-id 'use-id'.
# It may give users flexibility on controlling their GUI.
# However, it may be difficult for current Tcl/Tk (Tcl/Tk8.5.1),
# because it seems to require to modify Tcl/Tk's source code.
# --------------------------------------------------------------
if use_id
  tk_call_without_enc('wm', 'manage', win.epath, '-use', use_id)
else
  tk_call_without_enc('wm', 'manage', win.epath)
end
win

end

 
               # File tk/lib/tk/wm.rb, line 327
def Wm.maxsize(win, *args)
  if args.size == 0
    list(tk_call_without_enc('wm', 'maxsize', win.epath))
  else
    args = args[0] if args.length == 1 && args[0].kind_of?(Array)
    tk_call_without_enc('wm', 'maxsize', win.epath, *args)
    win
  end
end
            
minsize(win, *args) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 342
def Wm.minsize(win, *args)
  if args.size == 0
    list(tk_call_without_enc('wm', 'minsize', win.epath))
  else
    args = args[0] if args.length == 1 && args[0].kind_of?(Array)
    tk_call_without_enc('wm', 'minsize', win.path, *args)
    win
  end
end
            
overrideredirect(win, mode=TkComm::None) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 357
def Wm.overrideredirect(win, mode=TkComm::None)
  if mode == TkComm::None
    bool(tk_call_without_enc('wm', 'overrideredirect', win.epath))
  else
    tk_call_without_enc('wm', 'overrideredirect', win.epath, mode)
    win
  end
end
            
positionfrom(win, who=TkComm::None) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 371
def Wm.positionfrom(win, who=TkComm::None)
  if who == TkComm::None
    r = tk_call_without_enc('wm', 'positionfrom', win.epath)
    (r == "")? nil: r
  else
    tk_call_without_enc('wm', 'positionfrom', win.epath, who)
    win
  end
end
            
protocol(win, name=nil, cmd=nil, &b) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 386
def Wm.protocol(win, name=nil, cmd=nil, &b)
  if cmd
    tk_call_without_enc('wm', 'protocol', win.epath, name, cmd)
    win
  elsif b
    tk_call_without_enc('wm', 'protocol', win.epath, name, proc(&b))
    win
  elsif name
    result = tk_call_without_enc('wm', 'protocol', win.epath, name)
    (result == "")? nil : tk_tcl2ruby(result)
  else
    tk_split_simplelist(tk_call_without_enc('wm', 'protocol', win.epath))
  end
end
            
protocols(win, kv=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 405
def Wm.protocols(win, kv=nil)
  unless kv
    ret = {}
    Wm.protocol(win).each{|name|
      ret[name] = Wm.protocol(win, name)
    }
    return ret
  end

  unless kv.kind_of?(Hash)
    fail ArgumentError, 'expect a hash of protocol=>command'
  end
  kv.each{|k, v| Wm.protocol(win, k, v)}
  win
end
            
resizable(win, *args) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 426
def Wm.resizable(win, *args)
  if args.length == 0
    list(tk_call_without_enc('wm', 'resizable', win.epath)).map!{|e| bool(e)}
  else
    args = args[0] if args.length == 1 && args[0].kind_of?(Array)
    tk_call_without_enc('wm', 'resizable', win.epath, *args)
    win
  end
end
            
sizefrom(win, who=TkComm::None) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 441
def Wm.sizefrom(win, who=TkComm::None)
  if who == TkComm::None
    r = tk_call_without_enc('wm', 'sizefrom', win.epath)
    (r == "")? nil: r
  else
    tk_call_without_enc('wm', 'sizefrom', win.epath, who)
    win
  end
end
            
stackorder(win) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 456
def Wm.stackorder(win)
  list(tk_call('wm', 'stackorder', win.epath))
end
            
stackorder_is_above(win, target) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 467
def Wm.stackorder_is_above(win, target)
  Wm.stackorder_isabove(win, target)
end
            
stackorder_is_below(win, target) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 480
def Wm.stackorder_is_below(win, target)
  Wm.stackorder_isbelow(win, target)
end
            
stackorder_isabove(win, target) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 464
def Wm.stackorder_isabove(win, target)
  bool(tk_call('wm', 'stackorder', win.epath, 'isabove', target))
end
            
stackorder_isbelow(win, target) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 477
def Wm.stackorder_isbelow(win, target)
  bool(tk_call('wm', 'stackorder', win.epath, 'isbelow', target))
end
            
state(win, st=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 490
def Wm.state(win, st=nil)
  if st
    tk_call_without_enc('wm', 'state', win.epath, st)
    win
  else
    tk_call_without_enc('wm', 'state', win.epath)
  end
end
            
title(win, str=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 504
def Wm.title(win, str=nil)
  if str
    tk_call('wm', 'title', win.epath, str)
    win
  else
    tk_call('wm', 'title', win.epath)
  end
end
            
transient(win, master=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 518
def Wm.transient(win, master=nil)
  if master
    tk_call_without_enc('wm', 'transient', win.epath, master)
    win
  else
    window(tk_call_without_enc('wm', 'transient', win.epath))
  end
end
            
withdraw(win, ex = true) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 532
def Wm.withdraw(win, ex = true)
  if ex
    tk_call_without_enc('wm', 'withdraw', win.epath)
  else
    Wm.deiconify(win)
  end
  win
end
            

Public Instance Methods

aspect(*args) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 25
def aspect(*args)
  Wm.aspect(self, *args)
end
            
Also aliased as: wm_aspect
attributes(slot=nil,value=TkComm::None) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 49
def attributes(slot=nil,value=TkComm::None)
  Wm.attributes(self, slot, value)
end
            
Also aliased as: wm_attributes
client(name=TkComm::None) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 64
def client(name=TkComm::None)
  Wm.client(self, name)
end
            
Also aliased as: wm_client
colormapwindows(*args) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 79
def colormapwindows(*args)
  Wm.colormapwindows(self, *args)
end
            
Also aliased as: wm_colormapwindows
deiconify(ex = true) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 107
def deiconify(ex = true)
  Wm.deiconify(self, ex)
end
            
Also aliased as: wm_deiconify
focusmodel(mode = nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 120
def focusmodel(mode = nil)
  Wm.focusmodel(self, mode)
end
            
Also aliased as: wm_focusmodel
frame() click to toggle source
 
               # File tk/lib/tk/wm.rb, line 139
def frame
  Wm.frame(self)
end
            
Also aliased as: wm_frame
geometry(geom=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 152
def geometry(geom=nil)
  Wm.geometry(self, geom)
end
            
Also aliased as: wm_geometry
group(leader = nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 180
def group(leader = nil)
  Wm.group(self, leader)
end
            
Also aliased as: wm_group
iconbitmap(bmp=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 194
def iconbitmap(bmp=nil)
  Wm.iconbitmap(self, bmp)
end
            
Also aliased as: wm_iconbitmap
iconify(ex = true) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 237
def iconify(ex = true)
  Wm.iconify(self, ex)
end
            
Also aliased as: wm_iconify
iconmask(bmp=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 250
def iconmask(bmp=nil)
  Wm.iconmask(self, bmp)
end
            
Also aliased as: wm_iconmask
iconname(name=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 264
def iconname(name=nil)
  Wm.iconname(self, name)
end
            
Also aliased as: wm_iconname
iconphoto(*imgs) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 213
def iconphoto(*imgs)
  Wm.iconphoto(self, *imgs)
end
            
Also aliased as: wm_iconphoto
iconphoto_default(*imgs) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 224
def iconphoto_default(*imgs)
  Wm.iconphoto_default(self, *imgs)
end
            
Also aliased as: wm_iconphoto_default
iconposition(*args) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 279
def iconposition(*args)
  Wm.iconposition(self, *args)
end
            
Also aliased as: wm_iconposition
iconwindow(iconwin = nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 294
def iconwindow(iconwin = nil)
  Wm.iconwindow(self, iconwin)
end
            
Also aliased as: wm_iconwindow
maxsize(*args) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 336
def maxsize(*args)
  Wm.maxsize(self, *args)
end
            
Also aliased as: wm_maxsize
minsize(*args) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 351
def minsize(*args)
  Wm.minsize(self, *args)
end
            
Also aliased as: wm_minsize
overrideredirect(mode=TkComm::None) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 365
def overrideredirect(mode=TkComm::None)
  Wm.overrideredirect(self, mode)
end
            
Also aliased as: wm_overrideredirect
positionfrom(who=TkComm::None) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 380
def positionfrom(who=TkComm::None)
  Wm.positionfrom(self, who)
end
            
Also aliased as: wm_positionfrom
protocol(name=nil, cmd=nil, &b) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 400
def protocol(name=nil, cmd=nil, &b)
  Wm.protocol(self, name, cmd, &b)
end
            
Also aliased as: wm_protocol
protocols(kv=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 420
def protocols(kv=nil)
  Wm.protocols(self, kv)
end
            
Also aliased as: wm_protocols
resizable(*args) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 435
def resizable(*args)
  Wm.resizable(self, *args)
end
            
Also aliased as: wm_resizable
sizefrom(who=TkComm::None) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 450
def sizefrom(who=TkComm::None)
  Wm.sizefrom(self, who)
end
            
Also aliased as: wm_sizefrom
stackorder() click to toggle source
 
               # File tk/lib/tk/wm.rb, line 459
def stackorder
  Wm.stackorder(self)
end
            
Also aliased as: wm_stackorder
stackorder_is_above(target) click to toggle source
Alias for: stackorder_isabove
stackorder_is_below(target) click to toggle source
Alias for: stackorder_isbelow
stackorder_isabove(target) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 470
def stackorder_isabove(target)
  Wm.stackorder_isabove(self, target)
end
            
stackorder_isbelow(target) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 483
def stackorder_isbelow(target)
  Wm.stackorder_isbelow(self, target)
end
            
state(st=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 498
def state(st=nil)
  Wm.state(self, st)
end
            
Also aliased as: wm_state
title(str=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 512
def title(str=nil)
  Wm.title(self, str)
end
            
Also aliased as: wm_title
transient(master=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 526
def transient(master=nil)
  Wm.transient(self, master)
end
            
Also aliased as: wm_transient
withdraw(ex = true) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 540
def withdraw(ex = true)
  Wm.withdraw(self, ex)
end
            
Also aliased as: wm_withdraw
wm_aspect(*args) click to toggle source
Alias for: aspect
wm_attributes(slot=nil,value=TkComm::None) click to toggle source
Alias for: attributes
wm_client(name=TkComm::None) click to toggle source
Alias for: client
wm_colormapwindows(*args) click to toggle source
Alias for: colormapwindows
wm_command(value=nil) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 94
def wm_command(value=nil)
  Wm.command(self, value)
end
            
wm_deiconify(ex = true) click to toggle source
Alias for: deiconify
wm_focusmodel(mode = nil) click to toggle source
Alias for: focusmodel
wm_forget() click to toggle source
 
               # File tk/lib/tk/wm.rb, line 132
def wm_forget
  Wm.forget(self)
end
            
wm_frame() click to toggle source
Alias for: frame
wm_geometry(geom=nil) click to toggle source
Alias for: geometry
wm_grid(*args) click to toggle source
 
               # File tk/lib/tk/wm.rb, line 167
def wm_grid(*args)
  Wm.grid(self, *args)
end
            
wm_group(leader = nil) click to toggle source
Alias for: group
wm_iconbitmap(bmp=nil) click to toggle source
Alias for: iconbitmap
wm_iconify(ex = true) click to toggle source
Alias for: iconify
wm_iconmask(bmp=nil) click to toggle source
Alias for: iconmask
wm_iconname(name=nil) click to toggle source
Alias for: iconname
wm_iconphoto(*imgs) click to toggle source
Alias for: iconphoto
wm_iconphoto_default(*imgs) click to toggle source
Alias for: iconphoto_default
wm_iconposition(*args) click to toggle source
Alias for: iconposition
wm_iconwindow(iconwin = nil) click to toggle source
Alias for: iconwindow
wm_manage() click to toggle source
 
               # File tk/lib/tk/wm.rb, line 305
def wm_manage
  Wm.manage(self)
end
            
wm_maxsize(*args) click to toggle source
Alias for: maxsize
wm_minsize(*args) click to toggle source
Alias for: minsize
wm_overrideredirect(mode=TkComm::None) click to toggle source
Alias for: overrideredirect
wm_positionfrom(who=TkComm::None) click to toggle source
Alias for: positionfrom
wm_protocol(name=nil, cmd=nil, &b) click to toggle source
Alias for: protocol
wm_protocols(kv=nil) click to toggle source
Alias for: protocols
wm_resizable(*args) click to toggle source
Alias for: resizable
wm_sizefrom(who=TkComm::None) click to toggle source
Alias for: sizefrom
wm_stackorder() click to toggle source
Alias for: stackorder
wm_stackorder_is_above(target) click to toggle source
Alias for: stackorder_isabove
wm_stackorder_is_below(target) click to toggle source
Alias for: stackorder_isbelow
wm_stackorder_isabove(target) click to toggle source
Alias for: stackorder_isabove
wm_stackorder_isbelow(target) click to toggle source
Alias for: stackorder_isbelow
wm_state(st=nil) click to toggle source
Alias for: state
wm_title(str=nil) click to toggle source
Alias for: title
wm_transient(master=nil) click to toggle source
Alias for: transient
wm_withdraw(ex = true) click to toggle source
Alias for: withdraw

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.