wxOSX: Rewiring GetBestSize for single line text control again
see #22374
This commit is contained in:
@@ -85,6 +85,9 @@ public :
|
||||
virtual bool GetNewLineReplacement() wxOVERRIDE;
|
||||
virtual void SetInternalSelection( long from , long to );
|
||||
virtual void UpdateInternalSelectionFromEditor( wxNSTextFieldEditor* editor);
|
||||
|
||||
virtual wxSize GetBestSize() const wxOVERRIDE;
|
||||
|
||||
protected :
|
||||
NSTextField* m_textField;
|
||||
long m_selStart;
|
||||
|
||||
@@ -1713,6 +1713,22 @@ void wxNSTextFieldControl::SetJustification()
|
||||
[m_textField setAlignment:align];
|
||||
}
|
||||
|
||||
wxSize wxNSTextFieldControl::GetBestSize() const
|
||||
{
|
||||
wxSize sz = wxDefaultSize;
|
||||
if ( [m_textField respondsToSelector:@selector(sizeToFit)] )
|
||||
{
|
||||
NSRect former = [m_textField frame];
|
||||
[m_textField sizeToFit];
|
||||
NSRect best = [m_textField frame];
|
||||
[m_textField setFrame:former];
|
||||
sz.x = (int)ceil(best.size.width);
|
||||
sz.y = (int)ceil(best.size.height);
|
||||
}
|
||||
|
||||
return sz;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user