Class: Hourglass::Runner::ShellWrapper
- Inherits:
-
Delegator
- Object
- Delegator
- Hourglass::Runner::ShellWrapper
- Includes:
- ShellListener
- Defined in:
- lib/hourglass/runner.rb
Constant Summary collapse
- @@sizes =
{}
Instance Attribute Summary collapse
-
#frame_x ⇒ Object
readonly
Returns the value of attribute frame_x.
-
#frame_y ⇒ Object
readonly
Returns the value of attribute frame_y.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#shell ⇒ Object
(also: #__getobj__)
readonly
Returns the value of attribute shell.
Instance Method Summary collapse
-
#initialize(*args) ⇒ ShellWrapper
constructor
A new instance of ShellWrapper.
- #set_client_area_size(width, height) ⇒ Object
- #shellActivated(event) ⇒ Object
- #shellClosed(event) ⇒ Object
- #shellDeactivated(event) ⇒ Object
- #shellDeiconified(event) ⇒ Object
-
#shellIconified(event) ⇒ Object
To satisfy ShellListener.
Constructor Details
#initialize(*args) ⇒ ShellWrapper
Returns a new instance of ShellWrapper.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/hourglass/runner.rb', line 21 def initialize(*args) = args.last.is_a?(Hash) ? args.pop : {} @name = ['name'] @shell = Swt::Widgets::Shell.new(*args) width, height = @@sizes[name] || ['default_size'] || [600, 400] @shell.set_size(width, height) if ['center'] pt = ['center'] @shell.set_location(pt.x - (width / 2), pt.y - (height / 2)) end @shell.layout = Swt::Layout::FillLayout.new @shell.add_shell_listener(self) super(@shell) end |
Instance Attribute Details
#frame_x ⇒ Object (readonly)
Returns the value of attribute frame_x.
16 17 18 |
# File 'lib/hourglass/runner.rb', line 16 def frame_x @frame_x end |
#frame_y ⇒ Object (readonly)
Returns the value of attribute frame_y.
16 17 18 |
# File 'lib/hourglass/runner.rb', line 16 def frame_y @frame_y end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
16 17 18 |
# File 'lib/hourglass/runner.rb', line 16 def name @name end |
#shell ⇒ Object (readonly) Also known as: __getobj__
Returns the value of attribute shell.
16 17 18 |
# File 'lib/hourglass/runner.rb', line 16 def shell @shell end |
Instance Method Details
#set_client_area_size(width, height) ⇒ Object
54 55 56 |
# File 'lib/hourglass/runner.rb', line 54 def set_client_area_size(width, height) @shell.set_size(width + @frame_x, height + @frame_y) end |
#shellActivated(event) ⇒ Object
48 49 50 51 52 |
# File 'lib/hourglass/runner.rb', line 48 def shellActivated(event) client_area = @shell.client_area @frame_x = @shell.size.x - client_area.width @frame_y = @shell.size.y - client_area.height end |
#shellClosed(event) ⇒ Object
42 43 44 45 46 |
# File 'lib/hourglass/runner.rb', line 42 def shellClosed(event) # remember the shell size point = @shell.get_size @@sizes[@name] = [point.x, point.y] end |
#shellDeactivated(event) ⇒ Object
41 |
# File 'lib/hourglass/runner.rb', line 41 def shellDeactivated(event); end |
#shellDeiconified(event) ⇒ Object
40 |
# File 'lib/hourglass/runner.rb', line 40 def shellDeiconified(event); end |
#shellIconified(event) ⇒ Object
To satisfy ShellListener
39 |
# File 'lib/hourglass/runner.rb', line 39 def shellIconified(event); end |