[SRUK] Initial copy from Tizen 2.2 version
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / popup / popup.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/popup/popup.h>
18 #include <dali-toolkit/internal/controls/popup/popup-impl.h>
19 #include <dali-toolkit/public-api/controls/buttons/button.h>
20
21 using namespace Dali;
22
23 namespace Dali
24 {
25
26 namespace Toolkit
27 {
28
29 ///////////////////////////////////////////////////////////////////////////////////////////////////
30 // Popup
31 ///////////////////////////////////////////////////////////////////////////////////////////////////
32
33 const char* const Popup::SIGNAL_TOUCHED_OUTSIDE = "touched-outside";
34 const char* const Popup::SIGNAL_HIDDEN = "hidden";
35 const char* const Popup::PROPERTY_TITLE = "title";
36 const char* const Popup::PROPERTY_STATE = "state";
37
38 Popup::Popup()
39 {
40 }
41
42 Popup::Popup( const Popup& handle )
43 : Control( handle )
44 {
45 }
46
47 Popup& Popup::operator=( const Popup& handle )
48 {
49   if( &handle != this )
50   {
51     Control::operator=( handle );
52   }
53   return *this;
54 }
55
56 Popup::Popup(Internal::Popup& implementation)
57 : Control(implementation)
58 {
59 }
60
61 Popup::Popup( Dali::Internal::CustomActor* internal )
62 : Control( internal )
63 {
64   VerifyCustomActorPointer<Internal::Popup>(internal);
65 }
66
67 Popup Popup::New()
68 {
69   return Internal::Popup::New();
70 }
71
72 Popup::~Popup()
73 {
74 }
75
76 Popup Popup::DownCast( BaseHandle handle )
77 {
78   return Control::DownCast<Popup, Internal::Popup>(handle);
79 }
80
81 void Popup::SetBackgroundImage( Actor image )
82 {
83   GetImpl(*this).SetBackgroundImage( image );
84 }
85
86 void Popup::SetTitle( const std::string& text )
87 {
88   GetImpl(*this).SetTitle( text );
89 }
90
91 void Popup::SetTitle( TextView titleActor )
92 {
93   GetImpl(*this).SetTitle( titleActor );
94 }
95
96 TextView Popup::GetTitle() const
97 {
98   return GetImpl(*this).GetTitle();
99 }
100
101 void Popup::AddButton( Button button )
102 {
103   GetImpl(*this).AddButton( button );
104 }
105
106 void Popup::SetState( PopupState state )
107 {
108   GetImpl(*this).SetState( state );
109 }
110
111 void Popup::SetState( PopupState state, float duration )
112 {
113   GetImpl(*this).SetState( state, duration );
114 }
115
116 Popup::PopupState Popup::GetState() const
117 {
118   return GetImpl(*this).GetState();
119 }
120
121 void Popup::Show()
122 {
123   GetImpl(*this).SetState( POPUP_SHOW );
124 }
125
126 void Popup::Hide()
127 {
128   GetImpl(*this).SetState( POPUP_HIDE );
129 }
130
131 void Popup::ShowTail(const Vector3& position)
132 {
133   GetImpl(*this).ShowTail( position );
134 }
135
136 void Popup::HideTail()
137 {
138   GetImpl(*this).HideTail();
139 }
140
141 Popup::TouchedOutsideSignalV2& Popup::OutsideTouchedSignal()
142 {
143   return GetImpl(*this).OutsideTouchedSignal();
144 }
145
146 Popup::HiddenSignalV2& Popup::HiddenSignal()
147 {
148   return GetImpl(*this).HiddenSignal();
149 }
150
151 } // namespace Toolkit
152
153 } // namespace Dali