~ubuntu-branches/ubuntu/precise/kalzium/precise

« back to all changes in this revision

Viewing changes to src/psetable/periodictableview.h

  • Committer: Bazaar Package Importer
  • Author(s): Philip Muškovac
  • Date: 2011-07-03 12:28:58 UTC
  • Revision ID: james.westby@ubuntu.com-20110703122858-q1yyxncs89e4w0hs
Tags: upstream-4.6.90+repack
Import upstream version 4.6.90+repack

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2005-2006 by Pino Toscano, toscano.pino@tiscali.it      *
 
3
 *   Copyright (C) 2003-2006 by Carsten Niehaus, cniehaus@kde.org          *
 
4
 *   Copyright (C) 2007-2009 by Marcus D. Hanwell                          *
 
5
 *   Copyright (C) 2010-2011 by Etienne Rebetez, etienne.rebetez@oberwallis.ch  *
 
6
 *                                                                         *
 
7
 *                                                                         *
 
8
 *   This program is free software; you can redistribute it and/or modify  *
 
9
 *   it under the terms of the GNU General Public License as published by  *
 
10
 *   the Free Software Foundation; either version 2 of the License, or     *
 
11
 *   (at your option) any later version.                                   *
 
12
 *                                                                         *
 
13
 *   This program is distributed in the hope that it will be useful,       *
 
14
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 
15
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 
16
 *   GNU General Public License for more details.                          *
 
17
 *                                                                         *
 
18
 *   You should have received a copy of the GNU General Public License     *
 
19
 *   along with this program; if not, write to the                         *
 
20
 *   Free Software Foundation, Inc.,                                       *
 
21
 *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.          *
 
22
 ***************************************************************************/
 
23
 
 
24
#ifndef PERIODSYSTEMBASE_H
 
25
#define PERIODSYSTEMBASE_H
 
26
 
 
27
#include <QGraphicsView>
 
28
 
 
29
#include "kalziumdataobject.h"
 
30
 
 
31
#include "kalziumnumerationtype.h"
 
32
 
 
33
#include "elementitem.h"
 
34
#include "numerationitem.h"
 
35
#include "periodictablescene.h"
 
36
#include "periodictablestates.h"
 
37
 
 
38
 
 
39
/**
 
40
 * @class PeriodicTableView
 
41
 * In this class the periodic table of elements is created.
 
42
 * It provides slots to change the tables and accessing the element propertys
 
43
 * @short Base class and creation for the pse System
 
44
 * @author Carsten Niehaus
 
45
 * @author Marcus D. Hanwell
 
46
 * @author Etienne Rebetez
 
47
 *
 
48
*/
 
49
 
 
50
class PeriodicTableView : public QGraphicsView
 
51
{
 
52
    Q_OBJECT
 
53
public:
 
54
    PeriodicTableView(QWidget *parent = 0);
 
55
    ~PeriodicTableView();
 
56
 
 
57
    /**
 
58
     * Returns the qgraphicsscene
 
59
     */
 
60
    PeriodicTableScene *pseScene() const;
 
61
 
 
62
    /**
 
63
     * Returns the current id of the pse-table.
 
64
     * The id is the same as the menü and the pse list from the pseTables class.
 
65
     */
 
66
    int table() const;
 
67
 
 
68
    /**
 
69
     * Genarates and saves the pse as svg in the given filename.
 
70
     * @param filename filename of the destination.
 
71
     */
 
72
    void generateSvg(const QString& filename);
 
73
 
 
74
 
 
75
Q_SIGNALS:
 
76
    /**
 
77
     * Is emited when the pse table is changed.
 
78
     */
 
79
    void tableChanged(int tableTyp);
 
80
    /**
 
81
     * Is emited when the numeration of the pse table is changed.
 
82
     */
 
83
    void numerationChange(int num);
 
84
 
 
85
public slots:
 
86
    /**
 
87
     * Change the pse table to the given id.
 
88
     * @param newtable id of the pse table.
 
89
     */
 
90
    void slotChangeTable(int newtable);
 
91
    /**
 
92
     * fits the pse in the qGraphicsView.
 
93
     */
 
94
    void fitPseInView();
 
95
    /**
 
96
     * One Element can be selected with this function.
 
97
     * The selection is only a graphical feedback for the user.
 
98
     * @param element number of the element.
 
99
     */
 
100
    void slotSelectOneElement(int element);
 
101
    /**
 
102
     * Selects an Element.
 
103
     * @param element number of the element.
 
104
     */
 
105
    void slotSelectAdditionalElement(int element);
 
106
    /**
 
107
     * Unselects all elements
 
108
     */
 
109
    void slotUnSelectElements();
 
110
 
 
111
private:
 
112
    QList<ElementItem *>  createElementItems() const;
 
113
    QList<NumerationItem *>  createNumerationItems() const;
 
114
 
 
115
    void setBiggerSceneRect();
 
116
 
 
117
    int m_currentTableInex;
 
118
 
 
119
    PeriodicTableScene *m_tableScene;
 
120
    
 
121
    PeriodicTableStates *m_tableStates;
 
122
 
 
123
protected:
 
124
    /**
 
125
     * Generic event handler, currently defaults to calling parent class
 
126
     * (included for future compatibility)
 
127
     */
 
128
    bool event(QEvent *e);
 
129
 
 
130
    /**
 
131
     * is caled every time the view is resized.
 
132
     */
 
133
    void resizeEvent ( QResizeEvent * event );
 
134
};
 
135
#endif // PERIODSYSTEMBASE_H