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