2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FUi_NativeObjectHandler.cpp
20 * @brief This is the implementation file for the _NativeObjectHandler class.
24 #include "FUiAnimDisplayContext.h"
25 #include "FUiAnimVisualElement.h"
27 #include "FUi_NativeObjectHandler.h"
29 #include "FUiAnim_VisualElementImpl.h"
30 #include "FUiAnim_DisplayContextImpl.h"
31 #include "FUiAnim_EflNode.h"
32 #include "FUiAnim_EflLayer.h"
34 #include <FUiControl.h>
35 #include "FUi_ControlImpl.h"
40 using namespace Tizen::Ui::Animations;
42 namespace Tizen { namespace Ui {
45 _NativeObjectHandler::CreateNativeImageObjectN(const DisplayContext* pDisplayContext, int width, int height)
47 // * @exception E_SUCCESS The method is successful.
48 // * @exception E_INVALID_ARG The specified @c pDisplayContext is invalid.
49 // * @exception E_UNSUPPORTED_OPERATION This operation is not supported.
55 _DisplayContextImpl* pDispImpl = _DisplayContextImpl::GetInstance(*(DisplayContext*)pDisplayContext);
57 if(!pDispImpl->GetNativeLayer())
61 Evas* pEvas = ((_EflLayer*)pDispImpl->GetNativeLayer())->GetEvas();
68 Evas_Object* pImage = evas_object_image_filled_add(pEvas);
69 evas_object_resize(pImage, width, height);
70 evas_object_move(pImage, 0, 0);
71 // evas_object_show(pImage);
73 return reinterpret_cast<Handle>(pImage);
77 _NativeObjectHandler::SetNativeObjectToVisualElement(VisualElement* pVisualElement, Handle nativeObjectHandle)
79 // * @exception E_SUCCESS The method is successful.
80 // * @exception E_INVALID_ARG The specified @c pNativeObject is @c null.
81 // * @exception E_UNSUPPORTED_OPERATION This operation is not supported.
82 Evas_Object* pNative = reinterpret_cast<Evas_Object*>(nativeObjectHandle);
84 if(!pNative || !pVisualElement)
89 _VisualElementImpl* pVEImpl = _VisualElementImpl::GetInstance(*pVisualElement);
91 _EflNode* pNode = (_EflNode*)pVEImpl->GetNativeNode();
92 pNode->AddNativeSmartObject(*pVisualElement, pNative);
94 const char* pName = null;
95 evas_object_image_file_get(pNative, &pName, null);
101 evas_object_image_size_get(pNative, &imageWidth, &imageHeight);
102 evas_object_image_data_update_add(pNative, 0, 0, imageWidth, imageHeight);
109 _NativeObjectHandler::SetNativeObjectShowState(Handle nativeObjectHandle, bool show)
111 // * @exception E_SUCCESS The method is successful.
112 // * @exception E_INVALID_ARG The specified @c pVisualElement or @c pNativeObject is invalid.
113 // * @exception E_UNSUPPORTED_OPERATION This operation is not supported.
114 Evas_Object* pNative = reinterpret_cast<Evas_Object*>(nativeObjectHandle);
117 return E_INVALID_ARG;
121 evas_object_show(pNative);
125 evas_object_hide(pNative);
133 _NativeObjectHandler::DestroyNativeObject(VisualElement* pVisualElement, Handle nativeObjectHandle)
135 // * @exception E_SUCCESS The method is successful.
136 // * @exception E_UNSUPPORTED_OPERATION This operation is not supported.
140 _VisualElementImpl* pVEImpl = _VisualElementImpl::GetInstance(*pVisualElement);
142 _EflNode* pNode = (_EflNode*)pVEImpl->GetNativeNode();
143 pNode->AddNativeSmartObject(*pVisualElement, null);
146 Evas_Object* pNative = reinterpret_cast<Evas_Object*>(nativeObjectHandle);
149 evas_object_del(pNative);
155 }} // namespace Tizen { namespace Ui {