+wxClientDataType wxMacDataItemBrowserControl::GetClientDataType() const
+{
+ return m_clientDataItemsType;
+}
+void wxMacDataItemBrowserControl::SetClientDataType(wxClientDataType clientDataItemsType)
+{
+ m_clientDataItemsType = clientDataItemsType;
+}
+
+unsigned int wxMacDataItemBrowserControl::MacGetCount() const
+{
+ return GetItemCount(wxMacDataBrowserRootContainer,false,kDataBrowserItemAnyState);
+}
+
+void wxMacDataItemBrowserControl::MacDelete( unsigned int n )
+{
+ wxMacDataItem* item = (wxMacDataItem*)GetItemFromLine( n );
+ RemoveItem( wxMacDataBrowserRootContainer, item );
+}
+
+void wxMacDataItemBrowserControl::MacInsert( unsigned int n,
+ const wxArrayStringsAdapter& items,
+ int column )
+{
+ size_t itemsCount = items.GetCount();
+ if ( itemsCount == 0 )
+ return;
+
+ SInt32 frontLineOrder = 0;
+
+ if ( m_sortOrder == SortOrder_None )
+ {
+ // increase the order of the lines to be shifted
+ unsigned int lines = MacGetCount();
+ for ( unsigned int i = n; i < lines; ++i)
+ {
+ wxMacDataItem* iter = (wxMacDataItem*) GetItemFromLine(i);
+ iter->SetOrder( iter->GetOrder() + itemsCount );
+ }
+ if ( n > 0 )
+ {
+ wxMacDataItem* iter = (wxMacDataItem*) GetItemFromLine(n-1);
+ frontLineOrder = iter->GetOrder();
+ }
+ }
+
+ wxArrayMacDataItemPtr ids;
+ ids.SetCount( itemsCount );
+
+ for ( unsigned int i = 0; i < itemsCount; ++i )
+ {
+ wxMacDataItem* item = CreateItem();
+ item->SetLabel( items[i]);
+ if ( column != -1 )
+ item->SetColumn( kMinColumnId + column );
+
+ if ( m_sortOrder == SortOrder_None )
+ item->SetOrder( frontLineOrder + 1 + i );
+
+ ids[i] = item;
+ }
+
+ AddItems( wxMacDataBrowserRootContainer, ids );
+}
+
+int wxMacDataItemBrowserControl::MacAppend( const wxString& text)
+{
+ wxMacDataItem* item = CreateItem();
+ item->SetLabel( text );
+ if ( m_sortOrder == SortOrder_None )
+ {
+ unsigned int lines = MacGetCount();
+ if ( lines == 0 )
+ item->SetOrder( 1 );
+ else
+ {
+ wxMacDataItem* frontItem = (wxMacDataItem*) GetItemFromLine(lines-1);
+ item->SetOrder( frontItem->GetOrder() + 1 );
+ }
+ }
+ AddItem( wxMacDataBrowserRootContainer, item );
+
+ return GetLineFromItem(item);
+}
+
+void wxMacDataItemBrowserControl::MacClear()
+{
+ wxMacDataItemBrowserSelectionSuppressor suppressor(this);
+ RemoveAllItems(wxMacDataBrowserRootContainer);
+}
+
+void wxMacDataItemBrowserControl::MacDeselectAll()
+{
+ wxMacDataItemBrowserSelectionSuppressor suppressor(this);
+ SetSelectedAllItems( kDataBrowserItemsRemove );
+}
+
+void wxMacDataItemBrowserControl::MacSetSelection( unsigned int n, bool select, bool multi )
+{
+ wxMacDataItem* item = (wxMacDataItem*) GetItemFromLine(n);
+ wxMacDataItemBrowserSelectionSuppressor suppressor(this);
+
+ if ( IsItemSelected( item ) != select )
+ {
+ if ( select )
+ SetSelectedItem( item, multi ? kDataBrowserItemsAdd : kDataBrowserItemsAssign );
+ else
+ SetSelectedItem( item, kDataBrowserItemsRemove );
+ }
+
+ MacScrollTo( n );
+}
+
+bool wxMacDataItemBrowserControl::MacIsSelected( unsigned int n ) const
+{
+ wxMacDataItem* item = (wxMacDataItem*) GetItemFromLine(n);
+ return IsItemSelected( item );
+}
+
+int wxMacDataItemBrowserControl::MacGetSelection() const
+{
+ wxMacDataItemPtr first, last;
+ GetSelectionAnchor( &first, &last );
+
+ if ( first != NULL )
+ {
+ return GetLineFromItem( first );
+ }
+
+ return -1;
+}
+
+int wxMacDataItemBrowserControl::MacGetSelections( wxArrayInt& aSelections ) const
+{
+ aSelections.Empty();
+ wxArrayMacDataItemPtr selectedItems;
+ GetItems( wxMacDataBrowserRootContainer, false , kDataBrowserItemIsSelected, selectedItems);
+
+ int count = selectedItems.GetCount();
+
+ for ( int i = 0; i < count; ++i)
+ {
+ aSelections.Add(GetLineFromItem(selectedItems[i]));
+ }
+
+ return count;
+}
+
+void wxMacDataItemBrowserControl::MacSetString( unsigned int n, const wxString& text )
+{
+ // as we don't store the strings we only have to issue a redraw
+ wxMacDataItem* item = (wxMacDataItem*) GetItemFromLine( n);
+ item->SetLabel( text );
+ UpdateItem( wxMacDataBrowserRootContainer, item , kTextColumnId );
+}
+
+wxString wxMacDataItemBrowserControl::MacGetString( unsigned int n ) const
+{
+ wxMacDataItem * item = (wxMacDataItem*) GetItemFromLine( n );
+ return item->GetLabel();
+}
+
+void wxMacDataItemBrowserControl::MacSetClientData( unsigned int n, void * data)
+{
+ wxMacDataItem* item = (wxMacDataItem*) GetItemFromLine( n);
+ item->SetData( data );
+ // not displayed, therefore no Update infos to DataBrowser
+}
+
+void * wxMacDataItemBrowserControl::MacGetClientData( unsigned int n) const
+{
+ wxMacDataItem * item = (wxMacDataItem*) GetItemFromLine( n );
+ return item->GetData();
+}
+
+void wxMacDataItemBrowserControl::MacScrollTo( unsigned int n )
+{
+ RevealItem( GetItemFromLine( n) , kDataBrowserRevealWithoutSelecting );
+}
+