+
+// ----------------------------------------------------------------------------
+// MyTimeDialog
+// ----------------------------------------------------------------------------
+
+#if wxUSE_TIMEPICKCTRL
+
+BEGIN_EVENT_TABLE(MyTimeDialog, wxDialog)
+ EVT_TIME_CHANGED(wxID_ANY, MyTimeDialog::OnTimeChange)
+END_EVENT_TABLE()
+
+MyTimeDialog::MyTimeDialog(wxWindow *parent)
+ : wxDialog(parent, wxID_ANY, wxString(wxT("Calendar: Choose time")))
+{
+#if wxUSE_TIMEPICKCTRL_GENERIC
+ wxFrame *frame = (wxFrame *)wxGetTopLevelParent(parent);
+ if ( frame && frame->GetMenuBar()->IsChecked(Calendar_TimePicker_Generic) )
+ m_timePicker = new wxTimePickerCtrlGeneric(this, wxID_ANY);
+ else
+#endif // wxUSE_TIMEPICKCTRL_GENERIC
+ m_timePicker = new wxTimePickerCtrl(this, wxID_ANY);
+ m_timeText = new wxStaticText(this, wxID_ANY,
+ m_timePicker->GetValue().FormatISOTime());
+
+ const wxSizerFlags flags = wxSizerFlags().Centre().Border();
+ wxFlexGridSizer* const sizerMain = new wxFlexGridSizer(2);
+ sizerMain->Add(new wxStaticText(this, wxID_ANY, "Enter &time:"), flags);
+ sizerMain->Add(m_timePicker, flags);
+
+ sizerMain->Add(new wxStaticText(this, wxID_ANY, "Time in ISO format:"),
+ flags);
+ sizerMain->Add(m_timeText, flags);
+
+ wxSizer* sizerTop = new wxBoxSizer(wxVERTICAL);
+ sizerTop->Add(sizerMain, flags);
+ sizerTop->Add(CreateStdDialogButtonSizer(wxOK | wxCANCEL), flags);
+
+ SetSizerAndFit(sizerTop);
+}
+
+void MyTimeDialog::OnTimeChange(wxDateEvent& event)
+{
+ m_timeText->SetLabel(event.GetDate().FormatISOTime());
+}
+
+#endif // wxUSE_TIMEPICKCTRL