1 #define MODULE_NAME "HelloForm"
2 // #define __CONSOLE_APP__
6 static Class * class_HelloForm2;
8 struct HelloForm2 { Button button; };
10 typedef Instance HelloForm2;
12 static void HelloForm2_onRedraw(HelloForm2 this, Surface surface)
14 // Surface_writeTextf(surface, 100, 100, I18N("Testing stuff!"));
15 Surface_writeTextf(surface, 100, 100, "%d + %d = %d", 2, 3, 2+3);
18 static bool HelloForm2_button_notifyClicked(HelloForm2 this, Button button, int x, int y, Modifiers mods)
20 MessageBox msgBox = newi(class_MessageBox);
21 double i = 3.14159265;
23 constString s = _onGetString(class_double, &i, tmp, null, null);
25 PrintLn(class_String, "Hello! -- ", class_String, s, null); // Need to terminate with a null!
26 Window_set_caption(msgBox, $("Hello!"));
27 MessageBox_set_contents(msgBox, $("C Bindings!"));
32 static bool HelloForm2_constructor(HelloForm2 this)
34 struct HelloForm2 * self = IPTR(this, HelloForm2);
35 Window_set_caption(this, $("My Second Ecere/C Bindings App"));
36 Window_set_borderStyle(this, sizable);
37 Window_set_clientSize(this, &(Size){ 640, 480 });
38 Window_set_hasClose(this, true);
39 Window_set_hasMaximize(this, true);
40 Window_set_hasMinimize(this, true);
41 Window_set_background(this, formColor);
43 self->button = newi(class_Button);
44 Window_set_parent(self->button, this);
45 Window_set_position(self->button, &(Point){ 200, 200 });
46 Window_set_caption(self->button, $("Yay!!"));
47 Instance_setMethod(self->button, "NotifyClicked", HelloForm2_button_notifyClicked);
51 static void HelloForm2_destructor(HelloForm2 this)
53 struct HelloForm2 * self = IPTR(this, HelloForm2);
54 deletei(self->button);
59 class_HelloForm2 = registerClass(app, HelloForm2, Window);
60 addMethod(class_HelloForm2, "OnRedraw", HelloForm2_onRedraw);
62 HelloForm2 hello = newi(class_HelloForm2);
64 Application_main(app);