File: krmousehandler.h

package info (click to toggle)
krusader 2%3A2.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 25,448 kB
  • sloc: cpp: 56,112; ansic: 1,187; xml: 811; sh: 23; makefile: 3
file content (73 lines) | stat: -rw-r--r-- 1,691 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*
    SPDX-FileCopyrightText: 2009 Csaba Karai <cskarai@freemail.hu>
    SPDX-FileCopyrightText: 2009-2022 Krusader Krew <https://krusader.org>

    SPDX-License-Identifier: GPL-2.0-or-later
*/

#ifndef KRMOUSEHANDLER_H
#define KRMOUSEHANDLER_H

// QtCore
#include <QPoint>
#include <QStringList>
#include <QTime>
#include <QTimer>

class QMouseEvent;
class QWheelEvent;
class KrView;
class KrViewItem;
class QDragEnterEvent;
class QDragMoveEvent;
class QDragLeaveEvent;
class QDropEvent;

/**
 * @brief Mouse handler for view
 */
class KrMouseHandler : public QObject
{
    Q_OBJECT

public:
    KrMouseHandler(KrView *view, int contextMenuShift);

    bool mousePressEvent(QMouseEvent *e);
    bool mouseReleaseEvent(QMouseEvent *e);
    bool mouseDoubleClickEvent(QMouseEvent *e);
    bool mouseMoveEvent(QMouseEvent *e);
    bool wheelEvent(QWheelEvent *);
    bool dragEnterEvent(QDragEnterEvent *e);
    bool dragMoveEvent(QDragMoveEvent *e);
    bool dragLeaveEvent(QDragLeaveEvent *e);
    bool dropEvent(QDropEvent *e);
    void handleContextMenu(KrViewItem *it, const QPoint &pos);
    void otherEvent(QEvent *e);
    void cancelTwoClickRename();

public slots:
    void showContextMenu();

signals:
    void renameCurrentItem();

protected:
    KrView *_view;
    KrViewItem *_rightClickedItem;
    KrViewItem *_clickedItem;
    bool _rightClickSelects;
    bool _singleClick;
    QPoint _contextMenuPoint;
    QTimer _contextMenuTimer;
    int _contextMenuShift;
    bool _singleClicked;
    KrViewItem *_singleClickedItem;
    QTime _singleClickTime;
    QTimer _renameTimer;
    QPoint _dragStartPos;
    bool _emptyContextMenu;
    QStringList _selectedItemNames;
};

#endif