Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

fifteen.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2000-2002 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of the Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 
00021 #ifndef __fifteenapplet_h__
00022 #define __fifteenapplet_h__
00023 
00024 #include <qmainwindow.h>
00025 #include <qtableview.h>
00026 #include <qarray.h>
00027 #include <qpointarray.h>
00028 #include <qpixmap.h>
00029 #include <qvector.h>
00030 
00031 class QPopupMenu;
00032 class FifteenConfigDialog;
00033 
00034 class PiecesTable : public QTableView
00035 {
00036   Q_OBJECT
00037 
00038  public:
00039   PiecesTable(QWidget* parent = 0, const char* name = 0);
00040   ~PiecesTable();
00041 
00042  protected slots:
00043   void slotConfigure();
00044   void slotCustomImage(const QString &str);
00045   void slotRandomize();
00046   void slotReset();
00047 
00048  protected:
00049   void resizeEvent(QResizeEvent*);
00050   void mousePressEvent(QMouseEvent*);
00051 
00052   void paintCell(QPainter *, int row, int col);
00053 
00054   void initImage();
00055   void initMap();
00056   void initColors();
00057   void randomizeMap();
00058   void checkwin();
00059   void readConfig();
00060   void writeConfig();
00061 
00062   void initPolygon(int w, int h, int x_of, int y_of );
00063  private:
00064   void clear();
00065   QString        _image;
00066   QArray<int>    _map;
00067   QArray<QColor> _colors;
00068   QArray<QPixmap*> _pixmap;
00069 
00070   QPopupMenu     *_menu;
00071   bool           _randomized;
00072   QPointArray   light_border;
00073   QPointArray   dark_border;
00074   FifteenConfigDialog *_dialog;
00075 
00076   enum MenuOp { mRandomize = 1, mReset = 2 };
00077 };
00078 
00079 class FifteenWidget : public QWidget
00080 {
00081     Q_OBJECT
00082 
00083 public:
00084     FifteenWidget(QWidget *parent = 0, const char *name = 0);
00085 
00086 private:
00087     PiecesTable *_table;
00088 };
00089 
00090 
00091 class FifteenMainWindow : public QMainWindow
00092 {
00093     Q_OBJECT
00094 
00095 public:
00096     static QString appName() {
00097         return QString::fromLatin1("fifteen");
00098     }
00099     FifteenMainWindow(QWidget *parent=0, const char* name=0, WFlags fl=0);
00100 };
00101 
00102 #endif

Generated on Sat Nov 5 16:17:19 2005 for OPIE by  doxygen 1.4.2