Add wxTE_{RIGHT,CENTER} support for multiline wxTextCtrl in wxOSX

Just use -[NSTextView setAlignment].

Closes #13702.
This commit is contained in:
Andreas Falkenhahn
2015-10-22 00:06:45 +02:00
committed by Vadim Zeitlin
parent 165842423c
commit d45ba8ce62
3 changed files with 13 additions and 3 deletions

View File

@@ -561,7 +561,7 @@ NSView* wxMacEditHelper::ms_viewCurrentlyEdited = nil;
// wxNSTextViewControl
wxNSTextViewControl::wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w )
wxNSTextViewControl::wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w, long style )
: wxWidgetCocoaImpl(wxPeer, w),
wxTextWidgetImpl(wxPeer)
{
@@ -581,6 +581,15 @@ wxNSTextViewControl::wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w )
[tv setHorizontallyResizable:NO];
[tv setAutoresizingMask:NSViewWidthSizable];
if ( style & wxTE_RIGHT)
{
[tv setAlignment:NSRightTextAlignment];
}
else if ( style & wxTE_CENTRE)
{
[tv setAlignment:NSCenterTextAlignment];
}
if ( !wxPeer->HasFlag(wxTE_RICH | wxTE_RICH2) )
{
[tv setRichText:NO];
@@ -1064,7 +1073,7 @@ wxWidgetImplType* wxWidgetImpl::CreateTextControl( wxTextCtrl* wxpeer,
{
wxNSTextScrollView* v = nil;
v = [[wxNSTextScrollView alloc] initWithFrame:r];
c = new wxNSTextViewControl( wxpeer, v );
c = new wxNSTextViewControl( wxpeer, v, style );
c->SetNeedsFocusRect( true );
}
else