Class: Swt::EventLoop

Inherits:
Object
  • Object
show all
Defined in:
lib/swt/event_loop.rb

Instance Method Summary collapse

Constructor Details

#initializeEventLoop

Returns a new instance of EventLoop.



4
5
6
# File 'lib/swt/event_loop.rb', line 4

def initialize
  @running = false
end

Instance Method Details

#startObject

Begins the SWT event loop. Blocks.



9
10
11
12
13
14
15
16
17
18
# File 'lib/swt/event_loop.rb', line 9

def start
  @running = true
  @display = Swt.display
  while @running and not @display.disposed?
    unless read = @display.read_and_dispatch
      @display.sleep
    end
  end
  @display.dispose
end

#stopObject

Halts the SWT event loop.



26
27
28
# File 'lib/swt/event_loop.rb', line 26

def stop
  @running = false
end

#yield_untilObject

Lets the even loop run until block returns false



21
22
23
# File 'lib/swt/event_loop.rb', line 21

def yield_until
  @display.read_and_dispatch until yield
end