License Agreement changes
[apps/osp/Gallery.git] / src / GlFormFactory.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                GlFormFactory.cpp
19  * @brief               This is the implementation file for FormFactory class.
20  */
21
22 #include "GlAlbumListEditorForm.h"
23 #include "GlAlbumListForm.h"
24 #include "GlAlbumNameEditorForm.h"
25 #include "GlFileListEditorForm.h"
26 #include "GlFileListForm.h"
27 #include "GlFormFactory.h"
28 #include "GlSettingMainForm.h"
29 #include "GlTypes.h"
30
31 using namespace Tizen::Base;
32 using namespace Tizen::Ui;
33 using namespace Tizen::Ui::Controls;
34 using namespace Tizen::Ui::Scenes;
35
36 FormFactory::FormFactory(void)
37 {
38         AppLogDebug("ENTER");
39         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
40 }
41
42 FormFactory::~FormFactory(void)
43 {
44         AppLogDebug("ENTER");
45         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
46 }
47
48 Form*
49 FormFactory::CreateFormN(const String& formId, const SceneId& sceneId)
50 {
51         AppLogDebug("ENTER");
52         SceneManager* pSceneManager = SceneManager::GetInstance();
53         AppAssert(pSceneManager);
54         Form* pNewForm = null;
55
56         if (formId == IDC_FORM_ALBUM_LIST)
57         {
58                 AlbumListForm* pForm = new (std::nothrow) AlbumListForm();
59                 pForm->Initialize();
60                 pSceneManager->AddSceneEventListener(sceneId, *pForm);
61                 pNewForm = pForm;
62         }
63         else if (formId == IDC_FORM_ALBUM_LIST_EDITOR)
64         {
65                 AlbumListEditorForm* pForm = new (std::nothrow) AlbumListEditorForm();
66                 pForm->Initialize();
67                 pSceneManager->AddSceneEventListener(sceneId, *pForm);
68                 pNewForm = pForm;
69         }
70         else if (formId == IDC_FORM_ALBUM_NAME_EDITOR)
71         {
72                 AlbumNameEditorForm* pForm = new (std::nothrow) AlbumNameEditorForm();
73                 pForm->Initialize();
74                 pSceneManager->AddSceneEventListener(sceneId, *pForm);
75                 pNewForm = pForm;
76         }
77         else if (formId == IDC_FORM_FILE_LIST)
78         {
79                 FileListForm* pForm = new (std::nothrow) FileListForm();
80                 pForm->Initialize();
81                 pNewForm = pForm;
82         }
83         else if (formId == IDC_FORM_FILE_LIST_EDITOR)
84         {
85                 FileListEditorForm* pForm = new (std::nothrow) FileListEditorForm();
86                 pForm->Initialize();
87                 pSceneManager->AddSceneEventListener(sceneId, *pForm);
88                 pNewForm = pForm;
89         }
90         else if (formId == IDC_FORM_SETTING_MAIN)
91         {
92                 SettingMainForm* pForm = new (std::nothrow) SettingMainForm();
93                 pForm->Initialize();
94                 pSceneManager->AddSceneEventListener(sceneId, *pForm);
95                 pNewForm = pForm;
96         }
97
98         AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
99
100         return pNewForm;
101 }