/* set up locals */
focusResult = kControlFocusNoPart;
tpvars = (STPTextPaneVars **) GetControlReference(theControl);
- if (tpvars != NULL) {
+ if (tpvars != NULL && IsControlVisible( theControl ) ) {
state = HGetState((Handle) tpvars);
HLock((Handle) tpvars);
varsp = *tpvars;
#endif
// Text item
-wxTextCtrl::wxTextCtrl()
+void wxTextCtrl::Init()
{
m_macTE = NULL ;
m_macTXN = NULL ;
m_macTXNvars = NULL ;
m_macUsesTXN = false ;
+
m_editable = true ;
+ m_dirty = false;
+
m_maxLength = TE_UNLIMITED_LENGTH ;
}
m_macUsesTXN &= (TXNInitTextension != (void*) kUnresolvedCFragSymbolAddress) ;
// base initialization
- if ( !CreateBase(parent, id, pos, size, style, validator, name) )
+ if ( !wxTextCtrlBase::Create(parent, id, pos, size, style & ~(wxHSCROLL|wxVSCROLL), validator, name) )
return FALSE;
wxSize mySize = size ;
void wxTextCtrl::SetSelection(long from, long to)
{
- if ( from == -1 )
- from = 0;
-
- if ( to == -1 )
- to = GetLastPosition();
-
if ( !m_macUsesTXN )
{
ControlEditTextSelectionRec selection ;
- selection.selStart = from ;
- selection.selEnd = to ;
+ if ((from == -1) && (to == -1))
+ {
+ selection.selStart = 0 ;
+ selection.selEnd = 32767 ;
+ }
+ else
+ {
+ selection.selStart = from ;
+ selection.selEnd = to ;
+ }
TESetSelect( selection.selStart , selection.selEnd , ((TEHandle) m_macTE) ) ;
::SetControlData((ControlHandle) m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
may force a redraw in the text area. */
SetPort((**tpvars).fDrawingEnvironment);
/* change the selection */
- TXNSetSelection( (**tpvars).fTXNRec, from, to);
+ if ((from == -1) && (to == -1))
+ TXNSelectAll((TXNObject) m_macTXN);
+ else
+ TXNSetSelection( (**tpvars).fTXNRec, from, to);
TXNShowSelection( (TXNObject) m_macTXN, kTXNShowStart);
}
}
bool wxTextCtrl::IsModified() const
{
- return TRUE;
+ return m_dirty;
}
bool wxTextCtrl::IsEditable() const
// Makes 'unmodified'
void wxTextCtrl::DiscardEdits()
{
- // TODO
+ m_dirty = false;
}
int wxTextCtrl::GetNumberOfLines() const
// eat it
return ;
}
+
+ // assume that any key not processed yet is going to modify the control
+ m_dirty = true;
+
if ( key == 'v' && event.MetaDown() )
{
if ( CanPaste() )