1
/* This file is part of the KDE project
2
Copyright (C) 2011 Jarosław Staniek <staniek@kde.org>
4
This program is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Library General Public
6
License as published by the Free Software Foundation; either
7
version 2 of the License, or (at your option) any later version.
9
This program 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 program; see the file COPYING. If not, write to
16
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17
* Boston, MA 02110-1301, USA.
20
#ifndef KEXIANIMATEDLAYOUT_H
21
#define KEXIANIMATEDLAYOUT_H
23
#include <QStackedLayout>
25
#include "kexiutils_export.h"
27
//! A tool for animated switching between widgets in a given stacked layout.
28
/*! Animation is performed if the graphic effects level is set at least
29
at "simple" level, i.e. when
30
(KexiUtils::graphicEffectsLevel() & KexiUtils::SimpleAnimationEffects) is true. */
31
class KEXIUTILS_EXPORT KexiAnimatedLayout : public QStackedLayout
35
explicit KexiAnimatedLayout(QWidget* parent = 0);
37
~KexiAnimatedLayout();
40
//! Sets the current widget to be the specified widget.
41
/*! Animation is performed while switching the widgets
42
(assuming animations are enabled (see the explanation
43
for @ref KexiAnimatedStackedLayout).
44
The new current widget must already be contained in this stacked layout.
45
Because of the animation, changing current widget is asynchronous, i.e.
46
after this methods returns, current widget is not changed.
47
Connect to signal QStackedLayout::currentChanged(int index) to be notified
48
about actual change of the current widget when animation finishes.
49
@note this method is not virtual, so when calling it, make sure
50
the pointer is KexiAnimatedStackedLayout, not parent class QStackedLayout.
51
@see setCurrentIndex() currentWidget() */
52
void setCurrentWidget(QWidget* widget);
54
//! Sets the current widget to be the specified index.
55
/*! Animation is performed as for setCurrentWidget(). */
56
void setCurrentIndex(int index);