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__) || defined(wxUSE_NORLANDER_HEADERS))
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
, validator
, 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
;
135 if ((m_windowStyle
& wxTE_NO_VSCROLL
) == 0)
136 msStyle
|= WS_VSCROLL
;
137 m_windowStyle
|= wxTE_PROCESS_ENTER
;
140 msStyle
|= ES_AUTOHSCROLL
;
142 if (m_windowStyle
& wxTE_READONLY
)
143 msStyle
|= ES_READONLY
;
145 if (m_windowStyle
& wxHSCROLL
)
146 msStyle
|= (WS_HSCROLL
| ES_AUTOHSCROLL
);
147 if (m_windowStyle
& wxTE_PASSWORD
) // hidden input
148 msStyle
|= ES_PASSWORD
;
150 // we always want the characters and the arrows
151 m_lDlgCode
= DLGC_WANTCHARS
| DLGC_WANTARROWS
;
153 // we may have several different cases:
154 // 1. normal case: both TAB and ENTER are used for dialog navigation
155 // 2. ctrl which wants TAB for itself: ENTER is used to pass to the next
156 // control in the dialog
157 // 3. ctrl which wants ENTER for itself: TAB is used for dialog navigation
158 // 4. ctrl which wants both TAB and ENTER: Ctrl-ENTER is used to pass to
160 if ( m_windowStyle
& wxTE_PROCESS_ENTER
)
161 m_lDlgCode
|= DLGC_WANTMESSAGE
;
162 if ( m_windowStyle
& wxTE_PROCESS_TAB
)
163 m_lDlgCode
|= DLGC_WANTTAB
;
165 // do create the control - either an EDIT or RICHEDIT
166 const wxChar
*windowClass
= _T("EDIT");
169 if ( m_windowStyle
& wxTE_RICH
)
171 msStyle
|= ES_AUTOVSCROLL
;
173 windowClass
= _T("RICHEDIT");
180 WXDWORD exStyle
= Determine3DEffects(WS_EX_CLIENTEDGE
, &want3D
);
182 // Even with extended styles, need to combine with WS_BORDER for them to
184 if ( want3D
|| wxStyleHasBorder(m_windowStyle
) )
185 msStyle
|= WS_BORDER
;
187 // NB: don't use pos and size as CreateWindowEx arguments because they
188 // might be -1 in which case we should use the default values (and
189 // SetSize called below takes care of it)
190 m_hWnd
= (WXHWND
)::CreateWindowEx(exStyle
,
200 wxCHECK_MSG( m_hWnd
, FALSE
, _T("Failed to create text ctrl") );
205 Ctl3dSubclassCtl(GetHwnd());
213 // Have to enable events
214 ::SendMessage(GetHwnd(), EM_SETEVENTMASK
, 0,
215 ENM_CHANGE
| ENM_DROPFILES
| ENM_SELCHANGE
| ENM_UPDATE
);
219 SubclassWin(GetHWND());
221 // set font, position, size and initial value
222 wxFont
& fontParent
= parent
->GetFont();
223 if ( fontParent
.Ok() )
229 SetFont(wxSystemSettings::GetSystemFont(wxSYS_SYSTEM_FONT
));
232 // Causes a crash for Symantec C++ and WIN32 for some reason
233 #if !(defined(__SC__) && defined(__WIN32__))
234 if ( !value
.IsEmpty() )
240 SetSize(pos
.x
, pos
.y
, size
.x
, size
.y
);
245 // Make sure the window style (etc.) reflects the HWND style (roughly)
246 void wxTextCtrl::AdoptAttributesFromHWND()
248 wxWindow::AdoptAttributesFromHWND();
250 HWND hWnd
= GetHwnd();
251 long style
= GetWindowLong(hWnd
, GWL_STYLE
);
253 // retrieve the style to see whether this is an edit or richedit ctrl
257 GetClassName(hWnd
, buf
, WXSIZEOF(buf
));
259 if ( wxStricmp(buf
, _T("EDIT")) == 0 )
263 #endif // wxUSE_RICHEDIT
265 if (style
& ES_MULTILINE
)
266 m_windowStyle
|= wxTE_MULTILINE
;
267 if (style
& ES_PASSWORD
)
268 m_windowStyle
|= wxTE_PASSWORD
;
269 if (style
& ES_READONLY
)
270 m_windowStyle
|= wxTE_READONLY
;
271 if (style
& ES_WANTRETURN
)
272 m_windowStyle
|= wxTE_PROCESS_ENTER
;
275 void wxTextCtrl::SetupColours()
277 // FIXME why is bg colour not inherited from parent?
278 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW
));
279 SetForegroundColour(GetParent()->GetForegroundColour());
282 // ----------------------------------------------------------------------------
283 // set/get the controls text
284 // ----------------------------------------------------------------------------
286 wxString
wxTextCtrl::GetValue() const
288 return wxGetWindowText(GetHWND());
291 void wxTextCtrl::SetValue(const wxString
& value
)
293 wxString valueDos
= wxTextFile::Translate(value
, wxTextFileType_Dos
);
295 SetWindowText(GetHwnd(), valueDos
);
300 void wxTextCtrl::WriteText(const wxString
& value
)
302 wxString valueDos
= wxTextFile::Translate(value
, wxTextFileType_Dos
);
304 SendMessage(GetHwnd(), EM_REPLACESEL
, 0, (LPARAM
)valueDos
.c_str());
309 void wxTextCtrl::AppendText(const wxString
& text
)
311 SetInsertionPointEnd();
315 void wxTextCtrl::Clear()
317 SetWindowText(GetHwnd(), _T(""));
320 // ----------------------------------------------------------------------------
321 // Clipboard operations
322 // ----------------------------------------------------------------------------
324 void wxTextCtrl::Copy()
328 HWND hWnd
= GetHwnd();
329 SendMessage(hWnd
, WM_COPY
, 0, 0L);
333 void wxTextCtrl::Cut()
337 HWND hWnd
= GetHwnd();
338 SendMessage(hWnd
, WM_CUT
, 0, 0L);
342 void wxTextCtrl::Paste()
346 HWND hWnd
= GetHwnd();
347 SendMessage(hWnd
, WM_PASTE
, 0, 0L);
351 bool wxTextCtrl::CanCopy() const
353 // Can copy if there's a selection
355 GetSelection(& from
, & to
);
359 bool wxTextCtrl::CanCut() const
361 // Can cut if there's a selection
363 GetSelection(& from
, & to
);
367 bool wxTextCtrl::CanPaste() const
372 int dataFormat
= 0; // 0 == any format
373 return (::SendMessage( GetHwnd(), EM_CANPASTE
, (WPARAM
) (UINT
) dataFormat
, 0) != 0);
379 // Standard edit control: check for straight text on clipboard
380 bool isTextAvailable
= FALSE
;
381 if ( ::OpenClipboard(GetHwndOf(wxTheApp
->GetTopWindow())) )
383 isTextAvailable
= (::IsClipboardFormatAvailable(CF_TEXT
) != 0);
387 return isTextAvailable
;
390 // ----------------------------------------------------------------------------
392 // ----------------------------------------------------------------------------
394 void wxTextCtrl::SetEditable(bool editable
)
396 HWND hWnd
= GetHwnd();
397 SendMessage(hWnd
, EM_SETREADONLY
, (WPARAM
)!editable
, (LPARAM
)0L);
400 void wxTextCtrl::SetInsertionPoint(long pos
)
402 HWND hWnd
= GetHwnd();
410 SendMessage(hWnd
, EM_EXSETSEL
, 0, (LPARAM
) &range
);
411 SendMessage(hWnd
, EM_SCROLLCARET
, (WPARAM
)0, (LPARAM
)0);
414 #endif // wxUSE_RICHEDIT
416 SendMessage(hWnd
, EM_SETSEL
, pos
, pos
);
417 SendMessage(hWnd
, EM_SCROLLCARET
, (WPARAM
)0, (LPARAM
)0);
420 SendMessage(hWnd
, EM_SETSEL
, 0, MAKELPARAM(pos
, pos
));
423 static const char *nothing
= "";
424 SendMessage(hWnd
, EM_REPLACESEL
, 0, (LPARAM
)nothing
);
427 void wxTextCtrl::SetInsertionPointEnd()
429 long pos
= GetLastPosition();
430 SetInsertionPoint(pos
);
433 long wxTextCtrl::GetInsertionPoint() const
441 SendMessage(GetHwnd(), EM_EXGETSEL
, 0, (LPARAM
) &range
);
446 DWORD Pos
= (DWORD
)SendMessage(GetHwnd(), EM_GETSEL
, 0, 0L);
450 long wxTextCtrl::GetLastPosition() const
452 HWND hWnd
= GetHwnd();
454 // Will always return a number > 0 (according to docs)
455 int noLines
= (int)SendMessage(hWnd
, EM_GETLINECOUNT
, (WPARAM
)0, (LPARAM
)0L);
457 // This gets the char index for the _beginning_ of the last line
458 int charIndex
= (int)SendMessage(hWnd
, EM_LINEINDEX
, (WPARAM
)(noLines
-1), (LPARAM
)0L);
460 // Get number of characters in the last line. We'll add this to the character
461 // index for the last line, 1st position.
462 int lineLength
= (int)SendMessage(hWnd
, EM_LINELENGTH
, (WPARAM
)charIndex
, (LPARAM
)0L);
464 return (long)(charIndex
+ lineLength
);
467 // If the return values from and to are the same, there is no
469 void wxTextCtrl::GetSelection(long* from
, long* to
) const
475 ::SendMessage(GetHwnd(), EM_EXGETSEL
, 0, (LPARAM
) (CHARRANGE
*) & charRange
);
477 *from
= charRange
.cpMin
;
478 *to
= charRange
.cpMax
;
483 DWORD dwStart
, dwEnd
;
484 WPARAM wParam
= (WPARAM
) (DWORD
*) & dwStart
; // receives starting position
485 LPARAM lParam
= (LPARAM
) (DWORD
*) & dwEnd
; // receives ending position
487 ::SendMessage(GetHwnd(), EM_GETSEL
, wParam
, lParam
);
493 bool wxTextCtrl::IsEditable() const
495 long style
= ::GetWindowLong(GetHwnd(), GWL_STYLE
);
497 return ((style
& ES_READONLY
) == 0);
500 // ----------------------------------------------------------------------------
502 // ----------------------------------------------------------------------------
504 void wxTextCtrl::Replace(long from
, long to
, const wxString
& value
)
507 HWND hWnd
= GetHwnd();
508 long fromChar
= from
;
511 // Set selection and remove it
513 SendMessage(hWnd
, EM_SETSEL
, fromChar
, toChar
);
515 SendMessage(hWnd
, EM_SETSEL
, (WPARAM
)0, (LPARAM
)MAKELONG(fromChar
, toChar
));
517 SendMessage(hWnd
, WM_CUT
, (WPARAM
)0, (LPARAM
)0);
519 // Now replace with 'value', by pasting.
520 wxSetClipboardData(wxDF_TEXT
, (wxObject
*) (const wxChar
*)value
, 0, 0);
522 // Paste into edit control
523 SendMessage(hWnd
, WM_PASTE
, (WPARAM
)0, (LPARAM
)0L);
525 wxFAIL_MSG("wxTextCtrl::Replace not implemented if wxUSE_CLIPBOARD is 0.");
529 void wxTextCtrl::Remove(long from
, long to
)
531 HWND hWnd
= GetHwnd();
532 long fromChar
= from
;
535 // Cut all selected text
537 SendMessage(hWnd
, EM_SETSEL
, fromChar
, toChar
);
539 SendMessage(hWnd
, EM_SETSEL
, (WPARAM
)0, (LPARAM
)MAKELONG(fromChar
, toChar
));
541 SendMessage(hWnd
, WM_CUT
, (WPARAM
)0, (LPARAM
)0);
544 void wxTextCtrl::SetSelection(long from
, long to
)
546 HWND hWnd
= GetHwnd();
547 long fromChar
= from
;
550 // if from and to are both -1, it means (in wxWindows) that all text should
551 // be selected. Translate into Windows convention
552 if ((from
== -1) && (to
== -1))
559 SendMessage(hWnd
, EM_SETSEL
, (WPARAM
)fromChar
, (LPARAM
)toChar
);
560 SendMessage(hWnd
, EM_SCROLLCARET
, (WPARAM
)0, (LPARAM
)0);
562 // WPARAM is 0: selection is scrolled into view
563 SendMessage(hWnd
, EM_SETSEL
, (WPARAM
)0, (LPARAM
)MAKELONG(fromChar
, toChar
));
567 bool wxTextCtrl::LoadFile(const wxString
& file
)
569 if ( wxTextCtrlBase::LoadFile(file
) )
571 // update the size limit if needed
580 bool wxTextCtrl::IsModified() const
582 return (SendMessage(GetHwnd(), EM_GETMODIFY
, 0, 0) != 0);
585 // Makes 'unmodified'
586 void wxTextCtrl::DiscardEdits()
588 SendMessage(GetHwnd(), EM_SETMODIFY
, FALSE
, 0L);
591 int wxTextCtrl::GetNumberOfLines() const
593 return (int)SendMessage(GetHwnd(), EM_GETLINECOUNT
, (WPARAM
)0, (LPARAM
)0);
596 long wxTextCtrl::XYToPosition(long x
, long y
) const
598 HWND hWnd
= GetHwnd();
600 // This gets the char index for the _beginning_ of this line
601 int charIndex
= (int)SendMessage(hWnd
, EM_LINEINDEX
, (WPARAM
)y
, (LPARAM
)0);
602 return (long)(x
+ charIndex
);
605 bool wxTextCtrl::PositionToXY(long pos
, long *x
, long *y
) const
607 HWND hWnd
= GetHwnd();
609 // This gets the line number containing the character
614 lineNo
= (int)SendMessage(hWnd
, EM_EXLINEFROMCHAR
, 0, (LPARAM
)pos
);
617 #endif // wxUSE_RICHEDIT
618 lineNo
= (int)SendMessage(hWnd
, EM_LINEFROMCHAR
, (WPARAM
)pos
, 0);
626 // This gets the char index for the _beginning_ of this line
627 int charIndex
= (int)SendMessage(hWnd
, EM_LINEINDEX
, (WPARAM
)lineNo
, (LPARAM
)0);
628 if ( charIndex
== -1 )
633 // The X position must therefore be the different between pos and charIndex
635 *x
= (long)(pos
- charIndex
);
642 void wxTextCtrl::ShowPosition(long pos
)
644 HWND hWnd
= GetHwnd();
646 // To scroll to a position, we pass the number of lines and characters
647 // to scroll *by*. This means that we need to:
648 // (1) Find the line position of the current line.
649 // (2) Find the line position of pos.
650 // (3) Scroll by (pos - current).
651 // For now, ignore the horizontal scrolling.
653 // Is this where scrolling is relative to - the line containing the caret?
654 // Or is the first visible line??? Try first visible line.
655 // int currentLineLineNo1 = (int)SendMessage(hWnd, EM_LINEFROMCHAR, (WPARAM)-1, (LPARAM)0L);
657 int currentLineLineNo
= (int)SendMessage(hWnd
, EM_GETFIRSTVISIBLELINE
, (WPARAM
)0, (LPARAM
)0L);
659 int specifiedLineLineNo
= (int)SendMessage(hWnd
, EM_LINEFROMCHAR
, (WPARAM
)pos
, (LPARAM
)0L);
661 int linesToScroll
= specifiedLineLineNo
- currentLineLineNo
;
663 if (linesToScroll
!= 0)
664 (void)SendMessage(hWnd
, EM_LINESCROLL
, (WPARAM
)0, (LPARAM
)linesToScroll
);
667 int wxTextCtrl::GetLineLength(long lineNo
) const
669 long charIndex
= XYToPosition(0, lineNo
);
670 int len
= (int)SendMessage(GetHwnd(), EM_LINELENGTH
, charIndex
, 0);
674 wxString
wxTextCtrl::GetLineText(long lineNo
) const
676 size_t len
= (size_t)GetLineLength(lineNo
) + 1;
677 char *buf
= (char *)malloc(len
);
679 int noChars
= (int)SendMessage(GetHwnd(), EM_GETLINE
, lineNo
, (LPARAM
)buf
);
689 // ----------------------------------------------------------------------------
691 // ----------------------------------------------------------------------------
693 void wxTextCtrl::Undo()
697 ::SendMessage(GetHwnd(), EM_UNDO
, 0, 0);
701 void wxTextCtrl::Redo()
705 // Same as Undo, since Undo undoes the undo, i.e. a redo.
706 ::SendMessage(GetHwnd(), EM_UNDO
, 0, 0);
710 bool wxTextCtrl::CanUndo() const
712 return (::SendMessage(GetHwnd(), EM_CANUNDO
, 0, 0) != 0);
715 bool wxTextCtrl::CanRedo() const
717 return (::SendMessage(GetHwnd(), EM_CANUNDO
, 0, 0) != 0);
720 // ----------------------------------------------------------------------------
721 // implemenation details
722 // ----------------------------------------------------------------------------
724 void wxTextCtrl::Command(wxCommandEvent
& event
)
726 SetValue(event
.GetString());
727 ProcessCommand (event
);
730 void wxTextCtrl::OnDropFiles(wxDropFilesEvent
& event
)
732 // By default, load the first file into the text window.
733 if (event
.GetNumberOfFiles() > 0)
735 LoadFile(event
.GetFiles()[0]);
739 WXHBRUSH
wxTextCtrl::OnCtlColor(WXHDC pDC
, WXHWND pWnd
, WXUINT nCtlColor
,
740 WXUINT message
, WXWPARAM wParam
,
746 HBRUSH hbrush
= Ctl3dCtlColorEx(message
, wParam
, lParam
);
747 return (WXHBRUSH
) hbrush
;
752 SetBkMode(hdc
, GetParent()->GetTransparentBackground() ? TRANSPARENT
755 ::SetBkColor(hdc
, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
756 ::SetTextColor(hdc
, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
758 wxBrush
*backgroundBrush
= wxTheBrushList
->FindOrCreateBrush(GetBackgroundColour(), wxSOLID
);
760 return (WXHBRUSH
) backgroundBrush
->GetResourceHandle();
763 void wxTextCtrl::OnChar(wxKeyEvent
& event
)
765 switch ( event
.KeyCode() )
768 if ( !(m_windowStyle
& wxTE_MULTILINE
) )
770 wxCommandEvent
event(wxEVT_COMMAND_TEXT_ENTER
, m_windowId
);
771 event
.SetEventObject( this );
772 if ( GetEventHandler()->ProcessEvent(event
) )
775 //else: multiline controls need Enter for themselves
780 // always produce navigation event - even if we process TAB
781 // ourselves the fact that we got here means that the user code
782 // decided to skip processing of this TAB - probably to let it
783 // do its default job.
785 // NB: Notice that Ctrl-Tab is handled elsewhere and Alt-Tab is
786 // handled by Windows
788 wxNavigationKeyEvent eventNav
;
789 eventNav
.SetDirection(!event
.ShiftDown());
790 eventNav
.SetWindowChange(FALSE
);
791 eventNav
.SetEventObject(this);
793 if ( GetEventHandler()->ProcessEvent(eventNav
) )
803 // don't just call event.Skip() because this will cause TABs and ENTERs
804 // be passed upwards and we don't always want this - instead process it
811 bool wxTextCtrl::MSWCommand(WXUINT param
, WXWORD
WXUNUSED(id
))
818 wxFocusEvent
event(param
== EN_KILLFOCUS
? wxEVT_KILL_FOCUS
821 event
.SetEventObject( this );
822 GetEventHandler()->ProcessEvent(event
);
828 wxCommandEvent
event(wxEVT_COMMAND_TEXT_UPDATED
, m_windowId
);
829 wxString
val(GetValue());
831 event
.m_commandString
= WXSTRINGCAST val
;
832 event
.SetEventObject( this );
833 ProcessCommand(event
);
838 // the text size limit has been hit - increase it
842 // the other notification messages are not processed
855 void wxTextCtrl::AdjustSpaceLimit()
858 unsigned int len
= ::GetWindowTextLength(GetHwnd()),
859 limit
= ::SendMessage(GetHwnd(), EM_GETLIMITTEXT
, 0, 0);
862 limit
= len
+ 0x8000; // 32Kb
865 if ( m_isRich
|| limit
> 0xffff )
867 if ( limit
> 0xffff )
869 ::SendMessage(GetHwnd(), EM_LIMITTEXT
, 0, limit
);
871 ::SendMessage(GetHwnd(), EM_LIMITTEXT
, limit
, 0);
876 bool wxTextCtrl::AcceptsFocus() const
878 // we don't want focus if we can't be edited
879 return IsEditable() && wxControl::AcceptsFocus();
882 wxSize
wxTextCtrl::DoGetBestSize()
885 wxGetCharSize(GetHWND(), &cx
, &cy
, &GetFont());
887 int wText
= DEFAULT_ITEM_WIDTH
;
889 int hText
= EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy
);
890 if ( m_windowStyle
& wxTE_MULTILINE
)
892 hText
*= wxMin(GetNumberOfLines(), 5);
894 //else: for single line control everything is ok
896 return wxSize(wText
, hText
);
899 // ----------------------------------------------------------------------------
900 // standard handlers for standard edit menu events
901 // ----------------------------------------------------------------------------
903 void wxTextCtrl::OnCut(wxCommandEvent
& event
)
908 void wxTextCtrl::OnCopy(wxCommandEvent
& event
)
913 void wxTextCtrl::OnPaste(wxCommandEvent
& event
)
918 void wxTextCtrl::OnUndo(wxCommandEvent
& event
)
923 void wxTextCtrl::OnRedo(wxCommandEvent
& event
)
928 void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent
& event
)
930 event
.Enable( CanCut() );
933 void wxTextCtrl::OnUpdateCopy(wxUpdateUIEvent
& event
)
935 event
.Enable( CanCopy() );
938 void wxTextCtrl::OnUpdatePaste(wxUpdateUIEvent
& event
)
940 event
.Enable( CanPaste() );
943 void wxTextCtrl::OnUpdateUndo(wxUpdateUIEvent
& event
)
945 event
.Enable( CanUndo() );
948 void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent
& event
)
950 event
.Enable( CanRedo() );