Very basic stuff working on linux 32-bit with dmd and phobos2.
This commit is contained in:
parent
f23eee9828
commit
67f0225e42
152 changed files with 113 additions and 0 deletions
40
tests/minwin_gtk/minwin/samples/idle.d
Normal file
40
tests/minwin_gtk/minwin/samples/idle.d
Normal file
|
@ -0,0 +1,40 @@
|
|||
/* Sample MinWin application: idle processing
|
||||
*
|
||||
* Written by Ben Hinkle and released to the public domain, as
|
||||
* explained at http://creativecommons.org/licenses/publicdomain
|
||||
* Report comments and bugs at dsource: http://www.dsource.org/projects/minwin
|
||||
*/
|
||||
|
||||
module minwin.samples.idle;
|
||||
|
||||
import minwin.all;
|
||||
import std.random;
|
||||
import std.string;
|
||||
import std.utf;
|
||||
|
||||
extern (C)
|
||||
int MinWinMain(Application* app) {
|
||||
Window win = new Window("Idle processing");
|
||||
char[] text = "Idle processing...";
|
||||
char[] cur = "";
|
||||
win.quitOnDestroy = true;
|
||||
win.paintDelegate ~= delegate void(Component source, GContext gc) {
|
||||
auto Font font = new Font("",14,FontWeight.Bold);
|
||||
Font oldfont = gc.setFont(font);
|
||||
gc.drawText(100,100,text);
|
||||
gc.setFont(oldfont);
|
||||
};
|
||||
win.keyDelegate ~= delegate void(Component source, KeyEvent* event) {
|
||||
if (event.id == KeyPressedEvent) {
|
||||
char[4] buf;
|
||||
cur = toUTF8(buf,event.keyCode).dup;
|
||||
}
|
||||
};
|
||||
app.idleTime = 1000; // every second
|
||||
app.idleDelegate ~= delegate void() {
|
||||
text = cur ~ " " ~ toString(rand());
|
||||
win.repaint();
|
||||
};
|
||||
win.visible = true;
|
||||
return app.enterEventLoop();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue