#ifndef DISPLAY_COMPONENT_H #define DISPLAY_COMPONENT_H #include #include #include namespace display { class ComponentItem: public QGraphicsItemGroup { public: ComponentItem(domain::ComponentInstance *instance, QGraphicsItem *parent); void redraw(); private: domain::ComponentInstance *componentInstance; public: void contextMenuEvent(QGraphicsSceneContextMenuEvent *event) override; }; 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); } void redraw(); private: domain::ComponentInstance *componentInstance = nullptr; domain::BusInstance *busInstance = nullptr; domain::WireInstance *wireInstance = nullptr; ComponentItem *componentItem; std::vector pinItems; }; } // namespace display #endif // DISPLAY_COMPONENT_H