class WXDLLEXPORT wxMacPortSaver
{
- DECLARE_NO_COPY_CLASS(wxMacPortSaver)
+ wxDECLARE_NO_COPY_CLASS(wxMacPortSaver);
public:
wxMacPortSaver( GrafPtr port );
class WXDLLEXPORT wxMacWindowClipper : public wxMacPortSaver
{
- DECLARE_NO_COPY_CLASS(wxMacWindowClipper)
+ wxDECLARE_NO_COPY_CLASS(wxMacWindowClipper);
public:
wxMacWindowClipper( const wxWindow* win );
public :
wxMacMLTEControl( wxTextCtrl *peer ) ;
~wxMacMLTEControl() {}
+
+ virtual bool CanFocus() const
+ { return true; }
+
virtual wxString GetStringValue() const ;
virtual void SetStringValue( const wxString &str ) ;
virtual void Paste() ;
virtual bool CanPaste() const ;
virtual void SetEditable( bool editable ) ;
- virtual wxTextPos GetLastPosition() const ;
+ virtual long GetLastPosition() const ;
virtual void Replace( long from, long to, const wxString &str ) ;
virtual void Remove( long from, long to ) ;
virtual void GetSelection( long* from, long* to ) const ;
const wxSize& size, long style ) ;
virtual ~wxMacMLTEHIViewControl() ;
- virtual OSStatus SetFocus( ControlFocusPart focusPart ) ;
+ virtual bool SetFocus() ;
virtual bool HasFocus() const ;
virtual void SetBackgroundColour(const wxColour& col ) ;
{
::InstallControlEventHandler( m_controlRef , GetwxMacUnicodeTextControlEventHandlerUPP(),
GetEventTypeCount(unicodeTextControlEventList), unicodeTextControlEventList, this,
- NULL);
+ (EventHandlerRef*) &m_macTextCtrlEventHandler);
}
wxMacUnicodeTextControl::~wxMacUnicodeTextControl()
{
+ ::RemoveEventHandler((EventHandlerRef) m_macTextCtrlEventHandler);
}
void wxMacUnicodeTextControl::VisibilityChanged(bool shown)
static inline int wxConvertToTXN(int x)
{
- return wx_static_cast(int, x / 254.0 * 72 + 0.5);
+ return static_cast<int>(x / 254.0 * 72 + 0.5);
}
void wxMacMLTEControl::TXNSetAttribute( const wxTextAttr& style , long from , long to )
if ( typeAttrCount > 0 )
{
verify_noerr( TXNSetTypeAttributes( m_txn , typeAttrCount, typeAttr, from , to ) );
- relayout = true;
+ if (from != to)
+ relayout = true;
}
if ( tabs != NULL )
TXNSetTXNObjectControls( m_txn, false, WXSIZEOF(tag), tag, data ) ;
}
-wxTextPos wxMacMLTEControl::GetLastPosition() const
+long wxMacMLTEControl::GetLastPosition() const
{
wxTextPos actualsize = 0 ;
#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
MAC_WXHWND(wxPeer->GetParent()->MacGetTopLevelWindowRef()),
&bounds, featureSet, &m_controlRef );
verify_noerr( err );
+ SetControlReference( m_controlRef , (URefCon) wxPeer );
DoCreate();
{
HIViewAddSubview( m_scrollView , m_textView ) ;
m_controlRef = m_scrollView ;
- wxMacControl::MacInstallEventHandler( m_textView, wxPeer ) ;
+ InstallEventHandler( (WXWidget) m_textView ) ;
}
else
{
{
}
-OSStatus wxMacMLTEHIViewControl::SetFocus( ControlFocusPart focusPart )
+bool wxMacMLTEHIViewControl::SetFocus()
{
- return SetKeyboardFocus( GetControlOwner( m_textView ), m_textView, focusPart ) ;
+ return SetKeyboardFocus( GetControlOwner( m_textView ), m_textView, kControlFocusNextPart ) == noErr ;
}
bool wxMacMLTEHIViewControl::HasFocus() const