rotoswitch.h

00001 /***************************************************************************
00002  *   Copyright (C) 2005 by John Myers                                      *
00003  *   electronerd@electronerdia.net                                         *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  ***************************************************************************/
00010 
00011 #ifndef ROTOSWITCH_H
00012 #define ROTOSWITCH_H
00013 
00014 #include "component.h"
00015 #include <qvaluevector.h>
00016 
00017 struct SwitchPosition
00018 {
00019     ECNode* node;
00020     Switch* posSwitch;
00021     bool isMomentary;
00022     int pinAngle;
00023 };
00024 
00029 class ECRotoSwitch : public Component
00030 {
00031 public:
00032     ECRotoSwitch( ICNDocument *icnDocument, bool newItem, const char *id = 0 );
00033     ~ECRotoSwitch();
00034     
00035     static Item* construct( ItemDocument *itemDocument, bool newItem, const char *id );
00036     static LibraryItem *libraryItem();
00037     
00038     virtual void buttonStateChanged( const QString &id, bool state );
00039     virtual void dataChanged();
00040     
00041 private:
00042     virtual void drawShape( QPainter &p );
00043     
00044     int m_numPositions;
00045     int m_curPosition;
00046     
00048     static const int _pinOuterRadius = 64;
00050     static const int _pinWidth = 8;
00052     static const int _pinInnerRadius = _pinOuterRadius - _pinWidth;
00054     static const int _wireGap = 7;
00056     static const int _contactOuterRadius  = _pinInnerRadius - _wireGap;
00058     static const int _contactRadius = 2;
00060     static const int _contactRingRadius = _contactOuterRadius - _contactRadius;
00061     
00062     QValueVector<SwitchPosition> m_positions;
00063     ECNode* m_inNode;
00064     
00065 protected:
00066     void setUpSwitches();
00067 protected:
00068     void setActivePosition(int newPosition);
00069 };
00070 #endif //ROTOSWITCH_H

Generated on Tue May 8 17:05:32 2007 for KTechLab by  doxygen 1.5.1