1 /***************************************************************************
2 * Copyright (C) 2005, 2006 by Pino Toscano, toscano.pino@tiscali.it *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 ***************************************************************************/
20 #ifndef KALZIUMPAINTER_H
21 #define KALZIUMPAINTER_H
26 #include <chemicaldataobject.h>
30 class KalziumGradientType
;
31 class KalziumTableType
;
32 class KalziumSchemeType
;
33 class KalziumNumerationType
;
36 * The KalziumPainter is /the/ way to draw a table, any kind of it.
38 * One of the best features of it is that you can construct it once and do
39 * multiple drawing session without destroying it.
41 * A typical usage would be:
43 * // build the classic periodic table
44 * KalziumTableType *table = KalziumTableTypeFactory::instance()->build( "Classic" );
45 * // creating the painter with the table type
46 * KalziumPainter painter = new KalziumPainter( table );
47 * // setting the various options
49 * painter->begin( widget/pixmap/paintdevice );
51 * // draw the element selector for the element with atomic number 20 (Calcium)
52 * painter->drawElementSelector( 20 );
56 * @author Pino Toscano
62 * Construct a new KalziumPainter for the table type @p ktt.
64 KalziumPainter( KalziumTableType
*ktt
);
65 virtual ~KalziumPainter() {}
67 void setTableType( KalziumTableType
* ktt
){
74 SOM
/**< State of matter*/,
80 * Begin painting on the painting device @p pd.
82 void begin( QPaintDevice
*pd
);
88 KalziumTableType
* currentTableType() const;
91 * Draw all the things it can: elements and numeration
96 * Draw all the elements
101 * Draw the element with atomic number @p element.
102 * Pass a QRect() to the @p r parameter if you want to use the
103 * default rect for that element.
105 void drawElement( int element
, const QRect
& r
= QRect() );
108 * Draw the numeration
110 void drawNumeration();
113 * Paint a marker around the element number @p element
115 void drawElementSelector( int element
);
117 void setMode( MODE m
);
120 * @return Return the current MODE
126 void setScheme( int s
);
127 void setScheme( const QByteArray
& s
);
128 KalziumSchemeType
* scheme() const;
130 void setGradient( int cs
);
131 void setGradient( const QByteArray
& cs
);
132 KalziumGradientType
* gradient() const;
135 * Set the numeration @p n for the periodic table
137 void setNumeration( int n
);
138 void setNumeration( const QByteArray
& n
);
140 KalziumNumerationType
* numeration() const{
144 void setTemperature( int temp
);
146 int temperature() const{
147 return m_temperature
;
150 void setTime( int time
){
158 QBrush
brushForElement( int element
) const;
163 KalziumTableType
*m_ktt
;
167 KalziumSchemeType
*m_scheme
;
168 KalziumGradientType
*m_gradient
;
170 * the type of the numeration
172 KalziumNumerationType
*m_numeration
;
174 ///for the state-of-matter
181 #endif // KALZIUMPAINTER_H