+
+ return no_sel;
+}
+
+void wxMacDataBrowserListControl::MacSet( int n, const wxString& text )
+{
+ // as we don't store the strings we only have to issue a redraw
+ UInt32 id = n + 1;
+ verify_noerr( UpdateItems( kDataBrowserNoItem, 1, &id, kDataBrowserItemNoProperty, kDataBrowserItemNoProperty ) );
+}
+
+void wxMacDataBrowserListControl::MacScrollTo( int n )
+{
+ UInt32 id = n + 1;
+ verify_noerr( RevealItem( id, kTextColumnId, kDataBrowserRevealWithoutSelecting ) );
+}
+
+void wxMacDataBrowserListControl::UpdateLine( int n )
+{
+ UInt32 id = n + 1;
+ verify_noerr( UpdateItems(kDataBrowserNoItem, 1, &id, kDataBrowserItemNoProperty, kDataBrowserItemNoProperty ) );
+}
+
+//
+// Databrowser
+//
+
+OSStatus wxMacDataBrowserListControl::SetSelectionFlags( DataBrowserSelectionFlags options )
+{
+ return SetDataBrowserSelectionFlags( m_controlRef, options );
+}
+
+OSStatus wxMacDataBrowserListControl::AddListViewColumn( DataBrowserListViewColumnDesc *columnDesc,
+ DataBrowserTableViewColumnIndex position )
+{
+ return AddDataBrowserListViewColumn( m_controlRef, columnDesc, position );
+}
+
+OSStatus wxMacDataBrowserListControl::AutoSizeListViewColumns()
+{
+ return AutoSizeDataBrowserListViewColumns(m_controlRef);
+}
+
+OSStatus wxMacDataBrowserListControl::SetHasScrollBars( bool horiz, bool vert )
+{
+ return SetDataBrowserHasScrollBars( m_controlRef, horiz, vert );
+}
+
+OSStatus wxMacDataBrowserListControl::SetTableViewHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle )
+{
+ return SetDataBrowserTableViewHiliteStyle( m_controlRef, hiliteStyle );
+}
+
+OSStatus wxMacDataBrowserListControl::SetListViewHeaderBtnHeight(UInt16 height)
+{
+ return SetDataBrowserListViewHeaderBtnHeight( m_controlRef, height );
+}
+
+OSStatus wxMacDataBrowserListControl::SetCallbacks(const DataBrowserCallbacks *callbacks)
+{
+ return SetDataBrowserCallbacks( m_controlRef, callbacks );
+}
+
+OSStatus wxMacDataBrowserListControl::UpdateItems(
+ DataBrowserItemID container,
+ UInt32 numItems,
+ const DataBrowserItemID *items,
+ DataBrowserPropertyID preSortProperty,
+ DataBrowserPropertyID propertyID )
+{
+ return UpdateDataBrowserItems( m_controlRef, container, numItems, items, preSortProperty, propertyID );
+}
+
+bool wxMacDataBrowserListControl::IsItemSelected( DataBrowserItemID item ) const
+{
+ return IsDataBrowserItemSelected( m_controlRef, item );
+}
+
+OSStatus wxMacDataBrowserListControl::AddItems(
+ DataBrowserItemID container,
+ UInt32 numItems,
+ const DataBrowserItemID *items,
+ DataBrowserPropertyID preSortProperty )
+{
+ return AddDataBrowserItems( m_controlRef, container, numItems, items, preSortProperty );
+}
+
+OSStatus wxMacDataBrowserListControl::RemoveItems(
+ DataBrowserItemID container,
+ UInt32 numItems,
+ const DataBrowserItemID *items,
+ DataBrowserPropertyID preSortProperty )
+{
+ return RemoveDataBrowserItems( m_controlRef, container, numItems, items, preSortProperty );
+}
+
+OSStatus wxMacDataBrowserListControl::RevealItem(
+ DataBrowserItemID item,
+ DataBrowserPropertyID propertyID,
+ DataBrowserRevealOptions options )
+{
+ return RevealDataBrowserItem( m_controlRef, item, propertyID, options );
+}
+
+OSStatus wxMacDataBrowserListControl::SetSelectedItems(
+ UInt32 numItems,
+ const DataBrowserItemID *items,
+ DataBrowserSetOption operation )
+{
+ return SetDataBrowserSelectedItems( m_controlRef, numItems, items, operation );
+}
+
+OSStatus wxMacDataBrowserListControl::GetSelectionAnchor( DataBrowserItemID *first, DataBrowserItemID *last ) const
+{
+ return GetDataBrowserSelectionAnchor( m_controlRef, first, last );
+}
+
+#if 0
+
+// in case we need that one day
+
+// ============================================================================
+// HIView owner-draw-based implementation
+// ============================================================================
+
+static pascal void ListBoxDrawProc(
+ ControlRef browser, DataBrowserItemID item, DataBrowserPropertyID property,
+ DataBrowserItemState itemState, const Rect *itemRect, SInt16 depth, Boolean isColorDevice )
+{
+ CFStringRef cfString;
+ ThemeDrawingState themeState;
+ long systemVersion;
+
+ GetThemeDrawingState( &themeState );
+ cfString = CFStringCreateWithFormat( NULL, NULL, CFSTR("Row %d"), item );
+
+ // In this sample we handle the "selected" state; all others fall through to our "active" state
+ if ( itemState == kDataBrowserItemIsSelected )
+ {
+ ThemeBrush colorBrushID;
+
+ // TODO: switch over to wxSystemSettingsNative::GetColour() when kThemeBrushSecondaryHighlightColor
+ // is incorporated Panther DB starts using kThemeBrushSecondaryHighlightColor
+ // for inactive browser highlighting
+ Gestalt( gestaltSystemVersion, &systemVersion );
+ if ( (systemVersion >= 0x00001030) && !IsControlActive( browser ) )
+ colorBrushID = kThemeBrushSecondaryHighlightColor;
+ else
+ colorBrushID = kThemeBrushPrimaryHighlightColor;
+
+ // First paint the hilite rect, then the text on top
+ SetThemePen( colorBrushID, 32, true );
+ PaintRect( itemRect );
+ SetThemeDrawingState( themeState, false );
+ }
+
+ DrawThemeTextBox( cfString, kThemeApplicationFont, kThemeStateActive, true, itemRect, teFlushDefault, NULL );
+ SetThemeDrawingState( themeState, true );
+
+ if ( cfString != NULL )
+ CFRelease( cfString );
+}
+#endif
+
+// ============================================================================
+// list box control implementation
+// ============================================================================
+
+wxListBox::wxListBox()
+{
+ m_noItems = 0;
+}
+
+bool wxListBox::Create(
+ wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ const wxArrayString& choices,
+ long style,
+ const wxValidator& validator,
+ const wxString& name )
+{
+ wxCArrayString chs(choices);
+
+ return Create(
+ parent, id, pos, size, chs.GetCount(), chs.GetStrings(),
+ style, validator, name );
+}
+
+bool wxListBox::Create(
+ wxWindow *parent,
+ wxWindowID id,
+ const wxPoint& pos,
+ const wxSize& size,
+ int n,
+ const wxString choices[],
+ long style,
+ const wxValidator& validator,
+ const wxString& name )
+{
+ m_macIsUserPane = false;
+
+ wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED),
+ wxT("only a single listbox selection mode can be specified") );
+
+ if ( !wxListBoxBase::Create( parent, id, pos, size, style & ~(wxHSCROLL | wxVSCROLL), validator, name ) )
+ return false;
+
+ // this will be increased by our append command
+ m_noItems = 0;
+
+ m_peer = CreateMacListControl( pos, size, style );
+
+ MacPostControlCreate( pos, size );
+
+ InsertItems( n, choices, 0 );
+
+ // Needed because it is a wxControlWithItems
+ SetBestSize( size );
+
+ return true;
+}
+
+wxListBox::~wxListBox()
+{
+ m_peer->SetReference( 0 );
+ FreeData();
+}
+
+wxMacListControl * wxListBox::CreateMacListControl(const wxPoint& pos, const wxSize& size, long style)
+{
+ return new wxMacDataBrowserListControl( this, pos, size, style );