#define APPNAME "Entry text"
#include <gtkfc.h>
#include <Gapplication.h>
#include <GentryText.h>
class MyWindow : public Gwindow {
private:
  GentryText* the_text;
public:
  MyWindow(Gstring s):Gwindow(s)
  {
    SetLayout(new GboxLayout(Gcontainers::VERTICAL));
    the_text = new GentryText();
  }
  ~MyWindow()
  { 
    Gapplication::Exit();
  }
  bool OnInit()
  {
    Insert(the_text);
    return true;
  }
  void OnAction(Gwidget* w, GdkEvent* e)
  {
    if(w == the_text)
      {
    printf("%s\n", the_text->GetText().c_str());
    the_text->SetText(Gstring(""));
      }
  }
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;
}