1 #ifndef __DALI_TOOLKIT_PAGE_TURN_VIEW_H__
2 #define __DALI_TOOLKIT_PAGE_TURN_VIEW_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali-toolkit/public-api/controls/control.h>
30 // Forward declarations
33 namespace Internal DALI_INTERNAL
39 * @brief PageTurnView is a base class of different mode of pageTurnViews ( portrait or landscape )
41 * Page actors are provided from an external PageFactory
42 * PanGesture is used to activate the page bending, streching and tuning forward/backward
44 * Signal usage: There are four signals. Two matching pairs for panning and page turning:
45 * PagePanStarted/PagePanFinished and PageTurnStarted/PageTurnFinished. Panning relates to user interaction with
46 * the screen while page turning refers to animation of the page. There are three scenarios for these
47 * events: normal page turn (forwards or backwards), aborted page turn (forwards or backwards)
48 * and pan with no animation. The order of events is as follows:
49 * 1) Normal page turn: PagePanStarted -> PageTurnStarted direction -> PagePanFinished -> PageTurnFinished direction
50 * 2) Aborted page turn: PagePanStarted -> PageTurnStarted direction -> PageTurnStarted opposite direction
51 * -> PagePanFinished -> PageTurnFinished opposite direction
52 * 3) Pan with no animation: PagePanStarted -> PagePanFinished
53 * Pan with no animation will occur when the user touches the page in an area that does not start the
57 * | %Signal Name | Method |
58 * |--------------------|-------------------------------|
59 * | page-turn-started | @ref PageTurnStartedSignal() |
60 * | page-turn-finished | @ref PageTurnFinishedSignal() |
61 * | page-pan-started | @ref PagePanStartedSignal() |
62 * | page-pan-finished | @ref PagePanFinishedSignal() |
66 class DALI_IMPORT_API PageTurnView : public Control
71 * @brief The start and end property ranges for this control.
75 PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
76 PROPERTY_END_INDEX = PROPERTY_START_INDEX + 1000 ///< Reserve property indices
83 PAGE_SIZE = PROPERTY_START_INDEX, ///< name "page-size", type Vector2
84 CURRENT_PAGE_ID, ///< name "current-page-id", type Integer
87 * The two values are the major&minor radius (in pixels) to form an ellipse shape.
88 * The top-left quarter of this ellipse is used to calculate spine normal for simulating shadow.
90 SPINE_SHADOW, ///< name "spine-shadow", type Vector2
95 * Creates an empty PageTurnView handle. Only derived versions can be instantiated.
96 * Calling member function with an uninitialized handle is not allowed.
101 * Copy constructor. Creates another handle that points to the same real object
102 * @param[in] handle Handle to copy from
104 PageTurnView( const PageTurnView& handle );
107 * Assignment operator. Changes this handle to point to another real object
109 PageTurnView& operator=( const PageTurnView& handle );
114 * This is non-virtual since derived Handle types must not contain data or virtual methods.
119 * Downcast an Object handle to PageTurnView.
120 * If handle points to an PageTurnView the downcast produces valid handle.
121 * If not the returned handle is left uninitialized.
122 * @param[in] handle Handle to an object
123 * @return handle to a PageTurnView or an uninitialized handle
125 static PageTurnView DownCast( BaseHandle handle );
129 // Page Turned signal, with page index and boolean turning direction (true = forward, false = backward)
130 typedef Signal< void ( PageTurnView, unsigned int, bool ) > PageTurnSignal;
131 typedef Signal< void ( PageTurnView ) > PagePanSignal;
134 * Signal emitted when a page has started to turn over.
135 * A callback of the following type may be connected:
137 * void YourCallBackName( PageTurnView pageTurnView, unsigned int pageIndex, bool isTurningForward );
139 * @return The signal to connect to
141 PageTurnSignal& PageTurnStartedSignal();
144 * Signal emitted when a page has finished turning over.
145 * A callback of the following type may be connected:
147 * void YourCallBackName( PageTurnView pageTurnView, unsigned int pageIndex, bool isTurningForward );
149 * @return The signal to connect to
151 PageTurnSignal& PageTurnFinishedSignal();
154 * Signal emitted when a page pan has commenced
155 * A callback of the following type may be connected:
157 * void YourCallBackName( PageTurnView pageTurnView );
159 * @return The signal to connect to
161 PagePanSignal& PagePanStartedSignal();
164 * Signal emitted when a page pan has finished
165 * A callback of the following type may be connected:
167 * void YourCallBackName( PageTurnView pageTurnView );
169 * @return The signal to connect to
171 PagePanSignal& PagePanFinishedSignal();
173 public: // Not intended for application developers
176 * Creates a handle using the Toolkit::Internal implementation.
177 * @param[in] implementation The Control implementation.
179 DALI_INTERNAL PageTurnView(Internal::PageTurnView& implementation);
182 * Allows the creation of this Control from an Internal::CustomActor pointer.
183 * @param[in] internal A pointer to the internal CustomActor.
185 explicit DALI_INTERNAL PageTurnView(Dali::Internal::CustomActor* internal);
188 } // namespace Toolkit
192 #endif /* __DALI_TOOLKIT_PAGE_TURN_VIEW_H__ */