X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0263da03711c430dfd7a2452dc9b0239f7081376..4b134bb2ce1cba6a0033bdc553817d45de5b2cf7:/src/mac/carbon/textctrl.cpp?ds=sidebyside diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index 84f87fafc2..7cc3dd0fae 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -2,7 +2,7 @@ // Name: textctrl.cpp // Purpose: wxTextCtrl // Author: Stefan Csomor -// Modified by: +// Modified by: Ryan Norton (MLTE GetLineLength and GetLineText) // Created: 1998-01-01 // RCS-ID: $Id$ // Copyright: (c) Stefan Csomor @@ -55,6 +55,13 @@ #ifndef __DARWIN__ #include #endif + +// if this is set to 1 then under OSX 10.2 the 'classic' MLTE implementation will be used +// if set to 0 then the unicode textctrl will be used +#ifndef wxMAC_AWAYS_USE_MLTE +#define wxMAC_AWAYS_USE_MLTE 1 +#endif + #include #include #include @@ -192,11 +199,11 @@ public : virtual wxString GetStringValue() const ; virtual void SetStringValue( const wxString &str) ; - static int ConvertAttribute( const wxTextAttr& style , TXNTypeAttributes attr[] ) ; static TXNFrameOptions FrameOptionsFromWXStyle( long wxStyle ) ; void AdjustCreationAttributes( const wxColour& background , bool visible ) ; virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle ) ; + virtual void SetBackground( const wxBrush &brush) ; virtual void SetStyle(long start, long end, const wxTextAttr& style) ; virtual void Copy() ; virtual void Cut() ; @@ -226,6 +233,7 @@ public : void SetTXNData( const wxString& st , TXNOffset start , TXNOffset end ) ; protected : + void TXNSetAttribute( const wxTextAttr& style , long from , long to ) ; TXNObject m_txn ; } ; @@ -244,7 +252,7 @@ public : const wxSize& size, long style ) ; virtual OSStatus SetFocus( ControlFocusPart focusPart ) ; virtual bool HasFocus() const ; - virtual bool NeedsFocusRect() const ; + virtual bool NeedsFocusRect() const; protected : HIViewRef m_scrollView ; HIViewRef m_textView ; @@ -277,7 +285,7 @@ protected : OSType m_valueTag ; } ; -#else +#endif // implementation available under classic @@ -292,6 +300,7 @@ public : const wxSize& size, long style ) ; ~wxMacMLTEClassicControl() ; virtual void VisibilityChanged(bool shown) ; + virtual bool NeedsFocusRect() const; protected : OSStatus DoCreate(); public : @@ -299,16 +308,13 @@ public : STPTextPaneVars* m_macTXNvars ; } ; -#endif -// built-in TextCtrl - - #define TE_UNLIMITED_LENGTH 0xFFFFFFFFUL #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl) BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) + EVT_ERASE_BACKGROUND( wxTextCtrl::OnEraseBackground ) EVT_DROP_FILES(wxTextCtrl::OnDropFiles) EVT_CHAR(wxTextCtrl::OnChar) EVT_MENU(wxID_CUT, wxTextCtrl::OnCut) @@ -349,14 +355,12 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, m_macIsUserPane = FALSE ; m_editable = true ; - if ( !HasFlag(wxNO_BORDER) ) - style |= wxSUNKEN_BORDER ; + if ( ! ( style & wxNO_BORDER) ) + style = ( style & ~wxBORDER_MASK) | wxSUNKEN_BORDER ; if ( !wxTextCtrlBase::Create(parent, id, pos, size, style & ~(wxHSCROLL|wxVSCROLL), validator, name) ) return FALSE; - wxSize mySize = size ; - Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ; if ( m_windowStyle & wxTE_MULTILINE ) @@ -367,20 +371,31 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, m_windowStyle |= wxTE_PROCESS_ENTER; style |= wxTE_PROCESS_ENTER ; } + #if TARGET_API_MAC_OSX #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2 if ( UMAGetSystemVersion() >= 0x1030 ) { m_peer = new wxMacMLTEHIViewControl( this , str , pos , size , style ) ; } - else #endif +#if !wxMAC_AWAYS_USE_MLTE + if ( !m_peer ) { m_peer = new wxMacUnicodeTextControl( this , str , pos , size , style ) ; } -#else - m_peer = new wxMacMLTEClassicControl( this , str , pos , size , style ) ; #endif +#endif + if ( !m_peer ) + { + // this control draws the border itself + if ( !HasFlag(wxNO_BORDER) ) + { + m_windowStyle &= ~wxSUNKEN_BORDER ; + bounds = wxMacGetBoundsForControl( this , pos , size ) ; + } + m_peer = new wxMacMLTEClassicControl( this , str , pos , size , style ) ; + } MacPostControlCreate(pos,size) ; @@ -419,6 +434,11 @@ void wxTextCtrl::SetValue(const wxString& str) return ; GetPeer()->SetStringValue(str) ; + + wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId); + event.SetString( GetValue() ) ; + event.SetEventObject( this ); + GetEventHandler()->ProcessEvent(event); } void wxTextCtrl::SetMaxLength(unsigned long len) @@ -464,7 +484,6 @@ void wxTextCtrl::Cut() GetPeer()->Cut() ; wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId); - event.SetString( GetValue() ) ; event.SetEventObject( this ); GetEventHandler()->ProcessEvent(event); } @@ -478,7 +497,6 @@ void wxTextCtrl::Paste() // eventually we should add setting the default style again wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId); - event.SetString( GetValue() ) ; event.SetEventObject( this ); GetEventHandler()->ProcessEvent(event); } @@ -618,30 +636,35 @@ wxSize wxTextCtrl::DoGetBestSize() const int hText; + // these are the numbers from the HIG, we reduce them by the borders + // first + switch( m_windowVariant ) { case wxWINDOW_VARIANT_NORMAL : - hText = 22 ; + hText = 22 - 6 ; break ; case wxWINDOW_VARIANT_SMALL : - hText = 19 ; + hText = 19 - 6 ; break ; case wxWINDOW_VARIANT_MINI : - hText= 15 ; + hText= 15 - 6 ; break ; default : - hText = 22 ; + hText = 22 - 6; break ; } - if ( HasFlag(wxNO_BORDER) ) - hText -= 6 ; - + // as the above numbers have some free space around the text + // we get 5 lines like this anyway if ( m_windowStyle & wxTE_MULTILINE ) { hText *= 5 ; } + if ( !HasFlag(wxNO_BORDER) ) + hText += 6 ; + return wxSize(wText, hText); } @@ -742,6 +765,15 @@ void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event) } } +void wxTextCtrl::OnEraseBackground(wxEraseEvent& event) +{ + // all erasing should be done by the real mac control implementation + // while this is true for MLTE under classic, the HITextView is somehow + // transparent but background erase is not working correctly, so intercept + // things while we can... + event.Skip() ; +} + void wxTextCtrl::OnChar(wxKeyEvent& event) { int key = event.GetKeyCode() ; @@ -763,6 +795,16 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) return ; } + // Check if we have reached the max # of chars, but still allow navigation and deletion + if ( !IsMultiLine() && GetValue().Length() >= m_maxLength && + key != WXK_LEFT && key != WXK_RIGHT && key != WXK_TAB && + key != WXK_BACK && !( key == WXK_RETURN && (m_windowStyle & wxPROCESS_ENTER) ) + ) + { + // eat it, we don't want to add more than allowed # of characters + return; + } + // assume that any key not processed yet is going to modify the control m_dirty = true; @@ -863,7 +905,6 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) key == WXK_BACK) { wxCommandEvent event1(wxEVT_COMMAND_TEXT_UPDATED, m_windowId); - event1.SetString( GetValue() ) ; event1.SetEventObject( this ); wxPostEvent(GetEventHandler(),event1); } @@ -1129,7 +1170,7 @@ wxMacUnicodeTextControl::wxMacUnicodeTextControl( wxWindow *wxPeer, m_windowStyle = style ; Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ; wxString st = str ; - wxMacConvertNewlines13To10( &st ) ; + wxMacConvertNewlines10To13( &st ) ; wxMacCFStringHolder cf(st , m_font.GetEncoding()) ; CFStringRef cfr = cf ; Boolean isPassword = ( m_windowStyle & wxTE_PASSWORD ) != 0 ; @@ -1171,13 +1212,17 @@ wxString wxMacUnicodeTextControl::GetStringValue() const wxMacCFStringHolder cf(value) ; result = cf.AsString() ; } +#if '\n' == 10 + wxMacConvertNewlines13To10( &result ) ; +#else wxMacConvertNewlines10To13( &result ) ; +#endif return result ; } void wxMacUnicodeTextControl::SetStringValue( const wxString &str) { wxString st = str ; - wxMacConvertNewlines13To10( &st ) ; + wxMacConvertNewlines10To13( &st ) ; wxMacCFStringHolder cf(st , m_font.GetEncoding() ) ; verify_noerr( SetData( 0, m_valueTag , cf ) ) ; } @@ -1224,7 +1269,7 @@ void wxMacUnicodeTextControl::SetSelection( long from , long to ) void wxMacUnicodeTextControl::WriteText(const wxString& str) { wxString st = str ; - wxMacConvertNewlines13To10( &st ) ; + wxMacConvertNewlines10To13( &st ) ; #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2 wxMacCFStringHolder cf(st , m_font.GetEncoding() ) ; CFStringRef value = cf ; @@ -1236,7 +1281,7 @@ void wxMacUnicodeTextControl::WriteText(const wxString& str) val.Remove( start , end - start ) ; val.insert( start , str ) ; SetStringValue( val ) ; - SetInsertionPoint( start + str.Length() ) ; + SetSelection( start + str.Length() , start + str.Length() ) ; #endif } @@ -1345,14 +1390,19 @@ wxString wxMacMLTEControl::GetStringValue() const } #endif } +#if '\n' == 10 + wxMacConvertNewlines13To10( &result ) ; +#else wxMacConvertNewlines10To13( &result ) ; +#endif return result ; } void wxMacMLTEControl::SetStringValue( const wxString &str) { wxString st = str ; - wxMacConvertNewlines13To10( &st ) ; + + wxMacConvertNewlines10To13( &st ) ; EditHelper help(m_txn) ; // wxMacWindowClipper c( this ) ; @@ -1447,8 +1497,18 @@ void wxMacMLTEControl::AdjustCreationAttributes( const wxColour &background, boo TXNSetBackground( m_txn , &tback); } -int wxMacMLTEControl::ConvertAttribute( const wxTextAttr& style , TXNTypeAttributes typeAttr[] ) +void wxMacMLTEControl::SetBackground( const wxBrush &brush ) { + // currently only solid background are supported + TXNBackground tback; + tback.bgType = kTXNBackgroundTypeRGB; + tback.bg.color = MAC_WXCOLORREF( brush.GetColour().GetPixel() ); + TXNSetBackground( m_txn , &tback); +} + +void wxMacMLTEControl::TXNSetAttribute( const wxTextAttr& style , long from , long to) +{ + TXNTypeAttributes typeAttr[4] ; Str255 fontName = "\pMonaco" ; SInt16 fontSize = 12 ; Style fontStyle = normal ; @@ -1465,7 +1525,7 @@ int wxMacMLTEControl::ConvertAttribute( const wxTextAttr& style , TXNTypeAttribu fontStyle |= bold ; if ( font.GetStyle() == wxITALIC ) fontStyle |= italic ; - + typeAttr[attrCounter].tag = kTXNQDFontNameAttribute ; typeAttr[attrCounter].size = kTXNQDFontNameAttributeSize ; typeAttr[attrCounter].data.dataPtr = (void*) fontName ; @@ -1476,7 +1536,6 @@ int wxMacMLTEControl::ConvertAttribute( const wxTextAttr& style , TXNTypeAttribu typeAttr[attrCounter+2].size = kTXNQDFontStyleAttributeSize ; typeAttr[attrCounter+2].data.dataValue = fontStyle ; attrCounter += 3 ; - } if ( style.HasTextColour() ) { @@ -1486,29 +1545,21 @@ int wxMacMLTEControl::ConvertAttribute( const wxTextAttr& style , TXNTypeAttribu color = MAC_WXCOLORREF(style.GetTextColour().GetPixel()) ; attrCounter += 1 ; } - return attrCounter ; + if ( attrCounter > 0 ) + { + verify_noerr( TXNSetTypeAttributes ( m_txn , attrCounter , typeAttr, from , to) ); + } } void wxMacMLTEControl::SetFont( const wxFont & font , const wxColour& foreground , long windowStyle ) { EditHelper help(m_txn) ; - wxTextAttr style(wxNullColour,wxNullColour,font) ; - TXNTypeAttributes typeAttr[4] ; - int attrCounter = ConvertAttribute( style , typeAttr ) ; - if ( attrCounter > 0 ) - { - verify_noerr( TXNSetTypeAttributes ( m_txn , attrCounter , typeAttr, kTXNStartOffset,kTXNEndOffset) ); - } + TXNSetAttribute( wxTextAttr(foreground,wxNullColour,font) , kTXNStartOffset,kTXNEndOffset ) ; } void wxMacMLTEControl::SetStyle(long start, long end, const wxTextAttr& style) { EditHelper help(m_txn) ; - TXNTypeAttributes typeAttr[4] ; - int attrCounter = ConvertAttribute( style , typeAttr ) ; - if ( attrCounter > 0 ) - { - verify_noerr( TXNSetTypeAttributes ( m_txn , attrCounter , typeAttr, start,end) ); - } + TXNSetAttribute( style , start,end ) ; } void wxMacMLTEControl::Copy() @@ -1566,13 +1617,13 @@ long wxMacMLTEControl::GetLastPosition() const void wxMacMLTEControl::Replace( long from , long to , const wxString str ) { wxString value = str ; - wxMacConvertNewlines13To10( &value ) ; + wxMacConvertNewlines10To13( &value ) ; EditHelper help( m_txn ) ; TXNSetSelection(m_txn , from , to ) ; TXNClear( m_txn ) ; - SetTXNData( str , kTXNUseCurrentSelection, kTXNUseCurrentSelection ) ; + SetTXNData( value , kTXNUseCurrentSelection, kTXNUseCurrentSelection ) ; } void wxMacMLTEControl::Remove( long from , long to ) @@ -1602,7 +1653,7 @@ void wxMacMLTEControl::WriteText(const wxString& str) { EditHelper helper( m_txn ) ; wxString st = str ; - wxMacConvertNewlines13To10( &st ) ; + wxMacConvertNewlines10To13( &st ) ; long start , end , dummy ; GetSelection( &start , &dummy ) ; @@ -1772,41 +1823,37 @@ void wxMacMLTEControl::SetTXNData( const wxString& st , TXNOffset start , TXNOff wxString wxMacMLTEControl::GetLineText(long lineNo) const { wxString line ; - Point curpt ; - wxString content = GetStringValue() ; if ( lineNo < GetNumberOfLines() ) { - // TODO find a better implementation : while we can get the - // line metrics of a certain line, we don't get its starting - // position, so it would probably be rather a binary search - // for the start position - long xpos = 0 ; long ypos = 0 ; - int lastHeight = 0 ; - long lastpos = GetLastPosition() ; - - ItemCount n ; - for ( n = 0 ; n <= (ItemCount)lastpos ; ++n ) + + Fixed lineWidth, + lineHeight, + currentHeight = 0; + + // get the first possible position in the control + Point firstPoint; + TXNOffsetToPoint(m_txn, 0, &firstPoint); + + // Iterate through the lines until we reach the one we want, + // adding to our current y pixel point position + while (ypos < lineNo) { - TXNOffsetToPoint( m_txn, n , &curpt); - - if ( curpt.v > lastHeight ) - { - if ( ypos == lineNo ) - return line ; + TXNGetLineMetrics(m_txn, ypos++, &lineWidth, &lineHeight); + currentHeight += lineHeight; + } + + Point thePoint = { firstPoint.v + (currentHeight >> 16), firstPoint.h + (0) }; + TXNOffset theOffset; + TXNPointToOffset(m_txn, thePoint, &theOffset); - xpos = 0 ; - if ( n > 0 ) - ++ypos ; - lastHeight = curpt.v ; - } - else - { - if ( ypos == lineNo ) - line += content[n] ; - ++xpos ; - } + wxString content = GetStringValue() ; + Point currentPoint = thePoint; + while(thePoint.v == currentPoint.v && theOffset < content.length()) + { + line += content[theOffset]; + TXNOffsetToPoint(m_txn, ++theOffset, ¤tPoint); } } return line ; @@ -1814,38 +1861,41 @@ wxString wxMacMLTEControl::GetLineText(long lineNo) const int wxMacMLTEControl::GetLineLength(long lineNo) const { - Point curpt ; + int theLength = 0; + if ( lineNo < GetNumberOfLines() ) { - // TODO find a better implementation : while we can get the - // line metrics of a certain line, we don't get its starting - // position, so it would probably be rather a binary search - // for the start position - long xpos = 0 ; long ypos = 0 ; - int lastHeight = 0 ; - long lastpos = GetLastPosition() ; - - ItemCount n ; - for ( n = 0 ; n <= (ItemCount) lastpos ; ++n ) + + Fixed lineWidth, + lineHeight, + currentHeight = 0; + + // get the first possible position in the control + Point firstPoint; + TXNOffsetToPoint(m_txn, 0, &firstPoint); + + // Iterate through the lines until we reach the one we want, + // adding to our current y pixel point position + while (ypos < lineNo) { - TXNOffsetToPoint( m_txn , n , &curpt); - - if ( curpt.v > lastHeight ) - { - if ( ypos == lineNo ) - return xpos ; + TXNGetLineMetrics(m_txn, ypos++, &lineWidth, &lineHeight); + currentHeight += lineHeight; + } + + Point thePoint = { firstPoint.v + (currentHeight >> 16), firstPoint.h + (0) }; + TXNOffset theOffset; + TXNPointToOffset(m_txn, thePoint, &theOffset); - xpos = 0 ; - if ( n > 0 ) - ++ypos ; - lastHeight = curpt.v ; - } - else - ++xpos ; + wxString content = GetStringValue() ; + Point currentPoint = thePoint; + while(thePoint.v == currentPoint.v && theOffset < content.length()) + { + ++theLength; + TXNOffsetToPoint(m_txn, ++theOffset, ¤tPoint); } } - return 0 ; + return theLength ; } @@ -1853,8 +1903,6 @@ int wxMacMLTEControl::GetLineLength(long lineNo) const // MLTE control implementation (classic part) // ---------------------------------------------------------------------------- -#if !TARGET_API_MAC_OSX - // CS:TODO we still have a problem getting properly at the text events of a control because under Carbon // the MLTE engine registers itself for the key events thus the normal flow never occurs, the only measure for the // moment is to avoid setting the true focus on the control, the proper solution at the end would be to have @@ -1945,21 +1993,36 @@ static void TPCalculateBounds(STPTextPaneVars *varsp, const Rect& bounds) OSStatus MLTESetObjectVisibility( STPTextPaneVars *varsp, Boolean vis , long wxStyle) { OSStatus err = noErr ; -#if TARGET_API_MAC_OSX - TXNControlTag iControlTags[1] = { kTXNVisibilityTag }; - TXNControlData iControlData[1] = {{ vis }}; - err = ::TXNSetTXNObjectControls( varsp->fTXNRec, false, 1, iControlTags, iControlData ); -#endif wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(varsp->fUserPaneRec); - if ( vis && textctrl ) + if ( textctrl ) { +#if TARGET_API_MAC_OSX + TXNControlTag iControlTags[1] = { kTXNVisibilityTag }; + TXNControlData iControlData[1] = {{ vis }}; + err = ::TXNSetTXNObjectControls( varsp->fTXNRec, false, 1, iControlTags, iControlData ); +#endif Rect bounds ; UMAGetControlBoundsInWindowCoords( varsp->fUserPaneRec, &bounds); TPCalculateBounds( varsp , bounds ) ; - wxMacWindowClipper cl(textctrl) ; - TXNSetFrameBounds( varsp->fTXNRec, varsp->fRTextArea.top, varsp->fRTextArea.left, - varsp->fRTextArea.bottom, varsp->fRTextArea.right, varsp->fTXNFrame); - TXNShowSelection( varsp->fTXNRec, kTXNShowStart); + if ( vis ) + { + wxMacWindowClipper cl(textctrl) ; + TXNSetFrameBounds( varsp->fTXNRec, varsp->fRTextArea.top, varsp->fRTextArea.left, + varsp->fRTextArea.bottom, varsp->fRTextArea.right, varsp->fTXNFrame); + TXNShowSelection( varsp->fTXNRec, kTXNShowStart); + } + else + { +#if TARGET_API_MAC_OSX + // in 10.2 the scrollbars are still actively redrawn when using only the code above + if ( UMAGetSystemVersion() < 0x1030 ) + { + TXNSetFrameBounds( varsp->fTXNRec, varsp->fRTextArea.top + 20000 , varsp->fRTextArea.left + 20000 , + varsp->fRTextArea.bottom + 20000 , varsp->fRTextArea.right + 20000 , varsp->fTXNFrame); + + } +#endif + } } return err ; } @@ -2017,7 +2080,7 @@ static void TPRedrawFocusOutline(STPTextPaneVars *varsp) { if (varsp->fFocusDrawState != (varsp->fIsActive && varsp->fInFocus)) { varsp->fFocusDrawState = (varsp->fIsActive && varsp->fInFocus); - DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fFocusDrawState); + // DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fFocusDrawState); } } @@ -2071,7 +2134,20 @@ static pascal ControlPartCode TPPaneHitTestProc(ControlRef theControl, Point whe if (PtInRect(where, &varsp->fRBounds)) result = kmUPTextPart; else - result = 0; + { + // sometimes we get the coords also in control local coordinates, therefore test again + if ( textctrl->MacGetTopLevelWindow()->MacUsesCompositing() ) + { + int x = 0 , y = 0 ; + textctrl->MacClientToRootWindow( &x , &y ) ; + where.h += x ; + where.v += y ; + } + if (PtInRect(where, &varsp->fRBounds)) + result = kmUPTextPart; + else + result = 0; + } } return result; } @@ -2301,9 +2377,7 @@ wxMacMLTEClassicControl::wxMacMLTEClassicControl( wxWindow *wxPeer, m_windowStyle = style ; Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ; wxString st = str ; - wxMacConvertNewlines13To10( &st ) ; - - wxMacConvertNewlines13To10( &st ) ; + wxMacConvertNewlines10To13( &st ) ; short featurSet; @@ -2350,6 +2424,11 @@ void wxMacMLTEClassicControl::VisibilityChanged(bool shown) InvalWindowRect( GetControlOwner( m_controlRef ) , &((STPTextPaneVars *)m_macTXNvars)->fRBounds ) ; } +bool wxMacMLTEClassicControl::NeedsFocusRect() const +{ + return true; +} + OSStatus wxMacMLTEClassicControl::DoCreate() { Rect bounds; @@ -2419,15 +2498,14 @@ OSStatus wxMacMLTEClassicControl::DoCreate() return err; } - -#endif - // ---------------------------------------------------------------------------- // MLTE control implementation (OSX part) // ---------------------------------------------------------------------------- #if TARGET_API_MAC_OSX +#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2 + wxMacMLTEHIViewControl::wxMacMLTEHIViewControl( wxWindow *wxPeer, const wxString& str, const wxPoint& pos, @@ -2437,7 +2515,7 @@ wxMacMLTEHIViewControl::wxMacMLTEHIViewControl( wxWindow *wxPeer, m_windowStyle = style ; Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ; wxString st = str ; - wxMacConvertNewlines13To10( &st ) ; + wxMacConvertNewlines10To13( &st ) ; HIRect hr = { bounds.left , bounds.top , bounds.right - bounds.left , bounds.bottom- bounds.top } ; @@ -2492,9 +2570,12 @@ bool wxMacMLTEHIViewControl::HasFocus() const bool wxMacMLTEHIViewControl::NeedsFocusRect() const { - return true ; + return m_windowStyle & wxNO_BORDER ? false : true; } +#endif // MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2 + + #endif #endif // wxUSE_TEXTCTRL