]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dlgcmn.cpp
Make sure text part of combobox is enabled/disabled too
[wxWidgets.git] / src / common / dlgcmn.cpp
index 23b79ecad214e4c7249763bd5f9ab4d78d7b3c98..d32ba913182e804ea8a668f94742aace6d0b6afb 100644 (file)
@@ -56,7 +56,8 @@ WX_DELEGATE_TO_CONTROL_CONTAINER(wxDialogBase)
 void wxDialogBase::Init()
 {
     m_returnCode = 0;
-
+    m_affirmativeId = wxID_OK;
+    
     // the dialogs have this flag on by default to prevent the events from the
     // dialog controls from reaching the parent frame which is usually
     // undesirable and can lead to unexpected and hard to find bugs
@@ -105,7 +106,7 @@ wxSizer *wxDialogBase::CreateTextSizer( const wxString& message )
                 {
                     wxStaticText *s = new wxStaticText( this, wxID_ANY, line );
                     box->Add( s );
-                    line = wxT("");
+                    line = wxEmptyString;
                 }
                 else
                 {
@@ -148,7 +149,7 @@ wxSizer *wxDialogBase::CreateTextSizer( const wxString& message )
 
                         pos = last_space;
                         last_space = 0;
-                        line = wxT("");
+                        line = wxEmptyString;
                     }
                 }
         }
@@ -170,7 +171,28 @@ wxSizer *wxDialogBase::CreateTextSizer( const wxString& message )
 
 wxSizer *wxDialogBase::CreateButtonSizer( long flags )
 {
+#ifdef __SMARTPHONE__
+    wxDialog* dialog = (wxDialog*) this;
+    if (flags & wxOK){
+        dialog->SetLeftMenu(wxID_OK);
+    }
+
+    if (flags & wxCANCEL){
+        dialog->SetRightMenu(wxID_CANCEL);
+    }
+
+    if (flags & wxYES){
+        dialog->SetLeftMenu(wxID_YES);
+    }
+
+    if (flags & wxNO){
+        dialog->SetLeftMenu(wxID_NO);
+    }
+    wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
+    return sizer;
+#else
     return CreateStdDialogButtonSizer( flags );
+#endif
 }
 
 wxStdDialogButtonSizer *wxDialogBase::CreateStdDialogButtonSizer( long flags )
@@ -181,31 +203,31 @@ wxStdDialogButtonSizer *wxDialogBase::CreateStdDialogButtonSizer( long flags )
     wxButton *no = NULL;
 
     if (flags & wxOK){
-        ok = new wxButton(this, wxID_OK, _("OK"));
+        ok = new wxButton(this, wxID_OK);
         sizer->AddButton(ok);
     }
 
     if (flags & wxCANCEL){
-        wxButton *cancel = new wxButton(this, wxID_CANCEL, _("Cancel"));
+        wxButton *cancel = new wxButton(this, wxID_CANCEL);
         sizer->AddButton(cancel);
     }
 
     if (flags & wxYES){
-        yes = new wxButton(this, wxID_YES, _("Yes"));
+        yes = new wxButton(this, wxID_YES);
         sizer->AddButton(yes);
     }
 
     if (flags & wxNO){
-        no = new wxButton(this, wxID_NO, _("No"));
+        no = new wxButton(this, wxID_NO);
         sizer->AddButton(no);
     }
 
     if (flags & wxHELP){
-        wxButton *help = new wxButton(this, wxID_HELP, _("Help"));
+        wxButton *help = new wxButton(this, wxID_HELP);
         sizer->AddButton(help);
     }
 
-    sizer->Finalise();
+    sizer->Realize();
 
     if (flags & wxNO_DEFAULT)
     {
@@ -228,6 +250,11 @@ wxStdDialogButtonSizer *wxDialogBase::CreateStdDialogButtonSizer( long flags )
             yes->SetFocus();
         }
     }
+    
+    if (flags & wxOK)
+        SetAffirmativeId(wxID_OK);
+    else if (flags & wxYES)
+        SetAffirmativeId(wxID_YES);
 
     return sizer;
 }