2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include "toolkit-clipboard.h"
21 #include <dali/public-api/object/base-object.h>
34 * Implementation of the Clip Board
37 class Clipboard : public Dali::BaseObject
42 * @copydoc Dali::ClipboardEventNotifier::Get()
44 static Dali::Clipboard Get();
48 * @param[in] ecoreXwin, The window is created by application.
50 Clipboard(/*Ecore_X_Window ecoreXwin*/);
54 * @copydoc Dali::Clipboard::SetItem()
56 bool SetItem(const std::string &itemData);
59 * @copydoc Dali::Clipboard::GetItem()
61 std::string GetItem( unsigned int index );
64 * @copydoc Dali::Clipboard::NumberOfClipboardItems()
66 unsigned int NumberOfItems();
69 * @copydoc Dali::Clipboard::ShowClipboard()
74 * @copydoc Dali::Clipboard::HideClipboard()
80 Clipboard( const Clipboard& );
81 Clipboard& operator=( Clipboard& );
83 static Dali::Clipboard mToolkitClipboard;
87 Dali::Clipboard Dali::Internal::Adaptor::Clipboard::mToolkitClipboard;
90 Clipboard::Clipboard( /*Ecore_X_Window ecoreXwin*/)
94 Clipboard::~Clipboard()
98 Dali::Clipboard Clipboard::Get()
100 if( ! mToolkitClipboard )
102 mToolkitClipboard = Dali::Clipboard( new Dali::Internal::Adaptor::Clipboard() );
104 return mToolkitClipboard;
107 bool Clipboard::SetItem(const std::string &itemData )
112 std::string Clipboard::GetItem( unsigned int index )
117 unsigned int Clipboard::NumberOfItems()
122 void Clipboard::ShowClipboard()
126 void Clipboard::HideClipboard()
131 } // namespace Adaptor
133 } // namespace Internal
136 inline static Internal::Adaptor::Clipboard& GetImplementation(Dali::Clipboard& clipboard)
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);
144 inline static const Internal::Adaptor::Clipboard& GetImplementation(const Dali::Clipboard& clipboard)
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);
153 Clipboard::Clipboard()
156 Clipboard::~Clipboard()
159 Clipboard::Clipboard(Internal::Adaptor::Clipboard *impl)
164 Clipboard Clipboard::Get()
166 return Internal::Adaptor::Clipboard::Get();
168 bool Clipboard::SetItem( const std::string &itemData)
170 return GetImplementation(*this).SetItem( itemData );
173 std::string Clipboard::GetItem( unsigned int index )
175 return GetImplementation(*this).GetItem( index );
178 unsigned int Clipboard::NumberOfItems()
180 return GetImplementation(*this).NumberOfItems();
183 void Clipboard::ShowClipboard()
185 GetImplementation(*this).ShowClipboard();
188 void Clipboard::HideClipboard()
190 GetImplementation(*this).HideClipboard();