Optimize wxTextCtrl::GetLastPosition() in wxOSX

To get the length of the text in the control there is no need to convert NSString to wxString (what is done now by calling to GetStringValue).
This commit is contained in:
Artur Wieczorek
2017-08-31 16:28:42 +02:00
parent 2d464ca576
commit 4503c41bd8
2 changed files with 13 additions and 0 deletions

View File

@@ -845,6 +845,12 @@ void wxNSTextViewControl::SetEditable(bool editable)
[m_textView setEditable: editable];
}
long wxNSTextViewControl::GetLastPosition() const
{
wxCHECK( m_textView, 0 );
return [[m_textView string] length];
}
void wxNSTextViewControl::GetSelection( long* from, long* to) const
{
if (m_textView)
@@ -1221,6 +1227,11 @@ void wxNSTextFieldControl::SetEditable(bool editable)
[m_textField setEditable:editable];
}
long wxNSTextFieldControl::GetLastPosition() const
{
return [[m_textField stringValue] length];
}
void wxNSTextFieldControl::GetSelection( long* from, long* to) const
{
NSText* editor = [m_textField currentEditor];