+#include "wx/html/htmlproc.h"
+#include "wx/clipbrd.h"
+
+#include "wx/arrimpl.cpp"
+#include "wx/listimpl.cpp"
+
+
+#if wxUSE_CLIPBOARD
+// ----------------------------------------------------------------------------
+// wxHtmlWinAutoScrollTimer: the timer used to generate a stream of scroll
+// events when a captured mouse is held outside the window
+// ----------------------------------------------------------------------------
+
+class wxHtmlWinAutoScrollTimer : public wxTimer
+{
+public:
+ wxHtmlWinAutoScrollTimer(wxScrolledWindow *win,
+ wxEventType eventTypeToSend,
+ int pos, int orient)
+ {
+ m_win = win;
+ m_eventType = eventTypeToSend;
+ m_pos = pos;
+ m_orient = orient;
+ }
+
+ virtual void Notify();
+
+private:
+ wxScrolledWindow *m_win;
+ wxEventType m_eventType;
+ int m_pos,
+ m_orient;
+
+ DECLARE_NO_COPY_CLASS(wxHtmlWinAutoScrollTimer)
+};
+
+void wxHtmlWinAutoScrollTimer::Notify()
+{
+ // only do all this as long as the window is capturing the mouse
+ if ( wxWindow::GetCapture() != m_win )
+ {
+ Stop();
+ }
+ else // we still capture the mouse, continue generating events
+ {
+ // first scroll the window if we are allowed to do it
+ wxScrollWinEvent event1(m_eventType, m_pos, m_orient);
+ event1.SetEventObject(m_win);
+ if ( m_win->GetEventHandler()->ProcessEvent(event1) )
+ {
+ // and then send a pseudo mouse-move event to refresh the selection
+ wxMouseEvent event2(wxEVT_MOTION);
+ wxGetMousePosition(&event2.m_x, &event2.m_y);
+
+ // the mouse event coordinates should be client, not screen as
+ // returned by wxGetMousePosition
+ wxWindow *parentTop = m_win;
+ while ( parentTop->GetParent() )
+ parentTop = parentTop->GetParent();
+ wxPoint ptOrig = parentTop->GetPosition();
+ event2.m_x -= ptOrig.x;
+ event2.m_y -= ptOrig.y;
+
+ event2.SetEventObject(m_win);
+
+ // FIXME: we don't fill in the other members - ok?
+ m_win->GetEventHandler()->ProcessEvent(event2);
+ }
+ else // can't scroll further, stop
+ {
+ Stop();
+ }
+ }
+}
+
+#endif // wxUSE_CLIPBOARD
+