1 ///////////////////////////////////////////////////////////////////////////////
4 // Author: Stefan Csomor
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "listbox.h"
17 #include "wx/listbox.h"
18 #include "wx/button.h"
19 #include "wx/settings.h"
20 #include "wx/toplevel.h"
21 #include "wx/dynarray.h"
26 #if !USE_SHARED_LIBRARY
27 IMPLEMENT_DYNAMIC_CLASS(wxListBox
, wxControl
)
29 BEGIN_EVENT_TABLE(wxListBox
, wxControl
)
31 EVT_SIZE( wxListBox::OnSize
)
32 EVT_CHAR( wxListBox::OnChar
)
37 #include "wx/mac/uma.h"
39 const short kTextColumnId
= 1024 ;
41 // new databrowserbased version
44 wxListBox::wxListBox()
51 bool wxListBox::Create(wxWindow
*parent
, wxWindowID id
,
54 const wxArrayString
& choices
,
56 const wxValidator
& validator
,
59 wxCArrayString
chs(choices
);
61 return Create(parent
, id
, pos
, size
, chs
.GetCount(), chs
.GetStrings(),
62 style
, validator
, name
);
65 #if TARGET_API_MAC_OSX
66 static pascal void DataBrowserItemNotificationProc(ControlRef browser
, DataBrowserItemID itemID
,
67 DataBrowserItemNotification message
, DataBrowserItemDataRef itemData
)
69 static pascal void DataBrowserItemNotificationProc(ControlRef browser
, DataBrowserItemID itemID
,
70 DataBrowserItemNotification message
)
73 long ref
= GetControlReference( browser
) ;
76 wxListBox
* list
= wxDynamicCast( (wxObject
*) ref
, wxListBox
) ;
77 for ( size_t i
= 0 ; i
< list
->m_idArray
.GetCount() ; ++i
)
78 if ( list
->m_idArray
[i
] == (long) itemID
)
80 bool trigger
= false ;
82 wxEVT_COMMAND_LISTBOX_SELECTED
, list
->GetId() );
85 case kDataBrowserItemDeselected
:
86 if ( list
->HasMultipleSelection() )
89 case kDataBrowserItemSelected
:
92 case kDataBrowserItemDoubleClicked
:
93 event
.SetEventType(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
) ;
101 event
.SetEventObject( list
);
102 if ( list
->HasClientObjectData() )
103 event
.SetClientObject( list
->GetClientObject(i
) );
104 else if ( list
->HasClientUntypedData() )
105 event
.SetClientData( list
->GetClientData(i
) );
106 event
.SetString( list
->GetString(i
) );
108 event
.SetExtraLong( list
->HasMultipleSelection() ? message
== kDataBrowserItemSelected
: TRUE
);
109 list
->GetEventHandler()->ProcessEvent(event
) ;
117 static pascal OSStatus
ListBoxGetSetItemData(ControlRef browser
,
118 DataBrowserItemID itemID
, DataBrowserPropertyID property
,
119 DataBrowserItemDataRef itemData
, Boolean changeValue
)
121 OSStatus err
= errDataBrowserPropertyNotSupported
;
130 long ref
= GetControlReference( browser
) ;
133 wxListBox
* list
= wxDynamicCast( (wxObject
*) ref
, wxListBox
) ;
134 for ( size_t i
= 0 ; i
< list
->m_idArray
.GetCount() ; ++i
)
135 if ( list
->m_idArray
[i
] == (long) itemID
)
137 wxMacCFStringHolder
cf( list
->GetString(i
) , list
->GetFont().GetEncoding() ) ;
138 verify_noerr( ::SetDataBrowserItemDataText( itemData
, cf
) ) ;
154 bool wxListBox::Create(wxWindow
*parent
, wxWindowID id
,
157 int n
, const wxString choices
[],
159 const wxValidator
& validator
,
160 const wxString
& name
)
162 m_macIsUserPane
= FALSE
;
164 wxASSERT_MSG( !(style
& wxLB_MULTIPLE
) || !(style
& wxLB_EXTENDED
),
165 _T("only one of listbox selection modes can be specified") );
167 if ( !wxListBoxBase::Create(parent
, id
, pos
, size
, style
& ~(wxHSCROLL
|wxVSCROLL
), validator
, name
) )
170 m_noItems
= 0 ; // this will be increased by our append command
175 Rect bounds
= wxMacGetBoundsForControl( this , pos
, size
) ;
178 verify_noerr( ::CreateDataBrowserControl( MAC_WXHWND(parent
->MacGetTopLevelWindowRef()), &bounds
, kDataBrowserListView
, (ControlRef
*)&m_macControl
) );
179 browser
= (ControlRef
) m_macControl
;
181 DataBrowserSelectionFlags options
= kDataBrowserDragSelect
;
182 if ( style
& wxLB_MULTIPLE
)
184 options
+= kDataBrowserAlwaysExtendSelection
+ kDataBrowserCmdTogglesSelection
;
186 else if ( style
& wxLB_EXTENDED
)
192 options
+= kDataBrowserSelectOnlyOne
;
194 verify_noerr(SetDataBrowserSelectionFlags (browser
, options
) );
196 DataBrowserListViewColumnDesc columnDesc
;
197 columnDesc
.headerBtnDesc
.titleOffset
= 0;
198 columnDesc
.headerBtnDesc
.version
= kDataBrowserListViewLatestHeaderDesc
;
200 columnDesc
.headerBtnDesc
.btnFontStyle
.flags
=
201 kControlUseFontMask
| kControlUseJustMask
;
203 columnDesc
.headerBtnDesc
.btnContentInfo
.contentType
= kControlNoContent
;
204 columnDesc
.propertyDesc
.propertyType
= kDataBrowserTextType
;
205 columnDesc
.headerBtnDesc
.btnFontStyle
.just
= teFlushDefault
;
206 columnDesc
.headerBtnDesc
.minimumWidth
= 0;
207 columnDesc
.headerBtnDesc
.maximumWidth
= 10000;
209 columnDesc
.headerBtnDesc
.btnFontStyle
.font
= kControlFontViewSystemFont
;
210 columnDesc
.headerBtnDesc
.btnFontStyle
.style
= normal
;
211 columnDesc
.headerBtnDesc
.titleString
= NULL
; // CFSTR( "" );
213 columnDesc
.propertyDesc
.propertyID
= kTextColumnId
;
214 columnDesc
.propertyDesc
.propertyType
= kDataBrowserTextType
;
215 columnDesc
.propertyDesc
.propertyFlags
=
216 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
217 kDataBrowserListViewTypeSelectColumn
|
219 kDataBrowserTableViewSelectionColumn
;
222 verify_noerr(::AddDataBrowserListViewColumn(browser
, &columnDesc
, kDataBrowserListViewAppendColumn
) ) ;
223 verify_noerr(::AutoSizeDataBrowserListViewColumns( browser
) ) ;
224 verify_noerr(::SetDataBrowserHasScrollBars( browser
, false , true ) ) ;
225 verify_noerr(::SetDataBrowserTableViewHiliteStyle( browser
, kDataBrowserTableViewFillHilite
) ) ;
226 verify_noerr(::SetDataBrowserListViewHeaderBtnHeight( browser
, 0 ) ) ;
227 DataBrowserCallbacks callbacks
;
229 callbacks
.version
= kDataBrowserLatestCallbacks
;
231 InitDataBrowserCallbacks(&callbacks
);
233 callbacks
.u
.v1
.itemDataCallback
=
234 NewDataBrowserItemDataUPP(ListBoxGetSetItemData
);
236 callbacks
.u
.v1
.itemNotificationCallback
=
237 #if TARGET_API_MAC_OSX
238 (DataBrowserItemNotificationUPP
) NewDataBrowserItemNotificationWithItemUPP(DataBrowserItemNotificationProc
) ;
240 NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc
) ;
242 SetDataBrowserCallbacks(browser
, &callbacks
);
244 MacPostControlCreate(pos
,size
) ;
246 for ( int i
= 0 ; i
< n
; i
++ )
248 Append( choices
[i
] ) ;
251 SetBestSize(size
); // Needed because it is a wxControlWithItems
256 wxListBox::~wxListBox()
258 SetControlReference( (ControlRef
) m_macControl
, NULL
) ;
260 // avoid access during destruction
267 void wxListBox::FreeData()
269 #if wxUSE_OWNER_DRAWN
270 if ( m_windowStyle
& wxLB_OWNERDRAW
)
272 size_t uiCount
= m_aItems
.Count();
273 while ( uiCount
-- != 0 ) {
274 delete m_aItems
[uiCount
];
275 m_aItems
[uiCount
] = NULL
;
281 #endif // wxUSE_OWNER_DRAWN
282 if ( HasClientObjectData() )
284 for ( size_t n
= 0; n
< (size_t)m_noItems
; n
++ )
286 delete GetClientObject(n
);
291 void wxListBox::DoSetSize(int x
, int y
,
292 int width
, int height
,
295 wxControl::DoSetSize( x
, y
, width
, height
, sizeFlags
) ;
298 void wxListBox::DoSetFirstItem(int N
)
303 void wxListBox::Delete(int N
)
305 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
306 wxT("invalid index in wxListBox::Delete") );
308 #if wxUSE_OWNER_DRAWN
310 m_aItems
.RemoveAt(N
);
311 #else // !wxUSE_OWNER_DRAWN
312 if ( HasClientObjectData() )
314 delete GetClientObject(N
);
316 #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
317 m_stringArray
.RemoveAt( N
) ;
318 m_dataArray
.RemoveAt( N
) ;
324 int wxListBox::DoAppend(const wxString
& item
)
326 int index
= m_noItems
;
327 m_stringArray
.Add( item
) ;
328 m_dataArray
.Add( NULL
);
330 DoSetItemClientData( index
, NULL
) ;
336 void wxListBox::DoSetItems(const wxArrayString
& choices
, void** clientData
)
339 int n
= choices
.GetCount();
341 for( int i
= 0 ; i
< n
; ++i
)
345 #if wxUSE_OWNER_DRAWN
346 wxASSERT_MSG(clientData
[i
] == NULL
,
347 wxT("Can't use client data with owner-drawn listboxes"));
348 #else // !wxUSE_OWNER_DRAWN
349 Append( choices
[i
] , clientData
[i
] ) ;
353 Append( choices
[i
] ) ;
356 #if wxUSE_OWNER_DRAWN
357 if ( m_windowStyle
& wxLB_OWNERDRAW
) {
358 // first delete old items
359 size_t ui
= m_aItems
.Count();
360 while ( ui
-- != 0 ) {
366 // then create new ones
367 for ( ui
= 0; ui
< (size_t)m_noItems
; ui
++ ) {
368 wxOwnerDrawn
*pNewItem
= CreateItem(ui
);
369 pNewItem
->SetName(choices
[ui
]);
370 m_aItems
.Add(pNewItem
);
373 #endif // wxUSE_OWNER_DRAWN
376 int wxListBox::FindString(const wxString
& s
) const
379 if ( s
.Right(1) == wxT("*") )
381 wxString search
= s
.Left( s
.Length() - 1 ) ;
382 int len
= search
.Length() ;
384 wxMacStringToPascal( search
, s2
) ;
386 for ( int i
= 0 ; i
< m_noItems
; ++ i
)
388 wxMacStringToPascal( m_stringArray
[i
].Left( len
) , s1
) ;
390 if ( EqualString( s1
, s2
, false , false ) )
393 if ( s
.Left(1) == wxT("*") && s
.Length() > 1 )
397 for ( int i
= 0 ; i
< m_noItems
; ++i
)
399 if ( GetString(i
).Lower().Matches(st
) )
409 wxMacStringToPascal( s
, s2
) ;
411 for ( int i
= 0 ; i
< m_noItems
; ++ i
)
413 wxMacStringToPascal( m_stringArray
[i
] , s1
) ;
415 if ( EqualString( s1
, s2
, false , false ) )
422 void wxListBox::Clear()
426 m_stringArray
.Empty() ;
427 m_dataArray
.Empty() ;
431 void wxListBox::SetSelection(int N
, bool select
)
433 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
434 wxT("invalid index in wxListBox::SetSelection") );
435 MacSetSelection( N
, select
) ;
436 GetSelections( m_selectionPreImage
) ;
439 bool wxListBox::IsSelected(int N
) const
441 wxCHECK_MSG( N
>= 0 && N
< m_noItems
, FALSE
,
442 wxT("invalid index in wxListBox::Selected") );
444 return MacIsSelected( N
) ;
447 void *wxListBox::DoGetItemClientData(int N
) const
449 wxCHECK_MSG( N
>= 0 && N
< m_noItems
, NULL
,
450 wxT("invalid index in wxListBox::GetClientData"));
452 return (void *)m_dataArray
[N
];
455 wxClientData
*wxListBox::DoGetItemClientObject(int N
) const
457 return (wxClientData
*) DoGetItemClientData( N
) ;
460 void wxListBox::DoSetItemClientData(int N
, void *Client_data
)
462 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
463 wxT("invalid index in wxListBox::SetClientData") );
465 #if wxUSE_OWNER_DRAWN
466 if ( m_windowStyle
& wxLB_OWNERDRAW
)
468 // client data must be pointer to wxOwnerDrawn, otherwise we would crash
469 // in OnMeasure/OnDraw.
470 wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
472 #endif // wxUSE_OWNER_DRAWN
473 wxASSERT_MSG( m_dataArray
.GetCount() >= (size_t) N
, wxT("invalid client_data array") ) ;
475 if ( m_dataArray
.GetCount() > (size_t) N
)
477 m_dataArray
[N
] = (char*) Client_data
;
481 m_dataArray
.Add( (char*) Client_data
) ;
485 void wxListBox::DoSetItemClientObject(int n
, wxClientData
* clientData
)
487 DoSetItemClientData(n
, clientData
);
490 // Return number of selections and an array of selected integers
491 int wxListBox::GetSelections(wxArrayInt
& aSelections
) const
493 return MacGetSelections( aSelections
) ;
496 // Get single selection, for single choice list items
497 int wxListBox::GetSelection() const
499 return MacGetSelection() ;
502 // Find string for position
503 wxString
wxListBox::GetString(int N
) const
505 return m_stringArray
[N
] ;
508 void wxListBox::DoInsertItems(const wxArrayString
& items
, int pos
)
510 wxCHECK_RET( pos
>= 0 && pos
<= m_noItems
,
511 wxT("invalid index in wxListBox::InsertItems") );
513 int nItems
= items
.GetCount();
515 for ( int i
= 0 ; i
< nItems
; i
++ )
517 m_stringArray
.Insert( items
[i
] , pos
+ i
) ;
518 m_dataArray
.Insert( NULL
, pos
+ i
) ;
519 MacInsert( pos
+ i
, items
[i
] ) ;
525 void wxListBox::SetString(int N
, const wxString
& s
)
527 m_stringArray
[N
] = s
;
531 wxSize
wxListBox::DoGetBestSize() const
533 int lbWidth
= 100; // some defaults
538 wxMacPortStateHelper
st( UMAGetWindowPort( (WindowRef
) MacGetTopLevelWindowRef() ) ) ;
542 ::TextFont( m_font
.MacGetFontNum() ) ;
543 ::TextSize( m_font
.MacGetFontSize() ) ;
544 ::TextFace( m_font
.MacGetFontStyle() ) ;
548 ::TextFont( kFontIDMonaco
) ;
553 // Find the widest line
554 for(int i
= 0; i
< GetCount(); i
++) {
555 wxString
str(GetString(i
));
559 ::GetThemeTextDimensions( wxMacCFStringHolder( str
, m_font
.GetEncoding() ) ,
560 kThemeCurrentPortFont
,
567 wLine
= ::TextWidth( str
.c_str() , 0 , str
.Length() ) ;
569 lbWidth
= wxMax(lbWidth
, wLine
);
572 // Add room for the scrollbar
573 lbWidth
+= wxSystemSettings::GetMetric(wxSYS_VSCROLL_X
);
575 // And just a bit more
577 int cx
= ::TextWidth( "X" , 0 , 1 ) ;
580 // don't make the listbox too tall (limit height to around 10 items) but don't
581 // make it too small neither
582 lbHeight
= (cy
+4) * wxMin(wxMax(GetCount(), 3), 10);
585 return wxSize(lbWidth
, lbHeight
);
588 int wxListBox::GetCount() const
593 void wxListBox::Refresh(bool eraseBack
, const wxRect
*rect
)
595 wxControl::Refresh( eraseBack
, rect
) ;
596 // MacRedrawControl() ;
599 #if wxUSE_OWNER_DRAWN
601 class wxListBoxItem
: public wxOwnerDrawn
604 wxListBoxItem(const wxString
& str
= "");
607 wxListBoxItem::wxListBoxItem(const wxString
& str
) : wxOwnerDrawn(str
, FALSE
)
609 // no bitmaps/checkmarks
613 wxOwnerDrawn
*wxListBox::CreateItem(size_t n
)
615 return new wxListBoxItem();
618 #endif //USE_OWNER_DRAWN
620 // ============================================================================
621 // list box control implementation
622 // ============================================================================
624 void wxListBox::MacDelete( int N
)
626 UInt32 id
= m_idArray
[N
] ;
627 verify_noerr(::RemoveDataBrowserItems((ControlRef
) m_macControl
, kDataBrowserNoItem
, 1 , (UInt32
*) &id
, kDataBrowserItemNoProperty
) ) ;
628 m_idArray
.RemoveAt( N
) ;
631 void wxListBox::MacInsert( int n
, const wxString
& text
)
633 verify_noerr(::AddDataBrowserItems( (ControlRef
) m_macControl
, kDataBrowserNoItem
, 1 , (UInt32
*) &m_nextId
, kDataBrowserItemNoProperty
) ) ;
634 m_idArray
.Insert( m_nextId
, n
) ;
638 void wxListBox::MacAppend( const wxString
& text
)
640 verify_noerr(::AddDataBrowserItems( (ControlRef
) m_macControl
, kDataBrowserNoItem
, 1 , (UInt32
*) &m_nextId
, kDataBrowserItemNoProperty
) ) ;
641 m_idArray
.Add( m_nextId
) ;
645 void wxListBox::MacClear()
647 verify_noerr(::RemoveDataBrowserItems((ControlRef
) m_macControl
, kDataBrowserNoItem
, 0 , NULL
, kDataBrowserItemNoProperty
) ) ;
651 void wxListBox::MacSetSelection( int n
, bool select
)
653 UInt32 id
= m_idArray
[n
] ;
654 if ( !(GetWindowStyle() & (wxLB_MULTIPLE
|wxLB_EXTENDED
) ) )
656 int n
= MacGetSelection() ;
659 UInt32 idOld
= m_idArray
[n
] ;
660 SetDataBrowserSelectedItems((ControlRef
) m_macControl
, 1 , & idOld
, kDataBrowserItemsRemove
) ;
663 if ( ::IsDataBrowserItemSelected( (ControlRef
) m_macControl
, id
) != select
)
665 verify_noerr(::SetDataBrowserSelectedItems((ControlRef
) m_macControl
, 1 , & id
, kDataBrowserItemsToggle
) ) ;
670 bool wxListBox::MacIsSelected( int n
) const
672 return ::IsDataBrowserItemSelected( (ControlRef
) m_macControl
, m_idArray
[n
] ) ;
675 int wxListBox::MacGetSelection() const
677 for ( size_t i
= 0 ; i
< m_idArray
.GetCount() ; ++i
)
679 if ( ::IsDataBrowserItemSelected((ControlRef
) m_macControl
, m_idArray
[i
] ) )
687 int wxListBox::MacGetSelections( wxArrayInt
& aSelections
) const
692 for ( size_t i
= 0 ; i
< m_idArray
.GetCount() ; ++i
)
694 if ( ::IsDataBrowserItemSelected((ControlRef
) m_macControl
, m_idArray
[i
] ) )
696 aSelections
.Add( i
) ;
703 void wxListBox::MacSet( int n
, const wxString
& text
)
705 // as we don't store the strings we only have to issue a redraw
706 UInt32 id
= m_idArray
[n
] ;
707 verify_noerr( ::UpdateDataBrowserItems( (ControlRef
) m_macControl
, kDataBrowserNoItem
, 1 , &id
, kDataBrowserItemNoProperty
, kDataBrowserItemNoProperty
) ) ;
710 void wxListBox::MacScrollTo( int n
)
712 UInt32 id
= m_idArray
[n
] ;
713 verify_noerr( ::RevealDataBrowserItem((ControlRef
) m_macControl
, id
, kTextColumnId
, kDataBrowserRevealWithoutSelecting
) ) ;
716 #if !TARGET_API_MAC_OSX
717 void wxListBox::OnSize( wxSizeEvent
&event
)
722 void wxListBox::MacSetRedraw( bool doDraw
)
724 // nothing to do in compositing mode
727 void wxListBox::MacDoClick()
729 wxArrayInt aSelections;
731 size_t count = GetSelections(aSelections);
733 if ( count == m_selectionPreImage.GetCount() )
735 bool hasChanged = false ;
736 for ( size_t i = 0 ; i < count ; ++i )
738 if ( aSelections[i] != m_selectionPreImage[i] )
750 m_selectionPreImage = aSelections;
752 wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
753 event.SetEventObject( this );
758 if ( HasClientObjectData() )
759 event.SetClientObject( GetClientObject(n) );
760 else if ( HasClientUntypedData() )
761 event.SetClientData( GetClientData(n) );
762 event.SetString( GetString(n) );
769 event.m_commandInt = n;
771 GetEventHandler()->ProcessEvent(event);
775 void wxListBox::MacDoDoubleClick()
778 wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, m_windowId);
779 event.SetEventObject( this );
780 GetEventHandler()->ProcessEvent(event) ;
784 #if !TARGET_API_MAC_OSX
786 void wxListBox::OnChar(wxKeyEvent
& event
)
788 // todo trigger proper events here
792 if ( event
.GetKeyCode() == WXK_RETURN
|| event
.GetKeyCode() == WXK_NUMPAD_ENTER
)
794 wxWindow
* parent
= GetParent() ;
795 while( parent
&& !parent
->IsTopLevel() && parent
->GetDefaultItem() == NULL
)
796 parent
= parent
->GetParent() ;
798 if ( parent
&& parent
->GetDefaultItem() )
800 wxButton
*def
= wxDynamicCast(parent
->GetDefaultItem(),
802 if ( def
&& def
->IsEnabled() )
804 wxCommandEvent
event(wxEVT_COMMAND_BUTTON_CLICKED
, def
->GetId() );
805 event
.SetEventObject(def
);
812 /* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
813 else if (event
.GetKeyCode() == WXK_ESCAPE
|| (event
.GetKeyCode() == '.' && event
.MetaDown() ) )
815 // FIXME: look in ancestors, not just parent.
816 wxWindow
* win
= GetParent()->FindWindow( wxID_CANCEL
) ;
819 wxCommandEvent
new_event(wxEVT_COMMAND_BUTTON_CLICKED
,wxID_CANCEL
);
820 new_event
.SetEventObject( win
);
821 win
->GetEventHandler()->ProcessEvent( new_event
);
824 else if ( event
.GetKeyCode() == WXK_TAB
)
826 wxNavigationKeyEvent new_event
;
827 new_event
.SetEventObject( this );
828 new_event
.SetDirection( !event
.ShiftDown() );
829 /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
830 new_event
.SetWindowChange( event
.ControlDown() );
831 new_event
.SetCurrentFocus( this );
832 if ( !GetEventHandler()->ProcessEvent( new_event
) )
835 else if ( event
.GetKeyCode() == WXK_DOWN
|| event
.GetKeyCode() == WXK_UP
)
837 // perform the default key handling first
838 wxControl::OnKeyDown( event
) ;
840 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_SELECTED
, m_windowId
);
841 event
.SetEventObject( this );
843 wxArrayInt aSelections
;
844 int n
, count
= GetSelections(aSelections
);
848 if ( HasClientObjectData() )
849 event
.SetClientObject( GetClientObject(n
) );
850 else if ( HasClientUntypedData() )
851 event
.SetClientData( GetClientData(n
) );
852 event
.SetString( GetString(n
) );
859 event
.m_commandInt
= n
;
861 GetEventHandler()->ProcessEvent(event
);
865 if ( event
.GetTimestamp() > m_lastTypeIn
+ 60 )
867 m_typeIn
= wxEmptyString
;
869 m_lastTypeIn
= event
.GetTimestamp() ;
870 m_typeIn
+= (char) event
.GetKeyCode() ;
871 int line
= FindString(wxT("*")+m_typeIn
+wxT("*")) ;
874 if ( GetSelection() != line
)
877 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_SELECTED
, m_windowId
);
878 event
.SetEventObject( this );
880 if ( HasClientObjectData() )
881 event
.SetClientObject( GetClientObject( line
) );
882 else if ( HasClientUntypedData() )
883 event
.SetClientData( GetClientData(line
) );
884 event
.SetString( GetString(line
) );
886 event
.m_commandInt
= line
;
888 GetEventHandler()->ProcessEvent(event
);