Fix determining the length of the text in wxTextEntry/wxTextCtrl (wxGTK)

Several functions of wxTextEntry and wxTextCtrl call to
gtk_entry_get_text_length() API to determine the length of the text in
GTKEntry. This API is available since GTK+ 2.14 so we have to implement
a fallback method for older GTK+ versions.
Dedicated function GTKGetEntryTextLength() is implemented in wxTextEntry
and exposed through its interface because it is also used in wxTextCtrl.
This commit is contained in:
Artur Wieczorek
2017-07-31 21:36:02 +02:00
parent 5b679bfbec
commit 8317bc2844
3 changed files with 29 additions and 4 deletions

View File

@@ -1204,7 +1204,7 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
}
else // single line control
{
if (pos <= gtk_entry_get_text_length(GTK_ENTRY(m_text)))
if (pos <= GTKGetEntryTextLength(GTK_ENTRY(m_text)))
{
if ( y )
*y = 0;
@@ -1225,7 +1225,8 @@ long wxTextCtrl::XYToPosition(long x, long y ) const
{
if ( IsSingleLine() )
{
if ( y != 0 || x >= gtk_entry_get_text_length(GTK_ENTRY(m_text)) )
if ( y != 0 || x >= GTKGetEntryTextLength(GTK_ENTRY(m_text)) )
return -1;
return x;