File indexing completed on 2024-05-12 16:01:25

0001 /*
0002  *  SPDX-FileCopyrightText: 2016 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef __KIS_ASPECT_RATIO_LOCKER_H
0008 #define __KIS_ASPECT_RATIO_LOCKER_H
0009 
0010 #include <QScopedPointer>
0011 #include <QObject>
0012 #include "kritaui_export.h"
0013 
0014 class QSpinBox;
0015 class QDoubleSpinBox;
0016 class KisSliderSpinBox;
0017 class KisDoubleSliderSpinBox;
0018 class KoAspectButton;
0019 
0020 class KRITAUI_EXPORT KisAspectRatioLocker : public QObject
0021 {
0022     Q_OBJECT
0023 public:
0024     KisAspectRatioLocker(QObject *parent = 0);
0025     ~KisAspectRatioLocker() override;
0026 
0027     template <class SpinBoxType>
0028         void connectSpinBoxes(SpinBoxType *spinOne, SpinBoxType *spinTwo, KoAspectButton *aspectButton);
0029 
0030     void setBlockUpdateSignalOnDrag(bool block);
0031     void updateAspect();
0032 
0033 private Q_SLOTS:
0034     void slotSpinOneChanged();
0035     void slotSpinTwoChanged();
0036     void slotAspectButtonChanged();
0037     void slotSpinDraggingFinished();
0038 
0039 Q_SIGNALS:
0040     void sliderValueChanged();
0041     void aspectButtonChanged();
0042     void aspectButtonToggled(bool value);
0043 
0044 private:
0045     struct Private;
0046     const QScopedPointer<Private> m_d;
0047 };
0048 
0049 #endif /* __KIS_ASPECT_RATIO_LOCKER_H */