1 ///////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) AUTHOR
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 EVT_SIZE( wxListBox::OnSize
)
31 EVT_CHAR( wxListBox::OnChar
)
35 #include "wx/mac/uma.h"
37 #if PRAGMA_STRUCT_ALIGN
38 #pragma options align=mac68k
39 #elif PRAGMA_STRUCT_PACKPUSH
41 #elif PRAGMA_STRUCT_PACK
46 unsigned short instruction
;
48 } ldefRec
, *ldefPtr
, **ldefHandle
;
50 #if PRAGMA_STRUCT_ALIGN
51 #pragma options align=reset
52 #elif PRAGMA_STRUCT_PACKPUSH
54 #elif PRAGMA_STRUCT_PACK
59 const short kwxMacListItemHeight
= 19 ;
61 const short kwxMacListItemHeight
= 14 ;
66 static pascal void wxMacListDefinition( short message
, Boolean isSelected
, Rect
*drawRect
,
67 Cell cell
, short dataOffset
, short dataLength
,
68 ListHandle listHandle
) ;
71 static pascal void wxMacListDefinition( short message
, Boolean isSelected
, Rect
*drawRect
,
72 Cell cell
, short dataOffset
, short dataLength
,
73 ListHandle listHandle
)
77 RgnHandle savedClipRegion
;
81 SetPort((**listHandle
).port
);
82 grafPtr
= (**listHandle
).port
;
83 // typecast our refCon
84 list
= (wxListBox
*) GetControlReference( (ControlHandle
) GetListRefCon(listHandle
) );
86 // Calculate the cell rect.
97 const wxString text
= list
->m_stringArray
[cell
.v
] ;
99 // Save the current clip region, and set the clip region to the area we are about
102 savedClipRegion
= NewRgn();
103 GetClip( savedClipRegion
);
105 ClipRect( drawRect
);
106 EraseRect( drawRect
);
109 bool useDrawThemeText
= ( DrawThemeTextBox
!= (void*) kUnresolvedCFragSymbolAddress
) ;
111 if ( useDrawThemeText
)
113 Rect frame
= { drawRect
->top
, drawRect
->left
+ 4,
114 drawRect
->top
+ kwxMacListItemHeight
, drawRect
->right
} ;
115 CFStringRef mString
= CFStringCreateWithBytes( NULL
, (UInt8
*) text
.c_str(), text
.Length(), CFStringGetSystemEncoding(), false ) ;
116 ::DrawThemeTextBox( mString
,
123 CFRelease( mString
) ;
128 MoveTo(drawRect
->left
+ 4 , drawRect
->top
+ 10 );
129 ::TextFont( kFontIDMonaco
) ;
132 DrawText(text
, 0 , text
.Length());
135 // If the cell is hilited, do the hilite now. Paint the cell contents with the
136 // appropriate QuickDraw transform mode.
139 savedPenMode
= GetPortPenMode( (CGrafPtr
) grafPtr
);
140 SetPortPenMode( (CGrafPtr
)grafPtr
, hilitetransfermode
);
141 PaintRect( drawRect
);
142 SetPortPenMode( (CGrafPtr
)grafPtr
, savedPenMode
);
145 // Restore the saved clip region.
147 SetClip( savedClipRegion
);
148 DisposeRgn( savedClipRegion
);
153 // Hilite or unhilite the cell. Paint the cell contents with the
154 // appropriate QuickDraw transform mode.
157 savedPenMode
= GetPortPenMode( (CGrafPtr
)grafPtr
);
158 SetPortPenMode( (CGrafPtr
)grafPtr
, hilitetransfermode
);
159 PaintRect( drawRect
);
160 SetPortPenMode( (CGrafPtr
)grafPtr
, savedPenMode
);
168 extern "C" void MacDrawStringCell(Rect
*cellRect
, Cell lCell
, ListHandle theList
, long refCon
) ;
169 const short kwxMacListWithVerticalScrollbar
= 128 ;
171 // ============================================================================
172 // list box control implementation
173 // ============================================================================
176 wxListBox::wxListBox()
183 static ListDefUPP macListDefUPP
= NULL
;
185 bool wxListBox::Create(wxWindow
*parent
, wxWindowID id
,
188 int n
, const wxString choices
[],
190 const wxValidator
& validator
,
191 const wxString
& name
)
193 m_noItems
= 0 ; // this will be increased by our append command
199 MacPreControlCreate( parent
, id
, "" , pos
, size
,style
, validator
, name
, &bounds
, title
) ;
202 listDef
.defType
= kListDefUserProcType
;
203 if ( macListDefUPP
== NULL
)
205 macListDefUPP
= NewListDefUPP( wxMacListDefinition
);
207 listDef
.u
.userProc
= macListDefUPP
;
213 CreateListBoxControl( MAC_WXHWND(parent
->MacGetRootWindow()), &bounds
, false, 0, 1, false, true,
214 kwxMacListItemHeight
, kwxMacListItemHeight
, false, &listDef
, (ControlRef
*)&m_macControl
);
216 GetControlData( (ControlHandle
) m_macControl
, kControlNoPart
, kControlListBoxListHandleTag
,
217 sizeof(ListHandle
), (Ptr
) &m_macList
, &asize
);
219 SetControlReference( (ControlHandle
) m_macControl
, (long) this);
220 SetControlVisibility( (ControlHandle
) m_macControl
, false, false);
225 wxStAppResource resload
;
226 m_macControl
= ::NewControl( MAC_WXHWND(parent
->MacGetRootWindow()) , &bounds
, title
, false ,
227 kwxMacListWithVerticalScrollbar
, 0 , 0,
228 kControlListBoxProc
, (long) this ) ;
229 ::GetControlData( (ControlHandle
) m_macControl
, kControlNoPart
, kControlListBoxListHandleTag
,
230 sizeof( ListHandle
) , (char*) &m_macList
, &result
) ;
232 HLock( (Handle
) m_macList
) ;
234 ldef
= (ldefHandle
) NewHandle( sizeof(ldefRec
) ) ;
235 if ( (**(ListHandle
)m_macList
).listDefProc
!= NULL
)
237 (**ldef
).instruction
= 0x4EF9; /* JMP instruction */
238 (**ldef
).function
= (void(*)()) listDef
.u
.userProc
;
239 (**(ListHandle
)m_macList
).listDefProc
= (Handle
) ldef
;
242 Point pt
= (**(ListHandle
)m_macList
).cellSize
;
243 pt
.v
= kwxMacListItemHeight
;
244 LCellSize( pt
, (ListHandle
)m_macList
) ;
245 LAddColumn( 1 , 0 , (ListHandle
)m_macList
) ;
247 OptionBits options
= 0;
248 if ( style
& wxLB_MULTIPLE
)
250 options
+= lNoExtend
;
252 else if ( style
& wxLB_EXTENDED
)
254 options
+= lExtendDrag
;
260 SetListSelectionFlags((ListHandle
)m_macList
, options
);
262 MacPostControlCreate() ;
264 for ( int i
= 0 ; i
< n
; i
++ )
266 Append( choices
[i
] ) ;
269 LSetDrawingMode( true , (ListHandle
)m_macList
) ;
274 wxListBox::~wxListBox()
280 DisposeHandle( (**(ListHandle
)m_macList
).listDefProc
) ;
281 (**(ListHandle
)m_macList
).listDefProc
= NULL
;
287 void wxListBox::FreeData()
289 #if wxUSE_OWNER_DRAWN
290 if ( m_windowStyle
& wxLB_OWNERDRAW
)
292 size_t uiCount
= m_aItems
.Count();
293 while ( uiCount
-- != 0 ) {
294 delete m_aItems
[uiCount
];
295 m_aItems
[uiCount
] = NULL
;
301 #endif // wxUSE_OWNER_DRAWN
302 if ( HasClientObjectData() )
304 for ( size_t n
= 0; n
< (size_t)m_noItems
; n
++ )
306 delete GetClientObject(n
);
311 void wxListBox::DoSetSize(int x
, int y
,
312 int width
, int height
,
315 wxControl::DoSetSize( x
, y
, width
, height
, sizeFlags
) ;
318 GetControlBounds( (ControlHandle
) m_macControl
, &bounds
) ;
319 ControlRef control
= GetListVerticalScrollBar( (ListHandle
)m_macList
) ;
323 GetControlBounds( control
, &scrollbounds
) ;
324 if( scrollbounds
.right
!= bounds
.right
+ 1 )
326 UMAMoveControl( control
, bounds
.right
- (scrollbounds
.right
- scrollbounds
.left
) + 1 ,
332 void wxListBox::DoSetFirstItem(int N
)
337 void wxListBox::Delete(int N
)
339 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
340 wxT("invalid index in wxListBox::Delete") );
342 #if wxUSE_OWNER_DRAWN
344 m_aItems
.RemoveAt(N
);
345 #else // !wxUSE_OWNER_DRAWN
346 if ( HasClientObjectData() )
348 delete GetClientObject(N
);
350 #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
351 m_stringArray
.RemoveAt( N
) ;
352 m_dataArray
.RemoveAt( N
) ;
358 int wxListBox::DoAppend(const wxString
& item
)
360 int index
= m_noItems
;
361 if( wxApp::s_macDefaultEncodingIsPC
)
363 m_stringArray
.Add( wxMacMakeMacStringFromPC( item
) ) ;
364 m_dataArray
.Add( NULL
);
367 m_stringArray
.Add( item
) ;
368 m_dataArray
.Add( NULL
);
371 DoSetItemClientData( index
, NULL
) ;
377 void wxListBox::DoSetItems(const wxArrayString
& choices
, void** clientData
)
379 MacSetRedraw( false ) ;
381 int n
= choices
.GetCount();
383 for( int i
= 0 ; i
< n
; ++i
)
387 #if wxUSE_OWNER_DRAWN
388 wxASSERT_MSG(clientData
[i
] == NULL
,
389 wxT("Can't use client data with owner-drawn listboxes"));
390 #else // !wxUSE_OWNER_DRAWN
391 Append( choices
[i
] , clientData
[i
] ) ;
395 Append( choices
[i
] ) ;
398 #if wxUSE_OWNER_DRAWN
399 if ( m_windowStyle
& wxLB_OWNERDRAW
) {
400 // first delete old items
401 size_t ui
= m_aItems
.Count();
402 while ( ui
-- != 0 ) {
408 // then create new ones
409 for ( ui
= 0; ui
< (size_t)m_noItems
; ui
++ ) {
410 wxOwnerDrawn
*pNewItem
= CreateItem(ui
);
411 pNewItem
->SetName(choices
[ui
]);
412 m_aItems
.Add(pNewItem
);
415 #endif // wxUSE_OWNER_DRAWN
416 MacSetRedraw( true ) ;
419 bool wxListBox::HasMultipleSelection() const
421 return (m_windowStyle
& wxLB_MULTIPLE
) || (m_windowStyle
& wxLB_EXTENDED
);
424 int wxListBox::FindString(const wxString
& st
) const
427 if( wxApp::s_macDefaultEncodingIsPC
)
429 s
= wxMacMakeMacStringFromPC( st
) ;
434 if ( s
.Right(1) == "*" )
436 wxString search
= s
.Left( s
.Length() - 1 ) ;
437 int len
= search
.Length() ;
441 c2pstrcpy( (StringPtr
) s2
, search
.c_str() ) ;
443 strcpy( (char *) s2
, search
.c_str() ) ;
444 c2pstr( (char *) s2
) ;
447 for ( int i
= 0 ; i
< m_noItems
; ++ i
)
450 c2pstrcpy( (StringPtr
) s1
, m_stringArray
[i
].Left( len
).c_str() ) ;
452 strcpy( (char *) s1
, m_stringArray
[i
].Left( len
).c_str() ) ;
453 c2pstr( (char *) s1
) ;
455 if ( EqualString( s1
, s2
, false , false ) )
458 if ( s
.Left(1) == "*" && s
.Length() > 1 )
462 for ( int i
= 0 ; i
< m_noItems
; ++i
)
464 if ( GetString(i
).Lower().Matches(s
) )
475 c2pstrcpy( (StringPtr
) s2
, s
.c_str() ) ;
477 strcpy( (char *) s2
, s
.c_str() ) ;
478 c2pstr( (char *) s2
) ;
481 for ( int i
= 0 ; i
< m_noItems
; ++ i
)
484 c2pstrcpy( (StringPtr
) s1
, m_stringArray
[i
].c_str() ) ;
486 strcpy( (char *) s1
, m_stringArray
[i
].c_str() ) ;
487 c2pstr( (char *) s1
) ;
489 if ( EqualString( s1
, s2
, false , false ) )
496 void wxListBox::Clear()
500 m_stringArray
.Empty() ;
501 m_dataArray
.Empty() ;
505 void wxListBox::SetSelection(int N
, bool select
)
507 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
508 "invalid index in wxListBox::SetSelection" );
509 MacSetSelection( N
, select
) ;
510 GetSelections( m_selectionPreImage
) ;
513 bool wxListBox::IsSelected(int N
) const
515 wxCHECK_MSG( N
>= 0 && N
< m_noItems
, FALSE
,
516 "invalid index in wxListBox::Selected" );
518 return MacIsSelected( N
) ;
521 void *wxListBox::DoGetItemClientData(int N
) const
523 wxCHECK_MSG( N
>= 0 && N
< m_noItems
, NULL
,
524 wxT("invalid index in wxListBox::GetClientData"));
526 return (void *)m_dataArray
[N
];
529 wxClientData
*wxListBox::DoGetItemClientObject(int N
) const
531 return (wxClientData
*) DoGetItemClientData( N
) ;
534 void wxListBox::DoSetItemClientData(int N
, void *Client_data
)
536 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
537 "invalid index in wxListBox::SetClientData" );
539 #if wxUSE_OWNER_DRAWN
540 if ( m_windowStyle
& wxLB_OWNERDRAW
)
542 // client data must be pointer to wxOwnerDrawn, otherwise we would crash
543 // in OnMeasure/OnDraw.
544 wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
546 #endif // wxUSE_OWNER_DRAWN
547 wxASSERT_MSG( m_dataArray
.GetCount() >= N
, "invalid client_data array" ) ;
549 if ( m_dataArray
.GetCount() > N
)
551 m_dataArray
[N
] = (char*) Client_data
;
555 m_dataArray
.Add( (char*) Client_data
) ;
559 void wxListBox::DoSetItemClientObject(int n
, wxClientData
* clientData
)
561 DoSetItemClientData(n
, clientData
);
564 // Return number of selections and an array of selected integers
565 int wxListBox::GetSelections(wxArrayInt
& aSelections
) const
567 return MacGetSelections( aSelections
) ;
570 // Get single selection, for single choice list items
571 int wxListBox::GetSelection() const
573 return MacGetSelection() ;
576 // Find string for position
577 wxString
wxListBox::GetString(int N
) const
579 if( wxApp::s_macDefaultEncodingIsPC
)
581 return wxMacMakePCStringFromMac( m_stringArray
[N
] ) ;
584 return m_stringArray
[N
] ;
587 void wxListBox::DoInsertItems(const wxArrayString
& items
, int pos
)
589 wxCHECK_RET( pos
>= 0 && pos
<= m_noItems
,
590 wxT("invalid index in wxListBox::InsertItems") );
592 int nItems
= items
.GetCount();
594 for ( int i
= 0 ; i
< nItems
; i
++ )
596 m_stringArray
.Insert( items
[i
] , pos
+ i
) ;
597 m_dataArray
.Insert( NULL
, pos
+ i
) ;
598 MacInsert( pos
+ i
, items
[i
] ) ;
604 void wxListBox::SetString(int N
, const wxString
& s
)
607 if( wxApp::s_macDefaultEncodingIsPC
)
609 str
= wxMacMakeMacStringFromPC( s
) ;
613 m_stringArray
[N
] = str
;
617 wxSize
wxListBox::DoGetBestSize() const
619 return wxSize(100, 100);
622 int wxListBox::GetCount() const
627 void wxListBox::SetupColours()
629 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW
));
630 SetForegroundColour(GetParent()->GetForegroundColour());
633 void wxListBox::Refresh(bool eraseBack
, const wxRect
*rect
)
635 wxControl::Refresh( eraseBack
, rect
) ;
636 // MacRedrawControl() ;
639 #if wxUSE_OWNER_DRAWN
641 class wxListBoxItem
: public wxOwnerDrawn
644 wxListBoxItem(const wxString
& str
= "");
647 wxListBoxItem::wxListBoxItem(const wxString
& str
) : wxOwnerDrawn(str
, FALSE
)
649 // no bitmaps/checkmarks
653 wxOwnerDrawn
*wxListBox::CreateItem(size_t n
)
655 return new wxListBoxItem();
658 #endif //USE_OWNER_DRAWN
660 // ============================================================================
661 // list box control implementation
662 // ============================================================================
664 void MacDrawStringCell(Rect
*cellRect
, Cell lCell
, ListHandle theList
, long refCon
)
667 // typecast our refCon
668 list
= (wxListBox
*)refCon
;
670 MoveTo(cellRect
->left
+ 4 , cellRect
->top
+ 10 );
671 const wxString text
= list
->m_stringArray
[lCell
.v
] ;
672 ::TextFont( kFontIDMonaco
) ;
675 DrawText(text
, 0 , text
.Length());
679 void wxListBox::MacDelete( int N
)
681 LDelRow( 1 , N
, (ListHandle
)m_macList
) ;
685 void wxListBox::MacInsert( int n
, const char * text
)
687 Cell cell
= { 0 , 0 } ;
689 LAddRow( 1 , cell
.v
, (ListHandle
)m_macList
) ;
690 // LSetCell(text, strlen(text), cell, m_macList);
694 void wxListBox::MacAppend( const char * text
)
696 Cell cell
= { 0 , 0 } ;
697 cell
.v
= (**(ListHandle
)m_macList
).dataBounds
.bottom
;
698 LAddRow( 1 , cell
.v
, (ListHandle
)m_macList
) ;
699 // LSetCell(text, strlen(text), cell, m_macList);
703 void wxListBox::MacClear()
705 LDelRow( (**(ListHandle
)m_macList
).dataBounds
.bottom
, 0 ,(ListHandle
) m_macList
) ;
709 void wxListBox::MacSetSelection( int n
, bool select
)
711 Cell cell
= { 0 , 0 } ;
712 if ( ! (m_windowStyle
& wxLB_MULTIPLE
) )
714 if ( LGetSelect( true , &cell
, (ListHandle
)m_macList
) )
716 LSetSelect( false , cell
, (ListHandle
)m_macList
) ;
721 LSetSelect( select
, cell
, (ListHandle
)m_macList
) ;
722 LAutoScroll( (ListHandle
)m_macList
) ;
726 bool wxListBox::MacIsSelected( int n
) const
728 Cell cell
= { 0 , 0 } ;
730 return LGetSelect( false , &cell
, (ListHandle
)m_macList
) ;
733 void wxListBox::MacDestroy()
735 // DisposeExtLDEFInfo( m_macList ) ;
738 int wxListBox::MacGetSelection() const
740 Cell cell
= { 0 , 0 } ;
741 if ( LGetSelect( true , &cell
, (ListHandle
)m_macList
) )
747 int wxListBox::MacGetSelections( wxArrayInt
& aSelections
) const
753 Cell cell
= { 0 , 0 } ;
756 while ( LGetSelect( true , &cell
,(ListHandle
) m_macList
) )
758 aSelections
.Add( cell
.v
) ;
765 void wxListBox::MacSet( int n
, const char * text
)
767 // our implementation does not store anything in the list
768 // so we just have to redraw
769 Cell cell
= { 0 , 0 } ;
771 // LSetCell(text, strlen(text), cell, m_macList);
775 void wxListBox::MacScrollTo( int n
)
777 // TODO implement scrolling
780 void wxListBox::OnSize( const wxSizeEvent
&event
)
785 GetListCellSize((ListHandle
)m_macList
, &pt
);
787 pt
= (**(ListHandle
)m_macList
).cellSize
;
789 pt
.h
= m_width
- 15 ;
790 LCellSize( pt
, (ListHandle
)m_macList
) ;
793 void wxListBox::MacHandleControlClick( WXWidget control
, wxInt16 controlpart
)
795 Boolean wasDoubleClick
= false ;
798 ::GetControlData( (ControlHandle
) m_macControl
, kControlNoPart
, kControlListBoxDoubleClickTag
, sizeof( wasDoubleClick
) , (char*) &wasDoubleClick
, &result
) ;
799 if ( !wasDoubleClick
)
809 void wxListBox::MacSetRedraw( bool doDraw
)
811 LSetDrawingMode( doDraw
, (ListHandle
)m_macList
) ;
815 void wxListBox::MacDoClick()
817 wxArrayInt aSelections
;
818 int n
, count
= GetSelections(aSelections
);
820 if ( count
== m_selectionPreImage
.GetCount() )
822 bool hasChanged
= false ;
823 for ( int i
= 0 ; i
< count
; ++i
)
825 if ( aSelections
[i
] != m_selectionPreImage
[i
] )
837 m_selectionPreImage
= aSelections
;
839 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_SELECTED
, m_windowId
);
840 event
.SetEventObject( this );
845 if ( HasClientObjectData() )
846 event
.SetClientObject( GetClientObject(n
) );
847 else if ( HasClientUntypedData() )
848 event
.SetClientData( GetClientData(n
) );
849 event
.SetString( GetString(n
) );
856 event
.m_commandInt
= n
;
858 GetEventHandler()->ProcessEvent(event
);
861 void wxListBox::MacDoDoubleClick()
863 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
, m_windowId
);
864 event
.SetEventObject( this );
865 GetEventHandler()->ProcessEvent(event
) ;
868 static long sLastTypeIn
= 0 ;
870 void wxListBox::OnChar(wxKeyEvent
& event
)
872 if ( event
.KeyCode() == WXK_RETURN
|| event
.KeyCode() == WXK_NUMPAD_ENTER
)
874 wxWindow
* parent
= GetParent() ;
875 while( parent
&& !parent
->IsTopLevel() && parent
->GetDefaultItem() == NULL
)
876 parent
= parent
->GetParent() ;
878 if ( parent
&& parent
->GetDefaultItem() )
880 wxButton
*def
= wxDynamicCast(parent
->GetDefaultItem(),
882 if ( def
&& def
->IsEnabled() )
884 wxCommandEvent
event(wxEVT_COMMAND_BUTTON_CLICKED
, def
->GetId() );
885 event
.SetEventObject(def
);
892 /* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
893 else if (event
.KeyCode() == WXK_ESCAPE
|| (event
.KeyCode() == '.' && event
.MetaDown() ) )
895 wxWindow
* win
= GetParent()->FindWindow( wxID_CANCEL
) ;
896 wxCommandEvent
new_event(wxEVT_COMMAND_BUTTON_CLICKED
,wxID_CANCEL
);
897 new_event
.SetEventObject( win
);
898 win
->GetEventHandler()->ProcessEvent( new_event
);
900 else if ( event
.KeyCode() == WXK_TAB
)
902 wxNavigationKeyEvent new_event
;
903 new_event
.SetEventObject( this );
904 new_event
.SetDirection( !event
.ShiftDown() );
905 /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
906 new_event
.SetWindowChange( event
.ControlDown() );
907 new_event
.SetCurrentFocus( this );
908 if ( !GetEventHandler()->ProcessEvent( new_event
) )
911 else if ( event
.KeyCode() == WXK_DOWN
|| event
.KeyCode() == WXK_UP
)
913 // perform the default key handling first
914 wxControl::OnKeyDown( event
) ;
916 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_SELECTED
, m_windowId
);
917 event
.SetEventObject( this );
919 wxArrayInt aSelections
;
920 int n
, count
= GetSelections(aSelections
);
924 if ( HasClientObjectData() )
925 event
.SetClientObject( GetClientObject(n
) );
926 else if ( HasClientUntypedData() )
927 event
.SetClientData( GetClientData(n
) );
928 event
.SetString( GetString(n
) );
935 event
.m_commandInt
= n
;
937 GetEventHandler()->ProcessEvent(event
);
941 if ( event
.GetTimestamp() > m_lastTypeIn
+ 60 )
945 m_lastTypeIn
= event
.GetTimestamp() ;
946 m_typeIn
+= (char) event
.KeyCode() ;
947 int line
= FindString("*"+m_typeIn
+"*") ;
950 if ( GetSelection() != line
)
953 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_SELECTED
, m_windowId
);
954 event
.SetEventObject( this );
956 if ( HasClientObjectData() )
957 event
.SetClientObject( GetClientObject( line
) );
958 else if ( HasClientUntypedData() )
959 event
.SetClientData( GetClientData(line
) );
960 event
.SetString( GetString(line
) );
962 event
.m_commandInt
= line
;
964 GetEventHandler()->ProcessEvent(event
);