File indexing completed on 2024-06-16 04:16:12

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2010 Matus Talcik <matus.talcik@gmail.com>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 /****************************************************************************
0007 **
0008 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
0009 ** All rights reserved.
0010 ** Contact: Nokia Corporation (qt-info@nokia.com)
0011 **
0012 ** This file is part of the QtGui module of the Qt Toolkit.
0013 **
0014 ** $QT_BEGIN_LICENSE:LGPL$
0015 ** No Commercial Usage
0016 ** This file contains pre-release code and may not be distributed.
0017 ** You may use this file in accordance with the terms and conditions
0018 ** contained in the Technology Preview License Agreement accompanying
0019 ** this package.
0020 **
0021 ** GNU Lesser General Public License Usage
0022 ** Alternatively, this file may be used under the terms of the GNU Lesser
0023 ** General Public License version 2.1 as published by the Free Software
0024 ** Foundation and appearing in the file LICENSE.LGPL included in the
0025 ** packaging of this file.  Please review the following information to
0026 ** ensure the GNU Lesser General Public License version 2.1 requirements
0027 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
0028 **
0029 ** In addition, as a special exception, Nokia gives you certain additional
0030 ** rights.  These rights are described in the Nokia Qt LGPL Exception
0031 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
0032 **
0033 ** If you have questions regarding the use of this file, please contact
0034 ** Nokia at qt-info@nokia.com.
0035 **
0036 **
0037 **
0038 **
0039 **
0040 **
0041 **
0042 **
0043 ** $QT_END_LICENSE$
0044 **
0045 ****************************************************************************/
0046 #ifndef KisUndoView_H
0047 #define KisUndoView_H
0048 
0049 #include <QListView>
0050 #include <QString>
0051 #include <QAction>
0052 #include <QMenu>
0053 #include <kis_types.h>
0054 #include <klocalizedstring.h>
0055 #include <KisKineticScroller.h>
0056 #include <kis_icon.h>
0057 #include "kis_canvas2.h"
0058 
0059 #ifndef QT_NO_UNDOVIEW
0060 
0061 class KisUndoViewPrivate;
0062 class KUndo2QStack;
0063 class KUndo2Group;
0064 class QIcon;
0065 
0066 class KisUndoView : public QListView
0067 {
0068     Q_OBJECT
0069     Q_PROPERTY(QString emptyLabel READ emptyLabel WRITE setEmptyLabel)
0070     Q_PROPERTY(QIcon cleanIcon READ cleanIcon WRITE setCleanIcon)
0071 
0072 public:
0073     explicit KisUndoView(QWidget *parent = 0);
0074     explicit KisUndoView(KUndo2QStack *stack, QWidget *parent = 0);
0075 #ifndef QT_NO_UNDOGROUP
0076     explicit KisUndoView(KUndo2Group *group, QWidget *parent = 0);
0077 #endif
0078     ~KisUndoView() override;
0079 
0080     KUndo2QStack *stack() const;
0081 #ifndef QT_NO_UNDOGROUP
0082     KUndo2Group *group() const;
0083 #endif
0084 
0085     void setEmptyLabel(const QString &label);
0086     QString emptyLabel() const;
0087 
0088     void setCleanIcon(const QIcon &icon);
0089     QIcon cleanIcon() const;
0090 
0091     void setCanvas(KisCanvas2* canvas);
0092 
0093 public Q_SLOTS:
0094     void setStack(KUndo2QStack *stack);
0095 #ifndef QT_NO_UNDOGROUP
0096     void setGroup(KUndo2Group *group);
0097 #endif
0098 
0099     void slotScrollerStateChanged(QScroller::State state){KisKineticScroller::updateCursor(this, state);}
0100 
0101 
0102 private:
0103     KisUndoViewPrivate* const d;
0104     Q_DISABLE_COPY(KisUndoView)
0105 };
0106 
0107 #endif // QT_NO_UNDOVIEW
0108 #endif // KisUndoView_H