moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kalzium / src / elementbutton.h
blob6c24167be5496493e06340c32bb99ece1d6ef4ff
1 /***************************************************************************
2 * Copyright (C) 2003 by Carsten Niehaus *
3 * cniehaus@kde.org *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20 #ifndef ELEMENTBUTTON_H
21 #define ELEMENTBUTTON_H
23 #include <qframe.h>
24 #include "element.h"
26 class QMouseEvent;
28 /**
29 *An ElementButton is the widget the users sees when looking at the table.
30 *It provides the drag&drop-actions and click-events. Furthermore it can change
31 *it colors and hide/show itself.
33 *@author Carsten Niehaus
35 class ElementButton : public QFrame
37 Q_OBJECT
38 public:
39 ElementButton(int number, Element *el, QWidget *parent = 0, const char *name = 0);
41 ~ElementButton();
42 int ElementNumber();
44 /**
45 * the symbol of the element
47 QString sym;
49 /**
50 * the element this buttons represents
52 Element *e;
54 /**
55 * accessor for the element's color
57 QColor elementColor() const { return m_Color; }
59 /**
60 * mutator for the element's color
62 void setElementColor( const QColor &c ) { m_Color = c; update(); }
64 virtual void paintEvent( QPaintEvent* );
66 private:
68 * the integer num represents the number of the element
70 int m_ElementNumber;
71 QColor m_Color;
73 void mousePressEvent( QMouseEvent* );
74 void mouseReleaseEvent( QMouseEvent* );
76 signals:
78 * this signal emits the name ( the element-number )ยท
79 **/
80 void num( int );
84 #endif