Class: Swt::EventLoop
- Inherits:
-
Object
- Object
- Swt::EventLoop
- Defined in:
- lib/swt/event_loop.rb
Instance Method Summary collapse
-
#initialize ⇒ EventLoop
constructor
A new instance of EventLoop.
-
#start ⇒ Object
Begins the SWT event loop.
-
#stop ⇒ Object
Halts the SWT event loop.
-
#yield_until ⇒ Object
Lets the even loop run until block returns false.
Constructor Details
#initialize ⇒ EventLoop
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
#start ⇒ Object
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 |
#stop ⇒ Object
Halts the SWT event loop.
26 27 28 |
# File 'lib/swt/event_loop.rb', line 26 def stop @running = false end |
#yield_until ⇒ Object
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 |