mResizeEnabled( false ),
mType( Dali::Window::NORMAL ),
mParentWindow( NULL ),
- mPreferredAngle( 0 ),
+ mPreferredAngle( Dali::Window::NO_ORIENTATION_PREFERENCE ),
mRotationAngle( 0 ),
mWindowWidth( 0 ),
mWindowHeight( 0 ),
void Window::AddAvailableOrientation( Dali::Window::WindowOrientation orientation )
{
+ if( IsOrientationAvailable( orientation ) == false )
+ {
+ return;
+ }
+
bool found = false;
- if( orientation <= Dali::Window::LANDSCAPE_INVERSE )
+ int convertedAngle = ConvertToAngle( orientation );
+ for( std::size_t i = 0; i < mAvailableAngles.size(); i++ )
{
- int convertedAngle = ConvertToAngle( orientation );
- for( std::size_t i = 0; i < mAvailableAngles.size(); i++ )
+ if( mAvailableAngles[i] == convertedAngle )
{
- if( mAvailableAngles[i] == convertedAngle )
- {
- found = true;
- break;
- }
+ found = true;
+ break;
}
+ }
- if( !found )
- {
- mAvailableAngles.push_back( convertedAngle );
- SetAvailableAnlges( mAvailableAngles );
- }
+ if( !found )
+ {
+ mAvailableAngles.push_back( convertedAngle );
+ SetAvailableAnlges( mAvailableAngles );
}
}
void Window::RemoveAvailableOrientation( Dali::Window::WindowOrientation orientation )
{
+ if( IsOrientationAvailable( orientation ) == false )
+ {
+ return;
+ }
+
int convertedAngle = ConvertToAngle( orientation );
for( std::vector< int >::iterator iter = mAvailableAngles.begin();
iter != mAvailableAngles.end(); ++iter )
void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
{
+ if( orientation < Dali::Window::NO_ORIENTATION_PREFERENCE || orientation > Dali::Window::LANDSCAPE_INVERSE )
+ {
+ return;
+ }
mPreferredAngle = ConvertToAngle( orientation );
mWindowBase->SetPreferredAngle( mPreferredAngle );
}
convertAngle = 270;
break;
}
+ case Dali::Window::NO_ORIENTATION_PREFERENCE:
+ {
+ convertAngle = -1;
+ break;
+ }
}
}
return convertAngle;
orientation = Dali::Window::PORTRAIT_INVERSE;
break;
}
+ case -1:
+ {
+ orientation = Dali::Window::NO_ORIENTATION_PREFERENCE;
+ break;
+ }
}
}
return orientation;
}
+bool Window::IsOrientationAvailable( Dali::Window::WindowOrientation orientation ) const
+{
+ if( orientation <= Dali::Window::NO_ORIENTATION_PREFERENCE || orientation > Dali::Window::LANDSCAPE_INVERSE )
+ {
+ DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::IsOrientationAvailable: Invalid input orientation [%d]\n", orientation );
+ return false;
+ }
+ return true;
+}
+
Dali::Any Window::GetNativeHandle() const
{
return mWindowSurface->GetNativeWindow();
/**
* @brief Enumeration for orientation of the window is the way in which a rectangular page is oriented for normal viewing.
+ *
+ * This Enumeration is used the available orientation APIs and the preferred orientation.
+ *
+ * Especially, NO_ORIENTATION_PREFERENCE only has the effect for the preferred orientation.
+ * It is used to unset the preferred orientation with SetPreferredOrientation.
* @SINCE_1_0.0
*/
enum WindowOrientation
PORTRAIT = 0, ///< Portrait orientation. The height of the display area is greater than the width. @SINCE_1_0.0
LANDSCAPE = 90, ///< Landscape orientation. A wide view area is needed. @SINCE_1_0.0
PORTRAIT_INVERSE = 180, ///< Portrait inverse orientation @SINCE_1_0.0
- LANDSCAPE_INVERSE = 270 ///< Landscape inverse orientation @SINCE_1_0.0
+ LANDSCAPE_INVERSE = 270, ///< Landscape inverse orientation @SINCE_1_0.0
+ NO_ORIENTATION_PREFERENCE = -1 ///< No orientation. It is for the preferred orientation. @SINCE_1_4.51
};
/**
* @SINCE_1_0.0
* @param[in] orientation The preferred orientation
* @pre Orientation is in the list of available orientations.
+ *
+ * @note To unset the preferred orientation, orientation should be set NO_ORIENTATION_PREFERENCE.
*/
void SetPreferredOrientation( WindowOrientation orientation );