Skip to content

Instantly share code, notes, and snippets.

@jerstlouis
Created May 29, 2016 23:59
Show Gist options
  • Save jerstlouis/5259992b65e239679514ec09202a7583 to your computer and use it in GitHub Desktop.
Save jerstlouis/5259992b65e239679514ec09202a7583 to your computer and use it in GitHub Desktop.
#define MODULE_NAME "HelloForm"
#include "ecere.hpp"
GuiApplication app;
MAIN_DEFINITION;
class HelloForm : public Window
{
public:
Button button;
CONSTRUCT(HelloForm, Window)
{
caption = $("Sample App using Ecere Toolkit/C++ Bindings");
borderStyle = sizable;
clientSize = { 640, 480 };
hasClose = true;
hasMaximize = true;
hasMinimize = true;
background = formColor;
font = { "Arial", 30 };
button.parent = this;
button.position = { 200, 200 };
button.caption = $("Yay!!");
button.notifyClicked = [](Window & owner, Button & btn, int x, int y, Modifiers mods)
{
HelloForm & self = (HelloForm &)owner;
MessageBox msgBox;
msgBox.caption = self.button.caption;
msgBox.contents = $("C++ Bindings!");
msgBox.modal();
return true;
};
onRedraw = [](Window & w, Surface surface) { surface.writeTextf(100, 100, $("Instance Method!")); };
}
/*
static Class * class_registration(Class * _class)
{
Window::class_registration(_class);
register_onRedraw(_class, [](Window & w, Surface surface) { surface.writeTextf(100, 100, $("Class Method!")); });
return _class;
}
*/
};
REGISTER_CLASS(app, HelloForm, Window);
HelloForm hello;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment