]> git.saurik.com Git - wxWidgets.git/blame - src/mac/carbon/listbox.cpp
fixed crash in HitTest() with y position below the last line
[wxWidgets.git] / src / mac / carbon / listbox.cpp
CommitLineData
e9576ca5
SC
1///////////////////////////////////////////////////////////////////////////////
2// Name: listbox.cpp
3// Purpose: wxListBox
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 "listbox.h"
14#endif
15
03e11df5 16#include "wx/app.h"
e9576ca5
SC
17#include "wx/listbox.h"
18#include "wx/settings.h"
19#include "wx/dynarray.h"
20#include "wx/log.h"
21
519cb848 22#include "wx/utils.h"
60149370 23#ifndef __DARWIN__
03e11df5
GD
24 #include "extldef.h"
25#endif
519cb848 26
2f1ae414 27#if !USE_SHARED_LIBRARY
e9576ca5 28 IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
519cb848
SC
29
30BEGIN_EVENT_TABLE(wxListBox, wxControl)
31 EVT_SIZE( wxListBox::OnSize )
32END_EVENT_TABLE()
2f1ae414 33#endif
e9576ca5 34
519cb848
SC
35#include <wx/mac/uma.h>
36
37extern "C" void MacDrawStringCell(Rect *cellRect, Cell lCell, ListHandle theList, long refCon) ;
38const short kwxMacListWithVerticalScrollbar = 128 ;
39
e9576ca5
SC
40// ============================================================================
41// list box control implementation
42// ============================================================================
43
44// Listbox item
45wxListBox::wxListBox()
46{
47 m_noItems = 0;
48 m_selected = 0;
2f1ae414 49 m_macList = NULL ;
e9576ca5
SC
50}
51
52bool wxListBox::Create(wxWindow *parent, wxWindowID id,
53 const wxPoint& pos,
54 const wxSize& size,
55 int n, const wxString choices[],
56 long style,
57 const wxValidator& validator,
58 const wxString& name)
59{
60149370
GD
60 m_noItems = 0 ; // this will be increased by our append command
61 m_selected = 0;
62
63 Rect bounds ;
64 Str255 title ;
65
66 MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
e9576ca5 67
60149370
GD
68#if TARGET_CARBON
69 ListDefSpec listDef;
70 OptionBits options;
71 Size asize;
519cb848 72
60149370 73 listDef.defType = kListDefStandardTextType;
519cb848 74
60149370
GD
75 CreateListBoxControl( parent->GetMacRootWindow(), &bounds, false, 0, 1, false, true,
76 14, 14, false, &listDef, &m_macControl );
519cb848 77
60149370
GD
78 GetControlData(m_macControl, kControlNoPart, kControlListBoxListHandleTag,
79 sizeof(ListHandle), (Ptr) &m_macList, &asize);
519cb848 80
60149370
GD
81 SetControlReference(m_macControl, (long) this);
82 SetControlVisibility(m_macControl, false, false);
519cb848 83
60149370
GD
84 options = 0;
85 if ( style & wxLB_MULTIPLE )
86 {
87 options += lNoExtend ;
88 }
89 else if ( style & wxLB_EXTENDED )
90 {
91 options += lExtendDrag ;
92 }
93 else
94 {
95 options = lOnlyOne ;
96 }
97 SetListSelectionFlags(m_macList, options);
519cb848 98
60149370
GD
99#else
100 long result ;
101
102 m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , false ,
103 kwxMacListWithVerticalScrollbar , 0 , 0,
104 kControlListBoxProc , (long) this ) ;
105 UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxListHandleTag ,
106 sizeof( ListHandle ) , (char*) &m_macList , &result ) ;
107
108 HLock( (Handle) m_macList ) ;
109 NewExtLDEFInfo( m_macList , MacDrawStringCell , (long) this ) ;
110
111 (**m_macList).selFlags = 0 ;
112 if ( style & wxLB_MULTIPLE )
113 {
114 (**m_macList).selFlags += lNoExtend ;
115 }
116 else if ( style & wxLB_EXTENDED )
117 {
118 (**m_macList).selFlags += lExtendDrag ;
119 }
120 else
121 {
122 (**m_macList).selFlags = lOnlyOne ;
123 }
124
125 Point pt = (**m_macList).cellSize ;
126 pt.v = 14 ;
127 LCellSize( pt , m_macList ) ;
128
129 LAddColumn( 1 , 0 , m_macList ) ;
130
131 ControlFontStyleRec controlstyle ;
132 controlstyle.flags = kControlUseFontMask + kControlUseSizeMask ;
133 //controlstyle.font = kControlFontSmallSystemFont ;
134 controlstyle.font = kFontIDMonaco ;
135 controlstyle.size = 9 ;
136 //::UMASetControlFontStyle( m_macControl , &controlstyle ) ;
137#endif
138
139 MacPostControlCreate() ;
140
141 for ( int i = 0 ; i < n ; i++ )
142 {
143 Append( choices[i] ) ;
144 }
145
146 LSetDrawingMode( true , m_macList ) ;
519cb848 147
60149370 148 return TRUE;
e9576ca5
SC
149}
150
151wxListBox::~wxListBox()
152{
e7549107 153 Free() ;
2f1ae414
SC
154 if ( m_macList )
155 {
60149370
GD
156#if !TARGET_CARBON
157 DisposeExtLDEFInfo( m_macList ) ;
158#endif
159 m_macList = NULL ;
2f1ae414 160 }
e9576ca5
SC
161}
162
e7549107 163void wxListBox::Free()
e9576ca5 164{
e7549107
SC
165#if wxUSE_OWNER_DRAWN
166 if ( m_windowStyle & wxLB_OWNERDRAW )
167 {
168 size_t uiCount = m_aItems.Count();
169 while ( uiCount-- != 0 ) {
170 delete m_aItems[uiCount];
171 }
172
173 m_aItems.Clear();
174 }
175 else
176#endif // wxUSE_OWNER_DRAWN
177 if ( HasClientObjectData() )
178 {
179 for ( size_t n = 0; n < (size_t)m_noItems; n++ )
180 {
181 delete GetClientObject(n);
182 }
183 }
e9576ca5
SC
184}
185
e7549107 186void wxListBox::DoSetFirstItem(int N)
e9576ca5 187{
e7549107 188 MacScrollTo( N ) ;
e9576ca5
SC
189}
190
191void wxListBox::Delete(int N)
192{
e7549107
SC
193 wxCHECK_RET( N >= 0 && N < m_noItems,
194 wxT("invalid index in wxListBox::Delete") );
195
196#if wxUSE_OWNER_DRAWN
197 delete m_aItems[N];
198 m_aItems.Remove(N);
199#else // !wxUSE_OWNER_DRAWN
200 if ( HasClientObjectData() )
201 {
202 delete GetClientObject(N);
203 }
204#endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
519cb848 205 m_stringArray.Remove( N ) ;
3ef585df 206 m_dataArray.RemoveAt( N ) ;
2f1ae414 207 m_noItems --;
519cb848
SC
208
209 MacDelete( N ) ;
e9576ca5
SC
210}
211
e7549107 212int wxListBox::DoAppend(const wxString& item)
e9576ca5 213{
e7549107 214 int index = m_noItems ;
519cb848
SC
215 if( wxApp::s_macDefaultEncodingIsPC )
216 {
217 m_stringArray.Add( wxMacMakeMacStringFromPC( item ) ) ;
b81abd0d 218 m_dataArray.Add( NULL );
519cb848 219 }
b81abd0d 220 else {
519cb848 221 m_stringArray.Add( item ) ;
b81abd0d
GD
222 m_dataArray.Add( NULL );
223 }
e7549107 224 m_noItems ++;
5b781a67 225 DoSetItemClientData( index , NULL ) ;
519cb848 226 MacAppend( item ) ;
e7549107 227
e7549107 228 return index ;
e9576ca5
SC
229}
230
e7549107
SC
231void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
232{
233 MacSetRedraw( false ) ;
519cb848 234 Clear() ;
e7549107
SC
235 int n = choices.GetCount();
236
519cb848
SC
237 for( int i = 0 ; i < n ; ++i )
238 {
239 if ( clientData )
e7549107
SC
240 {
241#if wxUSE_OWNER_DRAWN
242 wxASSERT_MSG(clientData[i] == NULL,
243 wxT("Can't use client data with owner-drawn listboxes"));
244#else // !wxUSE_OWNER_DRAWN
8208e181 245 Append( choices[i] , clientData[i] ) ;
e7549107
SC
246 #endif
247 }
519cb848
SC
248 else
249 Append( choices[i] ) ;
250 }
e7549107
SC
251
252#if wxUSE_OWNER_DRAWN
253 if ( m_windowStyle & wxLB_OWNERDRAW ) {
254 // first delete old items
255 size_t ui = m_aItems.Count();
256 while ( ui-- != 0 ) {
257 delete m_aItems[ui];
258 }
259 m_aItems.Empty();
260
261 // then create new ones
262 for ( ui = 0; ui < (size_t)m_noItems; ui++ ) {
263 wxOwnerDrawn *pNewItem = CreateItem(ui);
264 pNewItem->SetName(choices[ui]);
265 m_aItems.Add(pNewItem);
266 }
267 }
268#endif // wxUSE_OWNER_DRAWN
269 MacSetRedraw( true ) ;
270}
271
272bool wxListBox::HasMultipleSelection() const
273{
274 return (m_windowStyle & wxLB_MULTIPLE) || (m_windowStyle & wxLB_EXTENDED);
e9576ca5
SC
275}
276
519cb848 277int wxListBox::FindString(const wxString& st) const
e9576ca5 278{
519cb848
SC
279 wxString s ;
280 if( wxApp::s_macDefaultEncodingIsPC )
281 {
282 s = wxMacMakeMacStringFromPC( st ) ;
283 }
284 else
285 s = st ;
286
287 if ( s.Right(1) == "*" )
288 {
289 wxString search = s.Left( s.Length() - 1 ) ;
290 int len = search.Length() ;
03e11df5
GD
291 Str255 s1 , s2 ;
292
293#if TARGET_CARBON
294 c2pstrcpy( (StringPtr) s2 , search.c_str() ) ;
295#else
296 strcpy( (char *) s2 , search.c_str() ) ;
297 c2pstr( (char *) s2 ) ;
298#endif
299
2f1ae414
SC
300 for ( int i = 0 ; i < m_noItems ; ++ i )
301 {
03e11df5
GD
302#if TARGET_CARBON
303 c2pstrcpy( (StringPtr) s1 , m_stringArray[i].Left( len ).c_str() ) ;
304#else
305 strcpy( (char *) s1 , m_stringArray[i].Left( len ).c_str() ) ;
306 c2pstr( (char *) s1 ) ;
307#endif
2f1ae414
SC
308 if ( EqualString( s1 , s2 , false , false ) )
309 return i ;
310 }
51a229c6 311 if ( s.Left(1) == "*" && s.Length() > 1 )
5b781a67
SC
312 {
313 s.MakeLower() ;
314 for ( int i = 0 ; i < m_noItems ; ++i )
315 {
316 if ( GetString(i).Lower().Matches(s) )
317 return i ;
318 }
319 }
320
519cb848
SC
321 }
322 else
323 {
2f1ae414 324 Str255 s1 , s2 ;
03e11df5
GD
325
326#if TARGET_CARBON
327 c2pstrcpy( (StringPtr) s2 , s.c_str() ) ;
328#else
329 strcpy( (char *) s2 , s.c_str() ) ;
330 c2pstr( (char *) s2 ) ;
331#endif
332
2f1ae414
SC
333 for ( int i = 0 ; i < m_noItems ; ++ i )
334 {
03e11df5
GD
335#if TARGET_CARBON
336 c2pstrcpy( (StringPtr) s1 , m_stringArray[i].c_str() ) ;
337#else
338 strcpy( (char *) s1 , m_stringArray[i].c_str() ) ;
339 c2pstr( (char *) s1 ) ;
340#endif
2f1ae414
SC
341 if ( EqualString( s1 , s2 , false , false ) )
342 return i ;
343 }
519cb848
SC
344 }
345 return -1;
e9576ca5
SC
346}
347
348void wxListBox::Clear()
349{
e7549107 350 Free();
e9576ca5 351 m_noItems = 0;
519cb848
SC
352 m_stringArray.Empty() ;
353 m_dataArray.Empty() ;
354 MacClear() ;
e9576ca5
SC
355}
356
357void wxListBox::SetSelection(int N, bool select)
358{
519cb848
SC
359 wxCHECK_RET( N >= 0 && N < m_noItems,
360 "invalid index in wxListBox::SetSelection" );
361 MacSetSelection( N , select ) ;
e9576ca5
SC
362}
363
e7549107 364bool wxListBox::IsSelected(int N) const
e9576ca5 365{
519cb848
SC
366 wxCHECK_MSG( N >= 0 && N < m_noItems, FALSE,
367 "invalid index in wxListBox::Selected" );
368
369 return MacIsSelected( N ) ;
e9576ca5
SC
370}
371
e7549107 372void *wxListBox::DoGetItemClientData(int N) const
e9576ca5 373{
519cb848 374 wxCHECK_MSG( N >= 0 && N < m_noItems, NULL,
60149370 375 wxT("invalid index in wxListBox::GetClientData"));
519cb848 376
e7549107 377 return (void *)m_dataArray[N];
e9576ca5
SC
378}
379
51abe921
SC
380wxClientData *wxListBox::DoGetItemClientObject(int N) const
381{
382 return (wxClientData *) DoGetItemClientData( N ) ;
383}
384
e7549107 385void wxListBox::DoSetItemClientData(int N, void *Client_data)
e9576ca5 386{
519cb848
SC
387 wxCHECK_RET( N >= 0 && N < m_noItems,
388 "invalid index in wxListBox::SetClientData" );
389
e7549107
SC
390#if wxUSE_OWNER_DRAWN
391 if ( m_windowStyle & wxLB_OWNERDRAW )
392 {
393 // client data must be pointer to wxOwnerDrawn, otherwise we would crash
394 // in OnMeasure/OnDraw.
395 wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
396 }
397#endif // wxUSE_OWNER_DRAWN
8208e181
SC
398 wxASSERT_MSG( m_dataArray.GetCount() >= N , "invalid client_data array" ) ;
399
400 if ( m_dataArray.GetCount() > N )
401 {
402 m_dataArray[N] = (char*) Client_data ;
2f1ae414 403 }
8208e181
SC
404 else
405 {
406 m_dataArray.Add( (char*) Client_data ) ;
407 }
e7549107
SC
408}
409
410void wxListBox::DoSetItemClientObject(int n, wxClientData* clientData)
411{
412 DoSetItemClientData(n, clientData);
e9576ca5
SC
413}
414
415// Return number of selections and an array of selected integers
416int wxListBox::GetSelections(wxArrayInt& aSelections) const
417{
519cb848 418 return MacGetSelections( aSelections ) ;
e9576ca5
SC
419
420/* TODO
519cb848 421 if ((m_windowStyle & wxLB_MULTIMacE) || (m_windowStyle & wxLB_EXTENDED))
e9576ca5
SC
422 {
423 int no_sel = ??
424 for ( int n = 0; n < no_sel; n++ )
425 aSelections.Add(??);
426
427 return no_sel;
428 }
429 else // single-selection listbox
430 {
431 aSelections.Add(??);
432
433 return 1;
434 }
435*/
e9576ca5
SC
436}
437
438// Get single selection, for single choice list items
439int wxListBox::GetSelection() const
440{
519cb848 441 return MacGetSelection() ;
e9576ca5
SC
442}
443
444// Find string for position
445wxString wxListBox::GetString(int N) const
446{
519cb848
SC
447 if( wxApp::s_macDefaultEncodingIsPC )
448 {
449 return wxMacMakePCStringFromMac( m_stringArray[N] ) ;
450 }
451 else
452 return m_stringArray[N] ;
e9576ca5
SC
453}
454
e7549107 455void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
e9576ca5 456{
e7549107
SC
457 wxCHECK_RET( pos >= 0 && pos <= m_noItems,
458 wxT("invalid index in wxListBox::InsertItems") );
459
460 int nItems = items.GetCount();
461
519cb848
SC
462 for ( int i = 0 ; i < nItems ; i++ )
463 {
464 m_stringArray.Insert( items[i] , pos + i ) ;
465 m_dataArray.Insert( NULL , pos + i ) ;
466 MacInsert( pos + i , items[i] ) ;
467 }
e9576ca5 468
519cb848 469 m_noItems += nItems;
e9576ca5
SC
470}
471
472void wxListBox::SetString(int N, const wxString& s)
473{
2f1ae414
SC
474 wxString str ;
475 if( wxApp::s_macDefaultEncodingIsPC )
476 {
477 str = wxMacMakeMacStringFromPC( s ) ;
478 }
479 else
480 str = s ;
481 m_stringArray[N] = str ;
519cb848 482 MacSet( N , s ) ;
e9576ca5
SC
483}
484
37e2cb08 485wxSize wxListBox::DoGetBestSize() const
e9576ca5 486{
e7549107 487 return wxSize(100, 100);
e9576ca5
SC
488}
489
51abe921
SC
490int wxListBox::GetCount() const
491{
492 return m_noItems;
493}
494
495void wxListBox::SetupColours()
496{
497 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_WINDOW));
498 SetForegroundColour(GetParent()->GetForegroundColour());
499}
500
60149370
GD
501void wxListBox::Refresh(bool eraseBack, const wxRect *rect)
502{
503 // Set up port
504 WindowRef rootwindow = GetMacRootWindow() ;
505 wxWindow* wxrootwindow = wxFindWinFromMacWindow( rootwindow ) ;
506 wxMacDrawingHelper focus( wxrootwindow );
507
508 UMADrawControl(m_macControl);
509}
510
51abe921
SC
511#if wxUSE_OWNER_DRAWN
512
513class wxListBoxItem : public wxOwnerDrawn
514{
515public:
516 wxListBoxItem(const wxString& str = "");
517};
518
519wxListBoxItem::wxListBoxItem(const wxString& str) : wxOwnerDrawn(str, FALSE)
520{
521 // no bitmaps/checkmarks
522 SetMarginWidth(0);
523}
524
525wxOwnerDrawn *wxListBox::CreateItem(size_t n)
526{
527 return new wxListBoxItem();
528}
529
530#endif //USE_OWNER_DRAWN
e9576ca5 531
519cb848
SC
532// ============================================================================
533// list box control implementation
534// ============================================================================
535
536void MacDrawStringCell(Rect *cellRect, Cell lCell, ListHandle theList, long refCon)
537{
538 wxListBox* list;
539 // typecast our refCon
540 list = (wxListBox*)refCon;
541
542 MoveTo(cellRect->left + 4 , cellRect->top + 10 );
543 const wxString text = list->m_stringArray[lCell.v] ;
544 ::TextFont( kFontIDMonaco ) ;
545 ::TextSize( 9 );
546 ::TextFace( 0 ) ;
547 DrawText(text, 0 , text.Length());
548
549}
550
551void wxListBox::MacDelete( int N )
552{
60149370
GD
553 LDelRow( 1 , N , m_macList) ;
554 Refresh();
519cb848
SC
555}
556
557void wxListBox::MacInsert( int n , const char * text)
558{
60149370
GD
559 Cell cell = { 0 , 0 } ;
560 cell.v = n ;
561 LAddRow( 1 , cell.v , m_macList ) ;
562 LSetCell(text, strlen(text), cell, m_macList);
563 Refresh();
519cb848
SC
564}
565
566void wxListBox::MacAppend( const char * text)
567{
60149370
GD
568 Cell cell = { 0 , 0 } ;
569 cell.v = (**m_macList).dataBounds.bottom ;
570 LAddRow( 1 , cell.v , m_macList ) ;
571 LSetCell(text, strlen(text), cell, m_macList);
572 Refresh();
519cb848
SC
573}
574
575void wxListBox::MacClear()
576{
60149370
GD
577 LDelRow( (**m_macList).dataBounds.bottom , 0 , m_macList ) ;
578 Refresh();
519cb848
SC
579}
580
581void wxListBox::MacSetSelection( int n , bool select )
582{
583 Cell cell = { 0 , 0 } ;
60149370 584 if ( LGetSelect( true , &cell , m_macList ) )
519cb848
SC
585 {
586 LSetSelect( false , cell , m_macList ) ;
587 }
588
589 cell.v = n ;
590 LSetSelect( select , cell , m_macList ) ;
591 LAutoScroll( m_macList ) ;
60149370 592 Refresh();
519cb848
SC
593}
594
595bool wxListBox::MacIsSelected( int n ) const
596{
597 Cell cell = { 0 , 0 } ;
598 cell.v = n ;
599 return LGetSelect( false , &cell , m_macList ) ;
600}
601
602void wxListBox::MacDestroy()
603{
60149370 604// DisposeExtLDEFInfo( m_macList ) ;
519cb848
SC
605}
606
607int wxListBox::MacGetSelection() const
608{
609 Cell cell = { 0 , 0 } ;
610 if ( LGetSelect( true , &cell , m_macList ) )
611 return cell.v ;
612 else
613 return -1 ;
614}
615
616int wxListBox::MacGetSelections( wxArrayInt& aSelections ) const
617{
618 int no_sel = 0 ;
619
620 aSelections.Empty();
621
622 Cell cell = { 0 , 0 } ;
623 cell.v = 0 ;
624
625 while ( LGetSelect( true , &cell , m_macList ) )
626 {
627 aSelections.Add( cell.v ) ;
628 no_sel++ ;
629 cell.v++ ;
630 }
631 return no_sel ;
632}
633
634void wxListBox::MacSet( int n , const char * text )
635{
636 // our implementation does not store anything in the list
637 // so we just have to redraw
638 Cell cell = { 0 , 0 } ;
639 cell.v = n ;
60149370
GD
640 LSetCell(text, strlen(text), cell, m_macList);
641 Refresh();
519cb848
SC
642}
643
644void wxListBox::MacScrollTo( int n )
645{
646 // TODO implement scrolling
647}
648
649void wxListBox::OnSize( const wxSizeEvent &event)
650{
60149370
GD
651 Point pt;
652
653#if TARGET_CARBON
654 GetListCellSize(m_macList, &pt);
655#else
656 pt = (**m_macList).cellSize ;
657#endif
658 pt.h = m_width - 15 ;
659 LCellSize( pt , m_macList ) ;
519cb848
SC
660}
661
662void wxListBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
663{
664 Boolean wasDoubleClick = false ;
665 long result ;
666
667 UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxDoubleClickTag , sizeof( wasDoubleClick ) , (char*) &wasDoubleClick , &result ) ;
668 if ( !wasDoubleClick )
669 {
670 MacDoClick() ;
671 }
672 else
673 {
674 MacDoDoubleClick() ;
675 }
676}
677
678void wxListBox::MacSetRedraw( bool doDraw )
679{
680 LSetDrawingMode( doDraw , m_macList ) ;
681
682}
683
684void wxListBox::MacDoClick()
685{
686 wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
e7549107
SC
687 event.SetEventObject( this );
688
519cb848 689 wxArrayInt aSelections;
e7549107 690 int n, count = GetSelections(aSelections);
519cb848
SC
691 if ( count > 0 )
692 {
7c74e7fe
SC
693 n = aSelections[0];
694 if ( HasClientObjectData() )
e7549107
SC
695 event.SetClientObject( GetClientObject(n) );
696 else if ( HasClientUntypedData() )
697 event.SetClientData( GetClientData(n) );
698 event.SetString( GetString(n) );
519cb848
SC
699 }
700 else
701 {
e7549107 702 n = -1;
519cb848
SC
703 }
704
e7549107
SC
705 event.m_commandInt = n;
706
707 GetEventHandler()->ProcessEvent(event);
519cb848
SC
708}
709
710void wxListBox::MacDoDoubleClick()
711{
712 wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, m_windowId);
713 event.SetEventObject( this );
714 GetEventHandler()->ProcessEvent(event) ;
715}