void FormMgr::SwitchToForm(RequestId requestId, Osp::Base::Collection::IList* pArgs) { Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame(); if (requestId == REQUEST_MAINFORM) { FMainForm* pExeForm = new FMainForm(); pExeForm->Initialize(); pFrame->AddControl(*pExeForm); pFrame->SetCurrentForm(*pExeForm); pExeForm->Draw(); pExeForm->Show(); if (__pPreviousForm != null) pFrame->RemoveControl(*__pPreviousForm); __pPreviousForm = pExeForm; } else if (requestId == REQUEST_CAMERAFORM) { Integer * arg1 = static_cast<Integer*>(pArgs->GetAt(0)); int sinterval = arg1->ToInt(); Osp::Graphics::Dimension * arg2 = static_cast<Osp::Graphics::Dimension*>(pArgs->GetAt(1)); Osp::Graphics::Dimension sresolution; sresolution.SetSize(arg2->width,arg2->height); Integer * arg3 = static_cast<Integer*>(pArgs->GetAt(2)); int sstopafter = arg3->ToInt(); FCameraForm* pExeForm = new FCameraForm(); pExeForm->Initialize(); pFrame->AddControl(*pExeForm); pFrame->SetCurrentForm(*pExeForm); pExeForm->Draw(); pExeForm->Show(); pExeForm->StartCamera(sinterval, sresolution, sstopafter); if (__pPreviousForm != null) pFrame->RemoveControl(*__pPreviousForm); __pPreviousForm = pExeForm; } else if (requestId == REQUEST_PLAYERFORM) { Osp::Base::String filename = L""; bool autoplay = false; Osp::Base::String * arg1 = static_cast<Osp::Base::String*>(pArgs->GetAt(0)); if (pArgs->GetCount() >= 2) { Osp::Base::Boolean * arg2 = static_cast<Osp::Base::Boolean*>(pArgs->GetAt(1)); autoplay = arg2->ToBool(); } filename.Append(*arg1); FPlayer* pExeForm = new FPlayer(); pExeForm->Initialize(); pFrame->AddControl(*pExeForm); pFrame->SetCurrentForm(*pExeForm); pExeForm->Draw(); pExeForm->Show(); pExeForm->LoadFile(filename, autoplay); if (__pPreviousForm != null) pFrame->RemoveControl(*__pPreviousForm); __pPreviousForm = pExeForm; } }
bool FormMgr::Initialize() { result r = E_SUCCESS; r = Form::Construct(FORM_STYLE_NORMAL); SetName(L"FormMgr"); Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame(); __pForm1 = new Form1(); __pForm1->Initialize(); pFrame->AddControl(*__pForm1); __pFormHelp = new FormHelp(); __pFormHelp->Initialize(); pFrame->AddControl(*__pFormHelp); return true; }
bool WatchList::OnAppInitializing(AppRegistry& appRegistry) { // TODO: // Initialize UI resources and application specific data. // The application's permanent data and context can be obtained from the appRegistry. // // If this method is successful, return true; otherwise, return false. // If this method returns false, the application will be terminated. // Uncomment the following statement to listen to the screen on/off events. //PowerManager::SetScreenEventListener(*this); // Create a form Form1 *pForm1 = new Form1(); pForm1->Initialize(); // Add the form to the frame Frame *pFrame = GetAppFrame()->GetFrame(); pFrame->AddControl(*pForm1); // Set the current form pFrame->SetCurrentForm(*pForm1); // Draw and Show the form pForm1->Draw(); pForm1->Show(); return true; }
// // create the ScummVM system // TizenAppForm *systemStart(Tizen::App::Application *app) { logEntered(); Frame *appFrame = new (std::nothrow) TizenAppFrame(); if (!appFrame || appFrame->Construct() == E_FAILURE) { AppLog("Failed to create appFrame"); return NULL; } app->AddFrame(*appFrame); TizenAppForm *appForm = new TizenAppForm(); if (!appForm) { AppLog("Failed to create appForm"); return NULL; } if (E_SUCCESS != appForm->Construct() || E_SUCCESS != appFrame->AddControl(appForm)) { delete appForm; AppLog("Failed to construct appForm"); return NULL; } appFrame->SetCurrentForm(appForm); appForm->GetVisualElement()->SetShowState(false); logLeaving(); return appForm; }
bool DrStrangecodeRssReader::OnAppInitializing(AppRegistry& appRegistry) { // Create a form MainForm *pMainForm = new MainForm(); pMainForm->Initialize(); pMainForm->SetName(kMainFormNameString); ItemForm * pItemForm = new ItemForm(); pItemForm->Initialize(); pItemForm->SetName(kItemFormNameString); // Add the form to the frame Frame *pFrame = GetAppFrame()->GetFrame(); pFrame->AddControl(*pMainForm); pFrame->AddControl(*pItemForm); // Set the current form pFrame->SetCurrentForm(*pMainForm); // Draw and Show the form pMainForm->Draw(); pMainForm->Show(); return true; }
void FormNavigationManager::Initialize() { AppLog("FormNavigationManager::Initialize()"); _currentFormsStack.Construct(); Form::Construct(FORM_STYLE_NORMAL); // Adds itself to the app frame, so we can receive user events from the event queue Frame * pFrame = Application::GetInstance()->GetAppFrame()->GetFrame(); pFrame->AddControl(*this); }
void TreeViewForm::showAuthenticationForm(){ myAuthenticationForm = new AuthenticationForm; myAuthenticationForm->Initialize(); myAuthenticationForm->SetPreviousForm(this); myAuthenticationForm->myNode = myNode; Frame *pFrame = UiApp::GetInstance()->GetAppFrame()->GetFrame(); pFrame->AddControl(myAuthenticationForm); pFrame->SetCurrentForm(myAuthenticationForm); myAuthenticationForm->Invalidate(true); }
bool CCEGLView::Create(Osp::App::Application* pApp, int width, int height) { m_sSizeInPoint.width = MIN(width, height); m_sSizeInPoint.height = MAX(width, height); Construct(FORM_STYLE_NORMAL); Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame(); pFrame->AddControl(*this); pFrame->SetCurrentForm(*this); m_pEGL = CCEGL::create(this); if (m_pEGL == null) return false; s_pMainWindow = this; Draw(); Show(); return true; }
bool LearnABC::OnAppInitializing(AppRegistry& appRegistry) { // Create a form LearnABCForm *pMainForm = new LearnABCForm(); pMainForm->Initialize(); // Add the form to the frame Frame *pFrame = GetAppFrame()->GetFrame(); pFrame->AddControl(*pMainForm); // Set the current form pFrame->SetCurrentForm(*pMainForm); // Draw and Show the form pMainForm->Draw(); pMainForm->Show(); return true; }
bool Cordova::OnAppInitializing(AppRegistry& appRegistry) { // TODO: // Initialize UI resources and application specific data. // The application's permanent data and context can be obtained from the appRegistry. // // If this method is successful, return true; otherwise, return false. // If this method returns false, the application will be terminated. // Uncomment the following statement to listen to the screen on/off events. //PowerManager::SetScreenEventListener(*this); Frame *pFrame = null; result r = E_SUCCESS; // Create a form WebForm *pWebForm = new WebForm(); r = pWebForm->Construct(FORM_STYLE_INDICATOR); if (IsFailed(r)) { AppLog("WebForm Construct() has failed.\n"); goto CATCH; } // Add the form to the frame pFrame = GetAppFrame()->GetFrame(); pFrame->AddControl(*pWebForm); // Set the current form pFrame->SetCurrentForm(*pWebForm); // Draw and Show the form pWebForm->Draw(); pWebForm->Show(); return true; CATCH: return false; }
void MapForm::OnActionPerformed(const Osp::Ui::Control &source, int actionId) { if (null == _pMap) return; switch(actionId) { case ACTION_ID_INFOWINDOW_BUTTON: case ACTION_ID_OVERLAY_BUTTON: case ACTION_ID_ROTATE_BUTTON: { Rectangle clientRect = GetClientAreaBounds(); CloseContextMenu(); int sectors = clientRect.width / int(ACTION_ID_BUTTON_MAX); Point pos; pos.y =clientRect.height + ((this->GetHeight() - clientRect.height)/2); pos.x = (sectors / 2) + (sectors * actionId); CreateAndShowContextMenu(actionId,pos); } break; case ACTION_ID_ROTATE_CW: { RotateMap(true); } break; case ACTION_ID_ROTATE_CCW: { RotateMap(false); } break; case ACTION_ID_OVERLAY: { if (_showAll) { ShowAll(false); ShowOverlays(true); } else { MoveMarker(false); ShowInfoWindow(false); ShowInfoWindowWithImage(false); ShowMyLocation(false); if (_showOverlay == false) { ShowOverlays(true); } else { ShowOverlays(false); } } Redraw(); } break; case ACTION_ID_INFOWINDOW: { if (_showAll) { ShowAll(false); ShowInfoWindow(true); } else { MoveMarker(false); ShowOverlays(false); ShowInfoWindowWithImage(false); ShowMyLocation(false); if (_showInfo == false) { ShowInfoWindow(true); } else { ShowInfoWindow(false); } } Redraw(); } break; case ACTION_ID_INFOWINDOW2: { // if (_showAll) { // ShowAll(false); // ShowInfoWindowWithImage(true); // } else { // MoveMarker(false); // ShowOverlays(false); // ShowInfoWindow(false); // ShowMyLocation(false); // // if (_showInfoWithImage == false) { // ShowInfoWindowWithImage(true); // } else { // ShowInfoWindowWithImage(false); // } // } // // Redraw(); // } // break; if(__newStartingPoint.IsEmpty() || __newDestinationPoint.IsEmpty()) break; ArrayList waypoints; String value(L""); Osp::Base::String __newStartingPoint = (L"51.5033, -0.1197"); Osp::Base::String __newDestinationPoint = (L"51.500721983903,-0.124197006225586"); Coordinates* pStartCoord = NavigatorUtil::StringToCoordinatesN(__newStartingPoint); Coordinates* pDestCoord = NavigatorUtil::StringToCoordinatesN(__newDestinationPoint); NavigatorRouteServices* __pRouteSvc = new NavigatorRouteServices(); if(pStartCoord != null) waypoints.Add(*pStartCoord); else { waypoints.Add(*new String(__newStartingPoint)); value += L"0"; value += Locale::CountryCodeToString(COUNTRY_US); value += L";"; } if(pDestCoord != null) waypoints.Add(*pDestCoord); else { waypoints.Add(*new String(__newDestinationPoint)); value += L"1"; value += Locale::CountryCodeToString(COUNTRY_US); value += L";"; } __pRouteSvc->GetRoute(waypoints, value); waypoints.RemoveAll(true); } break; case ACTION_ID_MY_LOCATION: { ShowAll(false); ShowMyLocation(true); Redraw(); } break; case ACTION_ID_MARKERMOVE: { if (_showAll) { ShowAll(false); MoveMarker(true); } else { ShowOverlays(false); ShowInfoWindow(false); ShowInfoWindowWithImage(false); ShowMyLocation(false); if (_movedMarker) { MoveMarker(false); } else { MoveMarker(true); } } Redraw(); } break; case ACTION_ID_ALL: { if (_showAll == false) { ShowAll(true); } else { ShowAll(false); } Redraw(); } break; case ACTION_ID_BUTTON_OK_POPUP: { if (_popupShow == true) { _pPopup->SetShowState(false); _pPopup->Show(); _popupShow = false; Redraw(); } } break; case ACTION_ID_GET_ADDRESS: RequestReverseGeocode(_positionOfContextMenu); break; case ACTION_ID_BACK: { BukkaMain *pMain = new BukkaMain(); pMain->Initialize(); Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame(); pFrame->AddControl(*pMain); pFrame->SetCurrentForm(*pMain); pMain->Draw(); pMain->Show(); } break; } }
bool GCubeApp::OnAppInitialized(void) { // フレーム作成 Frame *pFrame = new Frame(); pFrame->Construct(); pFrame->SetName(L"GCube"); // フォーム作成 Form *pForm = new Form(); if (settings->showStatusBar) { pForm->Construct(FORM_STYLE_INDICATOR); } else { pForm->Construct(FORM_STYLE_NORMAL); } pForm->AddTouchEventListener(*this); pForm->AddOrientationEventListener(*this); pFrame->AddControl(pForm); pFrame->SetCurrentForm(pForm); // 画面の向き enum Orientation orientation = ORIENTATION_NONE; if (settings->orientationPortrait) { if (settings->orientationLandscapeLeft || settings->orientationLandscapeRight) { orientation = ORIENTATION_AUTOMATIC; } else { orientation = ORIENTATION_PORTRAIT; } } else { if (settings->orientationPortraitUpsideDown) { if (settings->orientationLandscapeLeft || settings->orientationLandscapeRight) { orientation = ORIENTATION_AUTOMATIC_FOUR_DIRECTION; } else { orientation = ORIENTATION_PORTRAIT_REVERSE; } } else { if (settings->orientationLandscapeLeft) { orientation = ORIENTATION_LANDSCAPE_REVERSE; } else { if (settings->orientationLandscapeRight) { orientation = ORIENTATION_LANDSCAPE; } } } } pFrame->SetOrientation(orientation); pForm->SetOrientation(orientation); pFrame->SetMultipointTouchEnabled(true); AddFrame(*pFrame); { __player = new Tizen::Graphics::Opengl::GlPlayer; __player->Construct(Tizen::Graphics::Opengl::EGL_CONTEXT_CLIENT_VERSION_2_X, pForm); __player->SetFps(settings->frameRate); __player->SetEglAttributePreset(Tizen::Graphics::Opengl::EGL_ATTRIBUTES_PRESET_ARGB8888); EGLint eglConfigList[] = { EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 16, EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE }; __player->SetEglAttributeList(eglConfigList); __player->Start(); } __renderer = new GlRendererTemplate(); __player->SetIGlRenderer(__renderer); int w = __renderer->GetTargetControlWidth(); int h = __renderer->GetTargetControlHeight(); if (settings->debugButtonPos > 0) { // デバッグボタン作成 // TODO: XMLで作成 int dy = 0; if (settings->showStatusBar) { dy = 60; } Button* pDebugButton = new Button(); if (settings->debugButtonPos == 1) { pDebugButton->Construct(Rectangle(w-80, h-80-dy, 70, 70), L"D"); } else if (settings->debugButtonPos == 2) { pDebugButton->Construct(Rectangle(10, h-80-dy, 70, 70), L"D"); } else if (settings->debugButtonPos == 3) { pDebugButton->Construct(Rectangle(w-80, 10, 70, 70), L"D"); } else { pDebugButton->Construct(Rectangle(10, 10, 70, 70), L"D"); } pDebugButton->SetActionId(ID_DEBUG_BUTTON); pDebugButton->AddActionEventListener(*this); pForm->AddControl(pDebugButton); // ポップアップ作成 __pPopup = new Popup(); __pPopup->Construct(true, Dimension(600, 800)); __pPopup->SetTitleText(L"DebugConsole"); // ポップアップを閉じるボタン作成 Button* pCloseButton = new Button(); pCloseButton->Construct(Rectangle(30, 600, 250, 80), L"Cancel"); pCloseButton->SetActionId(ID_BUTTON_CLOSE_POPUP); pCloseButton->AddActionEventListener(*this); __pPopup->AddControl(pCloseButton); // OKボタン作成 Button* pOKButton = new Button(); pOKButton->Construct(Rectangle(320, 600, 250, 80), L"OK"); pOKButton->SetActionId(ID_BUTTON_OK_POPUP); pOKButton->AddActionEventListener(*this); __pPopup->AddControl(pOKButton); // テキスト入力 __pEditField = new EditField(); __pEditField->Construct(Rectangle(30, 500, 540, 80)); __pPopup->AddControl(__pEditField); // 説明テキスト std::vector<char> textBuff; GCGetResourceData("etc/debug.txt", textBuff); textBuff.push_back('\n'); String text = String(&textBuff[0]); TextBox *pTextBox = new TextBox(); pTextBox->Construct(Rectangle(30, 50, 540, 430)); pTextBox->SetTextSize(18); pTextBox->SetText(text); __pPopup->AddControl(pTextBox); } // サイズを通知 DeviceOrientation o = this->ConvertOrientState(pFrame->GetOrientationStatus()); gcube->onSizeChanged(w, h, o); if (settings->useOrientationSensor) { __sensorManager.Construct(); this->CreateSensor(); } return true; }
void AntiMoustiqueMainForm::StartAudioPlayer() { result r = E_SUCCESS; Frame *pFrame = (Frame *)GetParent(); if( !pFrame ) { AppLog(">>>>>> GetParent has failed.\n"); return ; } if ( !g_pAudioPlayer ) { g_pAudioPlayer = new AntiMoustiqueAudioPlayer(); if( !g_pAudioPlayer ) { AppLog( ">>>>>> new AudioPlay() has been failed\n"); return; } if( g_pAudioPlayer->ConstructAudioPlayer() == false ) { AppLog( ">>>>>>ConstructVideoPlay has been failed\n"); delete g_pAudioPlayer; g_pAudioPlayer= null; return; } //------------------------------ // Attach Form to Frame //------------------------------ r = pFrame->AddControl( *g_pAudioPlayer ); if( IsFailed(r)) { AppLog( ">>>>>> pFrame->AddControl( *g_pAudioPlayer ) has been failed\n"); delete g_pAudioPlayer; g_pAudioPlayer= null; return; } } //Assign the current form as Form1 r = pFrame->SetCurrentForm( *g_pAudioPlayer ); if( IsFailed(r)) { AppLog(">>>>>> SetCurrentForm( *g_pAudioPlayer ) has failed.\n"); return ; } //Redraw form pFrame->Draw(); r = pFrame->Show(); if( IsFailed(r)) { AppLog(">>>>>> Show() has failed.\n"); return ; } g_pAudioPlayer->AudioPlayerOpen(); }
void FormManager::SwitchToForm(RequestId requestId, Osp::Base::Collection::IList* pArgs) { Frame* pFrame = Application::GetInstance()->GetAppFrame()->GetFrame(); BaseForm* pExeForm = null; switch (requestId) { case REQUEST_MAINFORM: { if (__pMainForm == null) { __pMainForm = new MainForm(); __pMainForm->Initialize(); pFrame->AddControl(*__pMainForm); } pFrame->SetCurrentForm(*__pMainForm); __pMainForm->Draw(); __pMainForm->Show(); if (__pPreviousForm != null) { if (__pPreviousForm != __pMainForm) pFrame->RemoveControl(*__pPreviousForm); } __pPreviousForm = __pMainForm; return; } break; case REQUEST_FACEBOOKLOGINFORM: pExeForm = new LoginForm(); break; case REQUEST_USERPROFILEFORM: pExeForm = new UserProfileForm(); break; case REQUEST_FRIENDSFORM: pExeForm = new FriendsForm(); break; default: return; break; } pExeForm->Initialize(); pFrame->AddControl(*pExeForm); pFrame->SetCurrentForm(*pExeForm); pExeForm->Draw(); pExeForm->Show(); if (__pPreviousForm != null) { if (__pPreviousForm != __pMainForm) pFrame->RemoveControl(*__pPreviousForm); } __pPreviousForm = pExeForm; return; }
void FormNavigationManager::OnUserEventReceivedN(RequestId requestId, IList* pArgs) { switch (requestId) { case SET_ROOT_FORM: { AppLog("FormNavigationManager: setting root form"); AppAssertf(NumberOfFormsInCurrentStack() == 0, "This navigation stack has already a root form"); Frame * pFrame = Application::GetInstance()->GetAppFrame()->GetFrame(); StackBasedNavigationForm * nextForm = static_cast<StackBasedNavigationForm *> (pArgs->GetAt(0)); // Add new form in the stack _currentFormsStack.Add(*nextForm); // Add new form on display, the form is automatically set as the current form pFrame->AddControl(*nextForm); // Call FormWillAppear() on the root form nextForm->FormWillAppear(); // Show new form nextForm->Draw(); nextForm->Show(); delete pArgs; } break; case PUSH_FORM: { AppLog("FormNavigationManager: pushing form"); AppAssertf(NumberOfFormsInCurrentStack() > 0, "This navigation stack has no root form, please set a root form with SetRootForm()"); StackBasedNavigationForm * nextForm = static_cast<StackBasedNavigationForm *> (pArgs->GetAt(0)); StackBasedNavigationForm * currentForm = static_cast<StackBasedNavigationForm *> (_currentFormsStack.GetAt(_currentFormsStack.GetCount() - 1)); Frame * pFrame = Application::GetInstance()->GetAppFrame()->GetFrame(); // Call FormWillDisappear() on the old form currentForm->FormWillDisappear(); // Add new form in the stack _currentFormsStack.Add(*nextForm); // Add new form on display, nextForm becomes the current form pFrame->AddControl(*nextForm); // Re-set currentForm as the current form so we can perform a nice animation pFrame->SetCurrentForm(*currentForm); // Call FormWillAppear() on the new form nextForm->FormWillAppear(); // Perform the transition with a nice slide-in animation FrameAnimator * pAnimator = pFrame->GetFrameAnimator(); pAnimator->SetFormTransitionAnimation( FRAME_ANIMATOR_FORM_TRANSITION_ANIMATION_TRANSLATE_LEFT, 600, ANIMATION_INTERPOLATOR_EASE_IN_OUT); pAnimator->SetCurrentForm(*nextForm); delete pArgs; } break; case POP_FORM: { AppLog("FormNavigationManager: popping form"); AppAssertf(NumberOfFormsInCurrentStack() > 0, "This navigation stack has no root form, please set a root form with SetRootForm()"); Frame *pFrame = Application::GetInstance()->GetAppFrame()->GetFrame(); AppAssertf(_currentFormsStack.GetCount() > 1, "Illegal: Trying to pop the root form"); StackBasedNavigationForm * previousForm = static_cast<StackBasedNavigationForm *> (_currentFormsStack.GetAt(_currentFormsStack.GetCount() - 2)); StackBasedNavigationForm * currentForm = static_cast<StackBasedNavigationForm *> (_currentFormsStack.GetAt(_currentFormsStack.GetCount() - 1)); // Call FormWillDisappear() on the current form currentForm->FormWillDisappear(); // Call FormWillAppear() on the previous form previousForm->FormWillAppear(); // Perform the transition with a nice slide-out animation FrameAnimator * pAnimator = pFrame->GetFrameAnimator(); pAnimator->SetFormTransitionAnimation( FRAME_ANIMATOR_FORM_TRANSITION_ANIMATION_TRANSLATE_RIGHT, 600, ANIMATION_INTERPOLATOR_EASE_IN_OUT); pAnimator->SetCurrentForm(*previousForm); pFrame->RemoveControl(*currentForm); _currentFormsStack.RemoveAt(_currentFormsStack.GetCount() - 1, false); } break; } }