not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / kcontrol / randr / collapsiblewidget.h
blob3821c2ec9c9c37c16d4ae5b506ce17ec33a5ca99
1 /*
2 This file is part of the KDE libraries
3 Copyright (C) 2005 Daniel Molkentin <molkentin@kde.org>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
21 * file copied from playground/libs/ui/collabsiblewidget
23 #ifndef COLLAPSIBLEWIDGET_H
24 #define COLLAPSIBLEWIDGET_H
26 #include <QScrollArea>
27 #include <QLabel>
28 #include <QDebug>
29 #include <QAbstractButton>
31 class QScrollArea;
33 class ClickableLabel : public QLabel
35 Q_OBJECT
36 public:
37 ClickableLabel( QWidget* parent = 0 );
38 ~ClickableLabel();
40 void mouseReleaseEvent( QMouseEvent *e );
42 signals:
43 void clicked();
46 class ArrowButton : public QAbstractButton
48 public:
49 ArrowButton(QWidget *parent = 0);
50 ~ArrowButton();
52 QSize sizeHint() const { return QSize(16, 16); }
54 protected:
55 void paintEvent( QPaintEvent* );
57 private:
60 /**
61 @short A widget that has a caption and a collapsible widget
62 @author Daniel Molkentin <molkentin@kde.org>
64 class Q_GUI_EXPORT CollapsibleWidget : public QWidget
66 Q_OBJECT
67 public:
68 CollapsibleWidget(QWidget *parent = 0);
69 explicit CollapsibleWidget(const QString& caption, QWidget *parent = 0);
70 ~CollapsibleWidget();
72 QString caption() const;
73 bool isExpanded() const;
75 QWidget* innerWidget() const;
76 void setInnerWidget( QWidget *w);
78 public slots:
79 void setExpanded(bool collapsed);
80 void setCaption(const QString& caption);
83 protected:
84 void init();
86 private slots:
87 void animateCollapse(qreal);
89 private:
90 Q_DISABLE_COPY( CollapsibleWidget )
91 class Private;
92 Private *d;
98 /**
99 @short A scrollable container that contains groups of settings,
100 usually in the form of CollapsibleWidgets.
101 @author Daniel Molkentin <molkentin@kde.org>
103 class Q_GUI_EXPORT SettingsContainer : public QScrollArea
105 Q_ENUMS( CollapseState )
106 Q_OBJECT
107 public:
108 enum CollapseState { Collapsed, Uncollapsed };
109 SettingsContainer( QWidget *parent = 0 );
110 ~SettingsContainer();
112 CollapsibleWidget* insertWidget( QWidget* w, const QString& name );
114 private:
115 Q_DISABLE_COPY( SettingsContainer )
116 class Private;
117 Private *d;
122 #endif // COLLAPSIBLEWIDGET_H