File indexing completed on 2024-04-28 11:36:29

0001 /* This file is part of the KDE libraries
0002    Copyright (C) 1997 Martin Jones (mjones@kde.org)
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 KHUESATURATIONSELECT_H_
0021 #define KHUESATURATIONSELECT_H_
0022 
0023 #include <kdelibs4support_export.h>
0024 #include "kxyselector.h"
0025 
0026 #include "kcolorchoosermode.h"
0027 
0028 class KDELIBS4SUPPORT_DEPRECATED_EXPORT KHueSaturationSelector : public KXYSelector
0029 {
0030     Q_OBJECT
0031 public:
0032     /**
0033      * Constructs a hue/saturation selection widget.
0034      */
0035     KDELIBS4SUPPORT_DEPRECATED explicit KHueSaturationSelector(QWidget *parent = nullptr);
0036 
0037     /**
0038      * Destructor.
0039      */
0040     ~KHueSaturationSelector() override;
0041 
0042     /**
0043      * Sets the chooser mode. The allowed modes are defined
0044      * in KColorChooserMode.
0045      *
0046      * @param    The chooser mode as defined in KColorChooserMode
0047      */
0048     void setChooserMode(KColorChooserMode chooserMode);
0049 
0050     /**
0051      * Returns the chooser mode.
0052      *
0053      * @return   The chooser mode (defined in KColorChooserMode)
0054      */
0055     KColorChooserMode chooserMode() const;
0056 
0057     /**
0058      * Returns the hue value
0059      *
0060      * @return   The hue value (0-360)
0061      */
0062     int hue() const;
0063 
0064     /**
0065      * Sets the hue value (0-360)
0066      *
0067      * @param  hue  The hue value (0-360)
0068      */
0069     void setHue(int hue);
0070 
0071     /**
0072      * Returns the saturation (0-255)
0073      *
0074      * @return The saturation (0-255)
0075      */
0076     int saturation() const;
0077 
0078     /**
0079      * Sets the saturation (0-255)
0080      *
0081      * @param  saturation   The saturation (0-255)
0082      */
0083     void setSaturation(int saturation);
0084 
0085     /**
0086      * Returns the color value (also known as lumniousity, 0-255)
0087      *
0088      * @return  The color value (0-255)
0089      */
0090     int colorValue() const;
0091 
0092     /**
0093      * Sets the color value (0-255)
0094      *
0095      * @param  colorValue  The color value (0-255)
0096      */
0097     void setColorValue(int colorValue);
0098 
0099     /**
0100      * Updates the contents
0101      */
0102     void updateContents();
0103 
0104 protected:
0105     /**
0106      * Draws the contents of the widget on a pixmap,
0107      * which is used for buffering.
0108      */
0109     virtual void drawPalette(QPixmap *pixmap);
0110     void resizeEvent(QResizeEvent *) override;
0111 
0112     /**
0113      * Reimplemented from KXYSelector. This drawing is
0114      * buffered in a pixmap here. As real drawing
0115      * routine, drawPalette() is used.
0116      */
0117     void drawContents(QPainter *painter) override;
0118 
0119 private:
0120 
0121     class Private;
0122     friend class Private;
0123     Private *const d;
0124 
0125     Q_DISABLE_COPY(KHueSaturationSelector)
0126 };
0127 
0128 #endif /*KHUESATURATIONSELECT_H_*/