1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "textctrl.h"
25 #define XtParent XTPARENT
30 #include <sys/types.h>
34 #include "wx/textctrl.h"
35 #include "wx/settings.h"
36 #include "wx/filefn.h"
40 #pragma message disable nosimpint
44 #pragma message enable nosimpint
47 #include "wx/motif/private.h"
49 // ----------------------------------------------------------------------------
51 // ----------------------------------------------------------------------------
53 // helper: inserts the new text in the value of the text ctrl and returns the
55 static void MergeChangesIntoString(wxString
& value
,
56 XmTextVerifyCallbackStruct
*textStruct
);
59 static void wxTextWindowChangedProc(Widget w
, XtPointer clientData
, XtPointer ptr
);
60 static void wxTextWindowModifyProc(Widget w
, XtPointer clientData
, XmTextVerifyCallbackStruct
*cbs
);
61 static void wxTextWindowGainFocusProc(Widget w
, XtPointer clientData
, XmAnyCallbackStruct
*cbs
);
62 static void wxTextWindowLoseFocusProc(Widget w
, XtPointer clientData
, XmAnyCallbackStruct
*cbs
);
63 static void wxTextWindowActivateProc(Widget w
, XtPointer clientData
, XmAnyCallbackStruct
*ptr
);
65 IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl
, wxControl
)
67 BEGIN_EVENT_TABLE(wxTextCtrl
, wxControl
)
68 EVT_DROP_FILES(wxTextCtrl::OnDropFiles
)
69 EVT_CHAR(wxTextCtrl::OnChar
)
71 EVT_MENU(wxID_CUT
, wxTextCtrl::OnCut
)
72 EVT_MENU(wxID_COPY
, wxTextCtrl::OnCopy
)
73 EVT_MENU(wxID_PASTE
, wxTextCtrl::OnPaste
)
74 EVT_MENU(wxID_UNDO
, wxTextCtrl::OnUndo
)
75 EVT_MENU(wxID_REDO
, wxTextCtrl::OnRedo
)
77 EVT_UPDATE_UI(wxID_CUT
, wxTextCtrl::OnUpdateCut
)
78 EVT_UPDATE_UI(wxID_COPY
, wxTextCtrl::OnUpdateCopy
)
79 EVT_UPDATE_UI(wxID_PASTE
, wxTextCtrl::OnUpdatePaste
)
80 EVT_UPDATE_UI(wxID_UNDO
, wxTextCtrl::OnUpdateUndo
)
81 EVT_UPDATE_UI(wxID_REDO
, wxTextCtrl::OnUpdateRedo
)
85 // ============================================================================
87 // ============================================================================
89 // ----------------------------------------------------------------------------
91 // ----------------------------------------------------------------------------
94 wxTextCtrl::wxTextCtrl()
96 m_tempCallbackStruct
= (void*) NULL
;
98 m_processedDefault
= FALSE
;
101 bool wxTextCtrl::Create(wxWindow
*parent
,
103 const wxString
& value
,
107 const wxValidator
& validator
,
108 const wxString
& name
)
110 if( !CreateControl( parent
, id
, pos
, size
, style
, validator
, name
) )
113 m_tempCallbackStruct
= (void*) NULL
;
115 m_processedDefault
= FALSE
;
117 m_backgroundColour
= *wxWHITE
;
119 Widget parentWidget
= (Widget
) parent
->GetClientWidget();
121 bool wantHorizScrolling
= ((m_windowStyle
& wxHSCROLL
) != 0);
123 // If we don't have horizontal scrollbars, we want word wrap.
124 bool wantWordWrap
= !wantHorizScrolling
;
126 if (m_windowStyle
& wxTE_MULTILINE
)
129 XtSetArg (args
[0], XmNscrollHorizontal
, wantHorizScrolling
? True
: False
);
130 XtSetArg (args
[1], XmNwordWrap
, wantWordWrap
? True
: False
);
132 m_mainWidget
= (WXWidget
) XmCreateScrolledText(parentWidget
,
133 wxConstCast(name
.c_str(), char),
136 XtVaSetValues ((Widget
) m_mainWidget
,
137 XmNeditable
, ((style
& wxTE_READONLY
) ? False
: True
),
138 XmNeditMode
, XmMULTI_LINE_EDIT
,
140 XtManageChild ((Widget
) m_mainWidget
);
144 m_mainWidget
= (WXWidget
)XtVaCreateManagedWidget
146 wxConstCast(name
.c_str(), char),
152 XtVaSetValues ((Widget
) m_mainWidget
,
153 XmNeditable
, ((style
& wxTE_READONLY
) ? False
: True
),
156 // TODO: Is this relevant? What does it do?
158 if (!value
.IsNull() && (value
.Length() > (unsigned int) noCols
))
159 noCols
= value
.Length();
160 XtVaSetValues((Widget
) m_mainWidget
,
165 // remove border if asked for
166 if ( style
& wxNO_BORDER
)
168 XtVaSetValues((Widget
)m_mainWidget
,
169 XmNshadowThickness
, 0,
173 if ( !value
.empty() )
175 // do this instead... MB
177 XtVaSetValues( (Widget
) m_mainWidget
,
178 XmNvalue
, wxConstCast(value
.c_str(), char),
183 XtAddCallback((Widget
) m_mainWidget
, XmNvalueChangedCallback
, (XtCallbackProc
)wxTextWindowChangedProc
, (XtPointer
)this);
185 XtAddCallback((Widget
) m_mainWidget
, XmNmodifyVerifyCallback
, (XtCallbackProc
)wxTextWindowModifyProc
, (XtPointer
)this);
187 XtAddCallback((Widget
) m_mainWidget
, XmNactivateCallback
, (XtCallbackProc
)wxTextWindowActivateProc
, (XtPointer
)this);
189 XtAddCallback((Widget
) m_mainWidget
, XmNfocusCallback
, (XtCallbackProc
)wxTextWindowGainFocusProc
, (XtPointer
)this);
191 XtAddCallback((Widget
) m_mainWidget
, XmNlosingFocusCallback
, (XtCallbackProc
)wxTextWindowLoseFocusProc
, (XtPointer
)this);
196 wxSize best
= GetBestSize();
197 if( size
.x
!= -1 ) best
.x
= size
.x
;
198 if( size
.y
!= -1 ) best
.y
= size
.y
;
200 SetCanAddEventHandler(TRUE
);
201 AttachWidget (parent
, m_mainWidget
, (WXWidget
) NULL
,
202 pos
.x
, pos
.y
, best
.x
, best
.y
);
204 ChangeBackgroundColour();
209 WXWidget
wxTextCtrl::GetTopWidget() const
211 return ((m_windowStyle
& wxTE_MULTILINE
) ? (WXWidget
) XtParent((Widget
) m_mainWidget
) : m_mainWidget
);
214 wxString
wxTextCtrl::GetValue() const
216 wxString str
; // result
218 if (m_windowStyle
& wxTE_PASSWORD
)
220 // the value is stored always in m_value because it can't be retrieved
221 // from the text control
226 // just get the string from Motif
227 char *s
= XmTextGetString ((Widget
) m_mainWidget
);
233 //else: return empty string
235 if ( m_tempCallbackStruct
)
237 // the string in the control isn't yet updated, can't use it as is
238 MergeChangesIntoString(str
, (XmTextVerifyCallbackStruct
*)
239 m_tempCallbackStruct
);
246 void wxTextCtrl::SetValue(const wxString
& value
)
250 // do this instead... MB
252 XtVaSetValues( (Widget
) m_mainWidget
,
253 XmNvalue
, wxConstCast(value
.c_str(), char),
256 m_inSetValue
= FALSE
;
259 // Clipboard operations
260 void wxTextCtrl::Copy()
262 XmTextCopy((Widget
) m_mainWidget
, CurrentTime
);
265 void wxTextCtrl::Cut()
267 XmTextCut((Widget
) m_mainWidget
, CurrentTime
);
270 void wxTextCtrl::Paste()
272 XmTextPaste((Widget
) m_mainWidget
);
275 bool wxTextCtrl::CanCopy() const
277 // Can copy if there's a selection
279 GetSelection(& from
, & to
);
280 return (from
!= to
) ;
283 bool wxTextCtrl::CanCut() const
285 // Can cut if there's a selection
287 GetSelection(& from
, & to
);
288 return (from
!= to
) && (IsEditable());
291 bool wxTextCtrl::CanPaste() const
293 return IsEditable() ;
297 void wxTextCtrl::Undo()
299 // Not possible in Motif
302 void wxTextCtrl::Redo()
304 // Not possible in Motif
307 bool wxTextCtrl::CanUndo() const
313 bool wxTextCtrl::CanRedo() const
319 // If the return values from and to are the same, there is no
321 void wxTextCtrl::GetSelection(long* from
, long* to
) const
323 XmTextPosition left
, right
;
325 XmTextGetSelectionPosition((Widget
) m_mainWidget
, & left
, & right
);
331 bool wxTextCtrl::IsEditable() const
333 return (XmTextGetEditable((Widget
) m_mainWidget
) != 0);
336 void wxTextCtrl::SetEditable(bool editable
)
338 XmTextSetEditable((Widget
) m_mainWidget
, (Boolean
) editable
);
341 void wxTextCtrl::SetInsertionPoint(long pos
)
343 XmTextSetInsertionPosition ((Widget
) m_mainWidget
, (XmTextPosition
) pos
);
346 void wxTextCtrl::SetInsertionPointEnd()
348 long pos
= GetLastPosition();
349 SetInsertionPoint(pos
);
352 long wxTextCtrl::GetInsertionPoint() const
354 return (long) XmTextGetInsertionPosition ((Widget
) m_mainWidget
);
357 long wxTextCtrl::GetLastPosition() const
359 return (long) XmTextGetLastPosition ((Widget
) m_mainWidget
);
362 void wxTextCtrl::Replace(long from
, long to
, const wxString
& value
)
364 XmTextReplace ((Widget
) m_mainWidget
, (XmTextPosition
) from
, (XmTextPosition
) to
,
365 wxConstCast(value
.c_str(), char));
368 void wxTextCtrl::Remove(long from
, long to
)
370 XmTextSetSelection ((Widget
) m_mainWidget
, (XmTextPosition
) from
, (XmTextPosition
) to
,
372 XmTextRemove ((Widget
) m_mainWidget
);
375 void wxTextCtrl::SetSelection(long from
, long to
)
378 to
= GetLastPosition();
380 XmTextSetSelection ((Widget
) m_mainWidget
, (XmTextPosition
) from
, (XmTextPosition
) to
,
384 bool wxTextCtrl::LoadFile(const wxString
& file
)
386 if (!wxFileExists(file
))
393 Widget textWidget
= (Widget
) m_mainWidget
;
397 if ((stat (wxConstCast(file
.c_str(), char), &statb
) == -1) || (statb
.st_mode
& S_IFMT
) != S_IFREG
||
398 !(fp
= fopen (wxConstCast(file
.c_str(), char), "r")))
404 long len
= statb
.st_size
;
406 if (!(text
= XtMalloc ((unsigned) (len
+ 1))))
411 if (fread (text
, sizeof (char), len
, fp
) != (size_t) len
)
417 XmTextSetString (textWidget
, text
);
418 // m_textPosition = len;
425 // If file is null, try saved file name first
426 // Returns TRUE if succeeds.
427 bool wxTextCtrl::SaveFile(const wxString
& file
)
429 wxString
theFile(file
);
431 theFile
= m_fileName
;
434 m_fileName
= theFile
;
436 Widget textWidget
= (Widget
) m_mainWidget
;
439 if (!(fp
= fopen (wxConstCast(theFile
.c_str(), char), "w")))
445 char *text
= XmTextGetString (textWidget
);
446 long len
= XmTextGetLastPosition (textWidget
);
448 if (fwrite (text
, sizeof (char), len
, fp
) != (size_t) len
)
450 // Did not write whole file
452 // Make sure newline terminates the file
453 if (text
[len
- 1] != '\n')
463 void wxTextCtrl::WriteText(const wxString
& text
)
465 long textPosition
= GetInsertionPoint() + strlen (text
);
466 XmTextInsert ((Widget
) m_mainWidget
, GetInsertionPoint(),
467 wxConstCast(text
.c_str(), char));
468 XtVaSetValues ((Widget
) m_mainWidget
, XmNcursorPosition
, textPosition
, NULL
);
469 SetInsertionPoint(textPosition
);
470 XmTextShowPosition ((Widget
) m_mainWidget
, textPosition
);
474 void wxTextCtrl::AppendText(const wxString
& text
)
476 long textPosition
= GetLastPosition() + strlen(text
);
477 XmTextInsert ((Widget
) m_mainWidget
, GetLastPosition(),
478 wxConstCast(text
.c_str(), char));
479 XtVaSetValues ((Widget
) m_mainWidget
, XmNcursorPosition
, textPosition
, NULL
);
480 SetInsertionPoint(textPosition
);
481 XmTextShowPosition ((Widget
) m_mainWidget
, textPosition
);
485 void wxTextCtrl::Clear()
487 XmTextSetString ((Widget
) m_mainWidget
, "");
491 bool wxTextCtrl::IsModified() const
496 // Makes 'unmodified'
497 void wxTextCtrl::DiscardEdits()
502 int wxTextCtrl::GetNumberOfLines() const
504 // HIDEOUSLY inefficient, but we have no choice.
505 char *s
= XmTextGetString ((Widget
) m_mainWidget
);
510 bool finished
= FALSE
;
533 long wxTextCtrl::XYToPosition(long x
, long y
) const
535 /* It seems, that there is a bug in some versions of the Motif library,
536 so the original wxWin-Code doesn't work. */
538 Widget textWidget = (Widget) handle;
539 return (long) XmTextXYToPos (textWidget, (Position) x, (Position) y);
541 /* Now a little workaround: */
543 for (int i
=0; i
<y
; i
++) r
+=(GetLineLength(i
)+1);
547 bool wxTextCtrl::PositionToXY(long pos
, long *x
, long *y
) const
550 XmTextPosToXY((Widget
) m_mainWidget
, pos
, &xx
, &yy
);
559 void wxTextCtrl::ShowPosition(long pos
)
561 XmTextShowPosition ((Widget
) m_mainWidget
, (XmTextPosition
) pos
);
564 int wxTextCtrl::GetLineLength(long lineNo
) const
566 wxString str
= GetLineText (lineNo
);
567 return (int) str
.Length();
570 wxString
wxTextCtrl::GetLineText(long lineNo
) const
572 // HIDEOUSLY inefficient, but we have no choice.
573 char *s
= XmTextGetString ((Widget
) m_mainWidget
);
580 for (i
= 0; currentLine
!= lineNo
&& s
[i
]; i
++ )
585 for (j
= 0; s
[i
] && s
[i
] != '\n'; i
++, j
++ )
592 return wxEmptyString
;
599 void wxTextCtrl::Command(wxCommandEvent
& event
)
601 SetValue (event
.GetString());
602 ProcessCommand (event
);
605 void wxTextCtrl::OnDropFiles(wxDropFilesEvent
& event
)
607 // By default, load the first file into the text window.
608 if (event
.GetNumberOfFiles() > 0)
610 LoadFile(event
.GetFiles()[0]);
614 void wxTextCtrl::OnChar(wxKeyEvent
& event
)
616 // Indicates that we should generate a normal command, because
617 // we're letting default behaviour happen (otherwise it's vetoed
618 // by virtue of overriding OnChar)
619 m_processedDefault
= TRUE
;
621 if (m_tempCallbackStruct
)
623 XmTextVerifyCallbackStruct
*textStruct
=
624 (XmTextVerifyCallbackStruct
*) m_tempCallbackStruct
;
625 textStruct
->doit
= True
;
626 if (isascii(event
.m_keyCode
) && (textStruct
->text
->length
== 1))
628 textStruct
->text
->ptr
[0] = ((event
.m_keyCode
== WXK_RETURN
) ? 10 : event
.m_keyCode
);
633 void wxTextCtrl::ChangeFont(bool keepOriginalSize
)
635 wxWindow::ChangeFont(keepOriginalSize
);
638 void wxTextCtrl::ChangeBackgroundColour()
640 wxWindow::ChangeBackgroundColour();
642 /* TODO: should scrollbars be affected? Should probably have separate
643 * function to change them (by default, taken from wxSystemSettings)
645 if (m_windowStyle
& wxTE_MULTILINE
)
647 Widget parent
= XtParent ((Widget
) m_mainWidget
);
650 XtVaGetValues (parent
,
651 XmNhorizontalScrollBar
, &hsb
,
652 XmNverticalScrollBar
, &vsb
,
654 wxColour backgroundColour
= wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE
);
656 DoChangeBackgroundColour((WXWidget
) hsb
, backgroundColour
, TRUE
);
658 DoChangeBackgroundColour((WXWidget
) vsb
, backgroundColour
, TRUE
);
660 // MBN: why change parent background?
661 // DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE);
665 void wxTextCtrl::ChangeForegroundColour()
667 wxWindow::ChangeForegroundColour();
669 if (m_windowStyle
& wxTE_MULTILINE
)
671 Widget parent
= XtParent ((Widget
) m_mainWidget
);
674 XtVaGetValues (parent
,
675 XmNhorizontalScrollBar
, &hsb
,
676 XmNverticalScrollBar
, &vsb
,
679 /* TODO: should scrollbars be affected? Should probably have separate
680 * function to change them (by default, taken from wxSystemSettings)
682 DoChangeForegroundColour((WXWidget) hsb, m_foregroundColour);
684 DoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
686 DoChangeForegroundColour((WXWidget
) parent
, m_foregroundColour
);
690 void wxTextCtrl::DoSendEvents(void *wxcbs
, long keycode
)
692 // we're in process of updating the text control
693 m_tempCallbackStruct
= wxcbs
;
695 XmTextVerifyCallbackStruct
*cbs
= (XmTextVerifyCallbackStruct
*)wxcbs
;
697 wxKeyEvent
event (wxEVT_CHAR
);
698 event
.SetId(GetId());
699 event
.m_keyCode
= keycode
;
700 event
.SetEventObject(this);
702 // Only if wxTextCtrl::OnChar is called will this be set to True (and
703 // the character passed through)
706 GetEventHandler()->ProcessEvent(event
);
708 if ( !InSetValue() && m_processedDefault
)
710 // Can generate a command
711 wxCommandEvent
commandEvent(wxEVT_COMMAND_TEXT_UPDATED
, GetId());
712 commandEvent
.SetEventObject(this);
713 ProcessCommand(commandEvent
);
716 // do it after the (user) event handlers processed the events because
717 // otherwise GetValue() would return incorrect (not yet updated value)
718 m_tempCallbackStruct
= NULL
;
721 wxSize
wxDoGetSingleTextCtrlBestSize( Widget textWidget
,
722 const wxWindow
* window
)
724 Dimension xmargin
, ymargin
, highlight
, shadow
;
727 XtVaGetValues( textWidget
,
728 XmNmarginWidth
, &xmargin
,
729 XmNmarginHeight
, &ymargin
,
731 XmNhighlightThickness
, &highlight
,
732 XmNshadowThickness
, &shadow
,
739 window
->GetTextExtent( value
, &x
, &y
);
741 if( x
< 100 ) x
= 100;
743 return wxSize( x
+ 2 * xmargin
+ 2 * highlight
+ 2 * shadow
,
744 // MBN: +2 necessary: Lesstif bug or mine?
745 y
+ 2 * ymargin
+ 2 * highlight
+ 2 * shadow
+ 2 );
748 wxSize
wxTextCtrl::DoGetBestSize() const
751 return wxDoGetSingleTextCtrlBestSize( (Widget
)m_mainWidget
, this );
753 return wxWindow::DoGetBestSize();
756 // ----------------------------------------------------------------------------
757 // helpers and Motif callbacks
758 // ----------------------------------------------------------------------------
760 static void MergeChangesIntoString(wxString
& value
,
761 XmTextVerifyCallbackStruct
*cbs
)
764 * At least on my system (SunOS 4.1.3 + Motif 1.2), you need to think of
765 * every event as a replace event. cbs->text->ptr gives the replacement
766 * text, cbs->startPos gives the index of the first char affected by the
767 * replace, and cbs->endPos gives the index one more than the last char
768 * affected by the replace (startPos == endPos implies an empty range).
769 * Hence, a deletion is represented by replacing all input text with a
770 * blank string ("", *not* NULL!). A simple insertion that does not
771 * overwrite any text has startPos == endPos.
776 // easy case: the ol value was empty
777 value
= cbs
->text
->ptr
;
781 // merge the changes into the value
782 const char * const passwd
= value
;
783 int len
= value
.length();
785 len
+= ( cbs
->text
->ptr
?
786 strlen(cbs
->text
->ptr
) :
787 0 ) + 1; // + new text (if any) + NUL
788 len
-= cbs
->endPos
- cbs
->startPos
; // - text from affected region.
790 char * newS
= new char [len
];
792 * insert
= cbs
->text
->ptr
;
794 // Copy (old) text from passwd, up to the start posn of the change.
796 const char * p
= passwd
;
797 for (i
= 0; i
< cbs
->startPos
; ++i
)
800 // Copy the text to be inserted).
805 // Finally, copy into newS any remaining text from passwd[endPos] on.
806 for (p
= passwd
+ cbs
->endPos
; *p
; )
817 wxTextWindowChangedProc (Widget w
, XtPointer clientData
, XtPointer
WXUNUSED(ptr
))
819 if (!wxGetWindowFromTable(w
))
820 // Widget has been deleted!
823 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
824 tw
->SetModified(TRUE
);
828 wxTextWindowModifyProc (Widget
WXUNUSED(w
), XtPointer clientData
, XmTextVerifyCallbackStruct
*cbs
)
830 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
831 tw
->m_processedDefault
= FALSE
;
833 // First, do some stuff if it's a password control: in this case, we need
834 // to store the string inside the class because GetValue() can't retrieve
835 // it from the text ctrl. We do *not* do it in other circumstances because
836 // it would double the amount of memory needed.
838 if ( tw
->GetWindowStyleFlag() & wxTE_PASSWORD
)
840 MergeChangesIntoString(tw
->m_value
, cbs
);
842 if ( cbs
->text
->length
> 0 )
845 for (i
= 0; i
< cbs
->text
->length
; ++i
)
846 cbs
->text
->ptr
[i
] = '*';
847 cbs
->text
->ptr
[i
] = '\0';
851 // If we're already within an OnChar, return: probably a programmatic
853 if (tw
->m_tempCallbackStruct
)
856 // Check for a backspace
857 if (cbs
->startPos
== (cbs
->currInsert
- 1))
859 tw
->DoSendEvents((void *)cbs
, WXK_DELETE
);
864 // Pasting operation: let it through without calling OnChar
865 if (cbs
->text
->length
> 1)
868 // Something other than text
869 if (cbs
->text
->ptr
== NULL
)
873 char ch
= cbs
->text
->ptr
[0];
874 tw
->DoSendEvents((void *)cbs
, ch
== '\n' ? '\r' : ch
);
878 wxTextWindowGainFocusProc (Widget w
, XtPointer clientData
, XmAnyCallbackStruct
*WXUNUSED(cbs
))
880 if (!wxGetWindowFromTable(w
))
883 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
884 wxFocusEvent
event(wxEVT_SET_FOCUS
, tw
->GetId());
885 event
.SetEventObject(tw
);
886 tw
->GetEventHandler()->ProcessEvent(event
);
890 wxTextWindowLoseFocusProc (Widget w
, XtPointer clientData
, XmAnyCallbackStruct
*WXUNUSED(cbs
))
892 if (!wxGetWindowFromTable(w
))
895 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
896 wxFocusEvent
event(wxEVT_KILL_FOCUS
, tw
->GetId());
897 event
.SetEventObject(tw
);
898 tw
->GetEventHandler()->ProcessEvent(event
);
901 static void wxTextWindowActivateProc(Widget w
, XtPointer clientData
,
902 XmAnyCallbackStruct
*WXUNUSED(ptr
))
904 if (!wxGetWindowFromTable(w
))
907 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
909 if (tw
->InSetValue())
912 wxCommandEvent
event(wxEVT_COMMAND_TEXT_ENTER
);
913 event
.SetId(tw
->GetId());
914 event
.SetEventObject(tw
);
915 tw
->ProcessCommand(event
);
918 void wxTextCtrl::OnCut(wxCommandEvent
& WXUNUSED(event
))
923 void wxTextCtrl::OnCopy(wxCommandEvent
& WXUNUSED(event
))
928 void wxTextCtrl::OnPaste(wxCommandEvent
& WXUNUSED(event
))
933 void wxTextCtrl::OnUndo(wxCommandEvent
& WXUNUSED(event
))
938 void wxTextCtrl::OnRedo(wxCommandEvent
& WXUNUSED(event
))
943 void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent
& event
)
945 event
.Enable( CanCut() );
948 void wxTextCtrl::OnUpdateCopy(wxUpdateUIEvent
& event
)
950 event
.Enable( CanCopy() );
953 void wxTextCtrl::OnUpdatePaste(wxUpdateUIEvent
& event
)
955 event
.Enable( CanPaste() );
958 void wxTextCtrl::OnUpdateUndo(wxUpdateUIEvent
& event
)
960 event
.Enable( CanUndo() );
963 void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent
& event
)
965 event
.Enable( CanRedo() );