kopete/libkopete
collapsiblewidget.h
Go to the documentation of this file.00001 /* 00002 This file is part of the KDE libraries 00003 Copyright (C) 2005 Daniel Molkentin <molkentin@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License version 2 as published by the Free Software Foundation. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 /* 00021 * file copied from playground/libs/ui/collabsiblewidget 00022 */ 00023 #ifndef COLLAPSIBLEWIDGET_H 00024 #define COLLAPSIBLEWIDGET_H 00025 00026 #include <QScrollArea> 00027 #include <QLabel> 00028 #include <QDebug> 00029 #include <QAbstractButton> 00030 #include <kopete_export.h> 00031 00032 class QScrollArea; 00033 00034 class ClickableLabel : public QLabel 00035 { 00036 Q_OBJECT 00037 public: 00038 ClickableLabel( QWidget* parent = 0 ); 00039 ~ClickableLabel(); 00040 00041 void mouseReleaseEvent( QMouseEvent *e ); 00042 00043 signals: 00044 void clicked(); 00045 }; 00046 00047 class ArrowButton : public QAbstractButton 00048 { 00049 public: 00050 ArrowButton(QWidget *parent = 0); 00051 ~ArrowButton(); 00052 00053 QSize sizeHint() const { return QSize(16, 16); } 00054 00055 protected: 00056 void paintEvent( QPaintEvent* ); 00057 00058 private: 00059 }; 00060 00065 class KOPETE_EXPORT CollapsibleWidget : public QWidget 00066 { 00067 Q_OBJECT 00068 public: 00069 CollapsibleWidget(QWidget *parent = 0); 00070 explicit CollapsibleWidget(const QString& caption, QWidget *parent = 0); 00071 ~CollapsibleWidget(); 00072 00073 QString caption() const; 00074 bool isExpanded() const; 00075 00076 QWidget* innerWidget() const; 00077 void setInnerWidget( QWidget *w); 00078 00079 public slots: 00080 void setExpanded(bool collapsed); 00081 void setCaption(const QString& caption); 00082 00083 00084 protected: 00085 void init(); 00086 00087 private slots: 00088 void animateCollapse(qreal); 00089 00090 private: 00091 Q_DISABLE_COPY( CollapsibleWidget ) 00092 class Private; 00093 Private *d; 00094 00095 00096 }; 00097 00098 00104 class KOPETE_EXPORT SettingsContainer : public QScrollArea 00105 { 00106 Q_ENUMS( CollapseState ) 00107 Q_OBJECT 00108 public: 00109 enum CollapseState { Collapsed, Uncollapsed }; 00110 SettingsContainer( QWidget *parent = 0 ); 00111 ~SettingsContainer(); 00112 00113 CollapsibleWidget* insertWidget( QWidget* w, const QString& name ); 00114 00115 private: 00116 Q_DISABLE_COPY( SettingsContainer ) 00117 class Private; 00118 Private *d; 00119 }; 00120 00121 00122 00123 #endif // COLLAPSIBLEWIDGET_H 00124
KDE 4.2 API Reference