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
) );
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(SetDataBrowserSelectionFlags (*m_peer
, 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(::AddDataBrowserListViewColumn(*m_peer
, &columnDesc
, kDataBrowserListViewAppendColumn
) ) ;
224 verify_noerr(::AutoSizeDataBrowserListViewColumns( *m_peer
) ) ;
225 verify_noerr(::SetDataBrowserHasScrollBars( *m_peer
, false , true ) ) ;
226 verify_noerr(::SetDataBrowserTableViewHiliteStyle( *m_peer
, kDataBrowserTableViewFillHilite
) ) ;
227 verify_noerr(::SetDataBrowserListViewHeaderBtnHeight( *m_peer
, 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 SetDataBrowserCallbacks(*m_peer
, &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 SetControlReference( *m_peer
, 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 int index
= m_noItems
;
328 m_stringArray
.Add( item
) ;
329 m_dataArray
.Add( NULL
);
331 DoSetItemClientData( index
, NULL
) ;
337 void wxListBox::DoSetItems(const wxArrayString
& choices
, void** clientData
)
340 int n
= choices
.GetCount();
342 for( int i
= 0 ; i
< n
; ++i
)
346 #if wxUSE_OWNER_DRAWN
347 wxASSERT_MSG(clientData
[i
] == NULL
,
348 wxT("Can't use client data with owner-drawn listboxes"));
349 #else // !wxUSE_OWNER_DRAWN
350 Append( choices
[i
] , clientData
[i
] ) ;
354 Append( choices
[i
] ) ;
357 #if wxUSE_OWNER_DRAWN
358 if ( m_windowStyle
& wxLB_OWNERDRAW
) {
359 // first delete old items
360 size_t ui
= m_aItems
.Count();
361 while ( ui
-- != 0 ) {
367 // then create new ones
368 for ( ui
= 0; ui
< (size_t)m_noItems
; ui
++ ) {
369 wxOwnerDrawn
*pNewItem
= CreateItem(ui
);
370 pNewItem
->SetName(choices
[ui
]);
371 m_aItems
.Add(pNewItem
);
374 #endif // wxUSE_OWNER_DRAWN
377 int wxListBox::FindString(const wxString
& s
) const
380 if ( s
.Right(1) == wxT("*") )
382 wxString search
= s
.Left( s
.Length() - 1 ) ;
383 int len
= search
.Length() ;
385 wxMacStringToPascal( search
, s2
) ;
387 for ( int i
= 0 ; i
< m_noItems
; ++ i
)
389 wxMacStringToPascal( m_stringArray
[i
].Left( len
) , s1
) ;
391 if ( EqualString( s1
, s2
, false , false ) )
394 if ( s
.Left(1) == wxT("*") && s
.Length() > 1 )
398 for ( int i
= 0 ; i
< m_noItems
; ++i
)
400 if ( GetString(i
).Lower().Matches(st
) )
410 wxMacStringToPascal( s
, s2
) ;
412 for ( int i
= 0 ; i
< m_noItems
; ++ i
)
414 wxMacStringToPascal( m_stringArray
[i
] , s1
) ;
416 if ( EqualString( s1
, s2
, false , false ) )
423 void wxListBox::Clear()
427 m_stringArray
.Empty() ;
428 m_dataArray
.Empty() ;
432 void wxListBox::SetSelection(int N
, bool select
)
434 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
435 wxT("invalid index in wxListBox::SetSelection") );
436 MacSetSelection( N
, select
) ;
437 GetSelections( m_selectionPreImage
) ;
440 bool wxListBox::IsSelected(int N
) const
442 wxCHECK_MSG( N
>= 0 && N
< m_noItems
, FALSE
,
443 wxT("invalid index in wxListBox::Selected") );
445 return MacIsSelected( N
) ;
448 void *wxListBox::DoGetItemClientData(int N
) const
450 wxCHECK_MSG( N
>= 0 && N
< m_noItems
, NULL
,
451 wxT("invalid index in wxListBox::GetClientData"));
453 return (void *)m_dataArray
[N
];
456 wxClientData
*wxListBox::DoGetItemClientObject(int N
) const
458 return (wxClientData
*) DoGetItemClientData( N
) ;
461 void wxListBox::DoSetItemClientData(int N
, void *Client_data
)
463 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
464 wxT("invalid index in wxListBox::SetClientData") );
466 #if wxUSE_OWNER_DRAWN
467 if ( m_windowStyle
& wxLB_OWNERDRAW
)
469 // client data must be pointer to wxOwnerDrawn, otherwise we would crash
470 // in OnMeasure/OnDraw.
471 wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
473 #endif // wxUSE_OWNER_DRAWN
474 wxASSERT_MSG( m_dataArray
.GetCount() >= (size_t) N
, wxT("invalid client_data array") ) ;
476 if ( m_dataArray
.GetCount() > (size_t) N
)
478 m_dataArray
[N
] = (char*) Client_data
;
482 m_dataArray
.Add( (char*) Client_data
) ;
486 void wxListBox::DoSetItemClientObject(int n
, wxClientData
* clientData
)
488 DoSetItemClientData(n
, clientData
);
491 // Return number of selections and an array of selected integers
492 int wxListBox::GetSelections(wxArrayInt
& aSelections
) const
494 return MacGetSelections( aSelections
) ;
497 // Get single selection, for single choice list items
498 int wxListBox::GetSelection() const
500 return MacGetSelection() ;
503 // Find string for position
504 wxString
wxListBox::GetString(int N
) const
506 return m_stringArray
[N
] ;
509 void wxListBox::DoInsertItems(const wxArrayString
& items
, int pos
)
511 wxCHECK_RET( pos
>= 0 && pos
<= m_noItems
,
512 wxT("invalid index in wxListBox::InsertItems") );
514 int nItems
= items
.GetCount();
516 for ( int i
= 0 ; i
< nItems
; i
++ )
518 m_stringArray
.Insert( items
[i
] , pos
+ i
) ;
519 m_dataArray
.Insert( NULL
, pos
+ i
) ;
520 MacInsert( pos
+ i
, items
[i
] ) ;
526 void wxListBox::SetString(int N
, const wxString
& s
)
528 m_stringArray
[N
] = s
;
532 wxSize
wxListBox::DoGetBestSize() const
534 int lbWidth
= 100; // some defaults
539 wxMacPortStateHelper
st( UMAGetWindowPort( (WindowRef
) MacGetTopLevelWindowRef() ) ) ;
543 ::TextFont( m_font
.MacGetFontNum() ) ;
544 ::TextSize( m_font
.MacGetFontSize() ) ;
545 ::TextFace( m_font
.MacGetFontStyle() ) ;
549 ::TextFont( kFontIDMonaco
) ;
554 // Find the widest line
555 for(int i
= 0; i
< GetCount(); i
++) {
556 wxString
str(GetString(i
));
560 ::GetThemeTextDimensions( wxMacCFStringHolder( str
, m_font
.GetEncoding() ) ,
561 kThemeCurrentPortFont
,
568 wLine
= ::TextWidth( str
.c_str() , 0 , str
.Length() ) ;
570 lbWidth
= wxMax(lbWidth
, wLine
);
573 // Add room for the scrollbar
574 lbWidth
+= wxSystemSettings::GetMetric(wxSYS_VSCROLL_X
);
576 // And just a bit more
578 int cx
= ::TextWidth( "X" , 0 , 1 ) ;
581 // don't make the listbox too tall (limit height to around 10 items) but don't
582 // make it too small neither
583 lbHeight
= (cy
+4) * wxMin(wxMax(GetCount(), 3), 10);
586 return wxSize(lbWidth
, lbHeight
);
589 int wxListBox::GetCount() const
594 void wxListBox::Refresh(bool eraseBack
, const wxRect
*rect
)
596 wxControl::Refresh( eraseBack
, rect
) ;
597 // MacRedrawControl() ;
600 #if wxUSE_OWNER_DRAWN
602 class wxListBoxItem
: public wxOwnerDrawn
605 wxListBoxItem(const wxString
& str
= "");
608 wxListBoxItem::wxListBoxItem(const wxString
& str
) : wxOwnerDrawn(str
, FALSE
)
610 // no bitmaps/checkmarks
614 wxOwnerDrawn
*wxListBox::CreateItem(size_t n
)
616 return new wxListBoxItem();
619 #endif //USE_OWNER_DRAWN
621 // ============================================================================
622 // list box control implementation
623 // ============================================================================
625 void wxListBox::MacDelete( int N
)
627 UInt32 id
= m_idArray
[N
] ;
628 verify_noerr(::RemoveDataBrowserItems(*m_peer
, kDataBrowserNoItem
, 1 , (UInt32
*) &id
, kDataBrowserItemNoProperty
) ) ;
629 m_idArray
.RemoveAt( N
) ;
632 void wxListBox::MacInsert( int n
, const wxString
& text
)
634 verify_noerr(::AddDataBrowserItems( *m_peer
, kDataBrowserNoItem
, 1 , (UInt32
*) &m_nextId
, kDataBrowserItemNoProperty
) ) ;
635 m_idArray
.Insert( m_nextId
, n
) ;
639 void wxListBox::MacAppend( const wxString
& text
)
641 verify_noerr(::AddDataBrowserItems( *m_peer
, kDataBrowserNoItem
, 1 , (UInt32
*) &m_nextId
, kDataBrowserItemNoProperty
) ) ;
642 m_idArray
.Add( m_nextId
) ;
646 void wxListBox::MacClear()
648 verify_noerr(::RemoveDataBrowserItems(*m_peer
, kDataBrowserNoItem
, 0 , NULL
, kDataBrowserItemNoProperty
) ) ;
652 void wxListBox::MacSetSelection( int n
, bool select
)
654 UInt32 id
= m_idArray
[n
] ;
655 if ( !(GetWindowStyle() & (wxLB_MULTIPLE
|wxLB_EXTENDED
) ) )
657 int n
= MacGetSelection() ;
660 UInt32 idOld
= m_idArray
[n
] ;
661 SetDataBrowserSelectedItems(*m_peer
, 1 , & idOld
, kDataBrowserItemsRemove
) ;
664 if ( ::IsDataBrowserItemSelected( *m_peer
, id
) != select
)
666 verify_noerr(::SetDataBrowserSelectedItems(*m_peer
, 1 , & id
, kDataBrowserItemsToggle
) ) ;
671 bool wxListBox::MacIsSelected( int n
) const
673 return ::IsDataBrowserItemSelected( *m_peer
, m_idArray
[n
] ) ;
676 int wxListBox::MacGetSelection() const
678 for ( size_t i
= 0 ; i
< m_idArray
.GetCount() ; ++i
)
680 if ( ::IsDataBrowserItemSelected(*m_peer
, m_idArray
[i
] ) )
688 int wxListBox::MacGetSelections( wxArrayInt
& aSelections
) const
693 for ( size_t i
= 0 ; i
< m_idArray
.GetCount() ; ++i
)
695 if ( ::IsDataBrowserItemSelected(*m_peer
, m_idArray
[i
] ) )
697 aSelections
.Add( i
) ;
704 void wxListBox::MacSet( int n
, const wxString
& text
)
706 // as we don't store the strings we only have to issue a redraw
707 UInt32 id
= m_idArray
[n
] ;
708 verify_noerr( ::UpdateDataBrowserItems( *m_peer
, kDataBrowserNoItem
, 1 , &id
, kDataBrowserItemNoProperty
, kDataBrowserItemNoProperty
) ) ;
711 void wxListBox::MacScrollTo( int n
)
713 UInt32 id
= m_idArray
[n
] ;
714 verify_noerr( ::RevealDataBrowserItem(*m_peer
, id
, kTextColumnId
, kDataBrowserRevealWithoutSelecting
) ) ;
717 #if !TARGET_API_MAC_OSX
718 void wxListBox::OnSize( wxSizeEvent
&event
)
723 void wxListBox::MacSetRedraw( bool doDraw
)
725 // nothing to do in compositing mode
728 void wxListBox::MacDoClick()
730 wxArrayInt aSelections;
732 size_t count = GetSelections(aSelections);
734 if ( count == m_selectionPreImage.GetCount() )
736 bool hasChanged = false ;
737 for ( size_t i = 0 ; i < count ; ++i )
739 if ( aSelections[i] != m_selectionPreImage[i] )
751 m_selectionPreImage = aSelections;
753 wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
754 event.SetEventObject( this );
759 if ( HasClientObjectData() )
760 event.SetClientObject( GetClientObject(n) );
761 else if ( HasClientUntypedData() )
762 event.SetClientData( GetClientData(n) );
763 event.SetString( GetString(n) );
770 event.m_commandInt = n;
772 GetEventHandler()->ProcessEvent(event);
776 void wxListBox::MacDoDoubleClick()
779 wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, m_windowId);
780 event.SetEventObject( this );
781 GetEventHandler()->ProcessEvent(event) ;
785 #if !TARGET_API_MAC_OSX
787 void wxListBox::OnChar(wxKeyEvent
& event
)
789 // todo trigger proper events here
793 if ( event
.GetKeyCode() == WXK_RETURN
|| event
.GetKeyCode() == WXK_NUMPAD_ENTER
)
795 wxWindow
* parent
= GetParent() ;
796 while( parent
&& !parent
->IsTopLevel() && parent
->GetDefaultItem() == NULL
)
797 parent
= parent
->GetParent() ;
799 if ( parent
&& parent
->GetDefaultItem() )
801 wxButton
*def
= wxDynamicCast(parent
->GetDefaultItem(),
803 if ( def
&& def
->IsEnabled() )
805 wxCommandEvent
event(wxEVT_COMMAND_BUTTON_CLICKED
, def
->GetId() );
806 event
.SetEventObject(def
);
813 /* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
814 else if (event
.GetKeyCode() == WXK_ESCAPE
|| (event
.GetKeyCode() == '.' && event
.MetaDown() ) )
816 // FIXME: look in ancestors, not just parent.
817 wxWindow
* win
= GetParent()->FindWindow( wxID_CANCEL
) ;
820 wxCommandEvent
new_event(wxEVT_COMMAND_BUTTON_CLICKED
,wxID_CANCEL
);
821 new_event
.SetEventObject( win
);
822 win
->GetEventHandler()->ProcessEvent( new_event
);
825 else if ( event
.GetKeyCode() == WXK_TAB
)
827 wxNavigationKeyEvent new_event
;
828 new_event
.SetEventObject( this );
829 new_event
.SetDirection( !event
.ShiftDown() );
830 /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
831 new_event
.SetWindowChange( event
.ControlDown() );
832 new_event
.SetCurrentFocus( this );
833 if ( !GetEventHandler()->ProcessEvent( new_event
) )
836 else if ( event
.GetKeyCode() == WXK_DOWN
|| event
.GetKeyCode() == WXK_UP
)
838 // perform the default key handling first
839 wxControl::OnKeyDown( event
) ;
841 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_SELECTED
, m_windowId
);
842 event
.SetEventObject( this );
844 wxArrayInt aSelections
;
845 int n
, count
= GetSelections(aSelections
);
849 if ( HasClientObjectData() )
850 event
.SetClientObject( GetClientObject(n
) );
851 else if ( HasClientUntypedData() )
852 event
.SetClientData( GetClientData(n
) );
853 event
.SetString( GetString(n
) );
860 event
.m_commandInt
= n
;
862 GetEventHandler()->ProcessEvent(event
);
866 if ( event
.GetTimestamp() > m_lastTypeIn
+ 60 )
868 m_typeIn
= wxEmptyString
;
870 m_lastTypeIn
= event
.GetTimestamp() ;
871 m_typeIn
+= (char) event
.GetKeyCode() ;
872 int line
= FindString(wxT("*")+m_typeIn
+wxT("*")) ;
875 if ( GetSelection() != line
)
878 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_SELECTED
, m_windowId
);
879 event
.SetEventObject( this );
881 if ( HasClientObjectData() )
882 event
.SetClientObject( GetClientObject( line
) );
883 else if ( HasClientUntypedData() )
884 event
.SetClientData( GetClientData(line
) );
885 event
.SetString( GetString(line
) );
887 event
.m_commandInt
= line
;
889 GetEventHandler()->ProcessEvent(event
);