1 #ifndef __DALI_TOOLKIT_PAGE_FACTORY_H__
2 #define __DALI_TOOLKIT_PAGE_FACTORY_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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.
21 #include <dali/dali.h>
23 namespace Dali DALI_IMPORT_API
30 * PageFactory is an abstract interface for providing image actors to PageTurnView
31 * Each image actor is identified by a unique ID, and has a linear order from 0 to GetNumberOfPages()-1
37 static const std::string ACTOR_HITTABLE; ///< name "actor-hittable", type bool
43 * By default, the off screen rendering is disabled
44 * Is off screen rendering is required to create the page image,
45 * call EnableOffscreenRendering() before pass it as parameter to the PageTurnView
52 virtual ~PageFactory();
55 * Enable the off screen rendering to create the page image from actor tree
57 void EnableOffscreenRendering( );
60 * Query whether offscreen rendering is needed to create the page image
63 bool IsOffscreenRenderingNeeded();
66 * Query the number of pages available from the factory.
67 * The maximum available page has an ID of GetNumberOfPages()-1.
69 virtual unsigned int GetNumberOfPages() = 0;
72 * Create an actor to represent the page content.
73 * @param[in] pageId The ID of the page to create.
74 * @return An actor, or an uninitialized pointer if the ID is out of range.
76 virtual Actor NewPage( unsigned int pageId ) = 0;
80 * Signal type for notification
82 typedef SignalV2< void ( int ) > RefreshSignal;
85 * Signal emitted when the Actor tree is ready for rendering into the page image.
86 * The signal is connected to the page refresh function inside PageTurnView.
88 RefreshSignal& PageRefreshSignal();
91 * Emit the page ready singal. The PageTurn view will be notified to refresh the given page accordingly.
92 * @param[in] pageId the index of the page which is ready for refreshing.
94 void EmitPageRefreshSignal( int pageId );
99 * Sets whether an actor should be hittable for the PageTurnView::GetHitActor().
100 * It is useful when a sub-tree should be hit instead of the 'leaf' actor in the actor tree.
101 * By default, actors are not hittable for PageTurnView::GetHitActor()
102 * @param[in] actor The actor to be set with the hittablity
103 * @param[in] hittable True to be hittable, false otherwise.
105 void SetActorHittability( Actor actor, bool hittable );
108 * Query whether an actor is hittable for the PageTurnView::GetHitActor().
110 bool GetActorHittability( Actor actor );
114 bool mNeedOffscreenRendering;
116 RefreshSignal mPageRefreshSignal;
119 } // namespace Toolkit
122 #endif /* __DALI_TOOLKIT_PAGE_FACTORY_H__ */