-
-wxMacListBoxItem* wxMacDataBrowserListControl::CreateItem()
-{
- return new wxMacListBoxItem();
-}
-
-wxListBox * wxMacDataBrowserListControl::GetPeer() const
-{
- 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()