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

0001 /* This file is part of the KDE libraries
0002    SPDX-FileCopyrightText: 2007 Aurélien Gâteau <agateau@kde.org>
0003    SPDX-FileCopyrightText: 2012 Jean-Nicolas Artaud <jeannicolasartaud@gmail.com>
0004    SPDX-FileCopyrightText: 2012 Jarosław Staniek <staniek@kde.org>
0005 
0006    SPDX-License-Identifier: LGPL-2.0-only
0007 */
0008 #ifndef KOGROUPBUTTON_H
0009 #define KOGROUPBUTTON_H
0010 
0011 #include "kritawidgetutils_export.h"
0012 
0013 #include <KisHighlightedToolButton.h>
0014 
0015 /**
0016  * A thin tool button which can be visually grouped with other buttons.
0017  * 
0018  * The group can thus look like one solid bar: ( button1 | button2 | button3 )
0019  * 
0020  * For grouping layout can be used. For exclusive checkable behaviour assign QButtonGroup on the buttons.
0021  */
0022 class KRITAWIDGETUTILS_EXPORT KoGroupButton : public KisHighlightedToolButton
0023 {
0024     Q_OBJECT
0025     Q_ENUMS( GroupPosition )
0026     Q_PROPERTY( GroupPosition groupPosition READ groupPosition WRITE setGroupPosition )
0027 public:
0028     /**
0029      * Position of the button within the button group what affects the appearance.
0030      */
0031     enum GroupPosition {
0032         NoGroup,     //!< No particular position, gives the button unchanged appearance
0033         GroupLeft,   //!< The button is at the left of the group, so it would have rounded the left part
0034         GroupRight,  //!< The button is at the right of the group, so it would have rounded the right part
0035         GroupCenter  //!< The button is on the center of the group, so it would have separators on both sides
0036     };
0037 
0038     explicit KoGroupButton(GroupPosition position, QWidget* parent = 0);
0039 
0040     /**
0041      * Creates button with no NoGroup position.
0042      */
0043     explicit KoGroupButton(QWidget* parent = 0);
0044 
0045     ~KoGroupButton() override;
0046 
0047     void setGroupPosition(KoGroupButton::GroupPosition groupPosition);
0048 
0049     KoGroupButton::GroupPosition groupPosition() const;
0050 
0051 protected:
0052     void paintEvent(QPaintEvent* event) override;
0053 
0054 private:
0055     class Private;
0056     Private *const d;
0057 };
0058 
0059 #endif /* KOGROUPBUTTON_H */