blob: 2dd5009c0ca4c2baee97e8aa12535f09aa44620e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/***************************************************************************
* Copyright (C) 2004, 2005 Andi Peredri *
* andi@ukr.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License version 2 *
* as published by the Free Software Foundation (see COPYING) *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
***************************************************************************/
#ifndef CELL_H
#define CELL_H
#include <qpixmap.h>
#include <qwidget.h>
class Cell : public QWidget
{
Q_OBJECT
public:
enum Dirs { Free = 0, U = 1, R = 2, D = 4, L = 8, None = 16 };
Cell(QWidget* parent, int i);
int index() const;
void rotate(int a);
void setDirs(Dirs d);
void setRoot(bool b);
void setLight(int l);
void setConnected(bool b);
void setLocked( bool newlocked = true );
bool isConnected() const;
bool isRotated() const;
bool isLocked() const;
Dirs dirs() const;
static void initPixmaps();
signals:
void lClicked(int);
void rClicked(int);
void mClicked(int);
protected:
virtual void paintEvent(QPaintEvent*);
virtual void mousePressEvent(QMouseEvent*);
private:
typedef QMap<int, QPixmap*> PixmapMap;
static PixmapMap connectedpixmap;
static PixmapMap disconnectedpixmap;
int angle;
int light;
int iindex;
bool connected;
bool changed;
bool root;
bool locked;
Dirs ddirs;
QPixmap pixmap;
};
#endif
|