File indexing completed on 2024-12-22 04:13:09

0001 /*
0002  *  widgets/kis_cmb_composite.h - part of KImageShop/Krayon/Krita
0003  *
0004  *  SPDX-FileCopyrightText: 2004 Boudewijn Rempt (boud@valdyas.org)
0005  *  SPDX-FileCopyrightText: 2011 Silvio Heinrich <plassy@web.de>
0006  *
0007  *  SPDX-License-Identifier: GPL-2.0-or-later
0008  */
0009 
0010 #ifndef KIS_COMPOSITEOP_WIDGETS_H_
0011 #define KIS_COMPOSITEOP_WIDGETS_H_
0012 
0013 #include <QComboBox>
0014 #include <KisSqueezedComboBox.h>
0015 #include <kritaui_export.h>
0016 #include "kis_categorized_list_view.h"
0017 
0018 class KoID;
0019 class KoColorSpace;
0020 class KisSortedCompositeOpListModel;
0021 class KisAction;
0022 class KisActionManager;
0023 
0024 class KRITAUI_EXPORT KisCompositeOpListWidget: public KisCategorizedListView
0025 {
0026     Q_OBJECT
0027 public:
0028      KisCompositeOpListWidget(QWidget* parent = 0);
0029      ~KisCompositeOpListWidget() override;
0030 
0031     KoID selectedCompositeOp() const;
0032 
0033 public Q_SLOTS:
0034     void setCompositeOp(const KoID &id);
0035 
0036 private:
0037     KisSortedCompositeOpListModel *m_model;
0038 };
0039 
0040 
0041 class KRITAUI_EXPORT KisCompositeOpComboBox: public KisSqueezedComboBox
0042 {
0043     Q_OBJECT
0044 public:
0045      KisCompositeOpComboBox(QWidget* parent = 0);
0046      KisCompositeOpComboBox(bool limitToLayerStyles, QWidget* parent = 0);
0047     ~KisCompositeOpComboBox() override;
0048 
0049     void hidePopup() override;
0050 
0051     void validate(const KoColorSpace *cs);
0052     void selectCompositeOp(const KoID &op);
0053     KoID selectedCompositeOp() const;
0054 
0055     void connectBlendmodeActions(KisActionManager *manager);
0056 
0057     void wheelEvent(QWheelEvent *e) override;
0058     void keyPressEvent(QKeyEvent *e) override;
0059 
0060 private Q_SLOTS:
0061     void slotCategoryToggled(const QModelIndex& index, bool toggled);
0062     void slotEntryChecked(const QModelIndex& index);
0063 
0064     void slotNextBlendingMode();
0065     void slotPreviousBlendingMode();
0066     void slotNormal();
0067     void slotDissolve();
0068     void slotBehind();
0069     void slotClear();
0070     void slotDarken();
0071     void slotMultiply();
0072     void slotColorBurn();
0073     void slotLinearBurn();
0074     void slotLighten();
0075     void slotScreen();
0076     void slotColorDodge();
0077     void slotLinearDodge();
0078     void slotOverlay();
0079     void slotHardOverlay();
0080     void slotSoftLight();
0081     void slotHardLight();
0082     void slotVividLight();
0083     void slotLinearLight();
0084     void slotPinLight();
0085     void slotHardMix();
0086     void slotDifference();
0087     void slotExclusion();
0088     void slotHue();
0089     void slotSaturation();
0090     void slotColor();
0091     void slotLuminosity();
0092 
0093 private:
0094     void selectNeighbouringBlendMode(bool down);
0095 
0096 private:
0097     KisSortedCompositeOpListModel *m_model;
0098     KisCategorizedListView *m_view;
0099     bool m_allowToHidePopup;
0100 };
0101 
0102 class KRITAUI_EXPORT KisLayerStyleCompositeOpComboBox: public KisCompositeOpComboBox
0103 {
0104 public:
0105     KisLayerStyleCompositeOpComboBox(QWidget* parent = 0);
0106 };
0107 
0108 #endif // KIS_COMPOSITEOP_WIDGETS_H_