class Opine::Native::Window

Public Class Methods

new(options,&block) click to toggle source
Calls superclass method Opine::Widget::new
# File lib/opine/widgets/window_osx.rb, line 3
def initialize(options,&block)
  @window = Cocoa::NSWindow.alloc.initWithContentRect(options[: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

Public Instance Methods

native_style() click to toggle source
# File lib/opine/widgets/window_osx.rb, line 25
def native_style
  NSTitledWindowMask | NSResizableWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask
end
title=(name) click to toggle source
# File lib/opine/widgets/window_osx.rb, line 29
def title= name
  window.setTitle name
end
visible?() click to toggle source
# File lib/opine/widgets/window_osx.rb, line 33
def visible?
  window.isVisible
end