From 6615c06d3102dabe9e400755f17f22240030a922 Mon Sep 17 00:00:00 2001 From: Andreas Falkenhahn Date: Tue, 22 Nov 2016 02:31:11 +0100 Subject: [PATCH] Respect alignment in wxOSX wxTextCtrl::SetStyle() Honour the alignment specified in the style, if any. Closes #17529. --- src/osx/cocoa/textctrl.mm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/osx/cocoa/textctrl.mm b/src/osx/cocoa/textctrl.mm index 418d0f7c64..8180421885 100644 --- a/src/osx/cocoa/textctrl.mm +++ b/src/osx/cocoa/textctrl.mm @@ -862,6 +862,22 @@ void wxNSTextViewControl::SetStyle(long start, if ( style.HasTextColour() ) [storage addAttribute:NSForegroundColorAttributeName value:style.GetTextColour().OSXGetNSColor() range:range]; } + + if ( style.HasAlignment() ) + { + switch ( style.GetAlignment() ) + { + case wxTEXT_ALIGNMENT_RIGHT: + [m_textView setAlignment:NSRightTextAlignment]; + break; + case wxTEXT_ALIGNMENT_CENTER: + [m_textView setAlignment:NSCenterTextAlignment]; + break; + default: + [m_textView setAlignment:NSLeftTextAlignment]; + break; + } + } } void wxNSTextViewControl::CheckSpelling(bool check)