1 #include <Wt/WCalendar.h> 2 #include <Wt/WContainerWidget.h> 3 #include <Wt/WText.h> 4 5 SAMPLE_BEGIN(CalendarSimple) 6 7 auto container = std::make_unique<Wt::WContainerWidget>(); 8 9 Wt::WCalendar *c1 = container->addNew<Wt::WCalendar>(); 10 11 Wt::WText *out = container->addNew<Wt::WText>(); 12 out->addStyleClass("help-block"); 13 __anon4a9e1d4a0102null14c1->selectionChanged().connect([=] { 15 std::set<Wt::WDate> selection = c1->selection(); 16 if (selection.size() != 0) { 17 Wt::WDate d; 18 d = (*selection.begin()); 19 Wt::WDate toDate(d.year() + 1, 1, 1); 20 int days = d.daysTo(toDate); 21 out->setText(Wt::WString("<p>That's {1} days until New Year's Day!</p>") 22 .arg(days)); 23 } 24 }); 25 26 SAMPLE_END(return std::move(container)) 27