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

0001 /***************************************************************************
0002  *   Copyright (C) 2003,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 ECKEYPAD_H
0012 #define ECKEYPAD_H
0013 
0014 #include "component.h"
0015 
0016 /**
0017 @short 4x3 PTM Keypad
0018 @author David Saxton
0019 */
0020 class ECKeyPad : public Component
0021 {
0022 public:
0023     ECKeyPad(ICNDocument *icnDocument, bool newItem, const char *id = nullptr);
0024     ~ECKeyPad() 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 
0031 protected:
0032     void dataChanged() override;
0033     void initPins(unsigned numCols);
0034     QString buttonID(int row, int col) const;
0035     int sideLength(unsigned numButtons) const;
0036 
0037     Switch *m_switch[4][11];
0038     unsigned m_numCols;
0039 };
0040 
0041 #endif