for GTK+, Mac, MGL, X11, Motif ports (Chris Elliott)
- added (platform-dependent) scan code to wxKeyEvent (Bryce Denney)
- added wxTextCtrl::EmulateKeyPress()
+- Added wxMouseCaptureChangedEvent
wxMSW:
- wxWindowDC and wxClientDC::GetSize() works correctly now
- Added wxTB_NODIVIDER and wxTB_NOALIGN so native toolbar can be used in FL
- Multiline labels in buttons are now supoprted (simply use "\n" in the label)
+- Implemented wxMouseCaptureChangedEvent and made wxGenericDragImage check it
+ has the capture before release it.
wxGTK:
\twocolitem{\helpref{wxListEvent}{wxlistevent}}{A list control event}
\twocolitem{\helpref{wxMaximizeEvent}{wxmaximizeevent}}{A maximize event}
\twocolitem{\helpref{wxMenuEvent}{wxmenuevent}}{A menu event}
+\twocolitem{\helpref{wxMouseCaptureChangedEvent}{wxmousecapturechangedevent}}{A mouse capture changed event}
\twocolitem{\helpref{wxMouseEvent}{wxmouseevent}}{A mouse event}
\twocolitem{\helpref{wxMoveEvent}{wxmoveevent}}{A move event}
\twocolitem{\helpref{wxNotebookEvent}{wxnotebookevent}}{A notebook control event}
\input mimetype.tex
\input minifram.tex
\input module.tex
+\input mcaptevt.tex
\input mouseevt.tex
\input moveevt.tex
\input mltchdlg.tex
--- /dev/null
+\section{\class{wxMouseCaptureChangedEvent}}\label{wxmousecapturechangedevent}
+
+An mouse capture changed event is sent to a window that loses its
+mouse capture. This is called even if wxWindow::ReleaseCapture
+was called by the application code. Handling this event allows
+an application to cater for unexpected capture releases which
+might otherwise confuse mouse handling code.
+
+This event is implemented under Windows only.
+
+\wxheading{Derived from}
+
+\helpref{wxEvent}{wxevent}\\
+\helpref{wxObject}{wxobject}
+
+\wxheading{Include files}
+
+<wx/event.h>
+
+\wxheading{Event table macros}
+
+To process this event, use the following event handler macro to direct input to a member
+function that takes a wxMouseCaptureChangedEvent argument.
+
+\twocolwidtha{7cm}
+\begin{twocollist}\itemsep=0pt
+\twocolitem{{\bf EVT\_MOUSE\_CAPTURE\_CHANGED(func)}}{Process a wxEVT\_MOUSE\_CAPTURE\_CHANGED event.}
+\end{twocollist}%
+
+\wxheading{See also}
+
+\helpref{Event handling overview}{eventhandlingoverview},
+\helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse},
+\helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse},
+\helpref{wxWindow::GetCapture}{wxwindowgetcapture}
+
+\latexignore{\rtfignore{\wxheading{Members}}}
+
+\membersection{wxMouseCaptureChangedEvent::wxMouseCaptureChangedEvent}
+
+\func{}{wxMouseCaptureChangedEvent}{\param{wxWindowID }{windowId = 0}, \param{wxWindow*}{ gainedCapture = NULL}}
+
+Constructor.
+
+\membersection{wxActivateEvent::GetCapturedWindow}\label{wxmousecapturechangedeventgetcapturedwindow}
+
+\constfunc{wxWindow*}{GetCapturedWindow}{\void}
+
+Returns the window that gained the capture, or NULL if it was a non-wxWindows window.
+
Returns the \helpref{caret}{wxcaret} associated with the window.
+\membersection{wxWindow::GetCapture}\label{wxwindowgetcapture}
+
+\func{static wxWindow *}{GetCapture}{\void}
+
+Returns the currently captured window.
+
+\wxheading{See also}
+
+\helpref{wxWindow::HasCapture}{wxwindowhascapture},
+\helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse},
+\helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse},
+\helpref{wxMouseCaptureChangedEvent}{wxmousecapturechangedevent}
+
\membersection{wxWindow::GetCharHeight}
\constfunc{virtual int}{GetCharHeight}{\void}
Gets the window style that was passed to the constructor or {\bf Create}
method. {\bf GetWindowStyle()} is another name for the same function.
+\membersection{wxWindow::HasCapture}\label{wxwindowhascapture}
+
+\constfunc{virtual bool}{HasCapture}{\void}
+
+Returns TRUE if this window has the current mouse capture.
+
+\wxheading{See also}
+
+\helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse},
+\helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse},
+\helpref{wxMouseCaptureChangedEvent}{wxmousecapturechangedevent}
+
\membersection{wxWindow::Hide}\label{wxwindowhide}
\func{bool}{Hide}{\void}
\wxheading{See also}
-\helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse}
+\helpref{wxWindow::CaptureMouse}{wxwindowcapturemouse},
+\helpref{wxWindow::HasCapture}{wxwindowhascapture},
+\helpref{wxWindow::ReleaseMouse}{wxwindowreleasemouse},
+\helpref{wxMouseCaptureChangedEvent}{wxmousecapturechangedevent}
\membersection{wxWindow::RemoveChild}\label{wxwindowremovechild}
DECLARE_DYNAMIC_CLASS(wxSysColourChangedEvent)
};
+/*
+ wxEVT_MOUSE_CAPTURE_CHANGED
+ The window losing the capture receives this message
+ (even if it released the capture itself).
+ */
+
+class WXDLLEXPORT wxMouseCaptureChangedEvent : public wxEvent
+{
+public:
+ wxMouseCaptureChangedEvent(wxWindowID id = 0, wxWindow* gainedCapture = NULL): wxEvent(id)
+ { m_eventType = wxEVT_MOUSE_CAPTURE_CHANGED; m_gainedCapture = gainedCapture; }
+
+ virtual wxEvent *Clone() const { return new wxMouseCaptureChangedEvent(*this); }
+
+ wxWindow* GetCapturedWindow() const { return m_gainedCapture; };
+
+private:
+ wxWindow* m_gainedCapture;
+ DECLARE_DYNAMIC_CLASS(wxMouseCaptureChangedEvent)
+};
+
/*
wxEVT_DISPLAY_CHANGED
*/
typedef void (wxEvtHandler::*wxNotifyEventFunction)(wxNotifyEvent&);
typedef void (wxEvtHandler::*wxHelpEventFunction)(wxHelpEvent&);
typedef void (wxEvtHandler::*wxContextMenuEventFunction)(wxContextMenuEvent&);
+typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureChangedEvent&);
#endif // wxUSE_GUI
// N.B. In GNU-WIN32, you *have* to take the address of a member function
#define EVT_WINDOW_CREATE(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_CREATE, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxWindowCreateEventFunction) & func, (wxObject *) NULL ),
#define EVT_WINDOW_DESTROY(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_DESTROY, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxWindowDestroyEventFunction) & func, (wxObject *) NULL ),
#define EVT_SET_CURSOR(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_SET_CURSOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxSetCursorEventFunction) & func, (wxObject *) NULL ),
+#define EVT_MOUSE_CAPTURE_CHANGED(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MOUSE_CAPTURE_CHANGED, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseCaptureChangedEventFunction) & func, (wxObject *) NULL ),
// Mouse events
#define EVT_LEFT_DOWN(func) DECLARE_EVENT_TABLE_ENTRY( wxEVT_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (wxMouseEventFunction) & func, (wxObject *) NULL ),
bool HandleQueryNewPalette();
bool HandleSysColorChange();
bool HandleDisplayChange();
-
+ bool HandleCaptureChanged(WXHWND gainedCapture);
bool HandleQueryEndSession(long logOff, bool *mayEnd);
bool HandleEndSession(bool endSession, long logOff);
IMPLEMENT_DYNAMIC_CLASS(wxWindowDestroyEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxHelpEvent, wxCommandEvent)
IMPLEMENT_DYNAMIC_CLASS(wxContextMenuEvent, wxCommandEvent)
+ IMPLEMENT_DYNAMIC_CLASS(wxMouseCaptureChangedEvent, wxEvent)
#endif // wxUSE_GUI
const wxEventTable *wxEvtHandler::GetEventTable() const
{
if (m_window)
{
- m_window->ReleaseMouse();
+#ifdef __WXMSW__
+ // Under Windows we can be pretty sure this test will give
+ // the correct results
+ if (wxWindow::GetCapture() == m_window)
+#endif
+ m_window->ReleaseMouse();
+
if (m_cursor.Ok() && m_oldCursor.Ok())
{
m_window->SetCursor(m_oldCursor);
processed = HandlePaletteChanged((WXHWND) (HWND) wParam);
break;
+ case WM_CAPTURECHANGED:
+ processed = HandleCaptureChanged((WXHWND) (HWND) lParam);
+ break;
+
case WM_QUERYNEWPALETTE:
processed = HandleQueryNewPalette();
break;
return GetEventHandler()->ProcessEvent(event);
}
+bool wxWindowMSW::HandleCaptureChanged(WXHWND hWndGainedCapture)
+{
+ wxMouseCaptureChangedEvent event(GetId(), wxFindWinFromHandle(hWndGainedCapture));
+ event.SetEventObject(this);
+
+ return GetEventHandler()->ProcessEvent(event);
+}
+
bool wxWindowMSW::HandleQueryNewPalette()
{