10 #include <Wt/WApplication> 12 #include <Wt/WStringUtil> 15 : WContainerWidget(parent)
17 WContainerWidget *langLayout =
new WContainerWidget(
this);
18 langLayout->setContentAlignment(AlignRight);
19 new WText(tr(
"language"), langLayout);
21 const char *lang[] = {
"en",
"nl" };
23 for (
int i = 0; i < 2; ++i) {
24 WText *t =
new WText(widen(lang[i]), langLayout);
42 bool haveLang =
false;
48 bool isLang = lang.find(narrow(t->text().value())) == 0;
49 t->setStyleClass(isLang ? L
"langcurrent" : L
"lang");
51 haveLang = haveLang || isLang;
56 WApplication::instance()
59 WApplication::instance()->setLocale(lang);
64 WText *t = (WText *)sender();
70 WApplication *app =
new WApplication(env);
71 app->messageResourceBundle().use(WApplication::appRoot() +
"form-example");
72 app->setTitle(
"Form example");
76 WCssDecorationStyle langStyle;
77 langStyle.font().setSize(WFont::Smaller);
78 langStyle.setCursor(PointingHandCursor);
79 langStyle.setForegroundColor(blue);
80 langStyle.setTextDecoration(WCssDecorationStyle::Underline);
81 app->styleSheet().addRule(
".lang", langStyle);
83 langStyle.setCursor(ArrowCursor);
84 langStyle.font().setWeight(WFont::Bold);
85 app->styleSheet().addRule(
".langcurrent", langStyle);
90 int main(
int argc,
char **argv)