| 1 | // File: memorycellgraphicsitem.h |
| 2 | /* |
| 3 | Pep8-1 is a virtual machine for writing machine language and assembly |
| 4 | language programs. |
| 5 | |
| 6 | Copyright (C) 2009 J. Stanley Warford, Pepperdine University |
| 7 | |
| 8 | This program is free software: you can redistribute it and/or modify |
| 9 | it under the terms of the GNU General Public License as published by |
| 10 | the Free Software Foundation, either version 3 of the License, or |
| 11 | (at your option) any later version. |
| 12 | |
| 13 | This program is distributed in the hope that it will be useful, |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | GNU General Public License for more details. |
| 17 | |
| 18 | You should have received a copy of the GNU General Public License |
| 19 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | */ |
| 21 | |
| 22 | #ifndef MEMORYCELLGRAPHICSITEM_H |
| 23 | #define MEMORYCELLGRAPHICSITEM_H |
| 24 | |
| 25 | #include <QGraphicsItem> |
| 26 | #include "enu.h" |
| 27 | |
| 28 | class MemoryCellGraphicsItem : public QGraphicsItem |
| 29 | { |
| 30 | public: |
| 31 | MemoryCellGraphicsItem(int addr, QString sym, Enu::ESymbolFormat eSymFrmt, int xLoc, int yLoc); |
| 32 | ~MemoryCellGraphicsItem() { } |
| 33 | |
| 34 | QRectF boundingRect() const; |
| 35 | |
| 36 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *); |
| 37 | |
| 38 | static const int boxHeight; |
| 39 | static const int boxWidth; |
| 40 | static const int addressWidth; |
| 41 | static const int symbolWidth; |
| 42 | static const int bufferWidth; |
| 43 | static int cellSize(Enu::ESymbolFormat symbolFormat); |
| 44 | |
| 45 | QString value; |
| 46 | QColor boxColor; |
| 47 | QColor boxBgColor; |
| 48 | QColor textColor; |
| 49 | QColor boxTextColor; |
| 50 | void updateValue(); |
| 51 | int getAddress(); |
| 52 | int getNumBytes(); |
| 53 | |
| 54 | private: |
| 55 | int x; |
| 56 | int y; |
| 57 | int address; |
| 58 | Enu::ESymbolFormat eSymbolFormat; |
| 59 | QString symbol; |
| 60 | QRectF box; |
| 61 | |
| 62 | }; |
| 63 | |
| 64 | #endif // MEMORYCELLGRAPHICSITEM_H |