kControlFocusNoPart, otherwise return a non-zero part code.
kUserClickedToFocusPart - is a constant defined for this example. You should
define your own value for handling click-to-focus type events. */
- /* save the drawing state */
- SetPort((**tpvars).fDrawingEnvironment);
- wxMacWindowClipper clipper( wxFindControlFromMacControl(theControl ) ) ;
- /* calculate the next highlight state */
+ /* calculate the next highlight state */
switch (action) {
default:
case kControlFocusNoPart:
new focus state */
if ( IsControlVisible( theControl ) )
{
+ /* save the drawing state */
+ SetPort((**tpvars).fDrawingEnvironment);
+ wxMacWindowClipper clipper( wxFindControlFromMacControl(theControl ) ) ;
DrawThemeEditTextFrame(&varsp->fRTextOutline, varsp->fIsActive ? kThemeStateActive: kThemeStateInactive);
DrawThemeFocusRect(&varsp->fRFocusOutline, varsp->fIsActive && varsp->fInFocus);
}
const short kHorizontalMargin = 2 ;
bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
- const wxString& st,
+ const wxString& str,
const wxPoint& pos,
const wxSize& size, long style,
const wxValidator& validator,
m_editable = FALSE ;
}
+ wxString st = str ;
+ wxMacConvertNewlines13To10( &st ) ;
if ( !m_macUsesTXN )
{
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , "\p" , false , 0 , 0 , 1,
if ( !m_macUsesTXN )
{
- wxCharBuffer text = wxMacStringToCString( st ) ;
+ wxCharBuffer text = st.mb_str(wxConvLocal) ;
::SetControlData( (ControlHandle) m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , strlen(text) , text ) ;
}
else
TXNSetData( ((TXNObject) m_macTXN) , kTXNUnicodeTextData, (void*)st.wc_str(), st.Length() * 2,
kTXNStartOffset, kTXNEndOffset);
#else
- wxCharBuffer text = wxMacStringToCString( st ) ;
+ wxCharBuffer text = st.mb_str(wxConvLocal) ;
TXNSetData( ((TXNObject) m_macTXN) , kTXNTextData, (void*)text.data(), strlen( text ) ,
kTXNStartOffset, kTXNEndOffset);
#endif
::GetControlData( (ControlHandle) m_macControl, 0,
( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag,
actualSize , buf.data() , &actualSize ) ;
- result = wxMacMakeStringFromCString( buf ) ;
+ result = wxString( buf , wxConvLocal) ;
}
}
else
if ( actualSize > 0 )
{
HLock( theText ) ;
- result = wxMacMakeStringFromCString( *theText , actualSize ) ;
+ result = wxString( *theText , wxConvLocal , actualSize ) ;
HUnlock( theText ) ;
}
DisposeHandle( theText ) ;
}
#endif
}
-
+ wxMacConvertNewlines10To13( &result ) ;
return result ;
}
}
}
-void wxTextCtrl::SetValue(const wxString& st)
+void wxTextCtrl::SetValue(const wxString& str)
{
+ wxString st = str ;
+ wxMacConvertNewlines13To10( &st ) ;
if ( !m_macUsesTXN )
{
- wxCharBuffer text = wxMacStringToCString( st ) ;
+ wxCharBuffer text = st.mb_str(wxConvLocal) ;
::SetControlData( (ControlHandle) m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , strlen(text) , text ) ;
}
else
TXNSetData( ((TXNObject) m_macTXN), kTXNUnicodeTextData, (void*)st.wc_str(), st.Length() * 2 ,
kTXNStartOffset, kTXNEndOffset);
#else
- wxCharBuffer text = wxMacStringToCString( st ) ;
+ wxCharBuffer text = st.mb_str(wxConvLocal) ;
TXNSetData( ((TXNObject) m_macTXN), kTXNTextData, (void*)text.data(), strlen( text ) ,
kTXNStartOffset, kTXNEndOffset);
#endif
}
}
-void wxTextCtrl::Replace(long from, long to, const wxString& value)
+void wxTextCtrl::Replace(long from, long to, const wxString& str)
{
+ wxString value = str ;
+ wxMacConvertNewlines13To10( &value ) ;
if ( !m_macUsesTXN )
{
ControlEditTextSelectionRec selection ;
return FALSE;
}
-void wxTextCtrl::WriteText(const wxString& st)
+void wxTextCtrl::WriteText(const wxString& str)
{
+ wxString st = str ;
+ wxMacConvertNewlines13To10( &st ) ;
if ( !m_macUsesTXN )
{
- wxCharBuffer text = wxMacStringToCString( st ) ;
+ wxCharBuffer text = st.mb_str(wxConvLocal) ;
TEInsert( text , strlen(text) , ((TEHandle) m_macTE) ) ;
}
else
TXNSetData( ((TXNObject) m_macTXN), kTXNUnicodeTextData, (void*)st.wc_str(), st.Length() * 2 ,
kTXNUseCurrentSelection, kTXNUseCurrentSelection);
#else
- wxCharBuffer text = wxMacStringToCString( st ) ;
+ wxCharBuffer text = st.mb_str(wxConvLocal) ;
TXNSetData( ((TXNObject) m_macTXN), kTXNTextData, (void*)text.data(), strlen( text ) ,
kTXNUseCurrentSelection, kTXNUseCurrentSelection);
#endif
void wxTextCtrl::Clear()
{
- if ( !IsEditable() )
- {
- return ;
- }
if ( !m_macUsesTXN )
{
::SetControlData((ControlHandle) m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , 0 , (char*) ((const char*)NULL) ) ;
return FALSE ;
}
-// Makes 'unmodified'
+// Makes modifie or unmodified
+void wxTextCtrl::MarkDirty()
+{
+ m_dirty = true;
+}
+
void wxTextCtrl::DiscardEdits()
{
m_dirty = false;
for (size_t j = i; j < content.Length(); j++)
{
count++;
- if (content[j] == '\r') return count;
+ if (content[j] == '\n') return count;
}
return count;
}
- if (content[i] == '\r') count++;
+ if (content[i] == '\n') count++;
}
return 0;
}
for (size_t j = i; j < content.Length(); j++)
{
- if (content[j] == '\r')
+ if (content[j] == '\n')
return tmp;
tmp += content[j];
return tmp;
}
- if (content[i] == '\r') count++;
+ if (content[i] == '\n') count++;
}
return wxEmptyString ;
}