Add support for wxTE_CHARWRAP to wxTextCtrl

Apparently various text wrapping modes are not supported natively by
NSTextView (apart from word wrapping which is used by default) and
non-default wrapping has to be implemented in the custom code.
To wrap lines at any character, NSLineBreakByCharWrapping style should be
applied at any text change to the entire text stored in NSTextStorage
associated with NSTextView. This is done in DoUpdateTextStyle() method
which is called from controlTextDidChange() when text is modified by
the user, or SetStringValue() and WriteText() when text is set
programmatically.
This commit is contained in:
Artur Wieczorek
2017-08-05 20:44:15 +02:00
parent 7626292fa4
commit ec55f11ff7
4 changed files with 33 additions and 1 deletions

View File

@@ -124,9 +124,14 @@ public:
virtual wxSize GetBestSize() const wxOVERRIDE;
virtual void controlTextDidChange() wxOVERRIDE;
protected:
void DoUpdateTextStyle();
NSScrollView* m_scrollView;
NSTextView* m_textView;
bool m_useCharWrapping;
};
class wxNSComboBoxControl : public wxNSTextFieldControl, public wxComboWidgetImpl