+ // any class wishing to process wxWidgets events must use this macro
+ DECLARE_EVENT_TABLE()
+ DECLARE_WIDGETS_PAGE(TextWidgetsPage)
+};
+
+// ----------------------------------------------------------------------------
+// WidgetsTextCtrl
+// ----------------------------------------------------------------------------
+
+class WidgetsTextCtrl : public wxTextCtrl
+{
+public:
+ WidgetsTextCtrl(wxWindow *parent,
+ wxWindowID id,
+ const wxString& value,
+ int flags)
+ : wxTextCtrl(parent, id, value, wxDefaultPosition, wxDefaultSize, flags)
+ {
+ }
+
+protected:
+ void OnRightClick(wxMouseEvent& event)
+ {
+ wxString where;
+ wxTextCoord x, y;
+ switch ( HitTest(event.GetPosition(), &x, &y) )
+ {
+ default:
+ wxFAIL_MSG( wxT("unexpected HitTest() result") );
+ // fall through
+
+ case wxTE_HT_UNKNOWN:
+ x = y = -1;
+ where = wxT("nowhere near");
+ break;
+
+ case wxTE_HT_BEFORE:
+ where = wxT("before");
+ break;
+
+ case wxTE_HT_BELOW:
+ where = wxT("below");
+ break;
+
+ case wxTE_HT_BEYOND:
+ where = wxT("beyond");
+ break;
+
+ case wxTE_HT_ON_TEXT:
+ where = wxT("at");
+ break;
+ }
+
+ wxLogMessage(wxT("Mouse is %s (%ld, %ld)"), where.c_str(), x, y);
+
+ event.Skip();
+ }