wxGTK:
+- wxGTK uses GTK+ 2.x by default now, you have to pass --disable-gtk2 to
+ configure if you want to use GTK+ 1.2
- fixed many rendering artifacts and wrong colours with lots of GTK+ themes
- implemented wxColourDialog as native dialog
+- implemented wxTextCtrl::HitTest() (GTK+ >= 2)
- wxTreeCtrl::GetCount() counts root as well now (compatible with MSW)
- added support for wxCHK_3STATE style (GTK2 only)
- implemented text underlining under GTK2
- implemented wxFRAME_NO_TASKBAR style (GTK >= 2.2)
- implemented support for wxSYS_DCLICK_?, wxSYS_DRAG_? and wxSYS_CURSOR_?
in wxSystemSettings::GetMetric (Mart Raudsepp)
-- wxGTK uses GTK+ 2.x by default now, you have to pass --disable-gtk2 to
- configure if you want to use GTK+ 1.2
- implemented wxTopLevel::IsMaximized() for GTK+2 and WMs that implement
freedesktop.org's wm-spec (Mart Raudsepp)
of the character closest to this position are returned in the \arg{col} and
\arg{row} parameters (unless the pointers are {\tt NULL} which is allowed).
-Please note that this function is currently only implemented in wxUniv and
-wxMSW ports.
+Please note that this function is currently only implemented in wxUniv,
+wxMSW and wxGTK2 ports.
\wxheading{See also}
//
// NB: pt is in device coords (not adjusted for the client area origin nor
// scrolling)
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const;
virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
wxTextCoord *col,
wxTextCoord *row) const;
void RemoveSelection();
wxString GetSelectionText() const;
+ virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const;
virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
wxTextCoord *col,
wxTextCoord *row) const;
msg = GetMouseEventDesc(ev);
}
- msg << _T(" at (") << ev.GetX() << _T(", ") << ev.GetY() << _T(") ")
- << _T("Flags: ")
+ msg << _T(" at (") << ev.GetX() << _T(", ") << ev.GetY() << _T(") ");
+
+ long pos;
+ wxTextCtrlHitTestResult rc = HitTest(ev.GetPosition(), &pos);
+ if ( rc != wxTE_HT_UNKNOWN )
+ {
+ msg << _T("at position ") << pos;
+ }
+
+ msg << _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') );
+ << GetChar( ev.MetaDown(), _T('M') )
+ << _T(']');
wxLogMessage(msg);
}
// hit testing
// ----------------------------------------------------------------------------
+wxTextCtrlHitTestResult
+wxTextCtrlBase::HitTest(const wxPoint& pt, wxTextCoord *x, wxTextCoord *y) const
+{
+ // implement in terms of the other overload as the native ports typically
+ // can get the position and not (x, y) pair directly (although wxUniv
+ // directly gets x and y -- and so overrides this method as well)
+ long pos;
+ wxTextCtrlHitTestResult rc = HitTest(pt, &pos);
+
+ if ( rc != wxTE_HT_UNKNOWN )
+ {
+ PositionToXY(pos, x, y);
+ }
+
+ return rc;
+}
+
wxTextCtrlHitTestResult
wxTextCtrlBase::HitTest(const wxPoint& WXUNUSED(pt),
- wxTextCoord * WXUNUSED(col),
- wxTextCoord * WXUNUSED(row)) const
+ long * WXUNUSED(pos)) const
{
// not implemented
return wxTE_HT_UNKNOWN;
}
}
+#ifdef __WXGTK20__
+
+wxTextCtrlHitTestResult
+wxTextCtrl::HitTest(const wxPoint& pt, long *pos) const
+{
+ if ( !IsMultiLine() )
+ {
+ // not supported
+ return wxTE_HT_UNKNOWN;
+ }
+
+ int x, y;
+ gtk_text_view_window_to_buffer_coords
+ (
+ GTK_TEXT_VIEW(m_text),
+ GTK_TEXT_WINDOW_TEXT,
+ pt.x, pt.y,
+ &x, &y
+ );
+
+ GtkTextIter iter;
+ gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(m_text), &iter, x, y);
+ if ( pos )
+ *pos = gtk_text_iter_get_offset(&iter);
+
+ return wxTE_HT_ON_TEXT;
+}
+
+#endif // __WXGTK20__
+
long wxTextCtrl::GetInsertionPoint() const
{
wxCHECK_MSG( m_text != NULL, 0, wxT("invalid text ctrl") );
}
}
+#ifdef __WXGTK20__
+
+wxTextCtrlHitTestResult
+wxTextCtrl::HitTest(const wxPoint& pt, long *pos) const
+{
+ if ( !IsMultiLine() )
+ {
+ // not supported
+ return wxTE_HT_UNKNOWN;
+ }
+
+ int x, y;
+ gtk_text_view_window_to_buffer_coords
+ (
+ GTK_TEXT_VIEW(m_text),
+ GTK_TEXT_WINDOW_TEXT,
+ pt.x, pt.y,
+ &x, &y
+ );
+
+ GtkTextIter iter;
+ gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(m_text), &iter, x, y);
+ if ( pos )
+ *pos = gtk_text_iter_get_offset(&iter);
+
+ return wxTE_HT_ON_TEXT;
+}
+
+#endif // __WXGTK20__
+
long wxTextCtrl::GetInsertionPoint() const
{
wxCHECK_MSG( m_text != NULL, 0, wxT("invalid text ctrl") );
return res;
}
+wxTextCtrlHitTestResult wxTextCtrl::HitTest(const wxPoint& pt, long *pos) const
+{
+ wxTextCoord x, y;
+ wxTextCtrlHitTestResult rc = HitTest(pt, &x, &y);
+ if ( rc != wxTE_HT_UNKNOWN && pos )
+ {
+ *pos = XYToPosition(x, y);
+ }
+
+ return rc;
+}
+
wxTextCtrlHitTestResult wxTextCtrl::HitTest(const wxPoint& pos,
wxTextCoord *colOut,
wxTextCoord *rowOut) const