1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
17 #pragma implementation "textctrl.h"
20 // ----------------------------------------------------------------------------
22 // ----------------------------------------------------------------------------
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
32 #include "wx/textctrl.h"
33 #include "wx/settings.h"
41 #include "wx/clipbrd.h"
44 #include "wx/textfile.h"
48 #include "wx/msw/private.h"
52 #include <sys/types.h>
60 #if wxUSE_RICHEDIT && !defined(__GNUWIN32__)
64 #if !USE_SHARED_LIBRARY
66 // ----------------------------------------------------------------------------
67 // event tables and other macros
68 // ----------------------------------------------------------------------------
70 IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl
, wxControl
)
72 BEGIN_EVENT_TABLE(wxTextCtrl
, wxControl
)
73 EVT_CHAR(wxTextCtrl::OnChar
)
74 EVT_DROP_FILES(wxTextCtrl::OnDropFiles
)
76 EVT_MENU(wxID_CUT
, wxTextCtrl::OnCut
)
77 EVT_MENU(wxID_COPY
, wxTextCtrl::OnCopy
)
78 EVT_MENU(wxID_PASTE
, wxTextCtrl::OnPaste
)
79 EVT_MENU(wxID_UNDO
, wxTextCtrl::OnUndo
)
80 EVT_MENU(wxID_REDO
, wxTextCtrl::OnRedo
)
82 EVT_UPDATE_UI(wxID_CUT
, wxTextCtrl::OnUpdateCut
)
83 EVT_UPDATE_UI(wxID_COPY
, wxTextCtrl::OnUpdateCopy
)
84 EVT_UPDATE_UI(wxID_PASTE
, wxTextCtrl::OnUpdatePaste
)
85 EVT_UPDATE_UI(wxID_UNDO
, wxTextCtrl::OnUpdateUndo
)
86 EVT_UPDATE_UI(wxID_REDO
, wxTextCtrl::OnUpdateRedo
)
89 #endif // USE_SHARED_LIBRARY
91 // ============================================================================
93 // ============================================================================
95 // ----------------------------------------------------------------------------
97 // ----------------------------------------------------------------------------
99 wxTextCtrl::wxTextCtrl()
106 bool wxTextCtrl::Create(wxWindow
*parent
, wxWindowID id
,
107 const wxString
& value
,
111 const wxValidator
& validator
,
112 const wxString
& name
)
114 // base initialization
115 if ( !CreateBase(parent
, id
, pos
, size
, style
, name
) )
118 SetValidator(validator
);
120 parent
->AddChild(this);
125 // translate wxWin style flags to MSW ones, checking for consistency while
127 long msStyle
= ES_LEFT
| WS_VISIBLE
| WS_CHILD
| WS_TABSTOP
;
128 if ( m_windowStyle
& wxTE_MULTILINE
)
130 wxASSERT_MSG( !(m_windowStyle
& wxTE_PROCESS_ENTER
),
131 _T("wxTE_PROCESS_ENTER style is ignored for multiline "
132 "text controls (they always process it)") );
134 msStyle
|= ES_MULTILINE
| ES_WANTRETURN
| WS_VSCROLL
;
135 m_windowStyle
|= wxTE_PROCESS_ENTER
;
138 msStyle
|= ES_AUTOHSCROLL
;
140 if (m_windowStyle
& wxTE_READONLY
)
141 msStyle
|= ES_READONLY
;
143 if (m_windowStyle
& wxHSCROLL
)
144 msStyle
|= (WS_HSCROLL
| ES_AUTOHSCROLL
);
145 if (m_windowStyle
& wxTE_PASSWORD
) // hidden input
146 msStyle
|= ES_PASSWORD
;
148 // we always want the characters and the arrows
149 m_lDlgCode
= DLGC_WANTCHARS
| DLGC_WANTARROWS
;
151 // we may have several different cases:
152 // 1. normal case: both TAB and ENTER are used for dialog navigation
153 // 2. ctrl which wants TAB for itself: ENTER is used to pass to the next
154 // control in the dialog
155 // 3. ctrl which wants ENTER for itself: TAB is used for dialog navigation
156 // 4. ctrl which wants both TAB and ENTER: Ctrl-ENTER is used to pass to
158 if ( m_windowStyle
& wxTE_PROCESS_ENTER
)
159 m_lDlgCode
|= DLGC_WANTMESSAGE
;
160 if ( m_windowStyle
& wxTE_PROCESS_TAB
)
161 m_lDlgCode
|= DLGC_WANTTAB
;
163 // do create the control - either an EDIT or RICHEDIT
164 const wxChar
*windowClass
= _T("EDIT");
167 // multiline edit controls are RICHEDITs except for those which have a
168 // simple border (VZ: why??)
169 if ( (m_windowStyle
& wxTE_MULTILINE
) &&
170 !(m_windowStyle
& wxSIMPLE_BORDER
) )
172 msStyle
|= ES_AUTOVSCROLL
;
174 windowClass
= _T("RICHEDIT");
181 WXDWORD exStyle
= Determine3DEffects(WS_EX_CLIENTEDGE
, &want3D
);
183 // Even with extended styles, need to combine with WS_BORDER for them to
185 if ( want3D
|| wxStyleHasBorder(m_windowStyle
) )
186 msStyle
|= WS_BORDER
;
188 // NB: don't use pos and size as CreateWindowEx arguments because they
189 // might be -1 in which case we should use the default values (and
190 // SetSize called below takes care of it)
191 m_hWnd
= (WXHWND
)::CreateWindowEx(exStyle
,
201 wxCHECK_MSG( m_hWnd
, FALSE
, _T("Failed to create text ctrl") );
206 Ctl3dSubclassCtl(GetHwnd());
214 // Have to enable events
215 ::SendMessage(GetHwnd(), EM_SETEVENTMASK
, 0,
216 ENM_CHANGE
| ENM_DROPFILES
| ENM_SELCHANGE
| ENM_UPDATE
);
220 SubclassWin(GetHWND());
222 // set font, position, size and initial value
223 wxFont
& fontParent
= parent
->GetFont();
224 if ( fontParent
.Ok() )
230 SetFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT
));
233 // Causes a crash for Symantec C++ and WIN32 for some reason
234 #if !(defined(__SC__) && defined(__WIN32__))
235 if ( !value
.IsEmpty() )
241 SetSize(pos
.x
, pos
.y
, size
.x
, size
.y
);
246 // Make sure the window style (etc.) reflects the HWND style (roughly)
247 void wxTextCtrl::AdoptAttributesFromHWND()
249 wxWindow::AdoptAttributesFromHWND();
251 HWND hWnd
= GetHwnd();
252 long style
= GetWindowLong(hWnd
, GWL_STYLE
);
254 // retrieve the style to see whether this is an edit or richedit ctrl
258 GetClassName(hWnd
, buf
, WXSIZEOF(buf
));
260 if ( wxStricmp(buf
, _T("EDIT")) == 0 )
264 #endif // wxUSE_RICHEDIT
266 if (style
& ES_MULTILINE
)
267 m_windowStyle
|= wxTE_MULTILINE
;
268 if (style
& ES_PASSWORD
)
269 m_windowStyle
|= wxTE_PASSWORD
;
270 if (style
& ES_READONLY
)
271 m_windowStyle
|= wxTE_READONLY
;
272 if (style
& ES_WANTRETURN
)
273 m_windowStyle
|= wxTE_PROCESS_ENTER
;
276 void wxTextCtrl::SetupColours()
278 // FIXME why is bg colour not inherited from parent?
279 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW
));
280 SetForegroundColour(GetParent()->GetForegroundColour());
283 // ----------------------------------------------------------------------------
284 // set/get the controls text
285 // ----------------------------------------------------------------------------
287 wxString
wxTextCtrl::GetValue() const
289 return wxGetWindowText(GetHWND());
292 void wxTextCtrl::SetValue(const wxString
& value
)
294 wxString valueDos
= wxTextFile::Translate(value
, wxTextFileType_Dos
);
296 SetWindowText(GetHwnd(), valueDos
);
301 void wxTextCtrl::WriteText(const wxString
& value
)
303 wxString valueDos
= wxTextFile::Translate(value
, wxTextFileType_Dos
);
305 SendMessage(GetHwnd(), EM_REPLACESEL
, 0, (LPARAM
)valueDos
.c_str());
310 void wxTextCtrl::AppendText(const wxString
& text
)
312 SetInsertionPointEnd();
316 void wxTextCtrl::Clear()
318 SetWindowText(GetHwnd(), _T(""));
321 // ----------------------------------------------------------------------------
322 // Clipboard operations
323 // ----------------------------------------------------------------------------
325 void wxTextCtrl::Copy()
329 HWND hWnd
= GetHwnd();
330 SendMessage(hWnd
, WM_COPY
, 0, 0L);
334 void wxTextCtrl::Cut()
338 HWND hWnd
= GetHwnd();
339 SendMessage(hWnd
, WM_CUT
, 0, 0L);
343 void wxTextCtrl::Paste()
347 HWND hWnd
= GetHwnd();
348 SendMessage(hWnd
, WM_PASTE
, 0, 0L);
352 bool wxTextCtrl::CanCopy() const
354 // Can copy if there's a selection
356 GetSelection(& from
, & to
);
360 bool wxTextCtrl::CanCut() const
362 // Can cut if there's a selection
364 GetSelection(& from
, & to
);
368 bool wxTextCtrl::CanPaste() const
373 int dataFormat
= 0; // 0 == any format
374 return (::SendMessage( GetHwnd(), EM_CANPASTE
, (WPARAM
) (UINT
) dataFormat
, 0) != 0);
380 // Standard edit control: check for straight text on clipboard
381 bool isTextAvailable
= FALSE
;
382 if ( ::OpenClipboard(GetHwndOf(wxTheApp
->GetTopWindow())) )
384 isTextAvailable
= (::IsClipboardFormatAvailable(CF_TEXT
) != 0);
388 return isTextAvailable
;
391 // ----------------------------------------------------------------------------
393 // ----------------------------------------------------------------------------
395 void wxTextCtrl::SetEditable(bool editable
)
397 HWND hWnd
= GetHwnd();
398 SendMessage(hWnd
, EM_SETREADONLY
, (WPARAM
)!editable
, (LPARAM
)0L);
401 void wxTextCtrl::SetInsertionPoint(long pos
)
403 HWND hWnd
= GetHwnd();
411 SendMessage(hWnd
, EM_EXSETSEL
, 0, (LPARAM
) &range
);
412 SendMessage(hWnd
, EM_SCROLLCARET
, (WPARAM
)0, (LPARAM
)0);
415 #endif // wxUSE_RICHEDIT
417 SendMessage(hWnd
, EM_SETSEL
, pos
, pos
);
418 SendMessage(hWnd
, EM_SCROLLCARET
, (WPARAM
)0, (LPARAM
)0);
421 SendMessage(hWnd
, EM_SETSEL
, 0, MAKELPARAM(pos
, pos
));
424 static const char *nothing
= "";
425 SendMessage(hWnd
, EM_REPLACESEL
, 0, (LPARAM
)nothing
);
428 void wxTextCtrl::SetInsertionPointEnd()
430 long pos
= GetLastPosition();
431 SetInsertionPoint(pos
);
434 long wxTextCtrl::GetInsertionPoint() const
442 SendMessage(GetHwnd(), EM_EXGETSEL
, 0, (LPARAM
) &range
);
447 DWORD Pos
= (DWORD
)SendMessage(GetHwnd(), EM_GETSEL
, 0, 0L);
451 long wxTextCtrl::GetLastPosition() const
453 HWND hWnd
= GetHwnd();
455 // Will always return a number > 0 (according to docs)
456 int noLines
= (int)SendMessage(hWnd
, EM_GETLINECOUNT
, (WPARAM
)0, (LPARAM
)0L);
458 // This gets the char index for the _beginning_ of the last line
459 int charIndex
= (int)SendMessage(hWnd
, EM_LINEINDEX
, (WPARAM
)(noLines
-1), (LPARAM
)0L);
461 // Get number of characters in the last line. We'll add this to the character
462 // index for the last line, 1st position.
463 int lineLength
= (int)SendMessage(hWnd
, EM_LINELENGTH
, (WPARAM
)charIndex
, (LPARAM
)0L);
465 return (long)(charIndex
+ lineLength
);
468 // If the return values from and to are the same, there is no
470 void wxTextCtrl::GetSelection(long* from
, long* to
) const
476 ::SendMessage(GetHwnd(), EM_EXGETSEL
, 0, (LPARAM
) (CHARRANGE
*) & charRange
);
478 *from
= charRange
.cpMin
;
479 *to
= charRange
.cpMax
;
484 DWORD dwStart
, dwEnd
;
485 WPARAM wParam
= (WPARAM
) (DWORD
*) & dwStart
; // receives starting position
486 LPARAM lParam
= (LPARAM
) (DWORD
*) & dwEnd
; // receives ending position
488 ::SendMessage(GetHwnd(), EM_GETSEL
, wParam
, lParam
);
494 bool wxTextCtrl::IsEditable() const
496 long style
= ::GetWindowLong(GetHwnd(), GWL_STYLE
);
498 return ((style
& ES_READONLY
) == 0);
501 // ----------------------------------------------------------------------------
503 // ----------------------------------------------------------------------------
505 void wxTextCtrl::Replace(long from
, long to
, const wxString
& value
)
508 HWND hWnd
= GetHwnd();
509 long fromChar
= from
;
512 // Set selection and remove it
514 SendMessage(hWnd
, EM_SETSEL
, fromChar
, toChar
);
516 SendMessage(hWnd
, EM_SETSEL
, (WPARAM
)0, (LPARAM
)MAKELONG(fromChar
, toChar
));
518 SendMessage(hWnd
, WM_CUT
, (WPARAM
)0, (LPARAM
)0);
520 // Now replace with 'value', by pasting.
521 wxSetClipboardData(wxDF_TEXT
, (wxObject
*) (const wxChar
*)value
, 0, 0);
523 // Paste into edit control
524 SendMessage(hWnd
, WM_PASTE
, (WPARAM
)0, (LPARAM
)0L);
526 wxFAIL_MSG("wxTextCtrl::Replace not implemented if wxUSE_CLIPBOARD is 0.");
530 void wxTextCtrl::Remove(long from
, long to
)
532 HWND hWnd
= GetHwnd();
533 long fromChar
= from
;
536 // Cut all selected text
538 SendMessage(hWnd
, EM_SETSEL
, fromChar
, toChar
);
540 SendMessage(hWnd
, EM_SETSEL
, (WPARAM
)0, (LPARAM
)MAKELONG(fromChar
, toChar
));
542 SendMessage(hWnd
, WM_CUT
, (WPARAM
)0, (LPARAM
)0);
545 void wxTextCtrl::SetSelection(long from
, long to
)
547 HWND hWnd
= GetHwnd();
548 long fromChar
= from
;
551 // if from and to are both -1, it means (in wxWindows) that all text should
552 // be selected. Translate into Windows convention
553 if ((from
== -1) && (to
== -1))
560 SendMessage(hWnd
, EM_SETSEL
, (WPARAM
)fromChar
, (LPARAM
)toChar
);
561 SendMessage(hWnd
, EM_SCROLLCARET
, (WPARAM
)0, (LPARAM
)0);
563 // WPARAM is 0: selection is scrolled into view
564 SendMessage(hWnd
, EM_SETSEL
, (WPARAM
)0, (LPARAM
)MAKELONG(fromChar
, toChar
));
568 bool wxTextCtrl::LoadFile(const wxString
& file
)
570 if ( wxTextCtrlBase::LoadFile(file
) )
572 // update the size limit if needed
581 bool wxTextCtrl::IsModified() const
583 return (SendMessage(GetHwnd(), EM_GETMODIFY
, 0, 0) != 0);
586 // Makes 'unmodified'
587 void wxTextCtrl::DiscardEdits()
589 SendMessage(GetHwnd(), EM_SETMODIFY
, FALSE
, 0L);
592 int wxTextCtrl::GetNumberOfLines() const
594 return (int)SendMessage(GetHwnd(), EM_GETLINECOUNT
, (WPARAM
)0, (LPARAM
)0);
597 long wxTextCtrl::XYToPosition(long x
, long y
) const
599 HWND hWnd
= GetHwnd();
601 // This gets the char index for the _beginning_ of this line
602 int charIndex
= (int)SendMessage(hWnd
, EM_LINEINDEX
, (WPARAM
)y
, (LPARAM
)0);
603 return (long)(x
+ charIndex
);
606 bool wxTextCtrl::PositionToXY(long pos
, long *x
, long *y
) const
608 HWND hWnd
= GetHwnd();
610 // This gets the line number containing the character
615 lineNo
= (int)SendMessage(hWnd
, EM_EXLINEFROMCHAR
, 0, (LPARAM
)pos
);
618 #endif // wxUSE_RICHEDIT
619 lineNo
= (int)SendMessage(hWnd
, EM_LINEFROMCHAR
, (WPARAM
)pos
, 0);
627 // This gets the char index for the _beginning_ of this line
628 int charIndex
= (int)SendMessage(hWnd
, EM_LINEINDEX
, (WPARAM
)lineNo
, (LPARAM
)0);
629 if ( charIndex
== -1 )
634 // The X position must therefore be the different between pos and charIndex
636 *x
= (long)(pos
- charIndex
);
643 void wxTextCtrl::ShowPosition(long pos
)
645 HWND hWnd
= GetHwnd();
647 // To scroll to a position, we pass the number of lines and characters
648 // to scroll *by*. This means that we need to:
649 // (1) Find the line position of the current line.
650 // (2) Find the line position of pos.
651 // (3) Scroll by (pos - current).
652 // For now, ignore the horizontal scrolling.
654 // Is this where scrolling is relative to - the line containing the caret?
655 // Or is the first visible line??? Try first visible line.
656 // int currentLineLineNo1 = (int)SendMessage(hWnd, EM_LINEFROMCHAR, (WPARAM)-1, (LPARAM)0L);
658 int currentLineLineNo
= (int)SendMessage(hWnd
, EM_GETFIRSTVISIBLELINE
, (WPARAM
)0, (LPARAM
)0L);
660 int specifiedLineLineNo
= (int)SendMessage(hWnd
, EM_LINEFROMCHAR
, (WPARAM
)pos
, (LPARAM
)0L);
662 int linesToScroll
= specifiedLineLineNo
- currentLineLineNo
;
664 if (linesToScroll
!= 0)
665 (void)SendMessage(hWnd
, EM_LINESCROLL
, (WPARAM
)0, (LPARAM
)linesToScroll
);
668 int wxTextCtrl::GetLineLength(long lineNo
) const
670 long charIndex
= XYToPosition(0, lineNo
);
671 int len
= (int)SendMessage(GetHwnd(), EM_LINELENGTH
, charIndex
, 0);
675 wxString
wxTextCtrl::GetLineText(long lineNo
) const
677 size_t len
= (size_t)GetLineLength(lineNo
) + 1;
678 char *buf
= (char *)malloc(len
);
680 int noChars
= (int)SendMessage(GetHwnd(), EM_GETLINE
, lineNo
, (LPARAM
)buf
);
690 // ----------------------------------------------------------------------------
692 // ----------------------------------------------------------------------------
694 void wxTextCtrl::Undo()
698 ::SendMessage(GetHwnd(), EM_UNDO
, 0, 0);
702 void wxTextCtrl::Redo()
706 // Same as Undo, since Undo undoes the undo, i.e. a redo.
707 ::SendMessage(GetHwnd(), EM_UNDO
, 0, 0);
711 bool wxTextCtrl::CanUndo() const
713 return (::SendMessage(GetHwnd(), EM_CANUNDO
, 0, 0) != 0);
716 bool wxTextCtrl::CanRedo() const
718 return (::SendMessage(GetHwnd(), EM_CANUNDO
, 0, 0) != 0);
721 // ----------------------------------------------------------------------------
722 // implemenation details
723 // ----------------------------------------------------------------------------
725 void wxTextCtrl::Command(wxCommandEvent
& event
)
727 SetValue(event
.GetString());
728 ProcessCommand (event
);
731 void wxTextCtrl::OnDropFiles(wxDropFilesEvent
& event
)
733 // By default, load the first file into the text window.
734 if (event
.GetNumberOfFiles() > 0)
736 LoadFile(event
.GetFiles()[0]);
740 WXHBRUSH
wxTextCtrl::OnCtlColor(WXHDC pDC
, WXHWND pWnd
, WXUINT nCtlColor
,
741 WXUINT message
, WXWPARAM wParam
,
747 HBRUSH hbrush
= Ctl3dCtlColorEx(message
, wParam
, lParam
);
748 return (WXHBRUSH
) hbrush
;
753 SetBkMode(hdc
, GetParent()->GetTransparentBackground() ? TRANSPARENT
756 ::SetBkColor(hdc
, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
757 ::SetTextColor(hdc
, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
759 wxBrush
*backgroundBrush
= wxTheBrushList
->FindOrCreateBrush(GetBackgroundColour(), wxSOLID
);
761 return (WXHBRUSH
) backgroundBrush
->GetResourceHandle();
764 void wxTextCtrl::OnChar(wxKeyEvent
& event
)
766 switch ( event
.KeyCode() )
769 if ( !(m_windowStyle
& wxTE_MULTILINE
) )
771 wxCommandEvent
event(wxEVT_COMMAND_TEXT_ENTER
, m_windowId
);
772 event
.SetEventObject( this );
773 if ( GetEventHandler()->ProcessEvent(event
) )
776 //else: multiline controls need Enter for themselves
781 // always produce navigation event - even if we process TAB
782 // ourselves the fact that we got here means that the user code
783 // decided to skip processing of this TAB - probably to let it
784 // do its default job.
786 // NB: Notice that Ctrl-Tab is handled elsewhere and Alt-Tab is
787 // handled by Windows
789 wxNavigationKeyEvent eventNav
;
790 eventNav
.SetDirection(!event
.ShiftDown());
791 eventNav
.SetWindowChange(FALSE
);
792 eventNav
.SetEventObject(this);
794 if ( GetEventHandler()->ProcessEvent(eventNav
) )
804 // don't just call event.Skip() because this will cause TABs and ENTERs
805 // be passed upwards and we don't always want this - instead process it
812 bool wxTextCtrl::MSWCommand(WXUINT param
, WXWORD
WXUNUSED(id
))
819 wxFocusEvent
event(param
== EN_KILLFOCUS
? wxEVT_KILL_FOCUS
822 event
.SetEventObject( this );
823 GetEventHandler()->ProcessEvent(event
);
829 wxCommandEvent
event(wxEVT_COMMAND_TEXT_UPDATED
, m_windowId
);
830 wxString
val(GetValue());
832 event
.m_commandString
= WXSTRINGCAST val
;
833 event
.SetEventObject( this );
834 ProcessCommand(event
);
839 // the text size limit has been hit - increase it
843 // the other notification messages are not processed
856 void wxTextCtrl::AdjustSpaceLimit()
859 unsigned int len
= ::GetWindowTextLength(GetHwnd()),
860 limit
= ::SendMessage(GetHwnd(), EM_GETLIMITTEXT
, 0, 0);
863 limit
= len
+ 0x8000; // 32Kb
866 if ( m_isRich
|| limit
> 0xffff )
868 if ( limit
> 0xffff )
870 ::SendMessage(GetHwnd(), EM_LIMITTEXT
, 0, limit
);
872 ::SendMessage(GetHwnd(), EM_LIMITTEXT
, limit
, 0);
877 bool wxTextCtrl::AcceptsFocus() const
879 // we don't want focus if we can't be edited
880 return IsEditable() && wxControl::AcceptsFocus();
883 wxSize
wxTextCtrl::DoGetBestSize()
886 wxGetCharSize(GetHWND(), &cx
, &cy
, &GetFont());
888 int wText
= DEFAULT_ITEM_WIDTH
;
890 int hText
= EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy
);
891 if ( m_windowStyle
& wxTE_MULTILINE
)
893 hText
*= wxMin(GetNumberOfLines(), 5);
895 //else: for single line control everything is ok
897 return wxSize(wText
, hText
);
900 // ----------------------------------------------------------------------------
901 // standard handlers for standard edit menu events
902 // ----------------------------------------------------------------------------
904 void wxTextCtrl::OnCut(wxCommandEvent
& event
)
909 void wxTextCtrl::OnCopy(wxCommandEvent
& event
)
914 void wxTextCtrl::OnPaste(wxCommandEvent
& event
)
919 void wxTextCtrl::OnUndo(wxCommandEvent
& event
)
924 void wxTextCtrl::OnRedo(wxCommandEvent
& event
)
929 void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent
& event
)
931 event
.Enable( CanCut() );
934 void wxTextCtrl::OnUpdateCopy(wxUpdateUIEvent
& event
)
936 event
.Enable( CanCopy() );
939 void wxTextCtrl::OnUpdatePaste(wxUpdateUIEvent
& event
)
941 event
.Enable( CanPaste() );
944 void wxTextCtrl::OnUpdateUndo(wxUpdateUIEvent
& event
)
946 event
.Enable( CanUndo() );
949 void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent
& event
)
951 event
.Enable( CanRedo() );