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

0001 /***************************************************************************
0002  *   Copyright (C) 2006 by William Hillerby - william.hillerby@ntlworld.com*
0003  *                                                                         *
0004  *   This program is free software; you can redistribute it and/or modify  *
0005  *   it under the terms of the GNU General Public License as published by  *
0006  *   the Free Software Foundation; either version 2 of the License, or     *
0007  *   (at your option) any later version.                                   *
0008  ***************************************************************************/
0009 
0010 #ifndef VARIABLERESISTOR_H
0011 #define VARIABLERESISTOR_H
0012 
0013 #include <component.h>
0014 
0015 class Resistance;
0016 class QSlider;
0017 
0018 /**
0019 @author William Hillerby
0020 */
0021 
0022 class VariableResistor : public Component
0023 {
0024 public:
0025     VariableResistor(ICNDocument *icnDocument, bool newItem, const QString &id = nullptr);
0026     ~VariableResistor() override;
0027 
0028     static Item *construct(ItemDocument *itemDocument, bool newItem, const char *id);
0029     static LibraryItem *libraryItem();
0030 
0031     void sliderValueChanged(const QString &id, int newValue) override;
0032 
0033 private:
0034     void dataChanged() override;
0035     void drawShape(QPainter &p) override;
0036 
0037     Resistance *m_pResistance;
0038     QSlider *m_pSlider;
0039     double m_minResistance;
0040     double m_maxResistance;
0041     double m_currResistance;
0042     double m_tickValue;
0043 };
0044 
0045 #endif