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