Test change - can I push OK?
[kdeedu-porting.git] / kalzium / src / legendwidget.h
blob7d68d6fab908bd11e996316df521586877c5a6fd
1 #ifndef LEGENDWIDGET_H
2 #define LEGENDWIDGET_H
3 /***************************************************************************
4 * Copyright (C) 2007 by Carsten Niehaus *
5 * cniehaus@kde.org *
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the *
19 * Free Software Foundation, Inc., *
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
21 ***************************************************************************/
23 #include <kdialog.h>
25 #include "kalziumpainter.h"
26 #include "kalziumschemetype.h"
28 class LegendItem;
29 class KalziumGradientType;
31 /**
32 * @author Carsten Niehaus
34 * The LegendWidget displays the explanations of what the user is currently
35 * seeing in the table
37 class LegendWidget : public QWidget
39 Q_OBJECT
41 public:
42 LegendWidget( QWidget *parent );
44 ~LegendWidget(){}
46 private:
47 QPixmap m_pixmap;
49 KalziumSchemeType * m_scheme;
51 KalziumPainter::MODE m_mode;
53 KalziumTableType * m_tableType;
55 KalziumGradientType * m_gradientType;
57 QList<LegendItem*> m_legendItemList;
59 void updateLegendItemLayout( const QList<legendPair>& list );
61 public slots:
62 void updateContent();
64 void setMode( KalziumPainter::MODE m );
66 void setScheme( KalziumSchemeType * type );
68 void setTableType( KalziumTableType * type );
70 void setGradientType( KalziumGradientType * type );
73 /**
74 * A LegendItem is displayed as one small rectangle which represents the
75 * color or QBrush in the table with a short explanation for it.
77 * @author Carsten Niehaus
79 class LegendItem : public QWidget
81 Q_OBJECT
83 public:
84 LegendItem( const QPair<QString, QBrush>& pair, QWidget * parent = 0 );
85 ~LegendItem(){}
87 private:
88 QPair<QString, QBrush> m_pair;
90 protected:
91 virtual void paintEvent( QPaintEvent * e );
94 #endif // LEGENDWIDGET_H