File indexing completed on 2024-05-12 16:39:55

0001 /* This file is part of the KDE project
0002    Copyright (C) 2011 Jarosław Staniek <staniek@kde.org>
0003 
0004    This program is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This program is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this program; see the file COPYING.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef KEXIANIMATEDLAYOUT_H
0021 #define KEXIANIMATEDLAYOUT_H
0022 
0023 #include <QStackedLayout>
0024 
0025 #include "kexiutils_export.h"
0026 
0027 //! A tool for animated switching between widgets in a given stacked layout.
0028 /*! Animation is performed if the graphic effects level is set at least
0029  at "simple" level, i.e. when
0030  (KexiUtils::graphicEffectsLevel() & KexiUtils::SimpleAnimationEffects) is true. */
0031 class KEXIUTILS_EXPORT KexiAnimatedLayout : public QStackedLayout
0032 {
0033     Q_OBJECT
0034 public:
0035     explicit KexiAnimatedLayout(QWidget* parent = 0);
0036 
0037     ~KexiAnimatedLayout();
0038 
0039 public Q_SLOTS:
0040     //! Sets the current widget to be the specified widget.
0041     /*! Animation is performed while switching the widgets
0042         (assuming animations are enabled (see the explanation
0043         for KexiAnimatedStackedLayout).
0044         The new current widget must already be contained in this stacked layout.
0045         Because of the animation, changing current widget is asynchronous, i.e.
0046         after this methods returns, current widget is not changed.
0047         Connect to signal QStackedLayout::currentChanged(int index) to be notified
0048         about actual change of the current widget when animation finishes.
0049         @note this method is not virtual, so when calling it, make sure
0050               the pointer is KexiAnimatedStackedLayout, not parent class QStackedLayout.
0051         @see setCurrentIndex() currentWidget() */
0052     void setCurrentWidget(QWidget* widget);
0053 
0054     //! Sets the current widget to be the specified index.
0055     /*! Animation is performed as for setCurrentWidget(). */
0056     void setCurrentIndex(int index);
0057 
0058 private:
0059     class Private;
0060     Private* const d;
0061 };
0062 
0063 #endif