translations: Fix external translations logic
[lxde/liblxqt.git] / lxqtrotatedwidget.h
CommitLineData
4182f457
KS
1/* BEGIN_COMMON_COPYRIGHT_HEADER
2 * (c)LGPL2+
3 *
b9223fe7 4 * LXQt - a lightweight, Qt based, desktop toolset
4182f457
KS
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
b6483430
AS
28#ifndef LXQTROTATED_WIDGET_H
29#define LXQTROTATED_WIDGET_H
4182f457
KS
30
31#include <QWidget>
f9cba1ba 32#include "lxqtglobals.h"
4182f457 33
f05ba5af 34namespace LXQt
cb6d0217
AS
35{
36
f9cba1ba 37class LXQT_API RotatedWidget: public QWidget
4182f457
KS
38{
39 Q_OBJECT
40
41 Q_PROPERTY(Qt::Corner origin READ origin WRITE setOrigin)
42
3c68ef86
KS
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
4182f457 54public:
5cc7332d 55 explicit RotatedWidget(QWidget &content, QWidget* parent = 0, Qt::WindowFlags f = 0);
4182f457
KS
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
43ceadfa
KS
67 QSize adjustedSize(QSize) const;
68 QPoint adjustedPoint(QPoint) const;
69
3c68ef86
KS
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
4182f457
KS
94protected:
95 virtual void paintEvent(QPaintEvent *);
96
b7d6c34d
KS
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 *);
3c68ef86 107
b7d6c34d
KS
108 virtual void resizeEvent(QResizeEvent *);
109
4182f457
KS
110private:
111 QWidget *mContent;
112 Qt::Corner mOrigin;
3c68ef86
KS
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;
4182f457
KS
123};
124
f05ba5af 125} // namespace LXQt
b6483430 126#endif // LXQTROTATEDWIDGET_H