3 /***************************************************************************
4 * Copyright (C) 2007 by Carsten Niehaus *
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. *
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. *
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 ***************************************************************************/
25 #include "kalziumpainter.h"
26 #include "kalziumschemetype.h"
29 class KalziumGradientType
;
32 * @author Carsten Niehaus
34 * The LegendWidget displays the explanations of what the user is currently
37 class LegendWidget
: public QWidget
42 LegendWidget( QWidget
*parent
);
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
);
64 void setMode( KalziumPainter::MODE m
);
66 void setScheme( KalziumSchemeType
* type
);
68 void setTableType( KalziumTableType
* type
);
70 void setGradientType( KalziumGradientType
* type
);
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
84 LegendItem( const QPair
<QString
, QBrush
>& pair
, QWidget
* parent
= 0 );
88 QPair
<QString
, QBrush
> m_pair
;
91 virtual void paintEvent( QPaintEvent
* e
);
94 #endif // LEGENDWIDGET_H