Moved StyleManager to the public API 47/67347/9
authorDavid Steele <david.steele@samsung.com>
Mon, 25 Apr 2016 16:46:23 +0000 (17:46 +0100)
committerDavid Steele <david.steele@samsung.com>
Wed, 27 Apr 2016 15:18:52 +0000 (08:18 -0700)
Cleaned up the API (removed Orientation code), fixed comments, added
@SINCE_1_1.32 macros, doxygen groups.

Change-Id: I954f627a3db63714471d8440b65fc1afbc8dc44e
Signed-off-by: David Steele <david.steele@samsung.com>
23 files changed:
automated-tests/.gitignore
automated-tests/CMakeLists.txt.in [moved from automated-tests/CMakeLists.txt with 65% similarity]
automated-tests/src/dali-toolkit-styling/utc-Dali-StyleManager.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.h
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/toolkit-style-monitor.h
automated-tests/src/dali-toolkit/utc-Dali-ControlImpl.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp
build/tizen/configure.ac
build/tizen/dali-toolkit/Makefile.am
dali-toolkit/dali-toolkit.h
dali-toolkit/devel-api/file.list
dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/styling/style-manager-impl.cpp
dali-toolkit/internal/styling/style-manager-impl.h
dali-toolkit/public-api/controls/control-impl.cpp
dali-toolkit/public-api/file.list
dali-toolkit/public-api/styling/style-manager.cpp [moved from dali-toolkit/devel-api/styling/style-manager.cpp with 66% similarity]
dali-toolkit/public-api/styling/style-manager.h [moved from dali-toolkit/devel-api/styling/style-manager.h with 59% similarity]

index 39d9377..b12e784 100644 (file)
@@ -2,4 +2,5 @@
 build
 build.log
 tct*core.h
 build
 build.log
 tct*core.h
+CMakeLists.txt
 results_xml.*
 results_xml.*
similarity index 65%
rename from automated-tests/CMakeLists.txt
rename to automated-tests/CMakeLists.txt.in
index 9e15203..0a0b958 100644 (file)
@@ -4,8 +4,10 @@ PROJECT(tct_coreapi_utc)
 INCLUDE(FindPkgConfig)
 SET(BIN_DIR "/opt/usr/bin")
 
 INCLUDE(FindPkgConfig)
 SET(BIN_DIR "/opt/usr/bin")
 
+ADD_DEFINITIONS(-DDALI_STYLE_DIR="@dataReadOnlyDir@/toolkit/styles/")
+
 INCLUDE_DIRECTORIES(
 INCLUDE_DIRECTORIES(
-       src/common
+  src/common
 )
 
 ADD_SUBDIRECTORY(src)
 )
 
 ADD_SUBDIRECTORY(src)
index e463e2f..d82faf3 100644 (file)
@@ -19,7 +19,6 @@
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/integration-api/events/touch-event-integ.h>
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/integration-api/events/touch-event-integ.h>
-#include <dali-toolkit/devel-api/styling/style-manager.h>
 #include <dali-toolkit/devel-api/builder/builder.h>
 #include <test-button.h>
 #include <test-animation-data.h>
 #include <dali-toolkit/devel-api/builder/builder.h>
 #include <test-button.h>
 #include <test-animation-data.h>
@@ -163,93 +162,67 @@ void dali_style_manager_cleanup(void)
   test_return_value = TET_PASS;
 }
 
   test_return_value = TET_PASS;
 }
 
-int UtcDaliStyleManagerGet(void)
+
+int UtcDaliStyleManagerConstructorP(void)
 {
   ToolkitTestApplication application;
 
 {
   ToolkitTestApplication application;
 
-  tet_infoline(" UtcDaliStyleManagerGet");
-
-  // Register Type
-  TypeInfo type;
-  type = TypeRegistry::Get().GetTypeInfo( "StyleManager" );
-  DALI_TEST_CHECK( type );
-  BaseHandle handle = type.CreateInstance();
-  DALI_TEST_CHECK( handle );
-
-  StyleManager manager;
-
-  manager = StyleManager::Get();
-  DALI_TEST_CHECK(manager);
-
-  StyleManager newManager = StyleManager::Get();
-  DALI_TEST_CHECK(newManager);
-
-  // Check that focus manager is a singleton
-  DALI_TEST_CHECK(manager == newManager);
+  tet_infoline(" UtcDaliStyleManagerConstructorP");
+  StyleManager styleManager;
+  DALI_TEST_CHECK( !styleManager);
   END_TEST;
 }
 
   END_TEST;
 }
 
-int UtcDaliStyleManagerSetOrientationValue(void)
+int UtcDaliStyleManagerCopyConstructorP(void)
 {
 {
-  ToolkitTestApplication application;
-
-  tet_infoline( " UtcDaliStyleManagerSetOrientationValue" );
+  TestApplication application;
 
 
-  StyleManager manager = StyleManager::Get();
-
-  int orientation1 = 0;
-  manager.SetOrientationValue( orientation1 );
-  DALI_TEST_CHECK( manager.GetOrientationValue() == orientation1 );
-
-  int orientation2 = 180;
-  manager.SetOrientationValue( orientation2 );
-  DALI_TEST_CHECK( manager.GetOrientationValue() == orientation2 );
+  StyleManager styleManager = StyleManager::Get();
+  StyleManager copyOfStyleManager( styleManager );
 
 
+  DALI_TEST_CHECK( copyOfStyleManager );
   END_TEST;
 }
 
   END_TEST;
 }
 
-int UtcDaliStyleManagerSetOrientation(void)
+int UtcDaliStyleManagerAssignmentOperatorP(void)
 {
 {
-  ToolkitTestApplication application;
-
-  tet_infoline( " UtcDaliStyleManagerSetOrientation" );
+  TestApplication application;
 
 
-  StyleManager manager = StyleManager::Get();
-
-  Orientation orientation;
-
-  manager.SetOrientation( orientation );
-
-  DALI_TEST_CHECK( manager.GetOrientation() == orientation );
+  StyleManager styleManager = StyleManager::Get();
+  StyleManager copyOfStyleManager = styleManager;
 
 
+  DALI_TEST_CHECK( copyOfStyleManager );
+  DALI_TEST_CHECK( copyOfStyleManager == styleManager );
   END_TEST;
 }
 
   END_TEST;
 }
 
-int UtcDaliStyleManagerSetStyleConstant(void)
+int UtcDaliStyleManagerGet(void)
 {
   ToolkitTestApplication application;
 
 {
   ToolkitTestApplication application;
 
-  tet_infoline( " UtcDaliStyleManagerSetStyleConstant" );
-
-  StyleManager manager = StyleManager::Get();
-
-  std::string key( "key" );
-  Property::Value value( 100 );
+  tet_infoline(" UtcDaliStyleManagerGet");
 
 
-  manager.SetStyleConstant( key, value );
+  // Register Type
+  TypeInfo type;
+  type = TypeRegistry::Get().GetTypeInfo( "StyleManager" );
+  DALI_TEST_CHECK( type );
+  BaseHandle handle = type.CreateInstance();
+  DALI_TEST_CHECK( handle );
 
 
-  Property::Value returnedValue;
-  manager.GetStyleConstant( key, returnedValue );
+  StyleManager manager;
 
 
-  DALI_TEST_CHECK( value.Get<int>() == returnedValue.Get<int>() );
+  manager = StyleManager::Get();
+  DALI_TEST_CHECK(manager);
 
 
-  std::string key2( "key2" );
-  Property::Value returnedValue2;
-  DALI_TEST_CHECK( !manager.GetStyleConstant( key2, returnedValue2 ) );
+  StyleManager newManager = StyleManager::Get();
+  DALI_TEST_CHECK(newManager);
 
 
+  // Check that focus manager is a singleton
+  DALI_TEST_CHECK(manager == newManager);
   END_TEST;
 }
 
   END_TEST;
 }
 
+
 namespace
 {
 class StyleChangedSignalChecker : public ConnectionTracker
 namespace
 {
 class StyleChangedSignalChecker : public ConnectionTracker
@@ -276,11 +249,11 @@ public:
 
 } // anonymous namespace
 
 
 } // anonymous namespace
 
-int UtcDaliStyleManagerPropertyOverride(void)
+int UtcDaliStyleManagerApplyTheme(void)
 {
   ToolkitTestApplication application;
 
 {
   ToolkitTestApplication application;
 
-  tet_infoline( "Testing StyleManager property overrides" );
+  tet_infoline( "Testing StyleManager ApplyTheme" );
 
   const char* json1 =
     "{\n"
 
   const char* json1 =
     "{\n"
@@ -323,9 +296,9 @@ int UtcDaliStyleManagerPropertyOverride(void)
 
   tet_infoline("Apply the style");
 
 
   tet_infoline("Apply the style");
 
-  Test::StyleMonitor::SetThemeFileOutput(json1);
   std::string themeFile("ThemeOne");
   std::string themeFile("ThemeOne");
-  StyleManager::Get().RequestThemeChange(themeFile);
+  Test::StyleMonitor::SetThemeFileOutput(themeFile, json1);
+  StyleManager::Get().ApplyTheme(themeFile);
 
   Property::Value bgColor( testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR) );
   Property::Value fgColor( testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR) );
 
   Property::Value bgColor( testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR) );
   Property::Value fgColor( testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR) );
@@ -350,7 +323,7 @@ int UtcDaliStyleManagerPropertyOverride(void)
   tet_infoline("Apply the style again");
 
   styleChangedSignalHandler.signalCount = 0;
   tet_infoline("Apply the style again");
 
   styleChangedSignalHandler.signalCount = 0;
-  StyleManager::Get().RequestThemeChange(themeFile);
+  StyleManager::Get().ApplyTheme(themeFile);
 
   bgColor = testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR);
   fgColor = testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR);
 
   bgColor = testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR);
   fgColor = testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR);
@@ -364,11 +337,11 @@ int UtcDaliStyleManagerPropertyOverride(void)
   tet_infoline( "Load a different stylesheet");
 
   tet_infoline("Apply the new style");
   tet_infoline( "Load a different stylesheet");
 
   tet_infoline("Apply the new style");
-  Test::StyleMonitor::SetThemeFileOutput(json2);
+  std::string themeFile2("ThemeTwo");
+  Test::StyleMonitor::SetThemeFileOutput(themeFile2, json2);
 
   styleChangedSignalHandler.signalCount = 0;
 
   styleChangedSignalHandler.signalCount = 0;
-  std::string themeFile2("ThemeTwo");
-  StyleManager::Get().RequestThemeChange(themeFile2);
+  StyleManager::Get().ApplyTheme(themeFile2);
 
   bgColor = testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR);
   fgColor = testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR);
 
   bgColor = testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR);
   fgColor = testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR);
@@ -381,10 +354,230 @@ int UtcDaliStyleManagerPropertyOverride(void)
   END_TEST;
 }
 
   END_TEST;
 }
 
-int UtcDaliStyleManagerFontSizeChange(void)
+
+int UtcDaliStyleManagerApplyDefaultTheme(void)
+{
+  tet_infoline( "Testing StyleManager ApplyTheme" );
+
+  const char* defaultTheme =
+    "{\n"
+    "  \"styles\":\n"
+    "  {\n"
+    "    \"testbutton\":\n"
+    "    {\n"
+    "      \"backgroundColor\":[1.0,1.0,0.0,1.0],\n"
+    "      \"foregroundColor\":[0.0,0.0,1.0,1.0]\n"
+    "    }\n"
+    "  }\n"
+    "}\n";
+  // Bg: Yellow, Fg: Blue
+
+  const char* appTheme =
+    "{\n"
+    "  \"styles\":\n"
+    "  {\n"
+    "    \"testbutton\":\n"
+    "    {\n"
+    "      \"backgroundColor\":[1.0,0.0,1.0,1.0],\n"
+    "      \"foregroundColor\":[0.0,1.0,0.0,1.0]\n"
+    "    }\n"
+    "  }\n"
+    "}\n";
+  // Bg::Magenta, Fg:Green
+
+  std::string filepath(TEST_RESOURCE_DIR "");
+
+  Test::StyleMonitor::SetThemeFileOutput( DALI_STYLE_DIR "dali-toolkit-default-theme.json",
+                                          defaultTheme);
+  ToolkitTestApplication application;
+
+  Test::TestButton testButton = Test::TestButton::New();
+  Stage::GetCurrent().Add( testButton );
+  StyleChangedSignalChecker styleChangedSignalHandler;
+  StyleManager styleManager = StyleManager::Get();
+
+  styleManager.StyleChangedSignal().Connect(&styleChangedSignalHandler, &StyleChangedSignalChecker::OnStyleChanged);
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Get the default:
+  Property::Value defaultBgColor( testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR) );
+  Property::Value defaultFgColor( testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR) );
+
+  tet_infoline("Apply the style");
+
+  std::string themeFile("ThemeOne");
+  Test::StyleMonitor::SetThemeFileOutput(themeFile, appTheme);
+  StyleManager::Get().ApplyTheme(themeFile);
+
+  Property::Value bgColor( testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR) );
+  Property::Value fgColor( testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR) );
+
+  DALI_TEST_EQUALS( bgColor, Property::Value(Color::MAGENTA), 0.001, TEST_LOCATION );
+  DALI_TEST_EQUALS( fgColor, Property::Value(Color::GREEN), 0.001, TEST_LOCATION );
+
+  tet_infoline("Testing that the signal handler is called only once");
+  DALI_TEST_EQUALS( styleChangedSignalHandler.signalCount, 1, TEST_LOCATION );
+  tet_infoline("Revert the style");
+
+  styleChangedSignalHandler.signalCount = 0;
+  StyleManager::Get().ApplyDefaultTheme();
+
+  bgColor = testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR);
+  fgColor = testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR);
+
+  tet_infoline("Check that the property is reverted");
+  DALI_TEST_EQUALS( bgColor, defaultBgColor, 0.001, TEST_LOCATION );
+  DALI_TEST_EQUALS( fgColor, defaultFgColor, 0.001, TEST_LOCATION );
+  DALI_TEST_EQUALS( bgColor, Property::Value(Color::YELLOW), 0.001, TEST_LOCATION );
+  DALI_TEST_EQUALS( fgColor, Property::Value(Color::BLUE), 0.001, TEST_LOCATION );
+  tet_infoline("Testing that the signal handler is called only once");
+  DALI_TEST_EQUALS( styleChangedSignalHandler.signalCount, 1, TEST_LOCATION );
+
+  END_TEST;
+}
+
+
+int UtcDaliStyleManagerSetStyleConstantP(void)
+{
+  ToolkitTestApplication application;
+
+  tet_infoline( " UtcDaliStyleManagerSetStyleConstantP" );
+
+  StyleManager manager = StyleManager::Get();
+
+  std::string key( "key" );
+  Property::Value value( 100 );
+
+  manager.SetStyleConstant( key, value );
+
+  Property::Value returnedValue;
+  manager.GetStyleConstant( key, returnedValue );
+
+  DALI_TEST_CHECK( value.Get<int>() == returnedValue.Get<int>() );
+  END_TEST;
+}
+
+
+int UtcDaliStyleManagerGetStyleConstantP(void)
+{
+  ToolkitTestApplication application;
+
+  tet_infoline( " UtcDaliStyleManagerGetStyleConstantP" );
+
+  StyleManager manager = StyleManager::Get();
+
+  std::string key( "key" );
+  Property::Value value( 100 );
+
+  manager.SetStyleConstant( key, value );
+
+  Property::Value returnedValue;
+  manager.GetStyleConstant( key, returnedValue );
+
+  DALI_TEST_CHECK( value.Get<int>() == returnedValue.Get<int>() );
+  END_TEST;
+}
+
+int UtcDaliStyleManagerGetStyleConstantN(void)
+{
+  ToolkitTestApplication application;
+
+  tet_infoline( " UtcDaliStyleManagerGetStyleConstantN" );
+
+  StyleManager manager = StyleManager::Get();
+
+  std::string key2( "key2" );
+  Property::Value returnedValue2;
+  DALI_TEST_CHECK( !manager.GetStyleConstant( key2, returnedValue2 ) );
+
+  END_TEST;
+}
+
+int UtcDaliStyleManagerApplyStyle(void)
+{
+  ToolkitTestApplication application;
+
+  tet_infoline( "UtcDaliStyleManagerApplyStyle - test that a style can be applied to a single button" );
+
+  const char* json1 =
+    "{\n"
+    "  \"styles\":\n"
+    "  {\n"
+    "    \"testbutton\":\n"
+    "    {\n"
+    "      \"backgroundColor\":[1.0,1.0,0.0,1.0],\n"
+    "      \"foregroundColor\":[0.0,0.0,1.0,1.0]\n"
+    "    }\n"
+    "  }\n"
+    "}\n";
+
+  const char* json2 =
+    "{\n"
+    "  \"styles\":\n"
+    "  {\n"
+    "    \"testbutton\":\n"
+    "    {\n"
+    "      \"backgroundColor\":[1.0,0.0,0.0,1.0],\n"
+    "      \"foregroundColor\":[0.0,1.0,1.0,1.0]\n"
+    "    }\n"
+    "  }\n"
+    "}\n";
+
+  // Add 2 buttons
+  Test::TestButton testButton = Test::TestButton::New();
+  Test::TestButton testButton2 = Test::TestButton::New();
+  Stage::GetCurrent().Add( testButton );
+  Stage::GetCurrent().Add( testButton2 );
+  StyleChangedSignalChecker styleChangedSignalHandler;
+  StyleManager styleManager = StyleManager::Get();
+
+  styleManager.StyleChangedSignal().Connect(&styleChangedSignalHandler, &StyleChangedSignalChecker::OnStyleChanged);
+
+  tet_infoline("Apply the style");
+
+  std::string themeFile("ThemeOne");
+  Test::StyleMonitor::SetThemeFileOutput(themeFile, json1);
+  styleManager.ApplyTheme(themeFile);
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  Property::Value themedBgColor( testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR) );
+  Property::Value themedFgColor( testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR) );
+
+  // Apply the style to the test button:
+  std::string themeFile2("ThemeTwo");
+  Test::StyleMonitor::SetThemeFileOutput(themeFile2, json2);
+  styleManager.ApplyStyle( testButton, themeFile2, "testbutton" );
+
+  tet_infoline("Check that the properties change for the first button");
+  Property::Value bgColor = testButton.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR);
+  Property::Value fgColor = testButton.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR);
+  DALI_TEST_EQUALS( bgColor, Property::Value(Color::RED), 0.001, TEST_LOCATION );
+  DALI_TEST_EQUALS( fgColor, Property::Value(Color::CYAN), 0.001, TEST_LOCATION );
+
+  DALI_TEST_NOT_EQUALS( bgColor, themedBgColor, 0.001, TEST_LOCATION );
+  DALI_TEST_NOT_EQUALS( fgColor, themedFgColor, 0.001, TEST_LOCATION );
+
+  tet_infoline("Check that the properties remain the same for the second button");
+  bgColor = testButton2.GetProperty(Test::TestButton::Property::BACKGROUND_COLOR);
+  fgColor = testButton2.GetProperty(Test::TestButton::Property::FOREGROUND_COLOR);
+  DALI_TEST_EQUALS( bgColor, themedBgColor, 0.001, TEST_LOCATION );
+  DALI_TEST_EQUALS( fgColor, themedFgColor, 0.001, TEST_LOCATION );
+
+  END_TEST;
+}
+
+
+int UtcDaliStyleManagerStyleChangedSignal(void)
 {
   tet_infoline("Test that the StyleChange signal is fired when the font size is altered" );
 {
   tet_infoline("Test that the StyleChange signal is fired when the font size is altered" );
-  Test::StyleMonitor::SetThemeFileOutput(defaultTheme);
+  Test::StyleMonitor::SetThemeFileOutput( DALI_STYLE_DIR "dali-toolkit-default-theme.json",
+                                          defaultTheme );
 
   ToolkitTestApplication application;
 
 
   ToolkitTestApplication application;
 
index 5e10efe..7f81872 100644 (file)
@@ -272,6 +272,23 @@ inline void DALI_TEST_EQUALS(Type value1, Type value2, float epsilon, const char
   }
 }
 
   }
 }
 
+template<typename Type>
+inline void DALI_TEST_NOT_EQUALS(Type value1, Type value2, float epsilon, const char* location)
+{
+  if( CompareType<Type>(value1, value2, epsilon) )
+  {
+    std::ostringstream o;
+    o << value1 << " !=  " << value2 << std::endl;
+    fprintf(stderr, "%s, checking %s", location, o.str().c_str());
+    tet_result(TET_FAIL);
+  }
+  else
+  {
+    tet_result(TET_PASS);
+  }
+}
+
+
 /**
  * Test whether two TimePeriods are within a certain distance of each other.
  * @param[in] value1 The first value
 /**
  * Test whether two TimePeriods are within a certain distance of each other.
  * @param[in] value1 The first value
index c4dac4e..873c8d2 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "dummy-control.h"
 
 
 #include "dummy-control.h"
 
-#include <dali-toolkit/devel-api/styling/style-manager.h>
+#include <dali-toolkit/dali-toolkit.h>
 
 namespace Dali
 {
 
 namespace Dali
 {
index ba0469d..3d85457 100644 (file)
@@ -40,6 +40,19 @@ const char* DEFAULT_THEME=
   "  }\n"
   "}\n";
 
   "  }\n"
   "}\n";
 
+struct NamedTheme
+{
+  NamedTheme( const std::string& name, const std::string& theme )
+  : name(name), theme(theme)
+  {
+  }
+
+  std::string name;
+  std::string theme;
+};
+typedef std::vector< NamedTheme > NamedThemes;
+NamedThemes gThemes;
+
 std::string gTheme;
 std::string gFontFamily = Dali::StyleMonitor::DEFAULT_FONT_FAMILY;
 std::string gFontStyle  = Dali::StyleMonitor::DEFAULT_FONT_STYLE;
 std::string gTheme;
 std::string gFontFamily = Dali::StyleMonitor::DEFAULT_FONT_FAMILY;
 std::string gFontStyle  = Dali::StyleMonitor::DEFAULT_FONT_STYLE;
@@ -81,9 +94,8 @@ public: // Signals
 private:
   Dali::StyleMonitor::StyleChangeSignalType mStyleChangeSignal;
   static Dali::StyleMonitor mToolkitStyleMonitor;
 private:
   Dali::StyleMonitor::StyleChangeSignalType mStyleChangeSignal;
   static Dali::StyleMonitor mToolkitStyleMonitor;
-  std::string mTheme;
 
 
-  std::string mOutput; //<<< Test output. Use SetThemeFileOutput in a testharness to use it.
+  std::string mTheme;  ///<< Current theme name
 };
 
 Dali::StyleMonitor StyleMonitor::mToolkitStyleMonitor;
 };
 
 Dali::StyleMonitor StyleMonitor::mToolkitStyleMonitor;
@@ -135,6 +147,16 @@ void StyleMonitor::SetTheme(std::string path)
 
 bool StyleMonitor::LoadThemeFile( const std::string& filename, std::string& output )
 {
 
 bool StyleMonitor::LoadThemeFile( const std::string& filename, std::string& output )
 {
+  for( NamedThemes::iterator iter = gThemes.begin(); iter != gThemes.end(); ++iter )
+  {
+    NamedTheme& theme = *iter;
+    if( theme.name == filename )
+    {
+      output = theme.theme;
+      return true;
+    }
+  }
+
   if( !gTheme.empty() )
   {
     output = gTheme;
   if( !gTheme.empty() )
   {
     output = gTheme;
@@ -246,9 +268,19 @@ namespace Test
 namespace StyleMonitor
 {
 
 namespace StyleMonitor
 {
 
-void SetThemeFileOutput( const std::string& output )
+void SetThemeFileOutput( const std::string& name, const std::string& output )
 {
 {
-  gTheme = output;
+  for( NamedThemes::iterator iter = gThemes.begin(); iter != gThemes.end(); ++iter )
+  {
+    NamedTheme& theme = *iter;
+    if( theme.name == name )
+    {
+      theme.theme = output;
+      return;
+    }
+  }
+
+  gThemes.push_back( NamedTheme( name, output ) );
 }
 
 void SetDefaultFontFamily(const std::string& family)
 }
 
 void SetDefaultFontFamily(const std::string& family)
index 9bdb67c..b69a7db 100644 (file)
@@ -79,7 +79,7 @@ namespace Test
 {
 namespace StyleMonitor
 {
 {
 namespace StyleMonitor
 {
-void SetThemeFileOutput( const std::string& output );
+void SetThemeFileOutput( const std::string& name, const std::string& output );
 void SetDefaultFontFamily(const std::string& family);
 void SetDefaultFontStyle(const std::string& style);
 void SetDefaultFontSize( float size );
 void SetDefaultFontFamily(const std::string& family);
 void SetDefaultFontStyle(const std::string& style);
 void SetDefaultFontSize( float size );
index 7eb5f48..264a125 100644 (file)
@@ -34,7 +34,6 @@
 #include <dali/integration-api/events/touch-event-integ.h>
 #include <dali/integration-api/events/hover-event-integ.h>
 
 #include <dali/integration-api/events/touch-event-integ.h>
 #include <dali/integration-api/events/hover-event-integ.h>
 
-#include <dali-toolkit/devel-api/styling/style-manager.h>
 
 #include "dummy-control.h"
 
 
 #include "dummy-control.h"
 
@@ -934,7 +933,3 @@ int UtcDaliControlImplGetNextKeyboardFocusableActorP(void)
 
   END_TEST;
 }
 
   END_TEST;
 }
-
-
-
-
index 4bb5f56..809b07b 100644 (file)
@@ -23,7 +23,6 @@
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-editor.h> ///< @todo to be removed when text-editor is added to the dali-toolkit.h
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali-toolkit/devel-api/controls/text-controls/text-editor.h> ///< @todo to be removed when text-editor is added to the dali-toolkit.h
-#include <dali-toolkit/devel-api/styling/style-manager.h>
 
 using namespace Dali;
 using namespace Toolkit;
 
 using namespace Dali;
 using namespace Toolkit;
@@ -372,7 +371,7 @@ int utcDaliTextEditorAtlasRenderP(void)
   ToolkitTestApplication application;
   tet_infoline(" UtcDaliToolkitTextEditorAtlasRenderP");
   StyleManager styleManager = StyleManager::Get();
   ToolkitTestApplication application;
   tet_infoline(" UtcDaliToolkitTextEditorAtlasRenderP");
   StyleManager styleManager = StyleManager::Get();
-  styleManager.RequestDefaultTheme();
+  styleManager.ApplyDefaultTheme();
   TextEditor editor = TextEditor::New();
   DALI_TEST_CHECK( editor );
 
   TextEditor editor = TextEditor::New();
   DALI_TEST_CHECK( editor );
 
index 982dffe..2498c57 100644 (file)
@@ -22,7 +22,6 @@
 #include <dali/integration-api/events/tap-gesture-event.h>
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
 #include <dali/integration-api/events/tap-gesture-event.h>
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/styling/style-manager.h>
 
 using namespace Dali;
 using namespace Toolkit;
 
 using namespace Dali;
 using namespace Toolkit;
@@ -425,7 +424,7 @@ int utcDaliTextFieldAtlasRenderP(void)
   ToolkitTestApplication application;
   tet_infoline(" UtcDaliToolkitTextFieldAtlasRenderP");
   StyleManager styleManager = StyleManager::Get();
   ToolkitTestApplication application;
   tet_infoline(" UtcDaliToolkitTextFieldAtlasRenderP");
   StyleManager styleManager = StyleManager::Get();
-  styleManager.RequestDefaultTheme();
+  styleManager.ApplyDefaultTheme();
   TextField field = TextField::New();
   DALI_TEST_CHECK( field );
 
   TextField field = TextField::New();
   DALI_TEST_CHECK( field );
 
index a861a17..67156bb 100644 (file)
@@ -168,6 +168,7 @@ AC_CONFIG_FILES([
  dali-toolkit.pc
  docs/Makefile
  docs/dali.doxy
  dali-toolkit.pc
  docs/Makefile
  docs/dali.doxy
+ ../../automated-tests/CMakeLists.txt
 ])
 
 AC_OUTPUT
 ])
 
 AC_OUTPUT
index f803a93..f967eb5 100644 (file)
@@ -110,7 +110,6 @@ develapiimageatlasdir =         $(develapidir)/image-atlas
 develapiscriptingdir =          $(develapidir)/scripting
 develapishadereffectsdir =      $(develapidir)/shader-effects
 develapitransitioneffectsdir =  $(develapidir)/transition-effects
 develapiscriptingdir =          $(develapidir)/scripting
 develapishadereffectsdir =      $(develapidir)/shader-effects
 develapitransitioneffectsdir =  $(develapidir)/transition-effects
-develapistylingdir =            $(develapidir)/styling
 develapitoolbardir =            $(develapicontrolsdir)/tool-bar
 develapitextselectionpopupdir = $(develapicontrolsdir)/text-controls
 
 develapitoolbardir =            $(develapicontrolsdir)/tool-bar
 develapitextselectionpopupdir = $(develapicontrolsdir)/text-controls
 
@@ -130,7 +129,6 @@ develapiscripting_HEADERS =         $(devel_api_scripting_header_files)
 develapishadowview_HEADERS =        $(devel_api_shadow_view_header_files)
 develapishadereffects_HEADERS =     $(devel_api_shader_effects_header_files)
 develapislider_HEADERS =            $(devel_api_slider_header_files)
 develapishadowview_HEADERS =        $(devel_api_shadow_view_header_files)
 develapishadereffects_HEADERS =     $(devel_api_shader_effects_header_files)
 develapislider_HEADERS =            $(devel_api_slider_header_files)
-develapistyling_HEADERS =           $(devel_api_styling_header_files)
 develapisuperblurview_HEADERS =     $(devel_api_super_blur_view_header_files)
 develapitoolbar_HEADERS =           $(devel_api_tool_bar_header_files)
 develapitransitioneffects_HEADERS = $(devel_api_transition_effects_header_files)
 develapisuperblurview_HEADERS =     $(devel_api_super_blur_view_header_files)
 develapitoolbar_HEADERS =           $(devel_api_tool_bar_header_files)
 develapitransitioneffects_HEADERS = $(devel_api_transition_effects_header_files)
@@ -151,6 +149,7 @@ publicapiscrollbardir =            $(publicapicontrolsdir)/scroll-bar
 publicapiscrollabledir =           $(publicapicontrolsdir)/scrollable
 publicapiscrollviewdir =           $(publicapicontrolsdir)/scrollable/scroll-view
 publicapiitemviewdir =             $(publicapicontrolsdir)/scrollable/item-view
 publicapiscrollabledir =           $(publicapicontrolsdir)/scrollable
 publicapiscrollviewdir =           $(publicapicontrolsdir)/scrollable/scroll-view
 publicapiitemviewdir =             $(publicapicontrolsdir)/scrollable/item-view
+publicapistylingdir =              $(publicapidir)/styling
 publicapitableviewdir =            $(publicapicontrolsdir)/table-view
 publicapitextcontrolsdir =         $(publicapicontrolsdir)/text-controls
 publicapifocusmanagerdir =         $(publicapidir)/focus-manager
 publicapitableviewdir =            $(publicapicontrolsdir)/table-view
 publicapitextcontrolsdir =         $(publicapicontrolsdir)/text-controls
 publicapifocusmanagerdir =         $(publicapidir)/focus-manager
@@ -171,6 +170,7 @@ publicapipageturnview_HEADERS =         $(public_api_page_turn_view_header_files
 publicapiscrollbar_HEADERS =            $(public_api_scroll_bar_header_files)
 publicapiscrollable_HEADERS =           $(public_api_scrollable_header_files)
 publicapiscrollview_HEADERS =           $(public_api_scroll_view_header_files)
 publicapiscrollbar_HEADERS =            $(public_api_scroll_bar_header_files)
 publicapiscrollable_HEADERS =           $(public_api_scrollable_header_files)
 publicapiscrollview_HEADERS =           $(public_api_scroll_view_header_files)
+publicapistyling_HEADERS =              $(public_api_styling_header_files)
 publicapitableview_HEADERS =            $(public_api_table_view_header_files)
 publicapitextcontrols_HEADERS =         $(public_api_text_controls_header_files)
 publicapifocusmanager_HEADERS =         $(public_api_focus_manager_header_files)
 publicapitableview_HEADERS =            $(public_api_table_view_header_files)
 publicapitextcontrols_HEADERS =         $(public_api_text_controls_header_files)
 publicapifocusmanager_HEADERS =         $(public_api_focus_manager_header_files)
index 19a1993..36484f1 100644 (file)
@@ -51,6 +51,7 @@
 #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
 #include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
 #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
 #include <dali-toolkit/public-api/controls/text-controls/text-label.h>
 #include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
 #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
+#include <dali-toolkit/public-api/styling/style-manager.h>
 #include <dali-toolkit/public-api/text/rendering-backend.h>
 #include <dali-toolkit/public-api/dali-toolkit-version.h>
 #include <dali-toolkit/public-api/enums.h>
 #include <dali-toolkit/public-api/text/rendering-backend.h>
 #include <dali-toolkit/public-api/dali-toolkit-version.h>
 #include <dali-toolkit/public-api/enums.h>
index 8987002..f28fa71 100755 (executable)
@@ -22,7 +22,6 @@ devel_api_src_files = \
   $(devel_api_src_dir)/controls/tool-bar/tool-bar.cpp \
   $(devel_api_src_dir)/focus-manager/keyinput-focus-manager.cpp \
   $(devel_api_src_dir)/image-atlas/image-atlas.cpp \
   $(devel_api_src_dir)/controls/tool-bar/tool-bar.cpp \
   $(devel_api_src_dir)/focus-manager/keyinput-focus-manager.cpp \
   $(devel_api_src_dir)/image-atlas/image-atlas.cpp \
-  $(devel_api_src_dir)/styling/style-manager.cpp \
   $(devel_api_src_dir)/scripting/script.cpp \
   $(devel_api_src_dir)/transition-effects/cube-transition-cross-effect.cpp \
   $(devel_api_src_dir)/transition-effects/cube-transition-effect.cpp \
   $(devel_api_src_dir)/scripting/script.cpp \
   $(devel_api_src_dir)/transition-effects/cube-transition-cross-effect.cpp \
   $(devel_api_src_dir)/transition-effects/cube-transition-effect.cpp \
@@ -74,9 +73,6 @@ devel_api_focus_manager_header_files = \
 devel_api_image_atlas_header_files = \
   $(devel_api_src_dir)/image-atlas/image-atlas.h
 
 devel_api_image_atlas_header_files = \
   $(devel_api_src_dir)/image-atlas/image-atlas.h
 
-devel_api_styling_header_files = \
-  $(devel_api_src_dir)/styling/style-manager.h
-
 devel_api_scripting_header_files = \
   $(devel_api_src_dir)/scripting/script.h \
   $(devel_api_src_dir)/scripting/script-plugin.h
 devel_api_scripting_header_files = \
   $(devel_api_src_dir)/scripting/script.h \
   $(devel_api_src_dir)/scripting/script-plugin.h
@@ -123,4 +119,3 @@ devel_api_transition_effects_header_files = \
   $(devel_api_src_dir)/transition-effects/cube-transition-cross-effect.h \
   $(devel_api_src_dir)/transition-effects/cube-transition-fold-effect.h \
   $(devel_api_src_dir)/transition-effects/cube-transition-wave-effect.h
   $(devel_api_src_dir)/transition-effects/cube-transition-cross-effect.h \
   $(devel_api_src_dir)/transition-effects/cube-transition-fold-effect.h \
   $(devel_api_src_dir)/transition-effects/cube-transition-wave-effect.h
-
index 8301a08..660e823 100644 (file)
@@ -807,7 +807,7 @@ void TextEditor::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange:
     case StyleChange::DEFAULT_FONT_CHANGE:
     {
       DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor::OnStyleChange DEFAULT_FONT_CHANGE\n");
     case StyleChange::DEFAULT_FONT_CHANGE:
     {
       DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor::OnStyleChange DEFAULT_FONT_CHANGE\n");
-      std::string newFont = styleManager.GetDefaultFontFamily();
+      const std::string& newFont = GetImpl( styleManager ).GetDefaultFontFamily();
       // Property system did not set the font so should update it.
       mController->UpdateAfterFontChange( newFont );
       break;
       // Property system did not set the font so should update it.
       mController->UpdateAfterFontChange( newFont );
       break;
index ef00fc3..efec327 100644 (file)
@@ -1029,7 +1029,7 @@ void TextField::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::
     case StyleChange::DEFAULT_FONT_CHANGE:
     {
       DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnStyleChange DEFAULT_FONT_CHANGE\n");
     case StyleChange::DEFAULT_FONT_CHANGE:
     {
       DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnStyleChange DEFAULT_FONT_CHANGE\n");
-      std::string newFont = styleManager.GetDefaultFontFamily();
+      const std::string& newFont = GetImpl( styleManager ).GetDefaultFontFamily();
       // Property system did not set the font so should update it.
       mController->UpdateAfterFontChange( newFont );
       break;
       // Property system did not set the font so should update it.
       mController->UpdateAfterFontChange( newFont );
       break;
index cc633b1..e7bac78 100644 (file)
@@ -493,7 +493,7 @@ void TextLabel::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::
     case StyleChange::DEFAULT_FONT_CHANGE:
     {
       // Property system did not set the font so should update it.
     case StyleChange::DEFAULT_FONT_CHANGE:
     {
       // Property system did not set the font so should update it.
-      std::string newFont = styleManager.GetDefaultFontFamily();
+      const std::string& newFont = GetImpl( styleManager ).GetDefaultFontFamily();
       DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::OnStyleChange StyleChange::DEFAULT_FONT_CHANGE newFont(%s)\n", newFont.c_str() );
       mController->UpdateAfterFontChange( newFont );
       break;
       DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::OnStyleChange StyleChange::DEFAULT_FONT_CHANGE newFont(%s)\n", newFont.c_str() );
       mController->UpdateAfterFontChange( newFont );
       break;
index f9569b9..a550a11 100644 (file)
@@ -26,7 +26,7 @@
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/controls/control.h>
 #include <dali-toolkit/public-api/controls/control-impl.h>
-#include <dali-toolkit/devel-api/styling/style-manager.h>
+#include <dali-toolkit/public-api/styling/style-manager.h>
 #include <dali-toolkit/internal/feedback/feedback-style.h>
 
 namespace
 #include <dali-toolkit/internal/feedback/feedback-style.h>
 
 namespace
@@ -98,8 +98,7 @@ Toolkit::StyleManager StyleManager::Get()
 }
 
 StyleManager::StyleManager()
 }
 
 StyleManager::StyleManager()
-: mOrientationDegrees( 0 ),  // Portrait
-  mDefaultFontSize( -1 ),
+: mDefaultFontSize( -1 ),
   mDefaultFontFamily(""),
   mFeedbackStyle( NULL )
 {
   mDefaultFontFamily(""),
   mFeedbackStyle( NULL )
 {
@@ -123,43 +122,18 @@ StyleManager::~StyleManager()
   delete mFeedbackStyle;
 }
 
   delete mFeedbackStyle;
 }
 
-void StyleManager::SetOrientationValue( int orientation )
+void StyleManager::ApplyTheme( const std::string& themeFile )
 {
 {
-  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( mThemeFile );
-  }
-}
-
-int StyleManager::GetOrientationValue()
-{
-  return mOrientationDegrees;
-}
-
-void StyleManager::SetOrientation( Orientation orientation )
-{
-  if( mOrientation )
-  {
-    mOrientation.ChangedSignal().Disconnect( this, &StyleManager::OnOrientationChanged );
-  }
-
-  OnOrientationChanged( orientation );
-
-  if( mOrientation )
-  {
-    mOrientation.ChangedSignal().Connect( this, &StyleManager::OnOrientationChanged );
-  }
+  SetTheme( themeFile );
 }
 
 }
 
-Orientation StyleManager::GetOrientation()
+void StyleManager::ApplyDefaultTheme()
 {
 {
-  return mOrientation;
+  std::string empty;
+  SetTheme( empty );
 }
 
 }
 
-std::string StyleManager::GetDefaultFontFamily() const
+const std::string& StyleManager::GetDefaultFontFamily() const
 {
   return mDefaultFontFamily;
 }
 {
   return mDefaultFontFamily;
 }
@@ -181,22 +155,11 @@ bool StyleManager::GetStyleConstant( const std::string& key, Property::Value& va
   return false;
 }
 
   return false;
 }
 
-void StyleManager::RequestThemeChange( const std::string& themeFile )
-{
-  SetTheme( themeFile );
-}
-
-void StyleManager::RequestDefaultTheme()
-{
-  std::string empty;
-  SetTheme( empty );
-}
-
 void StyleManager::ApplyThemeStyle( Toolkit::Control control )
 {
   if( !mThemeBuilder )
   {
 void StyleManager::ApplyThemeStyle( Toolkit::Control control )
 {
   if( !mThemeBuilder )
   {
-    RequestDefaultTheme();
+    ApplyDefaultTheme();
   }
 
   if( mThemeBuilder )
   }
 
   if( mThemeBuilder )
@@ -328,13 +291,7 @@ bool StyleManager::LoadJSON( Toolkit::Builder builder, const std::string& jsonFi
 void StyleManager::CollectQualifiers( StringList& qualifiersOut )
 {
   // Append the relevant qualifier for orientation
 void StyleManager::CollectQualifiers( StringList& qualifiersOut )
 {
   // Append the relevant qualifier for orientation
-  int orientation = mOrientationDegrees;
-
-  if( mOrientation )
-  {
-    orientation = mOrientation.GetDegrees();
-  }
-
+  int orientation = 0; // Get the orientation from the system
   switch( orientation )
   {
     case 90:
   switch( orientation )
   {
     case 90:
@@ -405,15 +362,6 @@ void StyleManager::ApplyStyle( Toolkit::Builder builder, Toolkit::Control contro
   }
 }
 
   }
 }
 
-void StyleManager::OnOrientationChanged( Orientation orientation )
-{
-  mOrientation = 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( mThemeFile );
-}
-
-
 Toolkit::Builder StyleManager::FindCachedBuilder( const std::string& key )
 {
   BuilderMap::iterator builderIt = mBuilderCache.find( key );
 Toolkit::Builder StyleManager::FindCachedBuilder( const std::string& key )
 {
   BuilderMap::iterator builderIt = mBuilderCache.find( key );
index 283cf96..f0c217c 100644 (file)
@@ -27,7 +27,7 @@
 #include <dali/public-api/signals/connection-tracker.h>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/signals/connection-tracker.h>
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/styling/style-manager.h>
+#include <dali-toolkit/public-api/styling/style-manager.h>
 #include <dali-toolkit/devel-api/builder/builder.h>
 
 namespace Dali
 #include <dali-toolkit/devel-api/builder/builder.h>
 
 namespace Dali
@@ -67,30 +67,20 @@ protected:
 
 public: // Public API
 
 
 public: // Public API
 
-  /**
-   * @copydoc Toolkit::StyleManager::SetOrientationValue
-   */
-  void SetOrientationValue( int orientation );
-
-  /**
-   * @copydoc Toolkit::StyleManager::GetOrientationValue
-   */
-  int GetOrientationValue();
-
-  /**
-   * @copydoc Toolkit::StyleManager::SetOrientation( Orientation orientation )
+/**
+   * @copydoc Toolkit::StyleManager::ApplyTheme
    */
    */
-  void SetOrientation( Orientation orientation );
+  void ApplyTheme( const std::string& themeFile );
 
   /**
 
   /**
-   * @copydoc Toolkit::StyleManager::GetOrientation
+   * @copydoc Toolkit::StyleManager::ApplyDefaultTheme
    */
    */
-  Orientation GetOrientation();
+  void ApplyDefaultTheme();
 
   /**
    * @copydoc Toolkit::StyleManager::GetDefaultFontFamily
    */
 
   /**
    * @copydoc Toolkit::StyleManager::GetDefaultFontFamily
    */
-  std::string GetDefaultFontFamily() const;
+  const std::string& GetDefaultFontFamily() const;
 
   /**
    * @copydoc Toolkit::StyleManager::SetStyleConstant
 
   /**
    * @copydoc Toolkit::StyleManager::SetStyleConstant
@@ -103,16 +93,6 @@ public: // Public API
   bool GetStyleConstant( const std::string& key, Property::Value& valueOut );
 
   /**
   bool GetStyleConstant( const std::string& key, Property::Value& valueOut );
 
   /**
-   * @copydoc Toolkit::StyleManager::RequestThemeChange
-   */
-  void RequestThemeChange( const std::string& themeFile );
-
-  /**
-   * @copydoc Toolkit::StyleManager::RequestDefaultTheme
-   */
-  void RequestDefaultTheme();
-
-  /**
    * @brief Apply the theme style to a control.
    *
    * @param[in] control The control to apply style.
    * @brief Apply the theme style to a control.
    *
    * @param[in] control The control to apply style.
@@ -210,13 +190,6 @@ private:
   void ApplyStyle( Toolkit::Builder builder, Toolkit::Control control );
 
   /**
   void ApplyStyle( Toolkit::Builder builder, Toolkit::Control control );
 
   /**
-   * @brief Callback for orientation changes
-   *
-   * @param[in] orientation The orientation object
-   */
-  void OnOrientationChanged( Orientation orientation );
-
-  /**
    * Search for a builder in the cache
    *
    * @param[in] key The key the builder was cached under
    * Search for a builder in the cache
    *
    * @param[in] key The key the builder was cached under
@@ -259,9 +232,6 @@ private:
   Toolkit::Builder mThemeBuilder;     ///< Builder for all default theme properties
   StyleMonitor mStyleMonitor;         ///< Style monitor handle
 
   Toolkit::Builder mThemeBuilder;     ///< Builder for all default theme properties
   StyleMonitor mStyleMonitor;         ///< Style monitor handle
 
-  Orientation mOrientation;           ///< Handle to application orientation object
-  int mOrientationDegrees;            ///< Directly set value of orientation
-
   int mDefaultFontSize;               ///< Logical size, not a point-size
   std::string mDefaultFontFamily;
   std::string mThemeFile;             ///< The full path of the current theme file
   int mDefaultFontSize;               ///< Logical size, not a point-size
   std::string mDefaultFontFamily;
   std::string mThemeFile;             ///< The full path of the current theme file
index 2019553..45fbe44 100644 (file)
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
 #include <dali-toolkit/public-api/controls/control.h>
 // INTERNAL INCLUDES
 #include <dali-toolkit/public-api/focus-manager/keyboard-focus-manager.h>
 #include <dali-toolkit/public-api/controls/control.h>
+#include <dali-toolkit/public-api/styling/style-manager.h>
 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
 #include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
 #include <dali-toolkit/devel-api/controls/renderer-factory/renderer-factory.h>
 #include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
-#include <dali-toolkit/devel-api/styling/style-manager.h>
 #include <dali-toolkit/internal/styling/style-manager-impl.h>
 #include <dali-toolkit/internal/controls/renderers/color/color-renderer.h>
 
 #include <dali-toolkit/internal/styling/style-manager-impl.h>
 #include <dali-toolkit/internal/controls/renderers/color/color-renderer.h>
 
index 73d06a4..16d923f 100755 (executable)
@@ -27,6 +27,7 @@ public_api_src_files = \
   $(public_api_src_dir)/controls/text-controls/text-label.cpp \
   $(public_api_src_dir)/controls/text-controls/text-field.cpp \
   $(public_api_src_dir)/controls/gaussian-blur-view/gaussian-blur-view.cpp \
   $(public_api_src_dir)/controls/text-controls/text-label.cpp \
   $(public_api_src_dir)/controls/text-controls/text-field.cpp \
   $(public_api_src_dir)/controls/gaussian-blur-view/gaussian-blur-view.cpp \
+  $(public_api_src_dir)/styling/style-manager.cpp \
   $(public_api_src_dir)/accessibility-manager/accessibility-manager.cpp \
   $(public_api_src_dir)/focus-manager/keyboard-focus-manager.cpp \
   $(public_api_src_dir)/dali-toolkit-version.cpp \
   $(public_api_src_dir)/accessibility-manager/accessibility-manager.cpp \
   $(public_api_src_dir)/focus-manager/keyboard-focus-manager.cpp \
   $(public_api_src_dir)/dali-toolkit-version.cpp \
@@ -88,6 +89,9 @@ public_api_scroll_view_header_files = \
   $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-page-path-effect.h \
   $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view.h
 
   $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view-page-path-effect.h \
   $(public_api_src_dir)/controls/scrollable/scroll-view/scroll-view.h
 
+public_api_styling_header_files = \
+  $(public_api_src_dir)/styling/style-manager.h
+
 public_api_table_view_header_files = \
   $(public_api_src_dir)/controls/table-view/table-view.h
 
 public_api_table_view_header_files = \
   $(public_api_src_dir)/controls/table-view/table-view.h
 
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,7 +16,7 @@
 
 // CLASS HEADER
 
 
 // CLASS HEADER
 
-#include <dali-toolkit/devel-api/styling/style-manager.h>
+#include <dali-toolkit/public-api/styling/style-manager.h>
 
 // EXTERNAL INCLUDES
 
 
 // EXTERNAL INCLUDES
 
@@ -43,29 +43,14 @@ StyleManager StyleManager::Get()
   return Internal::StyleManager::Get();
 }
 
   return Internal::StyleManager::Get();
 }
 
-void StyleManager::SetOrientationValue( int orientation )
+void StyleManager::ApplyTheme( const std::string& themeFile )
 {
 {
-  GetImpl(*this).SetOrientationValue( orientation );
+  GetImpl(*this).ApplyTheme( themeFile );
 }
 
 }
 
-int StyleManager::GetOrientationValue()
+void StyleManager::ApplyDefaultTheme()
 {
 {
-  return GetImpl(*this).GetOrientationValue();
-}
-
-void StyleManager::SetOrientation( Orientation orientation )
-{
-  GetImpl(*this).SetOrientation( orientation );
-}
-
-std::string StyleManager::GetDefaultFontFamily() const
-{
-  return GetImpl(*this).GetDefaultFontFamily();
-}
-
-Orientation StyleManager::GetOrientation()
-{
-  return GetImpl(*this).GetOrientation();
+  GetImpl(*this).ApplyDefaultTheme();
 }
 
 void StyleManager::SetStyleConstant( const std::string& key, const Property::Value& value )
 }
 
 void StyleManager::SetStyleConstant( const std::string& key, const Property::Value& value )
@@ -83,24 +68,14 @@ void StyleManager::ApplyStyle( Toolkit::Control control, const std::string& json
   GetImpl(*this).ApplyStyle( control, jsonFileName, styleName );
 }
 
   GetImpl(*this).ApplyStyle( control, jsonFileName, styleName );
 }
 
-StyleManager::StyleManager( Internal::StyleManager *impl )
-  : BaseHandle( impl )
-{
-}
-
 StyleManager::StyleChangedSignalType& StyleManager::StyleChangedSignal()
 {
   return GetImpl( *this ).StyleChangedSignal();
 }
 
 StyleManager::StyleChangedSignalType& StyleManager::StyleChangedSignal()
 {
   return GetImpl( *this ).StyleChangedSignal();
 }
 
-void StyleManager::RequestThemeChange( const std::string& themeFile )
-{
-  GetImpl(*this).RequestThemeChange( themeFile );
-}
-
-void StyleManager::RequestDefaultTheme()
+StyleManager::StyleManager( Internal::StyleManager *impl )
+  : BaseHandle( impl )
 {
 {
-  GetImpl(*this).RequestDefaultTheme();
 }
 
 } // namespace Toolkit
 }
 
 } // namespace Toolkit
@@ -2,7 +2,7 @@
 #define __DALI_TOOLKIT_STYLE_MANAGER_H__
 
 /*
 #define __DALI_TOOLKIT_STYLE_MANAGER_H__
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@
  */
 
 // EXTERNAL INCLUDES
  */
 
 // EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/orientation.h>
 #include <dali/public-api/adaptor-framework/style-change.h>
 
 // INTERNAL INCLUDES
 #include <dali/public-api/adaptor-framework/style-change.h>
 
 // INTERNAL INCLUDES
@@ -36,28 +35,43 @@ class StyleManager;
 }
 
 /**
 }
 
 /**
- * @brief StyleManager provides the following functionalities:
+ * @addtogroup dali_toolkit_managers
+ * @{
+ */
+
+/**
+ * @brief StyleManager informs applications of system theme change,
+ * and supports application theme change at runtime.
  *
  * Applies various styles to Controls using the properties system.
  *
  * Applies various styles to Controls using the properties system.
- * On theme change a signal is raised that controls can be configured to listen to.
  *
  *
- * The default theme is automatically loaded and applied.
+ * On theme change, it automatically updates all controls, then raises
+ * a signal to inform the application.
+ *
+ * The default theme is automatically loaded and applied, followed by
+ * any application specific theme defined in Application::New().
  *
  * If the application wants to customize the theme, RequestThemeChange
  *
  * If the application wants to customize the theme, RequestThemeChange
- * needs to be called.  Internal::Control can be configured to
- * register for the signals that are required from StyleManager, such
- * as theme change.
+ * needs to be called.
+ *
+ * Signals
+ * | %Signal Name            | Method                           |
+ * |------------------------------------------------------------|
+ * | styleChanged            | @ref StyleChangedSignal()        |
+ * @SINCE_1_1.32
  */
 class DALI_IMPORT_API StyleManager : public BaseHandle
 {
 public:
 
  */
 class DALI_IMPORT_API StyleManager : public BaseHandle
 {
 public:
 
-  // Signals
+  /// @brief Style Changed signal. Emitted after controls have been updated
   typedef Signal< void ( StyleManager, StyleChange::Type ) >  StyleChangedSignalType;
 
   /**
    * @brief Create a StyleManager handle; this can be initialised with StyleManager::Get()
   typedef Signal< void ( StyleManager, StyleChange::Type ) >  StyleChangedSignalType;
 
   /**
    * @brief Create a StyleManager handle; this can be initialised with StyleManager::Get()
+   *
    * Calling member functions with an uninitialised handle is not allowed.
    * Calling member functions with an uninitialised handle is not allowed.
+   * @SINCE_1_1.32
    */
   StyleManager();
 
    */
   StyleManager();
 
@@ -65,71 +79,54 @@ public:
    * @brief Destructor
    *
    * This is non-virtual since derived Handle types must not contain data or virtual methods.
    * @brief Destructor
    *
    * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   * @SINCE_1_1.32
    */
   ~StyleManager();
 
   /**
    * @brief Get the singleton of StyleManager object.
    *
    */
   ~StyleManager();
 
   /**
    * @brief Get the singleton of StyleManager object.
    *
+   * @SINCE_1_1.32
    * @return A handle to the StyleManager control.
    */
   static StyleManager Get();
 
   /**
    * @return A handle to the StyleManager control.
    */
   static StyleManager Get();
 
   /**
-   * @brief Specify the orientation value directly for the style manager
+   * @brief Apply a new theme to the application. This will be merged
+   * on top of the default Toolkit theme.
    *
    *
-   * @param[in] orientation The orientation in degrees
-   */
-  void SetOrientationValue( int orientation );
-
-  /**
-   * @brief Return the orientation value
+   * If the application theme file doesn't style all controls that the
+   * application uses, then the default Toolkit theme will be used
+   * instead for those controls.
    *
    *
-   * @return The orientation value
-   */
-  int GetOrientationValue();
-
-  /**
-   * @brief Set the orientation object. This will take precedence over setting the orientation value.
+   * On application startup, it is suggested that the theme file name is
+   * passed to Application::New instead of using this API to prevent
+   * controls being styled more than once.
+   * @sa Application::New()
    *
    *
-   * @param[in] orientation Device orientation
+   * @SINCE_1_1.32
+   * @param[in] themeFile If a relative path is specified, then this is relative
+   * to the directory returned by app_get_resource_path().
    */
    */
-  void SetOrientation( Orientation orientation );
+  void ApplyTheme( const std::string& themeFile );
 
   /**
 
   /**
-   * @brief Return the orientation object
+   * @brief Apply the default Toolkit theme.
    *
    *
-   * @return The orientation.
-   */
-  Orientation GetOrientation();
-
-  /**
-   * @brief Retrieves the default font family.
-   * @return The default font family.
-   */
-  std::string GetDefaultFontFamily() const;
-
-  /**
-   * @brief Make a request to set the theme JSON file to one that exists in the Toolkit package.
-   *
-   * Multiple requests per event processing cycle can be made, but only the final one will be acted
-   * on in the event processing finished callback.
+   * Request that any application specific styling is removed
+   * and that the default Toolkit theme is re-applied.
    *
    *
-   * @param[in] themeFile This is just the JSON theme file name and not the full path.
+   * @SINCE_1_1.32
    */
    */
-  void RequestThemeChange( const std::string& themeFile );
-
-  /**
-   * @brief Request a change to the default theme
-   */
-  void RequestDefaultTheme();
+  void ApplyDefaultTheme();
 
   /**
    * @brief Set a constant for use when building styles
    *
 
   /**
    * @brief Set a constant for use when building styles
    *
-   * A constant is used in JSON files e.g. "myImage":"{ROOT_PATH}/mypath/image.jpg"
-   * where the string "{ROOT_PATH}" is substituted with the value.
+   * A constant is used in JSON files e.g. "myImage":"{RELATIVE_PATH}/image.jpg"
+   * where the string "{RELATIVE_PATH}" is substituted with the value.
    *
    *
+   * @SINCE_1_1.32
    * @param[in] key The key of the constant
    * @param[in] value The value of the constant
    */
    * @param[in] key The key of the constant
    * @param[in] value The value of the constant
    */
@@ -138,6 +135,7 @@ public:
   /**
    * @brief Return the style constant set for a specific key
    *
   /**
    * @brief Return the style constant set for a specific key
    *
+   * @SINCE_1_1.32
    * @param[in] key The key of the constant
    * @param[out] valueOut The value of the constant if it exists
    *
    * @param[in] key The key of the constant
    * @param[out] valueOut The value of the constant if it exists
    *
@@ -148,11 +146,11 @@ public:
   /**
    * @brief Apply the specified style to the control.
    *
   /**
    * @brief Apply the specified style to the control.
    *
-   * The JSON file will be cached and subsequent calls using the same JSON file name will
-   * use the already loaded cached values instead.
-   *
-   * @param[in] control The control to apply style.
-   * @param[in] jsonFileName The name of the JSON style file to apply.
+   * @SINCE_1_1.32
+   * @param[in] control The control to which to apply the style.
+   * @param[in] jsonFileName The name of the JSON style file to apply. If a
+   * relative path is specified, then this is relative to the directory
+   * returned by app_get_resource_path().
    * @param[in] styleName The name of the style within the JSON file to apply.
    */
   void ApplyStyle( Toolkit::Control control, const std::string& jsonFileName, const std::string& styleName );
    * @param[in] styleName The name of the style within the JSON file to apply.
    */
   void ApplyStyle( Toolkit::Control control, const std::string& jsonFileName, const std::string& styleName );
@@ -163,6 +161,7 @@ public: // Signals
    * @brief This signal is emitted after the style (e.g. theme/font change) has changed
    * and the controls have been informed.
    *
    * @brief This signal is emitted after the style (e.g. theme/font change) has changed
    * and the controls have been informed.
    *
+   * @SINCE_1_1.32
    * A callback of the following type may be connected:
    * @code
    *   void YourCallbackName( StyleManager styleManager, StyleChange change );
    * A callback of the following type may be connected:
    * @code
    *   void YourCallbackName( StyleManager styleManager, StyleChange change );
@@ -174,14 +173,19 @@ public: // Signals
 public:
 
   /**
 public:
 
   /**
-   * @brief Creates a new handle from the implementation.
+   * @brief Allows the creation of a StyleManager handle from an internal pointer.
    *
    *
+   * @note Not intended for application developers
+   * @SINCE_1_1.32
    * @param[in] impl A pointer to the object.
    */
   explicit DALI_INTERNAL StyleManager( Internal::StyleManager *impl );
 
 }; // class StyleManager
 
    * @param[in] impl A pointer to the object.
    */
   explicit DALI_INTERNAL StyleManager( Internal::StyleManager *impl );
 
 }; // class StyleManager
 
+/**
+ * @}
+ */
 } // namespace Toolkit
 
 } // namespace Dali
 } // namespace Toolkit
 
 } // namespace Dali