d72a76263b19e4e55a2084457bf46b91650ea2fd
[platform/core/uifw/dali-toolkit.git] / optional / dali-toolkit / public-api / controls / page-turn-view / page-factory.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 #include <dali-toolkit/public-api/controls/page-turn-view/page-factory.h>
18
19 namespace Dali
20 {
21
22 namespace Toolkit
23 {
24
25 const std::string PageFactory::ACTOR_HITTABLE( "actor-hittable" );
26
27 PageFactory::PageFactory( )
28 : mNeedOffscreenRendering( false )
29 {
30 }
31
32 PageFactory::~PageFactory()
33 {
34 }
35
36 void PageFactory::EnableOffscreenRendering(  )
37 {
38   mNeedOffscreenRendering = true;
39 }
40
41 bool PageFactory::IsOffscreenRenderingNeeded()
42 {
43   return mNeedOffscreenRendering;
44 }
45
46 void PageFactory::SetActorHittability( Actor actor, bool hittable )
47 {
48   // Create actor focusable property if not already created.
49   Property::Index propertyActorHittable = actor.GetPropertyIndex(ACTOR_HITTABLE);
50   if(propertyActorHittable == Property::INVALID_INDEX && hittable)
51   {
52     propertyActorHittable = actor.RegisterProperty(ACTOR_HITTABLE, true);
53   }
54   else
55   {
56     actor.SetProperty( propertyActorHittable, hittable );
57   }
58 }
59
60 bool PageFactory::GetActorHittability( Actor actor )
61 {
62   bool hittable = false;
63
64   Property::Index propertyActorHittable = actor.GetPropertyIndex(ACTOR_HITTABLE);
65   if(propertyActorHittable != Property::INVALID_INDEX)
66   {
67     hittable = actor.GetProperty<bool>( propertyActorHittable );
68   }
69
70   return hittable;
71 }
72
73 PageFactory::RefreshSignal& PageFactory::PageRefreshSignal()
74 {
75   return mPageRefreshSignal;
76 }
77
78 void PageFactory::EmitPageRefreshSignal( int pageId )
79 {
80   mPageRefreshSignal.Emit( pageId );
81 }
82
83 } // namespace Toolkit
84
85 } // namespace Dali