1 /* 2 SPDX-FileCopyrightText: 2014 Ian Wadham <iandw.au@gmail.com> 3 4 SPDX-License-Identifier: GPL-2.0-or-later 5 */ 6 7 #ifndef PALAPELI_PIECEHOLDER_H 8 #define PALAPELI_PIECEHOLDER_H 9 10 #include "../engine/view.h" 11 12 class QCloseEvent; 13 14 namespace Palapeli 15 { 16 class Scene; 17 class Piece; 18 19 /** 20 * Objects of this class are small windows that hold pieces temporarily 21 * while a large Palapeli jigsaw puzzle is being solved. There may be 22 * any number of such windows, including none in small puzzles. The 23 * pieces in a holder will usually have something in common, as decided 24 * by the user. For example, they might represent sky, skyline, water or 25 * other parts of the picture. In any large puzzle, there is a default 26 * holder called "Hand", which represents a player collecting pieces in 27 * his or her hand, then moving to the solution area to place them. 28 * 29 * The class has methods to assist in collecting and organizing pieces. 30 */ 31 32 class PieceHolder : public View 33 { 34 Q_OBJECT 35 public: 36 PieceHolder(QWidget* parent, const QSizeF& pieceArea, 37 const QString& title); 38 void initializeZooming(); 39 void setSelected(bool onOff); name()40 QString name() { return windowTitle(); } 41 protected: 42 void focusInEvent(QFocusEvent* e) override; 43 void closeEvent(QCloseEvent* event) override; 44 Q_SIGNALS: 45 void selected(PieceHolder* h); 46 void closing(PieceHolder* h); 47 private: 48 Scene* m_scene; 49 }; 50 } 51 52 #endif // PALAPELI_PIECEHOLDER_H 53