(Automated Tests) Update test suite after changes to PlatformAbstraction
[platform/core/uifw/dali-toolkit.git] / automated-tests / src / dali-toolkit / dali-toolkit-test-utils / toolkit-clipboard.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 "toolkit-clipboard.h"
19
20 // EXTERNAL INCLUDES
21 #include <dali/public-api/object/base-object.h>
22
23
24 namespace Dali
25 {
26
27 namespace Internal
28 {
29
30 namespace Adaptor
31 {
32
33 /**
34  * Implementation of the Clip Board
35  */
36
37 class Clipboard :  public Dali::BaseObject
38 {
39 public:
40
41   /**
42    * @copydoc Dali::ClipboardEventNotifier::Get()
43    */
44   static Dali::Clipboard Get();
45
46   /**
47    * Constructor
48    * @param[in] ecoreXwin, The window is created by application.
49    */
50   Clipboard(/*Ecore_X_Window ecoreXwin*/);
51   virtual ~Clipboard();
52
53   /**
54    * @copydoc Dali::Clipboard::SetItem()
55    */
56   bool SetItem(const std::string &itemData);
57
58   /**
59    * @copydoc Dali::Clipboard::GetItem()
60    */
61   std::string GetItem( unsigned int index );
62
63   /**
64    * @copydoc Dali::Clipboard::NumberOfClipboardItems()
65    */
66   unsigned int NumberOfItems();
67
68   /**
69    * @copydoc Dali::Clipboard::ShowClipboard()
70    */
71   void ShowClipboard();
72
73   /**
74    * @copydoc Dali::Clipboard::HideClipboard()
75    */
76   void HideClipboard();
77
78
79 private:
80   Clipboard( const Clipboard& );
81   Clipboard& operator=( Clipboard& );
82
83   static Dali::Clipboard mToolkitClipboard;
84 }; // class clipboard
85
86
87 Dali::Clipboard Dali::Internal::Adaptor::Clipboard::mToolkitClipboard;
88
89
90 Clipboard::Clipboard( /*Ecore_X_Window ecoreXwin*/)
91 {
92 }
93
94 Clipboard::~Clipboard()
95 {
96 }
97
98 Dali::Clipboard Clipboard::Get()
99 {
100   if( ! mToolkitClipboard )
101   {
102     mToolkitClipboard = Dali::Clipboard( new Dali::Internal::Adaptor::Clipboard() );
103   }
104   return mToolkitClipboard;
105 }
106
107 bool Clipboard::SetItem(const std::string &itemData )
108 {
109   return true;
110 }
111
112 std::string Clipboard::GetItem( unsigned int index )
113 {
114   return "";
115 }
116
117 unsigned int Clipboard::NumberOfItems()
118 {
119   return 0;
120 }
121
122 void Clipboard::ShowClipboard()
123 {
124 }
125
126 void Clipboard::HideClipboard()
127 {
128 }
129
130
131 } // namespace Adaptor
132
133 } // namespace Internal
134
135
136 inline static Internal::Adaptor::Clipboard& GetImplementation(Dali::Clipboard& clipboard)
137 {
138   // Bypass any passed in clipboard handle - it probably won't be initialized
139   Dali::Clipboard theClipboard = Dali::Clipboard::Get();
140   BaseObject& object = theClipboard.GetBaseObject();
141   return static_cast<Internal::Adaptor::Clipboard&>(object);
142 }
143
144 inline static const  Internal::Adaptor::Clipboard& GetImplementation(const Dali::Clipboard& clipboard)
145 {
146   // Bypass any passed in clipboard handle - it probably won't be initialized
147   Dali::Clipboard theClipboard = Dali::Clipboard::Get();
148   const BaseObject& object = theClipboard.GetBaseObject();
149   return static_cast<const Internal::Adaptor::Clipboard&>(object);
150 }
151
152
153 Clipboard::Clipboard()
154 {
155 }
156 Clipboard::~Clipboard()
157 {
158 }
159 Clipboard::Clipboard(Internal::Adaptor::Clipboard *impl)
160   : BaseHandle(impl)
161 {
162 }
163
164 Clipboard Clipboard::Get()
165 {
166   return Internal::Adaptor::Clipboard::Get();
167 }
168 bool Clipboard::SetItem( const std::string &itemData)
169 {
170   return GetImplementation(*this).SetItem( itemData );
171 }
172
173 std::string Clipboard::GetItem( unsigned int index )
174 {
175   return GetImplementation(*this).GetItem( index );
176 }
177
178 unsigned int Clipboard::NumberOfItems()
179 {
180   return GetImplementation(*this).NumberOfItems();
181 }
182
183 void Clipboard::ShowClipboard()
184 {
185   GetImplementation(*this).ShowClipboard();
186 }
187
188 void Clipboard::HideClipboard()
189 {
190   GetImplementation(*this).HideClipboard();
191 }
192
193 } // namespace Dali