void
HEventList::RemoveAll()
{
	BRow* row;
	while ((row = RowAt((int32)0, NULL)) != NULL) {
		RemoveRow(row);
		delete row;
	}
}
Exemplo n.º 2
0
void _OwqList::ReplacePreferences(BMessage& prefs)
{
	while( prefs.HasMessage( OPEN_FROM_QUERY_PREF ) )
		prefs.RemoveData( OPEN_FROM_QUERY_PREF );
	_OwqRow*	row;
	for( int32 k = 0; (row = dynamic_cast<_OwqRow*>( RowAt(k) )); k++ ) {
		BMessage	msg;
		if( row->GetPreferences( &msg ) == B_OK ) prefs.AddMessage( OPEN_FROM_QUERY_PREF, &msg );
	}
}
Exemplo n.º 3
0
void	ListView1::MessageDropped(BMessage *msg, BPoint point) {
printf("MessageDropped():");
	switch(msg->what) {
		case B_MOUSE_DOWN: printf("B_MOUSE_DOWN\n");break;
		case B_SIMPLE_DATA: be_app->PostMessage(msg); break;
		case B_MOUSE_MOVED: printf("B_MOUSE_MOVED\n");break;
		case LISTITEM_DROPPED: 	printf("LISTITEM_DROPPED\n");
				if ((CDMode!=AUDIOCD_INDEX) && (CDMode!=CDEXTRA_INDEX)) break;
				if (msg->WasDropped()) {
					BPoint where=msg->DropPoint();
					ConvertFromScreen(&where);
					where.PrintToStream();
					BRow *draggedRow=NULL;
					if ((CDMode==DATACD_INDEX) || (CDMode==BOOTABLECD_INDEX) || (CDMode==DVDVIDEO_INDEX)) {	// yes? then we are not in audio mode
						draggedRow=folderRow;
					} else
					if ((CDMode==AUDIOCD_INDEX) || (CDMode==CDEXTRA_INDEX)) {
						draggedRow=audioRow;
					}
					void	*row;
					msg->FindPointer("from", &row);
					if (RowAt(where)) {
						int32 index=IndexOf(RowAt(where));
						if (index>0) index--;
						AddRow(draggedRow, index);
					} else
						AddRow(draggedRow);
					RemoveRow(IndexOf((BRow *)row));
					Invalidate();
					ResetTrackNumbers();
					//Refresh();
					
					project_has_changed=true;
				}
				break;
		default:  BColumnListView::MessageDropped(msg, point);
	}
}
Exemplo n.º 4
0
TeamRow*
TeamsListView::FindTeamRow(team_id teamId)
{
	for (int32 i = CountRows(); i-- > 0;) {
		TeamRow* row = dynamic_cast<TeamRow*>(RowAt(i));
		if (row == NULL)
			continue;

		if (row->TeamID() == teamId)
			return row;
	}

	return NULL;
}
int32
PartitionListView::_InsertIndexForOffset(PartitionListRow* parent,
	off_t offset) const
{
	int32 index = 0;
	int32 count = CountRows(parent);
	for (; index < count; index++) {
		const PartitionListRow* item
			= dynamic_cast<const PartitionListRow*>(RowAt(index, parent));
		if (item && item->Offset() > offset)
			break;
	}
	return index;
}
Exemplo n.º 6
0
PackageRow*
PackageListView::_FindRow(const PackageInfoRef& package, PackageRow* parent)
{
    for (int32 i = CountRows(parent) - 1; i >= 0; i--) {
        PackageRow* row = dynamic_cast<PackageRow*>(RowAt(i, parent));
        if (row != NULL && row->Package() == package)
            return row;
        if (CountRows(row) > 0) {
            // recurse into child rows
            row = _FindRow(package, row);
            if (row != NULL)
                return row;
        }
    }

    return NULL;
}
PartitionListRow*
PartitionListView::FindRow(partition_id id, PartitionListRow* parent)
{
	for (int32 i = 0; i < CountRows(parent); i++) {
		PartitionListRow* item
			= dynamic_cast<PartitionListRow*>(RowAt(i, parent));
		if (item != NULL && item->ID() == id)
			return item;
		if (CountRows(item) > 0) {
			// recurse into child rows
			item = FindRow(id, item);
			if (item)
				return item;
		}
	}

	return NULL;
}
Exemplo n.º 8
0
void _OwqList::MessageDropped(BMessage* msg, BPoint point)
{
	inherited::MessageDropped(msg, point);
	entry_ref		ref;
	if( msg->FindRef( "refs", &ref ) == B_OK ) {
		_OwqRow*	row = dynamic_cast<_OwqRow*>( RowAt(point) );
		if( !row ) {
			BMessage	prefs;
			prefs.AddBool( "on", true );
			prefs.AddRef( "ref", &ref );
			row = new _OwqRow( &prefs, view_font_height(this) );
			if( row )  AddRow( row );
		} else {
			row->SetRef( ref );
			UpdateRow(row);
		}
	}
}
Exemplo n.º 9
0
void _OwqList::Add(BMessage* msg)
{
	if( !msg ) return;
	BMessage	newItem, oldItem;
	if( msg->FindMessage( "new item", &newItem ) != B_OK ) return;
	if( msg->FindMessage( "old item", &oldItem ) == B_OK ) {
		_OwqRow*	row;
		for( int32 k = 0; (row = dynamic_cast<_OwqRow*>( RowAt(k) )); k++ ) {
			if( row->Matches( oldItem ) ) {
				row->SetPreferences( &newItem );
				UpdateRow( row );
				return;
			}
		}
	}

	_OwqRow*	row = new _OwqRow( &newItem, view_font_height(this) );
	if( row )  AddRow( row );
}
Exemplo n.º 10
0
PackageRow*
PackageListView::_FindRow(const BString& packageTitle, PackageRow* parent)
{
    for (int32 i = CountRows(parent) - 1; i >= 0; i--) {
        PackageRow* row = dynamic_cast<PackageRow*>(RowAt(i, parent));
        if (row != NULL && row->Package().Get() != NULL
                && row->Package()->Title() == packageTitle) {
            return row;
        }
        if (CountRows(row) > 0) {
            // recurse into child rows
            row = _FindRow(packageTitle, row);
            if (row != NULL)
                return row;
        }
    }

    return NULL;
}
Exemplo n.º 11
0
void GeneratorTag :: Generate( Model * model ) {

	std::ostream & os = FileManager::Instance().GetStream( mOutFile );
	int nrows = mCount < 0 ? GetSize() : mCount;
	bool debug = false; // model->Debug() || Debug();

	if ( debug ) {
		std::cerr << "----- begin " << Name() << "\n";
	}

	if ( mFields.Size() ) {
		Row r;
		for ( unsigned int i = 0; i < mFields.Size(); i++ ) {
			r.AppendValue( mFields.At( i ) );
		}
		if ( debug ) {
			DebugRow( r, std::cerr );
		}
		os << r.AsCSV() << "\n";
	}

	while( nrows-- ) {
		Row r = Get();
		if ( debug ) {
			DebugRow( r, std::cerr );
		}
		if ( ! HasGroup() ) {
			os << r.AsCSV() << "\n";
		}
		AddRow( r );
	}

	if ( HasGroup() ) {
		DoGroup();
		for ( int i = 0; i < Size(); i++ ) {
			os << RowAt(i).AsCSV() << "\n";
		}
	}

	if ( debug ) {
		std::cerr << "----- end   " << Name() << "\n";
	}
}
bool
PartitionListView::InitiateDrag(BPoint rowPoint, bool wasSelected)
{
	PartitionListRow* draggedRow
		= dynamic_cast<PartitionListRow*>(RowAt(rowPoint));
	if (draggedRow == NULL)
		return false;

	const char* draggedPath = draggedRow->DevicePath();
	if (draggedPath == NULL)
		return false;

	BRect draggedRowRect;
	GetRowRect(draggedRow, &draggedRowRect);

	BMessage dragMessage(B_MIME_DATA);
	dragMessage.AddData("text/plain", B_MIME_TYPE, draggedPath,
		strlen(draggedPath));

	DragMessage(&dragMessage, draggedRowRect, NULL);
	return true;
}
Exemplo n.º 13
0
bool
TreeTable::GetToolTipAt(BPoint point, BToolTip** _tip)
{
	if (fToolTipProvider == NULL)
		return AbstractTable::GetToolTipAt(point, _tip);

	// get the table row
	BRow* row = RowAt(point);
	if (row == NULL)
		return AbstractTable::GetToolTipAt(point, _tip);

	TreeTableRow* treeRow = dynamic_cast<TreeTableRow*>(row);
	// get the table column
	BColumn* column = ColumnAt(point);

	int32 columnIndex = column != NULL ? column->LogicalFieldNum() : -1;

	TreeTablePath path;
	_GetPathForNode(treeRow->Node(), path);

	return fToolTipProvider->GetToolTipForTablePath(path, columnIndex,
		_tip);
}
Exemplo n.º 14
0
void ListView1::RemoveRow(int32 index) {
	BRow *row=RowAt(index);
	BColumnListView::RemoveRow(row);
	delete row;
}
Exemplo n.º 15
0
void ListView1::ResetTrackNumbers() {
	for (int i=0; i<CountRows(); i++) {
		((AudioRow *)RowAt(i))->SetTrackNumber(i+1);
	}
}