Class: QDA::GUI::WorkAreaWindow

Inherits:
WorkAreaWindowBaseClass
  • Object
show all
Defined in:
lib/weft/wxgui/inspectors.rb

Direct Known Subclasses

CodeReviewWindow, InspectorWindow, ScriptWindow

Constant Summary collapse

W_WINDOW_DEF_SIZE =

the default size for new windows of this type and subclasses. Expressed as a proportion of MDI client area width and MDI client area height.

[ 0.6, 0.8 ]

Instance Method Summary collapse

Constructor Details

#initialize(workarea, title, last_layout) ⇒ WorkAreaWindow

Returns a new instance of WorkAreaWindow.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/weft/wxgui/inspectors.rb', line 32

def initialize(workarea, title, last_layout)
  @workarea = workarea
  size = pos = nil
  if last_layout
    size = Wx::Size.new( last_layout[:w], last_layout[:h] )
    pos  = Wx::Point.new( last_layout[:x], last_layout[:y] )
  else
    proportions = self.class::W_WINDOW_DEF_SIZE
    size = workarea.proportional_size(*proportions)
    pos  = Wx::DEFAULT_POSITION
  end
  super(workarea, title, pos, size)
  evt_set_focus() { | e | on_focus() }
end

Instance Method Details

#active?Boolean

is this the currently focused window within the MDI layout?

Returns:

  • (Boolean)


69
70
71
# File 'lib/weft/wxgui/inspectors.rb', line 69

def active?()
  self == parent.active_child
end

#layoutObject

returns a hash serialising the current shape and location of this window, so it can later be unthawed



54
55
56
57
58
59
60
61
# File 'lib/weft/wxgui/inspectors.rb', line 54

def layout()
  curr_size = get_size()
  pos = get_position
  return { :x => pos.x,
    :y => pos.y,
    :w => curr_size.width,
    :h => curr_size.height }
end

#layout=(layout) ⇒ Object



63
64
65
66
# File 'lib/weft/wxgui/inspectors.rb', line 63

def layout=(layout)
  move( Wx::Point.new(layout[:x], layout[:y]) )
  set_client_size( Wx::Size.new(layout[:w], layout[:h]) )
end

#on_focusObject



48
49
50
# File 'lib/weft/wxgui/inspectors.rb', line 48

def on_focus()
  @workarea.active_child = self
end