File indexing completed on 2024-05-19 04:07:53
0001 /* 0002 SPDX-FileCopyrightText: 2014 Ian Wadham <iandw.au@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef PALAPELI_PIECEHOLDER_H 0008 #define PALAPELI_PIECEHOLDER_H 0009 0010 #include "../engine/view.h" 0011 0012 class QCloseEvent; 0013 0014 namespace Palapeli 0015 { 0016 class Scene; 0017 class Piece; 0018 0019 /** 0020 * Objects of this class are small windows that hold pieces temporarily 0021 * while a large Palapeli jigsaw puzzle is being solved. There may be 0022 * any number of such windows, including none in small puzzles. The 0023 * pieces in a holder will usually have something in common, as decided 0024 * by the user. For example, they might represent sky, skyline, water or 0025 * other parts of the picture. In any large puzzle, there is a default 0026 * holder called "Hand", which represents a player collecting pieces in 0027 * his or her hand, then moving to the solution area to place them. 0028 * 0029 * The class has methods to assist in collecting and organizing pieces. 0030 */ 0031 0032 class PieceHolder : public View 0033 { 0034 Q_OBJECT 0035 public: 0036 PieceHolder(QWidget* parent, const QSizeF& pieceArea, 0037 const QString& title); 0038 void initializeZooming(); 0039 void setSelected(bool onOff); 0040 QString name() { return windowTitle(); } 0041 protected: 0042 void focusInEvent(QFocusEvent* e) override; 0043 void closeEvent(QCloseEvent* event) override; 0044 Q_SIGNALS: 0045 void selected(PieceHolder* h); 0046 void closing(PieceHolder* h); 0047 private: 0048 Scene* m_scene; 0049 }; 0050 } 0051 0052 #endif // PALAPELI_PIECEHOLDER_H