Class: VER::ToplevelLayout::Toplevel

Inherits:
Tk::Toplevel
  • Object
show all
Defined in:
lib/ver/layout/toplevel.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#bufferObject

Returns the value of attribute buffer.



10
11
12
# File 'lib/ver/layout/toplevel.rb', line 10

def buffer
  @buffer
end

Instance Method Details

#hideObject



12
13
14
# File 'lib/ver/layout/toplevel.rb', line 12

def hide
  wm_withdraw
end

#showObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ver/layout/toplevel.rb', line 16

def show
  @really_destroy = false
  return if buffer.options.hidden

  buffer.focus
  return if buffer.winfo_ismapped

  buffer.frame.pack expand: true, fill: :both
  wm_withdraw

  # catch destroy requests from the WM before it's too late.
  wm_protocol('WM_DELETE_WINDOW'){
    buffer.close unless @really_destroy
    Tk::OK # don't forget about those...
  }
  bind('<FocusIn>'){|event|
    if event.window_path == self.tk_pathname
      buffer.focus
      Tk.callback_break
    end
  }
  Tk.update
  wm_deiconify
end