/* * label.cpp * dim sep 22 17:02:25 EDT 2002 * * ---------------------------------------------------------------------- * * display a simple window with a label inside. * The label is created in the OnInit() method. * Note that the Insert(new Glabel(...)) does not cause * memory leaks because the widget manager use a destructive collection. * See the api documentation (Gset Object) for more details... * * ---------------------------------------------------------------------- * * Compile with g++ `gtkfc-config --cflags` label.cpp -o label `gtkfc-config --libs` */ #define APPNAME "Hello World with label" #include <gtkfc.h> #include <Gapplication.h> #include <Glabel.h> class MyWindow : public Gwindow { public: MyWindow(Gstring s):Gwindow(s) { // imperatively set the main layout of the window SetLayout(new GboxLayout(Gcontainers::VERTICAL)); } ~MyWindow() { Gapplication::Exit(); } bool OnInit() { Insert(new Glabel(Gstring("A beautifull label in my window"))); 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; }