PageRenderTime 19ms CodeModel.GetById 12ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/inc/graphics/displaycell.h

https://code.google.com/p/dwarftherapist/
C++ Header | 54 lines | 24 code | 8 blank | 22 comment | 0 complexity | d39e84a4b54e5d98b7e655314e91d515 MD5 | raw file
 1/*
 2Dwarf Therapist
 3Copyright (c) 2010 Trey Stout (chmod)
 4
 5Permission is hereby granted, free of charge, to any person obtaining a copy
 6of this software and associated documentation files (the "Software"), to deal
 7in the Software without restriction, including without limitation the rights
 8to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 9copies of the Software, and to permit persons to whom the Software is
10furnished to do so, subject to the following conditions:
11
12The above copyright notice and this permission notice shall be included in
13all copies or substantial portions of the Software.
14
15THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21THE SOFTWARE.
22*/
23#ifndef DISPLAYCELL_H
24#define DISPLAYCELL_H
25
26#include <QtGui>
27
28static const int box_w = 16;
29static const int box_h = 16;
30
31class DisplayCell : public QGraphicsObject {
32    Q_OBJECT
33public:
34    DisplayCell(QGraphicsItem *parent = 0);
35
36    QRectF boundingRect() const;
37    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
38               QWidget *widget);
39
40public slots:
41    void hide_me() {hide();}
42    void show_me() {show();}
43
44protected:
45    void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
46    void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
47    void mousePressEvent(QGraphicsSceneMouseEvent *event);
48    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
49    void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
50
51private:
52};
53
54#endif // DISPLAYCELL_H