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
,
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
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
, (char *)value
.c_str(),
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
, (char *)value
.c_str(),
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 (char*) (const char*) value
);
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 ((char*) (const char*) file
, &statb
) == -1) || (statb
.st_mode
& S_IFMT
) != S_IFREG
||
398 !(fp
= fopen ((char*) (const char*) file
, "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 ((char*) (const char*) theFile
, "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(), (char*) (const char*) text
);
467 XtVaSetValues ((Widget
) m_mainWidget
, XmNcursorPosition
, textPosition
, NULL
);
468 SetInsertionPoint(textPosition
);
469 XmTextShowPosition ((Widget
) m_mainWidget
, textPosition
);
473 void wxTextCtrl::AppendText(const wxString
& text
)
475 long textPosition
= GetLastPosition() + strlen(text
);
476 XmTextInsert ((Widget
) m_mainWidget
, GetLastPosition(), (char*) (const char*) text
);
477 XtVaSetValues ((Widget
) m_mainWidget
, XmNcursorPosition
, textPosition
, NULL
);
478 SetInsertionPoint(textPosition
);
479 XmTextShowPosition ((Widget
) m_mainWidget
, textPosition
);
483 void wxTextCtrl::Clear()
485 XmTextSetString ((Widget
) m_mainWidget
, "");
489 bool wxTextCtrl::IsModified() const
494 // Makes 'unmodified'
495 void wxTextCtrl::DiscardEdits()
500 int wxTextCtrl::GetNumberOfLines() const
502 // HIDEOUSLY inefficient, but we have no choice.
503 char *s
= XmTextGetString ((Widget
) m_mainWidget
);
508 bool finished
= FALSE
;
531 long wxTextCtrl::XYToPosition(long x
, long y
) const
533 /* It seems, that there is a bug in some versions of the Motif library,
534 so the original wxWin-Code doesn't work. */
536 Widget textWidget = (Widget) handle;
537 return (long) XmTextXYToPos (textWidget, (Position) x, (Position) y);
539 /* Now a little workaround: */
541 for (int i
=0; i
<y
; i
++) r
+=(GetLineLength(i
)+1);
545 bool wxTextCtrl::PositionToXY(long pos
, long *x
, long *y
) const
548 XmTextPosToXY((Widget
) m_mainWidget
, pos
, &xx
, &yy
);
557 void wxTextCtrl::ShowPosition(long pos
)
559 XmTextShowPosition ((Widget
) m_mainWidget
, (XmTextPosition
) pos
);
562 int wxTextCtrl::GetLineLength(long lineNo
) const
564 wxString str
= GetLineText (lineNo
);
565 return (int) str
.Length();
568 wxString
wxTextCtrl::GetLineText(long lineNo
) const
570 // HIDEOUSLY inefficient, but we have no choice.
571 char *s
= XmTextGetString ((Widget
) m_mainWidget
);
578 for (i
= 0; currentLine
!= lineNo
&& s
[i
]; i
++ )
583 for (j
= 0; s
[i
] && s
[i
] != '\n'; i
++, j
++ )
590 return wxEmptyString
;
597 void wxTextCtrl::Command(wxCommandEvent
& event
)
599 SetValue (event
.GetString());
600 ProcessCommand (event
);
603 void wxTextCtrl::OnDropFiles(wxDropFilesEvent
& event
)
605 // By default, load the first file into the text window.
606 if (event
.GetNumberOfFiles() > 0)
608 LoadFile(event
.GetFiles()[0]);
612 void wxTextCtrl::OnChar(wxKeyEvent
& event
)
614 // Indicates that we should generate a normal command, because
615 // we're letting default behaviour happen (otherwise it's vetoed
616 // by virtue of overriding OnChar)
617 m_processedDefault
= TRUE
;
619 if (m_tempCallbackStruct
)
621 XmTextVerifyCallbackStruct
*textStruct
=
622 (XmTextVerifyCallbackStruct
*) m_tempCallbackStruct
;
623 textStruct
->doit
= True
;
624 if (isascii(event
.m_keyCode
) && (textStruct
->text
->length
== 1))
626 textStruct
->text
->ptr
[0] = ((event
.m_keyCode
== WXK_RETURN
) ? 10 : event
.m_keyCode
);
631 void wxTextCtrl::ChangeFont(bool keepOriginalSize
)
633 wxWindow::ChangeFont(keepOriginalSize
);
636 void wxTextCtrl::ChangeBackgroundColour()
638 wxWindow::ChangeBackgroundColour();
640 /* TODO: should scrollbars be affected? Should probably have separate
641 * function to change them (by default, taken from wxSystemSettings)
643 if (m_windowStyle
& wxTE_MULTILINE
)
645 Widget parent
= XtParent ((Widget
) m_mainWidget
);
648 XtVaGetValues (parent
,
649 XmNhorizontalScrollBar
, &hsb
,
650 XmNverticalScrollBar
, &vsb
,
652 wxColour backgroundColour
= wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE
);
654 DoChangeBackgroundColour((WXWidget
) hsb
, backgroundColour
, TRUE
);
656 DoChangeBackgroundColour((WXWidget
) vsb
, backgroundColour
, TRUE
);
658 // MBN: why change parent background?
659 // DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE);
663 void wxTextCtrl::ChangeForegroundColour()
665 wxWindow::ChangeForegroundColour();
667 if (m_windowStyle
& wxTE_MULTILINE
)
669 Widget parent
= XtParent ((Widget
) m_mainWidget
);
672 XtVaGetValues (parent
,
673 XmNhorizontalScrollBar
, &hsb
,
674 XmNverticalScrollBar
, &vsb
,
677 /* TODO: should scrollbars be affected? Should probably have separate
678 * function to change them (by default, taken from wxSystemSettings)
680 DoChangeForegroundColour((WXWidget) hsb, m_foregroundColour);
682 DoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
684 DoChangeForegroundColour((WXWidget
) parent
, m_foregroundColour
);
688 void wxTextCtrl::DoSendEvents(void *wxcbs
, long keycode
)
690 // we're in process of updating the text control
691 m_tempCallbackStruct
= wxcbs
;
693 XmTextVerifyCallbackStruct
*cbs
= (XmTextVerifyCallbackStruct
*)wxcbs
;
695 wxKeyEvent
event (wxEVT_CHAR
);
696 event
.SetId(GetId());
697 event
.m_keyCode
= keycode
;
698 event
.SetEventObject(this);
700 // Only if wxTextCtrl::OnChar is called will this be set to True (and
701 // the character passed through)
704 GetEventHandler()->ProcessEvent(event
);
706 if ( !InSetValue() && m_processedDefault
)
708 // Can generate a command
709 wxCommandEvent
commandEvent(wxEVT_COMMAND_TEXT_UPDATED
, GetId());
710 commandEvent
.SetEventObject(this);
711 ProcessCommand(commandEvent
);
714 // do it after the (user) event handlers processed the events because
715 // otherwise GetValue() would return incorrect (not yet updated value)
716 m_tempCallbackStruct
= NULL
;
719 wxSize
wxDoGetSingleTextCtrlBestSize( Widget textWidget
,
720 const wxWindow
* window
)
722 Dimension xmargin
, ymargin
, highlight
, shadow
;
725 XtVaGetValues( textWidget
,
726 XmNmarginWidth
, &xmargin
,
727 XmNmarginHeight
, &ymargin
,
729 XmNhighlightThickness
, &highlight
,
730 XmNshadowThickness
, &shadow
,
737 window
->GetTextExtent( value
, &x
, &y
);
739 if( x
< 100 ) x
= 100;
741 return wxSize( x
+ 2 * xmargin
+ 2 * highlight
+ 2 * shadow
,
742 // MBN: +2 necessary: Lesstif bug or mine?
743 y
+ 2 * ymargin
+ 2 * highlight
+ 2 * shadow
+ 2 );
746 wxSize
wxTextCtrl::DoGetBestSize() const
749 return wxDoGetSingleTextCtrlBestSize( (Widget
)m_mainWidget
, this );
751 return wxWindow::DoGetBestSize();
754 // ----------------------------------------------------------------------------
755 // helpers and Motif callbacks
756 // ----------------------------------------------------------------------------
758 static void MergeChangesIntoString(wxString
& value
,
759 XmTextVerifyCallbackStruct
*cbs
)
762 * At least on my system (SunOS 4.1.3 + Motif 1.2), you need to think of
763 * every event as a replace event. cbs->text->ptr gives the replacement
764 * text, cbs->startPos gives the index of the first char affected by the
765 * replace, and cbs->endPos gives the index one more than the last char
766 * affected by the replace (startPos == endPos implies an empty range).
767 * Hence, a deletion is represented by replacing all input text with a
768 * blank string ("", *not* NULL!). A simple insertion that does not
769 * overwrite any text has startPos == endPos.
774 // easy case: the ol value was empty
775 value
= cbs
->text
->ptr
;
779 // merge the changes into the value
780 const char * const passwd
= value
;
781 int len
= value
.length();
783 len
+= ( cbs
->text
->ptr
?
784 strlen(cbs
->text
->ptr
) :
785 0 ) + 1; // + new text (if any) + NUL
786 len
-= cbs
->endPos
- cbs
->startPos
; // - text from affected region.
788 char * newS
= new char [len
];
790 * insert
= cbs
->text
->ptr
;
792 // Copy (old) text from passwd, up to the start posn of the change.
794 const char * p
= passwd
;
795 for (i
= 0; i
< cbs
->startPos
; ++i
)
798 // Copy the text to be inserted).
803 // Finally, copy into newS any remaining text from passwd[endPos] on.
804 for (p
= passwd
+ cbs
->endPos
; *p
; )
815 wxTextWindowChangedProc (Widget w
, XtPointer clientData
, XtPointer
WXUNUSED(ptr
))
817 if (!wxGetWindowFromTable(w
))
818 // Widget has been deleted!
821 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
822 tw
->SetModified(TRUE
);
826 wxTextWindowModifyProc (Widget
WXUNUSED(w
), XtPointer clientData
, XmTextVerifyCallbackStruct
*cbs
)
828 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
829 tw
->m_processedDefault
= FALSE
;
831 // First, do some stuff if it's a password control: in this case, we need
832 // to store the string inside the class because GetValue() can't retrieve
833 // it from the text ctrl. We do *not* do it in other circumstances because
834 // it would double the amount of memory needed.
836 if ( tw
->GetWindowStyleFlag() & wxTE_PASSWORD
)
838 MergeChangesIntoString(tw
->m_value
, cbs
);
840 if ( cbs
->text
->length
> 0 )
843 for (i
= 0; i
< cbs
->text
->length
; ++i
)
844 cbs
->text
->ptr
[i
] = '*';
845 cbs
->text
->ptr
[i
] = '\0';
849 // If we're already within an OnChar, return: probably a programmatic
851 if (tw
->m_tempCallbackStruct
)
854 // Check for a backspace
855 if (cbs
->startPos
== (cbs
->currInsert
- 1))
857 tw
->DoSendEvents((void *)cbs
, WXK_DELETE
);
862 // Pasting operation: let it through without calling OnChar
863 if (cbs
->text
->length
> 1)
866 // Something other than text
867 if (cbs
->text
->ptr
== NULL
)
871 char ch
= cbs
->text
->ptr
[0];
872 tw
->DoSendEvents((void *)cbs
, ch
== '\n' ? '\r' : ch
);
876 wxTextWindowGainFocusProc (Widget w
, XtPointer clientData
, XmAnyCallbackStruct
*WXUNUSED(cbs
))
878 if (!wxGetWindowFromTable(w
))
881 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
882 wxFocusEvent
event(wxEVT_SET_FOCUS
, tw
->GetId());
883 event
.SetEventObject(tw
);
884 tw
->GetEventHandler()->ProcessEvent(event
);
888 wxTextWindowLoseFocusProc (Widget w
, XtPointer clientData
, XmAnyCallbackStruct
*WXUNUSED(cbs
))
890 if (!wxGetWindowFromTable(w
))
893 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
894 wxFocusEvent
event(wxEVT_KILL_FOCUS
, tw
->GetId());
895 event
.SetEventObject(tw
);
896 tw
->GetEventHandler()->ProcessEvent(event
);
899 static void wxTextWindowActivateProc(Widget w
, XtPointer clientData
,
900 XmAnyCallbackStruct
*WXUNUSED(ptr
))
902 if (!wxGetWindowFromTable(w
))
905 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
907 if (tw
->InSetValue())
910 wxCommandEvent
event(wxEVT_COMMAND_TEXT_ENTER
);
911 event
.SetId(tw
->GetId());
912 event
.SetEventObject(tw
);
913 tw
->ProcessCommand(event
);
916 void wxTextCtrl::OnCut(wxCommandEvent
& WXUNUSED(event
))
921 void wxTextCtrl::OnCopy(wxCommandEvent
& WXUNUSED(event
))
926 void wxTextCtrl::OnPaste(wxCommandEvent
& WXUNUSED(event
))
931 void wxTextCtrl::OnUndo(wxCommandEvent
& WXUNUSED(event
))
936 void wxTextCtrl::OnRedo(wxCommandEvent
& WXUNUSED(event
))
941 void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent
& event
)
943 event
.Enable( CanCut() );
946 void wxTextCtrl::OnUpdateCopy(wxUpdateUIEvent
& event
)
948 event
.Enable( CanCopy() );
951 void wxTextCtrl::OnUpdatePaste(wxUpdateUIEvent
& event
)
953 event
.Enable( CanPaste() );
956 void wxTextCtrl::OnUpdateUndo(wxUpdateUIEvent
& event
)
958 event
.Enable( CanUndo() );
961 void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent
& event
)
963 event
.Enable( CanRedo() );