bindings: Base methods support in Instance class
[sdk] / bindings / cpp / samples / sample4.cpp
1 #define MODULE_NAME  "HelloForm"
2
3 #include "ecere.hpp"
4
5 class HelloForm : public Window
6 {
7 public:
8    Button button;
9
10    CONSTRUCT(HelloForm, Window)
11    {
12       caption = $("Sample App using Ecere Toolkit/C++ Bindings");
13       borderStyle = sizable;
14       clientSize = { 640, 480 };
15       hasClose = true;
16       hasMaximize = true;
17       hasMinimize = true;
18       background = formColor;
19       font = { "Arial", 30 };
20
21       button.parent = this;
22       button.position = { 200, 200 };
23       button.caption = $("Yay!!");
24       button.notifyClicked = [](Window & owner, Button & btn, int x, int y, Modifiers mods)
25       {
26          HelloForm & self = (HelloForm &)owner;
27          MessageBox msgBox;
28          msgBox.caption = self.button.caption;
29          msgBox.contents = $("C++ Bindings!");
30          msgBox.modal();
31          return true;
32       };
33
34       onRedraw = [](Window & w, Surface & surface) { surface.writeTextf(100, 100, $("Instance Method!")); };
35    }
36 };
37 GuiApplication app;
38
39 REGISTER_CLASS_DEF(HelloForm, Window, app);
40
41 HelloForm hello;
42
43 MAIN_DEFINITION;