-
Notifications
You must be signed in to change notification settings - Fork 0
/
DateInput.cpp
22 lines (17 loc) · 904 Bytes
/
DateInput.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "DateInput.h"
#include "Log.h"
DateInput::DateInput(wxWindow* parent, wxWindowID datePickerCtrlId, std::string labelText, wxDateTime initialDate, wxPoint topLeft,
DatePickerChangeFunc datePickerChangeFunc, int labelWidth, int textInputWidth)
: datePickerChangeFunc(datePickerChangeFunc), parent(parent)
{
staticText = new wxStaticText(parent, 0, labelText, topLeft, wxSize(labelWidth, Height));
datePicker = new wxDatePickerCtrl(parent, datePickerCtrlId, initialDate, topLeft + wxSize(labelWidth, 0), wxSize(textInputWidth, Height)
, wxDP_DROPDOWN | wxDP_SHOWCENTURY); // not supported under OSX/Cocoa
// use wxDP_SPIN instead of wxDP_DROPDOWN);
datePicker->SetValue(initialDate);
parent->Bind(wxEVT_DATE_CHANGED, &DateInput::updateDatePicker, this, datePicker->GetId());
}
void DateInput::updateDatePicker(wxDateEvent& event)
{
datePickerChangeFunc(event.GetDate());
}