Parent

Files

Wx::App

Controller class which creates and manages all windows.

Public Class Methods

run(&block) click to toggle source

Convenience class method to create simple apps. Starts an application main_loop, setting up initial windows etc as specified in the passed block. block

# File wx/classes/app.rb, line 10
  def self.run(&block)
    app_klass = Class.new(self)
    app_klass.class_eval do
      define_method(:on_init, &block)
    end
    the_app = app_klass.new
    the_app.main_loop
  end

Public Instance Methods

gc_stress(interval = 1) click to toggle source

For use in development only, of no practical use in production code. This method causes Ruby’s garbage collection to run (roughly) at interval interval (seconds) - the default is 1, i.e. every second. This should help ferret out bugs in memory management more quickly.

# File wx/classes/app.rb, line 39
  def gc_stress(interval = 1)
    # Ruby 1.9 provides this built-in version, but doesn't like the 1.8
    # version at all - results in frequent segfaults.
    if RUBY_VERSION >= "1.9.0"
      GC.stress
    else # Ruby 1.8
      t = Wx::Timer.new(self, 9999)
      evt_timer(9999) { Thread.pass }
      Thread.new { loop { sleep interval; GC.start } }
      t.start(100)
    end
  end
is_main_loop_running() click to toggle source

This is a class method in Wx, but permit it to be an instance method in wxRuby

# File wx/classes/app.rb, line 21
  def is_main_loop_running
    Wx::App.is_main_loop_running
  end

Disabled; run with $DEBUG to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.