File indexing completed on 2024-05-19 09:39:09
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 TOGGLESWITCH_H 0012 #define TOGGLESWITCH_H 0013 0014 #include "component.h" 0015 0016 /** 0017 @short Double Pole Double Throw 0018 @author David Saxton 0019 */ 0020 class ECDPDT : public Component 0021 { 0022 public: 0023 ECDPDT(ICNDocument *icnDocument, bool newItem, const char *id = nullptr); 0024 ~ECDPDT() override; 0025 0026 static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id); 0027 static LibraryItem *libraryItem(); 0028 0029 void buttonStateChanged(const QString &id, bool state) override; 0030 void dataChanged() override; 0031 0032 private: 0033 void drawShape(QPainter &p) override; 0034 0035 Switch *m_switch1; 0036 Switch *m_switch2; 0037 Switch *m_switch3; 0038 Switch *m_switch4; 0039 bool pressed; 0040 }; 0041 0042 /** 0043 @short Double Pole Single Throw 0044 @author David Saxton 0045 */ 0046 class ECDPST : public Component 0047 { 0048 public: 0049 ECDPST(ICNDocument *icnDocument, bool newItem, const char *id = nullptr); 0050 ~ECDPST() override; 0051 0052 static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id); 0053 static LibraryItem *libraryItem(); 0054 0055 void buttonStateChanged(const QString &id, bool state) override; 0056 void dataChanged() override; 0057 0058 private: 0059 void drawShape(QPainter &p) override; 0060 0061 Switch *m_switch1; 0062 Switch *m_switch2; 0063 bool pressed; 0064 }; 0065 0066 /** 0067 @short Single Pole Double Throw 0068 @author David Saxton 0069 */ 0070 class ECSPDT : public Component 0071 { 0072 public: 0073 ECSPDT(ICNDocument *icnDocument, bool newItem, const char *id = nullptr); 0074 ~ECSPDT() override; 0075 0076 static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id); 0077 static LibraryItem *libraryItem(); 0078 0079 void buttonStateChanged(const QString &id, bool state) override; 0080 void dataChanged() override; 0081 0082 private: 0083 void drawShape(QPainter &p) override; 0084 0085 Switch *m_switch1; 0086 Switch *m_switch2; 0087 bool pressed; 0088 }; 0089 0090 /** 0091 @short Single-Pole Single-Throw Switch 0092 @author David Saxton 0093 */ 0094 class ECSPST : public Component 0095 { 0096 public: 0097 ECSPST(ICNDocument *icnDocument, bool newItem, const char *id = nullptr); 0098 ~ECSPST() override; 0099 0100 static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id); 0101 static LibraryItem *libraryItem(); 0102 0103 void buttonStateChanged(const QString &id, bool state) override; 0104 void dataChanged() override; 0105 0106 private: 0107 void drawShape(QPainter &p) override; 0108 Switch *m_switch; 0109 bool pressed; 0110 }; 0111 0112 #endif