Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / FUi_EflWindow.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Flora License, Version 1.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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17 /**
18  * @file                FUi_EflWindow.cpp
19  * @brief               This is the implementation file for the _EflWindow class.
20  */
21 #include <FBaseErrors.h>
22 #include <FBaseSysLog.h>
23 #include "FUi_EflWindow.h"
24 #include "FUiAnim_RootVisualElement.h"
25 #include "FUi_EcoreEvas.h"
26 #include "FUi_Control.h"
27
28 using namespace Tizen::Ui::Animations;
29
30 namespace Tizen { namespace Ui
31 {
32
33 _EflWindow*
34 _EflWindow::CreateInstanceN(void)
35 {
36         _EflWindow* pEflWindow = new (std::nothrow) _EflWindow;
37         SysTryReturn(NID_UI, pEflWindow, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
38
39         result r = GetLastResult();
40         SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
41
42         SetLastResult(E_SUCCESS);
43
44         return pEflWindow;
45
46 CATCH:
47         delete pEflWindow;
48         return null;
49 }
50
51 _EflWindow::~_EflWindow(void)
52 {
53         if (__pEcoreEvas)
54         {
55                 delete __pEcoreEvas;
56                 __pEcoreEvas = null;
57         }
58 }
59
60 void
61 _EflWindow::SetFrame(const _Control& control)
62 {
63         __pEcoreEvas->SetFrame(control);
64 }
65
66 _EflWindow::_EflWindow(void)
67         : __pEcoreEvas(null)
68 {
69         __pEcoreEvas = _EcoreEvas::CreateInstanceN();
70
71         result r = GetLastResult();
72         SysTryReturnVoidResult(NID_UI, __pEcoreEvas, r, "[%s] Propagating.", GetErrorMessage(r));
73
74         SetLastResult(E_SUCCESS);
75 }
76 _RootVisualElement*
77 _EflWindow::GetRootVisualElement(void)
78 {
79         if(__pEcoreEvas)
80         {
81                 return __pEcoreEvas->GetRootVisualElement();
82         }
83         return null;
84
85 }
86
87 }} // Tizen::Ui