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