+}
+
+void MyTextCtrl::OnMouseEvent(wxMouseEvent& ev)
+{
+ if ( !ev.Moving() )
+ {
+ wxString msg;
+ if ( ev.Entering() )
+ {
+ msg = _T("Mouse entered the window");
+ }
+ else if ( ev.Leaving() )
+ {
+ msg = _T("Mouse left the window");
+ }
+ else
+ {
+ // click event
+ wxString button;
+ bool dbl, up;
+ if ( ev.LeftDown() || ev.LeftUp() || ev.LeftDClick() )
+ {
+ button = _T("Left");
+ dbl = ev.LeftDClick();
+ up = ev.LeftUp();
+ }
+ else if ( ev.MiddleDown() || ev.MiddleUp() || ev.MiddleDClick() )
+ {
+ button = _T("Middle");
+ dbl = ev.MiddleDClick();
+ up = ev.MiddleUp();
+ }
+ else if ( ev.RightDown() || ev.RightUp() || ev.RightDClick() )
+ {
+ button = _T("Right");
+ dbl = ev.RightDClick();
+ up = ev.RightUp();
+ }
+ else
+ {
+ wxLogStatus(_T("Unknown mouse event"));
+ return;
+ }
+
+ msg.Printf(_T("%s mouse button %s"),
+ button.c_str(),
+ dbl ? _T("double clicked")
+ : up ? _T("released") : _T("clicked"));
+ }
+
+ msg << _T(" at (") << ev.GetX() << _T(", ") << ev.GetY() << _T(") ")
+ << _T("Flags: ")
+ << GetChar( ev.LeftIsDown(), _T('1') )
+ << GetChar( ev.MiddleIsDown(), _T('2') )
+ << GetChar( ev.RightIsDown(), _T('3') )
+ << GetChar( ev.ControlDown(), _T('C') )
+ << GetChar( ev.AltDown(), _T('A') )
+ << GetChar( ev.ShiftDown(), _T('S') )
+ << GetChar( ev.MetaDown(), _T('M') );
+
+ wxLogMessage(msg);
+ }
+ //else: we're not interested in mouse move events