1 ///////////////////////////////////////////////////////////////////////////////
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "listbox.h"
17 #include "wx/listbox.h"
18 #include "wx/settings.h"
19 #include "wx/toplevel.h"
20 #include "wx/dynarray.h"
25 #if !USE_SHARED_LIBRARY
26 IMPLEMENT_DYNAMIC_CLASS(wxListBox
, wxControl
)
28 BEGIN_EVENT_TABLE(wxListBox
, wxControl
)
29 EVT_SIZE( wxListBox::OnSize
)
30 EVT_CHAR( wxListBox::OnChar
)
34 #include "wx/mac/uma.h"
36 #if PRAGMA_STRUCT_ALIGN
37 #pragma options align=mac68k
38 #elif PRAGMA_STRUCT_PACKPUSH
40 #elif PRAGMA_STRUCT_PACK
45 unsigned short instruction
;
47 } ldefRec
, *ldefPtr
, **ldefHandle
;
49 #if PRAGMA_STRUCT_ALIGN
50 #pragma options align=reset
51 #elif PRAGMA_STRUCT_PACKPUSH
53 #elif PRAGMA_STRUCT_PACK
58 const short kwxMacListItemHeight
= 19 ;
60 const short kwxMacListItemHeight
= 14 ;
65 static pascal void wxMacListDefinition( short message
, Boolean isSelected
, Rect
*drawRect
,
66 Cell cell
, short dataOffset
, short dataLength
,
67 ListHandle listHandle
) ;
70 static pascal void wxMacListDefinition( short message
, Boolean isSelected
, Rect
*drawRect
,
71 Cell cell
, short dataOffset
, short dataLength
,
72 ListHandle listHandle
)
76 RgnHandle savedClipRegion
;
80 SetPort((**listHandle
).port
);
81 grafPtr
= (**listHandle
).port
;
82 // typecast our refCon
83 list
= (wxListBox
*) GetControlReference( (ControlHandle
) GetListRefCon(listHandle
) );
85 // Calculate the cell rect.
96 const wxString text
= list
->m_stringArray
[cell
.v
] ;
98 // Save the current clip region, and set the clip region to the area we are about
101 savedClipRegion
= NewRgn();
102 GetClip( savedClipRegion
);
104 ClipRect( drawRect
);
105 EraseRect( drawRect
);
108 bool useDrawThemeText
= ( DrawThemeTextBox
!= (void*) kUnresolvedCFragSymbolAddress
) ;
110 if ( useDrawThemeText
)
112 Rect frame
= { drawRect
->top
, drawRect
->left
+ 4,
113 drawRect
->top
+ kwxMacListItemHeight
, drawRect
->right
} ;
114 CFStringRef mString
= CFStringCreateWithBytes( NULL
, (UInt8
*) text
.c_str(), text
.Length(), CFStringGetSystemEncoding(), false ) ;
115 ::DrawThemeTextBox( mString
,
122 CFRelease( mString
) ;
127 MoveTo(drawRect
->left
+ 4 , drawRect
->top
+ 10 );
128 ::TextFont( kFontIDMonaco
) ;
131 DrawText(text
, 0 , text
.Length());
134 // If the cell is hilited, do the hilite now. Paint the cell contents with the
135 // appropriate QuickDraw transform mode.
138 savedPenMode
= GetPortPenMode( (CGrafPtr
) grafPtr
);
139 SetPortPenMode( (CGrafPtr
)grafPtr
, hilitetransfermode
);
140 PaintRect( drawRect
);
141 SetPortPenMode( (CGrafPtr
)grafPtr
, savedPenMode
);
144 // Restore the saved clip region.
146 SetClip( savedClipRegion
);
147 DisposeRgn( savedClipRegion
);
152 // Hilite or unhilite the cell. Paint the cell contents with the
153 // appropriate QuickDraw transform mode.
156 savedPenMode
= GetPortPenMode( (CGrafPtr
)grafPtr
);
157 SetPortPenMode( (CGrafPtr
)grafPtr
, hilitetransfermode
);
158 PaintRect( drawRect
);
159 SetPortPenMode( (CGrafPtr
)grafPtr
, savedPenMode
);
167 extern "C" void MacDrawStringCell(Rect
*cellRect
, Cell lCell
, ListHandle theList
, long refCon
) ;
168 const short kwxMacListWithVerticalScrollbar
= 128 ;
170 // ============================================================================
171 // list box control implementation
172 // ============================================================================
175 wxListBox::wxListBox()
182 static ListDefUPP macListDefUPP
= NULL
;
184 bool wxListBox::Create(wxWindow
*parent
, wxWindowID id
,
187 int n
, const wxString choices
[],
189 const wxValidator
& validator
,
190 const wxString
& name
)
192 m_noItems
= 0 ; // this will be increased by our append command
198 MacPreControlCreate( parent
, id
, "" , pos
, size
,style
, validator
, name
, &bounds
, title
) ;
201 listDef
.defType
= kListDefUserProcType
;
202 if ( macListDefUPP
== NULL
)
204 macListDefUPP
= NewListDefUPP( wxMacListDefinition
);
206 listDef
.u
.userProc
= macListDefUPP
;
212 CreateListBoxControl( MAC_WXHWND(parent
->MacGetRootWindow()), &bounds
, false, 0, 1, false, true,
213 kwxMacListItemHeight
, kwxMacListItemHeight
, false, &listDef
, (ControlRef
*)&m_macControl
);
215 GetControlData( (ControlHandle
) m_macControl
, kControlNoPart
, kControlListBoxListHandleTag
,
216 sizeof(ListHandle
), (Ptr
) &m_macList
, &asize
);
218 SetControlReference( (ControlHandle
) m_macControl
, (long) this);
219 SetControlVisibility( (ControlHandle
) m_macControl
, false, false);
224 wxStAppResource resload
;
225 m_macControl
= ::NewControl( MAC_WXHWND(parent
->MacGetRootWindow()) , &bounds
, title
, false ,
226 kwxMacListWithVerticalScrollbar
, 0 , 0,
227 kControlListBoxProc
, (long) this ) ;
228 ::GetControlData( (ControlHandle
) m_macControl
, kControlNoPart
, kControlListBoxListHandleTag
,
229 sizeof( ListHandle
) , (char*) &m_macList
, &result
) ;
231 HLock( (Handle
) m_macList
) ;
233 ldef
= (ldefHandle
) NewHandle( sizeof(ldefRec
) ) ;
234 if ( (**(ListHandle
)m_macList
).listDefProc
!= NULL
)
236 (**ldef
).instruction
= 0x4EF9; /* JMP instruction */
237 (**ldef
).function
= (void(*)()) listDef
.u
.userProc
;
238 (**(ListHandle
)m_macList
).listDefProc
= (Handle
) ldef
;
241 Point pt
= (**(ListHandle
)m_macList
).cellSize
;
242 pt
.v
= kwxMacListItemHeight
;
243 LCellSize( pt
, (ListHandle
)m_macList
) ;
244 LAddColumn( 1 , 0 , (ListHandle
)m_macList
) ;
246 OptionBits options
= 0;
247 if ( style
& wxLB_MULTIPLE
)
249 options
+= lNoExtend
;
251 else if ( style
& wxLB_EXTENDED
)
253 options
+= lExtendDrag
;
259 SetListSelectionFlags((ListHandle
)m_macList
, options
);
261 MacPostControlCreate() ;
263 for ( int i
= 0 ; i
< n
; i
++ )
265 Append( choices
[i
] ) ;
268 LSetDrawingMode( true , (ListHandle
)m_macList
) ;
273 wxListBox::~wxListBox()
279 DisposeHandle( (**(ListHandle
)m_macList
).listDefProc
) ;
280 (**(ListHandle
)m_macList
).listDefProc
= NULL
;
286 void wxListBox::FreeData()
288 #if wxUSE_OWNER_DRAWN
289 if ( m_windowStyle
& wxLB_OWNERDRAW
)
291 size_t uiCount
= m_aItems
.Count();
292 while ( uiCount
-- != 0 ) {
293 delete m_aItems
[uiCount
];
294 m_aItems
[uiCount
] = NULL
;
300 #endif // wxUSE_OWNER_DRAWN
301 if ( HasClientObjectData() )
303 for ( size_t n
= 0; n
< (size_t)m_noItems
; n
++ )
305 delete GetClientObject(n
);
310 void wxListBox::DoSetSize(int x
, int y
,
311 int width
, int height
,
314 wxControl::DoSetSize( x
, y
, width
, height
, sizeFlags
) ;
317 GetControlBounds( (ControlHandle
) m_macControl
, &bounds
) ;
318 ControlRef control
= GetListVerticalScrollBar( (ListHandle
)m_macList
) ;
322 GetControlBounds( control
, &scrollbounds
) ;
323 if( scrollbounds
.right
!= bounds
.right
+ 1 )
325 UMAMoveControl( control
, bounds
.right
- (scrollbounds
.right
- scrollbounds
.left
) + 1 ,
331 void wxListBox::DoSetFirstItem(int N
)
336 void wxListBox::Delete(int N
)
338 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
339 wxT("invalid index in wxListBox::Delete") );
341 #if wxUSE_OWNER_DRAWN
343 m_aItems
.RemoveAt(N
);
344 #else // !wxUSE_OWNER_DRAWN
345 if ( HasClientObjectData() )
347 delete GetClientObject(N
);
349 #endif // wxUSE_OWNER_DRAWN/!wxUSE_OWNER_DRAWN
350 m_stringArray
.RemoveAt( N
) ;
351 m_dataArray
.RemoveAt( N
) ;
357 int wxListBox::DoAppend(const wxString
& item
)
359 int index
= m_noItems
;
360 if( wxApp::s_macDefaultEncodingIsPC
)
362 m_stringArray
.Add( wxMacMakeMacStringFromPC( item
) ) ;
363 m_dataArray
.Add( NULL
);
366 m_stringArray
.Add( item
) ;
367 m_dataArray
.Add( NULL
);
370 DoSetItemClientData( index
, NULL
) ;
376 void wxListBox::DoSetItems(const wxArrayString
& choices
, void** clientData
)
378 MacSetRedraw( false ) ;
380 int n
= choices
.GetCount();
382 for( int i
= 0 ; i
< n
; ++i
)
386 #if wxUSE_OWNER_DRAWN
387 wxASSERT_MSG(clientData
[i
] == NULL
,
388 wxT("Can't use client data with owner-drawn listboxes"));
389 #else // !wxUSE_OWNER_DRAWN
390 Append( choices
[i
] , clientData
[i
] ) ;
394 Append( choices
[i
] ) ;
397 #if wxUSE_OWNER_DRAWN
398 if ( m_windowStyle
& wxLB_OWNERDRAW
) {
399 // first delete old items
400 size_t ui
= m_aItems
.Count();
401 while ( ui
-- != 0 ) {
407 // then create new ones
408 for ( ui
= 0; ui
< (size_t)m_noItems
; ui
++ ) {
409 wxOwnerDrawn
*pNewItem
= CreateItem(ui
);
410 pNewItem
->SetName(choices
[ui
]);
411 m_aItems
.Add(pNewItem
);
414 #endif // wxUSE_OWNER_DRAWN
415 MacSetRedraw( true ) ;
418 bool wxListBox::HasMultipleSelection() const
420 return (m_windowStyle
& wxLB_MULTIPLE
) || (m_windowStyle
& wxLB_EXTENDED
);
423 int wxListBox::FindString(const wxString
& st
) const
426 if( wxApp::s_macDefaultEncodingIsPC
)
428 s
= wxMacMakeMacStringFromPC( st
) ;
433 if ( s
.Right(1) == "*" )
435 wxString search
= s
.Left( s
.Length() - 1 ) ;
436 int len
= search
.Length() ;
440 c2pstrcpy( (StringPtr
) s2
, search
.c_str() ) ;
442 strcpy( (char *) s2
, search
.c_str() ) ;
443 c2pstr( (char *) s2
) ;
446 for ( int i
= 0 ; i
< m_noItems
; ++ i
)
449 c2pstrcpy( (StringPtr
) s1
, m_stringArray
[i
].Left( len
).c_str() ) ;
451 strcpy( (char *) s1
, m_stringArray
[i
].Left( len
).c_str() ) ;
452 c2pstr( (char *) s1
) ;
454 if ( EqualString( s1
, s2
, false , false ) )
457 if ( s
.Left(1) == "*" && s
.Length() > 1 )
461 for ( int i
= 0 ; i
< m_noItems
; ++i
)
463 if ( GetString(i
).Lower().Matches(s
) )
474 c2pstrcpy( (StringPtr
) s2
, s
.c_str() ) ;
476 strcpy( (char *) s2
, s
.c_str() ) ;
477 c2pstr( (char *) s2
) ;
480 for ( int i
= 0 ; i
< m_noItems
; ++ i
)
483 c2pstrcpy( (StringPtr
) s1
, m_stringArray
[i
].c_str() ) ;
485 strcpy( (char *) s1
, m_stringArray
[i
].c_str() ) ;
486 c2pstr( (char *) s1
) ;
488 if ( EqualString( s1
, s2
, false , false ) )
495 void wxListBox::Clear()
499 m_stringArray
.Empty() ;
500 m_dataArray
.Empty() ;
504 void wxListBox::SetSelection(int N
, bool select
)
506 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
507 "invalid index in wxListBox::SetSelection" );
508 MacSetSelection( N
, select
) ;
509 GetSelections( m_selectionPreImage
) ;
512 bool wxListBox::IsSelected(int N
) const
514 wxCHECK_MSG( N
>= 0 && N
< m_noItems
, FALSE
,
515 "invalid index in wxListBox::Selected" );
517 return MacIsSelected( N
) ;
520 void *wxListBox::DoGetItemClientData(int N
) const
522 wxCHECK_MSG( N
>= 0 && N
< m_noItems
, NULL
,
523 wxT("invalid index in wxListBox::GetClientData"));
525 return (void *)m_dataArray
[N
];
528 wxClientData
*wxListBox::DoGetItemClientObject(int N
) const
530 return (wxClientData
*) DoGetItemClientData( N
) ;
533 void wxListBox::DoSetItemClientData(int N
, void *Client_data
)
535 wxCHECK_RET( N
>= 0 && N
< m_noItems
,
536 "invalid index in wxListBox::SetClientData" );
538 #if wxUSE_OWNER_DRAWN
539 if ( m_windowStyle
& wxLB_OWNERDRAW
)
541 // client data must be pointer to wxOwnerDrawn, otherwise we would crash
542 // in OnMeasure/OnDraw.
543 wxFAIL_MSG(wxT("Can't use client data with owner-drawn listboxes"));
545 #endif // wxUSE_OWNER_DRAWN
546 wxASSERT_MSG( m_dataArray
.GetCount() >= N
, "invalid client_data array" ) ;
548 if ( m_dataArray
.GetCount() > N
)
550 m_dataArray
[N
] = (char*) Client_data
;
554 m_dataArray
.Add( (char*) Client_data
) ;
558 void wxListBox::DoSetItemClientObject(int n
, wxClientData
* clientData
)
560 DoSetItemClientData(n
, clientData
);
563 // Return number of selections and an array of selected integers
564 int wxListBox::GetSelections(wxArrayInt
& aSelections
) const
566 return MacGetSelections( aSelections
) ;
569 // Get single selection, for single choice list items
570 int wxListBox::GetSelection() const
572 return MacGetSelection() ;
575 // Find string for position
576 wxString
wxListBox::GetString(int N
) const
578 if( wxApp::s_macDefaultEncodingIsPC
)
580 return wxMacMakePCStringFromMac( m_stringArray
[N
] ) ;
583 return m_stringArray
[N
] ;
586 void wxListBox::DoInsertItems(const wxArrayString
& items
, int pos
)
588 wxCHECK_RET( pos
>= 0 && pos
<= m_noItems
,
589 wxT("invalid index in wxListBox::InsertItems") );
591 int nItems
= items
.GetCount();
593 for ( int i
= 0 ; i
< nItems
; i
++ )
595 m_stringArray
.Insert( items
[i
] , pos
+ i
) ;
596 m_dataArray
.Insert( NULL
, pos
+ i
) ;
597 MacInsert( pos
+ i
, items
[i
] ) ;
603 void wxListBox::SetString(int N
, const wxString
& s
)
606 if( wxApp::s_macDefaultEncodingIsPC
)
608 str
= wxMacMakeMacStringFromPC( s
) ;
612 m_stringArray
[N
] = str
;
616 wxSize
wxListBox::DoGetBestSize() const
618 return wxSize(100, 100);
621 int wxListBox::GetCount() const
626 void wxListBox::SetupColours()
628 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW
));
629 SetForegroundColour(GetParent()->GetForegroundColour());
632 void wxListBox::Refresh(bool eraseBack
, const wxRect
*rect
)
634 wxControl::Refresh( eraseBack
, rect
) ;
635 // MacRedrawControl() ;
638 #if wxUSE_OWNER_DRAWN
640 class wxListBoxItem
: public wxOwnerDrawn
643 wxListBoxItem(const wxString
& str
= "");
646 wxListBoxItem::wxListBoxItem(const wxString
& str
) : wxOwnerDrawn(str
, FALSE
)
648 // no bitmaps/checkmarks
652 wxOwnerDrawn
*wxListBox::CreateItem(size_t n
)
654 return new wxListBoxItem();
657 #endif //USE_OWNER_DRAWN
659 // ============================================================================
660 // list box control implementation
661 // ============================================================================
663 void MacDrawStringCell(Rect
*cellRect
, Cell lCell
, ListHandle theList
, long refCon
)
666 // typecast our refCon
667 list
= (wxListBox
*)refCon
;
669 MoveTo(cellRect
->left
+ 4 , cellRect
->top
+ 10 );
670 const wxString text
= list
->m_stringArray
[lCell
.v
] ;
671 ::TextFont( kFontIDMonaco
) ;
674 DrawText(text
, 0 , text
.Length());
678 void wxListBox::MacDelete( int N
)
680 LDelRow( 1 , N
, (ListHandle
)m_macList
) ;
684 void wxListBox::MacInsert( int n
, const char * text
)
686 Cell cell
= { 0 , 0 } ;
688 LAddRow( 1 , cell
.v
, (ListHandle
)m_macList
) ;
689 // LSetCell(text, strlen(text), cell, m_macList);
693 void wxListBox::MacAppend( const char * text
)
695 Cell cell
= { 0 , 0 } ;
696 cell
.v
= (**(ListHandle
)m_macList
).dataBounds
.bottom
;
697 LAddRow( 1 , cell
.v
, (ListHandle
)m_macList
) ;
698 // LSetCell(text, strlen(text), cell, m_macList);
702 void wxListBox::MacClear()
704 LDelRow( (**(ListHandle
)m_macList
).dataBounds
.bottom
, 0 ,(ListHandle
) m_macList
) ;
708 void wxListBox::MacSetSelection( int n
, bool select
)
710 Cell cell
= { 0 , 0 } ;
711 if ( ! (m_windowStyle
& wxLB_MULTIPLE
) )
713 if ( LGetSelect( true , &cell
, (ListHandle
)m_macList
) )
715 LSetSelect( false , cell
, (ListHandle
)m_macList
) ;
720 LSetSelect( select
, cell
, (ListHandle
)m_macList
) ;
721 LAutoScroll( (ListHandle
)m_macList
) ;
725 bool wxListBox::MacIsSelected( int n
) const
727 Cell cell
= { 0 , 0 } ;
729 return LGetSelect( false , &cell
, (ListHandle
)m_macList
) ;
732 void wxListBox::MacDestroy()
734 // DisposeExtLDEFInfo( m_macList ) ;
737 int wxListBox::MacGetSelection() const
739 Cell cell
= { 0 , 0 } ;
740 if ( LGetSelect( true , &cell
, (ListHandle
)m_macList
) )
746 int wxListBox::MacGetSelections( wxArrayInt
& aSelections
) const
752 Cell cell
= { 0 , 0 } ;
755 while ( LGetSelect( true , &cell
,(ListHandle
) m_macList
) )
757 aSelections
.Add( cell
.v
) ;
764 void wxListBox::MacSet( int n
, const char * text
)
766 // our implementation does not store anything in the list
767 // so we just have to redraw
768 Cell cell
= { 0 , 0 } ;
770 // LSetCell(text, strlen(text), cell, m_macList);
774 void wxListBox::MacScrollTo( int n
)
776 // TODO implement scrolling
779 void wxListBox::OnSize( const wxSizeEvent
&event
)
784 GetListCellSize((ListHandle
)m_macList
, &pt
);
786 pt
= (**(ListHandle
)m_macList
).cellSize
;
788 pt
.h
= m_width
- 15 ;
789 LCellSize( pt
, (ListHandle
)m_macList
) ;
792 void wxListBox::MacHandleControlClick( WXWidget control
, wxInt16 controlpart
)
794 Boolean wasDoubleClick
= false ;
797 ::GetControlData( (ControlHandle
) m_macControl
, kControlNoPart
, kControlListBoxDoubleClickTag
, sizeof( wasDoubleClick
) , (char*) &wasDoubleClick
, &result
) ;
798 if ( !wasDoubleClick
)
808 void wxListBox::MacSetRedraw( bool doDraw
)
810 LSetDrawingMode( doDraw
, (ListHandle
)m_macList
) ;
814 void wxListBox::MacDoClick()
816 wxArrayInt aSelections
;
817 int n
, count
= GetSelections(aSelections
);
819 if ( count
== m_selectionPreImage
.GetCount() )
821 bool hasChanged
= false ;
822 for ( int i
= 0 ; i
< count
; ++i
)
824 if ( aSelections
[i
] != m_selectionPreImage
[i
] )
836 m_selectionPreImage
= aSelections
;
838 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_SELECTED
, m_windowId
);
839 event
.SetEventObject( this );
844 if ( HasClientObjectData() )
845 event
.SetClientObject( GetClientObject(n
) );
846 else if ( HasClientUntypedData() )
847 event
.SetClientData( GetClientData(n
) );
848 event
.SetString( GetString(n
) );
855 event
.m_commandInt
= n
;
857 GetEventHandler()->ProcessEvent(event
);
860 void wxListBox::MacDoDoubleClick()
862 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED
, m_windowId
);
863 event
.SetEventObject( this );
864 GetEventHandler()->ProcessEvent(event
) ;
867 static long sLastTypeIn
= 0 ;
869 void wxListBox::OnChar(wxKeyEvent
& event
)
871 if ( event
.KeyCode() == WXK_RETURN
|| event
.KeyCode() == WXK_NUMPAD_ENTER
)
873 wxWindow
* parent
= GetParent() ;
874 while( parent
&& !parent
->IsTopLevel() && parent
->GetDefaultItem() == NULL
)
875 parent
= parent
->GetParent() ;
877 if ( parent
&& parent
->GetDefaultItem() )
879 wxButton
*def
= wxDynamicCast(parent
->GetDefaultItem(),
881 if ( def
&& def
->IsEnabled() )
883 wxCommandEvent
event(wxEVT_COMMAND_BUTTON_CLICKED
, def
->GetId() );
884 event
.SetEventObject(def
);
891 /* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
892 else if (event
.KeyCode() == WXK_ESCAPE
|| (event
.KeyCode() == '.' && event
.MetaDown() ) )
894 wxWindow
* win
= GetParent()->FindWindow( wxID_CANCEL
) ;
895 wxCommandEvent
new_event(wxEVT_COMMAND_BUTTON_CLICKED
,wxID_CANCEL
);
896 new_event
.SetEventObject( win
);
897 win
->GetEventHandler()->ProcessEvent( new_event
);
899 else if ( event
.KeyCode() == WXK_TAB
)
901 wxNavigationKeyEvent new_event
;
902 new_event
.SetEventObject( this );
903 new_event
.SetDirection( !event
.ShiftDown() );
904 /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
905 new_event
.SetWindowChange( event
.ControlDown() );
906 new_event
.SetCurrentFocus( this );
907 if ( !GetEventHandler()->ProcessEvent( new_event
) )
910 else if ( event
.KeyCode() == WXK_DOWN
|| event
.KeyCode() == WXK_UP
)
912 // perform the default key handling first
913 wxControl::OnKeyDown( event
) ;
915 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_SELECTED
, m_windowId
);
916 event
.SetEventObject( this );
918 wxArrayInt aSelections
;
919 int n
, count
= GetSelections(aSelections
);
923 if ( HasClientObjectData() )
924 event
.SetClientObject( GetClientObject(n
) );
925 else if ( HasClientUntypedData() )
926 event
.SetClientData( GetClientData(n
) );
927 event
.SetString( GetString(n
) );
934 event
.m_commandInt
= n
;
936 GetEventHandler()->ProcessEvent(event
);
940 if ( event
.GetTimestamp() > m_lastTypeIn
+ 60 )
944 m_lastTypeIn
= event
.GetTimestamp() ;
945 m_typeIn
+= (char) event
.KeyCode() ;
946 int line
= FindString("*"+m_typeIn
+"*") ;
949 if ( GetSelection() != line
)
952 wxCommandEvent
event(wxEVT_COMMAND_LISTBOX_SELECTED
, m_windowId
);
953 event
.SetEventObject( this );
955 if ( HasClientObjectData() )
956 event
.SetClientObject( GetClientObject( line
) );
957 else if ( HasClientUntypedData() )
958 event
.SetClientData( GetClientData(line
) );
959 event
.SetString( GetString(line
) );
961 event
.m_commandInt
= line
;
963 GetEventHandler()->ProcessEvent(event
);