-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathCalendarCtrl.cpp
38 lines (34 loc) · 1.31 KB
/
CalendarCtrl.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <wx/app.h>
#include <wx/calctrl.h>
#include <wx/frame.h>
#include <wx/panel.h>
namespace CalendarCtrlExample {
class Frame : public wxFrame {
public:
Frame() : wxFrame {nullptr, wxID_ANY, "MonthCalendar example"} {
calendarCtrl1->SetDateRange({5, wxDateTime::Jan, 1971}, {5, wxDateTime::Jan, 2071});
calendarCtrl1->Bind(wxEVT_CALENDAR_SEL_CHANGED, [&](wxCalendarEvent& e) {
wxLogDebug("Calendar Selection Changed");
});
calendarCtrl1->Bind(wxEVT_CALENDAR_DOUBLECLICKED, [&](wxCalendarEvent& e) {
wxLogDebug("Calendar double Cliccked");
});
calendarCtrl1->Bind(wxEVT_CALENDAR_PAGE_CHANGED, [&](wxCalendarEvent& e) {
wxLogDebug("Calendar Page Changed");
});
calendarCtrl1->Bind(wxEVT_CALENDAR_WEEKDAY_CLICKED, [&](wxCalendarEvent& e) {
wxLogDebug("Calendar Weekday Clicked");
});
calendarCtrl1->Bind(wxEVT_CALENDAR_WEEK_CLICKED, [&](wxCalendarEvent& e) {
wxLogDebug("Calendar Week Clicked");
});
}
private:
wxPanel* panel = new wxPanel {this};
wxCalendarCtrl* calendarCtrl1 = new wxCalendarCtrl {panel, wxID_ANY, wxDateTime::Now(), {10, 10}};
};
class Application : public wxApp {
bool OnInit() override {return (new Frame)->Show();}
};
}
wxIMPLEMENT_APP(CalendarCtrlExample::Application);