]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/combocmn.cpp
Rewind the input stream after failing to load image from it.
[wxWidgets.git] / src / common / combocmn.cpp
index b32ef217eda9d69a3644349b54e9cd9860d7efe3..15298838f0c09fd3ff364a91dd953a543834fc0e 100644 (file)
 #define wxCC_GENERIC_TLW_IS_DIALOG
 #define wxComboCtrlGenericTLW   wxDialog
 
-#include "wx/gtk/private.h"
+#if defined(__WXGTK20__)
+# include "wx/gtk/private.h"
+#else
+# include "wx/gtk1/private.h"
+#endif
 
 // NB: Let's not be afraid to use wxGTK's wxPopupTransientWindow as a
 //     'perfect' popup, as it can succesfully host child controls even in
@@ -231,10 +235,10 @@ static inline bool IsPopupWinTypePerfect( wxByte popupWinType )
 #else
     return ( popupWinType == POPUPWIN_GENERICTLW
         #if POPUPWIN_IS_PERFECT
-             || popupWinType == POPUPWIN_WXPOPUPWINDOW 
+             || popupWinType == POPUPWIN_WXPOPUPWINDOW
         #endif
         #if TRANSIENT_POPUPWIN_IS_PERFECT
-             || popupWinType == POPUPWIN_WXPOPUPTRANSIENTWINDOW 
+             || popupWinType == POPUPWIN_WXPOPUPTRANSIENTWINDOW
         #endif
             );
 #endif
@@ -1198,7 +1202,7 @@ void wxComboCtrlBase::PositionTextCtrl( int textCtrlXAdjust, int textCtrlYAdjust
             // There is special custom paint area - it is better to
             // use some margin with the wxTextCtrl.
             m_text->SetMargins(m_marginLeft);
-            x = m_tcArea.x + m_widthCustomPaint + 
+            x = m_tcArea.x + m_widthCustomPaint +
                 m_marginLeft + textCtrlXAdjust;
         }
 
@@ -2034,21 +2038,18 @@ void wxComboCtrlBase::DestroyPopup()
     if ( m_popup )
         m_popup->RemoveEventHandler(m_popupEvtHandler);
 
-    delete m_popupEvtHandler;
+    wxDELETE(m_popupEvtHandler);
 
-    delete m_popupInterface;
+    wxDELETE(m_popupInterface);
 
     if ( m_winPopup )
     {
         m_winPopup->RemoveEventHandler(m_popupWinEvtHandler);
-        delete m_popupWinEvtHandler;
-        m_popupWinEvtHandler = NULL;
+        wxDELETE(m_popupWinEvtHandler);
         m_winPopup->Destroy();
+        m_winPopup = NULL;
     }
 
-    m_popupEvtHandler = NULL;
-    m_popupInterface = NULL;
-    m_winPopup = NULL;
     m_popup = NULL;
 }
 
@@ -2091,17 +2092,24 @@ void wxComboCtrlBase::OnButtonClick()
 {
     // Derived classes can override this method for totally custom
     // popup action
-    if ( !IsPopupWindowState(Visible) )
+    switch ( GetPopupWindowState() )
     {
-        wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_DROPDOWN, GetId());
-        event.SetEventObject(this);
-        HandleWindowEvent(event);
+        case Hidden:
+        {
+            wxCommandEvent event(wxEVT_COMMAND_COMBOBOX_DROPDOWN, GetId());
+            event.SetEventObject(this);
+            HandleWindowEvent(event);
 
-        ShowPopup();
-    }
-    else
-    {
-        HidePopup(true);
+            ShowPopup();
+            break;
+        }
+
+        case Animating:
+        case Visible:
+        {
+            HidePopup(true);
+            break;
+        }
     }
 }