File indexing completed on 2024-05-05 05:46:05

0001 /***************************************************************************
0002  *   Copyright (C) 2005 by David Saxton                                    *
0003  *   david@bluehaze.org                                                    *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  ***************************************************************************/
0010 
0011 #ifndef ECSUBCIRCUIT_H
0012 #define ECSUBCIRCUIT_H
0013 
0014 #include <component.h>
0015 
0016 #include <QVector>
0017 
0018 /**
0019 "Container" component for subcircuits
0020 @author David Saxton
0021 */
0022 class ECSubcircuit : public Component
0023 {
0024     Q_OBJECT
0025 public:
0026     ECSubcircuit(ICNDocument *icnDocument, bool newItem, const char *id = nullptr);
0027     ~ECSubcircuit() override;
0028 
0029     static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id);
0030     static LibraryItem *libraryItem();
0031 
0032     /**
0033      * Create numExtCon nodes, deleting any old ones
0034      */
0035     void setNumExtCon(unsigned numExtCon);
0036     /**
0037      * Give the connecting node at position numId the given name
0038      */
0039     void setExtConName(unsigned numId, const QString &name);
0040     /**
0041      * Called from SubcircuitData once the subcircuit has been fully attached
0042      */
0043     void doneSCInit();
0044 
0045 public slots:
0046     void removeItem() override;
0047 
0048 signals:
0049     /**
0050      * Emitted when the current subcircuit is deleted
0051      */
0052     void subcircuitDeleted();
0053 
0054 protected:
0055     void dataChanged() override;
0056     void drawShape(QPainter &p) override;
0057     QVector<QString> m_conNames;
0058 };
0059 
0060 #endif