#define APPNAME "Layout"
#include <gtkfc.h>
#include <Gapplication.h>
#include <Glabel.h>
class MyWindow : public Gwindow {
public:
MyWindow(Gstring s):Gwindow(s)
{
SetLayout(new GboxLayout(Gcontainers::VERTICAL));
}
~MyWindow()
{
Gapplication::Exit();
}
bool OnInit()
{
Gcontainers* vertical = new GboxLayout(Gcontainers::VERTICAL);
Insert(vertical);
vertical->Add(new Glabel("first"));
vertical->Add(new Glabel("second"));
Gcontainers* horizontal = new GboxLayout(Gcontainers::HORIZONTAL);
Insert(horizontal);
horizontal->Add(new Glabel("first"));
horizontal->Add(new Glabel("second"));
Gcontainers* fixed = new GfixedLayout();
Insert(fixed);
Glabel* label;
label = new Glabel("first");
label->SetPosition(10, 10, 0, 0);
fixed->Add(label);
label = new Glabel("second");
label->SetPosition(100, 100, 0, 0);
fixed->Add(label);
return true;
}
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;
}