// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma implementation "genscrolwin.h"
#endif
#include "wx/scrolwin.h"
#include "wx/panel.h"
+#if wxUSE_TIMER
#include "wx/timer.h"
+#endif
#include "wx/sizer.h"
+#include "wx/recguard.h"
#ifdef __WXMSW__
#include <windows.h> // for DLGC_WANTARROWS
DECLARE_NO_COPY_CLASS(wxScrollHelperEvtHandler)
};
+#if wxUSE_TIMER
// ----------------------------------------------------------------------------
// wxAutoScrollTimer: the timer used to generate a stream of scroll events when
// a captured mouse is held outside the window
}
}
}
+#endif
// ----------------------------------------------------------------------------
// wxScrollHelperEvtHandler
// Adjust the scrollbars - new version.
void wxScrollHelper::AdjustScrollbars()
{
+ static wxRecursionGuardFlag s_flagReentrancy;
+ wxRecursionGuard guard(s_flagReentrancy);
+ if ( guard.IsInside() )
+ {
+ // don't reenter AdjustScrollbars() while another call to
+ // AdjustScrollbars() is in progress because this may lead to calling
+ // ScrollWindow() twice and this can really happen under MSW if
+ // SetScrollbar() call below adds or removes the scrollbar which
+ // changes the window size and hence results in another
+ // AdjustScrollbars() call
+ return;
+ }
+
#ifdef __WXMAC__
m_targetWindow->Update();
#endif
oldh = h;
GetTargetSize( &w, &h );
- } while ( w != oldw && h != oldh );
+ } while ( w != oldw || h != oldh );
#ifdef __WXMOTIF__
// Sorry, some Motif-specific code to implement a backing pixmap
void wxScrollHelper::StopAutoScrolling()
{
+#if wxUSE_TIMER
if ( m_timerAutoScroll )
{
delete m_timerAutoScroll;
m_timerAutoScroll = (wxTimer *)NULL;
}
+#endif
}
void wxScrollHelper::HandleOnMouseEnter(wxMouseEvent& event)
if ( !m_targetWindow->HasScrollbar(orient) )
return;
+#if wxUSE_TIMER
delete m_timerAutoScroll;
m_timerAutoScroll = new wxAutoScrollTimer
(
orient
);
m_timerAutoScroll->Start(50); // FIXME: make configurable
+#endif
}
}