Class: Opine::Native::Application

Inherits:
Application show all
Defined in:
lib/opine/widgets/application_osx.rb,
lib/opine/widgets/application_win.rb

Defined Under Namespace

Classes: OSXApplication

Constant Summary

Constants inherited from Application

Application::DEFAULTS

Instance Attribute Summary

Attributes inherited from Application

#application

Instance Method Summary collapse

Methods inherited from Application

#alert, #theme, theme, #theme=, #window

Constructor Details

#initialize(options, &block) ⇒ Application

Returns a new instance of Application.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/opine/widgets/application_osx.rb', line 27

def initialize(options,&block)
  super

  Cocoa::NSAutoreleasePool.new
  @application = Cocoa::NSApplication.sharedApplication
  application.setActivationPolicy Cocoa::NSApplicationActivationPolicyRegular

  delegate = OSXApplication.alloc.init.autorelease
  delegate.application = application
  delegate.block = ->() do
    instance_eval(&block) if block
  end
  application.setDelegate delegate
  application.run
end

Instance Method Details

#running?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/opine/widgets/application_osx.rb', line 43

def running?
  application.isRunning
end

#stopObject



51
52
53
# File 'lib/opine/widgets/application_osx.rb', line 51

def stop
  application.stop application
end

#terminateObject



47
48
49
# File 'lib/opine/widgets/application_osx.rb', line 47

def terminate
  application.terminate application
end