Implement XYToPosition() for single-line wxTextCtrl (wxGTK)

This commit is contained in:
Artur Wieczorek
2017-07-29 22:02:58 +02:00
parent bb9c7680ab
commit f208cfc886
2 changed files with 7 additions and 1 deletions

View File

@@ -162,6 +162,7 @@ wxGTK:
- Fix wxMemoryDC::Blit() with itself as source (GTK+ 3). - Fix wxMemoryDC::Blit() with itself as source (GTK+ 3).
- Fix displaying labels of wxRadioBox items. - Fix displaying labels of wxRadioBox items.
- Add a native implementation for clearing bitmap/window wxGraphicsContexts - Add a native implementation for clearing bitmap/window wxGraphicsContexts
- Implement XYToPosition() for single-line wxTextCtrl.
wxMSW: wxMSW:

View File

@@ -1224,7 +1224,12 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
long wxTextCtrl::XYToPosition(long x, long y ) const long wxTextCtrl::XYToPosition(long x, long y ) const
{ {
if ( IsSingleLine() ) if ( IsSingleLine() )
return 0; {
if ( y != 0 || x >= gtk_entry_get_text_length(GTK_ENTRY(m_text)) )
return -1;
return x;
}
GtkTextIter iter; GtkTextIter iter;
if (y >= gtk_text_buffer_get_line_count (m_buffer)) if (y >= gtk_text_buffer_get_line_count (m_buffer))