Example.C 747 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (C) 2010 Emweb bvba, Kessel-Lo, Belgium.
  3. *
  4. * See the LICENSE file for terms of use.
  5. */
  6. #include <Wt/WApplication>
  7. #include <Wt/WLineEdit>
  8. #include <Wt/WTemplate>
  9. #include "WidgetFunction.h"
  10. WidgetFunction widgetFunction;
  11. Wt::WWidget *createLineEdit(const std::vector<Wt::WString>& args)
  12. {
  13. return new Wt::WLineEdit();
  14. }
  15. Wt::WApplication *createApplication(const Wt::WEnvironment& env)
  16. {
  17. Wt::WApplication *app = new Wt::WApplication(env);
  18. Wt::WTemplate *t = new Wt::WTemplate("${widget:line-edit}", app->root());
  19. t->addFunction("widget", widgetFunction);
  20. return app;
  21. }
  22. int main(int argc, char **argv)
  23. {
  24. widgetFunction.registerType("line-edit", createLineEdit);
  25. return WRun(argc, argv, &createApplication);
  26. }