Conversion to Apache 2.0 license
[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 Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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
18 #include <dali-toolkit/public-api/controls/page-turn-view/page-factory.h>
19
20 namespace Dali
21 {
22
23 namespace Toolkit
24 {
25
26 const std::string PageFactory::ACTOR_HITTABLE( "actor-hittable" );
27
28 PageFactory::PageFactory( )
29 : mNeedOffscreenRendering( false )
30 {
31 }
32
33 PageFactory::~PageFactory()
34 {
35 }
36
37 void PageFactory::EnableOffscreenRendering(  )
38 {
39   mNeedOffscreenRendering = true;
40 }
41
42 bool PageFactory::IsOffscreenRenderingNeeded()
43 {
44   return mNeedOffscreenRendering;
45 }
46
47 void PageFactory::SetActorHittability( Actor actor, bool hittable )
48 {
49   // Create actor focusable property if not already created.
50   Property::Index propertyActorHittable = actor.GetPropertyIndex(ACTOR_HITTABLE);
51   if(propertyActorHittable == Property::INVALID_INDEX && hittable)
52   {
53     propertyActorHittable = actor.RegisterProperty(ACTOR_HITTABLE, true);
54   }
55   else
56   {
57     actor.SetProperty( propertyActorHittable, hittable );
58   }
59 }
60
61 bool PageFactory::GetActorHittability( Actor actor )
62 {
63   bool hittable = false;
64
65   Property::Index propertyActorHittable = actor.GetPropertyIndex(ACTOR_HITTABLE);
66   if(propertyActorHittable != Property::INVALID_INDEX)
67   {
68     hittable = actor.GetProperty<bool>( propertyActorHittable );
69   }
70
71   return hittable;
72 }
73
74 PageFactory::RefreshSignal& PageFactory::PageRefreshSignal()
75 {
76   return mPageRefreshSignal;
77 }
78
79 void PageFactory::EmitPageRefreshSignal( int pageId )
80 {
81   mPageRefreshSignal.Emit( pageId );
82 }
83
84 } // namespace Toolkit
85
86 } // namespace Dali