| 1 | This is a basic Splash Screen I created using Gtk |
| 2 | |
| 3 | {{{ |
| 4 | #!cobra |
| 5 | @args -pkg:gtk-sharp-2.0 |
| 6 | |
| 7 | use System |
| 8 | use Gtk |
| 9 | |
| 10 | class Splash inherits Window |
| 11 | cue init |
| 12 | base.init("") |
| 13 | .defaultSize = Gdk.Size(300,200) |
| 14 | .windowPosition = WindowPosition.Center |
| 15 | .decorated = false |
| 16 | .hasFocus = false |
| 17 | .hasFrame = false |
| 18 | .keepAbove = true |
| 19 | .modal = false |
| 20 | .skipPagerHint = true |
| 21 | .skipTaskbarHint = true |
| 22 | .typeHint = Gdk.WindowTypeHint.Splashscreen |
| 23 | .add(Image("logo.png")) |
| 24 | .showAll |
| 25 | |
| 26 | |
| 27 | class MainWindow inherits Window |
| 28 | cue init |
| 29 | base.init("My Main") |
| 30 | #simulate something that times time like Thread.sleep(5) |
| 31 | |
| 32 | def main is shared has STAThread |
| 33 | Application.init |
| 34 | spl = Splash() |
| 35 | while Application.eventsPending |
| 36 | Application.runIteration |
| 37 | MainWindow() #This is the window that takes a lot of time to load |
| 38 | spl.destroy |
| 39 | Application.run |
| 40 | |
| 41 | }}} |