一个scene是UI跳转的基本单元,包括一个form和一个panel,或只有一个form。
1. functions
1)管理form的生命周期,管理forms或者panels的跳转;
2)管理scene的变换;
3)为forms或panels的跳转增加动画。
2. 注册所有的scenes
1)实现 Tizen::Ui::Scenes::IFormFactory和 Tizen::Ui::Scenes::IPanelFactory,并为forms和panels指定特定的ID;
class MyFormFactory: public Tizen::Ui::Scenes::IFormFactory
class MyPanelFactory: public Tizen::Ui::Scenes::IPanelFactory
static MyFormFactory myFormFactory; myFormFactory.Construct(); static MyPanelFactory myPanelFactory; myPanelFactory.Construct(); static MyPolicyProvider myPolicyProvider; pSceneManager->RegisterFormFactory(myFormFactory); pSceneManager->RegisterPanelFactory(myPanelFactory);
SceneManager* pSceneManager = SceneManager::GetInstance(); pSceneManager->RegisterScene(L"InitialScene", L"InitialForm", L""); pSceneManager->RegisterScene(L"MainContactsListScene", L"MainForm", L"ContactsListPanel"); pSceneManager->RegisterScene(L"MainGroupsListScene", L"MainForm", L"GroupsPanel"); pSceneManager->RegisterScene(L"MainFavouritesListScene", L"MainForm", L"FavouritesListPanel"); pSceneManager->RegisterScene(L"DetailScene", L"DetailForm", L"");
class MyPolicyProvider: public Tizen::Ui::Scenes::ISceneTransitionPolicyProvider
Tizen::Base::String MyPolicyProvider::GetNextScene(const Tizen::Base::String& currentSceneId, const Tizen::Base::Collection::IList* pArgs) { String nextSceneId(L""); if (currentSceneId == L"InitialScene") nextSceneId = L"MainContactsListScene"; return nextSceneId; }
void MainForm::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) { result r = E_SUCCESS; SceneManager* pSceneManager = SceneManager::GetInstance(); switch (actionId) { case ID_BUTTON_1: r = pSceneManager->GoForward(ForwardSceneTransition(SCENE_TRANSITION_ANIMATION_TYPE_NONE, SCENE_HISTORY_OPTION_NO_HISTORY)); break; default: break; } }