RazorAutostartEntry => LxQt::AutostartEntry
[lxde/liblxqt.git] / rotatedwidget.h
1 /* BEGIN_COMMON_COPYRIGHT_HEADER
2 * (c)LGPL2+
3 *
4 * Razor - a lightweight, Qt based, desktop toolset
5 * http://razor-qt.org
6 *
7 * Copyright: 2010-2013 Razor team
8 * Authors:
9 * Kuzma Shapran <kuzma.shapran@gmail.com>
10 *
11 * This program or library is free software; you can redistribute it
12 * and/or modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20
21 * You should have received a copy of the GNU Lesser General
22 * Public License along with this library; if not, write to the
23 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 * Boston, MA 02110-1301 USA
25 *
26 * END_COMMON_COPYRIGHT_HEADER */
27
28 #ifndef ROTATED_WIDGET_H
29 #define ROTATED_WIDGET_H
30
31 #include <QWidget>
32
33 class RotatedWidget: public QWidget
34 {
35 Q_OBJECT
36
37 Q_PROPERTY(Qt::Corner origin READ origin WRITE setOrigin)
38
39 Q_PROPERTY(bool transferMousePressEvent READ transferMousePressEvent WRITE setTransferMousePressEvent)
40 Q_PROPERTY(bool transferMouseReleaseEvent READ transferMouseReleaseEvent WRITE setTransferMouseReleaseEvent)
41 Q_PROPERTY(bool transferMouseDoubleClickEvent READ transferMouseDoubleClickEvent WRITE setTransferMouseDoubleClickEvent)
42 Q_PROPERTY(bool transferMouseMoveEvent READ transferMouseMoveEvent WRITE setTransferMouseMoveEvent)
43 #ifndef QT_NO_WHEELEVENT
44 Q_PROPERTY(bool transferWheelEvent READ transferWheelEvent WRITE setTransferWheelEvent)
45 #endif
46
47 Q_PROPERTY(bool transferEnterEvent READ transferEnterEvent WRITE setTransferEnterEvent)
48 Q_PROPERTY(bool transferLeaveEvent READ transferLeaveEvent WRITE setTransferLeaveEvent)
49
50 public:
51 explicit RotatedWidget(QWidget &content, QWidget* parent = 0, Qt::WindowFlags f = 0);
52
53 Qt::Corner origin() const;
54 void setOrigin(Qt::Corner);
55
56 QWidget * content() const;
57
58 void adjustContentSize();
59
60 virtual QSize minimumSizeHint() const;
61 virtual QSize sizeHint() const;
62
63 QSize adjustedSize(QSize) const;
64 QPoint adjustedPoint(QPoint) const;
65
66
67 bool transferMousePressEvent() const { return mTransferMousePressEvent; }
68 void setTransferMousePressEvent(bool value) { mTransferMousePressEvent = value; }
69
70 bool transferMouseReleaseEvent() const { return mTransferMouseReleaseEvent; }
71 void setTransferMouseReleaseEvent(bool value) { mTransferMouseReleaseEvent = value; }
72
73 bool transferMouseDoubleClickEvent() const { return mTransferMouseDoubleClickEvent; }
74 void setTransferMouseDoubleClickEvent(bool value) { mTransferMouseDoubleClickEvent = value; }
75
76 bool transferMouseMoveEvent() const { return mTransferMouseMoveEvent; }
77 void setTransferMouseMoveEvent(bool value) { mTransferMouseMoveEvent = value; }
78
79 #ifndef QT_NO_WHEELEVENT
80 bool transferWheelEvent() const { return mTransferWheelEvent; }
81 void setTransferWheelEvent(bool value) { mTransferWheelEvent = value; }
82 #endif
83
84 bool transferEnterEvent() const { return mTransferEnterEvent; }
85 void setTransferEnterEvent(bool value) { mTransferEnterEvent = value; }
86
87 bool transferLeaveEvent() const { return mTransferLeaveEvent; }
88 void setTransferLeaveEvent(bool value) { mTransferLeaveEvent = value; }
89
90 protected:
91 virtual void paintEvent(QPaintEvent *);
92
93 // Transition event handlers
94 virtual void mousePressEvent(QMouseEvent *);
95 virtual void mouseReleaseEvent(QMouseEvent *);
96 virtual void mouseDoubleClickEvent(QMouseEvent *);
97 virtual void mouseMoveEvent(QMouseEvent *);
98 #ifndef QT_NO_WHEELEVENT
99 virtual void wheelEvent(QWheelEvent *);
100 #endif
101 virtual void enterEvent(QEvent *);
102 virtual void leaveEvent(QEvent *);
103
104 virtual void resizeEvent(QResizeEvent *);
105
106 private:
107 QWidget *mContent;
108 Qt::Corner mOrigin;
109
110 bool mTransferMousePressEvent;
111 bool mTransferMouseReleaseEvent;
112 bool mTransferMouseDoubleClickEvent;
113 bool mTransferMouseMoveEvent;
114 #ifndef QT_NO_WHEELEVENT
115 bool mTransferWheelEvent;
116 #endif
117 bool mTransferEnterEvent;
118 bool mTransferLeaveEvent;
119 };
120
121 #endif