]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/dlgcmn.cpp
Forgot header with OSX prefix
[wxWidgets.git] / src / common / dlgcmn.cpp
index 31c5aa60ec4ad4111ca0c76e45466646ee4c2fd0..aa25908a2b4417103b4b5c759625ffa2a4fbfaa4 100644 (file)
@@ -42,6 +42,7 @@
 #include "wx/module.h"
 #include "wx/private/stattext.h"
 #include "wx/bookctrl.h"
+#include "wx/scrolwin.h"
 
 #if wxUSE_DISPLAY
 #include "wx/display.h"
@@ -173,8 +174,6 @@ wxSizer *wxDialogBase::CreateTextSizer(const wxString& message)
 
 wxSizer *wxDialogBase::CreateButtonSizer(long flags)
 {
-    wxSizer *sizer = NULL;
-
 #ifdef __SMARTPHONE__
     wxDialog* dialog = (wxDialog*) this;
     if ( flags & wxOK )
@@ -188,6 +187,8 @@ wxSizer *wxDialogBase::CreateButtonSizer(long flags)
 
     if ( flags & wxNO )
         dialog->SetRightMenu(wxID_NO);
+
+    return NULL;
 #else // !__SMARTPHONE__
 
 #if wxUSE_BUTTON
@@ -201,15 +202,19 @@ wxSizer *wxDialogBase::CreateButtonSizer(long flags)
             wxSystemOptions::GetOptionInt(wxT("wince.dialog.real-ok-cancel")) )
 #endif // __POCKETPC__
     {
-        sizer = CreateStdDialogButtonSizer(flags);
+        return CreateStdDialogButtonSizer(flags);
     }
+#ifdef __POCKETPC__
+    return NULL;
+#endif // __POCKETPC__
+
 #else // !wxUSE_BUTTON
     wxUnusedVar(flags);
+
+    return NULL;
 #endif // wxUSE_BUTTON/!wxUSE_BUTTON
 
 #endif // __SMARTPHONE__/!__SMARTPHONE__
-
-    return sizer;
 }
 
 wxSizer *wxDialogBase::CreateSeparatedButtonSizer(long flags)
@@ -475,7 +480,17 @@ void wxDialogBase::OnSysColourChanged(wxSysColourChangedEvent& event)
 bool wxDialogBase::DoLayoutAdaptation()
 {
     if (GetLayoutAdapter())
-        return GetLayoutAdapter()->DoLayoutAdaptation((wxDialog*) this);
+    {
+        wxWindow* focusWindow = wxFindFocusDescendant(this); // from event.h
+        if (GetLayoutAdapter()->DoLayoutAdaptation((wxDialog*) this))
+        {
+            if (focusWindow)
+                focusWindow->SetFocus();
+            return true;
+        }
+        else
+            return false;
+    }
     else
         return false;
 }
@@ -528,6 +543,7 @@ bool wxStandardDialogLayoutAdapter::DoLayoutAdaptation(wxDialog* dialog)
 {
     if (dialog->GetSizer())
     {
+#if wxUSE_BOOKCTRL
         wxBookCtrlBase* bookContentWindow = wxDynamicCast(dialog->GetContentWindow(), wxBookCtrlBase);
 
         if (bookContentWindow)
@@ -563,6 +579,7 @@ bool wxStandardDialogLayoutAdapter::DoLayoutAdaptation(wxDialog* dialog)
             FitWithScrolling(dialog, windows);
         }
         else
+#endif // wxUSE_BOOKCTRL
         {
             // If we have an arbitrary dialog, create a scrolling area for the main content, and a button sizer
             // for the main buttons.
@@ -766,7 +783,7 @@ int wxStandardDialogLayoutAdapter::DoMustScroll(wxDialog* dialog, wxSize& window
 #if wxUSE_DISPLAY
     displaySize = wxDisplay(wxDisplay::GetFromWindow(dialog)).GetClientArea().GetSize();
 #else
-    displaySize = wxGetClientDisplayRect();
+    displaySize = wxGetClientDisplayRect().GetSize();
 #endif
 
     int flags = 0;