1 /***************************************************************************
2 * Copyright (C) 2003 by Carsten Niehaus *
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. *
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 *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
28 #include <qvaluelist.h>
34 #include "informationdialog_impl.h"
37 * @short basic class for the specific PSEs
38 * @author Carsten Niehaus
40 class PSE
: public QWidget
47 * @param data is the object in which all data is stored
49 PSE( KalziumDataObject
*data
, QWidget
*parent
= 0, const char *name
= 0);
55 CAS
= 1, //Chemical Abstract Service
56 IUPAC
= 2, //Intern. Union of Pure and Applied Chemistry
57 IUPACOLD
= 3 //old IUPAC numeration
61 * if this mode is activated a click on a button will not open
64 virtual void activateMolcalcmode( bool mode
){
65 m_molcalcIsActive
= mode
;
69 * @return if the the learningmode is active or not
71 virtual bool learningMode() const{
72 return m_learningMode
;
76 * @return if the the molcalc-Modus is active or not
78 virtual bool molcalcMode() const{
79 return m_molcalcIsActive
;
83 * sets the NUMERATIONTYPE @p num of the periodic table
85 void setNumerationType( int num
){
91 * This method sets the colors of the PSE.
92 @param nr takes 5 different values:
100 void activateColorScheme( const int nr
);
103 * @return the short and descriptive name of this PSE
105 QString
shortName() const{
110 * This method sets the color for the buttons corresponding to
111 * the given temperature @p temp
112 * @param temp is the temperature to which all buttons will be set
114 void setTemperature( const double temp
){
115 m_temperature
= temp
;
119 * @para simple if true the table will only show the p and s block
121 void setPSEType( bool simple
){
126 * returns if the SOM is active or not
132 void activateSOMMode( bool som
){
137 * if true the tooltips will be displayed
142 * This list includes all elementbuttons which are in the
143 * specific PSE. For example. in the simple PSE
144 * the elements of the f- and d-Block would not
147 QPtrList
<Element
> m_PSEElements
;
150 * activates or deactivates the legend
152 void showLegend( bool show
){
156 bool showLegend() const{
161 * activates or deactivates the learningmode
163 void setLearning( bool learningmode
){
164 m_learningMode
= learningmode
;
167 bool timeline() const{
171 void setTimeline( bool timeline
){
172 m_timeline
= timeline
;
181 ///the date used in the timeline
186 ///the temperature of the table (for the SOM-feature)
187 double m_temperature
;
189 ///if true the State Of Matter will be shown
192 ///Timer used for the tooltop
195 KalziumDataObject
*d
;
197 ///if true the periodic table is in the leraningmode
200 ///the number of the element the mouse-cursor is over
201 int m_tooltipElementNumber
;
204 * @return the number of the element at position x/y. If there
205 * is no element it will return 0
207 int ElementNumber( int x
, int y
);
210 * updates the numeration of the PSE
212 virtual void updateNumeration();
214 ///the currently selected element (the x/y-coordinates)
215 QPoint m_currentPoint
;
217 void mouseReleaseEvent( QMouseEvent
* );
219 void mouseMoveEvent( QMouseEvent
* );
221 ///if true the user looks at periods
224 QStringList m_IUPAClist
;
225 QStringList m_IUPACOLDlist
;
227 ///if the the legend will be displayed
231 * this is a short, descriptive name of the PSE
235 ///if true the pse is drawn in simple mode (s+p block only)
238 ///true if the molcalc-mode is active
239 bool m_molcalcIsActive
;
242 * the type of the nummeration ( NO, CAS, IUPACOLD, IUPAC )
246 ///the internal representation of the table
249 ///used for bitBlit. If true the complete table will be drawn
254 virtual void paintEvent( QPaintEvent
*e
);
256 ///in this method the tooltops are drawn.
257 virtual void drawToolTip( QPainter
*p
, Element
*e
);
259 ///called if the user resized the table
260 virtual void resizeEvent( QResizeEvent
*e
);
262 ///the central place for the drawing of the table
263 virtual void drawPSE( QPainter
* p
, bool useSimpleView
);
265 ///draw the state of matter
266 virtual void drawSOMPSE( QPainter
* p
);
269 virtual void drawLegend( QPainter
* p
);
272 void setDate( int date
){
274 //These elements have always been known:
275 //6 16 26 29 33 47 50 51 79 80 82 83
278 void setLearningMode( int horizontal
){
279 if ( horizontal
== 1 )
286 * start the calculation of the element over which the mouse-cursor
287 * is over. Finally the siganl ToolTip( int ) is emitted
289 void slotTransientLabel();
292 * this slot updates the currently selected point
294 void slotUpdatePoint( QPoint point
);
297 * sets the current element to @p number, activates
298 * the tooltipmode and updates the table
300 void slotToolTip( int number
);
304 * this signal is emited when the table is clicked
306 void tableClicked(QPoint
);
309 * this signal is emited when an element is clicked
311 void ElementClicked(int);
314 * this signal is emited when the tooltip of an element
315 * has to be displayed