From aa767a452107db3fcc5773a8955927b059ccf945 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 1 Aug 2007 15:34:48 +0000 Subject: [PATCH] Added EVT_MOVE_START, EVT_MOVE_END (wxMSW only for now) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47850 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/moveevt.tex | 4 ++++ include/wx/event.h | 18 +++++++++++------- include/wx/msw/window.h | 2 ++ src/common/event.cpp | 12 +++++++----- src/msw/window.cpp | 30 ++++++++++++++++++++++++++++++ 5 files changed, 54 insertions(+), 12 deletions(-) diff --git a/docs/latex/wx/moveevt.tex b/docs/latex/wx/moveevt.tex index 97dfbc4504..f58c651a97 100644 --- a/docs/latex/wx/moveevt.tex +++ b/docs/latex/wx/moveevt.tex @@ -24,6 +24,10 @@ function that takes a wxMoveEvent argument. \begin{twocollist}\itemsep=0pt \twocolitem{{\bf EVT\_MOVE(func)}}{Process a wxEVT\_MOVE event, which is generated when a window is moved.} +\twocolitem{{\bf EVT\_MOVE\_START(func)}}{Process a wxEVT\_MOVE\_START event, which is generated +when the user starts to move or size a window. wxMSW only.} +\twocolitem{{\bf EVT\_MOVE\_END(func)}}{Process a wxEVT\_MOVE\_END event, which is generated +when the user stops moving or sizing a window. wxMSW only.} \end{twocollist} \wxheading{See also} diff --git a/include/wx/event.h b/include/wx/event.h index 3635b757ec..4fc87804d0 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -275,13 +275,15 @@ BEGIN_DECLARE_EVENT_TYPES() DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 440) DECLARE_EVENT_TYPE(wxEVT_SIZING, 441) DECLARE_EVENT_TYPE(wxEVT_MOVING, 442) - DECLARE_EVENT_TYPE(wxEVT_HIBERNATE, 443) + DECLARE_EVENT_TYPE(wxEVT_MOVE_START, 443) + DECLARE_EVENT_TYPE(wxEVT_MOVE_END, 444) + DECLARE_EVENT_TYPE(wxEVT_HIBERNATE, 445) // more power events follow -- see wx/power.h // Clipboard events - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_COPY, 444) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_CUT, 445) - DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_PASTE, 446) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_COPY, 446) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_CUT, 447) + DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_PASTE, 448) // Generic command events // Note: a click is a higher-level event than button down/up @@ -826,7 +828,7 @@ public: // Returns the configured number of lines (or whatever) to be scrolled per // wheel action. Defaults to one. int GetLinesPerAction() const { return m_linesPerAction; } - + // Is the system set to do page scrolling? bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); } @@ -847,7 +849,7 @@ public: bool m_shiftDown; bool m_altDown; bool m_metaDown; - + int m_wheelAxis; int m_wheelRotation; int m_wheelDelta; @@ -2304,7 +2306,7 @@ public: // Clear table void Clear(); -#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING +#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING // Clear all tables static void ClearAll(); #endif // __WXDEBUG__ && wxUSE_MEMORY_TRACING @@ -2846,6 +2848,8 @@ typedef void (wxEvtHandler::*wxClipboardTextEventFunction)(wxClipboardTextEvent& #define EVT_SIZING(func) wx__DECLARE_EVT0(wxEVT_SIZING, wxSizeEventHandler(func)) #define EVT_MOVE(func) wx__DECLARE_EVT0(wxEVT_MOVE, wxMoveEventHandler(func)) #define EVT_MOVING(func) wx__DECLARE_EVT0(wxEVT_MOVING, wxMoveEventHandler(func)) +#define EVT_MOVE_START(func) wx__DECLARE_EVT0(wxEVT_MOVE_START, wxMoveEventHandler(func)) +#define EVT_MOVE_END(func) wx__DECLARE_EVT0(wxEVT_MOVE_END, wxMoveEventHandler(func)) #define EVT_CLOSE(func) wx__DECLARE_EVT0(wxEVT_CLOSE_WINDOW, wxCloseEventHandler(func)) #define EVT_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func)) #define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func)) diff --git a/include/wx/msw/window.h b/include/wx/msw/window.h index e65781c7a4..0a3600676c 100644 --- a/include/wx/msw/window.h +++ b/include/wx/msw/window.h @@ -317,6 +317,8 @@ public: bool HandleSize(int x, int y, WXUINT flag); bool HandleSizing(wxRect& rect); bool HandleGetMinMaxInfo(void *mmInfo); + bool HandleEnterSizeMove(); + bool HandleExitSizeMove(); bool HandleShow(bool show, int status); bool HandleActivate(int flag, bool minimized, WXHWND activate); diff --git a/src/common/event.cpp b/src/common/event.cpp index 980f6ba965..93eaa2e234 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -113,7 +113,7 @@ const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = // the memory leaks when using it, however this breaks re-initializing the // library (i.e. repeated calls to wxInitialize/wxUninitialize) because the // event tables won't be rebuilt the next time, so disable this by default -#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING +#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING class wxEventTableEntryModule: public wxModule { @@ -257,6 +257,8 @@ DEFINE_EVENT_TYPE(wxEVT_SIZE) DEFINE_EVENT_TYPE(wxEVT_SIZING) DEFINE_EVENT_TYPE(wxEVT_MOVE) DEFINE_EVENT_TYPE(wxEVT_MOVING) +DEFINE_EVENT_TYPE(wxEVT_MOVE_START) +DEFINE_EVENT_TYPE(wxEVT_MOVE_END) DEFINE_EVENT_TYPE(wxEVT_CLOSE_WINDOW) DEFINE_EVENT_TYPE(wxEVT_END_SESSION) DEFINE_EVENT_TYPE(wxEVT_QUERY_END_SESSION) @@ -861,7 +863,7 @@ void wxEventHashTable::Clear() m_size = 0; } -#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING +#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING // Clear all tables void wxEventHashTable::ClearAll() @@ -1037,7 +1039,7 @@ wxEvtHandler::wxEvtHandler() m_eventsLocker = new wxCriticalSection; # endif #endif - + // no client data (yet) m_clientData = NULL; m_clientDataType = wxClientData_None; @@ -1163,7 +1165,7 @@ void wxEvtHandler::ProcessPendingEvents() // pending events wxCHECK_RET( m_pendingEvents, wxT("Please call wxApp::ProcessPendingEvents() instead") ); - + wxENTER_CRIT_SECT( Lock() ); // we leave the loop once we have processed all events that were present at @@ -1506,7 +1508,7 @@ wxEventBlocker::wxEventBlocker(wxWindow *win, wxEventType type) wxEventBlocker::~wxEventBlocker() { wxEvtHandler *popped = m_window->PopEventHandler(false); - wxCHECK_RET(popped == this, + wxCHECK_RET(popped == this, wxT("Don't push other event handlers into a window managed by wxEventBlocker!")); } diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 67992184f1..e3531202d3 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -2543,6 +2543,18 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l } break; + case WM_ENTERSIZEMOVE: + { + processed = HandleEnterSizeMove(); + } + break; + + case WM_EXITSIZEMOVE: + { + processed = HandleExitSizeMove(); + } + break; + case WM_SIZING: { LPRECT pRect = (LPRECT)lParam; @@ -4563,6 +4575,24 @@ bool wxWindowMSW::HandleMoving(wxRect& rect) return rc; } +bool wxWindowMSW::HandleEnterSizeMove() +{ + wxMoveEvent event(wxPoint(), m_windowId); + event.SetEventType(wxEVT_MOVE_START); + event.SetEventObject(this); + + return GetEventHandler()->ProcessEvent(event); +} + +bool wxWindowMSW::HandleExitSizeMove() +{ + wxMoveEvent event(wxPoint(), m_windowId); + event.SetEventType(wxEVT_MOVE_END); + event.SetEventObject(this); + + return GetEventHandler()->ProcessEvent(event); +} + bool wxWindowMSW::HandleSize(int WXUNUSED(w), int WXUNUSED(h), WXUINT wParam) { #if USE_DEFERRED_SIZING -- 2.45.2