]> git.saurik.com Git - wxWidgets.git/blame - src/mac/textctrl.cpp
fixing mngw32 (cross)compilation
[wxWidgets.git] / src / mac / textctrl.cpp
CommitLineData
e9576ca5
SC
1/////////////////////////////////////////////////////////////////////////////
2// Name: textctrl.cpp
3// Purpose: wxTextCtrl
4// Author: AUTHOR
5// Modified by:
6// Created: ??/??/98
7// RCS-ID: $Id$
8// Copyright: (c) AUTHOR
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifdef __GNUG__
13#pragma implementation "textctrl.h"
14#endif
15
03e11df5
GD
16#ifdef __UNIX__
17 #include <sys/types.h>
18 #include <sys/stat.h>
e9576ca5 19#else
03e11df5 20 #include <stat.h>
e9576ca5
SC
21#endif
22#include <fstream.h>
23
03e11df5 24#include "wx/app.h"
5fde6fcc 25#include "wx/dc.h"
03e11df5
GD
26#include "wx/button.h"
27#include "wx/panel.h"
e9576ca5 28#include "wx/textctrl.h"
90b22aca
SC
29#include "wx/notebook.h"
30#include "wx/tabctrl.h"
e9576ca5
SC
31#include "wx/settings.h"
32#include "wx/filefn.h"
33#include "wx/utils.h"
34
35#if defined(__BORLANDC__) && !defined(__WIN32__)
03e11df5
GD
36 #include <alloc.h>
37#elif !defined(__MWERKS__) && !defined(__GNUWIN32) && !defined(__WXMAC_X__)
38 #include <malloc.h>
e9576ca5
SC
39#endif
40
519cb848
SC
41#include "wx/mac/uma.h"
42
2f1ae414 43#if !USE_SHARED_LIBRARY
e9576ca5
SC
44IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
45
46BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
47 EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
519cb848 48 EVT_CHAR(wxTextCtrl::OnChar)
2f1ae414
SC
49 EVT_MENU(wxID_CUT, wxTextCtrl::OnCut)
50 EVT_MENU(wxID_COPY, wxTextCtrl::OnCopy)
51 EVT_MENU(wxID_PASTE, wxTextCtrl::OnPaste)
52 EVT_MENU(wxID_UNDO, wxTextCtrl::OnUndo)
53 EVT_MENU(wxID_REDO, wxTextCtrl::OnRedo)
54
55 EVT_UPDATE_UI(wxID_CUT, wxTextCtrl::OnUpdateCut)
56 EVT_UPDATE_UI(wxID_COPY, wxTextCtrl::OnUpdateCopy)
57 EVT_UPDATE_UI(wxID_PASTE, wxTextCtrl::OnUpdatePaste)
58 EVT_UPDATE_UI(wxID_UNDO, wxTextCtrl::OnUpdateUndo)
59 EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo)
e9576ca5 60END_EVENT_TABLE()
2f1ae414 61#endif
e9576ca5
SC
62
63// Text item
64wxTextCtrl::wxTextCtrl()
e9576ca5 65{
e9576ca5
SC
66}
67
2f1ae414
SC
68const short kVerticalMargin = 2 ;
69const short kHorizontalMargin = 2 ;
70
e9576ca5 71bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id,
519cb848 72 const wxString& st,
e9576ca5
SC
73 const wxPoint& pos,
74 const wxSize& size, long style,
75 const wxValidator& validator,
76 const wxString& name)
77{
2f1ae414
SC
78 // base initialization
79 if ( !CreateBase(parent, id, pos, size, style, validator, name) )
80 return FALSE;
519cb848
SC
81
82 wxSize mySize = size ;
2f1ae414
SC
83 if ( UMAHasAppearance() )
84 {
85 m_macHorizontalBorder = 5 ; // additional pixels around the real control
86 m_macVerticalBorder = 5 ;
87 }
88 else
89 {
90 m_macHorizontalBorder = 0 ; // additional pixels around the real control
91 m_macVerticalBorder = 0 ;
92 }
93
519cb848
SC
94
95 Rect bounds ;
96 Str255 title ;
2f1ae414 97
519cb848
SC
98 if ( mySize.y == -1 )
99 {
100 if ( UMAHasAppearance() )
2f1ae414 101 mySize.y = 13 ;
519cb848
SC
102 else
103 mySize.y = 24 ;
2f1ae414
SC
104
105 mySize.y += 2 * m_macVerticalBorder ;
519cb848 106 }
2f1ae414 107
519cb848
SC
108 MacPreControlCreate( parent , id , "" , pos , mySize ,style, validator , name , &bounds , title ) ;
109
110 m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , "\p" , true , 0 , 0 , 1,
2f1ae414 111 ( style & wxTE_PASSWORD ) ? kControlEditTextPasswordProc : kControlEditTextProc , (long) this ) ;
519cb848
SC
112 MacPostControlCreate() ;
113
114 wxString value ;
115
5b781a67
SC
116 {
117 TEHandle teH ;
118 long size ;
119
120 UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
121 (*teH)->lineHeight = -1 ;
122 }
123
519cb848
SC
124 if( wxApp::s_macDefaultEncodingIsPC )
125 value = wxMacMakeMacStringFromPC( st ) ;
126 else
127 value = st ;
2f1ae414 128 UMASetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
519cb848
SC
129
130 return TRUE;
e9576ca5
SC
131}
132
133wxString wxTextCtrl::GetValue() const
134{
519cb848 135 Size actualsize;
2f1ae414 136 UMAGetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , 32767 , wxBuffer , &actualsize) ;
519cb848
SC
137 wxBuffer[actualsize] = 0 ;
138 if( wxApp::s_macDefaultEncodingIsPC )
139 return wxMacMakePCStringFromMac( wxBuffer ) ;
140 else
141 return wxString(wxBuffer);
e9576ca5
SC
142}
143
2f1ae414
SC
144void wxTextCtrl::GetSelection(long* from, long* to) const
145{
146 ControlEditTextSelectionRec selection ;
147 TEHandle teH ;
148 long size ;
149
150 UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
151
152 *from = (**teH).selStart;
153 *to = (**teH).selEnd;
154}
155
519cb848
SC
156void wxTextCtrl::SetValue(const wxString& st)
157{
158 wxString value ;
159
160 if( wxApp::s_macDefaultEncodingIsPC )
161 value = wxMacMakeMacStringFromPC( st ) ;
162 else
163 value = st ;
2f1ae414 164 UMASetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , value.Length() , (char*) ((const char*)value) ) ;
90b22aca
SC
165 WindowRef window = GetMacRootWindow() ;
166 if ( window )
167 {
168 wxWindow* win = wxFindWinFromMacWindow( window ) ;
169 if ( win )
170 {
171 wxMacDrawingHelper help( win ) ;
172 // the mac control manager always assumes to have the origin at 0,0
173 SetOrigin( 0 , 0 ) ;
174
175 bool hasTabBehind = false ;
176 wxWindow* parent = GetParent() ;
177 while ( parent )
178 {
179 if( parent->MacGetWindowData() )
180 {
181 UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
182 break ;
183 }
184
185 if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
186 {
187 if ( ((wxControl*)parent)->GetMacControl() )
188 SetUpControlBackground( ((wxControl*)parent)->GetMacControl() , -1 , true ) ;
189 break ;
190 }
191
192 parent = parent->GetParent() ;
193 }
194
195 UMADrawControl( m_macControl ) ;
196 UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
197 wxDC::MacInvalidateSetup() ;
198 }
199 }
e9576ca5
SC
200}
201
e9576ca5
SC
202// Clipboard operations
203void wxTextCtrl::Copy()
204{
2f1ae414
SC
205 if (CanCopy())
206 {
207 TEHandle teH ;
208 long size ;
519cb848 209
2f1ae414
SC
210 UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
211 TECopy( teH ) ;
212#if TARGET_CARBON
213 OSStatus err ;
214 err = ClearCurrentScrap( );
215#else
216 OSErr err ;
217 err = ZeroScrap( );
218#endif
219 TEToScrap() ;
220 }
e9576ca5
SC
221}
222
223void wxTextCtrl::Cut()
224{
2f1ae414
SC
225 if (CanCut())
226 {
227 TEHandle teH ;
228 long size ;
519cb848 229
2f1ae414
SC
230 UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
231 TECut( teH ) ;
232#if TARGET_CARBON
233 OSStatus err ;
234 err = ClearCurrentScrap( );
235#else
236 OSErr err ;
237 err = ZeroScrap( );
238#endif
239 TEToScrap() ;
240 // MacInvalidateControl() ;
241 }
e9576ca5
SC
242}
243
244void wxTextCtrl::Paste()
245{
2f1ae414
SC
246 if (CanPaste())
247 {
248 TEHandle teH ;
249 long size ;
519cb848 250
2f1ae414
SC
251 UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
252 TEFromScrap() ;
253 TEPaste( teH ) ;
90b22aca
SC
254 WindowRef window = GetMacRootWindow() ;
255 if ( window )
256 {
257 wxWindow* win = wxFindWinFromMacWindow( window ) ;
258 if ( win )
259 {
260 wxMacDrawingHelper help( win ) ;
261 // the mac control manager always assumes to have the origin at 0,0
262 SetOrigin( 0 , 0 ) ;
263
264 bool hasTabBehind = false ;
265 wxWindow* parent = GetParent() ;
266 while ( parent )
267 {
268 if( parent->MacGetWindowData() )
269 {
270 UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , kThemeBrushDialogBackgroundActive , false ) ;
271 break ;
272 }
273
274 if( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
275 {
276 if ( ((wxControl*)parent)->GetMacControl() )
277 SetUpControlBackground( ((wxControl*)parent)->GetMacControl() , -1 , true ) ;
278 break ;
279 }
280
281 parent = parent->GetParent() ;
282 }
283
284 UMADrawControl( m_macControl ) ;
285 UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
286 wxDC::MacInvalidateSetup() ;
287 }
288 }
2f1ae414
SC
289 }
290}
291
292bool wxTextCtrl::CanCopy() const
293{
294 // Can copy if there's a selection
295 long from, to;
296 GetSelection(& from, & to);
297 return (from != to);
298}
299
300bool wxTextCtrl::CanCut() const
301{
302 // Can cut if there's a selection
303 long from, to;
304 GetSelection(& from, & to);
305 return (from != to);
306}
307
308bool wxTextCtrl::CanPaste() const
309{
310 if (!IsEditable())
311 return FALSE;
312
313 long offset ;
314#if TARGET_CARBON
315 OSStatus err = noErr;
316 ScrapRef scrapRef;
317
318 err = GetCurrentScrap( &scrapRef );
319 if ( err != noTypeErr && err != memFullErr )
320 {
321 ScrapFlavorFlags flavorFlags;
322 Size byteCount;
323
324 if (( err = GetScrapFlavorFlags( scrapRef, 'TEXT', &flavorFlags )) == noErr)
325 {
326 if (( err = GetScrapFlavorSize( scrapRef, 'TEXT', &byteCount )) == noErr)
327 {
328 return TRUE ;
329 }
330 }
331 }
332 return FALSE;
333
334#else
335 if ( GetScrap( NULL , 'TEXT' , &offset ) > 0 )
336 {
337 return TRUE ;
338 }
339#endif
340 return FALSE ;
e9576ca5
SC
341}
342
343void wxTextCtrl::SetEditable(bool editable)
344{
519cb848
SC
345 if ( editable )
346 UMAActivateControl( m_macControl ) ;
347 else
348 UMADeactivateControl( m_macControl ) ;
e9576ca5
SC
349}
350
351void wxTextCtrl::SetInsertionPoint(long pos)
352{
519cb848 353 SetSelection( pos , pos ) ;
e9576ca5
SC
354}
355
356void wxTextCtrl::SetInsertionPointEnd()
357{
358 long pos = GetLastPosition();
359 SetInsertionPoint(pos);
360}
361
362long wxTextCtrl::GetInsertionPoint() const
363{
519cb848
SC
364 ControlEditTextSelectionRec selection ;
365 TEHandle teH ;
366 long size ;
367
368 UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
369// UMAGetControlData( m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection , &size ) ;
370 return (**teH).selStart ;
e9576ca5
SC
371}
372
373long wxTextCtrl::GetLastPosition() const
374{
519cb848
SC
375 ControlEditTextSelectionRec selection ;
376 TEHandle teH ;
377 long size ;
378
379 UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
380
381// UMAGetControlData( m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection , &size ) ;
382 return (**teH).teLength ;
e9576ca5
SC
383}
384
385void wxTextCtrl::Replace(long from, long to, const wxString& value)
386{
519cb848
SC
387 TEHandle teH ;
388 long size ;
389
390 ControlEditTextSelectionRec selection ;
391
392 selection.selStart = from ;
393 selection.selEnd = to ;
394 UMASetControlData( m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
395 UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
396 TESetSelect( from , to , teH ) ;
397 TEDelete( teH ) ;
398 TEInsert( value , value.Length() , teH ) ;
399// MacInvalidateControl() ;
e9576ca5
SC
400}
401
402void wxTextCtrl::Remove(long from, long to)
403{
519cb848
SC
404 TEHandle teH ;
405 long size ;
406
407 ControlEditTextSelectionRec selection ;
408
409 selection.selStart = from ;
410 selection.selEnd = to ;
411 UMASetControlData( m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
412 UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
413 TEDelete( teH ) ;
414// MacInvalidateControl() ;
e9576ca5
SC
415}
416
417void wxTextCtrl::SetSelection(long from, long to)
418{
519cb848
SC
419 ControlEditTextSelectionRec selection ;
420 TEHandle teH ;
421 long size ;
422
423 UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
424
425 selection.selStart = from ;
426 selection.selEnd = to ;
427
428 UMASetControlData( m_macControl , 0, kControlEditTextSelectionTag , sizeof( selection ) , (char*) &selection ) ;
429 TESetSelect( selection.selStart , selection.selEnd , teH ) ;
e9576ca5
SC
430}
431
432bool wxTextCtrl::LoadFile(const wxString& file)
433{
2f1ae414 434 if ( wxTextCtrlBase::LoadFile(file) )
e9576ca5 435 {
2f1ae414 436 return TRUE;
e9576ca5 437 }
e9576ca5
SC
438
439 return FALSE;
440}
441
442void wxTextCtrl::WriteText(const wxString& text)
443{
519cb848
SC
444 TEHandle teH ;
445 long size ;
446
447 memcpy( wxBuffer, text , text.Length() ) ;
448 wxBuffer[text.Length() ] = 0 ;
449// wxMacConvertNewlines( wxBuffer , wxBuffer ) ;
450
451 UMAGetControlData( m_macControl , 0, kControlEditTextTEHandleTag , sizeof( TEHandle ) , (char*) &teH , &size ) ;
452
453 TEInsert( wxBuffer , strlen( wxBuffer) , teH ) ;
454 Refresh() ;
e9576ca5
SC
455}
456
13c21be5
HH
457void wxTextCtrl::AppendText(const wxString& text)
458{
519cb848
SC
459 SetInsertionPointEnd();
460 WriteText(text);
13c21be5
HH
461}
462
e9576ca5
SC
463void wxTextCtrl::Clear()
464{
2f1ae414
SC
465 UMASetControlData( m_macControl, 0, ( m_windowStyle & wxTE_PASSWORD ) ? kControlEditTextPasswordTag : kControlEditTextTextTag , 0 , (char*) ((const char*)NULL) ) ;
466 Refresh() ;
e9576ca5
SC
467}
468
469bool wxTextCtrl::IsModified() const
470{
519cb848 471 return TRUE;
e9576ca5
SC
472}
473
2f1ae414
SC
474bool wxTextCtrl::IsEditable() const
475{
476 return IsEnabled();
477}
478
479bool wxTextCtrl::AcceptsFocus() const
480{
481 // we don't want focus if we can't be edited
482 return IsEditable() && wxControl::AcceptsFocus();
483}
484
485wxSize wxTextCtrl::DoGetBestSize() const
486{
487 int wText = 100 ;
488
489 int hText ;
490 if ( UMAHasAppearance() )
491 hText = 13 ;
492 else
493 hText = 24 ;
494 hText += 2 * m_macHorizontalBorder ;
495/*
496 int cx, cy;
497 wxGetCharSize(GetHWND(), &cx, &cy, &GetFont());
498
499 int wText = DEFAULT_ITEM_WIDTH;
500
501 int hText = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
502
503 return wxSize(wText, hText);
504*/
505 if ( m_windowStyle & wxTE_MULTILINE )
506 {
507 hText *= wxMin(GetNumberOfLines(), 5);
508 }
509 //else: for single line control everything is ok
510 return wxSize(wText, hText);
511}
512
513// ----------------------------------------------------------------------------
514// Undo/redo
515// ----------------------------------------------------------------------------
516
517void wxTextCtrl::Undo()
518{
519 if (CanUndo())
520 {
521 }
522}
523
524void wxTextCtrl::Redo()
525{
526 if (CanRedo())
527 {
528 }
529}
530
531bool wxTextCtrl::CanUndo() const
532{
533 return FALSE ;
534}
535
536bool wxTextCtrl::CanRedo() const
537{
538 return FALSE ;
539}
540
e9576ca5
SC
541// Makes 'unmodified'
542void wxTextCtrl::DiscardEdits()
543{
544 // TODO
545}
546
547int wxTextCtrl::GetNumberOfLines() const
548{
549 // TODO
550 return 0;
551}
552
553long wxTextCtrl::XYToPosition(long x, long y) const
554{
555 // TODO
556 return 0;
557}
558
2f1ae414 559bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
e9576ca5 560{
2f1ae414 561 return FALSE ;
e9576ca5
SC
562}
563
564void wxTextCtrl::ShowPosition(long pos)
565{
566 // TODO
567}
568
569int wxTextCtrl::GetLineLength(long lineNo) const
570{
519cb848 571 return GetValue().Length();
e9576ca5
SC
572}
573
574wxString wxTextCtrl::GetLineText(long lineNo) const
575{
519cb848 576 return GetValue();
e9576ca5
SC
577}
578
579/*
580 * Text item
581 */
582
583void wxTextCtrl::Command(wxCommandEvent & event)
584{
585 SetValue (event.GetString());
586 ProcessCommand (event);
587}
588
589void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event)
590{
591 // By default, load the first file into the text window.
592 if (event.GetNumberOfFiles() > 0)
593 {
594 LoadFile(event.GetFiles()[0]);
595 }
596}
597
519cb848
SC
598void wxTextCtrl::OnChar(wxKeyEvent& event)
599{
2f1ae414 600 switch ( event.KeyCode() )
519cb848
SC
601 {
602 case WXK_RETURN:
2f1ae414
SC
603 if (m_windowStyle & wxPROCESS_ENTER)
604 {
e7549107
SC
605 wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
606 event.SetEventObject( this );
607 if ( GetEventHandler()->ProcessEvent(event) )
608 return;
2f1ae414
SC
609 }
610 if ( !(m_windowStyle & wxTE_MULTILINE) )
611 {
612 wxWindow *parent = GetParent();
613 wxPanel *panel = wxDynamicCast(parent, wxPanel);
614 while ( parent != NULL && panel == NULL )
615 {
616 parent = parent->GetParent() ;
617 panel = wxDynamicCast(parent, wxPanel);
618 }
619 if ( panel && panel->GetDefaultItem() )
620 {
621 wxButton *def = panel->GetDefaultItem() ;
622 wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
623 event.SetEventObject(def);
624 def->Command(event);
625 event.Skip() ;
626 return ;
627 }
519cb848 628 }
e7549107
SC
629 //else: multiline controls need Enter for themselves
630
519cb848 631 break;
2f1ae414 632
519cb848 633 case WXK_TAB:
e7549107
SC
634 // always produce navigation event - even if we process TAB
635 // ourselves the fact that we got here means that the user code
636 // decided to skip processing of this TAB - probably to let it
637 // do its default job.
519cb848
SC
638 {
639 wxNavigationKeyEvent eventNav;
640 eventNav.SetDirection(!event.ShiftDown());
2f1ae414 641 eventNav.SetWindowChange(event.ControlDown());
519cb848 642 eventNav.SetEventObject(this);
e7549107 643
2f1ae414 644 if ( GetParent()->GetEventHandler()->ProcessEvent(eventNav) )
519cb848 645 return;
2f1ae414
SC
646 event.Skip() ;
647 return ;
519cb848
SC
648 }
649 break;
650 }
e7549107 651
2f1ae414
SC
652 EventRecord *ev = wxTheApp->MacGetCurrentEvent() ;
653 short keycode ;
654 short keychar ;
655 keychar = short(ev->message & charCodeMask);
656 keycode = short(ev->message & keyCodeMask) >> 8 ;
657 UMAHandleControlKey( m_macControl , keycode , keychar , ev->modifiers ) ;
658 if ( keychar >= 0x20 || event.KeyCode() == WXK_RETURN)
659 {
660 wxCommandEvent event(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
661 event.SetString( GetValue() ) ;
662 event.SetEventObject( this );
663 GetEventHandler()->ProcessEvent(event);
664 }
665
e9576ca5
SC
666}
667
2f1ae414
SC
668// ----------------------------------------------------------------------------
669// standard handlers for standard edit menu events
670// ----------------------------------------------------------------------------
671
672void wxTextCtrl::OnCut(wxCommandEvent& event)
673{
674 Cut();
e9576ca5
SC
675}
676
2f1ae414 677void wxTextCtrl::OnCopy(wxCommandEvent& event)
e9576ca5 678{
2f1ae414 679 Copy();
e9576ca5 680}
e9576ca5 681
2f1ae414 682void wxTextCtrl::OnPaste(wxCommandEvent& event)
e9576ca5 683{
2f1ae414 684 Paste();
e9576ca5
SC
685}
686
2f1ae414 687void wxTextCtrl::OnUndo(wxCommandEvent& event)
e9576ca5 688{
2f1ae414 689 Undo();
e9576ca5
SC
690}
691
2f1ae414 692void wxTextCtrl::OnRedo(wxCommandEvent& event)
e9576ca5 693{
2f1ae414 694 Redo();
e9576ca5
SC
695}
696
2f1ae414 697void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent& event)
e9576ca5 698{
2f1ae414 699 event.Enable( CanCut() );
e9576ca5
SC
700}
701
2f1ae414 702void wxTextCtrl::OnUpdateCopy(wxUpdateUIEvent& event)
e9576ca5 703{
2f1ae414 704 event.Enable( CanCopy() );
e9576ca5
SC
705}
706
2f1ae414 707void wxTextCtrl::OnUpdatePaste(wxUpdateUIEvent& event)
e9576ca5 708{
2f1ae414
SC
709 event.Enable( CanPaste() );
710}
e9576ca5 711
2f1ae414
SC
712void wxTextCtrl::OnUpdateUndo(wxUpdateUIEvent& event)
713{
714 event.Enable( CanUndo() );
715}
716
717void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event)
718{
719 event.Enable( CanRedo() );
e9576ca5
SC
720}
721