kde-workspace/kcontrol/randr/collapsiblewidget.h

116 lines
2.7 KiB
C
Raw Normal View History

2014-11-13 19:30:51 +02:00
/*
This file is part of the KDE libraries
Copyright (C) 2005 Daniel Molkentin <molkentin@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
/*
* file copied from playground/libs/ui/collabsiblewidget
*/
#ifndef COLLAPSIBLEWIDGET_H
#define COLLAPSIBLEWIDGET_H
#include <QScrollArea>
#include <QLabel>
#include <QDebug>
#include <QAbstractButton>
#include <QScrollArea>
2014-11-13 19:30:51 +02:00
class ClickableLabel : public QLabel
{
Q_OBJECT
public:
ClickableLabel(QWidget* parent = 0);
2014-11-13 19:30:51 +02:00
~ClickableLabel();
void mouseReleaseEvent(QMouseEvent *e);
2014-11-13 19:30:51 +02:00
signals:
2014-11-13 19:30:51 +02:00
void clicked();
};
class ArrowButton : public QAbstractButton
{
public:
2014-11-13 19:30:51 +02:00
ArrowButton(QWidget *parent = 0);
~ArrowButton();
QSize sizeHint() const { return QSize(16, 16); }
protected:
void paintEvent(QPaintEvent*);
2014-11-13 19:30:51 +02:00
};
/**
@short A widget that has a caption and a collapsible widget
@author Daniel Molkentin <molkentin@kde.org>
*/
class Q_GUI_EXPORT CollapsibleWidget : public QWidget
{
Q_OBJECT
public:
2014-11-13 19:30:51 +02:00
CollapsibleWidget(QWidget *parent = 0);
explicit CollapsibleWidget(const QString& caption, QWidget *parent = 0);
~CollapsibleWidget();
QString caption() const;
bool isExpanded() const;
QWidget* innerWidget() const;
void setInnerWidget(QWidget *w);
2014-11-13 19:30:51 +02:00
public slots:
2014-11-13 19:30:51 +02:00
void setExpanded(bool collapsed);
void setCaption(const QString& caption);
protected:
2014-11-13 19:30:51 +02:00
void init();
private slots:
2014-11-13 19:30:51 +02:00
void animateCollapse(qreal);
private:
Q_DISABLE_COPY(CollapsibleWidget)
2014-11-13 19:30:51 +02:00
class Private;
Private *d;
};
/**
@short A scrollable container that contains groups of settings,
usually in the form of CollapsibleWidgets.
@author Daniel Molkentin <molkentin@kde.org>
*/
class Q_GUI_EXPORT SettingsContainer : public QScrollArea
{
Q_ENUMS(CollapseState)
2014-11-13 19:30:51 +02:00
Q_OBJECT
public:
2014-11-13 19:30:51 +02:00
enum CollapseState { Collapsed, Uncollapsed };
SettingsContainer( QWidget *parent = 0 );
~SettingsContainer();
CollapsibleWidget* insertWidget(QWidget* w, const QString& name);
2014-11-13 19:30:51 +02:00
private:
Q_DISABLE_COPY(SettingsContainer)
2014-11-13 19:30:51 +02:00
class Private;
Private *d;
};
#endif // COLLAPSIBLEWIDGET_H