Initialize Tizen 2.3
[apps/osp/Gallery.git] / src / GlPanelFactory.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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  * @file                GlPanelFactory.cpp
19  * @brief               This is the implementation file for PanelFactory class.
20  */
21
22 #include "GlAllListEditorPanel.h"
23 #include "GlAllListPanel.h"
24 #include "GlAllListSelectionPanel.h"
25 #include "GlImageListEditorPanel.h"
26 #include "GlImageListPanel.h"
27 #include "GlPanelFactory.h"
28 #include "GlVideoListEditorPanel.h"
29 #include "GlVideoListPanel.h"
30 #include "GlTypes.h"
31
32 using namespace Tizen::Base;
33 using namespace Tizen::Ui::Controls;
34 using namespace Tizen::Ui::Scenes;
35
36 PanelFactory::PanelFactory()
37 {
38         AppLogDebug("ENTER");
39         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
40 }
41
42 PanelFactory::~PanelFactory()
43 {
44         AppLogDebug("ENTER");
45         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
46 }
47
48 Panel*
49 PanelFactory::CreatePanelN(const String& panelId, const SceneId& sceneId)
50 {
51         AppLogDebug("ENTER");
52         Panel*  pNewPanel = null;
53         SceneManager* pSceneManager = SceneManager::GetInstance();
54         AppAssert(pSceneManager);
55
56         if (panelId == IDC_PANEL_ALL_LIST)
57         {
58                 AllListPanel* pPanel = new (std::nothrow) AllListPanel();
59                 pPanel->Initialize();
60                 pSceneManager->AddSceneEventListener(sceneId, *pPanel);
61                 pNewPanel = pPanel;
62         }
63         else if (panelId == IDC_PANEL_IMAGE_LIST)
64         {
65                 ImageListPanel* pPanel = new (std::nothrow) ImageListPanel();
66                 pPanel->Initialize();
67                 pSceneManager->AddSceneEventListener(sceneId, *pPanel);
68                 pNewPanel = pPanel;
69         }
70         else if (panelId == IDC_PANEL_VIDEO_LIST)
71         {
72                 VideoListPanel* pPanel = new (std::nothrow) VideoListPanel();
73                 pPanel->Initialize();
74                 pSceneManager->AddSceneEventListener(sceneId, *pPanel);
75                 pNewPanel = pPanel;
76         }
77         else if (panelId == IDC_PANEL_ALL_LIST_EDITOR)
78         {
79                 AllListEditorPanel* pPanel = new (std::nothrow) AllListEditorPanel();
80                 pPanel->Initialize();
81                 pSceneManager->AddSceneEventListener(sceneId, *pPanel);
82                 pNewPanel = pPanel;
83         }
84         else if (panelId == IDC_PANEL_IMAGE_LIST_EDITOR)
85         {
86                 ImageListEditorPanel* pPanel = new (std::nothrow) ImageListEditorPanel();
87                 pPanel->Initialize();
88                 pSceneManager->AddSceneEventListener(sceneId, *pPanel);
89                 pNewPanel = pPanel;
90         }
91         else if (panelId == IDC_PANEL_VIDEO_LIST_EDITOR)
92         {
93                 VideoListEditorPanel* pPanel = new (std::nothrow) VideoListEditorPanel();
94                 pPanel->Initialize();
95                 pSceneManager->AddSceneEventListener(sceneId, *pPanel);
96                 pNewPanel = pPanel;
97         }
98         else if (panelId == IDC_PANEL_ALL_LIST_SELECTION)
99         {
100                 AllListSelectionPanel* pPanel = new (std::nothrow) AllListSelectionPanel();
101                 pPanel->Initialize();
102                 pSceneManager->AddSceneEventListener(sceneId, *pPanel);
103                 pNewPanel = pPanel;
104         }
105         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
106
107         return pNewPanel;
108 }