void MessageHandler::screenSetOrientation(const char* orientation) { if (0 == strcmp(orientation, "dynamic")) { // Android and Windows Phone. maScreenSetOrientation(SCREEN_ORIENTATION_DYNAMIC); // iOS and Windows Phone. maScreenSetSupportedOrientations( MA_SCREEN_ORIENTATION_LANDSCAPE_LEFT | MA_SCREEN_ORIENTATION_LANDSCAPE_RIGHT | MA_SCREEN_ORIENTATION_PORTRAIT | MA_SCREEN_ORIENTATION_PORTRAIT_UPSIDE_DOWN); } else if (0 == strcmp(orientation, "portrait")) { // Android and Windows Phone. maScreenSetOrientation(SCREEN_ORIENTATION_PORTRAIT); // iOS and Windows Phone. maScreenSetSupportedOrientations( MA_SCREEN_ORIENTATION_PORTRAIT | MA_SCREEN_ORIENTATION_PORTRAIT_UPSIDE_DOWN); } else if (0 == strcmp(orientation, "landscape")) { // Android and Windows Phone. maScreenSetOrientation(SCREEN_ORIENTATION_LANDSCAPE); // iOS and Windows Phone. maScreenSetSupportedOrientations( MA_SCREEN_ORIENTATION_LANDSCAPE_LEFT | MA_SCREEN_ORIENTATION_LANDSCAPE_RIGHT); } }
/** * Creates and adds main layout to the screen. */ void MainScreen::createMainLayout() { // Create and add the main layout to the screen. mMainLayout = new VerticalLayout(); mMainLayout->setBackgroundColor(0xC1FFC1); Screen::setMainWidget(mMainLayout); Label* infoLabel = new Label(); infoLabel->setText("Your current details:"); myAge = new Label(); myAge->setText("Age is not set."); mMainLayout->addChild(myAge); myGender = new Label(); myGender->setText("Gender is not set."); mMainLayout->addChild(myGender); mButtonForm = new Button(); mButtonForm->setText("Fill form"); mMainLayout->addChild(mButtonForm); int mSupportedOrientations = MA_SCREEN_ORIENTATION_PORTRAIT | MA_SCREEN_ORIENTATION_LANDSCAPE_LEFT | MA_SCREEN_ORIENTATION_LANDSCAPE_RIGHT; int result = maScreenSetSupportedOrientations(mSupportedOrientations); }
/** * Constructor. */ MyMoblet() { // Set the orientation mode to dynamic, so that it is possible to switch // between portrait and landscape orientations. You can also use these // syscalls to lock the screen in PORTRAIT or LANDSCAPE mode. maScreenSetSupportedOrientations(MA_SCREEN_ORIENTATION_DYNAMIC); // Update the display. drawScreen(); }