Re-order StyleManager implementation file to match header 86/56786/2
authorDavid Steele <david.steele@samsung.com>
Tue, 12 Jan 2016 14:42:38 +0000 (14:42 +0000)
committerDavid Steele <david.steele@samsung.com>
Wed, 20 Jan 2016 19:15:00 +0000 (19:15 +0000)
Change-Id: I4c55d156a1019e13b862617bda30a99bd0a093fb

dali-toolkit/internal/styling/style-manager-impl.cpp
dali-toolkit/internal/styling/style-manager-impl.h

index 2861611..5178020 100644 (file)
@@ -117,7 +117,6 @@ StyleManager::StyleManager()
 
   // Sound & haptic style
   mFeedbackStyle = new FeedbackStyle();
 
   // Sound & haptic style
   mFeedbackStyle = new FeedbackStyle();
-
 }
 
 StyleManager::~StyleManager()
 }
 
 StyleManager::~StyleManager()
@@ -156,14 +155,14 @@ void StyleManager::SetOrientation( Orientation orientation )
   }
 }
 
   }
 }
 
-std::string StyleManager::GetDefaultFontFamily() const
+Orientation StyleManager::GetOrientation()
 {
 {
-  return mDefaultFontFamily;
+  return mOrientation;
 }
 
 }
 
-Orientation StyleManager::GetOrientation()
+std::string StyleManager::GetDefaultFontFamily() const
 {
 {
-  return mOrientation;
+  return mDefaultFontFamily;
 }
 
 void StyleManager::SetStyleConstant( const std::string& key, const Property::Value& value )
 }
 
 void StyleManager::SetStyleConstant( const std::string& key, const Property::Value& value )
@@ -183,14 +182,114 @@ bool StyleManager::GetStyleConstant( const std::string& key, Property::Value& va
   return false;
 }
 
   return false;
 }
 
-void StyleManager::OnOrientationChanged( Orientation orientation )
+void StyleManager::RequestThemeChange( const std::string& themeFile )
 {
 {
-  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
+  mThemeFile = themeFile;
+
+  // need to do style change synchronously as app might create a UI control on the next line
   SetTheme();
 }
 
   SetTheme();
 }
 
+void StyleManager::RequestDefaultTheme()
+{
+  RequestThemeChange( DEFAULT_THEME );
+}
+
+void StyleManager::ApplyThemeStyle( Toolkit::Control control )
+{
+  if( !mThemeBuilder )
+  {
+    RequestDefaultTheme();
+  }
+
+  if( mThemeBuilder )
+  {
+    ApplyStyle( mThemeBuilder, control );
+  }
+}
+
+void StyleManager::ApplyThemeStyleAtInit( Toolkit::Control control )
+{
+  ApplyThemeStyle( control );
+
+  if(mFeedbackStyle)
+  {
+    mFeedbackStyle->ObjectCreated( control );
+  }
+}
+
+void StyleManager::ApplyStyle( Toolkit::Control control, const std::string& jsonFileName, const std::string& styleName )
+{
+  bool builderReady = false;
+
+  // First look in the cache
+  Toolkit::Builder builder = FindCachedBuilder( jsonFileName );
+  if( builder )
+  {
+    builderReady = true;
+  }
+  else
+  {
+    // Merge theme and style constants
+    Property::Map constants( mThemeBuilderConstants );
+    constants.Merge( mStyleBuilderConstants );
+
+    // Create it
+    builder = CreateBuilder( constants );
+
+    if( LoadJSON( builder, jsonFileName ) )
+    {
+      CacheBuilder( builder, jsonFileName );
+      builderReady = true;
+    }
+  }
+
+  // Apply the style to the control
+  if( builderReady )
+  {
+    builder.ApplyStyle( styleName, control );
+  }
+}
+
+Toolkit::StyleManager::StyleChangeSignalType& StyleManager::StyleChangeSignal()
+{
+  return mStyleChangeSignal;
+}
+
+
+void StyleManager::SetTheme()
+{
+  mThemeBuilder = CreateBuilder( mThemeBuilderConstants );
+
+  if( LoadJSON( mThemeBuilder, mThemeFile ) )
+  {
+    if(mFeedbackStyle)
+    {
+      mFeedbackStyle->StyleChanged( mThemeFile, StyleChange::THEME_CHANGE );
+    }
+
+    mStyleChangeSignal.Emit( Toolkit::StyleManager::Get(), StyleChange::THEME_CHANGE );
+  }
+  else
+  {
+    mThemeBuilder.Reset();
+  }
+}
+
+bool StyleManager::LoadFile( const std::string& filename, std::string& stringOut )
+{
+  DALI_ASSERT_DEBUG( 0 != filename.length());
+
+  // as toolkit is platform agnostic, it cannot load files from filesystem
+  // ask style monitor to load the style sheet
+  if( mStyleMonitor )
+  {
+    return mStyleMonitor.LoadThemeFile( filename, stringOut );
+  }
+
+  return false;
+}
+
 Toolkit::Builder StyleManager::CreateBuilder( const Property::Map& constants )
 {
   Toolkit::Builder builder = Toolkit::Builder::New();
 Toolkit::Builder StyleManager::CreateBuilder( const Property::Map& constants )
 {
   Toolkit::Builder builder = Toolkit::Builder::New();
@@ -294,112 +393,14 @@ void StyleManager::ApplyStyle( Toolkit::Builder builder, Toolkit::Control contro
   }
 }
 
   }
 }
 
-void StyleManager::ApplyThemeStyle( Toolkit::Control control )
-{
-  if( !mThemeBuilder )
-  {
-    RequestDefaultTheme();
-  }
-
-  if( mThemeBuilder )
-  {
-    ApplyStyle( mThemeBuilder, control );
-  }
-}
-
-void StyleManager::ApplyThemeStyleAtInit( Toolkit::Control control )
-{
-  ApplyThemeStyle( control );
-
-  if(mFeedbackStyle)
-  {
-    mFeedbackStyle->ObjectCreated( control );
-  }
-}
-
-void StyleManager::ApplyStyle( Toolkit::Control control, const std::string& jsonFileName, const std::string& styleName )
-{
-  bool builderReady = false;
-
-  // First look in the cache
-  Toolkit::Builder builder = FindCachedBuilder( jsonFileName );
-  if( builder )
-  {
-    builderReady = true;
-  }
-  else
-  {
-    // Merge theme and style constants
-    Property::Map constants( mThemeBuilderConstants );
-    constants.Merge( mStyleBuilderConstants );
-
-    // Create it
-    builder = CreateBuilder( constants );
-
-    if( LoadJSON( builder, jsonFileName ) )
-    {
-      CacheBuilder( builder, jsonFileName );
-      builderReady = true;
-    }
-  }
-
-  // Apply the style to the control
-  if( builderReady )
-  {
-    builder.ApplyStyle( styleName, control );
-  }
-}
-
-bool StyleManager::LoadFile( const std::string& filename, std::string& stringOut )
-{
-  DALI_ASSERT_DEBUG( 0 != filename.length());
-
-  // as toolkit is platform agnostic, it cannot load files from filesystem
-  // ask style monitor to load the style sheet
-  if( mStyleMonitor )
-  {
-    return mStyleMonitor.LoadThemeFile( filename, stringOut );
-  }
-
-  return false;
-}
-
-Toolkit::StyleManager::StyleChangeSignalType& StyleManager::StyleChangeSignal()
-{
-  return mStyleChangeSignal;
-}
-
-void StyleManager::RequestThemeChange( const std::string& themeFile )
+void StyleManager::OnOrientationChanged( Orientation orientation )
 {
 {
-  mThemeFile = themeFile;
-
-  // need to do style change synchronously as app might create a UI control on the next line
+  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();
 }
 
   SetTheme();
 }
 
-void StyleManager::RequestDefaultTheme()
-{
-  RequestThemeChange( DEFAULT_THEME );
-}
-
-void StyleManager::SetTheme()
-{
-  mThemeBuilder = CreateBuilder( mThemeBuilderConstants );
-
-  if( LoadJSON( mThemeBuilder, mThemeFile ) )
-  {
-    if(mFeedbackStyle)
-    {
-      mFeedbackStyle->StyleChanged( mThemeFile, StyleChange::THEME_CHANGE );
-    }
-
-    mStyleChangeSignal.Emit( Toolkit::StyleManager::Get(), StyleChange::THEME_CHANGE );
-  }
-  else
-  {
-    mThemeBuilder.Reset();
-  }
-}
 
 Toolkit::Builder StyleManager::FindCachedBuilder( const std::string& key )
 {
 
 Toolkit::Builder StyleManager::FindCachedBuilder( const std::string& key )
 {
index ab5e24d..0eec891 100644 (file)
@@ -47,7 +47,6 @@ class FeedbackStyle;
 class StyleManager : public Dali::BaseObject, public ConnectionTracker
 {
 public:
 class StyleManager : public Dali::BaseObject, public ConnectionTracker
 {
 public:
-
   /**
    * Singleton access
    *
   /**
    * Singleton access
    *
@@ -60,6 +59,14 @@ public:
    */
   StyleManager();
 
    */
   StyleManager();
 
+protected:
+  /**
+   * @brief Destructor
+   */
+  virtual ~StyleManager();
+
+public: // Public API
+
   /**
    * @copydoc Toolkit::StyleManager::SetOrientationValue
    */
   /**
    * @copydoc Toolkit::StyleManager::SetOrientationValue
    */
@@ -106,12 +113,6 @@ public:
   void RequestDefaultTheme();
 
   /**
   void RequestDefaultTheme();
 
   /**
-   * Determine if a theme change has been requested
-   * @return Whether a theme request is pending
-   */
-  bool IsThemeRequestPending();
-
-  /**
    * @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.
@@ -138,25 +139,14 @@ public:
    */
   Toolkit::StyleManager::StyleChangeSignalType& StyleChangeSignal();
 
    */
   Toolkit::StyleManager::StyleChangeSignalType& StyleChangeSignal();
 
-protected:
-
-  /**
-   * @brief Destructor
-   */
-  virtual ~StyleManager();
-
-
-public:
+private:
+  typedef std::vector<std::string> StringList;
 
   /**
    * @brief Set the current theme. Called only once per event processing cycle.
    */
   void SetTheme();
 
 
   /**
    * @brief Set the current theme. Called only once per event processing cycle.
    */
   void SetTheme();
 
-private:
-
-  typedef std::vector<std::string> StringList;
-
   /**
    * @brief Internal helper method to read a file from file system.
    * @param filename The name of the file to read.
   /**
    * @brief Internal helper method to read a file from file system.
    * @param filename The name of the file to read.
@@ -299,4 +289,3 @@ inline const Internal::StyleManager& GetImpl( const Dali::Toolkit::StyleManager&
 } // namespace Dali
 
 #endif // __DALI_TOOLKIT_INTERNAL_STYLE_MANAGER_H__
 } // namespace Dali
 
 #endif // __DALI_TOOLKIT_INTERNAL_STYLE_MANAGER_H__
-