{
}
-void WindowBaseAndroid::SetAvailableAnlges( const std::vector< int >& angles )
+void WindowBaseAndroid::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
{
}
-void WindowBaseAndroid::SetPreferredAngle( int angle )
+void WindowBaseAndroid::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
{
}
virtual void Activate() override;
/**
- * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
+ * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableOrientations()
*/
- virtual void SetAvailableAnlges( const std::vector< int >& angles ) override;
+ virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) override;
/**
- * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
+ * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredOrientation()
*/
- virtual void SetPreferredAngle( int angle ) override;
+ virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) override;
/**
* @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
/**
* @copydoc Dali::Window::SetAvailableOrientations()
*/
- virtual void SetAvailableAnlges( const std::vector< int >& angles ) = 0;
+ virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) = 0;
/**
* @copydoc Dali::Window::SetPreferredOrientation()
*/
- virtual void SetPreferredAngle( int angle ) = 0;
+ virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) = 0;
/**
* @copydoc Dali::Window::SetAcceptFocus()
#include <dali/internal/window-system/common/render-surface-factory.h>
#include <dali/internal/window-system/common/window-factory.h>
#include <dali/internal/window-system/common/window-base.h>
-#include <dali/internal/window-system/common/window-system.h>
#include <dali/internal/window-system/common/window-render-surface.h>
#include <dali/internal/window-system/common/window-visibility-observer.h>
mResizeEnabled( false ),
mType( Dali::Window::NORMAL ),
mParentWindow( NULL ),
- mPreferredAngle( 0 ),
+ mPreferredOrientation( Dali::Window::PORTRAIT ),
mRotationAngle( 0 ),
mWindowWidth( 0 ),
mWindowHeight( 0 ),
- mOrientationMode( Internal::Adaptor::Window::OrientationMode::PORTRAIT ),
mFocusChangedSignal(),
mResizedSignal(),
mDeleteRequestSignal(),
mWindowSurface->Map();
mOrientation = Orientation::New( this );
-
- // Get OrientationMode
- int screenWidth, screenHeight;
- WindowSystem::GetScreenSize( screenWidth, screenHeight );
- if( screenWidth > screenHeight )
- {
- mOrientationMode = Internal::Adaptor::Window::OrientationMode::LANDSCAPE;
- }
- else
- {
- mOrientationMode = Internal::Adaptor::Window::OrientationMode::PORTRAIT;
- }
}
void Window::OnAdaptorSet(Dali::Adaptor& adaptor)
void Window::AddAvailableOrientation( Dali::Window::WindowOrientation orientation )
{
bool found = false;
+
if( orientation <= Dali::Window::LANDSCAPE_INVERSE )
{
- int convertedAngle = ConvertToAngle( orientation );
- for( std::size_t i = 0; i < mAvailableAngles.size(); i++ )
+ for( std::size_t i = 0; i < mAvailableOrientations.size(); i++ )
{
- if( mAvailableAngles[i] == convertedAngle )
+ if( mAvailableOrientations[i] == orientation )
{
found = true;
break;
if( !found )
{
- mAvailableAngles.push_back( convertedAngle );
- SetAvailableAnlges( mAvailableAngles );
+ mAvailableOrientations.push_back( orientation );
+ SetAvailableOrientations( mAvailableOrientations );
}
}
}
void Window::RemoveAvailableOrientation( Dali::Window::WindowOrientation orientation )
{
- int convertedAngle = ConvertToAngle( orientation );
- for( std::vector< int >::iterator iter = mAvailableAngles.begin();
- iter != mAvailableAngles.end(); ++iter )
+ for( std::vector<Dali::Window::WindowOrientation>::iterator iter = mAvailableOrientations.begin();
+ iter != mAvailableOrientations.end(); ++iter )
{
- if( *iter == convertedAngle )
+ if( *iter == orientation )
{
- mAvailableAngles.erase( iter );
+ mAvailableOrientations.erase( iter );
break;
}
}
-
- SetAvailableAnlges( mAvailableAngles );
-}
-
-void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
-{
- mPreferredAngle = ConvertToAngle( orientation );
- mWindowBase->SetPreferredAngle( mPreferredAngle );
-}
-
-Dali::Window::WindowOrientation Window::GetPreferredOrientation()
-{
- Dali::Window::WindowOrientation preferredOrientation = ConvertToOrientation( mPreferredAngle );
- return preferredOrientation;
+ SetAvailableOrientations( mAvailableOrientations );
}
-void Window::SetAvailableAnlges( const std::vector< int >& angles )
+void Window::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
{
- if( angles.size() > 4 )
+ if( orientations.size() > 4 )
{
- DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetAvailableAnlges: Invalid vector size! [%d]\n", angles.size() );
+ DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetAvailableOrientations: Invalid vector size! [%d]\n", orientations.size() );
return;
}
- mWindowBase->SetAvailableAnlges( angles );
+ mAvailableOrientations = orientations;
+
+ mWindowBase->SetAvailableOrientations( mAvailableOrientations );
}
-int Window::ConvertToAngle( Dali::Window::WindowOrientation orientation )
+const std::vector< Dali::Window::WindowOrientation >& Window::GetAvailableOrientations()
{
- int convertAngle = static_cast< int >( orientation );
- if( mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE )
- {
- switch( orientation )
- {
- case Dali::Window::LANDSCAPE:
- {
- convertAngle = 0;
- break;
- }
- case Dali::Window::PORTRAIT:
- {
- convertAngle = 90;
- break;
- }
- case Dali::Window::LANDSCAPE_INVERSE:
- {
- convertAngle = 180;
- break;
- }
- case Dali::Window::PORTRAIT_INVERSE:
- {
- convertAngle = 270;
- break;
- }
- }
- }
- return convertAngle;
+ return mAvailableOrientations;
}
-Dali::Window::WindowOrientation Window::ConvertToOrientation( int angle )
+void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
{
- Dali::Window::WindowOrientation orientation = static_cast< Dali::Window::WindowOrientation >( angle );
- if( mOrientationMode == Internal::Adaptor::Window::OrientationMode::LANDSCAPE )
- {
- switch( angle )
- {
- case 0:
- {
- orientation = Dali::Window::LANDSCAPE;
- break;
- }
- case 90:
- {
- orientation = Dali::Window::PORTRAIT;
- break;
- }
- case 180:
- {
- orientation = Dali::Window::LANDSCAPE_INVERSE;
- break;
- }
- case 270:
- {
- orientation = Dali::Window::PORTRAIT_INVERSE;
- break;
- }
- }
- }
- return orientation;
+ mPreferredOrientation = orientation;
+
+ mWindowBase->SetPreferredOrientation( mPreferredOrientation );
+}
+
+Dali::Window::WindowOrientation Window::GetPreferredOrientation()
+{
+ return mPreferredOrientation;
}
Dali::Any Window::GetNativeHandle() const
void RemoveAvailableOrientation(Dali::Window::WindowOrientation orientation);
/**
+ * @copydoc Dali::Window::SetAvailableOrientations()
+ */
+ void SetAvailableOrientations(const std::vector<Dali::Window::WindowOrientation>& orientations);
+
+ /**
+ * @copydoc Dali::Window::GetAvailableOrientations()
+ */
+ const std::vector<Dali::Window::WindowOrientation>& GetAvailableOrientations();
+
+ /**
* @copydoc Dali::Window::SetPreferredOrientation()
*/
void SetPreferredOrientation(Dali::Window::WindowOrientation orientation);
private:
/**
- * @brief Enumeration for orietation mode.
- * The Orientation Mode is related to screen size.
- * If screen width is longer than height, the Orientation Mode will have LANDSCAPE.
- * Otherwise screen width is shorter than height or same, the Orientation Mode will have PORTRAIT.
- */
- enum class OrientationMode
- {
- PORTRAIT = 0,
- LANDSCAPE
- };
-
- /**
* Private constructor.
* @sa Window::New()
*/
*/
void OnTransitionEffectEvent( DevelWindow::EffectState state, DevelWindow::EffectType type );
- /**
- * @brief Set available orientation to window base.
- */
- void SetAvailableAnlges( const std::vector< int >& angles );
-
- /**
- * @brief Convert from window orientation to angle using OrientationMode.
- */
- int ConvertToAngle( Dali::Window::WindowOrientation orientation );
-
- /**
- * @brief Convert from angle to window orientation using OrientationMode.
- */
- Dali::Window::WindowOrientation ConvertToOrientation( int angle );
-
private: // Dali::Internal::Adaptor::SceneHolder
/**
Dali::Window::Type mType;
Dali::Window mParentWindow;
- OrientationPtr mOrientation;
- std::vector< int > mAvailableAngles;
- int mPreferredAngle;
+ OrientationPtr mOrientation;
+ std::vector<Dali::Window::WindowOrientation> mAvailableOrientations;
+ Dali::Window::WindowOrientation mPreferredOrientation;
int mRotationAngle; ///< The angle of the rotation
int mWindowWidth; ///< The width of the window
EventHandlerPtr mEventHandler; ///< The window events handler
- OrientationMode mOrientationMode;
-
// Signals
IndicatorSignalType mIndicatorVisibilityChangedSignal;
FocusSignalType mFocusChangedSignal;
// Default window size == screen size
mPositionSize.x = 0;
mPositionSize.y = 0;
+
WindowSystem::GetScreenSize( mPositionSize.width, mPositionSize.height );
}
WindowBaseEcoreWl* windowBase = static_cast< WindowBaseEcoreWl* >( data );
if( windowBase )
{
- DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl::EcoreEventRotate\n" );
windowBase->OnRotation( data, type, event );
}
return ECORE_CALLBACK_PASS_ON;
if( ev->win == static_cast< unsigned int >( ecore_wl_window_id_get( mEcoreWindow ) ) )
{
- DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl::OnRotation, angle: %d, width: %d, height: %d\n", ev->angle, ev->w, ev->h );
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::OnRotation\n" );
RotationEvent rotationEvent;
rotationEvent.angle = ev->angle;
ecore_wl_window_activate( mEcoreWindow );
}
-void WindowBaseEcoreWl::SetAvailableAnlges( const std::vector< int >& angles )
+void WindowBaseEcoreWl::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
{
int rotations[4] = { 0 };
- DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl::SetAvailableAnlges, angle's count: %d\n", angles.size() );
- for( std::size_t i = 0; i < angles.size(); ++i )
+ for( std::size_t i = 0; i < orientations.size(); ++i )
{
- rotations[i] = static_cast< int >( angles[i] );
- DALI_LOG_RELEASE_INFO( "%d ", rotations[i] );
+ rotations[i] = static_cast< int >( orientations[i] );
}
- ecore_wl_window_rotation_available_rotations_set( mEcoreWindow, rotations, angles.size() );
+ ecore_wl_window_rotation_available_rotations_set( mEcoreWindow, rotations, orientations.size() );
}
-void WindowBaseEcoreWl::SetPreferredAngle( int angle )
+void WindowBaseEcoreWl::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
{
- DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl::SetPreferredAngle, angle: %d\n", angle );
- ecore_wl_window_rotation_preferred_rotation_set( mEcoreWindow, angle );
+ ecore_wl_window_rotation_preferred_rotation_set( mEcoreWindow, orientation );
}
void WindowBaseEcoreWl::SetAcceptFocus( bool accept )
virtual void Activate() override;
/**
- * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
+ * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableOrientations()
*/
- virtual void SetAvailableAnlges( const std::vector< int >& angles ) override;
+ virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) override;
/**
- * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
+ * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredOrientation()
*/
- virtual void SetPreferredAngle( int angle ) override;
+ virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) override;
/**
* @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
WindowBaseEcoreWl2* windowBase = static_cast< WindowBaseEcoreWl2* >( data );
if( windowBase )
{
- DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl2::EcoreEventRotate\n" );
windowBase->OnRotation( data, type, event );
}
return ECORE_CALLBACK_PASS_ON;
if( ev->win == static_cast< unsigned int >( ecore_wl2_window_id_get( mEcoreWindow ) ) )
{
- DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl2::OnRotation, angle: %d, width: %d, height: %d\n", ev->angle, ev->w, ev->h );
+ DALI_LOG_INFO( gWindowBaseLogFilter, Debug::Concise, "WindowBaseEcoreWl::OnRotation\n" );
RotationEvent rotationEvent;
rotationEvent.angle = ev->angle;
ecore_wl2_window_activate( mEcoreWindow );
}
-void WindowBaseEcoreWl2::SetAvailableAnlges( const std::vector< int >& angles )
+void WindowBaseEcoreWl2::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
{
int rotations[4] = { 0 };
- DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl2::SetAvailableAnlges, angle's count: %d\n", angles.size() );
- for( std::size_t i = 0; i < angles.size(); ++i )
+ for( std::size_t i = 0; i < orientations.size(); ++i )
{
- rotations[i] = static_cast< int >( angles[i] );
- DALI_LOG_RELEASE_INFO( "%d ", rotations[i] );
+ rotations[i] = static_cast< int >( orientations[i] );
}
- ecore_wl2_window_available_rotations_set( mEcoreWindow, rotations, angles.size() );
+ ecore_wl2_window_available_rotations_set( mEcoreWindow, rotations, orientations.size() );
}
-void WindowBaseEcoreWl2::SetPreferredAngle( int angle )
+void WindowBaseEcoreWl2::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
{
- DALI_LOG_RELEASE_INFO( "WindowBaseEcoreWl2::SetPreferredAngle, angle: %d\n", angle );
- ecore_wl2_window_preferred_rotation_set( mEcoreWindow, angle );
+ ecore_wl2_window_preferred_rotation_set( mEcoreWindow, orientation );
}
void WindowBaseEcoreWl2::SetAcceptFocus( bool accept )
virtual void Activate() override;
/**
- * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
+ * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableOrientations()
*/
- virtual void SetAvailableAnlges( const std::vector< int >& angles ) override;
+ virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) override;
/**
- * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
+ * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredOrientation()
*/
- virtual void SetPreferredAngle( int angle ) override;
+ virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) override;
/**
* @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
ecore_x_netwm_client_active_request( ecore_x_window_root_get( mEcoreWindow ), mEcoreWindow, 1 /* request type, 1:application, 2:pager */, 0 );
}
-void WindowBaseEcoreX::SetAvailableAnlges( const std::vector< int >& angles )
+void WindowBaseEcoreX::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
{
}
-void WindowBaseEcoreX::SetPreferredAngle( int angle )
+void WindowBaseEcoreX::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
{
}
virtual void Activate() override;
/**
- * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
+ * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableOrientations()
*/
- virtual void SetAvailableAnlges( const std::vector< int >& angles ) override;
+ virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) override;
/**
- * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
+ * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredOrientation()
*/
- virtual void SetPreferredAngle( int angle ) override;
+ virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) override;
/**
* @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
{
}
-void WindowBaseWin::SetAvailableAnlges( const std::vector< int >& angles )
+void WindowBaseWin::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
{
}
-void WindowBaseWin::SetPreferredAngle( int angle )
+void WindowBaseWin::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
{
}
virtual void Activate() override;
/**
- * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableAnlges()
+ * @copydoc Dali::Internal::Adaptor::WindowBase::SetAvailableOrientations()
*/
- virtual void SetAvailableAnlges( const std::vector< int >& angles ) override;
+ virtual void SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations ) override;
/**
- * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredAngle()
+ * @copydoc Dali::Internal::Adaptor::WindowBase::SetPreferredOrientation()
*/
- virtual void SetPreferredAngle( int angle ) override;
+ virtual void SetPreferredOrientation( Dali::Window::WindowOrientation orientation ) override;
/**
* @copydoc Dali::Internal::Adaptor::WindowBase::SetAcceptFocus()
GetImplementation(*this).RemoveAvailableOrientation( orientation );
}
-void Window::SetPreferredOrientation( WindowOrientation orientation )
+void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
{
GetImplementation(*this).SetPreferredOrientation( orientation );
}