diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 01:49:02 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-02-24 01:49:02 +0000 |
commit | 5de3dd4762ca33a0f92e79ffa4fe2ff67069d531 (patch) | |
tree | bad482b7afa4cdf47422d60a5dd2c61c7e333b09 /src/picitem.h | |
download | ktechlab-5de3dd4762ca33a0f92e79ffa4fe2ff67069d531.tar.gz ktechlab-5de3dd4762ca33a0f92e79ffa4fe2ff67069d531.zip |
Added KDE3 version of ktechlab
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1095338 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/picitem.h')
-rw-r--r-- | src/picitem.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/src/picitem.h b/src/picitem.h new file mode 100644 index 0000000..0474ba8 --- /dev/null +++ b/src/picitem.h @@ -0,0 +1,94 @@ +/*************************************************************************** + * Copyright (C) 2003,2005 by David Saxton * + * david@bluehaze.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#ifndef PICITEM_H +#define PICITEM_H + +#include "cnitem.h" + +#include <qobject.h> + +class MicroSettings; +class FlowCodeDocument; +class PinSettings; + +/** +@short Allows visual setting of pin type/state +@author David Saxton +*/ +class PinItem : public QObject, public QCanvasRectangle +{ + Q_OBJECT +public: + PinItem( FlowCodeDocument* _view, QPoint position, bool _onLeft, PinSettings *_pinSettings ); + + int rtti() const; + QRect boundingRect () const; + void switchState(); + + QString id(); + + /** + * Called from ICNDocument when the pin item was dragged + */ + void dragged( int dx ); + + virtual void moveBy ( double dx, double dy ); + +public slots: + void updateDrawing(); + +private: + void initItem(); + void drawShape( QPainter& p ); + void calcTextRect(); + + FlowCodeDocument *view; // Pointer to canvas view that the component item is currently on + bool onLeft; + PinSettings * m_pinSettings; + QRect m_textRect; + QFont m_font; +}; +typedef QValueList<PinItem*> PinItemList; + + +/** +Allows visual editing of inital PIC settings +@author David Saxton +*/ +class PicItem : public CNItem +{ + Q_OBJECT + public: + PicItem( ICNDocument *icnDocument, bool newItem, const char *id, MicroSettings *_microSettings ); + ~PicItem(); + + void drawShape( QPainter &p ); + + virtual void buttonStateChanged( const QString &id, bool state ); + virtual bool isMovable() const { return false; } + + static QString typeString() { return "microitem"; } + virtual void updateZ( int baseZ ); + + protected slots: + void slotMicroSettingsDlgAccepted(); + + protected: + void updateVisibility(); + + MicroSettings *microSettings; + PinItemList m_pinItemList; + ICNDocument *p_icnDocument; + bool m_bExpanded; + int m_innerHeight; +}; + +#endif |