Class: QDA::GUI::WorkAreaWindow
- Inherits:
-
WorkAreaWindowBaseClass
- Object
- QDA::GUI::WorkAreaWindow
- Defined in:
- lib/weft/wxgui/inspectors.rb
Direct Known Subclasses
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
-
#active? ⇒ Boolean
is this the currently focused window within the MDI layout?.
-
#initialize(workarea, title, last_layout) ⇒ WorkAreaWindow
constructor
A new instance of WorkAreaWindow.
-
#layout ⇒ Object
returns a hash serialising the current shape and location of this window, so it can later be unthawed.
- #layout=(layout) ⇒ Object
- #on_focus ⇒ Object
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?
69 70 71 |
# File 'lib/weft/wxgui/inspectors.rb', line 69 def active?() self == parent.active_child end |
#layout ⇒ Object
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_focus ⇒ Object
48 49 50 |
# File 'lib/weft/wxgui/inspectors.rb', line 48 def on_focus() @workarea.active_child = self end |