#include "SHDesignerAPI.h"


SHDesignerAPI::SHDesignerAPI() {
}


SHDesignerAPI::~SHDesignerAPI() {
}


const QList<BlockItem *> SHDesignerAPI::sceneBlocks() {
	QList<BlockItem *> ret;
	sceneBlocksRequest(&ret);
	return ret;
}


BlockItem * SHDesignerAPI::addBlock(int id, QPoint pos) {
	BlockItem * ret = nullptr;
	emit newBlockRequest(id, pos, &ret);
	return ret;
}


BlockBusItem * SHDesignerAPI::connectPins(int id, BlockItemPin * p0, BlockItemPin * p1) {
	BlockBusItem * ret = nullptr;
	if (p0 == p1) return ret;
	connectBlocksRequest(id, p0->scenePos().toPoint(), p1->scenePos().toPoint(), &ret);
	return ret;
}


void SHDesignerAPI::prepareBlock(BlockItem * block) {
	prepareBlockRequest(block);
}
