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 ) ;
void AdjustCreationAttributes( const wxColour& background, bool visible ) ;
- virtual void SetFont( const wxFont & font, const wxColour& foreground, long windowStyle ) ;
+ virtual void SetFont( const wxFont & font, const wxColour& foreground, long windowStyle, bool ignoreBlack ) ;
virtual void SetBackgroundColour(const wxColour& col );
virtual void SetStyle( long start, long end, const wxTextAttr& style ) ;
virtual void Copy() ;
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 ) ;
};
wxWidgetImplType* wxWidgetImpl::CreateTextControl( wxTextCtrl* wxpeer,
- wxWindowMac* parent,
- wxWindowID id,
+ wxWindowMac* WXUNUSED(parent),
+ wxWindowID WXUNUSED(id),
const wxString& str,
const wxPoint& pos,
const wxSize& size,
long style,
- long extraStyle)
+ long WXUNUSED(extraStyle))
{
bool forceMLTE = false ;
{
::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 )
void wxMacMLTEControl::SetFont(const wxFont & font,
const wxColour& foreground,
- long WXUNUSED(windowStyle))
+ long WXUNUSED(windowStyle),
+ bool WXUNUSED(ignoreBlack))
{
wxMacEditHelper help( m_txn ) ;
TXNSetAttribute( wxTextAttr( foreground, wxNullColour, font ), kTXNStartOffset, kTXNEndOffset ) ;
TXNSetTXNObjectControls( m_txn, false, WXSIZEOF(tag), tag, data ) ;
}
-wxTextPos wxMacMLTEControl::GetLastPosition() const
+long wxMacMLTEControl::GetLastPosition() const
{
wxTextPos actualsize = 0 ;
Handle theText ;
+#if wxUSE_UNICODE
+ OSErr err = TXNGetDataEncoded( m_txn, kTXNStartOffset, kTXNEndOffset, &theText, kTXNUnicodeTextData );
+ // all done
+ if ( err == noErr )
+ {
+ actualsize = GetHandleSize( theText )/sizeof(UniChar);
+ DisposeHandle( theText ) ;
+ }
+#else
OSErr err = TXNGetDataEncoded( m_txn, kTXNStartOffset, kTXNEndOffset, &theText, kTXNTextData );
// all done
actualsize = GetHandleSize( theText ) ;
DisposeHandle( theText ) ;
}
+#endif
else
{
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