Update DBus Notify method annotation name
[lxde/liblxqt.git] / lxqtrotatedwidget.h
1 /* BEGIN_COMMON_COPYRIGHT_HEADER
2 * (c)LGPL2+
3 *
4 * LXQt - 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 LXQTROTATED_WIDGET_H
29 #define LXQTROTATED_WIDGET_H
30
31 #include <QWidget>
32 #include "lxqtglobals.h"
33
34 namespace LXQt
35 {
36
37 class LXQT_API RotatedWidget: public QWidget
38 {
39 Q_OBJECT
40
41 Q_PROPERTY(Qt::Corner origin READ origin WRITE setOrigin)
42
43 Q_PROPERTY(bool transferMousePressEvent READ transferMousePressEvent WRITE setTransferMousePressEvent)
44 Q_PROPERTY(bool transferMouseReleaseEvent READ transferMouseReleaseEvent WRITE setTransferMouseReleaseEvent)
45 Q_PROPERTY(bool transferMouseDoubleClickEvent READ transferMouseDoubleClickEvent WRITE setTransferMouseDoubleClickEvent)
46 Q_PROPERTY(bool transferMouseMoveEvent READ transferMouseMoveEvent WRITE setTransferMouseMoveEvent)
47 #ifndef QT_NO_WHEELEVENT
48 Q_PROPERTY(bool transferWheelEvent READ transferWheelEvent WRITE setTransferWheelEvent)
49 #endif
50
51 Q_PROPERTY(bool transferEnterEvent READ transferEnterEvent WRITE setTransferEnterEvent)
52 Q_PROPERTY(bool transferLeaveEvent READ transferLeaveEvent WRITE setTransferLeaveEvent)
53
54 public:
55 explicit RotatedWidget(QWidget &content, QWidget* parent = 0, Qt::WindowFlags f = 0);
56
57 Qt::Corner origin() const;
58 void setOrigin(Qt::Corner);
59
60 QWidget * content() const;
61
62 void adjustContentSize();
63
64 virtual QSize minimumSizeHint() const;
65 virtual QSize sizeHint() const;
66
67 QSize adjustedSize(QSize) const;
68 QPoint adjustedPoint(QPoint) const;
69
70
71 bool transferMousePressEvent() const { return mTransferMousePressEvent; }
72 void setTransferMousePressEvent(bool value) { mTransferMousePressEvent = value; }
73
74 bool transferMouseReleaseEvent() const { return mTransferMouseReleaseEvent; }
75 void setTransferMouseReleaseEvent(bool value) { mTransferMouseReleaseEvent = value; }
76
77 bool transferMouseDoubleClickEvent() const { return mTransferMouseDoubleClickEvent; }
78 void setTransferMouseDoubleClickEvent(bool value) { mTransferMouseDoubleClickEvent = value; }
79
80 bool transferMouseMoveEvent() const { return mTransferMouseMoveEvent; }
81 void setTransferMouseMoveEvent(bool value) { mTransferMouseMoveEvent = value; }
82
83 #ifndef QT_NO_WHEELEVENT
84 bool transferWheelEvent() const { return mTransferWheelEvent; }
85 void setTransferWheelEvent(bool value) { mTransferWheelEvent = value; }
86 #endif
87
88 bool transferEnterEvent() const { return mTransferEnterEvent; }
89 void setTransferEnterEvent(bool value) { mTransferEnterEvent = value; }
90
91 bool transferLeaveEvent() const { return mTransferLeaveEvent; }
92 void setTransferLeaveEvent(bool value) { mTransferLeaveEvent = value; }
93
94 protected:
95 virtual void paintEvent(QPaintEvent *);
96
97 // Transition event handlers
98 virtual void mousePressEvent(QMouseEvent *);
99 virtual void mouseReleaseEvent(QMouseEvent *);
100 virtual void mouseDoubleClickEvent(QMouseEvent *);
101 virtual void mouseMoveEvent(QMouseEvent *);
102 #ifndef QT_NO_WHEELEVENT
103 virtual void wheelEvent(QWheelEvent *);
104 #endif
105 virtual void enterEvent(QEvent *);
106 virtual void leaveEvent(QEvent *);
107
108 virtual void resizeEvent(QResizeEvent *);
109
110 private:
111 QWidget *mContent;
112 Qt::Corner mOrigin;
113
114 bool mTransferMousePressEvent;
115 bool mTransferMouseReleaseEvent;
116 bool mTransferMouseDoubleClickEvent;
117 bool mTransferMouseMoveEvent;
118 #ifndef QT_NO_WHEELEVENT
119 bool mTransferWheelEvent;
120 #endif
121 bool mTransferEnterEvent;
122 bool mTransferLeaveEvent;
123 };
124
125 } // namespace LXQt
126 #endif // LXQTROTATEDWIDGET_H