KoResourceItemView.h 2.09 KB
Newer Older
Sven Langkamp's avatar
 
Sven Langkamp committed
1 2
/* This file is part of the KDE project
 * Copyright (C) 2008 Jan Hambrecht <jaham@gmx.net>
3
 * Copyright (c) 2011 José Luis Vergara <pentalis@gmail.com>
Sven Langkamp's avatar
 
Sven Langkamp committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * 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.
 */

#ifndef KORESOURCEITEMVIEW_H
#define KORESOURCEITEMVIEW_H

24
#include <KoTableView.h>
Sven Langkamp's avatar
Sven Langkamp committed
25
#include <KoIconToolTip.h>
26 27
#include <QScroller>
#include <KisKineticScroller.h>
Sven Langkamp's avatar
 
Sven Langkamp committed
28

Sven Langkamp's avatar
Sven Langkamp committed
29
class QEvent;
30
class QModelIndex;
Sven Langkamp's avatar
 
Sven Langkamp committed
31

32 33
#include "kritawidgets_export.h"

Sven Langkamp's avatar
 
Sven Langkamp committed
34
/// The resource view
35
class KRITAWIDGETS_EXPORT KoResourceItemView : public KoTableView
Sven Langkamp's avatar
 
Sven Langkamp committed
36
{
37 38
    Q_OBJECT

Sven Langkamp's avatar
 
Sven Langkamp committed
39
public:
40

41
    explicit KoResourceItemView(QWidget *parent = 0);
42
    ~KoResourceItemView() override { disconnect(); }
43

Sven Langkamp's avatar
 
Sven Langkamp committed
44
    /// reimplemented
45
    bool viewportEvent(QEvent *event) override;
46

47
Q_SIGNALS:
48 49

    void currentResourceChanged(const QModelIndex &);
50 51
    void currentResourceClicked(const QModelIndex &);

52
    void contextMenuRequested(const QPoint &);
53 54

protected:
55 56
    void contextMenuEvent(QContextMenuEvent *event) override;
    void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override;
57

58
    void mousePressEvent(QMouseEvent *event) override;
59 60 61

private Q_SLOTS:
    void slotItemClicked(const QModelIndex &index);
62
    void slotScrollerStateChange(QScroller::State state){ KisKineticScroller::updateCursor(this, state); }
63

Sven Langkamp's avatar
 
Sven Langkamp committed
64 65
private:
    KoIconToolTip m_tip;
66
    QModelIndex m_beforeClickIndex;
Sven Langkamp's avatar
 
Sven Langkamp committed
67 68 69
};

#endif // KORESOURCEITEMVIEW_H