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 GlMainFrame.cpp
19 * @brief This is the implementation file for MainFrame class.
23 #include "GlGalleryApp.h"
24 #include "GlFormFactory.h"
25 #include "GlMainFrame.h"
26 #include "GlPanelFactory.h"
29 using namespace Tizen::Base;
30 using namespace Tizen::Base::Collection;
31 using namespace Tizen::Ui;
32 using namespace Tizen::Ui::Controls;
33 using namespace Tizen::Ui::Scenes;
35 MainFrame::MainFrame(void)
38 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
41 MainFrame::~MainFrame(void)
44 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
48 MainFrame::OnInitializing(void)
52 static FormFactory formFactory;
53 static PanelFactory panelFactory;
55 AddFrameEventListener(*this);
57 SceneManager* pSceneManager = SceneManager::GetInstance();
59 r = pSceneManager->RegisterFormFactory(formFactory);
60 r = pSceneManager->RegisterPanelFactory(panelFactory);
62 r = pSceneManager->RegisterScene(IDSCN_ALBUM_LIST, IDC_FORM_ALBUM_LIST, IDC_PANEL_BLANK);
63 r = pSceneManager->RegisterScene(IDSCN_ALBUM_LIST_EDITOR, IDC_FORM_ALBUM_LIST_EDITOR, IDC_PANEL_BLANK);
64 r = pSceneManager->RegisterScene(IDSCN_ALBUM_NAME_EDITOR, IDC_FORM_ALBUM_NAME_EDITOR, IDC_PANEL_BLANK);
66 r = pSceneManager->RegisterScene(IDSCN_ALL_LIST, IDC_FORM_FILE_LIST, IDC_PANEL_ALL_LIST);
67 r = pSceneManager->RegisterScene(IDSCN_IMAGE_LIST, IDC_FORM_FILE_LIST, IDC_PANEL_IMAGE_LIST);
68 r = pSceneManager->RegisterScene(IDSCN_VIDEO_LIST, IDC_FORM_FILE_LIST, IDC_PANEL_VIDEO_LIST);
70 r = pSceneManager->RegisterScene(IDSCN_ALL_LIST_EDITOR, IDC_FORM_FILE_LIST_EDITOR, IDC_PANEL_ALL_LIST_EDITOR);
71 r = pSceneManager->RegisterScene(IDSCN_IMAGE_LIST_EDITOR, IDC_FORM_FILE_LIST_EDITOR, IDC_PANEL_IMAGE_LIST_EDITOR);
72 r = pSceneManager->RegisterScene(IDSCN_VIDEO_LIST_EDITOR, IDC_FORM_FILE_LIST_EDITOR, IDC_PANEL_VIDEO_LIST_EDITOR);
74 r = pSceneManager->RegisterScene(IDSCN_ALL_LIST_SELECTION, IDC_FORM_FILE_LIST_EDITOR,
75 IDC_PANEL_ALL_LIST_SELECTION);
77 r = pSceneManager->RegisterScene(IDSCN_SETTING_MAIN, IDC_FORM_SETTING_MAIN, IDC_PANEL_BLANK);
78 r = pSceneManager->RegisterScene(IDSCN_SETTING_INTERVAL, IDC_FORM_SETTING_INTERVAL, IDC_PANEL_BLANK);
79 r = pSceneManager->RegisterScene(IDSCN_SETTING_TRANSITION, IDC_FORM_SETTING_TRANSITION, IDC_PANEL_BLANK);
80 r = pSceneManager->RegisterScene(IDSCN_IMAGE_CROP, IDC_FORM_IMAGE_CROP, IDC_PANEL_BLANK);
83 GalleryApp* pGalleryApp = static_cast<GalleryApp*>(GalleryApp::GetInstance());
85 String operationID = pGalleryApp->GetAppControlOperationId();
87 if (operationID.CompareTo(APPCONTROL_OPERATION_ID_MAIN) == 0)
89 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST), null);
91 else if (operationID.CompareTo(APPCONTROL_OPERATION_ID_PICK) == 0)
93 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_ALBUM_LIST), null);
95 else if (operationID.CompareTo(APPCONTROL_OPERATION_ID_CONFIGURE) == 0)
97 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SETTING_MAIN), null);
101 pGalleryApp->Terminate();
103 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
109 MainFrame::OnTerminating(void)
111 AppLogDebug("ENTER");
112 AppLogDebug("EXIT(%s)", GetErrorMessage(GetLastResult()));
118 MainFrame::OnFrameActivated(const Frame& source)
120 AppLogDebug("OnFrameActivated");
122 GalleryApp* pGalleryApp = static_cast<GalleryApp*>(GalleryApp::GetInstance());
123 if (pGalleryApp != null)
125 pGalleryApp->SetFrameActivated(true);