Debian Codegraph @

src/gui/modelessWindows/pinWindow/PinWindow.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2020 Damir Porobic <[email protected]>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
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
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #ifndef KSNIP_PINWINDOW_H
21 #define KSNIP_PINWINDOW_H
22
23 #include <QDialog>
24 #include <QImage>
25 #include <QPainter>
26 #include <QGraphicsDropShadowEffect>
27 #include <QVBoxLayout>
28 #include <QLabel>
29 #include <QMenu>
30 #include <QContextMenuEvent>
31 #include <QWheelEvent>
32
33 #include "src/gui/modelessWindows/IModelessWindow.h"
34
35 class PinWindow : public IModelessWindow
36 {
37 public:
38 explicit PinWindow(const QPixmap &pixmap, const QString &title);
39 ~PinWindow() override;
40
41 protected:
42 void mouseDoubleClickEvent(QMouseEvent *event) override;
43 void mousePressEvent(QMouseEvent *event) override;
44 void mouseReleaseEvent(QMouseEvent *event) override;
45 void mouseMoveEvent(QMouseEvent *event) override;
46 void contextMenuEvent(QContextMenuEvent *event) override;
47 void keyPressEvent(QKeyEvent *event) override;
48 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
49 void enterEvent(QEnterEvent *event) override;
50 #else
51 void enterEvent(QEvent *event) override;
52 #endif
53 void leaveEvent(QEvent *event) override;
54 void wheelEvent(QWheelEvent *event) override;
55
56 private:
57 QLabel *mCentralWidget;
58 QVBoxLayout *mLayout;
59 QGraphicsDropShadowEffect *mDropShadowEffect;
60 int mMargin;
61 int mMinSize;
62 QPixmap mImage;
63 QPoint mMoveOffset;
64 bool mIsMoving{};
65
66 void addDropShadow();
67 };
68
69 #endif //KSNIP_PINWINDOW_H