]> git.saurik.com Git - wxWidgets.git/commitdiff
Minor editing.
authorWłodzimierz Skiba <abx@abx.art.pl>
Mon, 14 Feb 2005 18:28:56 +0000 (18:28 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Mon, 14 Feb 2005 18:28:56 +0000 (18:28 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32042 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/calendar/calendar.cpp
src/generic/datectlg.cpp

index fb34cfe2803413c1c7d818d414bad909291b493a..9cc91601f799fa23393f97a7b8086562dfa27ce8 100644 (file)
@@ -96,7 +96,7 @@ public:
 
     void SetDate();
     void Today();
-    
+
 private:
     wxCalendarCtrl *m_calendar;
     wxStaticText   *m_date;
@@ -590,7 +590,7 @@ void MyPanel::Today()
 #if wxUSE_DATEPICKCTRL
 
 MyDialog::MyDialog(wxWindow *parent, const wxDateTime& dt, int dtpStyle)
-        : wxDialog(parent, -1, wxString(_T("Calendar: Choose a date")))
+        : wxDialog(parent, wxID_ANY, wxString(_T("Calendar: Choose a date")))
 {
     wxStdDialogButtonSizer *sizerBtns = new wxStdDialogButtonSizer;
     sizerBtns->AddButton(new wxButton(this, wxID_OK));
@@ -598,16 +598,16 @@ MyDialog::MyDialog(wxWindow *parent, const wxDateTime& dt, int dtpStyle)
     sizerBtns->Finalise();
 
     wxSizer *sizerText = new wxBoxSizer(wxHORIZONTAL);
-    sizerText->Add(new wxStaticText(this, -1, _T("Date in ISO format: ")),
+    sizerText->Add(new wxStaticText(this, wxID_ANY, _T("Date in ISO format: ")),
                     wxSizerFlags().Border().Align(wxALIGN_CENTRE_VERTICAL));
-    m_text = new wxTextCtrl(this, -1);
+    m_text = new wxTextCtrl(this, wxID_ANY);
     sizerText->Add(m_text, wxSizerFlags().
                         Expand().Border().Align(wxALIGN_CENTRE_VERTICAL));
 
     wxSizer *sizerTop = new wxBoxSizer(wxVERTICAL);
     sizerTop->Add(new wxStaticText
                       (
-                        this, -1,
+                        this, wxID_ANY,
                         _T("Enter your birthday date (not before 20th century):")
                       ),
                     wxSizerFlags().Border());
@@ -615,13 +615,13 @@ MyDialog::MyDialog(wxWindow *parent, const wxDateTime& dt, int dtpStyle)
 #if wxUSE_DATEPICKCTRL_GENERIC
     wxFrame *frame = (wxFrame *)wxGetTopLevelParent(parent);
     if ( frame && frame->GetMenuBar()->IsChecked(Calendar_DatePicker_Generic) )
-        m_datePicker = new wxDatePickerCtrlGeneric(this, -1, dt,
+        m_datePicker = new wxDatePickerCtrlGeneric(this, wxID_ANY, dt,
                                                    wxDefaultPosition,
                                                    wxDefaultSize,
                                                    dtpStyle);
     else
 #endif // wxUSE_DATEPICKCTRL_GENERIC
-    m_datePicker = new wxDatePickerCtrl(this, -1, dt,
+    m_datePicker = new wxDatePickerCtrl(this, wxID_ANY, dt,
                                         wxDefaultPosition, wxDefaultSize,
                                         dtpStyle);
     m_datePicker->SetRange(wxDateTime(1, wxDateTime::Jan, 1900),
@@ -640,7 +640,10 @@ MyDialog::MyDialog(wxWindow *parent, const wxDateTime& dt, int dtpStyle)
 void MyDialog::OnDateChange(wxDateEvent& event)
 {
     const wxDateTime dt = event.GetDate();
-    m_text->SetValue(dt.IsValid()? dt.FormatISODate() : wxString());
+    if(dt.IsValid())
+        m_text->SetValue(dt.FormatISODate());
+    else
+        m_text->SetValue(wxEmptyString);
 }
 
 #endif // wxUSE_DATEPICKCTRL
index 3ccd9d0553621f24266fd2ff34252ac31d56c142..4602a9c1071a5f3122d06b376707c8d5f9e7d5ec 100644 (file)
@@ -506,7 +506,7 @@ void wxDatePickerCtrlGeneric::DropDown(bool down)
         if (down)
         {
             wxDateTime dt;
-            if (!m_txt->GetValue().IsEmpty())
+            if (!m_txt->GetValue().empty())
                 dt.ParseFormat(m_txt->GetValue(), m_format);
 
             if (dt.IsValid())
@@ -588,7 +588,10 @@ void wxDatePickerCtrlGeneric::OnKillFocus(wxFocusEvent &ev)
             dt = m_currentDate;
     }
 
-    m_txt->SetValue(dt.IsValid()? dt.Format(m_format) : wxString());
+    if(dt.IsValid())
+        m_txt->SetValue(dt.Format(m_format));
+    else
+        m_txt->SetValue(wxEmptyString);
 
     // notify that we had to change the date after validation
     if ( (dt.IsValid() && m_currentDate != dt) ||
@@ -630,9 +633,9 @@ void wxDatePickerCtrlGeneric::OnText(wxCommandEvent &ev)
 
     // We'll create an additional event if the date is valid.
     // If the date isn't valid, the user's probably in the middle of typing
-    wxString txt=m_txt->GetValue();
+    wxString txt = m_txt->GetValue();
     wxDateTime dt;
-    if (!txt.IsEmpty())
+    if (!txt.empty())
     {
         dt.ParseFormat(txt, m_format);
         if (!dt.IsValid())