rhodes 5.5.0.3 → 5.5.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -0
  3. data/lib/commonAPI/coreapi/ext/platform/android/src/com/rho/notification/NotificationSingleton.java +20 -8
  4. data/lib/commonAPI/coreapi/ext/platform/iphone/cpp_based_impl/SystemImpl.mm +1 -2
  5. data/lib/commonAPI/coreapi/ext/system.xml +1 -1
  6. data/platform/android/build/android.rake +1 -0
  7. data/platform/iphone/Classes/AppManager/AppManager.m +44 -3
  8. data/platform/iphone/Classes/NativeView/RhoNativeViewManager.mm +4 -3
  9. data/platform/iphone/Classes/NativeView/RhoNativeViewManagerOC.h +1 -1
  10. data/platform/iphone/Classes/RhoMainView.h +8 -2
  11. data/platform/iphone/Classes/RhoUIWebView.h +75 -0
  12. data/platform/iphone/Classes/RhoUIWebView.m +142 -0
  13. data/platform/iphone/Classes/RhoWKWebView.h +87 -0
  14. data/platform/iphone/Classes/RhoWKWebView.m +187 -0
  15. data/platform/iphone/Classes/RhoWebView.h +72 -0
  16. data/platform/iphone/Classes/RhoWebViewFabrique.h +35 -0
  17. data/platform/iphone/Classes/RhoWebViewFabrique.m +87 -0
  18. data/platform/iphone/Classes/Rhodes.m +17 -6
  19. data/platform/iphone/Classes/Signature.old/SignatureDelegate.m +11 -4
  20. data/platform/iphone/Classes/Signature/SignatureDelegate.m +3 -4
  21. data/platform/iphone/Classes/SimpleMainView.h +7 -5
  22. data/platform/iphone/Classes/SimpleMainView.m +174 -179
  23. data/platform/iphone/Classes/SplitView/RightViewController.h +2 -2
  24. data/platform/iphone/Classes/SplitView/RightViewController.m +9 -10
  25. data/platform/iphone/Classes/SplitView/SplittedMainView.h +2 -3
  26. data/platform/iphone/Classes/SplitView/SplittedMainView.m +10 -7
  27. data/platform/iphone/Classes/TabbedMainView.h +2 -1
  28. data/platform/iphone/Classes/TabbedMainView.m +13 -10
  29. data/platform/iphone/Classes/URLProtocol/CRhoURLProtocol.m +21 -5
  30. data/platform/iphone/Classes/WebView.m +1 -1
  31. data/platform/iphone/RhoAppBaseLib/RhoAppBaseLib.xcodeproj/project.pbxproj +40 -3
  32. data/platform/iphone/RhoLib/RhoLib.xcodeproj/project.pbxproj +4 -0
  33. data/platform/iphone/rbuild/iphone.rake +51 -0
  34. data/platform/shared/common/RhoNativeViewManager.h +9 -9
  35. data/platform/shared/common/RhodesApp.cpp +13 -1
  36. data/platform/shared/net/HttpServer.cpp +12 -2
  37. data/platform/shared/qt/rhodes/ExternalWebView.ui +11 -2
  38. data/platform/shared/qt/rhodes/QtMainWindow.cpp +9 -7
  39. data/platform/shared/qt/rhodes/QtMainWindow.ui +13 -4
  40. data/platform/shared/qt/rhodes/qkineticscroller.cpp +1245 -0
  41. data/platform/shared/qt/rhodes/qkineticscroller.h +165 -0
  42. data/platform/shared/qt/rhodes/qkineticscroller_p.h +168 -0
  43. data/platform/shared/qt/rhodes/qtflickgesture.cpp +696 -0
  44. data/platform/shared/qt/rhodes/qtflickgesture_p.h +107 -0
  45. data/platform/shared/qt/rhodes/qtscroller.cpp +2080 -0
  46. data/platform/shared/qt/rhodes/qtscroller.h +138 -0
  47. data/platform/shared/qt/rhodes/qtscroller_p.h +205 -0
  48. data/platform/shared/qt/rhodes/qtscrollerfilter.cpp +350 -0
  49. data/platform/shared/qt/rhodes/qtscrollerfilter_p.h +110 -0
  50. data/platform/shared/qt/rhodes/qtscrollerproperties.cpp +412 -0
  51. data/platform/shared/qt/rhodes/qtscrollerproperties.h +135 -0
  52. data/platform/shared/qt/rhodes/qtscrollerproperties_p.h +90 -0
  53. data/platform/shared/qt/rhodes/qtscrollevent.cpp +190 -0
  54. data/platform/shared/qt/rhodes/qtscrollevent.h +100 -0
  55. data/platform/shared/qt/rhodes/qtscrollevent_p.h +33 -0
  56. data/platform/shared/qt/rhodes/qwebviewkineticscroller.cpp +347 -0
  57. data/platform/shared/qt/rhodes/qwebviewkineticscroller.h +90 -0
  58. data/platform/shared/qt/rhodes/qwebviewselectionsuppressor.h +113 -0
  59. data/platform/shared/qt/rhodes/rhodes.pro +19 -0
  60. data/res/generators/rhogen.rb +307 -15
  61. data/res/generators/templates/application/app/Settings/err_sync.erb +12 -6
  62. data/res/generators/templates/application/app/Settings/home.erb +32 -17
  63. data/res/generators/templates/application/app/Settings/index.erb +55 -26
  64. data/res/generators/templates/application/app/Settings/javascript_index.html +111 -0
  65. data/res/generators/templates/application/app/Settings/javascript_login.html +65 -0
  66. data/res/generators/templates/application/app/Settings/login.erb +25 -19
  67. data/res/generators/templates/application/app/Settings/reset.erb +18 -9
  68. data/res/generators/templates/application/app/Settings/wait.erb +10 -7
  69. data/res/generators/templates/application/app/index.erb +32 -20
  70. data/res/generators/templates/application/app/javascript_index.html +66 -0
  71. data/res/generators/templates/application/app/javascript_index.js +250 -0
  72. data/res/generators/templates/application/app/layout.erb +12 -67
  73. data/res/generators/templates/application/javascript_build.yml +41 -0
  74. data/res/generators/templates/application/javascript_rhoconfig.txt +123 -0
  75. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.css +587 -0
  76. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.css.map +1 -0
  77. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.min.css +6 -0
  78. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap-theme.min.css.map +1 -0
  79. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.css +6757 -0
  80. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.css.map +1 -0
  81. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.min.css +6 -0
  82. data/res/generators/templates/application/public/bootstrap-3.3.7/css/bootstrap.min.css.map +1 -0
  83. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.eot +0 -0
  84. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.svg +288 -0
  85. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.ttf +0 -0
  86. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff +0 -0
  87. data/res/generators/templates/application/public/bootstrap-3.3.7/fonts/glyphicons-halflings-regular.woff2 +0 -0
  88. data/res/generators/templates/application/public/bootstrap-3.3.7/js/bootstrap.js +2377 -0
  89. data/res/generators/templates/application/public/bootstrap-3.3.7/js/bootstrap.min.js +7 -0
  90. data/res/generators/templates/application/public/bootstrap-3.3.7/js/npm.js +13 -0
  91. data/res/generators/templates/application/public/css/style.css +3 -0
  92. data/res/generators/templates/application/public/jquery/jquery-3.1.1.min.js +4 -0
  93. data/res/generators/templates/application/public/jquery/jquery-3.1.1.min.map +1 -0
  94. data/res/generators/templates/application/rhoconfig.txt +16 -0
  95. data/res/generators/templates/iphone_project/Bremen7.xcodeproj/project.pbxproj +4 -0
  96. data/res/generators/templates/model/edit.erb +22 -21
  97. data/res/generators/templates/model/index.erb +24 -22
  98. data/res/generators/templates/model/javascript_edit.html +65 -0
  99. data/res/generators/templates/model/javascript_index.html +56 -0
  100. data/res/generators/templates/model/javascript_index.js +83 -0
  101. data/res/generators/templates/model/javascript_model.js +16 -0
  102. data/res/generators/templates/model/javascript_new.html +64 -0
  103. data/res/generators/templates/model/javascript_show.html +66 -0
  104. data/res/generators/templates/model/new.erb +22 -19
  105. data/res/generators/templates/model/show.erb +22 -14
  106. data/res/prebuild_base_app/app/index.erb +31 -18
  107. data/res/prebuild_base_app/app/layout.erb +11 -56
  108. data/version +1 -1
  109. metadata +59 -24
  110. data/res/generators/templates/application/public/css/android.css +0 -418
  111. data/res/generators/templates/application/public/css/iphone.css +0 -378
  112. data/res/generators/templates/application/public/css/jqmobile-patch.css +0 -62
  113. data/res/generators/templates/application/public/css/re_webkit.css +0 -736
  114. data/res/generators/templates/application/public/css/re_webkit_flat.css +0 -753
  115. data/res/generators/templates/application/public/css/windows_mobile.css +0 -327
  116. data/res/generators/templates/application/public/jqmobile/images/ajax-loader.gif +0 -0
  117. data/res/generators/templates/application/public/jqmobile/images/icon-search-black.png +0 -0
  118. data/res/generators/templates/application/public/jqmobile/images/icons-18-black.png +0 -0
  119. data/res/generators/templates/application/public/jqmobile/images/icons-18-white.png +0 -0
  120. data/res/generators/templates/application/public/jqmobile/images/icons-36-black.png +0 -0
  121. data/res/generators/templates/application/public/jqmobile/images/icons-36-white.png +0 -0
  122. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.css +0 -3
  123. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.js +0 -10
  124. data/res/generators/templates/application/public/jqmobile/jquery.mobile-1.4.5.min.map +0 -1
  125. data/res/generators/templates/application/public/jqmobile/jquery.mobile.structure-1.4.5.min.css +0 -3
  126. data/res/generators/templates/application/public/jqmobile/jquery.mobile.theme-1.4.5.min.css +0 -3
  127. data/res/generators/templates/application/public/jquery/jquery-1.9.1.min.js +0 -5
  128. data/res/generators/templates/application/public/jquery/jquery-1.9.1.min.map +0 -1
  129. data/res/generators/templates/application/public/js/application.js +0 -1
  130. data/res/generators/templates/application/public/js/jqmobile-patch.js +0 -466
  131. data/res/generators/templates/application/public/js/syncengine.js +0 -504
@@ -0,0 +1,135 @@
1
+ /****************************************************************************
2
+ **
3
+ ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ** All rights reserved.
5
+ ** Contact: Nokia Corporation (qt-info@nokia.com)
6
+ **
7
+ ** This file is part of the QtGui module of the Qt Toolkit.
8
+ **
9
+ ** $QT_BEGIN_LICENSE:LGPL$
10
+ ** No Commercial Usage
11
+ ** This file contains pre-release code and may not be distributed.
12
+ ** You may use this file in accordance with the terms and conditions
13
+ ** contained in the Technology Preview License Agreement accompanying
14
+ ** this package.
15
+ **
16
+ ** GNU Lesser General Public License Usage
17
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
18
+ ** General Public License version 2.1 as published by the Free Software
19
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
20
+ ** packaging of this file. Please review the following information to
21
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
22
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23
+ **
24
+ ** In addition, as a special exception, Nokia gives you certain additional
25
+ ** rights. These rights are described in the Nokia Qt LGPL Exception
26
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27
+ **
28
+ ** If you have questions regarding the use of this file, please contact
29
+ ** Nokia at qt-info@nokia.com.
30
+ **
31
+ **
32
+ **
33
+ **
34
+ **
35
+ **
36
+ **
37
+ **
38
+ ** $QT_END_LICENSE$
39
+ **
40
+ ****************************************************************************/
41
+
42
+ #ifndef QTSCROLLERPROPERTIES_H
43
+ #define QTSCROLLERPROPERTIES_H
44
+
45
+ #include <QtCore/QScopedPointer>
46
+ #include <QtCore/QMetaType>
47
+ #include <QtCore/QVariant>
48
+
49
+ #if (QT_VERSION < QT_VERSION_CHECK(4, 7, 0))
50
+ # include <QEasingCurve>
51
+ Q_DECLARE_METATYPE(QEasingCurve)
52
+ #endif
53
+
54
+ class QtScroller;
55
+ class QtScrollerPrivate;
56
+ class QtScrollerPropertiesPrivate;
57
+
58
+ class QtScrollerProperties
59
+ {
60
+ public:
61
+ QtScrollerProperties();
62
+ QtScrollerProperties(const QtScrollerProperties &sp);
63
+ QtScrollerProperties &operator=(const QtScrollerProperties &sp);
64
+ virtual ~QtScrollerProperties();
65
+
66
+ bool operator==(const QtScrollerProperties &sp) const;
67
+ bool operator!=(const QtScrollerProperties &sp) const;
68
+
69
+ static void setDefaultScrollerProperties(const QtScrollerProperties &sp);
70
+ static void unsetDefaultScrollerProperties();
71
+
72
+ enum OvershootPolicy
73
+ {
74
+ OvershootWhenScrollable,
75
+ OvershootAlwaysOff,
76
+ OvershootAlwaysOn
77
+ };
78
+
79
+ enum FrameRates {
80
+ Standard,
81
+ Fps60,
82
+ Fps30,
83
+ Fps20
84
+ };
85
+
86
+ enum ScrollMetric
87
+ {
88
+ MousePressEventDelay, // qreal [s]
89
+ DragStartDistance, // qreal [m]
90
+ DragVelocitySmoothingFactor, // qreal [0..1/s] (complex calculation involving time) v = v_new* DASF + v_old * (1-DASF)
91
+ AxisLockThreshold, // qreal [0..1] atan(|min(dx,dy)|/|max(dx,dy)|)
92
+
93
+ ScrollingCurve, // QEasingCurve
94
+ DecelerationFactor, // slope of the curve
95
+
96
+ MinimumVelocity, // qreal [m/s]
97
+ MaximumVelocity, // qreal [m/s]
98
+ MaximumClickThroughVelocity, // qreal [m/s]
99
+
100
+ AcceleratingFlickMaximumTime, // qreal [s]
101
+ AcceleratingFlickSpeedupFactor, // qreal [1..]
102
+
103
+ SnapPositionRatio, // qreal [0..1]
104
+ SnapTime, // qreal [s]
105
+
106
+ OvershootDragResistanceFactor, // qreal [0..1]
107
+ OvershootDragDistanceFactor, // qreal [0..1]
108
+ OvershootScrollDistanceFactor, // qreal [0..1]
109
+ OvershootScrollTime, // qreal [s]
110
+
111
+ HorizontalOvershootPolicy, // enum OvershootPolicy
112
+ VerticalOvershootPolicy, // enum OvershootPolicy
113
+ FrameRate, // enum FrameRates
114
+
115
+ ScrollMetricCount
116
+ };
117
+
118
+ QVariant scrollMetric(ScrollMetric metric) const;
119
+ void setScrollMetric(ScrollMetric metric, const QVariant &value);
120
+
121
+ protected:
122
+ QScopedPointer<QtScrollerPropertiesPrivate> d;
123
+
124
+ private:
125
+ QtScrollerProperties(QtScrollerPropertiesPrivate &dd);
126
+
127
+ friend class QtScrollerPropertiesPrivate;
128
+ friend class QtScroller;
129
+ friend class QtScrollerPrivate;
130
+ };
131
+
132
+ Q_DECLARE_METATYPE(QtScrollerProperties::OvershootPolicy)
133
+ Q_DECLARE_METATYPE(QtScrollerProperties::FrameRates)
134
+
135
+ #endif // QTSCROLLERPROPERTIES_H
@@ -0,0 +1,90 @@
1
+ /****************************************************************************
2
+ **
3
+ ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ** All rights reserved.
5
+ ** Contact: Nokia Corporation (qt-info@nokia.com)
6
+ **
7
+ ** This file is part of the QtGui module of the Qt Toolkit.
8
+ **
9
+ ** $QT_BEGIN_LICENSE:LGPL$
10
+ ** No Commercial Usage
11
+ ** This file contains pre-release code and may not be distributed.
12
+ ** You may use this file in accordance with the terms and conditions
13
+ ** contained in the Technology Preview License Agreement accompanying
14
+ ** this package.
15
+ **
16
+ ** GNU Lesser General Public License Usage
17
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
18
+ ** General Public License version 2.1 as published by the Free Software
19
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
20
+ ** packaging of this file. Please review the following information to
21
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
22
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23
+ **
24
+ ** In addition, as a special exception, Nokia gives you certain additional
25
+ ** rights. These rights are described in the Nokia Qt LGPL Exception
26
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27
+ **
28
+ ** If you have questions regarding the use of this file, please contact
29
+ ** Nokia at qt-info@nokia.com.
30
+ **
31
+ **
32
+ **
33
+ **
34
+ **
35
+ **
36
+ **
37
+ **
38
+ ** $QT_END_LICENSE$
39
+ **
40
+ ****************************************************************************/
41
+
42
+ #ifndef QTSCROLLERPROPERTIES_P_H
43
+ #define QTSCROLLERPROPERTIES_P_H
44
+
45
+ //
46
+ // W A R N I N G
47
+ // -------------
48
+ //
49
+ // This file is not part of the Qt API. It exists purely as an
50
+ // implementation detail. This header file may change from version to
51
+ // version without notice, or even be removed.
52
+ //
53
+ // We mean it.
54
+ //
55
+
56
+ #include <QPointF>
57
+ #include <QEasingCurve>
58
+ #include "qtscrollerproperties.h"
59
+
60
+ class QtScrollerPropertiesPrivate
61
+ {
62
+ public:
63
+ static QtScrollerPropertiesPrivate *defaults();
64
+
65
+ bool operator==(const QtScrollerPropertiesPrivate &) const;
66
+
67
+ qreal mousePressEventDelay;
68
+ qreal dragStartDistance;
69
+ qreal dragVelocitySmoothingFactor;
70
+ qreal axisLockThreshold;
71
+ QEasingCurve scrollingCurve;
72
+ qreal decelerationFactor;
73
+ qreal minimumVelocity;
74
+ qreal maximumVelocity;
75
+ qreal maximumClickThroughVelocity;
76
+ qreal acceleratingFlickMaximumTime;
77
+ qreal acceleratingFlickSpeedupFactor;
78
+ qreal snapPositionRatio;
79
+ qreal snapTime;
80
+ qreal overshootDragResistanceFactor;
81
+ qreal overshootDragDistanceFactor;
82
+ qreal overshootScrollDistanceFactor;
83
+ qreal overshootScrollTime;
84
+
85
+ QtScrollerProperties::OvershootPolicy hOvershootPolicy;
86
+ QtScrollerProperties::OvershootPolicy vOvershootPolicy;
87
+ QtScrollerProperties::FrameRates frameRate;
88
+ };
89
+
90
+ #endif // QTSCROLLERPROPERTIES_P_H
@@ -0,0 +1,190 @@
1
+ #include <qtscrollevent.h>
2
+ #include <qtscrollevent_p.h>
3
+
4
+ /*!
5
+ \class QtScrollPrepareEvent
6
+ \since 4.8
7
+ \ingroup events
8
+
9
+ \brief The QtScrollPrepareEvent class is send in preparation of a scrolling.
10
+
11
+ The scroll prepare event is send before scrolling (usually by QtScroller) is started.
12
+ The object receiving this event should set viewportSize, maxContentPos and contentPos.
13
+ It also should accept this event to indicate that scrolling should be started.
14
+
15
+ It is not guaranteed that a QtScrollEvent will be send after an acceepted
16
+ QtScrollPrepareEvent, e.g. in a case where the maximum content position is (0,0).
17
+
18
+ \sa QScrollEvent, QScroller
19
+ */
20
+
21
+ /*!
22
+ Creates new QScrollPrepareEvent
23
+ The \a startPos is the position of a touch or mouse event that started the scrolling.
24
+ */
25
+ QtScrollPrepareEvent::QtScrollPrepareEvent(const QPointF &startPos)
26
+ : QEvent(static_cast<QEvent::Type>(ScrollPrepare)),
27
+ d(new QtScrollPrepareEventPrivate())
28
+ {
29
+ d->startPos = startPos;
30
+ }
31
+
32
+ /*!
33
+ Destroys QtScrollPrepareEvent.
34
+ */
35
+ QtScrollPrepareEvent::~QtScrollPrepareEvent()
36
+ {
37
+ }
38
+
39
+ /*!
40
+ Returns the position of the touch or mouse event that started the scrolling.
41
+ */
42
+ QPointF QtScrollPrepareEvent::startPos() const
43
+ {
44
+ return d->startPos;
45
+ }
46
+
47
+ /*!
48
+ Returns size of the area that is to be scrolled as set by setViewportSize
49
+
50
+ \sa setViewportSize()
51
+ */
52
+ QSizeF QtScrollPrepareEvent::viewportSize() const
53
+ {
54
+ return d->viewportSize;
55
+ }
56
+
57
+ /*!
58
+ Returns maximum coordinates for the content as set by setMaximumContentRect.
59
+
60
+ \sa setMaximumContentRect()
61
+ */
62
+ QRectF QtScrollPrepareEvent::contentPosRange() const
63
+ {
64
+ return d->contentPosRange;
65
+ }
66
+
67
+ /*!
68
+ Returns the current position of the content as set by setContentPos.
69
+ */
70
+ QPointF QtScrollPrepareEvent::contentPos() const
71
+ {
72
+ return d->contentPos;
73
+ }
74
+
75
+
76
+ /*!
77
+ Sets the size of the area that is to be scrolled to \a size.
78
+
79
+ \sa viewportSize()
80
+ */
81
+ void QtScrollPrepareEvent::setViewportSize(const QSizeF &size)
82
+ {
83
+ d->viewportSize = size;
84
+ }
85
+
86
+ /*!
87
+ Sets the maximum content coordinates to \a rect.
88
+
89
+ \sa contentPosRange
90
+ */
91
+ void QtScrollPrepareEvent::setContentPosRange(const QRectF &rect)
92
+ {
93
+ d->contentPosRange = rect;
94
+ }
95
+
96
+ /*!
97
+ Sets the current content position to \a pos.
98
+
99
+ \sa contentPos()
100
+ */
101
+ void QtScrollPrepareEvent::setContentPos(const QPointF &pos)
102
+ {
103
+ d->contentPos = pos;
104
+ }
105
+
106
+
107
+ /*!
108
+ \class QtScrollEvent
109
+ \since 4.8
110
+ \ingroup events
111
+
112
+ \brief The QtScrollEvent class is send when scrolling.
113
+
114
+ The scroll event is send to indicate that the receiver should be scrolled.
115
+ Usually the receiver should be something visual like QWidget or QGraphicsObject.
116
+
117
+ Some care should be taken that no conflicting QtScrollEvents are sent from two
118
+ sources. Using QtScroller::scrollTo is safe however.
119
+
120
+ \sa QtScrollPrepareEvent, QtScroller
121
+ */
122
+
123
+ /*!
124
+ \enum QtScrollEvent::ScrollStateFlag
125
+
126
+ This enum describes the states a scroll event can have.
127
+
128
+ \value ScrollStarted Set for the first scroll event of a scroll activity.
129
+
130
+ \value ScrollUpdated Set for all but the first and the last scroll event of a scroll activity.
131
+
132
+ \value ScrollFinished Set for the last scroll event of a scroll activity.
133
+
134
+ \sa QtScrollEvent::scrollState
135
+ */
136
+
137
+ /*!
138
+ Creates a new QtScrollEvent
139
+ \a contentPos is the new content position, \a overshootDistance is the
140
+ new overshoot distance while \a scrollState indicates if this scroll
141
+ event is the first one, the last one or some event in between.
142
+ */
143
+ QtScrollEvent::QtScrollEvent(const QPointF &contentPos, const QPointF &overshootDistance, ScrollState scrollState)
144
+ : QEvent(static_cast<QEvent::Type>(Scroll)),
145
+ d(new QtScrollEventPrivate())
146
+ {
147
+ d->contentPos = contentPos;
148
+ d->overshoot= overshootDistance;
149
+ d->state = scrollState;
150
+ }
151
+
152
+ /*!
153
+ Destroys QtScrollEvent.
154
+ */
155
+ QtScrollEvent::~QtScrollEvent()
156
+ {
157
+ }
158
+
159
+ /*!
160
+ Returns the new scroll position.
161
+ */
162
+ QPointF QtScrollEvent::contentPos() const
163
+ {
164
+ return d->contentPos;
165
+ }
166
+
167
+ /*!
168
+ Returns the new overshoot distance.
169
+ See QtScroller for an explanation of the term overshoot.
170
+
171
+ \sa QtScroller
172
+ */
173
+ QPointF QtScrollEvent::overshootDistance() const
174
+ {
175
+ return d->overshoot;
176
+ }
177
+
178
+ /*!
179
+ Returns the current scroll state as a combination of ScrollStateFlag values.
180
+ ScrollStarted (or ScrollFinished) will be set, if this scroll event is the first (or last) event in a scrolling activity.
181
+ Please note that both values can be set at the same time, if the activity consists of a single QScrollEvent.
182
+ All other scroll events in between will have their state set to ScrollUpdated.
183
+
184
+ A widget could for example revert selections when scrolling is started and stopped.
185
+ \sa isLast()
186
+ */
187
+ QtScrollEvent::ScrollState QtScrollEvent::scrollState() const
188
+ {
189
+ return d->state;
190
+ }
@@ -0,0 +1,100 @@
1
+ /****************************************************************************
2
+ **
3
+ ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ** All rights reserved.
5
+ ** Contact: Nokia Corporation (qt-info@nokia.com)
6
+ **
7
+ ** This file is part of the QtGui module of the Qt Toolkit.
8
+ **
9
+ ** $QT_BEGIN_LICENSE:LGPL$
10
+ ** No Commercial Usage
11
+ ** This file contains pre-release code and may not be distributed.
12
+ ** You may use this file in accordance with the terms and conditions
13
+ ** contained in the Technology Preview License Agreement accompanying
14
+ ** this package.
15
+ **
16
+ ** GNU Lesser General Public License Usage
17
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
18
+ ** General Public License version 2.1 as published by the Free Software
19
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
20
+ ** packaging of this file. Please review the following information to
21
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
22
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23
+ **
24
+ ** In addition, as a special exception, Nokia gives you certain additional
25
+ ** rights. These rights are described in the Nokia Qt LGPL Exception
26
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27
+ **
28
+ ** If you have questions regarding the use of this file, please contact
29
+ ** Nokia at qt-info@nokia.com.
30
+ **
31
+ **
32
+ **
33
+ **
34
+ **
35
+ **
36
+ **
37
+ **
38
+ ** $QT_END_LICENSE$
39
+ **
40
+ ****************************************************************************/
41
+
42
+ #ifndef QTSCROLLEVENT_H
43
+ #define QTSCROLLEVENT_H
44
+
45
+ #include <QEvent>
46
+ #include <QPointF>
47
+ #include <QSizeF>
48
+ #include <QRectF>
49
+ #include <QScopedPointer>
50
+
51
+
52
+ class QtScrollPrepareEventPrivate;
53
+ class QtScrollPrepareEvent : public QEvent
54
+ {
55
+ public:
56
+ enum { ScrollPrepare = 15056 }; // random number
57
+
58
+ QtScrollPrepareEvent(const QPointF &startPos);
59
+ ~QtScrollPrepareEvent();
60
+
61
+ QPointF startPos() const;
62
+
63
+ QSizeF viewportSize() const;
64
+ QRectF contentPosRange() const;
65
+ QPointF contentPos() const;
66
+
67
+ void setViewportSize(const QSizeF &size);
68
+ void setContentPosRange(const QRectF &rect);
69
+ void setContentPos(const QPointF &pos);
70
+
71
+ private:
72
+ QScopedPointer<QtScrollPrepareEventPrivate> d;
73
+ };
74
+
75
+
76
+ class QtScrollEventPrivate;
77
+ class QtScrollEvent : public QEvent
78
+ {
79
+ public:
80
+ enum { Scroll = 15057 }; // random number
81
+
82
+ enum ScrollState
83
+ {
84
+ ScrollStarted,
85
+ ScrollUpdated,
86
+ ScrollFinished
87
+ };
88
+
89
+ QtScrollEvent(const QPointF &contentPos, const QPointF &overshoot, ScrollState scrollState);
90
+ ~QtScrollEvent();
91
+
92
+ QPointF contentPos() const;
93
+ QPointF overshootDistance() const;
94
+ ScrollState scrollState() const;
95
+
96
+ private:
97
+ QScopedPointer<QtScrollEventPrivate> d;
98
+ };
99
+
100
+ #endif // QTSCROLLEVENT_H