+void wxListBox::MacSetSelection( int n , bool select )
+{
+ Cell cell = { 0 , 0 } ;
+ if ( LGetSelect( true , &cell , m_macList ) )
+ {
+ LSetSelect( false , cell , m_macList ) ;
+ }
+
+ cell.v = n ;
+ LSetSelect( select , cell , m_macList ) ;
+ LAutoScroll( m_macList ) ;
+ Refresh();
+}
+
+bool wxListBox::MacIsSelected( int n ) const
+{
+ Cell cell = { 0 , 0 } ;
+ cell.v = n ;
+ return LGetSelect( false , &cell , m_macList ) ;
+}
+
+void wxListBox::MacDestroy()
+{
+// DisposeExtLDEFInfo( m_macList ) ;
+}
+
+int wxListBox::MacGetSelection() const
+{
+ Cell cell = { 0 , 0 } ;
+ if ( LGetSelect( true , &cell , m_macList ) )
+ return cell.v ;
+ else
+ return -1 ;
+}
+
+int wxListBox::MacGetSelections( wxArrayInt& aSelections ) const
+{
+ int no_sel = 0 ;
+
+ aSelections.Empty();
+
+ Cell cell = { 0 , 0 } ;
+ cell.v = 0 ;
+
+ while ( LGetSelect( true , &cell , m_macList ) )
+ {
+ aSelections.Add( cell.v ) ;
+ no_sel++ ;
+ cell.v++ ;
+ }
+ return no_sel ;
+}
+
+void wxListBox::MacSet( int n , const char * text )
+{
+ // our implementation does not store anything in the list
+ // so we just have to redraw
+ Cell cell = { 0 , 0 } ;
+ cell.v = n ;
+ LSetCell(text, strlen(text), cell, m_macList);
+ Refresh();
+}
+
+void wxListBox::MacScrollTo( int n )
+{
+ // TODO implement scrolling
+}
+
+void wxListBox::OnSize( const wxSizeEvent &event)
+{
+ Point pt;
+
+#if TARGET_CARBON
+ GetListCellSize(m_macList, &pt);
+#else
+ pt = (**m_macList).cellSize ;
+#endif
+ pt.h = m_width - 15 ;
+ LCellSize( pt , m_macList ) ;
+}
+
+void wxListBox::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
+{
+ Boolean wasDoubleClick = false ;
+ long result ;
+
+ UMAGetControlData( m_macControl , kControlNoPart , kControlListBoxDoubleClickTag , sizeof( wasDoubleClick ) , (char*) &wasDoubleClick , &result ) ;
+ if ( !wasDoubleClick )
+ {
+ MacDoClick() ;
+ }
+ else
+ {
+ MacDoDoubleClick() ;
+ }
+}
+
+void wxListBox::MacSetRedraw( bool doDraw )
+{
+ LSetDrawingMode( doDraw , m_macList ) ;
+
+}
+
+void wxListBox::MacDoClick()
+{
+ wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
+ event.SetEventObject( this );
+
+ wxArrayInt aSelections;
+ int n, count = GetSelections(aSelections);
+ if ( count > 0 )
+ {
+ n = aSelections[0];
+ if ( HasClientObjectData() )
+ event.SetClientObject( GetClientObject(n) );
+ else if ( HasClientUntypedData() )
+ event.SetClientData( GetClientData(n) );
+ event.SetString( GetString(n) );
+ }
+ else
+ {
+ n = -1;
+ }
+
+ event.m_commandInt = n;
+
+ GetEventHandler()->ProcessEvent(event);
+}
+
+void wxListBox::MacDoDoubleClick()
+{
+ wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, m_windowId);
+ event.SetEventObject( this );
+ GetEventHandler()->ProcessEvent(event) ;
+}