1 #ifndef __DALI_TOOLKIT_PAGE_FACTORY_H__
2 #define __DALI_TOOLKIT_PAGE_FACTORY_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/public-api/actors/actor.h>
31 * PageFactory is an abstract interface for providing image actors to PageTurnView
32 * Each image actor is identified by a unique ID, and has a linear order from 0 to GetNumberOfPages()-1
34 class DALI_IMPORT_API PageFactory
38 static const std::string ACTOR_HITTABLE; ///< name "actor-hittable", type bool
44 * By default, the off screen rendering is disabled
45 * Is off screen rendering is required to create the page image,
46 * call EnableOffscreenRendering() before pass it as parameter to the PageTurnView
53 virtual ~PageFactory();
56 * Enable the off screen rendering to create the page image from actor tree
58 void EnableOffscreenRendering( );
61 * Query whether offscreen rendering is needed to create the page image
64 bool IsOffscreenRenderingNeeded();
67 * Query the number of pages available from the factory.
68 * The maximum available page has an ID of GetNumberOfPages()-1.
70 virtual unsigned int GetNumberOfPages() = 0;
73 * Create an actor to represent the page content.
74 * @param[in] pageId The ID of the page to create.
75 * @return An actor, or an uninitialized pointer if the ID is out of range.
77 virtual Actor NewPage( unsigned int pageId ) = 0;
81 * Signal type for notification
83 typedef Signal< void ( int ) > RefreshSignal;
86 * Signal emitted when the Actor tree is ready for rendering into the page image.
87 * The signal is connected to the page refresh function inside PageTurnView.
89 RefreshSignal& PageRefreshSignal();
92 * Emit the page ready singal. The PageTurn view will be notified to refresh the given page accordingly.
93 * @param[in] pageId the index of the page which is ready for refreshing.
95 void EmitPageRefreshSignal( int pageId );
100 * Sets whether an actor should be hittable for the PageTurnView::GetHitActor().
101 * It is useful when a sub-tree should be hit instead of the 'leaf' actor in the actor tree.
102 * By default, actors are not hittable for PageTurnView::GetHitActor()
103 * @param[in] actor The actor to be set with the hittablity
104 * @param[in] hittable True to be hittable, false otherwise.
106 void SetActorHittability( Actor actor, bool hittable );
109 * Query whether an actor is hittable for the PageTurnView::GetHitActor().
111 bool GetActorHittability( Actor actor );
115 bool mNeedOffscreenRendering;
117 RefreshSignal mPageRefreshSignal;
120 } // namespace Toolkit
123 #endif /* __DALI_TOOLKIT_PAGE_FACTORY_H__ */