2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://floralicense.org/license/
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.
18 * @file CtFormFactory.cpp
19 * @brief This is the implementation file for the FormFactory class.
22 #include "CtContactDetailsForm.h"
23 #include "CtContactEditorForm.h"
24 #include "CtContactSelectorForm.h"
25 #include "CtFormFactory.h"
26 #include "CtGroupContactListEditorForm.h"
27 #include "CtGroupContactListForm.h"
28 #include "CtGroupEditorForm.h"
29 #include "CtGroupSelectorForm.h"
30 #include "CtMainForm.h"
31 #include "CtSettingsForm.h"
34 using namespace Tizen::Ui::Controls;
35 using namespace Tizen::Ui::Scenes;
37 FormFactory::FormFactory(void)
41 FormFactory::~FormFactory(void)
45 Tizen::Ui::Controls::Form*
46 FormFactory::CreateFormN(const Tizen::Base::String& formId, const Tizen::Ui::Scenes::SceneId& sceneId)
50 Form* pNewForm = null;
51 SceneManager* pSceneManager = SceneManager::GetInstance();
53 if (formId == IDC_FORM_MAIN)
55 MainForm* pForm = new (std::nothrow) MainForm();
60 else if (formId == IDC_FORM_CONTACT_SELECTOR)
62 ContactSelectorForm* pForm = new (std::nothrow) ContactSelectorForm();
65 r = pSceneManager->AddSceneEventListener(sceneId, *pForm);
66 TryCatch(r == E_SUCCESS, delete pForm, "[%s] Unable to add scene event listener", GetErrorMessage(r));
70 else if (formId == IDC_FORM_CONTACT_DETAILS)
72 ContactDetailsForm* pForm = new (std::nothrow) ContactDetailsForm();
75 r = pSceneManager->AddSceneEventListener(sceneId, *pForm);
76 TryCatch(r == E_SUCCESS, delete pForm, "[%s] Unable to add scene event listener", GetErrorMessage(r));
80 else if (formId == IDC_FORM_CONTACT_EDITOR)
82 ContactEditorForm* pForm = new (std::nothrow) ContactEditorForm();
85 r = pSceneManager->AddSceneEventListener(sceneId, *pForm);
86 TryCatch(r == E_SUCCESS, delete pForm, "[%s] Unable to add scene event listener", GetErrorMessage(r));
90 else if (formId == IDC_FORM_GROUP_SELECTOR)
92 GroupSelectorForm* pForm = new (std::nothrow) GroupSelectorForm();
95 r = pSceneManager->AddSceneEventListener(sceneId, *pForm);
96 TryCatch(r == E_SUCCESS, delete pForm, "[%s] Unable to add scene event listener", GetErrorMessage(r));
100 else if (formId == IDC_FORM_GROUP_EDITOR)
102 GroupEditorForm* pForm = new (std::nothrow) GroupEditorForm();
105 r = pSceneManager->AddSceneEventListener(sceneId, *pForm);
106 TryCatch(r == E_SUCCESS, delete pForm, "[%s] Unable to add scene event listener", GetErrorMessage(r));
110 else if (formId == IDC_FORM_SETTINGS)
112 SettingsForm* pForm = new (std::nothrow) SettingsForm();
116 else if (formId == IDC_FORM_GROUP_CONTACT_LIST)
118 GroupContactListForm* pForm = new (std::nothrow) GroupContactListForm();
121 r = pSceneManager->AddSceneEventListener(sceneId, *pForm);
122 TryCatch(r == E_SUCCESS, delete pForm, "[%s] Unable to add scene event listener", GetErrorMessage(r));
126 else if (formId == IDC_FORM_GROUP_CONTACT_LIST_EDITOR)
128 GroupContactListEditorForm* pForm = new (std::nothrow) GroupContactListEditorForm();
131 r = pSceneManager->AddSceneEventListener(sceneId, *pForm);
132 TryCatch(r == E_SUCCESS, delete pForm, "[%s] Unable to add scene event listener", GetErrorMessage(r));