- return wxDynamicCast( wxMacControl::GetPeer() , wxListBox );
-}
-
-wxClientDataType wxMacDataBrowserListControl::GetClientDataType() const
-{
- return m_clientDataItemsType;
-}
-void wxMacDataBrowserListControl::SetClientDataType(wxClientDataType clientDataItemsType)
-{
- m_clientDataItemsType = clientDataItemsType;
-}
-
-unsigned int wxMacDataBrowserListControl::MacGetCount() const
-{
- return GetItemCount(wxMacDataBrowserRootContainer,false,kDataBrowserItemAnyState);
-}
-
-void wxMacDataBrowserListControl::MacDelete( unsigned int n )
-{
- wxMacListBoxItem* item = (wxMacListBoxItem*)GetItemFromLine( n );
- RemoveItem( wxMacDataBrowserRootContainer, item );
-}
-
-void wxMacDataBrowserListControl::MacInsert( unsigned int n, const wxString& text)
-{
- wxMacListBoxItem* newItem = CreateItem();
- newItem->SetLabel( text );
-
- if ( !m_stringSorted )
- {
- // increase the order of the lines to be shifted
- unsigned int lines = MacGetCount();
- for ( unsigned int i = n; i < lines; ++i)
- {
- wxMacListBoxItem* iter = (wxMacListBoxItem*) GetItemFromLine(i);
- iter->SetOrder( iter->GetOrder() + 1 );
- }
-
- SInt32 frontLineOrder = 0;
- if ( n > 0 )
- {
- wxMacListBoxItem* iter = (wxMacListBoxItem*) GetItemFromLine(n-1);
- frontLineOrder = iter->GetOrder();
- }
- newItem->SetOrder( frontLineOrder + 1 );
- }
-
- AddItem( wxMacDataBrowserRootContainer, newItem );
-}
-
-void wxMacDataBrowserListControl::MacInsert( unsigned int n, const wxArrayString& items)
-{
- size_t itemsCount = items.GetCount();
- if ( itemsCount == 0 )
- return;
-
- SInt32 frontLineOrder = 0;
-
- if ( !m_stringSorted )
- {
- // increase the order of the lines to be shifted
- unsigned int lines = MacGetCount();
- for ( unsigned int i = n; i < lines; ++i)
- {
- wxMacListBoxItem* iter = (wxMacListBoxItem*) GetItemFromLine(i);
- iter->SetOrder( iter->GetOrder() + itemsCount );
- }
- if ( n > 0 )
- {
- wxMacListBoxItem* iter = (wxMacListBoxItem*) GetItemFromLine(n-1);
- frontLineOrder = iter->GetOrder();
- }
- }
-
- wxArrayMacDataItemPtr ids;
- ids.SetCount( itemsCount );
-
- for ( unsigned int i = 0; i < itemsCount; ++i )
- {
- wxMacListBoxItem* item = CreateItem();
- item->SetLabel( items[i]);
- if ( !m_stringSorted )
- item->SetOrder( frontLineOrder + 1 + i );
-
- ids[i] = item;
- }
-
- AddItems( wxMacDataBrowserRootContainer, ids );
-}
-
-int wxMacDataBrowserListControl::MacAppend( const wxString& text)
-{
- wxMacListBoxItem* item = CreateItem();
- item->SetLabel( text );
- if ( !m_stringSorted )
- {
- unsigned int lines = MacGetCount();
- if ( lines == 0 )
- item->SetOrder( 1 );
- else
- {
- wxMacListBoxItem* frontItem = (wxMacListBoxItem*) GetItemFromLine(lines-1);
- item->SetOrder( frontItem->GetOrder() + 1 );
- }
- }
- AddItem( wxMacDataBrowserRootContainer, item );
-
- return GetLineFromItem(item);
-}
-
-void wxMacDataBrowserListControl::MacClear()
-{
- wxMacDataItemBrowserSelectionSuppressor suppressor(this);
- RemoveAllItems(wxMacDataBrowserRootContainer);
-}
-
-void wxMacDataBrowserListControl::MacDeselectAll()
-{
- wxMacDataItemBrowserSelectionSuppressor suppressor(this);
- SetSelectedAllItems( kDataBrowserItemsRemove );
-}
-
-void wxMacDataBrowserListControl::MacSetSelection( unsigned int n, bool select )
-{
- wxMacListBoxItem* item = (wxMacListBoxItem*) GetItemFromLine(n);
- wxMacDataItemBrowserSelectionSuppressor suppressor(this);
-
- if ( IsItemSelected( item ) != select )
- {
- if ( select )
- SetSelectedItem( item, GetPeer()->HasMultipleSelection() ? kDataBrowserItemsAdd : kDataBrowserItemsAssign );
- else
- SetSelectedItem( item, kDataBrowserItemsRemove );
- }
-
- MacScrollTo( n );
-}
-
-bool wxMacDataBrowserListControl::MacIsSelected( unsigned int n ) const
-{
- wxMacListBoxItem* item = (wxMacListBoxItem*) GetItemFromLine(n);
- return IsItemSelected( item );
-}
-
-int wxMacDataBrowserListControl::MacGetSelection() const
-{
- wxMacDataItemPtr first, last;
- GetSelectionAnchor( &first, &last );
-
- if ( first != NULL )
- {
- return GetLineFromItem( first );
- }
-
- return -1;
-}
-
-int wxMacDataBrowserListControl::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 wxMacDataBrowserListControl::MacSetString( unsigned int n, const wxString& text )
-{
- // as we don't store the strings we only have to issue a redraw
- wxMacListBoxItem* item = (wxMacListBoxItem*) GetItemFromLine( n);
- item->SetLabel( text );
- UpdateItem( wxMacDataBrowserRootContainer, item , kTextColumnId );
-}
-
-wxString wxMacDataBrowserListControl::MacGetString( unsigned int n ) const
-{
- wxMacListBoxItem * item = (wxMacListBoxItem*) GetItemFromLine( n );
- return item->GetLabel();
-}
-
-void wxMacDataBrowserListControl::MacSetClientData( unsigned int n, void * data)
-{
- wxMacListBoxItem* item = (wxMacListBoxItem*) GetItemFromLine( n);
- item->SetData( data );
- // not displayed, therefore no Update infos to DataBrowser
-}
-
-void * wxMacDataBrowserListControl::MacGetClientData( unsigned int n) const
-{
- wxMacListBoxItem * item = (wxMacListBoxItem*) GetItemFromLine( n );
- return item->GetData();
-}
-
-void wxMacDataBrowserListControl::MacScrollTo( unsigned int n )
-{
- RevealItem( GetItemFromLine( n) , kDataBrowserRevealWithoutSelecting );