+#if TARGET_API_MAC_OSX
+ #define wxMAC_USE_MLTE 1
+ #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
+ #define wxMAC_USE_MLTE_HIVIEW 1
+ #else
+ #define wxMAC_USE_MLTE_HIVIEW 0
+ #endif
+#else
+ // there is no unicodetextctrl on classic, and hopefully MLTE works better there
+ #define wxMAC_USE_MLTE 1
+ #define wxMAC_USE_MLTE_HIVIEW 0
+#endif
+
+#if wxMAC_USE_MLTE
+
+TXNFrameOptions FrameOptionsFromWXStyle( long wxStyle )
+{
+ TXNFrameOptions frameOptions =
+ kTXNDontDrawCaretWhenInactiveMask ;
+ if ( ! ( wxStyle & wxTE_NOHIDESEL ) )
+ frameOptions |= kTXNDontDrawSelectionWhenInactiveMask ;
+
+ if ( wxStyle & wxTE_MULTILINE )
+ {
+ if ( ! ( wxStyle & wxTE_DONTWRAP ) )
+ frameOptions |= kTXNAlwaysWrapAtViewEdgeMask ;
+ else
+ {
+ frameOptions |= kTXNAlwaysWrapAtViewEdgeMask ;
+ frameOptions |= kTXNWantHScrollBarMask ;
+ }
+
+ if ( !(wxStyle & wxTE_NO_VSCROLL ) )
+ frameOptions |= kTXNWantVScrollBarMask ;
+ }
+ else
+ frameOptions |= kTXNSingleLineOnlyMask ;
+ return frameOptions ;
+}
+
+void AdjustAttributesFromWXStyle( TXNObject txn , long wxStyle , bool visible )
+{
+ TXNControlTag iControlTags[3] = { kTXNDoFontSubstitution, kTXNWordWrapStateTag };
+ TXNControlData iControlData[3] = { {false}, {kTXNNoAutoWrap} };
+ int toptag = 2 ;
+#if TARGET_API_MAC_OSX
+ iControlTags[2] = kTXNVisibilityTag ;
+ iControlData[2].uValue = visible ;
+ toptag++ ;
+#endif
+
+ if ( wxStyle & wxTE_MULTILINE )
+ {
+ if (wxStyle & wxTE_DONTWRAP)
+ iControlData[1].uValue = kTXNNoAutoWrap ;
+ else
+ iControlData[1].uValue = kTXNAutoWrap ;
+
+ }
+ verify_noerr( TXNSetTXNObjectControls( txn, false, toptag,
+ iControlTags, iControlData )) ;
+
+ Str255 fontName ;
+ SInt16 fontSize ;
+ Style fontStyle ;
+
+ GetThemeFont(kThemeSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
+
+ TXNTypeAttributes typeAttr[] =
+ {
+ { kTXNQDFontNameAttribute , kTXNQDFontNameAttributeSize , { (void*) fontName } } ,
+ { kTXNQDFontSizeAttribute , kTXNFontSizeAttributeSize , { (void*) (fontSize << 16) } } ,
+ { kTXNQDFontStyleAttribute , kTXNQDFontStyleAttributeSize , { (void*) normal } } ,
+ } ;
+
+ verify_noerr( TXNSetTypeAttributes (txn, sizeof( typeAttr ) / sizeof(TXNTypeAttributes) , typeAttr,
+ kTXNStartOffset,
+ kTXNEndOffset) );
+
+}
+
+#if !wxMAC_USE_MLTE_HIVIEW