modify license, permission and remove ^M char
[platform/framework/native/uifw.git] / src / ui / FUiControl.cpp
index 8ec997f..68af7d9 100644 (file)
@@ -2,14 +2,14 @@
 // Open Service Platform
 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
 //
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Apache License, Version 2.0 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//     http://floralicense.org/license/
+//     http://www.apache.org/licenses/LICENSE-2.0/
 //
 // Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an AS IS BASIS,
+// distributed under the License is distributed on an ”AS IS” BASIS,
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
 #include "FUi_ContainerImpl.h"
 #include "FUi_ErrorMessages.h"
 #include "FUiAnimVisualElement.h"
-#include "FUiAnimVisualElementSurface.h"
-#include "FUiAnim_VisualElementSurfaceImpl.h"
-
-// for sto
-#include <Evas.h>
-#include "FUiAnim_EflNode.h"
-#include "FUiAnim_EflLayer.h"
-#include "FUiAnim_VisualElementImpl.h"
-#include "FUiAnim_DisplayContextImpl.h"
 
 
 using namespace Tizen::Base;
@@ -45,143 +36,6 @@ using namespace Tizen::Base::Collection;
 using namespace Tizen::Graphics;
 using namespace Tizen::Ui::Animations;
 
-extern "C" _OSP_EXPORT_ void*
-STO_GetNativeHandle(void* pControl)
-{
-       Handle nativeHandle = 0;
-       Tizen::Ui::Control* pControlPointer = (Tizen::Ui::Control*)pControl;
-
-       if (pControlPointer)
-       {
-               Tizen::Ui::_ControlImpl* pControlImpl = Tizen::Ui::_ControlImpl::GetInstance(*pControlPointer);
-
-               if (pControlImpl)
-               {
-                       VisualElement *pVisualElement = pControlImpl->GetVisualElement();
-
-                       if (pVisualElement)
-                       {
-                               VisualElementSurface* pSurface = pVisualElement->GetSurfaceN();
-
-                               if (pSurface)
-                               {
-                                       _VisualElementSurfaceImpl* pSurfaceImpl = _VisualElementSurfaceImpl::GetInstance(*pSurface);
-                                       if (pSurfaceImpl)
-                                               nativeHandle = pSurfaceImpl->GetNativeHandle();
-
-                                       delete pSurface;
-                               }
-                       }
-               }
-       }
-
-       return (void*)nativeHandle;
-}
-
-extern "C" _OSP_EXPORT_ void
-STO_NativeHandleSetShowState(void* pNative, bool show)
-{
-       if(show)
-               evas_object_show((Evas_Object*)pNative);
-       else
-               evas_object_hide((Evas_Object*)pNative);
-}
-
-extern "C" _OSP_EXPORT_ void*
-STO_GetVisualElement(void* pControl)
-{
-       Tizen::Ui::Control* pControlPointer = (Tizen::Ui::Control*)pControl;
-       Tizen::Ui::_ControlImpl* pControlImpl = Tizen::Ui::_ControlImpl::GetInstance(*pControlPointer);
-
-       return (void *)pControlImpl->GetVisualElement();
-}
-
-extern "C" _OSP_EXPORT_
-void STO_NativeHandleDataSet(void* pEvasObject, void* pData, int width, int height)
-{
-       evas_object_image_size_set((Evas_Object*)pEvasObject, width, height);
-       evas_object_image_data_set((Evas_Object*)pEvasObject, pData);
-}
-
-
-
-extern "C" _OSP_EXPORT_ void
-STO_SetVisualElementNativeObject(void* pVisualElement, void* pNativeObject)
-{
-       VisualElement* pVE = (VisualElement* )pVisualElement;
-       Evas_Object* pEO = (Evas_Object*)pNativeObject;
-
-       _VisualElementImpl* pVEImpl = _VisualElementImpl::GetInstance(*pVE);
-
-       _EflNode* pNode = (_EflNode*)pVEImpl->GetNativeNode();
-       pNode->AddNativeSmartObject(*pVE, pEO);
-
-       int imageWidth = 0;
-       int imageHeight = 0;
-
-       evas_object_image_size_get(pEO, &imageWidth, &imageHeight);
-       evas_object_image_data_update_add(pEO, 0, 0, imageWidth, imageHeight);
-}
-
-extern "C" _OSP_EXPORT_
-void* STO_CreateNativeImageObject(void* pDisplayContext, int width, int height)
-{
-
-       if(!pDisplayContext)
-       {
-               return null;
-       }
-
-       _DisplayContextImpl* pDispImpl =  _DisplayContextImpl::GetInstance(*(DisplayContext*)pDisplayContext);
-
-       if(!pDispImpl->GetNativeLayer())
-       {
-               return null;
-       }
-       Evas* pEvas = ((_EflLayer*)pDispImpl->GetNativeLayer())->GetEvas();
-
-       if(!pEvas)
-       {
-               return null;
-       }
-
-       Evas_Object* pImage = evas_object_image_filled_add(pEvas);
-       evas_object_resize(pImage, width, height);
-       evas_object_move(pImage, 0, 0);
-//     evas_object_show(pImage);
-
-       return pImage;
-
-}
-
-extern "C" _OSP_EXPORT_ void
-STO_FillSet(void* pVisualElement, int x, int y, int w, int h)
-{
-                  VisualElement* pVE = (VisualElement*)pVisualElement;
-
-                  _VisualElementImpl* pVEImpl = _VisualElementImpl::GetInstance(*pVE);
-
-                  _EflNode* pNode = (_EflNode*)pVEImpl->GetNativeNode();
-                  Evas_Object* pEvasObject = pNode->GetNativeObject();
-                  if (pEvasObject)
-                  {
-                                        evas_object_image_fill_set(pEvasObject, x, y, w, h);
-                  }
-}
-
-extern "C" _OSP_EXPORT_ void
-STO_Destroy(void* pVisualElement, void* pEvasObject)
-{
-       VisualElement* pVE = (VisualElement* )pVisualElement;
-
-       _VisualElementImpl* pVEImpl = _VisualElementImpl::GetInstance(*pVE);
-
-       _EflNode* pNode = (_EflNode*)pVEImpl->GetNativeNode();
-       pNode->AddNativeSmartObject(*pVE, null);
-
-       evas_object_del((Evas_Object*)pEvasObject);
-}
-
 
 namespace Tizen { namespace Ui {
 
@@ -1515,6 +1369,7 @@ Control::AddGestureDetector(const TouchGestureDetector& gestureDetector)
 result
 Control::AddGestureDetector(TouchGestureDetector* pGestureDetector)
 {
+       SysTryReturnResult(NID_UI, pGestureDetector != null, E_INVALID_ARG, "pGestureDetector is null.");
        _ControlImpl* pControlImpl = _ControlImpl::GetInstance(*this);
        SysAssertf(pControlImpl != null, "Not yet constructed. Construct() should be called before use.");
 
@@ -1533,6 +1388,7 @@ Control::RemoveGestureDetector(const TouchGestureDetector& gestureDetector)
 result
 Control::RemoveGestureDetector(TouchGestureDetector* pGestureDetector)
 {
+       SysTryReturnResult(NID_UI, pGestureDetector != null, E_INVALID_ARG, "pGestureDetector is null.");
        _ControlImpl* pControlImpl = _ControlImpl::GetInstance(*this);
        SysAssertf(pControlImpl != null, "Not yet constructed. Construct() should be called before use.");