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
) ;
180 verify_noerr( ::CreateDataBrowserControl( MAC_WXHWND(parent
->MacGetTopLevelWindowRef()), &bounds
, kDataBrowserListView
, (ControlRef
*)&m_macControl
) );
181 browser
= (ControlRef
) m_macControl
;
183 DataBrowserSelectionFlags options
= kDataBrowserDragSelect
;
184 if ( style
& wxLB_MULTIPLE
)
186 options
+= kDataBrowserAlwaysExtendSelection
+ kDataBrowserCmdTogglesSelection
;
188 else if ( style
& wxLB_EXTENDED
)
194 options
+= kDataBrowserSelectOnlyOne
;
196 verify_noerr(SetDataBrowserSelectionFlags (browser
, options
) );
198 DataBrowserListViewColumnDesc columnDesc
;
199 columnDesc
.headerBtnDesc
.titleOffset
= 0;
200 columnDesc
.headerBtnDesc
.version
= kDataBrowserListViewLatestHeaderDesc
;
202 columnDesc
.headerBtnDesc
.btnFontStyle
.flags
=
203 kControlUseFontMask
| kControlUseJustMask
;
205 columnDesc
.headerBtnDesc
.btnContentInfo
.contentType
= kControlNoContent
;
206 columnDesc
.propertyDesc
.propertyType
= kDataBrowserTextType
;
207 columnDesc
.headerBtnDesc
.btnFontStyle
.just
= teFlushDefault
;
208 columnDesc
.headerBtnDesc
.minimumWidth
= 0;
209 columnDesc
.headerBtnDesc
.maximumWidth
= 10000;
211 columnDesc
.headerBtnDesc
.btnFontStyle
.font
= kControlFontViewSystemFont
;
212 columnDesc
.headerBtnDesc
.btnFontStyle
.style
= normal
;
213 columnDesc
.headerBtnDesc
.titleString
= NULL
; // CFSTR( "" );
215 columnDesc
.propertyDesc
.propertyID
= kTextColumnId
;
216 columnDesc
.propertyDesc
.propertyType
= kDataBrowserTextType
;
217 columnDesc
.propertyDesc
.propertyFlags
=
218 #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
219 kDataBrowserListViewTypeSelectColumn
|
221 kDataBrowserTableViewSelectionColumn
;
224 verify_noerr(::AddDataBrowserListViewColumn(browser
, &columnDesc
, kDataBrowserListViewAppendColumn
) ) ;
225 verify_noerr(::AutoSizeDataBrowserListViewColumns( browser
) ) ;
226 verify_noerr(::SetDataBrowserHasScrollBars( browser
, false , true ) ) ;
227 verify_noerr(::SetDataBrowserTableViewHiliteStyle( browser
, kDataBrowserTableViewFillHilite
) ) ;
228 verify_noerr(::SetDataBrowserListViewHeaderBtnHeight( browser
, 0 ) ) ;
229 DataBrowserCallbacks callbacks
;
231 callbacks
.version
= kDataBrowserLatestCallbacks
;
233 InitDataBrowserCallbacks(&callbacks
);
235 callbacks
.u
.v1
.itemDataCallback
=
236 NewDataBrowserItemDataUPP(ListBoxGetSetItemData
);
238 callbacks
.u
.v1
.itemNotificationCallback
=
239 #if TARGET_API_MAC_OSX
240 (DataBrowserItemNotificationUPP
) NewDataBrowserItemNotificationWithItemUPP(DataBrowserItemNotificationProc
) ;
242 NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc
) ;
244 SetDataBrowserCallbacks(browser
, &callbacks
);
246 MacPostControlCreate(pos
,size
) ;
248 for ( int i
= 0 ; i
< n
; i
++ )
250 Append( choices
[i
] ) ;
253 SetBestSize(size
); // Needed because it is a wxControlWithItems
258 wxListBox::~wxListBox()
260 SetControlReference( (ControlRef
) m_macControl
, NULL
) ;
262 // avoid access during destruction
269 void wxListBox::FreeData()
271 #if wxUSE_OWNER_DRAWN
272 if ( m_windowStyle
& wxLB_OWNERDRAW
)
274 size_t uiCount
= m_aItems
.Count();
275 while ( uiCount
-- != 0 ) {
276 delete m_aItems
[uiCount
];
277 m_aItems
[uiCount
] = NULL
;
283 #endif // wxUSE_OWNER_DRAWN
284 if ( HasClientObjectData() )
286 for ( size_t n
= 0; n
< (size_t)m_noItems
; n
++ )
288 delete GetClientObject(n
);
293 void wxListBox::DoSetSize(int x
, int y
,
294 int width
, int height
,
297 wxControl::DoSetSize( x
, y
, width
, height
, sizeFlags
) ;
300 void wxListBox::DoSetFirstItem(int N
)
305 void wxListBox::Delete(int N
)
307 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
308 wxT("invalid index in wxListBox::Delete") );
310 #if wxUSE_OWNER_DRAWN
312 m_aItems
.RemoveAt(N
);
313 #else // !wxUSE_OWNER_DRAWN
314 if ( HasClientObjectData() )
316 delete GetClientObject(N
);
318 #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
319 m_stringArray
.RemoveAt( N
) ;
320 m_dataArray
.RemoveAt( N
) ;
326 int wxListBox::DoAppend(const wxString
& item
)
328 int index
= m_noItems
;
329 m_stringArray
.Add( item
) ;
330 m_dataArray
.Add( NULL
);
332 DoSetItemClientData( index
, NULL
) ;
338 void wxListBox::DoSetItems(const wxArrayString
& choices
, void** clientData
)
341 int n
= choices
.GetCount();
343 for( int i
= 0 ; i
< n
; ++i
)
347 #if wxUSE_OWNER_DRAWN
348 wxASSERT_MSG(clientData
[i
] == NULL
,
349 wxT("Can't use client data with owner-drawn listboxes"));
350 #else // !wxUSE_OWNER_DRAWN
351 Append( choices
[i
] , clientData
[i
] ) ;
355 Append( choices
[i
] ) ;
358 #if wxUSE_OWNER_DRAWN
359 if ( m_windowStyle
& wxLB_OWNERDRAW
) {
360 // first delete old items
361 size_t ui
= m_aItems
.Count();
362 while ( ui
-- != 0 ) {
368 // then create new ones
369 for ( ui
= 0; ui
< (size_t)m_noItems
; ui
++ ) {
370 wxOwnerDrawn
*pNewItem
= CreateItem(ui
);
371 pNewItem
->SetName(choices
[ui
]);
372 m_aItems
.Add(pNewItem
);
375 #endif // wxUSE_OWNER_DRAWN
378 int wxListBox::FindString(const wxString
& s
) const
381 if ( s
.Right(1) == wxT("*") )
383 wxString search
= s
.Left( s
.Length() - 1 ) ;
384 int len
= search
.Length() ;
386 wxMacStringToPascal( search
, s2
) ;
388 for ( int i
= 0 ; i
< m_noItems
; ++ i
)
390 wxMacStringToPascal( m_stringArray
[i
].Left( len
) , s1
) ;
392 if ( EqualString( s1
, s2
, false , false ) )
395 if ( s
.Left(1) == wxT("*") && s
.Length() > 1 )
399 for ( int i
= 0 ; i
< m_noItems
; ++i
)
401 if ( GetString(i
).Lower().Matches(st
) )
411 wxMacStringToPascal( s
, s2
) ;
413 for ( int i
= 0 ; i
< m_noItems
; ++ i
)
415 wxMacStringToPascal( m_stringArray
[i
] , s1
) ;
417 if ( EqualString( s1
, s2
, false , false ) )
424 void wxListBox::Clear()
428 m_stringArray
.Empty() ;
429 m_dataArray
.Empty() ;
433 void wxListBox::SetSelection(int N
, bool select
)
435 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
436 wxT("invalid index in wxListBox::SetSelection") );
437 MacSetSelection( N
, select
) ;
438 GetSelections( m_selectionPreImage
) ;
441 bool wxListBox::IsSelected(int N
) const
443 wxCHECK_MSG( N
>= 0 && N
< m_noItems
, FALSE
,
444 wxT("invalid index in wxListBox::Selected") );
446 return MacIsSelected( N
) ;
449 void *wxListBox::DoGetItemClientData(int N
) const
451 wxCHECK_MSG( N
>= 0 && N
< m_noItems
, NULL
,
452 wxT("invalid index in wxListBox::GetClientData"));
454 return (void *)m_dataArray
[N
];
457 wxClientData
*wxListBox::DoGetItemClientObject(int N
) const
459 return (wxClientData
*) DoGetItemClientData( N
) ;
462 void wxListBox::DoSetItemClientData(int N
, void *Client_data
)
464 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
465 wxT("invalid index in wxListBox::SetClientData") );
467 #if wxUSE_OWNER_DRAWN
468 if ( m_windowStyle
& wxLB_OWNERDRAW
)
470 // client data must be pointer to wxOwnerDrawn, otherwise we would crash
471 // in OnMeasure/OnDraw.
472 wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
474 #endif // wxUSE_OWNER_DRAWN
475 wxASSERT_MSG( m_dataArray
.GetCount() >= (size_t) N
, wxT("invalid client_data array") ) ;
477 if ( m_dataArray
.GetCount() > (size_t) N
)
479 m_dataArray
[N
] = (char*) Client_data
;
483 m_dataArray
.Add( (char*) Client_data
) ;
487 void wxListBox::DoSetItemClientObject(int n
, wxClientData
* clientData
)
489 DoSetItemClientData(n
, clientData
);
492 // Return number of selections and an array of selected integers
493 int wxListBox::GetSelections(wxArrayInt
& aSelections
) const
495 return MacGetSelections( aSelections
) ;
498 // Get single selection, for single choice list items
499 int wxListBox::GetSelection() const
501 return MacGetSelection() ;
504 // Find string for position
505 wxString
wxListBox::GetString(int N
) const
507 return m_stringArray
[N
] ;
510 void wxListBox::DoInsertItems(const wxArrayString
& items
, int pos
)
512 wxCHECK_RET( pos
>= 0 && pos
<= m_noItems
,
513 wxT("invalid index in wxListBox::InsertItems") );
515 int nItems
= items
.GetCount();
517 for ( int i
= 0 ; i
< nItems
; i
++ )
519 m_stringArray
.Insert( items
[i
] , pos
+ i
) ;
520 m_dataArray
.Insert( NULL
, pos
+ i
) ;
521 MacInsert( pos
+ i
, items
[i
] ) ;
527 void wxListBox::SetString(int N
, const wxString
& s
)
529 m_stringArray
[N
] = s
;
533 wxSize
wxListBox::DoGetBestSize() const
535 int lbWidth
= 100; // some defaults
540 wxMacPortStateHelper
st( UMAGetWindowPort( (WindowRef
) MacGetTopLevelWindowRef() ) ) ;
544 ::TextFont( m_font
.MacGetFontNum() ) ;
545 ::TextSize( m_font
.MacGetFontSize() ) ;
546 ::TextFace( m_font
.MacGetFontStyle() ) ;
550 ::TextFont( kFontIDMonaco
) ;
555 // Find the widest line
556 for(int i
= 0; i
< GetCount(); i
++) {
557 wxString
str(GetString(i
));
561 ::GetThemeTextDimensions( wxMacCFStringHolder( str
, m_font
.GetEncoding() ) ,
562 kThemeCurrentPortFont
,
569 wLine
= ::TextWidth( str
.c_str() , 0 , str
.Length() ) ;
571 lbWidth
= wxMax(lbWidth
, wLine
);
574 // Add room for the scrollbar
575 lbWidth
+= wxSystemSettings::GetMetric(wxSYS_VSCROLL_X
);
577 // And just a bit more
579 int cx
= ::TextWidth( "X" , 0 , 1 ) ;
582 // don't make the listbox too tall (limit height to around 10 items) but don't
583 // make it too small neither
584 lbHeight
= (cy
+4) * wxMin(wxMax(GetCount(), 3), 10);
587 return wxSize(lbWidth
, lbHeight
);
590 int wxListBox::GetCount() const
595 void wxListBox::Refresh(bool eraseBack
, const wxRect
*rect
)
597 wxControl::Refresh( eraseBack
, rect
) ;
598 // MacRedrawControl() ;
601 #if wxUSE_OWNER_DRAWN
603 class wxListBoxItem
: public wxOwnerDrawn
606 wxListBoxItem(const wxString
& str
= "");
609 wxListBoxItem::wxListBoxItem(const wxString
& str
) : wxOwnerDrawn(str
, FALSE
)
611 // no bitmaps/checkmarks
615 wxOwnerDrawn
*wxListBox::CreateItem(size_t n
)
617 return new wxListBoxItem();
620 #endif //USE_OWNER_DRAWN
622 // ============================================================================
623 // list box control implementation
624 // ============================================================================
626 void wxListBox::MacDelete( int N
)
628 UInt32 id
= m_idArray
[N
] ;
629 verify_noerr(::RemoveDataBrowserItems((ControlRef
) m_macControl
, kDataBrowserNoItem
, 1 , (UInt32
*) &id
, kDataBrowserItemNoProperty
) ) ;
630 m_idArray
.RemoveAt( N
) ;
633 void wxListBox::MacInsert( int n
, const wxString
& text
)
635 verify_noerr(::AddDataBrowserItems( (ControlRef
) m_macControl
, kDataBrowserNoItem
, 1 , (UInt32
*) &m_nextId
, kDataBrowserItemNoProperty
) ) ;
636 m_idArray
.Insert( m_nextId
, n
) ;
640 void wxListBox::MacAppend( const wxString
& text
)
642 verify_noerr(::AddDataBrowserItems( (ControlRef
) m_macControl
, kDataBrowserNoItem
, 1 , (UInt32
*) &m_nextId
, kDataBrowserItemNoProperty
) ) ;
643 m_idArray
.Add( m_nextId
) ;
647 void wxListBox::MacClear()
649 verify_noerr(::RemoveDataBrowserItems((ControlRef
) m_macControl
, kDataBrowserNoItem
, 0 , NULL
, kDataBrowserItemNoProperty
) ) ;
653 void wxListBox::MacSetSelection( int n
, bool select
)
655 UInt32 id
= m_idArray
[n
] ;
656 if ( !(GetWindowStyle() & (wxLB_MULTIPLE
|wxLB_EXTENDED
) ) )
658 int n
= MacGetSelection() ;
661 UInt32 idOld
= m_idArray
[n
] ;
662 SetDataBrowserSelectedItems((ControlRef
) m_macControl
, 1 , & idOld
, kDataBrowserItemsRemove
) ;
665 if ( ::IsDataBrowserItemSelected( (ControlRef
) m_macControl
, id
) != select
)
667 verify_noerr(::SetDataBrowserSelectedItems((ControlRef
) m_macControl
, 1 , & id
, kDataBrowserItemsToggle
) ) ;
672 bool wxListBox::MacIsSelected( int n
) const
674 return ::IsDataBrowserItemSelected( (ControlRef
) m_macControl
, m_idArray
[n
] ) ;
677 int wxListBox::MacGetSelection() const
679 for ( size_t i
= 0 ; i
< m_idArray
.GetCount() ; ++i
)
681 if ( ::IsDataBrowserItemSelected((ControlRef
) m_macControl
, m_idArray
[i
] ) )
689 int wxListBox::MacGetSelections( wxArrayInt
& aSelections
) const
694 for ( size_t i
= 0 ; i
< m_idArray
.GetCount() ; ++i
)
696 if ( ::IsDataBrowserItemSelected((ControlRef
) m_macControl
, m_idArray
[i
] ) )
698 aSelections
.Add( i
) ;
705 void wxListBox::MacSet( int n
, const wxString
& text
)
707 // as we don't store the strings we only have to issue a redraw
708 UInt32 id
= m_idArray
[n
] ;
709 verify_noerr( ::UpdateDataBrowserItems( (ControlRef
) m_macControl
, kDataBrowserNoItem
, 1 , &id
, kDataBrowserItemNoProperty
, kDataBrowserItemNoProperty
) ) ;
712 void wxListBox::MacScrollTo( int n
)
714 UInt32 id
= m_idArray
[n
] ;
715 verify_noerr( ::RevealDataBrowserItem((ControlRef
) m_macControl
, id
, kTextColumnId
, kDataBrowserRevealWithoutSelecting
) ) ;
718 #if !TARGET_API_MAC_OSX
719 void wxListBox::OnSize( wxSizeEvent
&event
)
724 void wxListBox::MacSetRedraw( bool doDraw
)
726 // nothing to do in compositing mode
729 void wxListBox::MacDoClick()
731 wxArrayInt aSelections;
733 size_t count = GetSelections(aSelections);
735 if ( count == m_selectionPreImage.GetCount() )
737 bool hasChanged = false ;
738 for ( size_t i = 0 ; i < count ; ++i )
740 if ( aSelections[i] != m_selectionPreImage[i] )
752 m_selectionPreImage = aSelections;
754 wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
755 event.SetEventObject( this );
760 if ( HasClientObjectData() )
761 event.SetClientObject( GetClientObject(n) );
762 else if ( HasClientUntypedData() )
763 event.SetClientData( GetClientData(n) );
764 event.SetString( GetString(n) );
771 event.m_commandInt = n;
773 GetEventHandler()->ProcessEvent(event);
777 void wxListBox::MacDoDoubleClick()
780 wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, m_windowId);
781 event.SetEventObject( this );
782 GetEventHandler()->ProcessEvent(event) ;
786 #if !TARGET_API_MAC_OSX
788 void wxListBox::OnChar(wxKeyEvent
& event
)
790 // todo trigger proper events here
794 if ( event
.GetKeyCode() == WXK_RETURN
|| event
.GetKeyCode() == WXK_NUMPAD_ENTER
)
796 wxWindow
* parent
= GetParent() ;
797 while( parent
&& !parent
->IsTopLevel() && parent
->GetDefaultItem() == NULL
)
798 parent
= parent
->GetParent() ;
800 if ( parent
&& parent
->GetDefaultItem() )
802 wxButton
*def
= wxDynamicCast(parent
->GetDefaultItem(),
804 if ( def
&& def
->IsEnabled() )
806 wxCommandEvent
event(wxEVT_COMMAND_BUTTON_CLICKED
, def
->GetId() );
807 event
.SetEventObject(def
);
814 /* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
815 else if (event
.GetKeyCode() == WXK_ESCAPE
|| (event
.GetKeyCode() == '.' && event
.MetaDown() ) )
817 // FIXME: look in ancestors, not just parent.
818 wxWindow
* win
= GetParent()->FindWindow( wxID_CANCEL
) ;
821 wxCommandEvent
new_event(wxEVT_COMMAND_BUTTON_CLICKED
,wxID_CANCEL
);
822 new_event
.SetEventObject( win
);
823 win
->GetEventHandler()->ProcessEvent( new_event
);
826 else if ( event
.GetKeyCode() == WXK_TAB
)
828 wxNavigationKeyEvent new_event
;
829 new_event
.SetEventObject( this );
830 new_event
.SetDirection( !event
.ShiftDown() );
831 /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
832 new_event
.SetWindowChange( event
.ControlDown() );
833 new_event
.SetCurrentFocus( this );
834 if ( !GetEventHandler()->ProcessEvent( new_event
) )
837 else if ( event
.GetKeyCode() == WXK_DOWN
|| event
.GetKeyCode() == WXK_UP
)
839 // perform the default key handling first
840 wxControl::OnKeyDown( event
) ;
842 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_SELECTED
, m_windowId
);
843 event
.SetEventObject( this );
845 wxArrayInt aSelections
;
846 int n
, count
= GetSelections(aSelections
);
850 if ( HasClientObjectData() )
851 event
.SetClientObject( GetClientObject(n
) );
852 else if ( HasClientUntypedData() )
853 event
.SetClientData( GetClientData(n
) );
854 event
.SetString( GetString(n
) );
861 event
.m_commandInt
= n
;
863 GetEventHandler()->ProcessEvent(event
);
867 if ( event
.GetTimestamp() > m_lastTypeIn
+ 60 )
869 m_typeIn
= wxEmptyString
;
871 m_lastTypeIn
= event
.GetTimestamp() ;
872 m_typeIn
+= (char) event
.GetKeyCode() ;
873 int line
= FindString(wxT("*")+m_typeIn
+wxT("*")) ;
876 if ( GetSelection() != line
)
879 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_SELECTED
, m_windowId
);
880 event
.SetEventObject( this );
882 if ( HasClientObjectData() )
883 event
.SetClientObject( GetClientObject( line
) );
884 else if ( HasClientUntypedData() )
885 event
.SetClientData( GetClientData(line
) );
886 event
.SetString( GetString(line
) );
888 event
.m_commandInt
= line
;
890 GetEventHandler()->ProcessEvent(event
);