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

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 DEPENDENTSOURCE_H
0012 #define DEPENDENTSOURCE_H
0013 
0014 #include "component.h"
0015 
0016 /**
0017 @author David Saxton
0018 */
0019 class DependentSource : public Component
0020 {
0021 public:
0022     DependentSource(ICNDocument *icnDocument, bool newItem, const char *id);
0023     ~DependentSource() override;
0024 
0025 protected:
0026     void drawOutline(QPainter &p);
0027     void drawTopArrow(QPainter &p);
0028     void drawBottomArrow(QPainter &p);
0029 };
0030 
0031 /**
0032 @short Current Controlled Current Source
0033 @author David Saxton
0034 */
0035 class ECCCCS : public DependentSource
0036 {
0037 public:
0038     ECCCCS(ICNDocument *icnDocument, bool newItem, const char *id = nullptr);
0039     ~ECCCCS() override;
0040 
0041     static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id);
0042     static LibraryItem *libraryItem();
0043 
0044 protected:
0045     void dataChanged() override;
0046     void drawShape(QPainter &p) override;
0047 
0048     CCCS *m_cccs;
0049 };
0050 
0051 /**
0052 @short Current Controlled Voltage Source
0053 @author David Saxton
0054 */
0055 class ECCCVS : public DependentSource
0056 {
0057 public:
0058     ECCCVS(ICNDocument *icnDocument, bool newItem, const char *id = nullptr);
0059     ~ECCCVS() override;
0060 
0061     static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id);
0062     static LibraryItem *libraryItem();
0063 
0064 protected:
0065     void dataChanged() override;
0066     void drawShape(QPainter &p) override;
0067 
0068     CCVS *m_ccvs;
0069 };
0070 
0071 /**
0072 @short Voltage Controlled Current Source
0073 @author David Saxton
0074 */
0075 class ECVCCS : public DependentSource
0076 {
0077 public:
0078     ECVCCS(ICNDocument *icnDocument, bool newItem, const char *id = nullptr);
0079     ~ECVCCS() override;
0080 
0081     static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id);
0082     static LibraryItem *libraryItem();
0083 
0084 protected:
0085     void dataChanged() override;
0086     void drawShape(QPainter &p) override;
0087 
0088     VCCS *m_vccs;
0089 };
0090 
0091 /**
0092 @short Voltage Controlled Voltage Source
0093 @author David Saxton
0094 */
0095 class ECVCVS : public DependentSource
0096 {
0097 public:
0098     ECVCVS(ICNDocument *icnDocument, bool newItem, const char *id = nullptr);
0099     ~ECVCVS() override;
0100 
0101     static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id);
0102     static LibraryItem *libraryItem();
0103 
0104 protected:
0105     void dataChanged() override;
0106     void drawShape(QPainter &p) override;
0107 
0108     VCVS *m_vcvs;
0109 };
0110 
0111 #endif