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 IsMultiLine() ? (WXWidget
)XtParent((Widget
)m_mainWidget
)
215 wxString
wxTextCtrl::GetValue() const
217 wxString str
; // result
219 if (m_windowStyle
& wxTE_PASSWORD
)
221 // the value is stored always in m_value because it can't be retrieved
222 // from the text control
227 // just get the string from Motif
228 char *s
= XmTextGetString ((Widget
) m_mainWidget
);
234 //else: return empty string
236 if ( m_tempCallbackStruct
)
238 // the string in the control isn't yet updated, can't use it as is
239 MergeChangesIntoString(str
, (XmTextVerifyCallbackStruct
*)
240 m_tempCallbackStruct
);
247 void wxTextCtrl::SetValue(const wxString
& value
)
251 // do this instead... MB
253 // with (at least) OpenMotif 2.1 this causes a lot of flicker
255 XtVaSetValues( (Widget
) m_mainWidget
,
256 XmNvalue
, wxConstCast(value
.c_str(), char),
263 m_inSetValue
= FALSE
;
266 // Clipboard operations
267 void wxTextCtrl::Copy()
269 XmTextCopy((Widget
) m_mainWidget
, CurrentTime
);
272 void wxTextCtrl::Cut()
274 XmTextCut((Widget
) m_mainWidget
, CurrentTime
);
277 void wxTextCtrl::Paste()
279 XmTextPaste((Widget
) m_mainWidget
);
282 bool wxTextCtrl::CanCopy() const
284 // Can copy if there's a selection
286 GetSelection(& from
, & to
);
287 return (from
!= to
) ;
290 bool wxTextCtrl::CanCut() const
292 // Can cut if there's a selection
294 GetSelection(& from
, & to
);
295 return (from
!= to
) && (IsEditable());
298 bool wxTextCtrl::CanPaste() const
300 return IsEditable() ;
304 void wxTextCtrl::Undo()
306 // Not possible in Motif
309 void wxTextCtrl::Redo()
311 // Not possible in Motif
314 bool wxTextCtrl::CanUndo() const
320 bool wxTextCtrl::CanRedo() const
326 // If the return values from and to are the same, there is no
328 void wxTextCtrl::GetSelection(long* from
, long* to
) const
330 XmTextPosition left
, right
;
332 XmTextGetSelectionPosition((Widget
) m_mainWidget
, & left
, & right
);
338 bool wxTextCtrl::IsEditable() const
340 return (XmTextGetEditable((Widget
) m_mainWidget
) != 0);
343 void wxTextCtrl::SetEditable(bool editable
)
345 XmTextSetEditable((Widget
) m_mainWidget
, (Boolean
) editable
);
348 void wxTextCtrl::SetInsertionPoint(long pos
)
350 XmTextSetInsertionPosition ((Widget
) m_mainWidget
, (XmTextPosition
) pos
);
353 void wxTextCtrl::SetInsertionPointEnd()
355 long pos
= GetLastPosition();
356 SetInsertionPoint(pos
);
359 long wxTextCtrl::GetInsertionPoint() const
361 return (long) XmTextGetInsertionPosition ((Widget
) m_mainWidget
);
364 long wxTextCtrl::GetLastPosition() const
366 return (long) XmTextGetLastPosition ((Widget
) m_mainWidget
);
369 void wxTextCtrl::Replace(long from
, long to
, const wxString
& value
)
371 XmTextReplace ((Widget
) m_mainWidget
, (XmTextPosition
) from
, (XmTextPosition
) to
,
372 wxConstCast(value
.c_str(), char));
375 void wxTextCtrl::Remove(long from
, long to
)
377 XmTextSetSelection ((Widget
) m_mainWidget
, (XmTextPosition
) from
, (XmTextPosition
) to
,
379 XmTextRemove ((Widget
) m_mainWidget
);
382 void wxTextCtrl::SetSelection(long from
, long to
)
385 to
= GetLastPosition();
387 XmTextSetSelection ((Widget
) m_mainWidget
, (XmTextPosition
) from
, (XmTextPosition
) to
,
391 void wxTextCtrl::WriteText(const wxString
& text
)
393 long textPosition
= GetInsertionPoint() + strlen (text
);
394 XmTextInsert ((Widget
) m_mainWidget
, GetInsertionPoint(),
395 wxConstCast(text
.c_str(), char));
396 XtVaSetValues ((Widget
) m_mainWidget
, XmNcursorPosition
, textPosition
, NULL
);
397 SetInsertionPoint(textPosition
);
398 XmTextShowPosition ((Widget
) m_mainWidget
, textPosition
);
402 void wxTextCtrl::AppendText(const wxString
& text
)
404 long textPosition
= GetLastPosition() + strlen(text
);
405 XmTextInsert ((Widget
) m_mainWidget
, GetLastPosition(),
406 wxConstCast(text
.c_str(), char));
407 XtVaSetValues ((Widget
) m_mainWidget
, XmNcursorPosition
, textPosition
, NULL
);
408 SetInsertionPoint(textPosition
);
409 XmTextShowPosition ((Widget
) m_mainWidget
, textPosition
);
413 void wxTextCtrl::Clear()
415 XmTextSetString ((Widget
) m_mainWidget
, "");
419 bool wxTextCtrl::IsModified() const
424 // Makes 'unmodified'
425 void wxTextCtrl::DiscardEdits()
430 int wxTextCtrl::GetNumberOfLines() const
432 // HIDEOUSLY inefficient, but we have no choice.
433 char *s
= XmTextGetString ((Widget
) m_mainWidget
);
438 bool finished
= FALSE
;
461 long wxTextCtrl::XYToPosition(long x
, long y
) const
463 /* It seems, that there is a bug in some versions of the Motif library,
464 so the original wxWin-Code doesn't work. */
466 Widget textWidget = (Widget) handle;
467 return (long) XmTextXYToPos (textWidget, (Position) x, (Position) y);
469 /* Now a little workaround: */
471 for (int i
=0; i
<y
; i
++) r
+=(GetLineLength(i
)+1);
475 bool wxTextCtrl::PositionToXY(long pos
, long *x
, long *y
) const
478 XmTextPosToXY((Widget
) m_mainWidget
, pos
, &xx
, &yy
);
487 void wxTextCtrl::ShowPosition(long pos
)
489 XmTextShowPosition ((Widget
) m_mainWidget
, (XmTextPosition
) pos
);
492 int wxTextCtrl::GetLineLength(long lineNo
) const
494 wxString str
= GetLineText (lineNo
);
495 return (int) str
.Length();
498 wxString
wxTextCtrl::GetLineText(long lineNo
) const
500 // HIDEOUSLY inefficient, but we have no choice.
501 char *s
= XmTextGetString ((Widget
) m_mainWidget
);
508 for (i
= 0; currentLine
!= lineNo
&& s
[i
]; i
++ )
513 for (j
= 0; s
[i
] && s
[i
] != '\n'; i
++, j
++ )
520 return wxEmptyString
;
527 void wxTextCtrl::Command(wxCommandEvent
& event
)
529 SetValue (event
.GetString());
530 ProcessCommand (event
);
533 void wxTextCtrl::OnDropFiles(wxDropFilesEvent
& event
)
535 // By default, load the first file into the text window.
536 if (event
.GetNumberOfFiles() > 0)
538 LoadFile(event
.GetFiles()[0]);
542 void wxTextCtrl::OnChar(wxKeyEvent
& event
)
544 // Indicates that we should generate a normal command, because
545 // we're letting default behaviour happen (otherwise it's vetoed
546 // by virtue of overriding OnChar)
547 m_processedDefault
= TRUE
;
549 if (m_tempCallbackStruct
)
551 XmTextVerifyCallbackStruct
*textStruct
=
552 (XmTextVerifyCallbackStruct
*) m_tempCallbackStruct
;
553 textStruct
->doit
= True
;
554 if (isascii(event
.m_keyCode
) && (textStruct
->text
->length
== 1))
556 textStruct
->text
->ptr
[0] = ((event
.m_keyCode
== WXK_RETURN
) ? 10 : event
.m_keyCode
);
561 void wxTextCtrl::ChangeFont(bool keepOriginalSize
)
563 wxWindow::ChangeFont(keepOriginalSize
);
566 void wxTextCtrl::ChangeBackgroundColour()
568 wxWindow::ChangeBackgroundColour();
570 /* TODO: should scrollbars be affected? Should probably have separate
571 * function to change them (by default, taken from wxSystemSettings)
573 if (m_windowStyle
& wxTE_MULTILINE
)
575 Widget parent
= XtParent ((Widget
) m_mainWidget
);
578 XtVaGetValues (parent
,
579 XmNhorizontalScrollBar
, &hsb
,
580 XmNverticalScrollBar
, &vsb
,
582 wxColour backgroundColour
= wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE
);
584 DoChangeBackgroundColour((WXWidget
) hsb
, backgroundColour
, TRUE
);
586 DoChangeBackgroundColour((WXWidget
) vsb
, backgroundColour
, TRUE
);
588 // MBN: why change parent background?
589 // DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE);
593 void wxTextCtrl::ChangeForegroundColour()
595 wxWindow::ChangeForegroundColour();
597 if (m_windowStyle
& wxTE_MULTILINE
)
599 Widget parent
= XtParent ((Widget
) m_mainWidget
);
602 XtVaGetValues (parent
,
603 XmNhorizontalScrollBar
, &hsb
,
604 XmNverticalScrollBar
, &vsb
,
607 /* TODO: should scrollbars be affected? Should probably have separate
608 * function to change them (by default, taken from wxSystemSettings)
610 DoChangeForegroundColour((WXWidget) hsb, m_foregroundColour);
612 DoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
614 DoChangeForegroundColour((WXWidget
) parent
, m_foregroundColour
);
618 void wxTextCtrl::DoSendEvents(void *wxcbs
, long keycode
)
620 // we're in process of updating the text control
621 m_tempCallbackStruct
= wxcbs
;
623 XmTextVerifyCallbackStruct
*cbs
= (XmTextVerifyCallbackStruct
*)wxcbs
;
625 wxKeyEvent
event (wxEVT_CHAR
);
626 event
.SetId(GetId());
627 event
.m_keyCode
= keycode
;
628 event
.SetEventObject(this);
630 // Only if wxTextCtrl::OnChar is called will this be set to True (and
631 // the character passed through)
634 GetEventHandler()->ProcessEvent(event
);
636 if ( !InSetValue() && m_processedDefault
)
638 // Can generate a command
639 wxCommandEvent
commandEvent(wxEVT_COMMAND_TEXT_UPDATED
, GetId());
640 commandEvent
.SetEventObject(this);
641 ProcessCommand(commandEvent
);
644 // do it after the (user) event handlers processed the events because
645 // otherwise GetValue() would return incorrect (not yet updated value)
646 m_tempCallbackStruct
= NULL
;
649 wxSize
wxDoGetSingleTextCtrlBestSize( Widget textWidget
,
650 const wxWindow
* window
)
652 Dimension xmargin
, ymargin
, highlight
, shadow
;
655 XtVaGetValues( textWidget
,
656 XmNmarginWidth
, &xmargin
,
657 XmNmarginHeight
, &ymargin
,
659 XmNhighlightThickness
, &highlight
,
660 XmNshadowThickness
, &shadow
,
667 window
->GetTextExtent( value
, &x
, &y
);
669 if( x
< 100 ) x
= 100;
671 return wxSize( x
+ 2 * xmargin
+ 2 * highlight
+ 2 * shadow
,
672 // MBN: +2 necessary: Lesstif bug or mine?
673 y
+ 2 * ymargin
+ 2 * highlight
+ 2 * shadow
+ 2 );
676 wxSize
wxTextCtrl::DoGetBestSize() const
679 return wxDoGetSingleTextCtrlBestSize( (Widget
)m_mainWidget
, this );
681 return wxWindow::DoGetBestSize();
684 // ----------------------------------------------------------------------------
685 // helpers and Motif callbacks
686 // ----------------------------------------------------------------------------
688 static void MergeChangesIntoString(wxString
& value
,
689 XmTextVerifyCallbackStruct
*cbs
)
692 * At least on my system (SunOS 4.1.3 + Motif 1.2), you need to think of
693 * every event as a replace event. cbs->text->ptr gives the replacement
694 * text, cbs->startPos gives the index of the first char affected by the
695 * replace, and cbs->endPos gives the index one more than the last char
696 * affected by the replace (startPos == endPos implies an empty range).
697 * Hence, a deletion is represented by replacing all input text with a
698 * blank string ("", *not* NULL!). A simple insertion that does not
699 * overwrite any text has startPos == endPos.
704 // easy case: the ol value was empty
705 value
= cbs
->text
->ptr
;
709 // merge the changes into the value
710 const char * const passwd
= value
;
711 int len
= value
.length();
713 len
+= ( cbs
->text
->ptr
?
714 strlen(cbs
->text
->ptr
) :
715 0 ) + 1; // + new text (if any) + NUL
716 len
-= cbs
->endPos
- cbs
->startPos
; // - text from affected region.
718 char * newS
= new char [len
];
720 * insert
= cbs
->text
->ptr
;
722 // Copy (old) text from passwd, up to the start posn of the change.
724 const char * p
= passwd
;
725 for (i
= 0; i
< cbs
->startPos
; ++i
)
728 // Copy the text to be inserted).
733 // Finally, copy into newS any remaining text from passwd[endPos] on.
734 for (p
= passwd
+ cbs
->endPos
; *p
; )
745 wxTextWindowChangedProc (Widget w
, XtPointer clientData
, XtPointer
WXUNUSED(ptr
))
747 if (!wxGetWindowFromTable(w
))
748 // Widget has been deleted!
751 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
752 tw
->SetModified(TRUE
);
756 wxTextWindowModifyProc (Widget
WXUNUSED(w
), XtPointer clientData
, XmTextVerifyCallbackStruct
*cbs
)
758 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
759 tw
->m_processedDefault
= FALSE
;
761 // First, do some stuff if it's a password control: in this case, we need
762 // to store the string inside the class because GetValue() can't retrieve
763 // it from the text ctrl. We do *not* do it in other circumstances because
764 // it would double the amount of memory needed.
766 if ( tw
->GetWindowStyleFlag() & wxTE_PASSWORD
)
768 MergeChangesIntoString(tw
->m_value
, cbs
);
770 if ( cbs
->text
->length
> 0 )
773 for (i
= 0; i
< cbs
->text
->length
; ++i
)
774 cbs
->text
->ptr
[i
] = '*';
775 cbs
->text
->ptr
[i
] = '\0';
782 // If we're already within an OnChar, return: probably a programmatic
784 if (tw
->m_tempCallbackStruct
)
787 // Check for a backspace
788 if (cbs
->startPos
== (cbs
->currInsert
- 1))
790 tw
->DoSendEvents((void *)cbs
, WXK_DELETE
);
795 // Pasting operation: let it through without calling OnChar
796 if (cbs
->text
->length
> 1)
799 // Something other than text
800 if (cbs
->text
->ptr
== NULL
)
804 char ch
= cbs
->text
->ptr
[0];
805 tw
->DoSendEvents((void *)cbs
, ch
== '\n' ? '\r' : ch
);
809 wxTextWindowGainFocusProc (Widget w
, XtPointer clientData
, XmAnyCallbackStruct
*WXUNUSED(cbs
))
811 if (!wxGetWindowFromTable(w
))
814 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
815 wxFocusEvent
event(wxEVT_SET_FOCUS
, tw
->GetId());
816 event
.SetEventObject(tw
);
817 tw
->GetEventHandler()->ProcessEvent(event
);
821 wxTextWindowLoseFocusProc (Widget w
, XtPointer clientData
, XmAnyCallbackStruct
*WXUNUSED(cbs
))
823 if (!wxGetWindowFromTable(w
))
826 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
827 wxFocusEvent
event(wxEVT_KILL_FOCUS
, tw
->GetId());
828 event
.SetEventObject(tw
);
829 tw
->GetEventHandler()->ProcessEvent(event
);
832 static void wxTextWindowActivateProc(Widget w
, XtPointer clientData
,
833 XmAnyCallbackStruct
*WXUNUSED(ptr
))
835 if (!wxGetWindowFromTable(w
))
838 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
840 if (tw
->InSetValue())
843 wxCommandEvent
event(wxEVT_COMMAND_TEXT_ENTER
);
844 event
.SetId(tw
->GetId());
845 event
.SetEventObject(tw
);
846 tw
->ProcessCommand(event
);
849 void wxTextCtrl::OnCut(wxCommandEvent
& WXUNUSED(event
))
854 void wxTextCtrl::OnCopy(wxCommandEvent
& WXUNUSED(event
))
859 void wxTextCtrl::OnPaste(wxCommandEvent
& WXUNUSED(event
))
864 void wxTextCtrl::OnUndo(wxCommandEvent
& WXUNUSED(event
))
869 void wxTextCtrl::OnRedo(wxCommandEvent
& WXUNUSED(event
))
874 void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent
& event
)
876 event
.Enable( CanCut() );
879 void wxTextCtrl::OnUpdateCopy(wxUpdateUIEvent
& event
)
881 event
.Enable( CanCopy() );
884 void wxTextCtrl::OnUpdatePaste(wxUpdateUIEvent
& event
)
886 event
.Enable( CanPaste() );
889 void wxTextCtrl::OnUpdateUndo(wxUpdateUIEvent
& event
)
891 event
.Enable( CanUndo() );
894 void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent
& event
)
896 event
.Enable( CanRedo() );