File indexing completed on 2024-04-21 15:12:09

0001 /* This file is part of the KDE Project
0002    Copyright (C) 2000 Klaas Freitag <freitag@suse.de>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This library is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this library; see the file COPYING.LIB.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017    Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #ifndef GAMMAWIDGET_H
0021 #define GAMMAWIDGET_H
0022 
0023 #include "kookascan_export.h"
0024 
0025 #include <qwidget.h>
0026 #include <qsizepolicy.h>
0027 #include <qsize.h>
0028 
0029 class QPaintEvent;
0030 class KGammaTable;
0031 
0032 /**
0033  * @short A widget to display a gamma table.
0034  *
0035  * The table is displayed in a square, regardless of the aspect ratio
0036  * of the widget, and aligned to the top left.  Grid lines are
0037  * automatically displayed.
0038  *
0039  * The display is redrawn whenever the associated gamma table changes.
0040  *
0041  * @author Klaas Freitag
0042  * @author Jonathan Marten
0043  **/
0044 
0045 class KOOKASCAN_EXPORT GammaWidget : public QWidget
0046 {
0047     Q_OBJECT
0048 
0049 public:
0050     /**
0051      * Constructor.
0052      *
0053      * @param table The gamma table to display
0054      * @param parent Parent widget
0055      **/
0056     explicit GammaWidget(KGammaTable *table, QWidget *parent = nullptr);
0057 
0058     /**
0059      * Destructor.
0060      **/
0061     ~GammaWidget() override {}
0062 
0063     /**
0064      * Reimplemented
0065      **/
0066     QSize sizeHint() const override;
0067 
0068 protected:
0069     /**
0070      * Reimplemented
0071      **/
0072     void paintEvent(QPaintEvent *ev) override;
0073 
0074 private:
0075     KGammaTable *mTable;
0076 };
0077 
0078 #endif                          // GAMMAWIDGET_H