X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9f8062a0e436173152575757b9bc7deef2a28e46..f8d0234d39c66f3d1d7fc2346562cb96c8c7be20:/src/osx/carbon/textctrl.cpp?ds=sidebyside diff --git a/src/osx/carbon/textctrl.cpp b/src/osx/carbon/textctrl.cpp index b30b691016..1949980f8f 100644 --- a/src/osx/carbon/textctrl.cpp +++ b/src/osx/carbon/textctrl.cpp @@ -144,7 +144,7 @@ void* wxMacMPRemoteGUICall( classtype *object , void (classtype::*function)( con class WXDLLEXPORT wxMacPortSaver { - DECLARE_NO_COPY_CLASS(wxMacPortSaver) + wxDECLARE_NO_COPY_CLASS(wxMacPortSaver); public: wxMacPortSaver( GrafPtr port ); @@ -160,7 +160,7 @@ private : class WXDLLEXPORT wxMacWindowClipper : public wxMacPortSaver { - DECLARE_NO_COPY_CLASS(wxMacWindowClipper) + wxDECLARE_NO_COPY_CLASS(wxMacWindowClipper); public: wxMacWindowClipper( const wxWindow* win ); @@ -509,11 +509,12 @@ void wxMacUnicodeTextControl::InstallEventHandlers() { ::InstallControlEventHandler( m_controlRef , GetwxMacUnicodeTextControlEventHandlerUPP(), GetEventTypeCount(unicodeTextControlEventList), unicodeTextControlEventList, this, - NULL); + (EventHandlerRef*) &m_macTextCtrlEventHandler); } wxMacUnicodeTextControl::~wxMacUnicodeTextControl() { + ::RemoveEventHandler((EventHandlerRef) m_macTextCtrlEventHandler); } void wxMacUnicodeTextControl::VisibilityChanged(bool shown) @@ -950,7 +951,7 @@ void wxMacMLTEControl::SetBackgroundColour(const wxColour& col ) static inline int wxConvertToTXN(int x) { - return wx_static_cast(int, x / 254.0 * 72 + 0.5); + return static_cast(x / 254.0 * 72 + 0.5); } void wxMacMLTEControl::TXNSetAttribute( const wxTextAttr& style , long from , long to ) @@ -1062,7 +1063,8 @@ void wxMacMLTEControl::TXNSetAttribute( const wxTextAttr& style , long from , lo if ( typeAttrCount > 0 ) { verify_noerr( TXNSetTypeAttributes( m_txn , typeAttrCount, typeAttr, from , to ) ); - relayout = true; + if (from != to) + relayout = true; } if ( tabs != NULL ) @@ -1370,8 +1372,10 @@ void wxMacMLTEControl::SetTXNData( const wxString& st, TXNOffset start, TXNOffse #else wxMBConvUTF16 converter ; ByteCount byteBufferLen = converter.WC2MB( NULL, st.wc_str(), 0 ) ; - UniChar *unibuf = (UniChar*)malloc( byteBufferLen ) ; - converter.WC2MB( (char*)unibuf, st.wc_str(), byteBufferLen ) ; + wxASSERT_MSG( byteBufferLen != wxCONV_FAILED, + _T("Conversion to UTF-16 unexpectedly failed") ); + UniChar *unibuf = (UniChar*)malloc( byteBufferLen + 2 ) ; // 2 for NUL in UTF-16 + converter.WC2MB( (char*)unibuf, st.wc_str(), byteBufferLen + 2 ) ; TXNSetData( m_txn, kTXNUnicodeTextData, (void*)unibuf, byteBufferLen, start, end ) ; free( unibuf ) ; #endif @@ -1906,6 +1910,7 @@ wxMacMLTEClassicControl::wxMacMLTEClassicControl( wxTextCtrl *wxPeer, MAC_WXHWND(wxPeer->GetParent()->MacGetTopLevelWindowRef()), &bounds, featureSet, &m_controlRef ); verify_noerr( err ); + SetControlReference( m_controlRef , (URefCon) wxPeer ); DoCreate(); @@ -2226,7 +2231,7 @@ wxMacMLTEHIViewControl::wxMacMLTEHIViewControl( wxTextCtrl *wxPeer, { HIViewAddSubview( m_scrollView , m_textView ) ; m_controlRef = m_scrollView ; - wxMacControl::MacInstallEventHandler( m_textView, wxPeer ) ; + InstallEventHandler( (WXWidget) m_textView ) ; } else {