]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/combocmn.cpp
don't crash on weird line endings like \r\r\n
[wxWidgets.git] / src / common / combocmn.cpp
index deeff9218ac13b883a8d89feb29cd64e39d184e6..7f613330e3f7934d7f74858fec0c9b95fa41c2cb 100644 (file)
@@ -35,7 +35,6 @@
     #include "wx/timer.h"
 #endif
 
-#include "wx/dcbuffer.h"
 #include "wx/tooltip.h"
 
 #include "wx/combo.h"
@@ -610,9 +609,6 @@ END_EVENT_TABLE()
 
 IMPLEMENT_ABSTRACT_CLASS(wxComboCtrlBase, wxControl)
 
-// Have global double buffer - should be enough for multiple combos
-static wxBitmap* gs_doubleBuffer = (wxBitmap*) NULL;
-
 void wxComboCtrlBase::Init()
 {
     m_winPopup = (wxWindow *)NULL;
@@ -737,9 +733,6 @@ wxComboCtrlBase::~wxComboCtrlBase()
     if ( HasCapture() )
         ReleaseMouse();
 
-    delete gs_doubleBuffer;
-    gs_doubleBuffer = (wxBitmap*) NULL;
-
 #if INSTALL_TOPLEV_HANDLER
     delete ((wxComboFrameEventHandler*)m_toplevEvtHandler);
     m_toplevEvtHandler = (wxEvtHandler*) NULL;
@@ -1238,19 +1231,6 @@ void wxComboCtrlBase::RecalcAndRefresh()
     }
 }
 
-wxBitmap& wxComboCtrlBase::GetBufferBitmap( const wxSize& sz ) const
-{
-    // If size is larger, recalculate double buffer bitmap
-    if ( !gs_doubleBuffer ||
-         sz.x > gs_doubleBuffer->GetWidth() ||
-         sz.y > gs_doubleBuffer->GetHeight() )
-    {
-        delete gs_doubleBuffer;
-        gs_doubleBuffer = new wxBitmap(sz.x+25,sz.y);
-    }
-    return *gs_doubleBuffer;
-}
-
 // ----------------------------------------------------------------------------
 // miscellaneous event handlers
 // ----------------------------------------------------------------------------
@@ -1302,26 +1282,17 @@ bool wxComboCtrlBase::HandleButtonMouseEvent( wxMouseEvent& event,
     }
     else if ( type == wxEVT_LEFT_DOWN )
     {
-        // Only accept event if it wasn't right after popup dismiss
-        //if ( ::wxGetLocalTimeMillis() > m_timeCanClick )
+        if ( flags & (wxCC_MF_ON_CLICK_AREA|wxCC_MF_ON_BUTTON) )
         {
-            // Need to test this, because it might be outside.
-            if ( flags & wxCC_MF_ON_BUTTON )
-            {
-                m_btnState |= wxCONTROL_PRESSED;
-                Refresh();
+            m_btnState |= wxCONTROL_PRESSED;
+            Refresh();
 
-                if ( !(m_iFlags & wxCC_POPUP_ON_MOUSE_UP) )
-                    OnButtonClick();
-                else
-                    // If showing popup now, do not capture mouse or there will be interference
-                    CaptureMouse();
-            }
+            if ( !(m_iFlags & wxCC_POPUP_ON_MOUSE_UP) )
+                OnButtonClick();
+            else
+                // If showing popup now, do not capture mouse or there will be interference
+                CaptureMouse();
         }
-        /*else
-        {
-            m_btnState = 0;
-        }*/
     }
     else if ( type == wxEVT_LEFT_UP )
     {
@@ -1335,7 +1306,7 @@ bool wxComboCtrlBase::HandleButtonMouseEvent( wxMouseEvent& event,
             // If mouse was inside, fire the click event.
             if ( m_iFlags & wxCC_POPUP_ON_MOUSE_UP )
             {
-                if ( flags & wxCC_MF_ON_BUTTON )
+                if ( flags & (wxCC_MF_ON_CLICK_AREA|wxCC_MF_ON_BUTTON) )
                     OnButtonClick();
             }