+
+
+TimePickerText::TimePickerText (wxWindow* parent, wxDateTime time)
+ : TimePicker (parent)
+{
+ wxClientDC dc (parent);
+ wxSize size = dc.GetTextExtent (wxT("99999"));
+ size.SetHeight (-1);
+
+ wxBoxSizer* sizer = new wxBoxSizer (wxHORIZONTAL);
+ _hours = new wxTextCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, size);
+ sizer->Add (_hours, 1, wxEXPAND | wxLEFT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP);
+ sizer->Add (new StaticText (this, wxT (":")), 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL, 4);
+ _minutes = new wxTextCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, size);
+ sizer->Add (_minutes, 1, wxEXPAND | wxRIGHT | wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_GAP);
+
+ SetSizerAndFit (sizer);
+
+ _minutes->MoveAfterInTabOrder (_hours);
+
+ _hours->SetValue (wxString::Format("%d", time.GetHour()));
+ _minutes->SetValue (wxString::Format("%d", time.GetMinute()));
+
+ _hours->Bind (wxEVT_TEXT, (bind(&TimePickerText::changed, this)));
+ _minutes->Bind (wxEVT_TEXT, (bind(&TimePickerText::changed, this)));
+}
+
+
+void
+TimePickerText::changed ()
+{
+ Changed ();
+}
+
+
+int
+TimePickerText::hours () const
+{
+ return max(0, min(23, wxAtoi(_hours->GetValue())));
+}
+
+
+int
+TimePickerText::minutes () const
+{
+ return max(0, min(59, wxAtoi(_minutes->GetValue())));
+}
+
+
+