#include <dali-toolkit/public-api/controls/control.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/styling/style-manager.h>
-#include <dali-toolkit/internal/styling/util.h>
#include <dali/integration-api/debug.h>
// EXTERNAL INCLUDES
}
StyleManager::StyleManager()
- : mOrientationDegrees( 0 ), // Portrait
- mSetThemeConnection( false )
+ : mOrientationDegrees( 0 ) // Portrait
{
// Add theme builder constants
mThemeBuilderConstants[ PACKAGE_PATH_KEY ] = DEFAULT_PACKAGE_PATH;
StyleManager::~StyleManager()
{
- // Disconnect from signal
- SetOrientation( Orientation() );
}
void StyleManager::SetOrientationValue( int orientation )
{
- mOrientationDegrees = orientation;
-
- Util::ConnectEventProcessingFinishedSignal();
- mSetThemeConnection = true;
+ if( orientation != mOrientationDegrees )
+ {
+ mOrientationDegrees = orientation;
+ // TODO: if orientation changed, apply the new style to all controls
+ // dont want to really do the whole load from file again if the bundle contains both portrait & landscape
+ SetTheme();
+ }
}
int StyleManager::GetOrientationValue()
void StyleManager::OnOrientationChanged( Orientation orientation )
{
mOrientation = orientation;
-
- if( mOrientation )
- {
- Util::ConnectEventProcessingFinishedSignal();
- mSetThemeConnection = true;
- }
+ // TODO: if orientation changed, apply the new style to all controls
+ // dont want to really do the whole load from file again if the bundle contains both portrait & landscape
+ SetTheme();
}
Toolkit::Builder StyleManager::CreateBuilder( const PropertyValueMap& constants )
{
mThemeFile = themeFile;
- Util::ConnectEventProcessingFinishedSignal();
- mSetThemeConnection = true;
+ // need to do style change synchronously as app might create a UI control on the next line
+ SetTheme();
}
void StyleManager::RequestDefaultTheme()
RequestThemeChange( DEFAULT_THEME );
}
-bool StyleManager::IsThemeRequestPending()
-{
- return mSetThemeConnection;
-}
-
void StyleManager::SetTheme()
{
mThemeBuilder = CreateBuilder( mThemeBuilderConstants );
LoadJSON( mThemeBuilder, mThemeFile );
- mSetThemeConnection = false;
-
StyleChange change;
change.themeChange = true;
mStyleChangeSignal.Emit( Toolkit::StyleManager::Get(), change );