// Name: textctrl.cpp
// Purpose: wxTextCtrl
// Author: Stefan Csomor
-// Modified by:
+// Modified by: Ryan Norton (MLTE GetLineLength and GetLineText)
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
const wxSize& size, long style ) ;
~wxMacMLTEClassicControl() ;
virtual void VisibilityChanged(bool shown) ;
+ virtual bool NeedsFocusRect() const;
protected :
OSStatus DoCreate();
public :
{
// this control draws the border itself
if ( !HasFlag(wxNO_BORDER) )
+ {
m_windowStyle &= ~wxSUNKEN_BORDER ;
+ bounds = wxMacGetBoundsForControl( this , pos , size ) ;
+ }
m_peer = new wxMacMLTEClassicControl( this , str , pos , size , style ) ;
}
// while this is true for MLTE under classic, the HITextView is somehow
// transparent but background erase is not working correctly, so intercept
// things while we can...
+ event.Skip() ;
}
void wxTextCtrl::OnChar(wxKeyEvent& event)
m_windowStyle = style ;
Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ;
wxString st = str ;
- wxMacConvertNewlines13To10( &st ) ;
+ wxMacConvertNewlines10To13( &st ) ;
wxMacCFStringHolder cf(st , m_font.GetEncoding()) ;
CFStringRef cfr = cf ;
Boolean isPassword = ( m_windowStyle & wxTE_PASSWORD ) != 0 ;
wxMacCFStringHolder cf(value) ;
result = cf.AsString() ;
}
+#if '\n' == 10
+ wxMacConvertNewlines13To10( &result ) ;
+#else
wxMacConvertNewlines10To13( &result ) ;
+#endif
return result ;
}
void wxMacUnicodeTextControl::SetStringValue( const wxString &str)
{
wxString st = str ;
- wxMacConvertNewlines13To10( &st ) ;
+ wxMacConvertNewlines10To13( &st ) ;
wxMacCFStringHolder cf(st , m_font.GetEncoding() ) ;
verify_noerr( SetData<CFStringRef>( 0, m_valueTag , cf ) ) ;
}
void wxMacUnicodeTextControl::WriteText(const wxString& str)
{
wxString st = str ;
- wxMacConvertNewlines13To10( &st ) ;
+ wxMacConvertNewlines10To13( &st ) ;
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
wxMacCFStringHolder cf(st , m_font.GetEncoding() ) ;
CFStringRef value = cf ;
}
#endif
}
+#if '\n' == 10
+ wxMacConvertNewlines13To10( &result ) ;
+#else
wxMacConvertNewlines10To13( &result ) ;
+#endif
return result ;
}
void wxMacMLTEControl::SetStringValue( const wxString &str)
{
wxString st = str ;
- wxMacConvertNewlines13To10( &st ) ;
+
+ wxMacConvertNewlines10To13( &st ) ;
EditHelper help(m_txn) ;
// wxMacWindowClipper c( this ) ;
void wxMacMLTEControl::Replace( long from , long to , const wxString str )
{
wxString value = str ;
- wxMacConvertNewlines13To10( &value ) ;
+ wxMacConvertNewlines10To13( &value ) ;
EditHelper help( m_txn ) ;
TXNSetSelection(m_txn , from , to ) ;
TXNClear( m_txn ) ;
- SetTXNData( str , kTXNUseCurrentSelection, kTXNUseCurrentSelection ) ;
+ SetTXNData( value , kTXNUseCurrentSelection, kTXNUseCurrentSelection ) ;
}
void wxMacMLTEControl::Remove( long from , long to )
{
EditHelper helper( m_txn ) ;
wxString st = str ;
- wxMacConvertNewlines13To10( &st ) ;
+ wxMacConvertNewlines10To13( &st ) ;
long start , end , dummy ;
GetSelection( &start , &dummy ) ;
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);
m_windowStyle = style ;
Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ;
wxString st = str ;
- wxMacConvertNewlines13To10( &st ) ;
-
- wxMacConvertNewlines13To10( &st ) ;
+ wxMacConvertNewlines10To13( &st ) ;
short featurSet;
return err;
}
+//
+// HACKHACK: (RN)
+// Classic controls are not initially focused and
+// smaller ones are focused badly with the focus rect
+// this "fixes" the above issue - but there is probably a
+// a better way.
+//
+// Still, on smaller text controls the focus rect is off
+//
+
+bool wxMacMLTEClassicControl::NeedsFocusRect() const
+{
+ return m_windowStyle & wxNO_BORDER ? false : true;
+}
+
// ----------------------------------------------------------------------------
// MLTE control implementation (OSX part)
// ----------------------------------------------------------------------------
m_windowStyle = style ;
Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ;
wxString st = str ;
- wxMacConvertNewlines13To10( &st ) ;
+ wxMacConvertNewlines10To13( &st ) ;
HIRect hr = { bounds.left , bounds.top , bounds.right - bounds.left , bounds.bottom- bounds.top } ;