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 AttachWidget (parent
, m_mainWidget
, (WXWidget
) NULL
,
201 pos
.x
, pos
.y
, best
.x
, best
.y
);
203 ChangeBackgroundColour();
208 WXWidget
wxTextCtrl::GetTopWidget() const
210 return IsMultiLine() ? (WXWidget
)XtParent((Widget
)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 // with (at least) OpenMotif 2.1 this causes a lot of flicker
254 XtVaSetValues( (Widget
) m_mainWidget
,
255 XmNvalue
, wxConstCast(value
.c_str(), char),
262 m_inSetValue
= FALSE
;
265 // Clipboard operations
266 void wxTextCtrl::Copy()
268 XmTextCopy((Widget
) m_mainWidget
, CurrentTime
);
271 void wxTextCtrl::Cut()
273 XmTextCut((Widget
) m_mainWidget
, CurrentTime
);
276 void wxTextCtrl::Paste()
278 XmTextPaste((Widget
) m_mainWidget
);
281 bool wxTextCtrl::CanCopy() const
283 // Can copy if there's a selection
285 GetSelection(& from
, & to
);
286 return (from
!= to
) ;
289 bool wxTextCtrl::CanCut() const
291 // Can cut if there's a selection
293 GetSelection(& from
, & to
);
294 return (from
!= to
) && (IsEditable());
297 bool wxTextCtrl::CanPaste() const
299 return IsEditable() ;
303 void wxTextCtrl::Undo()
305 // Not possible in Motif
308 void wxTextCtrl::Redo()
310 // Not possible in Motif
313 bool wxTextCtrl::CanUndo() const
319 bool wxTextCtrl::CanRedo() const
325 // If the return values from and to are the same, there is no
327 void wxTextCtrl::GetSelection(long* from
, long* to
) const
329 XmTextPosition left
, right
;
331 XmTextGetSelectionPosition((Widget
) m_mainWidget
, & left
, & right
);
337 bool wxTextCtrl::IsEditable() const
339 return (XmTextGetEditable((Widget
) m_mainWidget
) != 0);
342 void wxTextCtrl::SetEditable(bool editable
)
344 XmTextSetEditable((Widget
) m_mainWidget
, (Boolean
) editable
);
347 void wxTextCtrl::SetInsertionPoint(long pos
)
349 XmTextSetInsertionPosition ((Widget
) m_mainWidget
, (XmTextPosition
) pos
);
352 void wxTextCtrl::SetInsertionPointEnd()
354 long pos
= GetLastPosition();
355 SetInsertionPoint(pos
);
358 long wxTextCtrl::GetInsertionPoint() const
360 return (long) XmTextGetInsertionPosition ((Widget
) m_mainWidget
);
363 long wxTextCtrl::GetLastPosition() const
365 return (long) XmTextGetLastPosition ((Widget
) m_mainWidget
);
368 void wxTextCtrl::Replace(long from
, long to
, const wxString
& value
)
370 XmTextReplace ((Widget
) m_mainWidget
, (XmTextPosition
) from
, (XmTextPosition
) to
,
371 wxConstCast(value
.c_str(), char));
374 void wxTextCtrl::Remove(long from
, long to
)
376 XmTextSetSelection ((Widget
) m_mainWidget
, (XmTextPosition
) from
, (XmTextPosition
) to
,
378 XmTextRemove ((Widget
) m_mainWidget
);
381 void wxTextCtrl::SetSelection(long from
, long to
)
384 to
= GetLastPosition();
386 XmTextSetSelection ((Widget
) m_mainWidget
, (XmTextPosition
) from
, (XmTextPosition
) to
,
390 void wxTextCtrl::WriteText(const wxString
& text
)
392 long textPosition
= GetInsertionPoint() + strlen (text
);
393 XmTextInsert ((Widget
) m_mainWidget
, GetInsertionPoint(),
394 wxConstCast(text
.c_str(), char));
395 XtVaSetValues ((Widget
) m_mainWidget
, XmNcursorPosition
, textPosition
, NULL
);
396 SetInsertionPoint(textPosition
);
397 XmTextShowPosition ((Widget
) m_mainWidget
, textPosition
);
401 void wxTextCtrl::AppendText(const wxString
& text
)
403 long textPosition
= GetLastPosition() + text
.length();
404 XmTextInsert ((Widget
) m_mainWidget
, GetLastPosition(),
405 wxConstCast(text
.c_str(), char));
406 XtVaSetValues ((Widget
) m_mainWidget
, XmNcursorPosition
, textPosition
, NULL
);
407 SetInsertionPoint(textPosition
);
408 XmTextShowPosition ((Widget
) m_mainWidget
, textPosition
);
412 void wxTextCtrl::Clear()
414 XmTextSetString ((Widget
) m_mainWidget
, "");
418 bool wxTextCtrl::IsModified() const
423 // Makes 'unmodified'
424 void wxTextCtrl::DiscardEdits()
429 int wxTextCtrl::GetNumberOfLines() const
431 // HIDEOUSLY inefficient, but we have no choice.
432 char *s
= XmTextGetString ((Widget
) m_mainWidget
);
437 bool finished
= FALSE
;
460 long wxTextCtrl::XYToPosition(long x
, long y
) const
462 /* It seems, that there is a bug in some versions of the Motif library,
463 so the original wxWin-Code doesn't work. */
465 Widget textWidget = (Widget) handle;
466 return (long) XmTextXYToPos (textWidget, (Position) x, (Position) y);
468 /* Now a little workaround: */
470 for (int i
=0; i
<y
; i
++) r
+=(GetLineLength(i
)+1);
474 bool wxTextCtrl::PositionToXY(long pos
, long *x
, long *y
) const
477 XmTextPosToXY((Widget
) m_mainWidget
, pos
, &xx
, &yy
);
486 void wxTextCtrl::ShowPosition(long pos
)
488 XmTextShowPosition ((Widget
) m_mainWidget
, (XmTextPosition
) pos
);
491 int wxTextCtrl::GetLineLength(long lineNo
) const
493 wxString str
= GetLineText (lineNo
);
494 return (int) str
.Length();
497 wxString
wxTextCtrl::GetLineText(long lineNo
) const
499 // HIDEOUSLY inefficient, but we have no choice.
500 char *s
= XmTextGetString ((Widget
) m_mainWidget
);
507 for (i
= 0; currentLine
!= lineNo
&& s
[i
]; i
++ )
512 for (j
= 0; s
[i
] && s
[i
] != '\n'; i
++, j
++ )
519 return wxEmptyString
;
526 void wxTextCtrl::Command(wxCommandEvent
& event
)
528 SetValue (event
.GetString());
529 ProcessCommand (event
);
532 void wxTextCtrl::OnDropFiles(wxDropFilesEvent
& event
)
534 // By default, load the first file into the text window.
535 if (event
.GetNumberOfFiles() > 0)
537 LoadFile(event
.GetFiles()[0]);
541 void wxTextCtrl::OnChar(wxKeyEvent
& event
)
543 // Indicates that we should generate a normal command, because
544 // we're letting default behaviour happen (otherwise it's vetoed
545 // by virtue of overriding OnChar)
546 m_processedDefault
= TRUE
;
548 if (m_tempCallbackStruct
)
550 XmTextVerifyCallbackStruct
*textStruct
=
551 (XmTextVerifyCallbackStruct
*) m_tempCallbackStruct
;
552 textStruct
->doit
= True
;
553 if (isascii(event
.m_keyCode
) && (textStruct
->text
->length
== 1))
555 textStruct
->text
->ptr
[0] = ((event
.m_keyCode
== WXK_RETURN
) ? 10 : event
.m_keyCode
);
560 void wxTextCtrl::ChangeFont(bool keepOriginalSize
)
562 wxWindow::ChangeFont(keepOriginalSize
);
565 void wxTextCtrl::ChangeBackgroundColour()
567 wxWindow::ChangeBackgroundColour();
569 /* TODO: should scrollbars be affected? Should probably have separate
570 * function to change them (by default, taken from wxSystemSettings)
572 if (m_windowStyle
& wxTE_MULTILINE
)
574 Widget parent
= XtParent ((Widget
) m_mainWidget
);
577 XtVaGetValues (parent
,
578 XmNhorizontalScrollBar
, &hsb
,
579 XmNverticalScrollBar
, &vsb
,
581 wxColour backgroundColour
= wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE
);
583 wxDoChangeBackgroundColour((WXWidget
) hsb
, backgroundColour
, TRUE
);
585 wxDoChangeBackgroundColour((WXWidget
) vsb
, backgroundColour
, TRUE
);
587 // MBN: why change parent background?
588 // DoChangeBackgroundColour((WXWidget) parent, m_backgroundColour, TRUE);
592 void wxTextCtrl::ChangeForegroundColour()
594 wxWindow::ChangeForegroundColour();
596 if (m_windowStyle
& wxTE_MULTILINE
)
598 Widget parent
= XtParent ((Widget
) m_mainWidget
);
601 XtVaGetValues (parent
,
602 XmNhorizontalScrollBar
, &hsb
,
603 XmNverticalScrollBar
, &vsb
,
606 /* TODO: should scrollbars be affected? Should probably have separate
607 * function to change them (by default, taken from wxSystemSettings)
609 DoChangeForegroundColour((WXWidget) hsb, m_foregroundColour);
611 DoChangeForegroundColour((WXWidget) vsb, m_foregroundColour);
613 wxDoChangeForegroundColour((WXWidget
) parent
, m_foregroundColour
);
617 void wxTextCtrl::DoSendEvents(void *wxcbs
, long keycode
)
619 // we're in process of updating the text control
620 m_tempCallbackStruct
= wxcbs
;
622 XmTextVerifyCallbackStruct
*cbs
= (XmTextVerifyCallbackStruct
*)wxcbs
;
624 wxKeyEvent
event (wxEVT_CHAR
);
625 event
.SetId(GetId());
626 event
.m_keyCode
= keycode
;
627 event
.SetEventObject(this);
629 // Only if wxTextCtrl::OnChar is called will this be set to True (and
630 // the character passed through)
633 GetEventHandler()->ProcessEvent(event
);
635 if ( !InSetValue() && m_processedDefault
)
637 // Can generate a command
638 wxCommandEvent
commandEvent(wxEVT_COMMAND_TEXT_UPDATED
, GetId());
639 commandEvent
.SetEventObject(this);
640 ProcessCommand(commandEvent
);
643 // do it after the (user) event handlers processed the events because
644 // otherwise GetValue() would return incorrect (not yet updated value)
645 m_tempCallbackStruct
= NULL
;
648 wxSize
wxDoGetSingleTextCtrlBestSize( Widget textWidget
,
649 const wxWindow
* window
)
651 Dimension xmargin
, ymargin
, highlight
, shadow
;
654 XtVaGetValues( textWidget
,
655 XmNmarginWidth
, &xmargin
,
656 XmNmarginHeight
, &ymargin
,
658 XmNhighlightThickness
, &highlight
,
659 XmNshadowThickness
, &shadow
,
666 window
->GetTextExtent( value
, &x
, &y
);
668 if( x
< 100 ) x
= 100;
670 return wxSize( x
+ 2 * xmargin
+ 2 * highlight
+ 2 * shadow
,
671 // MBN: +2 necessary: Lesstif bug or mine?
672 y
+ 2 * ymargin
+ 2 * highlight
+ 2 * shadow
+ 2 );
675 wxSize
wxTextCtrl::DoGetBestSize() const
678 return wxDoGetSingleTextCtrlBestSize( (Widget
)m_mainWidget
, this );
680 return wxWindow::DoGetBestSize();
683 // ----------------------------------------------------------------------------
684 // helpers and Motif callbacks
685 // ----------------------------------------------------------------------------
687 static void MergeChangesIntoString(wxString
& value
,
688 XmTextVerifyCallbackStruct
*cbs
)
691 * At least on my system (SunOS 4.1.3 + Motif 1.2), you need to think of
692 * every event as a replace event. cbs->text->ptr gives the replacement
693 * text, cbs->startPos gives the index of the first char affected by the
694 * replace, and cbs->endPos gives the index one more than the last char
695 * affected by the replace (startPos == endPos implies an empty range).
696 * Hence, a deletion is represented by replacing all input text with a
697 * blank string ("", *not* NULL!). A simple insertion that does not
698 * overwrite any text has startPos == endPos.
703 // easy case: the ol value was empty
704 value
= cbs
->text
->ptr
;
708 // merge the changes into the value
709 const char * const passwd
= value
;
710 int len
= value
.length();
712 len
+= ( cbs
->text
->ptr
?
713 strlen(cbs
->text
->ptr
) :
714 0 ) + 1; // + new text (if any) + NUL
715 len
-= cbs
->endPos
- cbs
->startPos
; // - text from affected region.
717 char * newS
= new char [len
];
719 * insert
= cbs
->text
->ptr
;
721 // Copy (old) text from passwd, up to the start posn of the change.
723 const char * p
= passwd
;
724 for (i
= 0; i
< cbs
->startPos
; ++i
)
727 // Copy the text to be inserted).
732 // Finally, copy into newS any remaining text from passwd[endPos] on.
733 for (p
= passwd
+ cbs
->endPos
; *p
; )
744 wxTextWindowChangedProc (Widget w
, XtPointer clientData
, XtPointer
WXUNUSED(ptr
))
746 if (!wxGetWindowFromTable(w
))
747 // Widget has been deleted!
750 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
751 tw
->SetModified(TRUE
);
755 wxTextWindowModifyProc (Widget
WXUNUSED(w
), XtPointer clientData
, XmTextVerifyCallbackStruct
*cbs
)
757 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
758 tw
->m_processedDefault
= FALSE
;
760 // First, do some stuff if it's a password control: in this case, we need
761 // to store the string inside the class because GetValue() can't retrieve
762 // it from the text ctrl. We do *not* do it in other circumstances because
763 // it would double the amount of memory needed.
765 if ( tw
->GetWindowStyleFlag() & wxTE_PASSWORD
)
767 MergeChangesIntoString(tw
->m_value
, cbs
);
769 if ( cbs
->text
->length
> 0 )
772 for (i
= 0; i
< cbs
->text
->length
; ++i
)
773 cbs
->text
->ptr
[i
] = '*';
774 cbs
->text
->ptr
[i
] = '\0';
781 // If we're already within an OnChar, return: probably a programmatic
783 if (tw
->m_tempCallbackStruct
)
786 // Check for a backspace
787 if (cbs
->startPos
== (cbs
->currInsert
- 1))
789 tw
->DoSendEvents((void *)cbs
, WXK_DELETE
);
794 // Pasting operation: let it through without calling OnChar
795 if (cbs
->text
->length
> 1)
798 // Something other than text
799 if (cbs
->text
->ptr
== NULL
)
803 char ch
= cbs
->text
->ptr
[0];
804 tw
->DoSendEvents((void *)cbs
, ch
== '\n' ? '\r' : ch
);
808 wxTextWindowGainFocusProc (Widget w
, XtPointer clientData
, XmAnyCallbackStruct
*WXUNUSED(cbs
))
810 if (!wxGetWindowFromTable(w
))
813 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
814 wxFocusEvent
event(wxEVT_SET_FOCUS
, tw
->GetId());
815 event
.SetEventObject(tw
);
816 tw
->GetEventHandler()->ProcessEvent(event
);
820 wxTextWindowLoseFocusProc (Widget w
, XtPointer clientData
, XmAnyCallbackStruct
*WXUNUSED(cbs
))
822 if (!wxGetWindowFromTable(w
))
825 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
826 wxFocusEvent
event(wxEVT_KILL_FOCUS
, tw
->GetId());
827 event
.SetEventObject(tw
);
828 tw
->GetEventHandler()->ProcessEvent(event
);
831 static void wxTextWindowActivateProc(Widget w
, XtPointer clientData
,
832 XmAnyCallbackStruct
*WXUNUSED(ptr
))
834 if (!wxGetWindowFromTable(w
))
837 wxTextCtrl
*tw
= (wxTextCtrl
*) clientData
;
839 if (tw
->InSetValue())
842 wxCommandEvent
event(wxEVT_COMMAND_TEXT_ENTER
);
843 event
.SetId(tw
->GetId());
844 event
.SetEventObject(tw
);
845 tw
->ProcessCommand(event
);
848 void wxTextCtrl::OnCut(wxCommandEvent
& WXUNUSED(event
))
853 void wxTextCtrl::OnCopy(wxCommandEvent
& WXUNUSED(event
))
858 void wxTextCtrl::OnPaste(wxCommandEvent
& WXUNUSED(event
))
863 void wxTextCtrl::OnUndo(wxCommandEvent
& WXUNUSED(event
))
868 void wxTextCtrl::OnRedo(wxCommandEvent
& WXUNUSED(event
))
873 void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent
& event
)
875 event
.Enable( CanCut() );
878 void wxTextCtrl::OnUpdateCopy(wxUpdateUIEvent
& event
)
880 event
.Enable( CanCopy() );
883 void wxTextCtrl::OnUpdatePaste(wxUpdateUIEvent
& event
)
885 event
.Enable( CanPaste() );
888 void wxTextCtrl::OnUpdateUndo(wxUpdateUIEvent
& event
)
890 event
.Enable( CanUndo() );
893 void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent
& event
)
895 event
.Enable( CanRedo() );