File indexing completed on 2024-05-12 16:02:29

0001 /*
0002  *  SPDX-FileCopyrightText: 2022 Deif Lou <ginoba@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KISOPTIONBUTTONSTRIP_H
0008 #define KISOPTIONBUTTONSTRIP_H
0009 
0010 #include <QList>
0011 #include <QScopedPointer>
0012 #include <QWidget>
0013 
0014 #include <kritawidgetutils_export.h>
0015 
0016 class KoGroupButton;
0017 
0018 /**
0019  * @brief Provides a list of consecutive tool buttons
0020  */
0021 class KRITAWIDGETUTILS_EXPORT KisOptionButtonStrip : public QWidget
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     explicit KisOptionButtonStrip(QWidget *parent = nullptr);
0027     ~KisOptionButtonStrip() override;
0028 
0029     KoGroupButton *addButton(const QIcon &icon,
0030                              const QString &text = QString());
0031     KoGroupButton *addButton(const QString &text);
0032     KoGroupButton *addButton();
0033 
0034     KoGroupButton *button(int index) const;
0035     QList<KoGroupButton *> buttons() const;
0036 
0037     bool exclusive() const;
0038     void setExclusive(bool exclusive);
0039 
0040     KoGroupButton *checkedButton() const;
0041     int checkedButtonIndex() const;
0042 
0043 Q_SIGNALS:
0044     void buttonToggled(KoGroupButton *button, bool checked);
0045     void buttonToggled(int index, bool checked);
0046 
0047 private:
0048     class Private;
0049     QScopedPointer<Private> m_d;
0050 };
0051 
0052 #endif