Move ECore_Wayland specific code to ecore folder
[platform/core/uifw/dali-adaptor.git] / adaptors / ecore / wayland / clipboard-impl-ecore-wl.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 // CLASS HEADER
19 #include "clipboard-impl.h"
20
21 // EXTERNAL INCLUDES
22 #include <Ecore.h>
23 #include <Ecore_Wayland.h>
24 #include <dali/public-api/object/any.h>
25 #include <dali/public-api/object/type-registry.h>
26 #include <dali/integration-api/debug.h>
27
28 // INTERNAL INCLUDES
29 #include <singleton-service-impl.h>
30
31 namespace //unnamed namespace
32 {
33 const char* const CBHM_WINDOW = "CBHM_XWIN";
34 const char* const CBHM_MSG = "CBHM_MSG";
35 const char* const CBHM_ITEM = "CBHM_ITEM";
36 const char* const CBHM_cCOUNT = "CBHM_cCOUNT";
37 const char* const CBHM_ERROR = "CBHM_ERROR";
38 const char* const SET_ITEM = "SET_ITEM";
39 const char* const SHOW = "show0";
40 const char* const HIDE = "cbhm_hide";
41 }
42
43 ///////////////////////////////////////////////////////////////////////////////////////////////////
44 // Clipboard
45 ///////////////////////////////////////////////////////////////////////////////////////////////////
46
47 namespace Dali
48 {
49
50 namespace Internal
51 {
52
53 namespace Adaptor
54 {
55
56 namespace
57 {
58 BaseHandle Create()
59 {
60   BaseHandle handle( Clipboard::Get() );
61
62   return handle;
63 }
64 TypeRegistration CLIPBOARD_TYPE( typeid(Dali::Clipboard), typeid(Dali::BaseHandle), Create, true /* Create Instance At Startup */ );
65
66 } // unnamed namespace
67
68 Clipboard::~Clipboard()
69 {
70 }
71
72 Dali::Clipboard Clipboard::Get()
73 {
74   Dali::Clipboard clipboard;
75
76   Dali::SingletonService service( SingletonService::Get() );
77   if ( service )
78   {
79     // Check whether the singleton is already created
80     Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::Clipboard ) );
81     if(handle)
82     {
83       // If so, downcast the handle
84       clipboard = Dali::Clipboard( dynamic_cast< Clipboard* >( handle.GetObjectPtr() ) );
85     }
86   }
87
88   return clipboard;
89 }
90 bool Clipboard::SetItem(const std::string &itemData )
91 {
92   return true;
93 }
94
95 /*
96  * Get string at given index of clipboard
97  */
98 std::string Clipboard::GetItem( unsigned int index )  // change string to a Dali::Text object.
99 {
100   if ( index >= NumberOfItems() )
101   {
102     return "";
103   }
104
105   std::string emptyString( "" );
106   char sendBuf[20];
107
108   snprintf( sendBuf, 20,  "%s%d", CBHM_ITEM, index );
109   return emptyString;
110 }
111
112 /*
113  * Get number of items in clipboard
114  */
115 unsigned int Clipboard::NumberOfItems()
116 {
117   int count = -1;
118
119   return count;
120 }
121
122 /**
123  * Show clipboard window
124  * Function to send message to show the Clipboard (cbhm) as no direct API available
125  * Reference elementary/src/modules/ctxpopup_copypasteUI/cbhm_helper.c
126  */
127 void Clipboard::ShowClipboard()
128 {
129 }
130
131 void Clipboard::HideClipboard()
132 {
133 }
134
135
136 } // namespace Adaptor
137
138 } // namespace Internal
139
140 } // namespace Dali