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
)
30 #if !TARGET_API_MAC_OSX
31 EVT_SIZE( wxListBox::OnSize
)
32 EVT_CHAR( wxListBox::OnChar
)
37 #include "wx/mac/uma.h"
39 // new databrowserbased version
42 wxListBox::wxListBox()
49 bool wxListBox::Create(wxWindow
*parent
, wxWindowID id
,
52 const wxArrayString
& choices
,
54 const wxValidator
& validator
,
57 wxCArrayString
chs(choices
);
59 return Create(parent
, id
, pos
, size
, chs
.GetCount(), chs
.GetStrings(),
60 style
, validator
, name
);
63 #if TARGET_API_MAC_OSX
64 static pascal void DataBrowserItemNotificationProc(ControlRef browser
, DataBrowserItemID itemID
,
65 DataBrowserItemNotification message
, DataBrowserItemDataRef itemData
)
67 static pascal void DataBrowserItemNotificationProc(ControlRef browser
, DataBrowserItemID itemID
,
68 DataBrowserItemNotification message
)
71 long ref
= GetControlReference( browser
) ;
74 wxListBox
* list
= wxDynamicCast( (wxObject
*) ref
, wxListBox
) ;
75 for ( size_t i
= 0 ; i
< list
->m_idArray
.GetCount() ; ++i
)
76 if ( list
->m_idArray
[i
] == (long) itemID
)
78 bool trigger
= false ;
80 wxEVT_COMMAND_LISTBOX_SELECTED
, list
->GetId() );
83 case kDataBrowserItemDeselected
:
84 if ( list
->HasMultipleSelection() )
87 case kDataBrowserItemSelected
:
90 case kDataBrowserItemDoubleClicked
:
91 event
.SetEventType(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
) ;
99 event
.SetEventObject( list
);
100 if ( list
->HasClientObjectData() )
101 event
.SetClientObject( list
->GetClientObject(i
) );
102 else if ( list
->HasClientUntypedData() )
103 event
.SetClientData( list
->GetClientData(i
) );
104 event
.SetString( list
->GetString(i
) );
106 event
.SetExtraLong( list
->HasMultipleSelection() ? message
== kDataBrowserItemSelected
: TRUE
);
107 list
->GetEventHandler()->ProcessEvent(event
) ;
115 static pascal OSStatus
ListBoxGetSetItemData(ControlRef browser
,
116 DataBrowserItemID itemID
, DataBrowserPropertyID property
,
117 DataBrowserItemDataRef itemData
, Boolean changeValue
)
119 OSStatus err
= errDataBrowserPropertyNotSupported
;
128 long ref
= GetControlReference( browser
) ;
131 wxListBox
* list
= wxDynamicCast( (wxObject
*) ref
, wxListBox
) ;
132 for ( size_t i
= 0 ; i
< list
->m_idArray
.GetCount() ; ++i
)
133 if ( list
->m_idArray
[i
] == (long) itemID
)
135 wxMacCFStringHolder
cf( list
->GetString(i
) , list
->GetFont().GetEncoding() ) ;
136 verify_noerr( ::SetDataBrowserItemDataText( itemData
, cf
) ) ;
152 bool wxListBox::Create(wxWindow
*parent
, wxWindowID id
,
155 int n
, const wxString choices
[],
157 const wxValidator
& validator
,
158 const wxString
& name
)
160 m_macIsUserPane
= FALSE
;
162 wxASSERT_MSG( !(style
& wxLB_MULTIPLE
) || !(style
& wxLB_EXTENDED
),
163 _T("only one of listbox selection modes can be specified") );
165 if ( !wxListBoxBase::Create(parent
, id
, pos
, size
, style
& ~(wxHSCROLL
|wxVSCROLL
), validator
, name
) )
168 m_noItems
= 0 ; // this will be increased by our append command
173 Rect bounds
= wxMacGetBoundsForControl( this , pos
, size
) ;
176 verify_noerr( ::CreateDataBrowserControl( MAC_WXHWND(parent
->MacGetTopLevelWindowRef()), &bounds
, kDataBrowserListView
, (ControlRef
*)&m_macControl
) );
177 browser
= (ControlRef
) m_macControl
;
179 DataBrowserSelectionFlags options
= kDataBrowserDragSelect
;
180 if ( style
& wxLB_MULTIPLE
)
182 options
+= kDataBrowserAlwaysExtendSelection
+ kDataBrowserCmdTogglesSelection
;
184 else if ( style
& wxLB_EXTENDED
)
190 options
+= kDataBrowserSelectOnlyOne
;
192 verify_noerr(SetDataBrowserSelectionFlags (browser
, options
) );
194 DataBrowserListViewColumnDesc columnDesc
;
195 columnDesc
.headerBtnDesc
.titleOffset
= 0;
196 columnDesc
.headerBtnDesc
.version
= kDataBrowserListViewLatestHeaderDesc
;
198 columnDesc
.headerBtnDesc
.btnFontStyle
.flags
=
199 kControlUseFontMask
| kControlUseJustMask
;
201 columnDesc
.headerBtnDesc
.btnContentInfo
.contentType
= kControlNoContent
;
202 columnDesc
.propertyDesc
.propertyType
= kDataBrowserTextType
;
203 columnDesc
.headerBtnDesc
.btnFontStyle
.just
= teFlushDefault
;
204 columnDesc
.headerBtnDesc
.minimumWidth
= 0;
205 columnDesc
.headerBtnDesc
.maximumWidth
= 10000;
207 columnDesc
.headerBtnDesc
.btnFontStyle
.font
= kControlFontViewSystemFont
;
208 columnDesc
.headerBtnDesc
.btnFontStyle
.style
= normal
;
209 columnDesc
.headerBtnDesc
.titleString
= NULL
; // CFSTR( "" );
211 columnDesc
.propertyDesc
.propertyID
= 1024;
212 columnDesc
.propertyDesc
.propertyType
= kDataBrowserTextType
;
213 columnDesc
.propertyDesc
.propertyFlags
=
214 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
215 kDataBrowserListViewTypeSelectColumn
|
217 kDataBrowserTableViewSelectionColumn
;
220 verify_noerr(::AddDataBrowserListViewColumn(browser
, &columnDesc
, kDataBrowserListViewAppendColumn
) ) ;
221 verify_noerr(::AutoSizeDataBrowserListViewColumns( browser
) ) ;
222 verify_noerr(::SetDataBrowserHasScrollBars( browser
, false , true ) ) ;
223 verify_noerr(::SetDataBrowserTableViewHiliteStyle( browser
, kDataBrowserTableViewFillHilite
) ) ;
224 verify_noerr(::SetDataBrowserListViewHeaderBtnHeight( browser
, 0 ) ) ;
225 DataBrowserCallbacks callbacks
;
227 callbacks
.version
= kDataBrowserLatestCallbacks
;
229 InitDataBrowserCallbacks(&callbacks
);
231 callbacks
.u
.v1
.itemDataCallback
=
232 NewDataBrowserItemDataUPP(ListBoxGetSetItemData
);
234 callbacks
.u
.v1
.itemNotificationCallback
=
235 #if TARGET_API_MAC_OSX
236 (DataBrowserItemNotificationUPP
) NewDataBrowserItemNotificationWithItemUPP(DataBrowserItemNotificationProc
) ;
238 NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc
) ;
240 SetDataBrowserCallbacks(browser
, &callbacks
);
242 MacPostControlCreate(pos
,size
) ;
244 for ( int i
= 0 ; i
< n
; i
++ )
246 Append( choices
[i
] ) ;
252 wxListBox::~wxListBox()
254 SetControlReference( (ControlRef
) m_macControl
, NULL
) ;
256 // avoid access during destruction
263 void wxListBox::FreeData()
265 #if wxUSE_OWNER_DRAWN
266 if ( m_windowStyle
& wxLB_OWNERDRAW
)
268 size_t uiCount
= m_aItems
.Count();
269 while ( uiCount
-- != 0 ) {
270 delete m_aItems
[uiCount
];
271 m_aItems
[uiCount
] = NULL
;
277 #endif // wxUSE_OWNER_DRAWN
278 if ( HasClientObjectData() )
280 for ( size_t n
= 0; n
< (size_t)m_noItems
; n
++ )
282 delete GetClientObject(n
);
287 void wxListBox::DoSetSize(int x
, int y
,
288 int width
, int height
,
291 wxControl::DoSetSize( x
, y
, width
, height
, sizeFlags
) ;
294 void wxListBox::DoSetFirstItem(int N
)
299 void wxListBox::Delete(int N
)
301 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
302 wxT("invalid index in wxListBox::Delete") );
304 #if wxUSE_OWNER_DRAWN
306 m_aItems
.RemoveAt(N
);
307 #else // !wxUSE_OWNER_DRAWN
308 if ( HasClientObjectData() )
310 delete GetClientObject(N
);
312 #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
313 m_stringArray
.RemoveAt( N
) ;
314 m_dataArray
.RemoveAt( N
) ;
320 int wxListBox::DoAppend(const wxString
& item
)
322 int index
= m_noItems
;
323 m_stringArray
.Add( item
) ;
324 m_dataArray
.Add( NULL
);
326 DoSetItemClientData( index
, NULL
) ;
332 void wxListBox::DoSetItems(const wxArrayString
& choices
, void** clientData
)
335 int n
= choices
.GetCount();
337 for( int i
= 0 ; i
< n
; ++i
)
341 #if wxUSE_OWNER_DRAWN
342 wxASSERT_MSG(clientData
[i
] == NULL
,
343 wxT("Can't use client data with owner-drawn listboxes"));
344 #else // !wxUSE_OWNER_DRAWN
345 Append( choices
[i
] , clientData
[i
] ) ;
349 Append( choices
[i
] ) ;
352 #if wxUSE_OWNER_DRAWN
353 if ( m_windowStyle
& wxLB_OWNERDRAW
) {
354 // first delete old items
355 size_t ui
= m_aItems
.Count();
356 while ( ui
-- != 0 ) {
362 // then create new ones
363 for ( ui
= 0; ui
< (size_t)m_noItems
; ui
++ ) {
364 wxOwnerDrawn
*pNewItem
= CreateItem(ui
);
365 pNewItem
->SetName(choices
[ui
]);
366 m_aItems
.Add(pNewItem
);
369 #endif // wxUSE_OWNER_DRAWN
372 int wxListBox::FindString(const wxString
& s
) const
375 if ( s
.Right(1) == wxT("*") )
377 wxString search
= s
.Left( s
.Length() - 1 ) ;
378 int len
= search
.Length() ;
380 wxMacStringToPascal( search
, s2
) ;
382 for ( int i
= 0 ; i
< m_noItems
; ++ i
)
384 wxMacStringToPascal( m_stringArray
[i
].Left( len
) , s1
) ;
386 if ( EqualString( s1
, s2
, false , false ) )
389 if ( s
.Left(1) == wxT("*") && s
.Length() > 1 )
393 for ( int i
= 0 ; i
< m_noItems
; ++i
)
395 if ( GetString(i
).Lower().Matches(st
) )
405 wxMacStringToPascal( s
, s2
) ;
407 for ( int i
= 0 ; i
< m_noItems
; ++ i
)
409 wxMacStringToPascal( m_stringArray
[i
] , s1
) ;
411 if ( EqualString( s1
, s2
, false , false ) )
418 void wxListBox::Clear()
422 m_stringArray
.Empty() ;
423 m_dataArray
.Empty() ;
427 void wxListBox::SetSelection(int N
, bool select
)
429 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
430 wxT("invalid index in wxListBox::SetSelection") );
431 MacSetSelection( N
, select
) ;
432 GetSelections( m_selectionPreImage
) ;
435 bool wxListBox::IsSelected(int N
) const
437 wxCHECK_MSG( N
>= 0 && N
< m_noItems
, FALSE
,
438 wxT("invalid index in wxListBox::Selected") );
440 return MacIsSelected( N
) ;
443 void *wxListBox::DoGetItemClientData(int N
) const
445 wxCHECK_MSG( N
>= 0 && N
< m_noItems
, NULL
,
446 wxT("invalid index in wxListBox::GetClientData"));
448 return (void *)m_dataArray
[N
];
451 wxClientData
*wxListBox::DoGetItemClientObject(int N
) const
453 return (wxClientData
*) DoGetItemClientData( N
) ;
456 void wxListBox::DoSetItemClientData(int N
, void *Client_data
)
458 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
459 wxT("invalid index in wxListBox::SetClientData") );
461 #if wxUSE_OWNER_DRAWN
462 if ( m_windowStyle
& wxLB_OWNERDRAW
)
464 // client data must be pointer to wxOwnerDrawn, otherwise we would crash
465 // in OnMeasure/OnDraw.
466 wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
468 #endif // wxUSE_OWNER_DRAWN
469 wxASSERT_MSG( m_dataArray
.GetCount() >= (size_t) N
, wxT("invalid client_data array") ) ;
471 if ( m_dataArray
.GetCount() > (size_t) N
)
473 m_dataArray
[N
] = (char*) Client_data
;
477 m_dataArray
.Add( (char*) Client_data
) ;
481 void wxListBox::DoSetItemClientObject(int n
, wxClientData
* clientData
)
483 DoSetItemClientData(n
, clientData
);
486 // Return number of selections and an array of selected integers
487 int wxListBox::GetSelections(wxArrayInt
& aSelections
) const
489 return MacGetSelections( aSelections
) ;
492 // Get single selection, for single choice list items
493 int wxListBox::GetSelection() const
495 return MacGetSelection() ;
498 // Find string for position
499 wxString
wxListBox::GetString(int N
) const
501 return m_stringArray
[N
] ;
504 void wxListBox::DoInsertItems(const wxArrayString
& items
, int pos
)
506 wxCHECK_RET( pos
>= 0 && pos
<= m_noItems
,
507 wxT("invalid index in wxListBox::InsertItems") );
509 int nItems
= items
.GetCount();
511 for ( int i
= 0 ; i
< nItems
; i
++ )
513 m_stringArray
.Insert( items
[i
] , pos
+ i
) ;
514 m_dataArray
.Insert( NULL
, pos
+ i
) ;
515 MacInsert( pos
+ i
, items
[i
] ) ;
521 void wxListBox::SetString(int N
, const wxString
& s
)
523 m_stringArray
[N
] = s
;
527 wxSize
wxListBox::DoGetBestSize() const
529 int lbWidth
= 100; // some defaults
534 wxMacPortStateHelper
st( UMAGetWindowPort( (WindowRef
) MacGetTopLevelWindowRef() ) ) ;
538 ::TextFont( m_font
.MacGetFontNum() ) ;
539 ::TextSize( m_font
.MacGetFontSize() ) ;
540 ::TextFace( m_font
.MacGetFontStyle() ) ;
544 ::TextFont( kFontIDMonaco
) ;
549 // Find the widest line
550 for(int i
= 0; i
< GetCount(); i
++) {
551 wxString
str(GetString(i
));
555 ::GetThemeTextDimensions( wxMacCFStringHolder( str
, m_font
.GetEncoding() ) ,
556 kThemeCurrentPortFont
,
563 wLine
= ::TextWidth( str
.c_str() , 0 , str
.Length() ) ;
565 lbWidth
= wxMax(lbWidth
, wLine
);
568 // Add room for the scrollbar
569 lbWidth
+= wxSystemSettings::GetMetric(wxSYS_VSCROLL_X
);
571 // And just a bit more
573 int cx
= ::TextWidth( "X" , 0 , 1 ) ;
576 // don't make the listbox too tall (limit height to around 10 items) but don't
577 // make it too small neither
578 lbHeight
= (cy
+4) * wxMin(wxMax(GetCount(), 3), 10);
581 return wxSize(lbWidth
, lbHeight
);
584 int wxListBox::GetCount() const
589 void wxListBox::Refresh(bool eraseBack
, const wxRect
*rect
)
591 wxControl::Refresh( eraseBack
, rect
) ;
592 // MacRedrawControl() ;
595 #if wxUSE_OWNER_DRAWN
597 class wxListBoxItem
: public wxOwnerDrawn
600 wxListBoxItem(const wxString
& str
= "");
603 wxListBoxItem::wxListBoxItem(const wxString
& str
) : wxOwnerDrawn(str
, FALSE
)
605 // no bitmaps/checkmarks
609 wxOwnerDrawn
*wxListBox::CreateItem(size_t n
)
611 return new wxListBoxItem();
614 #endif //USE_OWNER_DRAWN
616 // ============================================================================
617 // list box control implementation
618 // ============================================================================
620 void wxListBox::MacDelete( int N
)
622 UInt32 id
= m_idArray
[N
] ;
623 verify_noerr(::RemoveDataBrowserItems((ControlRef
) m_macControl
, kDataBrowserNoItem
, 1 , (UInt32
*) &id
, kDataBrowserItemNoProperty
) ) ;
624 m_idArray
.RemoveAt( N
) ;
627 void wxListBox::MacInsert( int n
, const wxString
& text
)
629 verify_noerr(::AddDataBrowserItems( (ControlRef
) m_macControl
, kDataBrowserNoItem
, 1 , (UInt32
*) &m_nextId
, kDataBrowserItemNoProperty
) ) ;
630 m_idArray
.Insert( m_nextId
, n
) ;
634 void wxListBox::MacAppend( const wxString
& text
)
636 verify_noerr(::AddDataBrowserItems( (ControlRef
) m_macControl
, kDataBrowserNoItem
, 1 , (UInt32
*) &m_nextId
, kDataBrowserItemNoProperty
) ) ;
637 m_idArray
.Add( m_nextId
) ;
641 void wxListBox::MacClear()
643 verify_noerr(::RemoveDataBrowserItems((ControlRef
) m_macControl
, kDataBrowserNoItem
, 0 , NULL
, kDataBrowserItemNoProperty
) ) ;
647 void wxListBox::MacSetSelection( int n
, bool select
)
649 UInt32 id
= m_idArray
[n
] ;
650 if ( !(GetWindowStyle() & (wxLB_MULTIPLE
|wxLB_EXTENDED
) ) )
652 int n
= MacGetSelection() ;
655 UInt32 idOld
= m_idArray
[n
] ;
656 SetDataBrowserSelectedItems((ControlRef
) m_macControl
, 1 , & idOld
, kDataBrowserItemsRemove
) ;
659 if ( ::IsDataBrowserItemSelected( (ControlRef
) m_macControl
, id
) != select
)
661 verify_noerr(::SetDataBrowserSelectedItems((ControlRef
) m_macControl
, 1 , & id
, kDataBrowserItemsToggle
) ) ;
666 bool wxListBox::MacIsSelected( int n
) const
668 return ::IsDataBrowserItemSelected( (ControlRef
) m_macControl
, m_idArray
[n
] ) ;
671 int wxListBox::MacGetSelection() const
673 for ( size_t i
= 0 ; i
< m_idArray
.GetCount() ; ++i
)
675 if ( ::IsDataBrowserItemSelected((ControlRef
) m_macControl
, m_idArray
[i
] ) )
683 int wxListBox::MacGetSelections( wxArrayInt
& aSelections
) const
688 for ( size_t i
= 0 ; i
< m_idArray
.GetCount() ; ++i
)
690 if ( ::IsDataBrowserItemSelected((ControlRef
) m_macControl
, m_idArray
[i
] ) )
692 aSelections
.Add( i
) ;
699 void wxListBox::MacSet( int n
, const wxString
& text
)
701 // as we don't store the strings we only have to issue a redraw
702 UInt32 id
= m_idArray
[n
] ;
703 verify_noerr( ::UpdateDataBrowserItems( (ControlRef
) m_macControl
, kDataBrowserNoItem
, 1 , &id
, kDataBrowserItemNoProperty
, kDataBrowserItemNoProperty
) ) ;
706 void wxListBox::MacScrollTo( int n
)
708 // TODO implement scrolling
711 void wxListBox::OnSize( wxSizeEvent
&event
)
715 void wxListBox::MacSetRedraw( bool doDraw
)
717 // nothing to do in compositing mode
720 void wxListBox::MacDoClick()
722 wxArrayInt aSelections;
724 size_t count = GetSelections(aSelections);
726 if ( count == m_selectionPreImage.GetCount() )
728 bool hasChanged = false ;
729 for ( size_t i = 0 ; i < count ; ++i )
731 if ( aSelections[i] != m_selectionPreImage[i] )
743 m_selectionPreImage = aSelections;
745 wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
746 event.SetEventObject( this );
751 if ( HasClientObjectData() )
752 event.SetClientObject( GetClientObject(n) );
753 else if ( HasClientUntypedData() )
754 event.SetClientData( GetClientData(n) );
755 event.SetString( GetString(n) );
762 event.m_commandInt = n;
764 GetEventHandler()->ProcessEvent(event);
768 void wxListBox::MacDoDoubleClick()
771 wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, m_windowId);
772 event.SetEventObject( this );
773 GetEventHandler()->ProcessEvent(event) ;
777 void wxListBox::OnChar(wxKeyEvent
& event
)
779 // todo trigger proper events here
783 if ( event
.GetKeyCode() == WXK_RETURN
|| event
.GetKeyCode() == WXK_NUMPAD_ENTER
)
785 wxWindow
* parent
= GetParent() ;
786 while( parent
&& !parent
->IsTopLevel() && parent
->GetDefaultItem() == NULL
)
787 parent
= parent
->GetParent() ;
789 if ( parent
&& parent
->GetDefaultItem() )
791 wxButton
*def
= wxDynamicCast(parent
->GetDefaultItem(),
793 if ( def
&& def
->IsEnabled() )
795 wxCommandEvent
event(wxEVT_COMMAND_BUTTON_CLICKED
, def
->GetId() );
796 event
.SetEventObject(def
);
803 /* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
804 else if (event
.GetKeyCode() == WXK_ESCAPE
|| (event
.GetKeyCode() == '.' && event
.MetaDown() ) )
806 // FIXME: look in ancestors, not just parent.
807 wxWindow
* win
= GetParent()->FindWindow( wxID_CANCEL
) ;
810 wxCommandEvent
new_event(wxEVT_COMMAND_BUTTON_CLICKED
,wxID_CANCEL
);
811 new_event
.SetEventObject( win
);
812 win
->GetEventHandler()->ProcessEvent( new_event
);
815 else if ( event
.GetKeyCode() == WXK_TAB
)
817 wxNavigationKeyEvent new_event
;
818 new_event
.SetEventObject( this );
819 new_event
.SetDirection( !event
.ShiftDown() );
820 /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
821 new_event
.SetWindowChange( event
.ControlDown() );
822 new_event
.SetCurrentFocus( this );
823 if ( !GetEventHandler()->ProcessEvent( new_event
) )
826 else if ( event
.GetKeyCode() == WXK_DOWN
|| event
.GetKeyCode() == WXK_UP
)
828 // perform the default key handling first
829 wxControl::OnKeyDown( event
) ;
831 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_SELECTED
, m_windowId
);
832 event
.SetEventObject( this );
834 wxArrayInt aSelections
;
835 int n
, count
= GetSelections(aSelections
);
839 if ( HasClientObjectData() )
840 event
.SetClientObject( GetClientObject(n
) );
841 else if ( HasClientUntypedData() )
842 event
.SetClientData( GetClientData(n
) );
843 event
.SetString( GetString(n
) );
850 event
.m_commandInt
= n
;
852 GetEventHandler()->ProcessEvent(event
);
856 if ( event
.GetTimestamp() > m_lastTypeIn
+ 60 )
858 m_typeIn
= wxEmptyString
;
860 m_lastTypeIn
= event
.GetTimestamp() ;
861 m_typeIn
+= (char) event
.GetKeyCode() ;
862 int line
= FindString(wxT("*")+m_typeIn
+wxT("*")) ;
865 if ( GetSelection() != line
)
868 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_SELECTED
, m_windowId
);
869 event
.SetEventObject( this );
871 if ( HasClientObjectData() )
872 event
.SetClientObject( GetClientObject( line
) );
873 else if ( HasClientUntypedData() )
874 event
.SetClientData( GetClientData(line
) );
875 event
.SetString( GetString(line
) );
877 event
.m_commandInt
= line
;
879 GetEventHandler()->ProcessEvent(event
);