Update the text input popup GUI.
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / builder / builder-actor.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 // EXTERNAL INCLUDES
19 #include <string>
20 #include <dali/integration-api/debug.h>
21 #include <dali/public-api/scripting/scripting.h>
22
23 // INTERNAL INCLUDES
24 #include <dali-toolkit/internal/builder/builder-get-is.inl.h>
25
26 namespace Dali
27 {
28
29 namespace Toolkit
30 {
31
32 namespace Internal
33 {
34
35 using namespace Dali::Scripting;
36
37 /*
38  * Handles special case actor configuration (anything thats not already a property)
39  *
40  */
41 Actor SetupActor( const TreeNode& child, Actor& actor )
42 {
43   DALI_ASSERT_ALWAYS( actor && "Empty actor handle" );
44
45   // we allow enums strings for parent-origin and anchor-point but as with the current json
46   // strings always succeed if they exist then check its not vector. If they are Vec3s then
47   // this has already been set as a generic property.
48   if( !IsVector3( child, "parent-origin") )
49   {
50     if( OptionalVector3 v = IsVector3(child, "parent-origin") )
51     {
52       actor.SetParentOrigin( *v );
53     }
54     else if( OptionalString origin = IsString(child, "parent-origin") )
55     {
56       actor.SetParentOrigin( GetAnchorConstant(*origin) );
57     }
58   }
59
60   if( !IsVector3(child, "anchor-point") )
61   {
62     if( OptionalVector3 v = IsVector3(child, "anchor-point") )
63     {
64       actor.SetAnchorPoint( *v );
65     }
66     else if( OptionalString anchor = IsString(child, "anchor-point") )
67     {
68       actor.SetAnchorPoint( GetAnchorConstant(*anchor) );
69     }
70   }
71
72   return actor;
73 }
74
75 } // namespace Internal
76
77 } // namespace Toolkit
78
79 } // namespace Dali