Code_TYMPAN  4.4.0
Industrial site acoustic simulation
TYLookupTableWidget.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) <2012> <EDF-R&D> <FRANCE>
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation; either version 2 of the License, or
6  * (at your option) any later version.
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  * See the GNU General Public License for more details.
11  * You should have received a copy of the GNU General Public License along
12  * with this program; if not, write to the Free Software Foundation, Inc.,
13  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
14  */
15 
26 #ifndef __TY_LOOKUPTABLE_WIDGET__
27 #define __TY_LOOKUPTABLE_WIDGET__
28 
29 #include <qwidget.h>
30 // Added by qt3to4:
31 #include <QPaintEvent>
32 #include <QResizeEvent>
33 #include <QColor>
34 
35 #include "Tympan/core/color.h"
36 
37 inline QColor toQColor(const OColor& color)
38 {
39  return QColor(color.r * 255.0f, color.g * 255.0f, color.b * 255.0f);
40 }
41 
42 inline OColor toOColor(const QColor& color)
43 {
44  return OColor(color.red() / 255.0f, color.green() / 255.0f, color.blue() / 255.0f);
45 }
46 
47 class QRect;
48 class TYPalette;
49 class QDoubleSpinBox;
50 
56 class TYLookupTableWidget : public QWidget
57 {
58  Q_OBJECT
59 
61 
62 public:
63  TYLookupTableWidget(const TYPalette* palette, QWidget* parent = 0, const char* name = 0);
64  virtual ~TYLookupTableWidget();
65 
66 protected:
67  void paintEvent(QPaintEvent*);
68  void resizeEvent(QResizeEvent*);
69  void drawPalette(QPainter* painter);
70 
72  QRect* _rectPal;
73 };
74 
75 class TYLabeledLookupTableWidget : public QWidget
76 {
77  Q_OBJECT
78 
79 public:
80  TYLabeledLookupTableWidget(const TYPalette* palette, QWidget* parent = 0, const char* name = 0);
82 
83 public slots:
84  void update(const TYPalette* palette);
85 
86 protected:
88  QDoubleSpinBox* p_minBound;
89  QDoubleSpinBox* p_maxBound;
90 };
91 
92 #endif // __TY_LOOKUPTABLE_WIDGET__
OColor toOColor(const QColor &color)
QColor toQColor(const OColor &color)
const char * name
Definition: color.h:31
float b
Definition: color.h:33
float r
Definition: color.h:33
float g
Definition: color.h:33
TYLabeledLookupTableWidget(const TYPalette *palette, QWidget *parent=0, const char *name=0)
TYLookupTableWidget * p_scale
void update(const TYPalette *palette)
Outil IHM utile a l'affichage de la palette de couleur.
TYLookupTableWidget(const TYPalette *palette, QWidget *parent=0, const char *name=0)
void drawPalette(QPainter *painter)
void paintEvent(QPaintEvent *)
void resizeEvent(QResizeEvent *)
const TYPalette * _palette
Classe de definition d'une palette.
Definition: TYPalette.h:41