File indexing completed on 2024-11-24 04:42:27

0001 /*
0002  *  spinbox_p.h  -  private classes for SpinBox
0003  *  Program:  kalarm
0004  *  SPDX-FileCopyrightText: 2021 David Jarvie <djarvie@kde.org>
0005  *
0006  *  SPDX-License-Identifier: GPL-2.0-or-later
0007  */
0008 
0009 #pragma once
0010 
0011 #include <QStyle>
0012 
0013 
0014 /*=============================================================================
0015 = Class SpinBoxStyle
0016 * Extra pair of spin buttons for SpinBox2.
0017 * The widget is actually a whole spin box, but only the buttons are displayed.
0018 =============================================================================*/
0019 
0020 class SpinBoxStyle : public QStyle
0021 {
0022     Q_OBJECT
0023 public:
0024     SpinBoxStyle();
0025 
0026     void polish(QWidget* widget) override;
0027     void unpolish(QWidget* widget) override;
0028 
0029     void polish(QApplication* application) override;
0030     void unpolish(QApplication* application) override;
0031 
0032     void polish(QPalette& palette) override;
0033 
0034     QRect itemTextRect(const QFontMetrics& fm, const QRect& r,
0035                            int flags, bool enabled,
0036                            const QString& text) const override;
0037 
0038     QRect itemPixmapRect(const QRect& r, int flags, const QPixmap& pixmap) const override;
0039 
0040     void drawItemText(QPainter* painter, const QRect& rect,
0041                               int flags, const QPalette& pal, bool enabled,
0042                               const QString& text, QPalette::ColorRole textRole = QPalette::NoRole) const override;
0043 
0044     void drawItemPixmap(QPainter* painter, const QRect& rect,
0045                                 int alignment, const QPixmap& pixmap) const override;
0046 
0047     QPalette standardPalette() const override;
0048 
0049     void drawPrimitive(PrimitiveElement pe, const QStyleOption* opt, QPainter* p,
0050                                const QWidget* w = nullptr) const override;
0051 
0052     void drawControl(ControlElement element, const QStyleOption* opt, QPainter* p,
0053                              const QWidget* w = nullptr) const override;
0054 
0055     QRect subElementRect(SubElement subElement, const QStyleOption* option,
0056                                  const QWidget* widget = nullptr) const override;
0057 
0058     void drawComplexControl(ComplexControl cc, const QStyleOptionComplex* opt, QPainter* p,
0059                                     const QWidget* widget = nullptr) const override;
0060     SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex* opt,
0061                                              const QPoint& pt, const QWidget* widget = nullptr) const override;
0062     QRect subControlRect(ComplexControl cc, const QStyleOptionComplex* opt,
0063                                  SubControl sc, const QWidget* widget = nullptr) const override;
0064 
0065     int pixelMetric(PixelMetric metric, const QStyleOption* option = nullptr,
0066                             const QWidget* widget = nullptr) const override;
0067 
0068     QSize sizeFromContents(ContentsType ct, const QStyleOption* opt,
0069                                    const QSize& contentsSize, const QWidget* w = nullptr) const override;
0070 
0071     int styleHint(StyleHint stylehint, const QStyleOption* opt = nullptr,
0072                           const QWidget* widget = nullptr, QStyleHintReturn* returnData = nullptr) const override;
0073 
0074     QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption* opt = nullptr,
0075                                    const QWidget* widget = nullptr) const override;
0076 
0077     QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption* option = nullptr,
0078                                const QWidget* widget = nullptr) const override;
0079 
0080     QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap& pixmap,
0081                                         const QStyleOption* opt) const override;
0082 
0083     int layoutSpacing(QSizePolicy::ControlType control1,
0084                               QSizePolicy::ControlType control2, Qt::Orientation orientation,
0085                               const QStyleOption* option = nullptr, const QWidget* widget = nullptr) const override;
0086 };
0087 
0088 // vim: et sw=4: