Class: Fzeet::Application
- Inherits:
-
Object
- Object
- Fzeet::Application
- Defined in:
- lib/fzeet/Application.rb
Class Attribute Summary collapse
-
.accelerators ⇒ Object
readonly
Returns the value of attribute accelerators.
-
.authors ⇒ Object
Returns the value of attribute authors.
-
.dialogs ⇒ Object
readonly
Returns the value of attribute dialogs.
-
.images ⇒ Object
readonly
Returns the value of attribute images.
-
.name ⇒ Object
Returns the value of attribute name.
-
.quitWhenMainWindowCloses ⇒ Object
Returns the value of attribute quitWhenMainWindowCloses.
-
.version ⇒ Object
Returns the value of attribute version.
-
.window ⇒ Object
Returns the value of attribute window.
Class Method Summary collapse
Class Attribute Details
.accelerators ⇒ Object (readonly)
Returns the value of attribute accelerators.
18 19 20 |
# File 'lib/fzeet/Application.rb', line 18 def accelerators @accelerators end |
.authors ⇒ Object
Returns the value of attribute authors.
17 18 19 |
# File 'lib/fzeet/Application.rb', line 17 def @authors end |
.dialogs ⇒ Object (readonly)
Returns the value of attribute dialogs.
18 19 20 |
# File 'lib/fzeet/Application.rb', line 18 def dialogs @dialogs end |
.images ⇒ Object (readonly)
Returns the value of attribute images.
18 19 20 |
# File 'lib/fzeet/Application.rb', line 18 def images @images end |
.name ⇒ Object
Returns the value of attribute name.
17 18 19 |
# File 'lib/fzeet/Application.rb', line 17 def name @name end |
.quitWhenMainWindowCloses ⇒ Object
Returns the value of attribute quitWhenMainWindowCloses.
17 18 19 |
# File 'lib/fzeet/Application.rb', line 17 def quitWhenMainWindowCloses @quitWhenMainWindowCloses end |
.version ⇒ Object
Returns the value of attribute version.
17 18 19 |
# File 'lib/fzeet/Application.rb', line 17 def version @version end |
.window ⇒ Object
Returns the value of attribute window.
18 19 20 |
# File 'lib/fzeet/Application.rb', line 18 def window @window end |
Class Method Details
.quit(code = 0) ⇒ Object
58 59 60 61 62 63 |
# File 'lib/fzeet/Application.rb', line 58 def self.quit(code = 0) accelerators.each(&:dispose) images.values.each(&:dispose) Windows.PostQuitMessage(code) end |
.run(windowOrOpts = {}, &block) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/fzeet/Application.rb', line 27 def self.run(windowOrOpts = {}, &block) @window = case windowOrOpts when BasicWindow; windowOrOpts.tap { |window| block.call(window) if block } when Hash if windowOrOpts[:deferCreateWindow].tap { windowOrOpts.delete_if { |k, v| k == :deferCreateWindow } } Window.new(windowOrOpts, &block) else Window.new(windowOrOpts).tap { |window| block.call(window) if block } end else raise ArgumentError end return 0 if window.handle.null? @window.on(:destroy) { quit } if @quitWhenMainWindowCloses @window.show.update msg = Message.new while msg.get! msg.translate.dispatch unless accelerators.any? { |table| table.translate?(msg, @window) } || dialogs.any? { |dialog| dialog.dlgmsg?(msg) } end msg[:wParam] rescue Fzeet. %Q{#{$!}\n\n#{$!.backtrace.join("\n")}}, icon: :error end |