]> git.saurik.com Git - wxWidgets.git/blob - src/motif/textctrl.cpp
fix crash in wxExecuteModule::OnExit() (never noticed before because it wasn't execut...
[wxWidgets.git] / src / motif / textctrl.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/motif/textctrl.cpp
3 // Purpose: wxTextCtrl
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #include <sys/types.h>
24 #include <sys/stat.h>
25 #include <ctype.h>
26
27 #include "wx/textctrl.h"
28
29 #ifndef WX_PRECOMP
30 #include "wx/utils.h"
31 #include "wx/settings.h"
32 #endif
33
34 #include "wx/filefn.h"
35
36 #ifdef __VMS__
37 #pragma message disable nosimpint
38 #endif
39 #include <Xm/Text.h>
40 #ifdef __VMS__
41 #pragma message enable nosimpint
42 #endif
43
44 #include "wx/motif/private.h"
45
46 // ----------------------------------------------------------------------------
47 // private functions
48 // ----------------------------------------------------------------------------
49
50 // helper: inserts the new text in the value of the text ctrl and returns the
51 // result in place
52 static void MergeChangesIntoString(wxString& value,
53 XmTextVerifyCallbackStruct *textStruct);
54
55 // callbacks
56 static void wxTextWindowChangedProc(Widget w, XtPointer clientData, XtPointer ptr);
57 static void wxTextWindowModifyProc(Widget w, XtPointer clientData, XmTextVerifyCallbackStruct *cbs);
58 static void wxTextWindowGainFocusProc(Widget w, XtPointer clientData, XmAnyCallbackStruct *cbs);
59 static void wxTextWindowLoseFocusProc(Widget w, XtPointer clientData, XmAnyCallbackStruct *cbs);
60 static void wxTextWindowActivateProc(Widget w, XtPointer clientData, XmAnyCallbackStruct *ptr);
61
62 IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxTextCtrlBase)
63
64 BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase)
65 EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
66 EVT_CHAR(wxTextCtrl::OnChar)
67
68 EVT_MENU(wxID_CUT, wxTextCtrl::OnCut)
69 EVT_MENU(wxID_COPY, wxTextCtrl::OnCopy)
70 EVT_MENU(wxID_PASTE, wxTextCtrl::OnPaste)
71 EVT_MENU(wxID_UNDO, wxTextCtrl::OnUndo)
72 EVT_MENU(wxID_REDO, wxTextCtrl::OnRedo)
73
74 EVT_UPDATE_UI(wxID_CUT, wxTextCtrl::OnUpdateCut)
75 EVT_UPDATE_UI(wxID_COPY, wxTextCtrl::OnUpdateCopy)
76 EVT_UPDATE_UI(wxID_PASTE, wxTextCtrl::OnUpdatePaste)
77 EVT_UPDATE_UI(wxID_UNDO, wxTextCtrl::OnUpdateUndo)
78 EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo)
79
80 END_EVENT_TABLE()
81
82 // ============================================================================
83 // implementation
84 // ============================================================================
85
86 // ----------------------------------------------------------------------------
87 // wxTextCtrl
88 // ----------------------------------------------------------------------------
89
90 // Text item
91 wxTextCtrl::wxTextCtrl()
92 {
93 m_tempCallbackStruct = (void*) NULL;
94 m_modified = false;
95 m_processedDefault = false;
96 }
97
98 bool wxTextCtrl::Create(wxWindow *parent,
99 wxWindowID id,
100 const wxString& value,
101 const wxPoint& pos,
102 const wxSize& size,
103 long style,
104 const wxValidator& validator,
105 const wxString& name)
106 {
107 if( !CreateControl( parent, id, pos, size, style, validator, name ) )
108 return false;
109 PreCreation();
110
111 m_tempCallbackStruct = (void*) NULL;
112 m_modified = false;
113 m_processedDefault = false;
114
115 Widget parentWidget = (Widget) parent->GetClientWidget();
116
117 Bool wantHorizScroll = (m_windowStyle & wxHSCROLL) != 0 ? True : False;
118 // If we don't have horizontal scrollbars, we want word wrap.
119 // OpenMotif 2.1 crashes if wantWordWrap is True in Japanese
120 // locale (and probably other multibyte locales). The check might be
121 // more precise
122 #if wxCHECK_LESSTIF() || wxCHECK_MOTIF_VERSION( 2, 2 )
123 Bool wantWordWrap = wantHorizScroll == True ? False : True;
124 #else
125 Bool wantWordWrap = False;
126 #endif
127
128 if (m_windowStyle & wxTE_MULTILINE)
129 {
130 Arg args[8];
131 int count = 0;
132 XtSetArg (args[count], XmNscrollHorizontal, wantHorizScroll); ++count;
133 if( m_font.IsOk() )
134 XtSetArg (args[count], (String) wxFont::GetFontTag(),
135 m_font.GetFontType( XtDisplay(parentWidget) ) ); ++count;
136 XtSetArg (args[count], XmNwordWrap, wantWordWrap); ++count;
137 XtSetArg (args[count], XmNvalue, (const char*)value.mb_str()); ++count;
138 XtSetArg (args[count], XmNeditable,
139 style & wxTE_READONLY ? False : True); ++count;
140 XtSetArg (args[count], XmNeditMode, XmMULTI_LINE_EDIT ); ++count;
141
142 m_mainWidget =
143 (WXWidget) XmCreateScrolledText(parentWidget,
144 name.char_str(),
145 args, count);
146
147 XtManageChild ((Widget) m_mainWidget);
148 }
149 else
150 {
151 m_mainWidget = (WXWidget)XtVaCreateManagedWidget
152 (
153 name.mb_str(),
154 xmTextWidgetClass,
155 parentWidget,
156 wxFont::GetFontTag(), m_font.GetFontType( XtDisplay(parentWidget) ),
157 XmNvalue, (const char*)value.mb_str(),
158 XmNeditable, (style & wxTE_READONLY) ?
159 False : True,
160 NULL
161 );
162
163 #if 0
164 // TODO: Is this relevant? What does it do?
165 int noCols = 2;
166 if (!value.IsNull() && (value.length() > (unsigned int) noCols))
167 noCols = value.length();
168 XtVaSetValues((Widget) m_mainWidget,
169 XmNcolumns, noCols,
170 NULL);
171 #endif
172 }
173
174 // remove border if asked for
175 if ( style & wxNO_BORDER )
176 {
177 XtVaSetValues((Widget)m_mainWidget,
178 XmNshadowThickness, 0,
179 NULL);
180 }
181
182 // install callbacks
183 XtAddCallback((Widget) m_mainWidget, XmNvalueChangedCallback, (XtCallbackProc)wxTextWindowChangedProc, (XtPointer)this);
184
185 XtAddCallback((Widget) m_mainWidget, XmNmodifyVerifyCallback, (XtCallbackProc)wxTextWindowModifyProc, (XtPointer)this);
186
187 XtAddCallback((Widget) m_mainWidget, XmNactivateCallback, (XtCallbackProc)wxTextWindowActivateProc, (XtPointer)this);
188
189 XtAddCallback((Widget) m_mainWidget, XmNfocusCallback, (XtCallbackProc)wxTextWindowGainFocusProc, (XtPointer)this);
190
191 XtAddCallback((Widget) m_mainWidget, XmNlosingFocusCallback, (XtCallbackProc)wxTextWindowLoseFocusProc, (XtPointer)this);
192
193 PostCreation();
194 AttachWidget (parent, m_mainWidget, (WXWidget) NULL,
195 pos.x, pos.y, size.x, size.y);
196
197 return true;
198 }
199
200 WXWidget wxTextCtrl::GetTopWidget() const
201 {
202 return IsMultiLine() ? (WXWidget)XtParent((Widget)m_mainWidget)
203 : m_mainWidget;
204 }
205
206 wxString wxTextCtrl::GetValue() const
207 {
208 wxString str; // result
209
210 if (m_windowStyle & wxTE_PASSWORD)
211 {
212 // the value is stored always in m_value because it can't be retrieved
213 // from the text control
214 str = m_value;
215 }
216 else
217 {
218 str = wxTextEntry::GetValue();
219
220 if ( m_tempCallbackStruct )
221 {
222 // the string in the control isn't yet updated, can't use it as is
223 MergeChangesIntoString(str, (XmTextVerifyCallbackStruct *)
224 m_tempCallbackStruct);
225 }
226 }
227
228 return str;
229 }
230
231 void wxTextCtrl::DoSetValue(const wxString& text, int flags)
232 {
233 m_inSetValue = true;
234
235 XmTextSetString ((Widget) m_mainWidget, text.char_str());
236 XtVaSetValues ((Widget) m_mainWidget,
237 XmNcursorPosition, text.length(),
238 NULL);
239
240 SetInsertionPoint(text.length());
241 XmTextShowPosition ((Widget) m_mainWidget, text.length());
242 m_modified = true;
243
244 m_inSetValue = false;
245
246 if ( flags & SetValue_SendEvent )
247 SendTextUpdatedEvent();
248 }
249
250 bool wxTextCtrl::IsModified() const
251 {
252 return m_modified;
253 }
254
255 // Makes modified or unmodified
256 void wxTextCtrl::MarkDirty()
257 {
258 m_modified = true;
259 }
260
261 void wxTextCtrl::DiscardEdits()
262 {
263 m_modified = false;
264 }
265
266 int wxTextCtrl::GetNumberOfLines() const
267 {
268 // HIDEOUSLY inefficient, but we have no choice.
269 char *s = XmTextGetString ((Widget) m_mainWidget);
270 if (s)
271 {
272 long i = 0;
273 int currentLine = 0;
274 bool finished = false;
275 while (!finished)
276 {
277 int ch = s[i];
278 if (ch == '\n')
279 {
280 currentLine++;
281 i++;
282 }
283 else if (ch == 0)
284 {
285 finished = true;
286 }
287 else
288 i++;
289 }
290
291 XtFree (s);
292 return currentLine;
293 }
294 return 0;
295 }
296
297 long wxTextCtrl::XYToPosition(long x, long y) const
298 {
299 /* It seems, that there is a bug in some versions of the Motif library,
300 so the original wxWin-Code doesn't work. */
301 /*
302 Widget textWidget = (Widget) handle;
303 return (long) XmTextXYToPos (textWidget, (Position) x, (Position) y);
304 */
305 /* Now a little workaround: */
306 long r=0;
307 for (int i=0; i<y; i++) r+=(GetLineLength(i)+1);
308 return r+x;
309 }
310
311 bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
312 {
313 Position xx, yy;
314 XmTextPosToXY((Widget) m_mainWidget, pos, &xx, &yy);
315 if ( x )
316 *x = xx;
317 if ( y )
318 *y = yy;
319
320 return true;
321 }
322
323 void wxTextCtrl::ShowPosition(long pos)
324 {
325 XmTextShowPosition ((Widget) m_mainWidget, (XmTextPosition) pos);
326 }
327
328 int wxTextCtrl::GetLineLength(long lineNo) const
329 {
330 wxString str = GetLineText (lineNo);
331 return (int) str.length();
332 }
333
334 wxString wxTextCtrl::GetLineText(long lineNo) const
335 {
336 // HIDEOUSLY inefficient, but we have no choice.
337 char *s = XmTextGetString ((Widget) m_mainWidget);
338
339 if (s)
340 {
341 wxString buf;
342 long i;
343 int currentLine = 0;
344 for (i = 0; currentLine != lineNo && s[i]; i++ )
345 if (s[i] == '\n')
346 currentLine++;
347 // Now get the text
348 int j;
349 for (j = 0; s[i] && s[i] != '\n'; i++, j++ )
350 buf += s[i];
351
352 XtFree(s);
353 return buf;
354 }
355 else
356 return wxEmptyString;
357 }
358
359 /*
360 * Text item
361 */
362
363 void wxTextCtrl::Command(wxCommandEvent & event)
364 {
365 SetValue (event.GetString());
366 ProcessCommand (event);
367 }
368
369 void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event)
370 {
371 // By default, load the first file into the text window.
372 if (event.GetNumberOfFiles() > 0)
373 {
374 LoadFile(event.GetFiles()[0]);
375 }
376 }
377
378 void wxTextCtrl::OnChar(wxKeyEvent& event)
379 {
380 // Indicates that we should generate a normal command, because
381 // we're letting default behaviour happen (otherwise it's vetoed
382 // by virtue of overriding OnChar)
383 m_processedDefault = true;
384
385 if (m_tempCallbackStruct)
386 {
387 XmTextVerifyCallbackStruct *textStruct =
388 (XmTextVerifyCallbackStruct *) m_tempCallbackStruct;
389 textStruct->doit = True;
390 if (isascii(event.m_keyCode) && (textStruct->text->length == 1))
391 {
392 textStruct->text->ptr[0] = (char)((event.m_keyCode == WXK_RETURN) ? 10 : event.m_keyCode);
393 }
394 }
395 }
396
397 void wxTextCtrl::ChangeFont(bool keepOriginalSize)
398 {
399 wxWindow::ChangeFont(keepOriginalSize);
400 }
401
402 void wxTextCtrl::ChangeBackgroundColour()
403 {
404 wxWindow::ChangeBackgroundColour();
405
406 /* TODO: should scrollbars be affected? Should probably have separate
407 * function to change them (by default, taken from wxSystemSettings)
408 */
409 if (m_windowStyle & wxTE_MULTILINE)
410 {
411 Widget parent = XtParent ((Widget) m_mainWidget);
412 Widget hsb, vsb;
413
414 XtVaGetValues (parent,
415 XmNhorizontalScrollBar, &hsb,
416 XmNverticalScrollBar, &vsb,
417 NULL);
418 wxColour backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
419 if (hsb)
420 wxDoChangeBackgroundColour((WXWidget) hsb, backgroundColour, true);
421 if (vsb)
422 wxDoChangeBackgroundColour((WXWidget) vsb, backgroundColour, true);
423
424 // MBN: why change parent background?
425 // DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, true);
426 }
427 }
428
429 void wxTextCtrl::ChangeForegroundColour()
430 {
431 wxWindow::ChangeForegroundColour();
432
433 if (m_windowStyle & wxTE_MULTILINE)
434 {
435 Widget parent = XtParent ((Widget) m_mainWidget);
436 Widget hsb, vsb;
437
438 XtVaGetValues (parent,
439 XmNhorizontalScrollBar, &hsb,
440 XmNverticalScrollBar, &vsb,
441 NULL);
442
443 /* TODO: should scrollbars be affected? Should probably have separate
444 * function to change them (by default, taken from wxSystemSettings)
445 if (hsb)
446 DoChangeForegroundColour((WXWidget) hsb, m_foregroundColour);
447 if (vsb)
448 DoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
449 */
450 wxDoChangeForegroundColour((WXWidget) parent, m_foregroundColour);
451 }
452 }
453
454 void wxTextCtrl::DoSendEvents(void *wxcbs, long keycode)
455 {
456 // we're in process of updating the text control
457 m_tempCallbackStruct = wxcbs;
458
459 XmTextVerifyCallbackStruct *cbs = (XmTextVerifyCallbackStruct *)wxcbs;
460
461 wxKeyEvent event (wxEVT_CHAR);
462 event.SetId(GetId());
463 event.m_keyCode = keycode;
464 event.SetEventObject(this);
465
466 // Only if wxTextCtrl::OnChar is called will this be set to True (and
467 // the character passed through)
468 cbs->doit = False;
469
470 HandleWindowEvent(event);
471
472 if ( !InSetValue() && m_processedDefault )
473 {
474 // Can generate a command
475 wxCommandEvent commandEvent(wxEVT_COMMAND_TEXT_UPDATED, GetId());
476 commandEvent.SetEventObject(this);
477 ProcessCommand(commandEvent);
478 }
479
480 // do it after the (user) event handlers processed the events because
481 // otherwise GetValue() would return incorrect (not yet updated value)
482 m_tempCallbackStruct = NULL;
483 }
484
485 wxSize wxDoGetSingleTextCtrlBestSize( Widget textWidget,
486 const wxWindow* window )
487 {
488 Dimension xmargin, ymargin, highlight, shadow;
489 char* value;
490
491 XtVaGetValues( textWidget,
492 XmNmarginWidth, &xmargin,
493 XmNmarginHeight, &ymargin,
494 XmNvalue, &value,
495 XmNhighlightThickness, &highlight,
496 XmNshadowThickness, &shadow,
497 NULL );
498
499 if( !value )
500 value = wxMOTIF_STR("|");
501
502 int x, y;
503 window->GetTextExtent( value, &x, &y );
504
505 if( x < 90 )
506 x = 90;
507
508 return wxSize( x + 2 * xmargin + 2 * highlight + 2 * shadow,
509 // MBN: +2 necessary: Lesstif bug or mine?
510 y + 2 * ymargin + 2 * highlight + 2 * shadow + 2 );
511 }
512
513 wxSize wxTextCtrl::DoGetBestSize() const
514 {
515 if( IsSingleLine() )
516 {
517 wxSize best = wxControl::DoGetBestSize();
518 #if wxCHECK_MOTIF_VERSION( 2, 3 )
519 // OpenMotif 2.3 gives way too big X sizes
520 wxSize other_best = wxDoGetSingleTextCtrlBestSize
521 ( (Widget) GetTopWidget(), this );
522 return wxSize( other_best.x, best.y );
523 #else
524 if( best.x < 90 ) best.x = 90;
525
526 return best;
527 #endif
528 }
529 else
530 return wxWindow::DoGetBestSize();
531 }
532
533 // ----------------------------------------------------------------------------
534 // helpers and Motif callbacks
535 // ----------------------------------------------------------------------------
536
537 static void MergeChangesIntoString(wxString& value,
538 XmTextVerifyCallbackStruct *cbs)
539 {
540 /* _sm_
541 * At least on my system (SunOS 4.1.3 + Motif 1.2), you need to think of
542 * every event as a replace event. cbs->text->ptr gives the replacement
543 * text, cbs->startPos gives the index of the first char affected by the
544 * replace, and cbs->endPos gives the index one more than the last char
545 * affected by the replace (startPos == endPos implies an empty range).
546 * Hence, a deletion is represented by replacing all input text with a
547 * blank string ("", *not* NULL!). A simple insertion that does not
548 * overwrite any text has startPos == endPos.
549 */
550
551 if ( !value )
552 {
553 // easy case: the ol value was empty
554 value = cbs->text->ptr;
555 }
556 else
557 {
558 // merge the changes into the value
559 const char * const passwd = value;
560 int len = value.length();
561
562 len += ( cbs->text->ptr ?
563 strlen(cbs->text->ptr) :
564 0 ) + 1; // + new text (if any) + NUL
565 len -= cbs->endPos - cbs->startPos; // - text from affected region.
566
567 char * newS = new char [len];
568 char * dest = newS,
569 * insert = cbs->text->ptr;
570
571 // Copy (old) text from passwd, up to the start posn of the change.
572 int i;
573 const char * p = passwd;
574 for (i = 0; i < cbs->startPos; ++i)
575 *dest++ = *p++;
576
577 // Copy the text to be inserted).
578 if (insert)
579 while (*insert)
580 *dest++ = *insert++;
581
582 // Finally, copy into newS any remaining text from passwd[endPos] on.
583 for (p = passwd + cbs->endPos; *p; )
584 *dest++ = *p++;
585 *dest = 0;
586
587 value = newS;
588
589 delete[] newS;
590 }
591 }
592
593 static void
594 wxTextWindowChangedProc (Widget w, XtPointer clientData, XtPointer WXUNUSED(ptr))
595 {
596 if (!wxGetWindowFromTable(w))
597 // Widget has been deleted!
598 return;
599
600 wxTextCtrl *tw = (wxTextCtrl *) clientData;
601 tw->SetModified(true);
602 }
603
604 static void
605 wxTextWindowModifyProc (Widget WXUNUSED(w), XtPointer clientData, XmTextVerifyCallbackStruct *cbs)
606 {
607 wxTextCtrl *tw = (wxTextCtrl *) clientData;
608 tw->m_processedDefault = false;
609
610 // First, do some stuff if it's a password control: in this case, we need
611 // to store the string inside the class because GetValue() can't retrieve
612 // it from the text ctrl. We do *not* do it in other circumstances because
613 // it would double the amount of memory needed.
614
615 if ( tw->GetWindowStyleFlag() & wxTE_PASSWORD )
616 {
617 MergeChangesIntoString(tw->m_value, cbs);
618
619 if ( cbs->text->length > 0 )
620 {
621 int i;
622 for (i = 0; i < cbs->text->length; ++i)
623 cbs->text->ptr[i] = '*';
624 cbs->text->ptr[i] = '\0';
625 }
626 }
627
628 if(tw->InSetValue())
629 return;
630
631 // If we're already within an OnChar, return: probably a programmatic
632 // insertion.
633 if (tw->m_tempCallbackStruct)
634 return;
635
636 // Check for a backspace
637 if (cbs->startPos == (cbs->currInsert - 1))
638 {
639 tw->DoSendEvents((void *)cbs, WXK_DELETE);
640
641 return;
642 }
643
644 // Pasting operation: let it through without calling OnChar
645 if (cbs->text->length > 1)
646 return;
647
648 // Something other than text
649 if (cbs->text->ptr == NULL)
650 return;
651
652 // normal key press
653 char ch = cbs->text->ptr[0];
654 tw->DoSendEvents((void *)cbs, ch == '\n' ? '\r' : ch);
655 }
656
657 static void
658 wxTextWindowGainFocusProc (Widget w, XtPointer clientData, XmAnyCallbackStruct *WXUNUSED(cbs))
659 {
660 if (!wxGetWindowFromTable(w))
661 return;
662
663 wxTextCtrl *tw = (wxTextCtrl *) clientData;
664 wxFocusEvent event(wxEVT_SET_FOCUS, tw->GetId());
665 event.SetEventObject(tw);
666 tw->HandleWindowEvent(event);
667 }
668
669 static void
670 wxTextWindowLoseFocusProc (Widget w, XtPointer clientData, XmAnyCallbackStruct *WXUNUSED(cbs))
671 {
672 if (!wxGetWindowFromTable(w))
673 return;
674
675 wxTextCtrl *tw = (wxTextCtrl *) clientData;
676 wxFocusEvent event(wxEVT_KILL_FOCUS, tw->GetId());
677 event.SetEventObject(tw);
678 tw->HandleWindowEvent(event);
679 }
680
681 static void wxTextWindowActivateProc(Widget w, XtPointer clientData,
682 XmAnyCallbackStruct *WXUNUSED(ptr))
683 {
684 if (!wxGetWindowFromTable(w))
685 return;
686
687 wxTextCtrl *tw = (wxTextCtrl *) clientData;
688
689 if (tw->InSetValue())
690 return;
691
692 wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER);
693 event.SetId(tw->GetId());
694 event.SetEventObject(tw);
695 tw->ProcessCommand(event);
696 }
697
698 void wxTextCtrl::OnCut(wxCommandEvent& WXUNUSED(event))
699 {
700 Cut();
701 }
702
703 void wxTextCtrl::OnCopy(wxCommandEvent& WXUNUSED(event))
704 {
705 Copy();
706 }
707
708 void wxTextCtrl::OnPaste(wxCommandEvent& WXUNUSED(event))
709 {
710 Paste();
711 }
712
713 void wxTextCtrl::OnUndo(wxCommandEvent& WXUNUSED(event))
714 {
715 Undo();
716 }
717
718 void wxTextCtrl::OnRedo(wxCommandEvent& WXUNUSED(event))
719 {
720 Redo();
721 }
722
723 void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent& event)
724 {
725 event.Enable( CanCut() );
726 }
727
728 void wxTextCtrl::OnUpdateCopy(wxUpdateUIEvent& event)
729 {
730 event.Enable( CanCopy() );
731 }
732
733 void wxTextCtrl::OnUpdatePaste(wxUpdateUIEvent& event)
734 {
735 event.Enable( CanPaste() );
736 }
737
738 void wxTextCtrl::OnUpdateUndo(wxUpdateUIEvent& event)
739 {
740 event.Enable( CanUndo() );
741 }
742
743 void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event)
744 {
745 event.Enable( CanRedo() );
746 }