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 wxPostEvent( list
->GetEventHandler() , event
) ;
110 // direct notification is not always having the listbox GetSelection() having in synch with event
111 // list->GetEventHandler()->ProcessEvent(event) ;
119 static pascal OSStatus
ListBoxGetSetItemData(ControlRef browser
,
120 DataBrowserItemID itemID
, DataBrowserPropertyID property
,
121 DataBrowserItemDataRef itemData
, Boolean changeValue
)
123 OSStatus err
= errDataBrowserPropertyNotSupported
;
132 long ref
= GetControlReference( browser
) ;
135 wxListBox
* list
= wxDynamicCast( (wxObject
*) ref
, wxListBox
) ;
136 for ( size_t i
= 0 ; i
< list
->m_idArray
.GetCount() ; ++i
)
137 if ( list
->m_idArray
[i
] == (long) itemID
)
139 wxMacCFStringHolder
cf( list
->GetString(i
) , list
->GetFont().GetEncoding() ) ;
140 verify_noerr( ::SetDataBrowserItemDataText( itemData
, cf
) ) ;
156 bool wxListBox::Create(wxWindow
*parent
, wxWindowID id
,
159 int n
, const wxString choices
[],
161 const wxValidator
& validator
,
162 const wxString
& name
)
164 m_macIsUserPane
= FALSE
;
166 wxASSERT_MSG( !(style
& wxLB_MULTIPLE
) || !(style
& wxLB_EXTENDED
),
167 _T("only one of listbox selection modes can be specified") );
169 if ( !wxListBoxBase::Create(parent
, id
, pos
, size
, style
& ~(wxHSCROLL
|wxVSCROLL
), validator
, name
) )
172 m_noItems
= 0 ; // this will be increased by our append command
177 Rect bounds
= wxMacGetBoundsForControl( this , pos
, size
) ;
179 m_peer
= new wxMacControl() ;
180 verify_noerr( ::CreateDataBrowserControl( MAC_WXHWND(parent
->MacGetTopLevelWindowRef()), &bounds
, kDataBrowserListView
, m_peer
->GetControlRefAddr() ) );
182 DataBrowserSelectionFlags options
= kDataBrowserDragSelect
;
183 if ( style
& wxLB_MULTIPLE
)
185 options
+= kDataBrowserAlwaysExtendSelection
+ kDataBrowserCmdTogglesSelection
;
187 else if ( style
& wxLB_EXTENDED
)
193 options
+= kDataBrowserSelectOnlyOne
;
195 verify_noerr(m_peer
->SetSelectionFlags( options
) );
197 DataBrowserListViewColumnDesc columnDesc
;
198 columnDesc
.headerBtnDesc
.titleOffset
= 0;
199 columnDesc
.headerBtnDesc
.version
= kDataBrowserListViewLatestHeaderDesc
;
201 columnDesc
.headerBtnDesc
.btnFontStyle
.flags
=
202 kControlUseFontMask
| kControlUseJustMask
;
204 columnDesc
.headerBtnDesc
.btnContentInfo
.contentType
= kControlNoContent
;
205 columnDesc
.propertyDesc
.propertyType
= kDataBrowserTextType
;
206 columnDesc
.headerBtnDesc
.btnFontStyle
.just
= teFlushDefault
;
207 columnDesc
.headerBtnDesc
.minimumWidth
= 0;
208 columnDesc
.headerBtnDesc
.maximumWidth
= 10000;
210 columnDesc
.headerBtnDesc
.btnFontStyle
.font
= kControlFontViewSystemFont
;
211 columnDesc
.headerBtnDesc
.btnFontStyle
.style
= normal
;
212 columnDesc
.headerBtnDesc
.titleString
= NULL
; // CFSTR( "" );
214 columnDesc
.propertyDesc
.propertyID
= kTextColumnId
;
215 columnDesc
.propertyDesc
.propertyType
= kDataBrowserTextType
;
216 columnDesc
.propertyDesc
.propertyFlags
=
217 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
218 kDataBrowserListViewTypeSelectColumn
|
220 kDataBrowserTableViewSelectionColumn
;
223 verify_noerr(m_peer
->AddListViewColumn( &columnDesc
, kDataBrowserListViewAppendColumn
) ) ;
224 verify_noerr(m_peer
->AutoSizeListViewColumns() ) ;
225 verify_noerr(m_peer
->SetHasScrollBars(false , true ) ) ;
226 verify_noerr(m_peer
->SetTableViewHiliteStyle(kDataBrowserTableViewFillHilite
) ) ;
227 verify_noerr(m_peer
->SetListViewHeaderBtnHeight( 0 ) ) ;
228 DataBrowserCallbacks callbacks
;
230 callbacks
.version
= kDataBrowserLatestCallbacks
;
232 InitDataBrowserCallbacks(&callbacks
);
234 callbacks
.u
.v1
.itemDataCallback
=
235 NewDataBrowserItemDataUPP(ListBoxGetSetItemData
);
237 callbacks
.u
.v1
.itemNotificationCallback
=
238 #if TARGET_API_MAC_OSX
239 (DataBrowserItemNotificationUPP
) NewDataBrowserItemNotificationWithItemUPP(DataBrowserItemNotificationProc
) ;
241 NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc
) ;
243 m_peer
->SetCallbacks( &callbacks
);
245 MacPostControlCreate(pos
,size
) ;
247 for ( int i
= 0 ; i
< n
; i
++ )
249 Append( choices
[i
] ) ;
252 SetBestSize(size
); // Needed because it is a wxControlWithItems
257 wxListBox::~wxListBox()
259 m_peer
->SetReference( NULL
) ;
261 // avoid access during destruction
268 void wxListBox::FreeData()
270 #if wxUSE_OWNER_DRAWN
271 if ( m_windowStyle
& wxLB_OWNERDRAW
)
273 size_t uiCount
= m_aItems
.Count();
274 while ( uiCount
-- != 0 ) {
275 delete m_aItems
[uiCount
];
276 m_aItems
[uiCount
] = NULL
;
282 #endif // wxUSE_OWNER_DRAWN
283 if ( HasClientObjectData() )
285 for ( size_t n
= 0; n
< (size_t)m_noItems
; n
++ )
287 delete GetClientObject(n
);
292 void wxListBox::DoSetSize(int x
, int y
,
293 int width
, int height
,
296 wxControl::DoSetSize( x
, y
, width
, height
, sizeFlags
) ;
299 void wxListBox::DoSetFirstItem(int N
)
304 void wxListBox::Delete(int N
)
306 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
307 wxT("invalid index in wxListBox::Delete") );
309 #if wxUSE_OWNER_DRAWN
311 m_aItems
.RemoveAt(N
);
312 #else // !wxUSE_OWNER_DRAWN
313 if ( HasClientObjectData() )
315 delete GetClientObject(N
);
317 #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
318 m_stringArray
.RemoveAt( N
) ;
319 m_dataArray
.RemoveAt( N
) ;
325 int wxListBox::DoAppend(const wxString
& item
)
327 InvalidateBestSize();
329 int index
= m_noItems
;
330 m_stringArray
.Add( item
) ;
331 m_dataArray
.Add( NULL
);
333 DoSetItemClientData( index
, NULL
) ;
339 void wxListBox::DoSetItems(const wxArrayString
& choices
, void** clientData
)
342 int n
= choices
.GetCount();
344 for( int i
= 0 ; i
< n
; ++i
)
348 #if wxUSE_OWNER_DRAWN
349 wxASSERT_MSG(clientData
[i
] == NULL
,
350 wxT("Can't use client data with owner-drawn listboxes"));
351 #else // !wxUSE_OWNER_DRAWN
352 Append( choices
[i
] , clientData
[i
] ) ;
356 Append( choices
[i
] ) ;
359 #if wxUSE_OWNER_DRAWN
360 if ( m_windowStyle
& wxLB_OWNERDRAW
) {
361 // first delete old items
362 size_t ui
= m_aItems
.Count();
363 while ( ui
-- != 0 ) {
369 // then create new ones
370 for ( ui
= 0; ui
< (size_t)m_noItems
; ui
++ ) {
371 wxOwnerDrawn
*pNewItem
= CreateItem(ui
);
372 pNewItem
->SetName(choices
[ui
]);
373 m_aItems
.Add(pNewItem
);
376 #endif // wxUSE_OWNER_DRAWN
379 int wxListBox::FindString(const wxString
& s
) const
382 if ( s
.Right(1) == wxT("*") )
384 wxString search
= s
.Left( s
.Length() - 1 ) ;
385 int len
= search
.Length() ;
387 wxMacStringToPascal( search
, s2
) ;
389 for ( int i
= 0 ; i
< m_noItems
; ++ i
)
391 wxMacStringToPascal( m_stringArray
[i
].Left( len
) , s1
) ;
393 if ( EqualString( s1
, s2
, false , false ) )
396 if ( s
.Left(1) == wxT("*") && s
.Length() > 1 )
400 for ( int i
= 0 ; i
< m_noItems
; ++i
)
402 if ( GetString(i
).Lower().Matches(st
) )
412 wxMacStringToPascal( s
, s2
) ;
414 for ( int i
= 0 ; i
< m_noItems
; ++ i
)
416 wxMacStringToPascal( m_stringArray
[i
] , s1
) ;
418 if ( EqualString( s1
, s2
, false , false ) )
425 void wxListBox::Clear()
429 m_stringArray
.Empty() ;
430 m_dataArray
.Empty() ;
434 void wxListBox::SetSelection(int N
, bool select
)
436 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
437 wxT("invalid index in wxListBox::SetSelection") );
438 MacSetSelection( N
, select
) ;
439 GetSelections( m_selectionPreImage
) ;
442 bool wxListBox::IsSelected(int N
) const
444 wxCHECK_MSG( N
>= 0 && N
< m_noItems
, FALSE
,
445 wxT("invalid index in wxListBox::Selected") );
447 return MacIsSelected( N
) ;
450 void *wxListBox::DoGetItemClientData(int N
) const
452 wxCHECK_MSG( N
>= 0 && N
< m_noItems
, NULL
,
453 wxT("invalid index in wxListBox::GetClientData"));
455 return (void *)m_dataArray
[N
];
458 wxClientData
*wxListBox::DoGetItemClientObject(int N
) const
460 return (wxClientData
*) DoGetItemClientData( N
) ;
463 void wxListBox::DoSetItemClientData(int N
, void *Client_data
)
465 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
466 wxT("invalid index in wxListBox::SetClientData") );
468 #if wxUSE_OWNER_DRAWN
469 if ( m_windowStyle
& wxLB_OWNERDRAW
)
471 // client data must be pointer to wxOwnerDrawn, otherwise we would crash
472 // in OnMeasure/OnDraw.
473 wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
475 #endif // wxUSE_OWNER_DRAWN
476 wxASSERT_MSG( m_dataArray
.GetCount() >= (size_t) N
, wxT("invalid client_data array") ) ;
478 if ( m_dataArray
.GetCount() > (size_t) N
)
480 m_dataArray
[N
] = (char*) Client_data
;
484 m_dataArray
.Add( (char*) Client_data
) ;
488 void wxListBox::DoSetItemClientObject(int n
, wxClientData
* clientData
)
490 DoSetItemClientData(n
, clientData
);
493 // Return number of selections and an array of selected integers
494 int wxListBox::GetSelections(wxArrayInt
& aSelections
) const
496 return MacGetSelections( aSelections
) ;
499 // Get single selection, for single choice list items
500 int wxListBox::GetSelection() const
502 return MacGetSelection() ;
505 // Find string for position
506 wxString
wxListBox::GetString(int N
) const
508 return m_stringArray
[N
] ;
511 void wxListBox::DoInsertItems(const wxArrayString
& items
, int pos
)
513 wxCHECK_RET( pos
>= 0 && pos
<= m_noItems
,
514 wxT("invalid index in wxListBox::InsertItems") );
516 InvalidateBestSize();
518 int nItems
= items
.GetCount();
520 for ( int i
= 0 ; i
< nItems
; i
++ )
522 m_stringArray
.Insert( items
[i
] , pos
+ i
) ;
523 m_dataArray
.Insert( NULL
, pos
+ i
) ;
524 MacInsert( pos
+ i
, items
[i
] ) ;
530 void wxListBox::SetString(int N
, const wxString
& s
)
532 m_stringArray
[N
] = s
;
536 wxSize
wxListBox::DoGetBestSize() const
538 int lbWidth
= 100; // some defaults
543 wxMacPortStateHelper
st( UMAGetWindowPort( (WindowRef
) MacGetTopLevelWindowRef() ) ) ;
547 ::TextFont( m_font
.MacGetFontNum() ) ;
548 ::TextSize( m_font
.MacGetFontSize() ) ;
549 ::TextFace( m_font
.MacGetFontStyle() ) ;
553 ::TextFont( kFontIDMonaco
) ;
558 // Find the widest line
559 for(int i
= 0; i
< GetCount(); i
++) {
560 wxString
str(GetString(i
));
564 ::GetThemeTextDimensions( wxMacCFStringHolder( str
, m_font
.GetEncoding() ) ,
565 kThemeCurrentPortFont
,
572 wLine
= ::TextWidth( str
.c_str() , 0 , str
.Length() ) ;
574 lbWidth
= wxMax(lbWidth
, wLine
);
577 // Add room for the scrollbar
578 lbWidth
+= wxSystemSettings::GetMetric(wxSYS_VSCROLL_X
);
580 // And just a bit more
582 int cx
= ::TextWidth( "X" , 0 , 1 ) ;
585 // don't make the listbox too tall (limit height to around 10 items) but don't
586 // make it too small neither
587 lbHeight
= (cy
+4) * wxMin(wxMax(GetCount(), 3), 10);
590 return wxSize(lbWidth
, lbHeight
);
593 int wxListBox::GetCount() const
598 void wxListBox::Refresh(bool eraseBack
, const wxRect
*rect
)
600 wxControl::Refresh( eraseBack
, rect
) ;
601 // MacRedrawControl() ;
604 #if wxUSE_OWNER_DRAWN
606 class wxListBoxItem
: public wxOwnerDrawn
609 wxListBoxItem(const wxString
& str
= "");
612 wxListBoxItem::wxListBoxItem(const wxString
& str
) : wxOwnerDrawn(str
, FALSE
)
614 // no bitmaps/checkmarks
618 wxOwnerDrawn
*wxListBox::CreateItem(size_t n
)
620 return new wxListBoxItem();
623 #endif //USE_OWNER_DRAWN
625 // ============================================================================
626 // list box control implementation
627 // ============================================================================
629 void wxListBox::MacDelete( int N
)
631 UInt32 id
= m_idArray
[N
] ;
632 verify_noerr( m_peer
->RemoveItems( kDataBrowserNoItem
, 1 , (UInt32
*) &id
, kDataBrowserItemNoProperty
) ) ;
633 m_idArray
.RemoveAt( N
) ;
636 void wxListBox::MacInsert( int n
, const wxString
& text
)
638 verify_noerr( m_peer
->AddItems( kDataBrowserNoItem
, 1 , (UInt32
*) &m_nextId
, kDataBrowserItemNoProperty
) ) ;
639 m_idArray
.Insert( m_nextId
, n
) ;
643 void wxListBox::MacAppend( const wxString
& text
)
645 verify_noerr( m_peer
->AddItems( kDataBrowserNoItem
, 1 , (UInt32
*) &m_nextId
, kDataBrowserItemNoProperty
) ) ;
646 m_idArray
.Add( m_nextId
) ;
650 void wxListBox::MacClear()
652 verify_noerr( m_peer
->RemoveItems( kDataBrowserNoItem
, 0 , NULL
, kDataBrowserItemNoProperty
) ) ;
656 void wxListBox::MacSetSelection( int n
, bool select
)
658 UInt32 id
= m_idArray
[n
] ;
659 if ( !(GetWindowStyle() & (wxLB_MULTIPLE
|wxLB_EXTENDED
) ) )
661 int n
= MacGetSelection() ;
664 UInt32 idOld
= m_idArray
[n
] ;
665 m_peer
->SetSelectedItems( 1 , & idOld
, kDataBrowserItemsRemove
) ;
668 if ( m_peer
->IsItemSelected( id
) != select
)
670 verify_noerr(m_peer
->SetSelectedItems( 1 , & id
, kDataBrowserItemsToggle
) ) ;
675 bool wxListBox::MacIsSelected( int n
) const
677 return m_peer
->IsItemSelected( m_idArray
[n
] ) ;
680 int wxListBox::MacGetSelection() const
682 for ( size_t i
= 0 ; i
< m_idArray
.GetCount() ; ++i
)
684 if ( m_peer
->IsItemSelected( m_idArray
[i
] ) )
692 int wxListBox::MacGetSelections( wxArrayInt
& aSelections
) const
697 for ( size_t i
= 0 ; i
< m_idArray
.GetCount() ; ++i
)
699 if ( m_peer
->IsItemSelected( m_idArray
[i
] ) )
701 aSelections
.Add( i
) ;
708 void wxListBox::MacSet( int n
, const wxString
& text
)
710 // as we don't store the strings we only have to issue a redraw
711 UInt32 id
= m_idArray
[n
] ;
712 verify_noerr( m_peer
->UpdateItems( kDataBrowserNoItem
, 1 , &id
, kDataBrowserItemNoProperty
, kDataBrowserItemNoProperty
) ) ;
715 void wxListBox::MacScrollTo( int n
)
717 UInt32 id
= m_idArray
[n
] ;
718 verify_noerr( m_peer
->RevealItem( id
, kTextColumnId
, kDataBrowserRevealWithoutSelecting
) ) ;
721 #if !TARGET_API_MAC_OSX
722 void wxListBox::OnSize( wxSizeEvent
&event
)
727 void wxListBox::MacSetRedraw( bool doDraw
)
729 // nothing to do in compositing mode
732 void wxListBox::MacDoClick()
734 wxArrayInt aSelections;
736 size_t count = GetSelections(aSelections);
738 if ( count == m_selectionPreImage.GetCount() )
740 bool hasChanged = false ;
741 for ( size_t i = 0 ; i < count ; ++i )
743 if ( aSelections[i] != m_selectionPreImage[i] )
755 m_selectionPreImage = aSelections;
757 wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
758 event.SetEventObject( this );
763 if ( HasClientObjectData() )
764 event.SetClientObject( GetClientObject(n) );
765 else if ( HasClientUntypedData() )
766 event.SetClientData( GetClientData(n) );
767 event.SetString( GetString(n) );
774 event.m_commandInt = n;
776 GetEventHandler()->ProcessEvent(event);
780 void wxListBox::MacDoDoubleClick()
783 wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, m_windowId);
784 event.SetEventObject( this );
785 GetEventHandler()->ProcessEvent(event) ;
789 #if !TARGET_API_MAC_OSX
791 void wxListBox::OnChar(wxKeyEvent
& event
)
793 // todo trigger proper events here
797 if ( event
.GetKeyCode() == WXK_RETURN
|| event
.GetKeyCode() == WXK_NUMPAD_ENTER
)
799 wxWindow
* parent
= GetParent() ;
800 while( parent
&& !parent
->IsTopLevel() && parent
->GetDefaultItem() == NULL
)
801 parent
= parent
->GetParent() ;
803 if ( parent
&& parent
->GetDefaultItem() )
805 wxButton
*def
= wxDynamicCast(parent
->GetDefaultItem(),
807 if ( def
&& def
->IsEnabled() )
809 wxCommandEvent
event(wxEVT_COMMAND_BUTTON_CLICKED
, def
->GetId() );
810 event
.SetEventObject(def
);
817 /* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
818 else if (event
.GetKeyCode() == WXK_ESCAPE
|| (event
.GetKeyCode() == '.' && event
.MetaDown() ) )
820 // FIXME: look in ancestors, not just parent.
821 wxWindow
* win
= GetParent()->FindWindow( wxID_CANCEL
) ;
824 wxCommandEvent
new_event(wxEVT_COMMAND_BUTTON_CLICKED
,wxID_CANCEL
);
825 new_event
.SetEventObject( win
);
826 win
->GetEventHandler()->ProcessEvent( new_event
);
829 else if ( event
.GetKeyCode() == WXK_TAB
)
831 wxNavigationKeyEvent new_event
;
832 new_event
.SetEventObject( this );
833 new_event
.SetDirection( !event
.ShiftDown() );
834 /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
835 new_event
.SetWindowChange( event
.ControlDown() );
836 new_event
.SetCurrentFocus( this );
837 if ( !GetEventHandler()->ProcessEvent( new_event
) )
840 else if ( event
.GetKeyCode() == WXK_DOWN
|| event
.GetKeyCode() == WXK_UP
)
842 // perform the default key handling first
843 wxControl::OnKeyDown( event
) ;
845 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_SELECTED
, m_windowId
);
846 event
.SetEventObject( this );
848 wxArrayInt aSelections
;
849 int n
, count
= GetSelections(aSelections
);
853 if ( HasClientObjectData() )
854 event
.SetClientObject( GetClientObject(n
) );
855 else if ( HasClientUntypedData() )
856 event
.SetClientData( GetClientData(n
) );
857 event
.SetString( GetString(n
) );
864 event
.m_commandInt
= n
;
866 GetEventHandler()->ProcessEvent(event
);
870 if ( event
.GetTimestamp() > m_lastTypeIn
+ 60 )
872 m_typeIn
= wxEmptyString
;
874 m_lastTypeIn
= event
.GetTimestamp() ;
875 m_typeIn
+= (char) event
.GetKeyCode() ;
876 int line
= FindString(wxT("*")+m_typeIn
+wxT("*")) ;
879 if ( GetSelection() != line
)
882 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_SELECTED
, m_windowId
);
883 event
.SetEventObject( this );
885 if ( HasClientObjectData() )
886 event
.SetClientObject( GetClientObject( line
) );
887 else if ( HasClientUntypedData() )
888 event
.SetClientData( GetClientData(line
) );
889 event
.SetString( GetString(line
) );
891 event
.m_commandInt
= line
;
893 GetEventHandler()->ProcessEvent(event
);