/*************************************************************************** Description : KPuzzle - A KDE Jigsaw Puzzle Game Version : 0.2 Copyright : (C) 2000-2001 by Michael Wand EMail : mwand@gmx.de ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef PIECEWIDGET_H #define PIECEWIDGET_H #ifdef HAVE_CONFIG_H #include #endif #include class KPuzzleView; class KPuzzleGame; #include #include #include /* This class encapsulates the piece selection widget. The * onject receives commands from the two turn buttons and the * next/previous buttons around the widget. */ class CPieceWidget : public QWidget { Q_OBJECT public: /* Constructor. */ CPieceWidget(QWidget *parent); /* Set the pointer to the KPuzzleGame object. */ void setGame(KPuzzleGame* game) { _game = game; } /* Destructor. */ virtual ~CPieceWidget(); /* Data */ public: /* Return a pixmap of the current piece, appropiately turned. */ QPixmap* currentPiece() const; protected: /* The KPuzzleGame object. */ KPuzzleGame* _game; /* Implementation */ protected: /* Rectangle in which the piece should be drawn * (necessary for centering the piece). */ QRect getPieceDrawRect() const; /* Paint the widget. */ virtual void paintEvent(QPaintEvent* event); public slots: /* The slot for the "Next Piece" button under * this widget. */ void slotNextClicked(); /* The slot for the "Previous Piece" button over * this widget. */ void slotPrevClicked(); /* The slot for the first "Turn" button to the * left of this widget. */ void slotTurn1Clicked(); /* The slot for the second "Turn" button to the * left of this widget. */ void slotTurn2Clicked(); }; #endif /* PIECEWIDGET_H */