#define APPNAME "Button test"
#include <gtkfc.h>
#include <Gapplication.h>
#include <Gbutton.h>
class MyWindow : public Gwindow {
private:
Gbutton* the_button;
public:
MyWindow(Gstring s):Gwindow(s)
{
the_button = new Gbutton(Gstring("Push me to print hello on stdout"));
SetLayout(new GboxLayout(Gcontainers::VERTICAL));
}
~MyWindow()
{
Gapplication::Exit();
}
bool OnInit()
{
Insert(the_button);
return true;
}
void OnAction(Gwidget* w, GdkEvent* e)
{
if(w == the_button)
printf("hello\n");
}
protected:
bool OnDestroy(){
return true;
}
};
int main(int argc, char **argv)
{
Gapplication app(APPNAME, argc, argv);
Gwindow *w = new MyWindow(app.GetAppName());
app.Add(w);
w->Show();
app.Run();
return EXIT_SUCCESS;
}