summaryrefslogtreecommitdiffstats
path: root/knetwalk/src/cell.h
blob: 2e5b9b3637f5f6bad5f3f4ad8c7a1edcdeee2512 (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
62
/***************************************************************************
 *   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 <tqpixmap.h>
#include <tqwidget.h>

class Cell : public TQWidget
{
	Q_OBJECT
  
	public:
		enum Dirs { Free = 0, U = 1, R = 2, D = 4, L = 8, None = 16 };
		Cell(TQWidget* 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(TQPaintEvent*);
		virtual void mousePressEvent(TQMouseEvent*);
	private:
		typedef TQMap<int, TQPixmap*> PixmapMap;
		static  PixmapMap connectedpixmap;
		static  PixmapMap disconnectedpixmap;
		int     angle;
		int     light;
		int     iindex;
		bool    connected;
		bool    changed;
		bool    root;
		bool    locked;
		Dirs    ddirs;
		TQPixmap pixmap;
};

#endif