schema_editor/comdel/display/component_display.h

56 lines
1.3 KiB
C
Raw Normal View History

2022-04-07 22:21:23 +00:00
#ifndef DISPLAY_COMPONENT_H
#define DISPLAY_COMPONENT_H
#include <comdel/domain/instance.h>
#include <comdel/domain/wireinstance.h>
#include <QGraphicsItemGroup>
namespace display {
2022-04-10 15:24:15 +00:00
class ComponentItem: public QGraphicsItemGroup
2022-04-07 22:21:23 +00:00
{
public:
2022-04-10 15:24:15 +00:00
ComponentItem(domain::ComponentInstance *instance, QGraphicsItem *parent);
void redraw();
private:
domain::ComponentInstance *componentInstance;
public:
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override;
};
2022-04-07 22:21:23 +00:00
2022-04-10 15:24:15 +00:00
class PinItem: public QGraphicsItemGroup
{
public:
PinItem(domain::Pin pin, QGraphicsItem *parent);
void redraw();
private:
domain::Pin pin;
};
class ComponentWrapper: public QGraphicsItemGroup
{
public:
static ComponentWrapper *ofComponent(domain::ComponentInstance *instance);
static ComponentWrapper *ofBus(domain::BusInstance *instance);
static ComponentWrapper *ofWire(domain::WireInstance *wire);
ComponentWrapper() {
this->setHandlesChildEvents(false);
}
2022-04-07 22:21:23 +00:00
void redraw();
private:
domain::ComponentInstance *componentInstance = nullptr;
domain::BusInstance *busInstance = nullptr;
domain::WireInstance *wireInstance = nullptr;
2022-04-10 15:24:15 +00:00
ComponentItem *componentItem;
std::vector<PinItem*> pinItems;
2022-04-07 22:21:23 +00:00
};
} // namespace display
#endif // DISPLAY_COMPONENT_H