2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 // http://floralicense.org/license/
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.
17 #include "toolkit-clipboard.h"
20 #include <dali/public-api/object/base-object.h>
33 * Implementation of the Clip Board
36 class Clipboard : public Dali::BaseObject
41 * @copydoc Dali::ClipboardEventNotifier::Get()
43 static Dali::Clipboard Get();
47 * @param[in] ecoreXwin, The window is created by application.
49 Clipboard(/*Ecore_X_Window ecoreXwin*/);
53 * @copydoc Dali::Clipboard::SetItem()
55 bool SetItem(const std::string &itemData);
58 * @copydoc Dali::Clipboard::GetItem()
60 std::string GetItem( unsigned int index );
63 * @copydoc Dali::Clipboard::NumberOfClipboardItems()
65 unsigned int NumberOfItems();
68 * @copydoc Dali::Clipboard::ShowClipboard()
73 * @copydoc Dali::Clipboard::HideClipboard()
79 Clipboard( const Clipboard& );
80 Clipboard& operator=( Clipboard& );
82 static Dali::Clipboard mToolkitClipboard;
86 Dali::Clipboard Dali::Internal::Adaptor::Clipboard::mToolkitClipboard;
89 Clipboard::Clipboard( /*Ecore_X_Window ecoreXwin*/)
93 Clipboard::~Clipboard()
97 Dali::Clipboard Clipboard::Get()
99 if( ! mToolkitClipboard )
101 mToolkitClipboard = Dali::Clipboard( new Dali::Internal::Adaptor::Clipboard() );
103 return mToolkitClipboard;
106 bool Clipboard::SetItem(const std::string &itemData )
111 std::string Clipboard::GetItem( unsigned int index )
116 unsigned int Clipboard::NumberOfItems()
121 void Clipboard::ShowClipboard()
125 void Clipboard::HideClipboard()
130 } // namespace Adaptor
132 } // namespace Internal
135 inline static Internal::Adaptor::Clipboard& GetImplementation(Dali::Clipboard& clipboard)
137 // Bypass any passed in clipboard handle - it probably won't be initialized
138 Dali::Clipboard theClipboard = Dali::Clipboard::Get();
139 BaseObject& object = theClipboard.GetBaseObject();
140 return static_cast<Internal::Adaptor::Clipboard&>(object);
143 inline static const Internal::Adaptor::Clipboard& GetImplementation(const Dali::Clipboard& clipboard)
145 // Bypass any passed in clipboard handle - it probably won't be initialized
146 Dali::Clipboard theClipboard = Dali::Clipboard::Get();
147 const BaseObject& object = theClipboard.GetBaseObject();
148 return static_cast<const Internal::Adaptor::Clipboard&>(object);
152 Clipboard::Clipboard()
155 Clipboard::~Clipboard()
158 Clipboard::Clipboard(Internal::Adaptor::Clipboard *impl)
163 Clipboard Clipboard::Get()
165 return Internal::Adaptor::Clipboard::Get();
167 bool Clipboard::SetItem( const std::string &itemData)
169 return GetImplementation(*this).SetItem( itemData );
172 std::string Clipboard::GetItem( unsigned int index )
174 return GetImplementation(*this).GetItem( index );
177 unsigned int Clipboard::NumberOfItems()
179 return GetImplementation(*this).NumberOfItems();
182 void Clipboard::ShowClipboard()
184 GetImplementation(*this).ShowClipboard();
187 void Clipboard::HideClipboard()
189 GetImplementation(*this).HideClipboard();