File indexing completed on 2024-05-12 04:44:36

0001 // SPDX-FileCopyrightText: Lukas Sommer <sommerluk@gmail.com>
0002 // SPDX-License-Identifier: BSD-2-Clause OR MIT
0003 
0004 #ifndef WHEELCOLORPICKER_P_H
0005 #define WHEELCOLORPICKER_P_H
0006 
0007 // Include the header of the public class of this private implementation.
0008 // #include "wheelcolorpicker.h"
0009 
0010 #include "constpropagatingrawpointer.h"
0011 #include <qglobal.h>
0012 #include <qobject.h>
0013 #include <qpointer.h>
0014 #include <qsharedpointer.h>
0015 #include <qsize.h>
0016 class QWidget;
0017 
0018 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
0019 #include <qtmetamacros.h>
0020 #else
0021 #include <qobjectdefs.h>
0022 #include <qstring.h>
0023 #endif
0024 
0025 namespace PerceptualColor
0026 {
0027 class ChromaLightnessDiagram;
0028 class ColorWheel;
0029 class RgbColorSpace;
0030 class WheelColorPicker;
0031 
0032 /** @internal
0033  *
0034  *  @brief Private implementation within the <em>Pointer to
0035  *  implementation</em> idiom */
0036 class WheelColorPickerPrivate final : public QObject
0037 {
0038     Q_OBJECT
0039 
0040 public:
0041     // Constructors and destructors
0042     explicit WheelColorPickerPrivate(WheelColorPicker *backLink);
0043     /** @brief Default destructor */
0044     virtual ~WheelColorPickerPrivate() noexcept override = default;
0045 
0046     // Member methods
0047     [[nodiscard]] QSizeF optimalChromaLightnessDiagramSize() const;
0048     void resizeChildWidgets();
0049 
0050     // Data members
0051     /** @brief A pointer to the @ref ChromaLightnessDiagram child widget. */
0052     QPointer<ChromaLightnessDiagram> m_chromaLightnessDiagram;
0053     /** @brief A pointer to the color space. */
0054     QSharedPointer<PerceptualColor::RgbColorSpace> m_rgbColorSpace;
0055     /** @brief A pointer to the @ref ColorWheel child widget. */
0056     QPointer<ColorWheel> m_colorWheel;
0057 
0058 public Q_SLOTS:
0059     void handleFocusChanged(QWidget *old, QWidget *now);
0060 
0061 private:
0062     Q_DISABLE_COPY(WheelColorPickerPrivate)
0063 
0064     /** @brief Pointer to the object from which <em>this</em> object
0065      *  is the private implementation. */
0066     ConstPropagatingRawPointer<WheelColorPicker> q_pointer;
0067 };
0068 
0069 } // namespace PerceptualColor
0070 
0071 #endif // WHEELCOLORPICKER_P_H