00001 //SEE: http://websvn.kde.org/trunk/playground/libs/ui/collapsiblewidget/kexpandablegroupbox.cpp?view=log 00002 00003 /* 00004 This file is part of the KDE libraries 00005 Copyright (C) 2005-2007 Daniel Molkentin <molkentin@kde.org> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License version 2 as published by the Free Software Foundation. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 #ifndef KEXPANDABLEGROUPBOX_H 00022 #define KEXPANDABLEGROUPBOX_H 00023 00024 #include <QtGui/QWidget> 00025 00026 class QScrollArea; 00027 00066 class /*Q_GUI_EXPORT*/ KExpandableGroupBox : public QWidget 00067 { 00068 Q_OBJECT 00069 00070 Q_PROPERTY(bool expanded READ isExpanded WRITE setExpanded) 00071 Q_PROPERTY(QString title READ title WRITE setTitle) 00072 Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) 00073 Q_PROPERTY(bool animateExpansion READ animateExpansion WRITE setAnimateExpansion) 00074 00075 public: 00083 explicit KExpandableGroupBox(QWidget *parent = 0); 00092 explicit KExpandableGroupBox(const QString& title, QWidget *parent = 0); 00093 ~KExpandableGroupBox(); 00094 00098 QString title() const; 00099 00104 bool isExpanded() const; 00105 00110 Qt::Alignment alignment() const; 00111 00116 QWidget* widget() const; 00117 00122 void setWidget(QWidget *w); 00123 00128 void setAlignment(Qt::Alignment a); 00129 00134 void setAnimateExpansion(bool animate); 00135 00141 bool animateExpansion() const; 00142 00144 QSize minimumSizeHint () const; 00145 00146 00147 public slots: 00152 void setExpanded(bool expanded); 00153 00158 void setTitle(const QString& title); 00159 00160 protected: 00161 void mouseReleaseEvent(QMouseEvent *ev); 00162 void paintEvent(QPaintEvent*); 00163 00164 private slots: 00165 void animateExpansion(qreal); 00166 00167 private: 00168 void init(); 00169 Q_DISABLE_COPY(KExpandableGroupBox) 00170 class Private; 00171 Private *d; 00172 00173 00174 }; 00175 00176 #endif // KEXPANDABLEGROUPBOX_H 00177