1 #ifndef ZONEVIEWERZONE_H
2 #define ZONEVIEWERZONE_H
3 
4 #include "selectzone.h"
5 
6 #include <QGraphicsLayoutItem>
7 
8 class ZoneViewWidget;
9 class Response;
10 class ServerInfo_Card;
11 class QGraphicsSceneWheelEvent;
12 
13 class ZoneViewZone : public SelectZone, public QGraphicsLayoutItem
14 {
15     Q_OBJECT
16     Q_INTERFACES(QGraphicsLayoutItem)
17 private:
18     QRectF bRect, optimumRect;
19     int minRows, numberCards;
20     void handleDropEvent(const QList<CardDragItem *> &dragItems, CardZone *startZone, const QPoint &dropPoint);
21     CardZone *origZone;
22     bool revealZone, writeableRevealZone;
23     bool sortByName, sortByType;
24     bool pileView;
25 
26 public:
27     ZoneViewZone(Player *_p,
28                  CardZone *_origZone,
29                  int _numberCards = -1,
30                  bool _revealZone = false,
31                  bool _writeableRevealZone = false,
32                  QGraphicsItem *parent = nullptr);
33     ~ZoneViewZone();
34     QRectF boundingRect() const;
35     void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
36     void reorganizeCards();
37     void initializeCards(const QList<const ServerInfo_Card *> &cardList = QList<const ServerInfo_Card *>());
38     void removeCard(int position);
getNumberCards()39     int getNumberCards() const
40     {
41         return numberCards;
42     }
43     void setGeometry(const QRectF &rect);
getOptimumRect()44     QRectF getOptimumRect() const
45     {
46         return optimumRect;
47     }
getRevealZone()48     bool getRevealZone() const
49     {
50         return revealZone;
51     }
getWriteableRevealZone()52     bool getWriteableRevealZone() const
53     {
54         return writeableRevealZone;
55     }
56     void setWriteableRevealZone(bool _writeableRevealZone);
57 public slots:
58     void setSortByName(int _sortByName);
59     void setSortByType(int _sortByType);
60     void setPileView(int _pileView);
61 private slots:
62     void zoneDumpReceived(const Response &r);
63 signals:
64     void beingDeleted();
65     void optimumRectChanged();
66     void wheelEventReceived(QGraphicsSceneWheelEvent *event);
67 
68 protected:
69     void addCardImpl(CardItem *card, int x, int y);
70     QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const;
71     void wheelEvent(QGraphicsSceneWheelEvent *event);
72 };
73 
74 #endif
75