1 /*************************************************************************** 2 * Copyright (C) 2005 by David Saxton * 3 * david@bluehaze.org * 4 * * 5 * This program is free software; you can redistribute it and/or modify * 6 * it under the terms of the GNU General Public License as published by * 7 * the Free Software Foundation; either version 2 of the License, or * 8 * (at your option) any later version. * 9 ***************************************************************************/ 10 11 #ifndef PUSHSWITCH_H 12 #define PUSHSWITCH_H 13 14 #include "component.h" 15 16 /** 17 @short Push-to-Break switch component 18 @author David Saxton 19 */ 20 class ECPTBSwitch : public Component 21 { 22 public: 23 ECPTBSwitch( ICNDocument *icnDocument, bool newItem, const char *id = nullptr ); 24 ~ECPTBSwitch() override; 25 26 static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id ); 27 static LibraryItem *libraryItem(); 28 29 void buttonStateChanged( const QString &id, bool state ) override; 30 void dataChanged() override; 31 32 private: 33 void drawShape( QPainter &p ) override; 34 Switch *m_switch; 35 bool pressed; 36 }; 37 38 39 /** 40 @short Push-to-make switch 41 @author David Saxton 42 */ 43 class ECPTMSwitch : public Component 44 { 45 public: 46 ECPTMSwitch( ICNDocument *icnDocument, bool newItem, const char *id = nullptr ); 47 ~ECPTMSwitch() override; 48 49 static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id ); 50 static LibraryItem *libraryItem(); 51 52 void buttonStateChanged( const QString &id, bool state ) override; 53 void dataChanged() override; 54 55 private: 56 void drawShape( QPainter &p ) override; 57 58 Switch *m_switch; 59 bool pressed; 60 }; 61 62 63 #endif 64