Warning, file /office/calligra/libs/widgetutils/KoGroupButton.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE libraries
0002    Copyright (C) 2007 Aurélien Gâteau <agateau@kde.org>
0003    Copyright (C) 2012 Jean-Nicolas Artaud <jeannicolasartaud@gmail.com>
0004    Copyright (C) 2012 Jarosław Staniek <staniek@kde.org>
0005 
0006    This library is free software; you can redistribute it and/or
0007    modify it under the terms of the GNU Library General Public
0008    License version 2 as published by the Free Software Foundation.
0009 
0010    This library is distributed in the hope that it will be useful,
0011    but WITHOUT ANY WARRANTY; without even the implied warranty of
0012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013    Library General Public License for more details.
0014 
0015    You should have received a copy of the GNU Library General Public License
0016    along with this library; see the file COPYING.LIB.  If not, write to
0017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018    Boston, MA 02110-1301, USA.
0019 */
0020 #ifndef KOGROUPBUTTON_H
0021 #define KOGROUPBUTTON_H
0022 
0023 #include "kowidgetutils_export.h"
0024 
0025 // Qt
0026 #include <QToolButton>
0027 
0028 /**
0029  * A thin tool button which can be visually grouped with other buttons.
0030  * 
0031  * The group can thus look like one solid bar: ( button1 | button2 | button3 )
0032  * 
0033  * For groupping layout can be used. For exclusive checkable behaviour assign QButtonGroup on the buttons.
0034  */
0035 class KOWIDGETUTILS_EXPORT KoGroupButton : public QToolButton
0036 {
0037     Q_OBJECT
0038 public:
0039     /**
0040      * Position of the button within the button group what affects the appearance.
0041      */
0042     enum GroupPosition {
0043         NoGroup,     //!< No particular position, gives the button unchanged appearance
0044         GroupLeft,   //!< The button is at the left of the group, so it would have rounded the left part
0045         GroupRight,  //!< The button is at the right of the group, so it would have rounded the right part
0046         GroupCenter  //!< The button is on the center of the group, so it would have separators on both sides
0047     };
0048 private:
0049     Q_ENUMS( GroupPosition )
0050     Q_PROPERTY( GroupPosition groupPosition READ groupPosition WRITE setGroupPosition )
0051 public:
0052 
0053     explicit KoGroupButton(GroupPosition position, QWidget* parent = 0);
0054 
0055     /**
0056      * Creates button with no NoGroup position.
0057      */
0058     explicit KoGroupButton(QWidget* parent = 0);
0059 
0060     ~KoGroupButton() override;
0061 
0062     void setGroupPosition(KoGroupButton::GroupPosition groupPosition);
0063 
0064     KoGroupButton::GroupPosition groupPosition() const;
0065 
0066 protected:
0067     void paintEvent(QPaintEvent* event) override;
0068 
0069 private:
0070     class Private;
0071     Private *const d;
0072 };
0073 
0074 #endif /* KOGROUPBUTTON_H */