1
/***********************************************************************************
2
* Mass calculator: Plasmoid to calculate mass of a Molecule.
3
* Copyright (C) 2009, 2010 Etienne Rebetez, etienne.rebetez@oberwallis.ch
5
* This program is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU General Public License
7
* as published by the Free Software Foundation; either version 2
8
* of the License, or (at your option) any later version.
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.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
***********************************************************************************/
21
// Here we avoid loading the header multiple times
22
#ifndef ElementWidget_HEADER
23
#define ElementWidget_HEADER
25
#include <QGraphicsGridLayout>
27
#include <plasma/widgets/pushbutton.h>
28
#include <plasma/widgets/iconwidget.h>
29
#include <plasma/tooltipmanager.h>
30
#include <Plasma/Applet>
34
class PeriodicGrid : public QGraphicsWidget
38
// Basic Create/Destroy
39
PeriodicGrid(Plasma::Applet *applet = 0);
40
PeriodicGrid(int tableTyp, Plasma::Applet *applet = 0);
44
/// gets the current periodic table id.
45
int getCurrentPseTyp() const;
47
/// creates all element labels and put them in the grid.
51
/// sets the new table typ and creates the table.
52
void setCurrentPseTyp(int tableTyp);
55
QGraphicsGridLayout *m_actualPeriodSystem;
59
QList<ElementLabel*> m_elementItemList;
61
Plasma::DataEngine::Data m_element;
62
Plasma::Applet *m_applet;
65
class ElementLabel : public Plasma::IconWidget
69
// Basic Create/Destroy
70
ElementLabel( int element, Plasma::Applet *applet, QGraphicsWidget * parent = 0);
74
/// emits the text string of the current element.
75
void ElementAction(QString text);
78
/// is used to add information to the clicked() signal.
79
void ElementPressed() {
80
emit ElementAction(text());
83
void drawToolTip( Plasma::DataEngine::Data &element );