Class: Opine::Native::Window
- Defined in:
- lib/opine/widgets/window_osx.rb,
lib/opine/widgets/window_win.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Window
Constant Summary
Constants inherited from Window
Instance Attribute Summary
Attributes inherited from Window
#content_view, #frame, #title, #window
Instance Method Summary collapse
-
#initialize(options, &block) ⇒ Window
constructor
A new instance of Window.
- #native_style ⇒ Object
- #title=(name) ⇒ Object
- #visible? ⇒ Boolean
Methods inherited from Window
Constructor Details
#initialize(options, &block) ⇒ Window
Returns a new instance of Window.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/opine/widgets/window_osx.rb', line 3 def initialize(,&block) @window = Cocoa::NSWindow.alloc.initWithContentRect([:frame].native, styleMask: native_style, backing: NSBackingStoreBuffered, defer: false) super window.setMinSize NSSize.new(width: 200, height: 200) point = CGPoint.new point[:x] = 120.0 point[:y] = 220.0 window.cascadeTopLeftFromPoint point @content_view = Opine::View.new(window.contentView) instance_eval(&block) if block window.makeKeyAndOrderFront nil end |
Instance Method Details
#native_style ⇒ Object
25 26 27 |
# File 'lib/opine/widgets/window_osx.rb', line 25 def native_style NSTitledWindowMask | NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask end |
#title=(name) ⇒ Object
29 30 31 |
# File 'lib/opine/widgets/window_osx.rb', line 29 def title= name window.setTitle name end |
#visible? ⇒ Boolean
33 34 35 |
# File 'lib/opine/widgets/window_osx.rb', line 33 def visible? window.isVisible end |