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