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

Just use -[NSTextView setAlignment].

Closes #13702.

(cherry picked from commit d45ba8ce62)
This commit is contained in:
Andreas Falkenhahn
2015-10-22 00:06:45 +02:00
committed by Dimitri Schoolwerth
parent 66ac3e863f
commit 49d52abb4e
3 changed files with 13 additions and 3 deletions

View File

@@ -662,6 +662,7 @@ wxOSX:
- Fix custom paper support (tijsv). - Fix custom paper support (tijsv).
- Return false from wxSound::Create()/IsOk() if the file doesn't exist. - Return false from wxSound::Create()/IsOk() if the file doesn't exist.
- Fix scrolling behaviour of wxSearchCtrl (John Roberts). - Fix scrolling behaviour of wxSearchCtrl (John Roberts).
- Add wxTE_{RIGHT,CENTER} support for multiline wxTextCtrl (Andreas Falkenhahn).
3.0.2: (released 2014-10-06) 3.0.2: (released 2014-10-06)

View File

@@ -62,7 +62,7 @@ private:
class wxNSTextViewControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl class wxNSTextViewControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl
{ {
public: public:
wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w ); wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w, long style );
virtual ~wxNSTextViewControl(); virtual ~wxNSTextViewControl();
virtual wxString GetStringValue() const ; virtual wxString GetStringValue() const ;

View File

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