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 ) ;
void SetTXNData( const wxString& st , TXNOffset start , TXNOffset end ) ;
protected :
+ void TXNSetAttribute( const wxTextAttr& style , long from , long to ) ;
TXNObject m_txn ;
} ;
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 ;
const wxSize& size, long style ) ;
~wxMacMLTEClassicControl() ;
virtual void VisibilityChanged(bool shown) ;
- virtual bool NeedsFocusRect() const;
protected :
OSStatus DoCreate();
public :
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;
wxMacCFStringHolder cf(value) ;
result = cf.AsString() ;
}
-#if TARGET_API_MAC_OSX
+#if '\n' == 10
wxMacConvertNewlines13To10( &result ) ;
#else
wxMacConvertNewlines10To13( &result ) ;
}
#endif
}
-#if TARGET_API_MAC_OSX
+#if '\n' == 10
wxMacConvertNewlines13To10( &result ) ;
#else
wxMacConvertNewlines10To13( &result ) ;
TXNSetBackground( m_txn , &tback);
}
-int wxMacMLTEControl::ConvertAttribute( const wxTextAttr& style , TXNTypeAttributes typeAttr[] )
+void wxMacMLTEControl::TXNSetAttribute( const wxTextAttr& style , long from , long to)
{
+ TXNTypeAttributes typeAttr[4] ;
Str255 fontName = "\pMonaco" ;
SInt16 fontSize = 12 ;
Style fontStyle = normal ;
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(foreground,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()
currentHeight += lineHeight;
}
- Point thePoint = { firstPoint.v + Fix2Long(currentHeight), firstPoint.h + Fix2Long(0) };
+ Point thePoint = { firstPoint.v + (currentHeight >> 16), firstPoint.h + (0) };
TXNOffset theOffset;
TXNPointToOffset(m_txn, thePoint, &theOffset);
currentHeight += lineHeight;
}
- Point thePoint = { firstPoint.v + Fix2Long(currentHeight), firstPoint.h + Fix2Long(0) };
+ Point thePoint = { firstPoint.v + (currentHeight >> 16), firstPoint.h + (0) };
TXNOffset theOffset;
TXNPointToOffset(m_txn, thePoint, &theOffset);
return err;
}
-bool wxMacMLTEClassicControl::NeedsFocusRect() const
-{
- return m_windowStyle & wxNO_BORDER ? false : true;
-}
-
// ----------------------------------------------------------------------------
// MLTE control implementation (OSX part)
// ----------------------------------------------------------------------------