]> git.saurik.com Git - wxWidgets.git/commitdiff
In wxComboCtrlBase::DoShowPopup(), if the popup window is a generic TLW or a 'perfect...
authorJaakko Salli <jaakko.salli@dnainternet.net>
Sun, 6 Jun 2010 09:35:06 +0000 (09:35 +0000)
committerJaakko Salli <jaakko.salli@dnainternet.net>
Sun, 6 Jun 2010 09:35:06 +0000 (09:35 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64504 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/combocmn.cpp

index a050bd6cf231cf34ca7692665ad6d944cf8c6777..a256b660c403c4feea64b344d275572d01589c12 100644 (file)
@@ -221,6 +221,26 @@ enum
 #endif
 
 
+// Returns true if given popup window type can be classified as perfect
+// on this platform.
+static inline bool IsPopupWinTypePerfect( wxByte popupWinType )
+{
+#if POPUPWIN_IS_PERFECT && TRANSIENT_POPUPWIN_IS_PERFECT
+    wxUnusedVar(popupWinType);
+    return true;
+#else
+    return ( popupWinType == POPUPWIN_GENERICTLW
+        #if POPUPWIN_IS_PERFECT
+             || popupWinType == POPUPWIN_WXPOPUPWINDOW 
+        #endif
+        #if TRANSIENT_POPUPWIN_IS_PERFECT
+             || popupWinType == POPUPWIN_WXPOPUPTRANSIENTWINDOW 
+        #endif
+            );
+#endif
+}
+
+
 //
 // ** TODO **
 // * wxComboPopupWindow for external use (ie. replace old wxUniv wxPopupComboWindow)
@@ -2288,6 +2308,13 @@ void wxComboCtrlBase::DoShowPopup( const wxRect& rect, int WXUNUSED(flags) )
             winPopup->Show();
 
         m_popupWinState = Visible;
+
+        // If popup window was a generic top-level window, or the
+        // wxPopupWindow implemenation on this platform is classified as
+        // perfect, then we should be able to safely set focus to the popup
+        // control.
+        if ( IsPopupWinTypePerfect(m_popupWinType) )
+            m_popup->SetFocus();
     }
     else if ( IsPopupWindowState(Hidden) )
     {