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
This commit is contained in:
Julian Smart
2007-08-01 15:34:48 +00:00
parent 900af4701c
commit aa767a4521
5 changed files with 54 additions and 12 deletions

View File

@@ -24,6 +24,10 @@ function that takes a wxMoveEvent argument.
\begin{twocollist}\itemsep=0pt \begin{twocollist}\itemsep=0pt
\twocolitem{{\bf EVT\_MOVE(func)}}{Process a wxEVT\_MOVE event, which is generated \twocolitem{{\bf EVT\_MOVE(func)}}{Process a wxEVT\_MOVE event, which is generated
when a window is moved.} 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} \end{twocollist}
\wxheading{See also} \wxheading{See also}

View File

@@ -275,13 +275,15 @@ BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 440) DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 440)
DECLARE_EVENT_TYPE(wxEVT_SIZING, 441) DECLARE_EVENT_TYPE(wxEVT_SIZING, 441)
DECLARE_EVENT_TYPE(wxEVT_MOVING, 442) 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 // more power events follow -- see wx/power.h
// Clipboard events // Clipboard events
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_COPY, 444) DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_COPY, 446)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_CUT, 445) DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_CUT, 447)
DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_PASTE, 446) DECLARE_EVENT_TYPE(wxEVT_COMMAND_TEXT_PASTE, 448)
// Generic command events // Generic command events
// Note: a click is a higher-level event than button down/up // 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 // Returns the configured number of lines (or whatever) to be scrolled per
// wheel action. Defaults to one. // wheel action. Defaults to one.
int GetLinesPerAction() const { return m_linesPerAction; } int GetLinesPerAction() const { return m_linesPerAction; }
// Is the system set to do page scrolling? // Is the system set to do page scrolling?
bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); } bool IsPageScroll() const { return ((unsigned int)m_linesPerAction == UINT_MAX); }
@@ -847,7 +849,7 @@ public:
bool m_shiftDown; bool m_shiftDown;
bool m_altDown; bool m_altDown;
bool m_metaDown; bool m_metaDown;
int m_wheelAxis; int m_wheelAxis;
int m_wheelRotation; int m_wheelRotation;
int m_wheelDelta; int m_wheelDelta;
@@ -2304,7 +2306,7 @@ public:
// Clear table // Clear table
void Clear(); void Clear();
#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING #if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING
// Clear all tables // Clear all tables
static void ClearAll(); static void ClearAll();
#endif // __WXDEBUG__ && wxUSE_MEMORY_TRACING #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_SIZING(func) wx__DECLARE_EVT0(wxEVT_SIZING, wxSizeEventHandler(func))
#define EVT_MOVE(func) wx__DECLARE_EVT0(wxEVT_MOVE, wxMoveEventHandler(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_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_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_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)) #define EVT_QUERY_END_SESSION(func) wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func))

View File

@@ -317,6 +317,8 @@ public:
bool HandleSize(int x, int y, WXUINT flag); bool HandleSize(int x, int y, WXUINT flag);
bool HandleSizing(wxRect& rect); bool HandleSizing(wxRect& rect);
bool HandleGetMinMaxInfo(void *mmInfo); bool HandleGetMinMaxInfo(void *mmInfo);
bool HandleEnterSizeMove();
bool HandleExitSizeMove();
bool HandleShow(bool show, int status); bool HandleShow(bool show, int status);
bool HandleActivate(int flag, bool minimized, WXHWND activate); bool HandleActivate(int flag, bool minimized, WXHWND activate);

View File

@@ -113,7 +113,7 @@ const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] =
// the memory leaks when using it, however this breaks re-initializing the // the memory leaks when using it, however this breaks re-initializing the
// library (i.e. repeated calls to wxInitialize/wxUninitialize) because 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 // 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 class wxEventTableEntryModule: public wxModule
{ {
@@ -257,6 +257,8 @@ DEFINE_EVENT_TYPE(wxEVT_SIZE)
DEFINE_EVENT_TYPE(wxEVT_SIZING) DEFINE_EVENT_TYPE(wxEVT_SIZING)
DEFINE_EVENT_TYPE(wxEVT_MOVE) DEFINE_EVENT_TYPE(wxEVT_MOVE)
DEFINE_EVENT_TYPE(wxEVT_MOVING) 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_CLOSE_WINDOW)
DEFINE_EVENT_TYPE(wxEVT_END_SESSION) DEFINE_EVENT_TYPE(wxEVT_END_SESSION)
DEFINE_EVENT_TYPE(wxEVT_QUERY_END_SESSION) DEFINE_EVENT_TYPE(wxEVT_QUERY_END_SESSION)
@@ -861,7 +863,7 @@ void wxEventHashTable::Clear()
m_size = 0; m_size = 0;
} }
#if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING #if defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING
// Clear all tables // Clear all tables
void wxEventHashTable::ClearAll() void wxEventHashTable::ClearAll()
@@ -1037,7 +1039,7 @@ wxEvtHandler::wxEvtHandler()
m_eventsLocker = new wxCriticalSection; m_eventsLocker = new wxCriticalSection;
# endif # endif
#endif #endif
// no client data (yet) // no client data (yet)
m_clientData = NULL; m_clientData = NULL;
m_clientDataType = wxClientData_None; m_clientDataType = wxClientData_None;
@@ -1163,7 +1165,7 @@ void wxEvtHandler::ProcessPendingEvents()
// pending events // pending events
wxCHECK_RET( m_pendingEvents, wxCHECK_RET( m_pendingEvents,
wxT("Please call wxApp::ProcessPendingEvents() instead") ); wxT("Please call wxApp::ProcessPendingEvents() instead") );
wxENTER_CRIT_SECT( Lock() ); wxENTER_CRIT_SECT( Lock() );
// we leave the loop once we have processed all events that were present at // 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() wxEventBlocker::~wxEventBlocker()
{ {
wxEvtHandler *popped = m_window->PopEventHandler(false); 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!")); wxT("Don't push other event handlers into a window managed by wxEventBlocker!"));
} }

View File

@@ -2543,6 +2543,18 @@ WXLRESULT wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM l
} }
break; break;
case WM_ENTERSIZEMOVE:
{
processed = HandleEnterSizeMove();
}
break;
case WM_EXITSIZEMOVE:
{
processed = HandleExitSizeMove();
}
break;
case WM_SIZING: case WM_SIZING:
{ {
LPRECT pRect = (LPRECT)lParam; LPRECT pRect = (LPRECT)lParam;
@@ -4563,6 +4575,24 @@ bool wxWindowMSW::HandleMoving(wxRect& rect)
return rc; 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) bool wxWindowMSW::HandleSize(int WXUNUSED(w), int WXUNUSED(h), WXUINT wParam)
{ {
#if USE_DEFERRED_SIZING #if USE_DEFERRED_SIZING