]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dlgcmn.cpp
Apply patch that prevents a crash when more than
[wxWidgets.git] / src / common / dlgcmn.cpp
index f810b795a413196af0015f7de55a079f2d996003..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
@@ -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 )
@@ -205,7 +227,7 @@ wxStdDialogButtonSizer *wxDialogBase::CreateStdDialogButtonSizer( long flags )
         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;
 }