]> git.saurik.com Git - wxWidgets.git/blob - src/osx/textctrl_osx.cpp
Suppress unused parameter warnings.
[wxWidgets.git] / src / osx / textctrl_osx.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/textctrl_osx.cpp
3 // Purpose: wxTextCtrl
4 // Author: Stefan Csomor
5 // Modified by: Ryan Norton (MLTE GetLineLength and GetLineText)
6 // Created: 1998-01-01
7 // RCS-ID: $Id: textctrl.cpp 54820 2008-07-29 20:04:11Z SC $
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #include "wx/wxprec.h"
13
14 #if wxUSE_TEXTCTRL
15
16 #include "wx/textctrl.h"
17
18 #ifndef WX_PRECOMP
19 #include "wx/intl.h"
20 #include "wx/app.h"
21 #include "wx/utils.h"
22 #include "wx/dc.h"
23 #include "wx/button.h"
24 #include "wx/menu.h"
25 #include "wx/settings.h"
26 #include "wx/msgdlg.h"
27 #include "wx/toplevel.h"
28 #endif
29
30 #ifdef __DARWIN__
31 #include <sys/types.h>
32 #include <sys/stat.h>
33 #else
34 #include <stat.h>
35 #endif
36
37 #if wxUSE_STD_IOSTREAM
38 #if wxUSE_IOSTREAMH
39 #include <fstream.h>
40 #else
41 #include <fstream>
42 #endif
43 #endif
44
45 #include "wx/filefn.h"
46 #include "wx/sysopt.h"
47 #include "wx/thread.h"
48
49 #include "wx/osx/private.h"
50
51 IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxTextCtrlBase)
52
53 BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase)
54 EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
55 EVT_CHAR(wxTextCtrl::OnChar)
56 EVT_KEY_DOWN(wxTextCtrl::OnKeyDown)
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 EVT_MENU(wxID_CLEAR, wxTextCtrl::OnDelete)
63 EVT_MENU(wxID_SELECTALL, wxTextCtrl::OnSelectAll)
64
65 EVT_CONTEXT_MENU(wxTextCtrl::OnContextMenu)
66
67 EVT_UPDATE_UI(wxID_CUT, wxTextCtrl::OnUpdateCut)
68 EVT_UPDATE_UI(wxID_COPY, wxTextCtrl::OnUpdateCopy)
69 EVT_UPDATE_UI(wxID_PASTE, wxTextCtrl::OnUpdatePaste)
70 EVT_UPDATE_UI(wxID_UNDO, wxTextCtrl::OnUpdateUndo)
71 EVT_UPDATE_UI(wxID_REDO, wxTextCtrl::OnUpdateRedo)
72 EVT_UPDATE_UI(wxID_CLEAR, wxTextCtrl::OnUpdateDelete)
73 EVT_UPDATE_UI(wxID_SELECTALL, wxTextCtrl::OnUpdateSelectAll)
74 END_EVENT_TABLE()
75
76
77 void wxTextCtrl::Init()
78 {
79 m_dirty = false;
80
81 m_privateContextMenu = NULL;
82 m_triggerUpdateEvents = true ;
83 }
84
85 wxTextCtrl::~wxTextCtrl()
86 {
87 #if wxUSE_MENUS
88 delete m_privateContextMenu;
89 #endif
90 }
91
92 bool wxTextCtrl::Create( wxWindow *parent,
93 wxWindowID id,
94 const wxString& str,
95 const wxPoint& pos,
96 const wxSize& size,
97 long style,
98 const wxValidator& validator,
99 const wxString& name )
100 {
101 m_macIsUserPane = false ;
102 m_editable = true ;
103
104 if ( ! (style & wxNO_BORDER) )
105 style = (style & ~wxBORDER_MASK) | wxSUNKEN_BORDER ;
106
107 if ( !wxTextCtrlBase::Create( parent, id, pos, size, style & ~(wxHSCROLL | wxVSCROLL), validator, name ) )
108 return false;
109
110 if ( m_windowStyle & wxTE_MULTILINE )
111 {
112 // always turn on this style for multi-line controls
113 m_windowStyle |= wxTE_PROCESS_ENTER;
114 style |= wxTE_PROCESS_ENTER ;
115 }
116
117
118 m_peer = wxWidgetImpl::CreateTextControl( this, GetParent(), GetId(), str, pos, size, style, GetExtraStyle() );
119
120 MacPostControlCreate(pos, size) ;
121
122 #if wxOSX_USE_COCOA
123 // under carbon everything can already be set before the MacPostControlCreate embedding takes place
124 // but under cocoa for single line textfields this only works after everything has been set up
125 GetTextPeer()->SetStringValue(str);
126 #endif
127
128 // only now the embedding is correct and we can do a positioning update
129
130 MacSuperChangedPosition() ;
131
132 if ( m_windowStyle & wxTE_READONLY)
133 SetEditable( false ) ;
134
135 SetCursor( wxCursor( wxCURSOR_IBEAM ) ) ;
136
137 return true;
138 }
139
140 wxTextWidgetImpl* wxTextCtrl::GetTextPeer() const
141 {
142 return dynamic_cast<wxTextWidgetImpl*> (m_peer);
143 }
144
145 void wxTextCtrl::MacSuperChangedPosition()
146 {
147 wxWindow::MacSuperChangedPosition() ;
148 #if wxOSX_USE_CARBON
149 GetPeer()->SuperChangedPosition() ;
150 #endif
151 }
152
153 void wxTextCtrl::MacVisibilityChanged()
154 {
155 #if wxOSX_USE_CARBON
156 GetPeer()->VisibilityChanged( GetPeer()->IsVisible() );
157 #endif
158 }
159
160 void wxTextCtrl::MacCheckSpelling(bool check)
161 {
162 GetTextPeer()->CheckSpelling(check);
163 }
164
165 void wxTextCtrl::SetMaxLength(unsigned long len)
166 {
167 m_maxLength = len ;
168 }
169
170 bool wxTextCtrl::SetFont( const wxFont& font )
171 {
172 if ( !wxTextCtrlBase::SetFont( font ) )
173 return false ;
174
175 GetPeer()->SetFont( font , GetForegroundColour() , GetWindowStyle(), false /* dont ignore black */ ) ;
176
177 return true ;
178 }
179
180 bool wxTextCtrl::SetStyle(long start, long end, const wxTextAttr& style)
181 {
182 if (GetTextPeer())
183 GetTextPeer()->SetStyle( start , end , style ) ;
184
185 return true ;
186 }
187
188 bool wxTextCtrl::SetDefaultStyle(const wxTextAttr& style)
189 {
190 wxTextCtrlBase::SetDefaultStyle( style ) ;
191 SetStyle( -1 /*current selection*/ , -1 /*current selection*/ , GetDefaultStyle() ) ;
192
193 return true ;
194 }
195
196 bool wxTextCtrl::IsModified() const
197 {
198 return m_dirty;
199 }
200
201 bool wxTextCtrl::AcceptsFocus() const
202 {
203 // we don't want focus if we can't be edited
204 return /*IsEditable() && */ wxControl::AcceptsFocus();
205 }
206
207 wxSize wxTextCtrl::DoGetBestSize() const
208 {
209 if (GetTextPeer())
210 {
211 wxSize size = GetTextPeer()->GetBestSize();
212 if (size.x > 0 && size.y > 0)
213 return size;
214 }
215
216 int wText, hText;
217
218 // these are the numbers from the HIG:
219 // we reduce them by the borders first
220 wText = 100 ;
221
222 switch ( m_windowVariant )
223 {
224 case wxWINDOW_VARIANT_NORMAL :
225 hText = 22 - 6 ;
226 break ;
227
228 case wxWINDOW_VARIANT_SMALL :
229 hText = 19 - 6 ;
230 break ;
231
232 case wxWINDOW_VARIANT_MINI :
233 hText = 15 - 6 ;
234 break ;
235
236 default :
237 hText = 22 - 6;
238 break ;
239 }
240
241 // as the above numbers have some free space around the text
242 // we get 5 lines like this anyway
243 if ( m_windowStyle & wxTE_MULTILINE )
244 hText *= 5 ;
245
246 if ( !HasFlag(wxNO_BORDER) )
247 hText += 6 ;
248
249 return wxSize(wText, hText);
250 }
251
252 bool wxTextCtrl::GetStyle(long position, wxTextAttr& style)
253 {
254 return GetTextPeer()->GetStyle(position, style);
255 }
256
257 void wxTextCtrl::MarkDirty()
258 {
259 m_dirty = true;
260 }
261
262 void wxTextCtrl::DiscardEdits()
263 {
264 m_dirty = false;
265 }
266
267 int wxTextCtrl::GetNumberOfLines() const
268 {
269 return GetTextPeer()->GetNumberOfLines() ;
270 }
271
272 long wxTextCtrl::XYToPosition(long x, long y) const
273 {
274 return GetTextPeer()->XYToPosition( x , y ) ;
275 }
276
277 bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
278 {
279 return GetTextPeer()->PositionToXY( pos , x , y ) ;
280 }
281
282 void wxTextCtrl::ShowPosition(long pos)
283 {
284 return GetTextPeer()->ShowPosition(pos) ;
285 }
286
287 int wxTextCtrl::GetLineLength(long lineNo) const
288 {
289 return GetTextPeer()->GetLineLength(lineNo) ;
290 }
291
292 wxString wxTextCtrl::GetLineText(long lineNo) const
293 {
294 return GetTextPeer()->GetLineText(lineNo) ;
295 }
296
297 void wxTextCtrl::Remove(long from, long to)
298 {
299 wxTextEntry::Remove(from, to);
300 if ( m_triggerUpdateEvents )
301 SendTextUpdatedEvent();
302 }
303
304 void wxTextCtrl::WriteText(const wxString& str)
305 {
306 wxTextEntry::WriteText( str ) ;
307 if ( m_triggerUpdateEvents )
308 SendTextUpdatedEvent();
309 }
310
311 void wxTextCtrl::Clear()
312 {
313 wxTextEntry::Clear() ;
314 SendTextUpdatedEvent();
315 }
316
317 void wxTextCtrl::Copy()
318 {
319 if (CanCopy())
320 {
321 wxClipboardTextEvent evt(wxEVT_COMMAND_TEXT_COPY, GetId());
322 evt.SetEventObject(this);
323 if (!GetEventHandler()->ProcessEvent(evt))
324 {
325 wxTextEntry::Copy();
326 }
327 }
328 }
329
330 void wxTextCtrl::Cut()
331 {
332 if (CanCut())
333 {
334 wxClipboardTextEvent evt(wxEVT_COMMAND_TEXT_CUT, GetId());
335 evt.SetEventObject(this);
336 if (!GetEventHandler()->ProcessEvent(evt))
337 {
338 wxTextEntry::Cut();
339
340 SendTextUpdatedEvent();
341 }
342 }
343 }
344
345 void wxTextCtrl::Paste()
346 {
347 if (CanPaste())
348 {
349 wxClipboardTextEvent evt(wxEVT_COMMAND_TEXT_PASTE, GetId());
350 evt.SetEventObject(this);
351 if (!GetEventHandler()->ProcessEvent(evt))
352 {
353 wxTextEntry::Paste();
354
355 // TODO: eventually we should add setting the default style again
356 SendTextUpdatedEvent();
357 }
358 }
359 }
360
361 void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event)
362 {
363 // By default, load the first file into the text window.
364 if (event.GetNumberOfFiles() > 0)
365 LoadFile( event.GetFiles()[0] );
366 }
367
368 void wxTextCtrl::OnKeyDown(wxKeyEvent& event)
369 {
370 if ( event.GetModifiers() == wxMOD_CMD )
371 {
372 switch( event.GetKeyCode() )
373 {
374 case 'A':
375 SelectAll();
376 return;
377 case 'C':
378 if ( CanCopy() )
379 Copy() ;
380 return;
381 case 'V':
382 if ( CanPaste() )
383 Paste() ;
384 return;
385 case 'X':
386 if ( CanCut() )
387 Cut() ;
388 return;
389 default:
390 break;
391 }
392 }
393 // no, we didn't process it
394 event.Skip();
395 }
396
397 void wxTextCtrl::OnChar(wxKeyEvent& event)
398 {
399 int key = event.GetKeyCode() ;
400 bool eat_key = false ;
401 long from, to;
402
403 if ( !IsEditable() && !event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB) &&
404 !( key == WXK_RETURN && ( (m_windowStyle & wxTE_PROCESS_ENTER) || (m_windowStyle & wxTE_MULTILINE) ) )
405 // && key != WXK_PAGEUP && key != WXK_PAGEDOWN && key != WXK_HOME && key != WXK_END
406 )
407 {
408 // eat it
409 return ;
410 }
411
412 // Check if we have reached the max # of chars (if it is set), but still
413 // allow navigation and deletion
414 GetSelection( &from, &to );
415 if ( !IsMultiLine() && m_maxLength && GetValue().length() >= m_maxLength &&
416 !event.IsKeyInCategory(WXK_CATEGORY_ARROW | WXK_CATEGORY_TAB | WXK_CATEGORY_CUT) &&
417 !( key == WXK_RETURN && (m_windowStyle & wxTE_PROCESS_ENTER) ) &&
418 from == to )
419 {
420 // eat it, we don't want to add more than allowed # of characters
421
422 // TODO: generate EVT_TEXT_MAXLEN()
423 return;
424 }
425
426 // assume that any key not processed yet is going to modify the control
427 m_dirty = true;
428
429 switch ( key )
430 {
431 case WXK_RETURN:
432 if (m_windowStyle & wxTE_PROCESS_ENTER)
433 {
434 wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
435 event.SetEventObject( this );
436 event.SetString( GetValue() );
437 if ( HandleWindowEvent(event) )
438 return;
439 }
440
441 if ( !(m_windowStyle & wxTE_MULTILINE) )
442 {
443 wxTopLevelWindow *tlw = wxDynamicCast(wxGetTopLevelParent(this), wxTopLevelWindow);
444 if ( tlw && tlw->GetDefaultItem() )
445 {
446 wxButton *def = wxDynamicCast(tlw->GetDefaultItem(), wxButton);
447 if ( def && def->IsEnabled() )
448 {
449 wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
450 event.SetEventObject(def);
451 def->Command(event);
452
453 return ;
454 }
455 }
456
457 // this will make wxWidgets eat the ENTER key so that
458 // we actually prevent line wrapping in a single line text control
459 eat_key = true;
460 }
461 break;
462
463 case WXK_TAB:
464 if ( !(m_windowStyle & wxTE_PROCESS_TAB))
465 {
466 int flags = 0;
467 if (!event.ShiftDown())
468 flags |= wxNavigationKeyEvent::IsForward ;
469 if (event.ControlDown())
470 flags |= wxNavigationKeyEvent::WinChange ;
471 Navigate(flags);
472
473 return;
474 }
475 else
476 {
477 // This is necessary (don't know why);
478 // otherwise the tab will not be inserted.
479 WriteText(wxT("\t"));
480 eat_key = true;
481 }
482 break;
483
484 default:
485 break;
486 }
487
488 if (!eat_key)
489 {
490 // perform keystroke handling
491 event.Skip(true) ;
492 }
493
494 // osx_cocoa sends its event upon insertText
495 #if wxOSX_USE_CARBON
496 if ( ( key >= 0x20 && key < WXK_START ) ||
497 ( key >= WXK_NUMPAD0 && key <= WXK_DIVIDE ) ||
498 key == WXK_RETURN ||
499 key == WXK_DELETE ||
500 key == WXK_BACK)
501 {
502 wxCommandEvent event1(wxEVT_COMMAND_TEXT_UPDATED, m_windowId);
503 event1.SetEventObject( this );
504 wxPostEvent( GetEventHandler(), event1 );
505 }
506 #endif
507 }
508
509 void wxTextCtrl::Command(wxCommandEvent & event)
510 {
511 SetValue(event.GetString());
512 ProcessCommand(event);
513 }
514
515 // ----------------------------------------------------------------------------
516 // standard handlers for standard edit menu events
517 // ----------------------------------------------------------------------------
518
519 // CS: Context Menus only work with MLTE implementations or non-multiline HIViews at the moment
520
521 void wxTextCtrl::OnCut(wxCommandEvent& WXUNUSED(event))
522 {
523 Cut();
524 }
525
526 void wxTextCtrl::OnCopy(wxCommandEvent& WXUNUSED(event))
527 {
528 Copy();
529 }
530
531 void wxTextCtrl::OnPaste(wxCommandEvent& WXUNUSED(event))
532 {
533 Paste();
534 }
535
536 void wxTextCtrl::OnUndo(wxCommandEvent& WXUNUSED(event))
537 {
538 Undo();
539 }
540
541 void wxTextCtrl::OnRedo(wxCommandEvent& WXUNUSED(event))
542 {
543 Redo();
544 }
545
546 void wxTextCtrl::OnDelete(wxCommandEvent& WXUNUSED(event))
547 {
548 long from, to;
549
550 GetSelection( &from, &to );
551 if (from != -1 && to != -1)
552 Remove( from, to );
553 }
554
555 void wxTextCtrl::OnSelectAll(wxCommandEvent& WXUNUSED(event))
556 {
557 SetSelection(-1, -1);
558 }
559
560 void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent& event)
561 {
562 event.Enable( CanCut() );
563 }
564
565 void wxTextCtrl::OnUpdateCopy(wxUpdateUIEvent& event)
566 {
567 event.Enable( CanCopy() );
568 }
569
570 void wxTextCtrl::OnUpdatePaste(wxUpdateUIEvent& event)
571 {
572 event.Enable( CanPaste() );
573 }
574
575 void wxTextCtrl::OnUpdateUndo(wxUpdateUIEvent& event)
576 {
577 event.Enable( CanUndo() );
578 }
579
580 void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event)
581 {
582 event.Enable( CanRedo() );
583 }
584
585 void wxTextCtrl::OnUpdateDelete(wxUpdateUIEvent& event)
586 {
587 long from, to;
588
589 GetSelection( &from, &to );
590 event.Enable( from != -1 && to != -1 && from != to && IsEditable() ) ;
591 }
592
593 void wxTextCtrl::OnUpdateSelectAll(wxUpdateUIEvent& event)
594 {
595 event.Enable(GetLastPosition() > 0);
596 }
597
598 void wxTextCtrl::OnContextMenu(wxContextMenuEvent& event)
599 {
600 if ( GetTextPeer()->HasOwnContextMenu() )
601 {
602 event.Skip() ;
603 return ;
604 }
605
606 #if wxUSE_MENUS
607 if (m_privateContextMenu == NULL)
608 {
609 m_privateContextMenu = new wxMenu;
610 m_privateContextMenu->Append(wxID_UNDO, _("&Undo"));
611 m_privateContextMenu->Append(wxID_REDO, _("&Redo"));
612 m_privateContextMenu->AppendSeparator();
613 m_privateContextMenu->Append(wxID_CUT, _("Cu&t"));
614 m_privateContextMenu->Append(wxID_COPY, _("&Copy"));
615 m_privateContextMenu->Append(wxID_PASTE, _("&Paste"));
616 m_privateContextMenu->Append(wxID_CLEAR, _("&Delete"));
617 m_privateContextMenu->AppendSeparator();
618 m_privateContextMenu->Append(wxID_SELECTALL, _("Select &All"));
619 }
620
621 PopupMenu(m_privateContextMenu);
622 #endif
623 }
624
625 bool wxTextCtrl::MacSetupCursor( const wxPoint& pt )
626 {
627 if ( !GetTextPeer()->SetupCursor( pt ) )
628 return wxWindow::MacSetupCursor( pt ) ;
629 else
630 return true ;
631 }
632
633 // ----------------------------------------------------------------------------
634 // implementation base class
635 // ----------------------------------------------------------------------------
636
637 bool wxTextWidgetImpl::GetStyle(long WXUNUSED(position),
638 wxTextAttr& WXUNUSED(style))
639 {
640 return false;
641 }
642
643 void wxTextWidgetImpl::SetStyle(long WXUNUSED(start),
644 long WXUNUSED(end),
645 const wxTextAttr& WXUNUSED(style))
646 {
647 }
648
649 void wxTextWidgetImpl::Copy()
650 {
651 }
652
653 void wxTextWidgetImpl::Cut()
654 {
655 }
656
657 void wxTextWidgetImpl::Paste()
658 {
659 }
660
661 bool wxTextWidgetImpl::CanPaste() const
662 {
663 return false ;
664 }
665
666 void wxTextWidgetImpl::SetEditable(bool WXUNUSED(editable))
667 {
668 }
669
670 long wxTextWidgetImpl::GetLastPosition() const
671 {
672 return GetStringValue().length() ;
673 }
674
675 void wxTextWidgetImpl::Replace( long from , long to , const wxString &val )
676 {
677 SetSelection( from , to ) ;
678 WriteText( val ) ;
679 }
680
681 void wxTextWidgetImpl::Remove( long from , long to )
682 {
683 SetSelection( from , to ) ;
684 WriteText( wxEmptyString) ;
685 }
686
687 void wxTextWidgetImpl::Clear()
688 {
689 SetStringValue( wxEmptyString ) ;
690 }
691
692 bool wxTextWidgetImpl::CanUndo() const
693 {
694 return false ;
695 }
696
697 void wxTextWidgetImpl::Undo()
698 {
699 }
700
701 bool wxTextWidgetImpl::CanRedo() const
702 {
703 return false ;
704 }
705
706 void wxTextWidgetImpl::Redo()
707 {
708 }
709
710 long wxTextWidgetImpl::XYToPosition(long WXUNUSED(x), long WXUNUSED(y)) const
711 {
712 return 0 ;
713 }
714
715 bool wxTextWidgetImpl::PositionToXY(long WXUNUSED(pos),
716 long *WXUNUSED(x),
717 long *WXUNUSED(y)) const
718 {
719 return false ;
720 }
721
722 void wxTextWidgetImpl::ShowPosition( long WXUNUSED(pos) )
723 {
724 }
725
726 int wxTextWidgetImpl::GetNumberOfLines() const
727 {
728 wxString content = GetStringValue() ;
729 ItemCount lines = 1;
730
731 for (size_t i = 0; i < content.length() ; i++)
732 {
733 #if wxOSX_USE_COCOA
734 if (content[i] == '\n')
735 #else
736 if (content[i] == '\r')
737 #endif
738 lines++;
739 }
740
741 return lines ;
742 }
743
744 wxString wxTextWidgetImpl::GetLineText(long lineNo) const
745 {
746 // TODO: change this if possible to reflect real lines
747 wxString content = GetStringValue() ;
748
749 // Find line first
750 int count = 0;
751 for (size_t i = 0; i < content.length() ; i++)
752 {
753 if (count == lineNo)
754 {
755 // Add chars in line then
756 wxString tmp;
757
758 for (size_t j = i; j < content.length(); j++)
759 {
760 if (content[j] == '\n')
761 return tmp;
762
763 tmp += content[j];
764 }
765
766 return tmp;
767 }
768
769 if (content[i] == '\n')
770 count++;
771 }
772
773 return wxEmptyString ;
774 }
775
776 int wxTextWidgetImpl::GetLineLength(long lineNo) const
777 {
778 // TODO: change this if possible to reflect real lines
779 wxString content = GetStringValue() ;
780
781 // Find line first
782 int count = 0;
783 for (size_t i = 0; i < content.length() ; i++)
784 {
785 if (count == lineNo)
786 {
787 // Count chars in line then
788 count = 0;
789 for (size_t j = i; j < content.length(); j++)
790 {
791 count++;
792 if (content[j] == '\n')
793 return count;
794 }
795
796 return count;
797 }
798
799 if (content[i] == '\n')
800 count++;
801 }
802
803 return 0 ;
804 }
805
806 #endif // wxUSE_TEXTCTRL