+// common interface for all implementations
+class wxMacListControl : public wxMacControl
+{
+public:
+ wxMacListControl( wxListBox *peer )
+ : wxMacControl( peer )
+ {
+ }
+
+ ~wxMacListControl()
+ {
+ }
+
+ virtual void UpdateLine( int n ) = 0;
+
+ virtual void MacDelete( int n ) = 0;
+ virtual void MacInsert( int n, const wxString& item ) = 0;
+ virtual void MacInsert( int n, const wxArrayString& items ) = 0;
+ virtual void MacAppend( const wxString& item ) = 0;
+ virtual void MacSet( int n, const wxString& item ) = 0;
+ virtual void MacClear() = 0;
+ virtual void MacDeselectAll() = 0;
+ virtual void MacSetSelection( int n, bool select ) = 0;
+ virtual int MacGetSelection() const = 0;
+ virtual int MacGetSelections( wxArrayInt& aSelections ) const = 0;
+ virtual bool MacIsSelected( int n ) const = 0;
+ virtual void MacScrollTo( int n ) = 0;
+
+ wxListBox * GetPeer() const
+ { return (wxListBox*)m_peer; }
+};
+
+#if 0
+// In case we have to replace data browser ...
+// custom HIView-based implementation
+
+class wxMacCustomHIViewListControl : public wxMacListControl
+{
+public:
+ wxMacCustomHIViewListControl( wxListBox *peer, const wxPoint& pos, const wxSize& size, long style );
+ ~wxMacCustomHIViewListControl();
+
+ void MacDelete( int n );
+ void MacInsert( int n, const wxString& item );
+ void MacInsert( int n, const wxArrayString& items );
+ void MacAppend( const wxString& item );
+ void MacSet( int n, const wxString& item );
+ void MacClear();
+ void MacDeselectAll();
+ void MacSetSelection( int n, bool select );
+ int MacGetSelection() const;
+ int MacGetSelections( wxArrayInt& aSelections ) const;
+ bool MacIsSelected( int n ) const;
+ void MacScrollTo( int n );
+};
+#endif
+
+// DataBrowser-based implementation
+
+class wxMacDataBrowserListControl : public wxMacListControl
+{
+public:
+ wxMacDataBrowserListControl( wxListBox *peer, const wxPoint& pos, const wxSize& size, long style );
+ ~wxMacDataBrowserListControl();
+
+ void UpdateLine( int n );
+
+ void MacDelete( int n );
+ void MacInsert( int n, const wxString& item );
+ void MacInsert( int n, const wxArrayString& items );
+ void MacAppend( const wxString& item );
+ void MacSet( int n, const wxString& item );
+ void MacClear();
+ void MacDeselectAll();
+ void MacSetSelection( int n, bool select );
+ int MacGetSelection() const;
+ int MacGetSelections( wxArrayInt& aSelections ) const;
+ bool MacIsSelected( int n ) const;
+ void MacScrollTo( int n );
+
+ virtual OSStatus SetSelectionFlags( DataBrowserSelectionFlags );
+ virtual OSStatus AddListViewColumn( DataBrowserListViewColumnDesc *columnDesc,
+ DataBrowserTableViewColumnIndex position );
+ virtual OSStatus AutoSizeListViewColumns();
+ virtual OSStatus SetHasScrollBars( bool horiz, bool vert );
+ virtual OSStatus SetTableViewHiliteStyle( DataBrowserTableViewHiliteStyle hiliteStyle );
+ virtual OSStatus SetListViewHeaderBtnHeight( UInt16 height );
+ virtual OSStatus SetCallbacks( const DataBrowserCallbacks *callbacks );
+ virtual OSStatus UpdateItems( DataBrowserItemID container, UInt32 numItems,
+ const DataBrowserItemID *items,
+ DataBrowserPropertyID preSortProperty,
+ DataBrowserPropertyID propertyID );
+ virtual OSStatus AddItems( DataBrowserItemID container, UInt32 numItems,
+ const DataBrowserItemID *items,
+ DataBrowserPropertyID preSortProperty );
+ virtual OSStatus RemoveItems( DataBrowserItemID container, UInt32 numItems,
+ const DataBrowserItemID *items,
+ DataBrowserPropertyID preSortProperty );
+ virtual OSStatus RevealItem( DataBrowserItemID item,
+ DataBrowserPropertyID propertyID,
+ DataBrowserRevealOptions options );
+ virtual OSStatus GetSelectionAnchor( DataBrowserItemID *first, DataBrowserItemID *last ) const;
+ virtual bool IsItemSelected( DataBrowserItemID item ) const;
+ virtual OSStatus SetSelectedItems( UInt32 numItems,
+ const DataBrowserItemID *items,
+ DataBrowserSetOption operation );
+
+private:
+ // as we are getting the same events for human and API selection we have to suppress
+ // events in the latter case
+ bool MacSuppressSelection( bool suppress );
+ bool MacIsSelectionSuppressed() const { return m_suppressSelection; }
+
+ bool m_suppressSelection;
+
+#if TARGET_API_MAC_OSX
+ static pascal void DataBrowserItemNotificationProc(
+ ControlRef browser,
+ DataBrowserItemID itemID,
+ DataBrowserItemNotification message,
+ DataBrowserItemDataRef itemData );
+#else
+ static pascal void DataBrowserItemNotificationProc(
+ ControlRef browser,
+ DataBrowserItemID itemID,
+ DataBrowserItemNotification message );
+#endif
+};
+
+// ============================================================================
+// data browser based implementation
+// ============================================================================