Revert "Revert "[SRUK] (StyleManager) Create a style manager""
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Thu, 29 May 2014 13:13:50 +0000 (22:13 +0900)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Wed, 11 Jun 2014 07:56:53 +0000 (08:56 +0100)
Change-Id: I35a410e4a1b1979f2f1738b1457190f415fca43c

72 files changed:
automated-tests/src/dali-toolkit-unmanaged/CMakeLists.txt
automated-tests/src/dali-toolkit-unmanaged/tct-dali-toolkit-unmanaged-core.h
automated-tests/src/dali-toolkit-unmanaged/utc-Dali-StyleManager.cpp [new file with mode: 0644]
base/dali-toolkit/internal/builder/builder-actor.cpp [moved from optional/dali-toolkit/internal/builder/builder-actor.cpp with 100% similarity]
base/dali-toolkit/internal/builder/builder-animations.cpp [moved from optional/dali-toolkit/internal/builder/builder-animations.cpp with 100% similarity]
base/dali-toolkit/internal/builder/builder-declarations.h [moved from optional/dali-toolkit/internal/builder/builder-declarations.h with 100% similarity]
base/dali-toolkit/internal/builder/builder-filesystem.h [moved from optional/dali-toolkit/internal/builder/builder-filesystem.h with 100% similarity]
base/dali-toolkit/internal/builder/builder-get-is.inl.h [moved from optional/dali-toolkit/internal/builder/builder-get-is.inl.h with 100% similarity]
base/dali-toolkit/internal/builder/builder-impl.cpp [moved from optional/dali-toolkit/internal/builder/builder-impl.cpp with 99% similarity]
base/dali-toolkit/internal/builder/builder-impl.h [moved from optional/dali-toolkit/internal/builder/builder-impl.h with 98% similarity]
base/dali-toolkit/internal/builder/builder-set-property.cpp [moved from optional/dali-toolkit/internal/builder/builder-set-property.cpp with 100% similarity]
base/dali-toolkit/internal/builder/builder-signals.cpp [moved from optional/dali-toolkit/internal/builder/builder-signals.cpp with 100% similarity]
base/dali-toolkit/internal/builder/json-parser-impl.cpp [moved from optional/dali-toolkit/internal/builder/json-parser-impl.cpp with 100% similarity]
base/dali-toolkit/internal/builder/json-parser-impl.h [moved from optional/dali-toolkit/internal/builder/json-parser-impl.h with 100% similarity]
base/dali-toolkit/internal/builder/json-parser-state.cpp [moved from optional/dali-toolkit/internal/builder/json-parser-state.cpp with 100% similarity]
base/dali-toolkit/internal/builder/json-parser-state.h [moved from optional/dali-toolkit/internal/builder/json-parser-state.h with 100% similarity]
base/dali-toolkit/internal/builder/optional-value.h [moved from optional/dali-toolkit/internal/builder/optional-value.h with 100% similarity]
base/dali-toolkit/internal/builder/replacement.cpp [moved from optional/dali-toolkit/internal/builder/replacement.cpp with 100% similarity]
base/dali-toolkit/internal/builder/replacement.h [moved from optional/dali-toolkit/internal/builder/replacement.h with 100% similarity]
base/dali-toolkit/internal/builder/tree-node-manipulator.cpp [moved from optional/dali-toolkit/internal/builder/tree-node-manipulator.cpp with 100% similarity]
base/dali-toolkit/internal/builder/tree-node-manipulator.h [moved from optional/dali-toolkit/internal/builder/tree-node-manipulator.h with 100% similarity]
base/dali-toolkit/internal/controls/alignment/alignment-impl.cpp
base/dali-toolkit/internal/controls/buttons/button-impl.cpp
base/dali-toolkit/internal/controls/popup/popup-impl.cpp
base/dali-toolkit/internal/controls/scrollable/scrollable-impl.cpp
base/dali-toolkit/internal/controls/table-view/table-view-impl.cpp
base/dali-toolkit/internal/controls/text-input/text-input-impl.cpp
base/dali-toolkit/internal/controls/text-view/text-view-impl.cpp
base/dali-toolkit/internal/file.list
base/dali-toolkit/internal/styling/style-manager-impl.cpp [new file with mode: 0644]
base/dali-toolkit/internal/styling/style-manager-impl.h [new file with mode: 0644]
base/dali-toolkit/internal/styling/util.h [new file with mode: 0644]
base/dali-toolkit/public-api/builder/builder.cpp [moved from optional/dali-toolkit/public-api/builder/builder.cpp with 97% similarity]
base/dali-toolkit/public-api/builder/builder.h [moved from optional/dali-toolkit/public-api/builder/builder.h with 95% similarity]
base/dali-toolkit/public-api/builder/json-parser.cpp [moved from optional/dali-toolkit/public-api/builder/json-parser.cpp with 100% similarity]
base/dali-toolkit/public-api/builder/json-parser.h [moved from optional/dali-toolkit/public-api/builder/json-parser.h with 100% similarity]
base/dali-toolkit/public-api/builder/tree-node.cpp [moved from optional/dali-toolkit/public-api/builder/tree-node.cpp with 100% similarity]
base/dali-toolkit/public-api/builder/tree-node.h [moved from optional/dali-toolkit/public-api/builder/tree-node.h with 100% similarity]
base/dali-toolkit/public-api/controls/control-impl.cpp
base/dali-toolkit/public-api/controls/scrollable/scroll-component-impl.cpp
base/dali-toolkit/public-api/file.list
base/dali-toolkit/public-api/styling/style-manager.cpp [new file with mode: 0644]
base/dali-toolkit/public-api/styling/style-manager.h [new file with mode: 0644]
base/dali-toolkit/styles/file.list [new file with mode: 0644]
base/dali-toolkit/styles/tizen-dark-theme.json [new file with mode: 0644]
base/dali-toolkit/styles/tizen-default-theme.json [new symlink]
build/slp/dali-toolkit-base/Makefile.am
build/slp/dali-toolkit/Makefile.am
capi/dali-toolkit/public-api/controls/control-impl.h
capi/dali-toolkit/public-api/dali-toolkit-capi-internal.h
capi/dali-toolkit/public-api/file.list
optional/dali-toolkit/dali-toolkit.h
optional/dali-toolkit/internal/controls/bloom-view/bloom-view-impl.cpp
optional/dali-toolkit/internal/controls/bubble-effect/bubble-emitter-impl.cpp
optional/dali-toolkit/internal/controls/cluster/cluster-impl.cpp
optional/dali-toolkit/internal/controls/effects-view/effects-view-impl.cpp
optional/dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.cpp
optional/dali-toolkit/internal/controls/image-view/image-view-impl.cpp
optional/dali-toolkit/internal/controls/image-view/masked-image-view-impl.cpp
optional/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp
optional/dali-toolkit/internal/controls/navigation-frame/navigation-control-impl.cpp
optional/dali-toolkit/internal/controls/navigation-frame/page-impl.cpp
optional/dali-toolkit/internal/controls/page-turn-view/page-turn-view-impl.cpp
optional/dali-toolkit/internal/controls/selectors/rotating-selector-impl.cpp
optional/dali-toolkit/internal/controls/shadow-view/shadow-view-impl.cpp
optional/dali-toolkit/internal/controls/slider/slider-impl.cpp
optional/dali-toolkit/internal/controls/super-blur-view/super-blur-view-impl.cpp
optional/dali-toolkit/internal/controls/tool-bar/tool-bar-impl.cpp
optional/dali-toolkit/internal/controls/view/view-impl.cpp
optional/dali-toolkit/internal/file.list
optional/dali-toolkit/public-api/file.list
packaging/dali-toolkit.spec

index 46af2cd..a1e6c7f 100644 (file)
@@ -49,6 +49,7 @@ SET(TC_SOURCES
  utc-Dali-KeyboardFocusManager.cpp
  utc-Dali-ScrollViewEffect.cpp
  utc-Dali-TextInput.cpp
+ utc-Dali-StyleManager.cpp
 )
 
 # Append list of test harness files (Won't get parsed for test cases)
index f3a27c4..528e51e 100644 (file)
@@ -81,6 +81,8 @@ extern void dali_keyboard_focus_manager_startup(void);
 extern void dali_keyboard_focus_manager_cleanup(void);
 extern void dali_scroll_view_effect_startup(void);
 extern void dali_scroll_view_effect_cleanup(void);
+extern void dali_style_manager_startup(void);
+extern void dali_style_manager_cleanup(void);
 
 extern int UtcDaliAlbumLayoutNew(void);
 extern int UtcDaliAlbumSetAndGetItemSizeFunction(void);
@@ -394,6 +396,10 @@ extern int UtcDaliTextInputGetStyleAtCursor(void);
 extern int UtcDaliTextInputSetAndGetTextAlignment(void);
 extern int UtcDaliTextInputSetAndGetMultilinePolicy(void);
 extern int UtcDaliTextInputSetAndGetExceedEnabled(void);
+extern int UtcDaliStyleManagerGet(void);
+extern int UtcDaliStyleManagerSetOrientationValue(void);
+extern int UtcDaliStyleManagerSetOrientation(void);
+extern int UtcDaliStyleManagerSetStyleConstant(void);
 
 testcase tc_array[] = {
     {"UtcDaliAlbumLayoutNew", UtcDaliAlbumLayoutNew, album_layout_startup, album_layout_cleanup},
@@ -708,6 +714,10 @@ testcase tc_array[] = {
     {"UtcDaliTextInputSetAndGetTextAlignment", UtcDaliTextInputSetAndGetTextAlignment, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
     {"UtcDaliTextInputSetAndGetMultilinePolicy", UtcDaliTextInputSetAndGetMultilinePolicy, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
     {"UtcDaliTextInputSetAndGetExceedEnabled", UtcDaliTextInputSetAndGetExceedEnabled, dali_scroll_view_effect_startup, dali_scroll_view_effect_cleanup},
+    {"UtcDaliStyleManagerGet", UtcDaliStyleManagerGet, dali_style_manager_startup, dali_style_manager_cleanup},
+    {"UtcDaliStyleManagerSetOrientationValue", UtcDaliStyleManagerSetOrientationValue, dali_style_manager_startup, dali_style_manager_cleanup},
+    {"UtcDaliStyleManagerSetOrientation", UtcDaliStyleManagerSetOrientation, dali_style_manager_startup, dali_style_manager_cleanup},
+    {"UtcDaliStyleManagerSetStyleConstant", UtcDaliStyleManagerSetStyleConstant, dali_style_manager_startup, dali_style_manager_cleanup},
     {NULL, NULL}
 };
 
diff --git a/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-StyleManager.cpp b/automated-tests/src/dali-toolkit-unmanaged/utc-Dali-StyleManager.cpp
new file mode 100644 (file)
index 0000000..c49762f
--- /dev/null
@@ -0,0 +1,123 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <iostream>
+#include <stdlib.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/public-api/styling/style-manager.h>
+
+
+using namespace Dali;
+using namespace Dali::Toolkit;
+
+void dali_style_manager_startup(void)
+{
+  test_return_value = TET_UNDEF;
+}
+
+void dali_style_manager_cleanup(void)
+{
+  test_return_value = TET_PASS;
+}
+
+int UtcDaliStyleManagerGet(void)
+{
+  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);
+  END_TEST;
+}
+
+int UtcDaliStyleManagerSetOrientationValue(void)
+{
+  ToolkitTestApplication application;
+
+  tet_infoline( " UtcDaliStyleManagerSetOrientationValue" );
+
+  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 );
+
+  END_TEST;
+}
+
+int UtcDaliStyleManagerSetOrientation(void)
+{
+  ToolkitTestApplication application;
+
+  tet_infoline( " UtcDaliStyleManagerSetOrientation" );
+
+  StyleManager manager = StyleManager::Get();
+
+  Orientation orientation;
+
+  manager.SetOrientation( orientation );
+
+  DALI_TEST_CHECK( manager.GetOrientation() == orientation );
+
+  END_TEST;
+}
+
+int UtcDaliStyleManagerSetStyleConstant(void)
+{
+  ToolkitTestApplication application;
+
+  tet_infoline( " UtcDaliStyleManagerSetStyleConstant" );
+
+  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>() );
+
+  std::string key2( "key2" );
+  Property::Value returnedValue2;
+  DALI_TEST_CHECK( !manager.GetStyleConstant( key2, returnedValue2 ) );
+
+  END_TEST;
+}
@@ -995,13 +995,13 @@ void Builder::LoadConstants( const TreeNode& root, PropertyValueMap& intoMap )
 
 }
 
-void Builder::ApplyStyle( const std::string& styleName, Handle& handle )
+bool Builder::ApplyStyle( const std::string& styleName, Handle& handle )
 {
   Replacement replacer( mReplacementMap );
-  ApplyStyle( styleName, handle, replacer );
+  return ApplyStyle( styleName, handle, replacer );
 }
 
-void Builder::ApplyStyle( const std::string& styleName, Handle& handle, const Replacement& replacement )
+bool Builder::ApplyStyle( const std::string& styleName, Handle& handle, const Replacement& replacement )
 {
   DALI_ASSERT_ALWAYS(mParser.GetRoot() && "Builder script not loaded");
 
@@ -1011,12 +1011,13 @@ void Builder::ApplyStyle( const std::string& styleName, Handle& handle, const Re
   if( styles && style )
   {
     ApplyAllStyleProperties( *mParser.GetRoot(), *style, handle, replacement );
+    return true;
   }
   else
   {
     DALI_SCRIPT_WARNING("No styles section to create style '%s'\n", styleName.c_str());
+    return false;
   }
-
 }
 
 BaseHandle Builder::Create( const std::string& templateName, const PropertyValueMap& map )
@@ -150,7 +150,7 @@ public:
   /**
    * @copydoc Toolkit::Builder::ApplyStyle
    */
-  void ApplyStyle( const std::string& styleName, Handle& handle );
+  bool ApplyStyle( const std::string& styleName, Handle& handle );
 
   void AnimateTo( const std::string& styleName, Handle& handle );
 
@@ -231,7 +231,7 @@ private:
 
   void LoadIncludes( const std::string& data );
 
-  void ApplyStyle( const std::string& styleName, Handle& handle, const Replacement& replacement);
+  bool ApplyStyle( const std::string& styleName, Handle& handle, const Replacement& replacement);
 
   Animation CreateAnimation( const std::string& animationName, const Replacement& replacement, Dali::Actor sourceActor );
 
index e661a87..1514358 100644 (file)
@@ -623,7 +623,7 @@ void Alignment::OnRelaidOut( Vector2 size, ActorSizeContainer& container )
 }
 
 Alignment::Alignment( Toolkit::Alignment::Type horizontal, Toolkit::Alignment::Type vertical )
-: Control( false ),  // doesn't require touch events
+: Control( CONTROL_BEHAVIOUR_NONE ),
   mHorizontal( horizontal ),
   mVertical( vertical ),
   mScaling( Toolkit::Alignment::ScaleNone ),
index 8536b0b..941ebcc 100644 (file)
@@ -52,7 +52,7 @@ PropertyRegistration property1( typeRegistration, "dimmed", Toolkit::Button::PRO
 } // unnamed namespace
 
 Button::Button()
-: Control( true ),
+: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ),
   mState( ButtonUp ),
   mDimmed( false ),
   mPainter( NULL )
index 47995d4..7f3b7c0 100755 (executable)
@@ -169,7 +169,7 @@ Dali::Toolkit::Popup Popup::New()
 }
 
 Popup::Popup(PopupStyle& style)
-: Control(true),
+: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ),
   mShowing(false),
   mState(Toolkit::Popup::POPUP_NONE), // Initially, the popup state should not be set, it's set in OnInitialize
   mAlterAddedChild(false),
index 451895c..6c4da93 100644 (file)
@@ -61,7 +61,7 @@ const Vector4     Scrollable::DEFAULT_OVERSHOOT_COLOUR(0.0f, 0.64f, 0.85f, 0.6f)
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 Scrollable::Scrollable()
-: Control(true/*requires touch*/),
+: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ),
   mPropertyRelativePosition(Property::INVALID_INDEX),
   mPropertyPositionMin(Property::INVALID_INDEX),
   mPropertyPositionMax(Property::INVALID_INDEX),
index e2970cc..fff8bc4 100644 (file)
@@ -794,7 +794,7 @@ void TableView::OnControlChildRemove( Actor& child )
 }
 
 TableView::TableView( unsigned int initialRows, unsigned int initialColumns )
-: Control( true ),  // requires touch
+: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ),
   mCellData( initialRows, initialColumns ),
   mLayoutingChild( false ),
   mConstraintDuration( DEFAULT_CONSTRAINT_DURATION )
index 557e2fd..3d79aad 100644 (file)
@@ -269,7 +269,7 @@ Dali::Toolkit::TextInput TextInput::New()
 }
 
 TextInput::TextInput()
-:Control( true ),
+:Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ),
  mState( StateEdit ),
  mStyledText(),
  mInputStyle(),
index 16a8305..78c4980 100644 (file)
@@ -1009,7 +1009,7 @@ TextView::RelayoutData& TextView::RelayoutData::operator=( const TextView::Relay
 }
 
 TextView::TextView()
-: Control( false ),  // doesn't require touch events
+: Control( REQUIRES_THEME_CHANGE_SIGNALS ),
   mCurrentStyledText(),
   mTextViewProcessorOperations(),
   mLayoutParameters( Toolkit::TextView::SplitByNewLineChar,
index 61f3ba0..7c99c2c 100644 (file)
@@ -4,7 +4,6 @@ toolkit_base_src_files = \
    $(toolkit_base_src_dir)/controls/relayout-controller.cpp \
    $(toolkit_base_src_dir)/controls/relayout-controller-impl.cpp \
    $(toolkit_base_src_dir)/controls/relayout-helper.cpp \
-   $(toolkit_base_src_dir)/controls/style-change-processor.cpp \
    $(toolkit_base_src_dir)/controls/alignment/alignment-impl.cpp \
    $(toolkit_base_src_dir)/controls/buttons/button-impl.cpp \
    $(toolkit_base_src_dir)/controls/buttons/check-box-button-default-painter-impl.cpp \
@@ -57,4 +56,14 @@ toolkit_base_src_files = \
    $(toolkit_base_src_dir)/factory/localized-control-factory-impl.cpp \
    $(toolkit_base_src_dir)/focus-manager/focus-manager-impl.cpp \
    $(toolkit_base_src_dir)/focus-manager/keyboard-focus-manager-impl.cpp \
-   $(toolkit_base_src_dir)/focus-manager/keyinput-focus-manager-impl.cpp
+   $(toolkit_base_src_dir)/focus-manager/keyinput-focus-manager-impl.cpp \
+   $(toolkit_base_src_dir)/styling/style-manager-impl.cpp \
+   $(toolkit_base_src_dir)/builder/builder-impl.cpp \
+   $(toolkit_base_src_dir)/builder/builder-animations.cpp \
+   $(toolkit_base_src_dir)/builder/builder-set-property.cpp \
+   $(toolkit_base_src_dir)/builder/builder-signals.cpp \
+   $(toolkit_base_src_dir)/builder/builder-actor.cpp \
+   $(toolkit_base_src_dir)/builder/json-parser-state.cpp \
+   $(toolkit_base_src_dir)/builder/json-parser-impl.cpp \
+   $(toolkit_base_src_dir)/builder/tree-node-manipulator.cpp \
+   $(toolkit_base_src_dir)/builder/replacement.cpp
diff --git a/base/dali-toolkit/internal/styling/style-manager-impl.cpp b/base/dali-toolkit/internal/styling/style-manager-impl.cpp
new file mode 100644 (file)
index 0000000..56b97f8
--- /dev/null
@@ -0,0 +1,394 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// CLASS HEADER
+#include "style-manager-impl.h"
+
+// INTERNAL INCLUDES
+#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
+#include <fstream>
+#include <iostream>
+#include <sstream>
+
+
+namespace
+{
+
+const char* LANDSCAPE_QUALIFIER = "landscape";
+const char* PORTRAIT_QUALIFIER  = "portrait";
+
+const char* DEFAULT_THEME = DALI_STYLE_DIR "tizen-default-theme.json";
+
+const char* PACKAGE_PATH_KEY = "PACKAGE_PATH";
+const char* DEFAULT_PACKAGE_PATH = DALI_DATA_READ_ONLY_DIR "/toolkit/";
+
+} // namespace
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+namespace
+{
+
+BaseHandle Create()
+{
+  BaseHandle handle = StyleManager::Get();
+
+  if ( !handle && Adaptor::IsAvailable() )
+  {
+    Toolkit::StyleManager manager = Toolkit::StyleManager( new Internal::StyleManager() );
+    Adaptor::Get().RegisterSingleton( typeid( manager ), manager );
+    handle = manager;
+  }
+
+  return handle;
+}
+TypeRegistration STYLE_MANAGER_TYPE( typeid(Dali::Toolkit::StyleManager), typeid(Dali::BaseHandle), Create, true /* Create instance at startup */ );
+
+/**
+ * Merge two maps into one
+ */
+void MergeMaps( const PropertyValueMap& a, const PropertyValueMap& b, PropertyValueMap& out )
+{
+  out = a;
+  for( PropertyValueMap::const_iterator it = b.begin(), itEnd = b.end(); it != itEnd; ++it )
+  {
+    out[ it->first ] = it->second;
+  }
+}
+
+} // namespace
+
+Toolkit::StyleManager StyleManager::Get()
+{
+  Toolkit::StyleManager manager;
+
+  if ( Adaptor::IsAvailable() )
+  {
+    // Check whether the style manager is already created
+    Dali::BaseHandle handle = Dali::Adaptor::Get().GetSingleton( typeid( Toolkit::StyleManager ) );
+    if( handle )
+    {
+      // If so, downcast the handle of singleton
+      manager = Toolkit::StyleManager( dynamic_cast< StyleManager* >( handle.GetObjectPtr() ) );
+    }
+  }
+
+  return manager;
+}
+
+StyleManager::StyleManager()
+  : mOrientationDegrees( 0 ),  // Portrait
+    mSetThemeConnection( false )
+{
+  // Add theme builder constants
+  mThemeBuilderConstants[ PACKAGE_PATH_KEY ] = DEFAULT_PACKAGE_PATH;
+
+  RequestDefaultTheme();
+}
+
+StyleManager::~StyleManager()
+{
+  // Disconnect from signal
+  SetOrientation( Orientation() );
+}
+
+void StyleManager::SetOrientationValue( int orientation )
+{
+  mOrientationDegrees = orientation;
+
+  Util::ConnectEventProcessingFinishedSignal();
+  mSetThemeConnection = true;
+}
+
+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 );
+  }
+}
+
+Orientation StyleManager::GetOrientation()
+{
+  return mOrientation;
+}
+
+void StyleManager::SetStyleConstant( const std::string& key, const Property::Value& value )
+{
+  mStyleBuilderConstants[ key ] = value;
+}
+
+bool StyleManager::GetStyleConstant( const std::string& key, Property::Value& valueOut )
+{
+  Toolkit::PropertyValueMap::iterator valueIt = mStyleBuilderConstants.find( key );
+  if( valueIt != mStyleBuilderConstants.end() )
+  {
+    valueOut = valueIt->second;
+    return true;
+  }
+
+  return false;
+}
+
+void StyleManager::OnOrientationChanged( Orientation orientation )
+{
+  mOrientation = orientation;
+
+  if( mOrientation )
+  {
+    Util::ConnectEventProcessingFinishedSignal();
+    mSetThemeConnection = true;
+  }
+}
+
+Toolkit::Builder StyleManager::CreateBuilder( const PropertyValueMap& constants )
+{
+  Toolkit::Builder builder = Toolkit::Builder::New();
+  builder.AddConstants( constants );
+
+  return builder;
+}
+
+bool StyleManager::LoadJSON( Toolkit::Builder builder, const std::string& jsonFilePath )
+{
+  std::string fileString;
+  if( LoadFile( jsonFilePath, fileString ) )
+  {
+    builder.LoadFromString( fileString );
+    return true;
+  }
+  else
+  {
+    DALI_LOG_WARNING("Error loading file '%s'\n", jsonFilePath.c_str());
+    return false;
+  }
+}
+
+void StyleManager::CollectQualifiers( StringList& qualifiersOut )
+{
+  // Append the relevant qualifier for orientation
+  int orientation = mOrientationDegrees;
+
+  if( mOrientation )
+  {
+    orientation = mOrientation.GetDegrees();
+  }
+
+  switch( orientation )
+  {
+    case 90:
+    case 270:
+    {
+      qualifiersOut.push_back( std::string( LANDSCAPE_QUALIFIER ) );
+      break;
+    }
+    case 180:
+    case 0: // fall through
+    default:
+    {
+      qualifiersOut.push_back( std::string( PORTRAIT_QUALIFIER ) );
+      break;
+    }
+  }
+}
+
+void StyleManager::BuildQualifiedStyleName( const std::string& styleName, const StringList& qualifiers, std::string& qualifiedStyleOut )
+{
+  qualifiedStyleOut.append( styleName );
+
+  for( StringList::const_iterator it = qualifiers.begin(), itEnd = qualifiers.end(); it != itEnd; ++it )
+  {
+    const std::string& str = *it;
+
+    qualifiedStyleOut.append( "-" );
+    qualifiedStyleOut.append( str );
+  }
+}
+
+void StyleManager::ApplyStyle( Toolkit::Builder builder, Toolkit::Control control )
+{
+  // Convert control name to lower case
+  std::string styleName = control.GetTypeName();
+  std::transform( styleName.begin(), styleName.end(), styleName.begin(), ::tolower );
+
+  // Apply the style after choosing the correct actual style (e.g. landscape or portrait)
+  StringList qualifiers;
+  CollectQualifiers( qualifiers );
+
+  while( true )
+  {
+    std::string qualifiedStyleName;
+    BuildQualifiedStyleName( styleName, qualifiers, qualifiedStyleName );
+
+    // Break if style found or we have tried the root style name (qualifiers is empty)
+    if( builder.ApplyStyle( qualifiedStyleName, control ) || qualifiers.size() == 0 )
+    {
+      break;
+    }
+
+    // Remove the last qualifier in an attempt to find a style that is valid
+    qualifiers.pop_back();
+  }
+}
+
+void StyleManager::ApplyThemeStyle( Toolkit::Control control )
+{
+  if( mThemeBuilder )
+  {
+    ApplyStyle( mThemeBuilder, 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
+    PropertyValueMap constants;
+    MergeMaps( mThemeBuilderConstants, mStyleBuilderConstants, constants );
+
+    // 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());
+
+  std::ifstream in( filename.c_str(), std::ios::in );
+  if( in )
+  {
+    std::stringstream buffer;
+    buffer << in.rdbuf();
+
+    stringOut = buffer.str();
+
+    in.close();
+
+    return true;
+  }
+
+  return false;
+}
+
+Toolkit::StyleManager::ThemeChangeSignalType& StyleManager::ThemeChangeSignal()
+{
+  return mThemeChangeSignal;
+}
+
+void StyleManager::EmitThemeChangeSignal()
+{
+  if( !mThemeChangeSignal.Empty() )
+  {
+    mThemeChangeSignal.Emit( Toolkit::StyleManager::Get() );
+  }
+}
+
+void StyleManager::RequestThemeChange( const std::string& themeFile )
+{
+  mThemeFile = themeFile;
+
+  Util::ConnectEventProcessingFinishedSignal();
+  mSetThemeConnection = true;
+}
+
+void StyleManager::RequestDefaultTheme()
+{
+  RequestThemeChange( DEFAULT_THEME );
+}
+
+bool StyleManager::IsThemeRequestPending()
+{
+  return mSetThemeConnection;
+}
+
+void StyleManager::SetTheme()
+{
+  mThemeBuilder = CreateBuilder( mThemeBuilderConstants );
+  LoadJSON( mThemeBuilder, mThemeFile );
+
+  mSetThemeConnection = false;
+
+  EmitThemeChangeSignal();
+}
+
+Toolkit::Builder StyleManager::FindCachedBuilder( const std::string& key )
+{
+  BuilderMap::iterator builderIt = mBuilderCache.find( key );
+  if( builderIt != mBuilderCache.end() )
+  {
+    return builderIt->second;
+  }
+
+  return Toolkit::Builder();
+}
+
+void StyleManager::CacheBuilder( Toolkit::Builder builder, const std::string& key )
+{
+  mBuilderCache[ key ] = builder;
+}
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
diff --git a/base/dali-toolkit/internal/styling/style-manager-impl.h b/base/dali-toolkit/internal/styling/style-manager-impl.h
new file mode 100644 (file)
index 0000000..2c15f89
--- /dev/null
@@ -0,0 +1,276 @@
+#ifndef __DALI_TOOLKIT_INTERNAL_STYLE_MANAGER_H__
+#define __DALI_TOOLKIT_INTERNAL_STYLE_MANAGER_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+#include <string>
+#include <list>
+
+// INTERNAL INCLUDES
+
+#include <dali/dali.h>
+#include <dali-toolkit/public-api/styling/style-manager.h>
+#include <dali-toolkit/public-api/builder/builder.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+/**
+ * @copydoc Toolkit::StyleManager
+ */
+class StyleManager : public Dali::BaseObject, public ConnectionTracker
+{
+public:
+
+  /**
+   * Singleton access
+   *
+   * @return The StyleManager object
+   */
+  static Toolkit::StyleManager Get();
+
+  /**
+   * Construct a new StyleManager.
+   */
+  StyleManager();
+
+  /**
+   * @copydoc Toolkit::StyleManager::SetOrientationValue
+   */
+  void SetOrientationValue( int orientation );
+
+  /**
+   * @copydoc Toolkit::StyleManager::GetOrientationValue
+   */
+  int GetOrientationValue();
+
+  /**
+   * @copydoc Toolkit::StyleManager::SetOrientation( Orientation orientation )
+   */
+  void SetOrientation( Orientation orientation );
+
+  /**
+   * @copydoc Toolkit::StyleManager::GetOrientation
+   */
+  Orientation GetOrientation();
+
+  /**
+   * @copydoc Toolkit::StyleManager::SetStyleConstant
+   */
+  void SetStyleConstant( const std::string& key, const Property::Value& value );
+
+  /**
+   * @copydoc Toolkit::StyleManager::GetStyleConstant
+   */
+  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();
+
+  /**
+   * 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.
+   */
+  void ApplyThemeStyle( Toolkit::Control control );
+
+  /**
+   * @copydoc Toolkit::StyleManager::ApplyStyle
+   */
+  void ApplyStyle( Toolkit::Control control, const std::string& jsonFileName, const std::string& styleName );
+
+public:
+  // SIGNALS
+
+  /**
+   * @copydoc Toolkit::StyleManager::ThemeChangeSignal
+   */
+  Toolkit::StyleManager::ThemeChangeSignalType& ThemeChangeSignal();
+
+protected:
+
+  /**
+   * @brief Destructor
+   */
+  virtual ~StyleManager();
+
+
+public:
+
+  /**
+   * @brief Set the current theme. Called only once per event processing cycle.
+   */
+  void SetTheme();
+
+private:
+
+  typedef std::list<std::string> StringList;
+
+  /**
+   * @brief Internal helper method to read a file from file system.
+   * @param filename The name of the file to read.
+   * @param[out] stringOut The string to return the file in
+   *
+   * @param Return true if file was found
+   */
+  bool LoadFile(const std::string& filename, std::string& stringOut);
+
+  /**
+   * @brief Create a new builder.
+   *
+   * @param[in] constants A map of constants to be used by the builder
+   *
+   * @return Return the newly created builder
+   */
+  Toolkit::Builder CreateBuilder( const PropertyValueMap& constants );
+
+  /**
+   * @brief Load a JSON file into given builder
+   *
+   * @param[in] builder The builder object to load the theme file
+   * @param[in] jsonFileName The name of the JSON file to load
+   * @return Return true if file was loaded
+   */
+  bool LoadJSON( Toolkit::Builder builder, const std::string& jsonFileName );
+
+  /**
+   * @brief Collect qualifiers (e.g. Landscape, portrait etc) for a given style
+   *
+   * @param[in,out] qualifiersOut The list to populate with qualifiers
+   */
+  void CollectQualifiers( StringList& qualifiersOut );
+
+  /**
+   * @brief Construct a qualified style name out of qualifiers
+   *
+   * A qualifed style name will be in the format: style-qualifier0-qualifier1-qualifierN
+   *
+   * @param[in] styleName The root name of the style
+   * @param[in] qualifiers List of qualifier names
+   * @param[out] qualifiedStyleOut The qualified style name
+   */
+  void BuildQualifiedStyleName( const std::string& styleName, const StringList& qualifiers, std::string& qualifiedStyleOut );
+
+  /**
+   * @brief Apply a style to the control using the given builder
+   *
+   * @param[in] builder The builder to apply the style from
+   * @param[in] control The control to apply the style to
+   */
+  void ApplyStyle( Toolkit::Builder builder, Toolkit::Control control );
+
+  /**
+   * @brief Emit theme changed signal
+   */
+  void EmitThemeChangeSignal();
+
+  /**
+   * @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
+   * @return Return the cached builder if found or an empty builder object if not found
+   */
+  Toolkit::Builder FindCachedBuilder( const std::string& key );
+
+  /**
+   * Store a given builder in the cache keyed to the given key
+   *
+   * @param[in] builder The builder object to store
+   * @param[in] key The key to store the builder under
+   */
+  void CacheBuilder( Toolkit::Builder builder, const std::string& key );
+
+  // Undefined
+  StyleManager(const StyleManager&);
+
+  StyleManager& operator=(const StyleManager& rhs);
+
+private:
+
+  // Map to store builders keyed by JSON file name
+  typedef std::map< std::string, Toolkit::Builder > BuilderMap;
+
+  Toolkit::Builder mThemeBuilder;     ///< Builder for all default theme properties
+
+  Orientation mOrientation;           ///< Handle to application orientation object
+  int mOrientationDegrees;            ///< Directly set value of orientation
+
+  std::string mThemeFile;             ///< The full path of the current theme file
+
+  Toolkit::PropertyValueMap mThemeBuilderConstants;   ///< Contants to give the theme builder
+  Toolkit::PropertyValueMap mStyleBuilderConstants;   ///< Constants specific to building styles
+
+  BuilderMap mBuilderCache;           ///< Cache of builders keyed by JSON file name
+
+  bool mSetThemeConnection;           ///< Has the callback to set the theme been set
+
+  // Signals
+  Toolkit::StyleManager::ThemeChangeSignalType       mThemeChangeSignal;         ///< Emitted when the theme changes
+};
+
+} // namespace Internal
+
+inline Internal::StyleManager& GetImpl( Dali::Toolkit::StyleManager& obj )
+{
+  DALI_ASSERT_ALWAYS( obj );
+
+  Dali::BaseObject& handle = obj.GetBaseObject();
+
+  return static_cast< Internal::StyleManager& >( handle );
+}
+
+inline const Internal::StyleManager& GetImpl( const Dali::Toolkit::StyleManager& obj )
+{
+  DALI_ASSERT_ALWAYS( obj );
+
+  const Dali::BaseObject& handle = obj.GetBaseObject();
+
+  return static_cast< const Internal::StyleManager& >( handle );
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_INTERNAL_STYLE_MANAGER_H__
+
diff --git a/base/dali-toolkit/internal/styling/util.h b/base/dali-toolkit/internal/styling/util.h
new file mode 100644 (file)
index 0000000..61901fe
--- /dev/null
@@ -0,0 +1,82 @@
+#ifndef __DALI_TOOLKIT_INTERNAL_UTIL_H__
+#define __DALI_TOOLKIT_INTERNAL_UTIL_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+
+#include <dali/dali.h>
+#include <dali-toolkit/internal/styling/style-manager-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Internal
+{
+
+namespace Util
+{
+
+/**
+ * @brief Callback that the EventProcessingFinishedSignal signal calls
+ *
+ * Priorities calls to managers
+ */
+inline void EventProcessingFinishedSignalPrioritizer()
+{
+  // Priority 0: Set all styles
+  Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
+  if( GetImpl(styleManager).IsThemeRequestPending() )
+  {
+    GetImpl(styleManager).SetTheme();
+  }
+
+  // Todo: Priority 1: Do relayout after styles have been set
+}
+
+/**
+ * @brief Connect to the EventProcessingFinishedSignal
+ *
+ * Needs to be called only once, but will still operate successfully if called multiple times.
+ * Makes the assumption that this is the only thing connecting to the EventProcessingFinishedSignal.
+ */
+inline void ConnectEventProcessingFinishedSignal()
+{
+  Stage stage = Stage::GetCurrent();
+
+  // This is only intended for one purpose!
+  if( stage.EventProcessingFinishedSignal().GetConnectionCount() == 0 )
+  {
+    stage.EventProcessingFinishedSignal().Connect( &EventProcessingFinishedSignalPrioritizer );
+  }
+}
+
+} // namespace Util
+
+} // namespace Internal
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_INTERNAL_STYLE_MANAGER_H__
+
@@ -113,9 +113,9 @@ BaseHandle Builder::Create( const std::string& templateName, const PropertyValue
   return GetImpl(*this).Create( templateName, map );
 }
 
-void Builder::ApplyStyle( const std::string& styleName, Handle& handle )
+bool Builder::ApplyStyle( const std::string& styleName, Handle& handle )
 {
-  GetImpl(*this).ApplyStyle( styleName, handle );
+  return GetImpl(*this).ApplyStyle( styleName, handle );
 }
 
 void Builder::AddActors( Actor toActor )
@@ -140,7 +140,9 @@ typedef std::map<std::string, Property::Value> PropertyValueMap;
    * @brief Adds or modifies a user defined constant to all future style template or animation expansions
    *
    * e.g.
-   *  builder.AddConstant( "IMAGE_DIRECTORY", "/usr/share/images" );
+   * @code
+   * builder.AddConstant( "IMAGE_DIRECTORY", "/usr/share/images" );
+   * @endcode
    *
    * @pre The Builder has been initialized.
    * @param key The constant name to add or update
@@ -152,9 +154,11 @@ typedef std::map<std::string, Property::Value> PropertyValueMap;
    * @brief Gets all currently defined constants.
    *
    * e.g.
-   *  PropertyValueMap map = builder.GetConstants(); // get copy of current constants
-   *  map["IMAGE_DIRECTORY"] = "/usr/share/images";  // make modification
-   *  builder.AddConstants( map );                   // write back changes
+   * @code
+   * PropertyValueMap map = builder.GetConstants(); // get copy of current constants
+   * map["IMAGE_DIRECTORY"] = "/usr/share/images";  // make modification
+   * builder.AddConstants( map );                   // write back changes
+   * @endcode
    *
    * @pre The Builder has been initialized.
    * @return A reference to the currently defined constants.
@@ -165,9 +169,11 @@ typedef std::map<std::string, Property::Value> PropertyValueMap;
    * @brief Gets a currently defined constant, or returns Property::INVALID
    *
    * e.g.
-   *  PropertyValueMap map = builder.GetConstants(); // get copy of current constants
-   *  map["IMAGE_DIRECTORY"] = "/usr/share/images";  // make modification
-   *  builder.AddConstants( map );                   // write back changes
+   * @code
+   * PropertyValueMap map = builder.GetConstants(); // get copy of current constants
+   * map["IMAGE_DIRECTORY"] = "/usr/share/images";  // make modification
+   * builder.AddConstants( map );                   // write back changes
+   * @endcode
    *
    * @pre The Builder has been initialized.
    * @param key The constant name to search for.
@@ -292,8 +298,10 @@ typedef std::map<std::string, Property::Value> PropertyValueMap;
    * @pre Preconditions have been met for creating dali objects ie Images, Actors etc
    * @param styleName The name of the set of style properties to set on the handle object.
    * @param handle Then handle of the object on which to set the properties.
+   *
+   * @return Return true if the style was found
    */
-  void ApplyStyle( const std::string& styleName, Handle& handle );
+  bool ApplyStyle( const std::string& styleName, Handle& handle );
 
   /**
    * Add the actor tree in the "stage" section to the actor toActor.
index 9e85139..d8d1e36 100644 (file)
 
 #include <dali/integration-api/debug.h>
 
-#include "dali-toolkit/internal/controls/style-change-processor.h"
 #include "dali-toolkit/internal/controls/relayout-controller.h"
 #include "dali-toolkit/internal/controls/relayout-helper.h"
 #include "dali-toolkit/public-api/focus-manager/keyinput-focus-manager.h"
 #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/internal/styling/style-manager-impl.h>
+
 namespace Dali
 {
 
@@ -252,7 +254,8 @@ public:
     mIsKeyboardNavigationSupported(false),
     mIsKeyboardFocusGroup(false),
     mKeyEventSignalV2(),
-    mBackground( NULL )
+    mBackground( NULL ),
+    mFlags( Control::CONTROL_BEHAVIOUR_NONE )
   {
   }
 
@@ -527,6 +530,8 @@ public:
   // Background
   Background* mBackground;           ///< Only create the background if we use it
 
+  ControlBehaviour mFlags;           ///< Flags passed in from constructor
+
   // Properties - these need to be members of Internal::Control::Impl as they need to functions within this class.
   static PropertyRegistration PROPERTY_1;
   static PropertyRegistration PROPERTY_2;
@@ -548,7 +553,7 @@ PropertyRegistration Control::Impl::PROPERTY_7( CONTROL_TYPE, "key-input-focus",
 Toolkit::Control Control::New()
 {
   // Create the implementation, temporarily owned on stack
-  IntrusivePtr<Control> controlImpl = new Control( false );
+  IntrusivePtr<Control> controlImpl = new Control( CONTROL_BEHAVIOUR_NONE );
 
   // Pass ownership to handle
   Toolkit::Control handle( *controlImpl );
@@ -562,22 +567,26 @@ Toolkit::Control Control::New()
 
 Control::~Control()
 {
-  if( mImpl->mInitialized )
-  {
-    // Unregister only if control has been initialized.
-    Internal::StyleChangeProcessor::Unregister( this );
-  }
   delete mImpl;
 }
 
 void Control::Initialize()
 {
-  // Register with the style change processor so we are informed when the default style changes
-  Internal::StyleChangeProcessor::Register( this );
 
   // Calling deriving classes
   OnInitialize();
 
+  if( mImpl->mFlags & REQUIRES_THEME_CHANGE_SIGNALS )
+  {
+    Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
+
+    // Register for font/theme changes
+    styleManager.ThemeChangeSignal().Connect( this, &ControlImpl::OnThemeChange );
+
+    // Set theme
+    GetImpl( styleManager ).ApplyThemeStyle( GetOwner() );
+  }
+
   mImpl->mInitialized = true;
 }
 
@@ -1179,6 +1188,11 @@ void Control::NegotiateSize( Vector2 allocatedSize, ActorSizeContainer& containe
   Relayout( size, container );
 }
 
+void Control::OnThemeChange( Toolkit::StyleManager styleManager )
+{
+  GetImpl( styleManager ).ApplyThemeStyle( GetOwner() );
+}
+
 bool Control::EmitKeyEventSignal( const KeyEvent& event )
 {
   // Guard against destruction during signal emission
@@ -1222,6 +1236,13 @@ Control::Control( bool requiresTouchEvents )
 {
 }
 
+Control::Control( ControlBehaviour behaviourFlags )
+: CustomActorImpl( behaviourFlags & REQUIRES_TOUCH_EVENTS ),
+  mImpl(new Impl(*this))
+{
+  mImpl->mFlags = behaviourFlags;
+}
+
 } // namespace Internal
 
 } // namespace Toolkit
index 3cd35d4..2b089f7 100644 (file)
@@ -54,7 +54,7 @@ Toolkit::ScrollConnector ScrollComponentImpl::GetScrollConnector() const
 }
 
 ScrollComponentImpl::ScrollComponentImpl()
-: Control(true/*requires touch*/)
+: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) )
 {
 }
 
index dbca37b..089896c 100755 (executable)
@@ -48,7 +48,11 @@ public_api_base_src_files = \
   $(public_api_base_src_dir)/focus-manager/keyinput-focus-manager.cpp \
   $(public_api_base_src_dir)/markup-processor/markup-processor.cpp \
   $(public_api_base_src_dir)/shader-effects/image-region-effect.cpp \
-  $(public_api_base_src_dir)/shader-effects/bouncing-effect.cpp
+  $(public_api_base_src_dir)/shader-effects/bouncing-effect.cpp \
+  $(public_api_base_src_dir)/styling/style-manager.cpp \
+  $(public_api_base_src_dir)/builder/builder.cpp \
+  $(public_api_base_src_dir)/builder/json-parser.cpp \
+  $(public_api_base_src_dir)/builder/tree-node.cpp
 
 # Add public header files here
 
@@ -101,3 +105,12 @@ public_api_base_markup_processor_header_files =
 public_api_base_shader_effects_header_files = \
   $(public_api_base_src_dir)/shader-effects/bouncing-effect.h
 
+public_api_base_styling_header_files = \
+  $(public_api_base_src_dir)/styling/style-manager.h
+
+public_api_base_builder_header_files = \
+  $(public_api_base_src_dir)/builder/builder.h \
+  $(public_api_base_src_dir)/builder/json-parser.h \
+  $(public_api_base_src_dir)/builder/tree-node.h
+
+
diff --git a/base/dali-toolkit/public-api/styling/style-manager.cpp b/base/dali-toolkit/public-api/styling/style-manager.cpp
new file mode 100644 (file)
index 0000000..bdef3d1
--- /dev/null
@@ -0,0 +1,104 @@
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// CLASS HEADER
+
+#include <dali-toolkit/public-api/styling/style-manager.h>
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+
+#include <dali-toolkit/internal/styling/style-manager-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+StyleManager::StyleManager()
+{
+}
+
+StyleManager::~StyleManager()
+{
+}
+
+StyleManager StyleManager::Get()
+{
+  return Internal::StyleManager::Get();
+}
+
+void StyleManager::SetOrientationValue( int orientation )
+{
+  GetImpl(*this).SetOrientationValue( orientation );
+}
+
+int StyleManager::GetOrientationValue()
+{
+  return GetImpl(*this).GetOrientationValue();
+}
+
+void StyleManager::SetOrientation( Orientation orientation )
+{
+  GetImpl(*this).SetOrientation( orientation );
+}
+
+Orientation StyleManager::GetOrientation()
+{
+  return GetImpl(*this).GetOrientation();
+}
+
+void StyleManager::SetStyleConstant( const std::string& key, const Property::Value& value )
+{
+  GetImpl(*this).SetStyleConstant( key, value );
+}
+
+bool StyleManager::GetStyleConstant( const std::string& key, Property::Value& valueOut )
+{
+  return GetImpl(*this).GetStyleConstant( key, valueOut );
+}
+
+void StyleManager::ApplyStyle( Toolkit::Control control, const std::string& jsonFileName, const std::string& styleName )
+{
+  GetImpl(*this).ApplyStyle( control, jsonFileName, styleName );
+}
+
+StyleManager::StyleManager( Internal::StyleManager *impl )
+  : BaseHandle( impl )
+{
+}
+
+StyleManager::ThemeChangeSignalType& StyleManager::ThemeChangeSignal()
+{
+  return GetImpl( *this ).ThemeChangeSignal();
+}
+
+void StyleManager::RequestThemeChange( const std::string& themeFile )
+{
+  GetImpl(*this).RequestThemeChange( themeFile );
+}
+
+void StyleManager::RequestDefaultTheme()
+{
+  GetImpl(*this).RequestDefaultTheme();
+}
+
+} // namespace Toolkit
+
+} // namespace Dali
+
diff --git a/base/dali-toolkit/public-api/styling/style-manager.h b/base/dali-toolkit/public-api/styling/style-manager.h
new file mode 100644 (file)
index 0000000..6b42f8d
--- /dev/null
@@ -0,0 +1,190 @@
+#ifndef __DALI_TOOLKIT_STYLE_MANAGER_H__
+#define __DALI_TOOLKIT_STYLE_MANAGER_H__
+
+//
+// Copyright (c) 2014 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+#include <dali/dali.h>
+#include <dali-toolkit/public-api/controls/control.h>
+
+namespace Dali DALI_IMPORT_API
+{
+
+namespace Toolkit
+{
+
+namespace Internal DALI_INTERNAL
+{
+class StyleManager;
+}
+
+/**
+ * @brief StyleManager provides the following functionalities:
+ *
+ * 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.
+ *
+ * If the application wants to customize the theme, RequestThemeChange needs to be called.
+ * Also, the default orientation is Portrait, if the application wants to adapt to the orientation change, call SetOrientation or SetOrienationValue.
+ * @code
+ *   const char* CUSTOM_THEME = DALI_SCRIPT_DIR "tizen-dark-theme.json";
+ *
+ *   void OnInit(Application& app)
+ *   {
+ *      Toolkit::StyleManager::Get().RequestThemeChange( CUSTOM_THEME );
+ *      Toolkit::StyleManager::Get().SetOrientation( app.GetOrientation() );
+ *      ...
+ *   }
+ * @endcode
+ *
+ * Internal::Control can be configured to register for the signals that are required from StyleManager,
+ * such as theme change.
+ */
+class StyleManager : public BaseHandle
+{
+public:
+
+  // Signals
+  typedef SignalV2< void ( StyleManager ) > ThemeChangeSignalType;
+
+  /**
+   * @brief Create a StyleManager handle; this can be initialised with StyleManager::Get()
+   * Calling member functions with an uninitialised handle is not allowed.
+   */
+  StyleManager();
+
+  /**
+   * @brief Virtual destructor.
+   */
+  virtual ~StyleManager();
+
+  /**
+   * @brief Get the singleton of StyleManager object.
+   *
+   * @return A handle to the StyleManager control.
+   */
+  static StyleManager Get();
+
+  /**
+   * @brief Specify the orientation value directly for the style manager
+   *
+   * @param[in] orientation The orientation in degrees
+   */
+  void SetOrientationValue( int orientation );
+
+  /**
+   * @brief Return the orientation value
+   *
+   * @return The orientation value
+   */
+  int GetOrientationValue();
+
+  /**
+   * @brief Set the orientation object. This will take precedence over setting the orientation value.
+   *
+   * @param[in] orientation Device orientation
+   */
+  void SetOrientation( Orientation orientation );
+
+  /**
+   * @brief Return the orientation object
+   *
+   * @return The orientation.
+   */
+  Orientation GetOrientation();
+
+  /**
+   * @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.
+   *
+   * @param[in] themeFile This is just the JSON theme file name and not the full path.
+   */
+  void RequestThemeChange( const std::string& themeFile );
+
+  /**
+   * @brief Request a change to the default theme
+   */
+  void RequestDefaultTheme();
+
+  /**
+   * @brief Set a constant for use when building styles
+   *
+   * A constant is used in JSON files e.g. "my-image":"{ROOT_PATH}/mypath/image.jpg"
+   * where the string "{ROOT_PATH}" is substituted with the value.
+   *
+   * @param[in] key The key of the constant
+   * @param[in] value The value of the constant
+   */
+  void SetStyleConstant( const std::string& key, const Property::Value& value );
+
+  /**
+   * @brief Return the style constant set for a specific key
+   *
+   * @param[in] key The key of the constant
+   * @param[out] valueOut The value of the constant if it exists
+   *
+   * @return If the constant for key exists then return the constant in valueOut and return true
+   */
+  bool GetStyleConstant( const std::string& key, Property::Value& valueOut );
+
+  /**
+   * @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.
+   * @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 );
+
+public: // Signals
+
+  /**
+   * @brief This signal is emitted whenever the theme is changed on device
+   * A callback of the following type may be connected:
+   * @code
+   *   void YourCallbackName( StyleManager styleManager );
+   * @endcode
+   * @return The signal to connect to.
+   */
+  ThemeChangeSignalType& ThemeChangeSignal();
+
+public:
+
+  /**
+   * @brief Creates a new handle from the implementation.
+   *
+   * @param[in] impl A pointer to the object.
+   */
+  explicit DALI_INTERNAL StyleManager( Internal::StyleManager *impl );
+
+}; // class StyleManager
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+
+#endif /* __DALI_TOOLKIT_STYLE_MANAGER_H__ */
diff --git a/base/dali-toolkit/styles/file.list b/base/dali-toolkit/styles/file.list
new file mode 100644 (file)
index 0000000..83a6e26
--- /dev/null
@@ -0,0 +1,4 @@
+# Files to install here
+
+dali_toolkit_style_files =\
+    $(toolkit_base_styles_dir)/*.json
diff --git a/base/dali-toolkit/styles/tizen-dark-theme.json b/base/dali-toolkit/styles/tizen-dark-theme.json
new file mode 100644 (file)
index 0000000..4f1e5d7
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+Copyright (c) 2000-2014 Samsung Electronics Co., Ltd All Rights Reserved
+
+This file is part of Dali Toolkit
+
+PROPRIETARY/CONFIDENTIAL
+
+This software is the confidential and proprietary information of
+SAMSUNG ELECTRONICS ("Confidential Information"). You shall not
+disclose such Confidential Information and shall use it only in
+accordance with the terms of the license agreement you entered
+into with SAMSUNG ELECTRONICS.
+
+SAMSUNG make no representations or warranties about the suitability
+of the software, either express or implied, including but not limited
+to the implied warranties of merchantability, fitness for a particular
+purpose, or non-infringement. SAMSUNG shall not be liable for any
+damages suffered by licensee as a result of using, modifying or
+distributing this software or its derivatives.
+*/
+
+
+
+//******************************************************************************
+//
+// Default style theme for Tizen dark theme, The values should come from
+// UX design document.
+//
+//******************************************************************************
+
+{
+  "styles":
+  {
+  }
+}
\ No newline at end of file
diff --git a/base/dali-toolkit/styles/tizen-default-theme.json b/base/dali-toolkit/styles/tizen-default-theme.json
new file mode 120000 (symlink)
index 0000000..c09c1a1
--- /dev/null
@@ -0,0 +1 @@
+tizen-dark-theme.json
\ No newline at end of file
index 50eaa34..111aea3 100644 (file)
 # Base files
 toolkit_base_images_dir = ../../../base/dali-toolkit/images
 toolkit_base_sounds_dir = ../../../base/dali-toolkit/sounds
+toolkit_base_styles_dir = ../../../base/dali-toolkit/styles
 toolkit_base_src_dir    = ../../../base/dali-toolkit/internal
 public_api_base_src_dir = ../../../base/dali-toolkit/public-api
 
 include ../../../base/dali-toolkit/images/file.list
 include ../../../base/dali-toolkit/sounds/file.list
+include ../../../base/dali-toolkit/styles/file.list
 include ../../../base/dali-toolkit/internal/file.list
 include ../../../base/dali-toolkit/public-api/file.list
 
@@ -33,6 +35,9 @@ include ../../../base/dali-toolkit/public-api/file.list
 #dalisounddir = ${dataReadOnlyDir}/toolkit/sounds/
 #dalisound_DATA = ${dali_toolkit_base_sound_files}
 
+#dalistyledir = ${dataReadOnlyDir}/toolkit/styles/
+#dalistyle_DATA = ${dali_toolkit_style_files}
+
 # The Base library
 lib_LTLIBRARIES = libdali-toolkit-base.la
 
@@ -43,8 +48,11 @@ libdali_toolkit_base_la_SOURCES = \
 libdali_toolkit_base_la_DEPENDENCIES =
 
 libdali_toolkit_base_la_CXXFLAGS = -DDALI_COMPILATION \
+                      -DDALI_TOOLKIT_BASE \
                       -DDALI_IMAGE_DIR="\"${daliimagedir}\"" \
                       -DDALI_SOUND_DIR="\"${dalisounddir}\"" \
+                      -DDALI_STYLE_DIR="\"${dalistyledir}\"" \
+                      -DDALI_DATA_READ_ONLY_DIR="\"${dataReadOnlyDir}\"" \
                       -Werror -Wall \
                       -I../../../base \
                       -I../../../capi \
index 79f3c62..3d8c4cc 100644 (file)
 # Base files
 toolkit_base_images_dir = ../../../base/dali-toolkit/images
 toolkit_base_sounds_dir = ../../../base/dali-toolkit/sounds
+toolkit_base_styles_dir = ../../../base/dali-toolkit/styles
 toolkit_base_src_dir    = ../../../base/dali-toolkit/internal
 public_api_base_src_dir = ../../../base/dali-toolkit/public-api
 
 include ../../../base/dali-toolkit/images/file.list
 include ../../../base/dali-toolkit/sounds/file.list
+include ../../../base/dali-toolkit/styles/file.list
 include ../../../base/dali-toolkit/internal/file.list
 include ../../../base/dali-toolkit/public-api/file.list
 
@@ -58,11 +60,16 @@ libdali_toolkit_la_SOURCES = \
                      $(toolkit_optional_src_files) \
                      $(public_api_optional_src_files)
 
+dalistyledir = ${dataReadOnlyDir}/toolkit/styles/
+dalistyle_DATA = ${dali_toolkit_style_files}
+
 libdali_toolkit_la_DEPENDENCIES =
 
 libdali_toolkit_la_CXXFLAGS = -DDALI_COMPILATION \
                       -DDALI_IMAGE_DIR="\"${daliimagedir}\"" \
                       -DDALI_SOUND_DIR="\"${dalisounddir}\"" \
+                      -DDALI_STYLE_DIR="\"${dalistyledir}\"" \
+                      -DDALI_DATA_READ_ONLY_DIR="\"${dataReadOnlyDir}\"" \
                       -Werror -Wall \
                       -I../../../base \
                       -I../../../optional \
@@ -103,6 +110,8 @@ publicapibasefactorydir = $(publicapibasedir)/factory
 publicapibasefocusmanagerdir = $(publicapibasedir)/focus-manager
 publicapibasemarkupprocessordir = $(publicapibasedir)/markup-processor
 publicapibaseshadereffectsdir = $(publicapibasedir)/shader-effects
+publicapibasestylingdir = $(publicapibasedir)/styling
+publicapibasebuilderdir = $(publicapibasedir)/builder
 
 publicapibase_HEADERS = $(public_api_base_header_files)
 publicapibasecontrols_HEADERS = $(public_api_base_controls_header_files)
@@ -122,6 +131,8 @@ publicapibasefactory_HEADERS = $(public_api_base_factory_header_files)
 publicapibasefocusmanager_HEADERS = $(public_api_base_focus_manager_header_files)
 publicapibasemarkupprocessor_HEADERS = $(public_api_base_markup_processor_header_files)
 publicapibaseshadereffects_HEADERS = $(public_api_base_shader_effects_header_files)
+publicapibasestyling_HEADERS = $(public_api_base_styling_header_files)
+publicapibasebuilder_HEADERS = $(public_api_base_builder_header_files)
 
 # Install Optional headers
 
@@ -147,7 +158,6 @@ publicapioptionalviewdir = $(publicapioptionaldir)/controls/view
 publicapioptionalnavigationframedir = $(publicapioptionaldir)/controls/navigation-frame
 publicapioptionalshadereffectsdir = $(publicapioptionaldir)/shader-effects
 publicapioptionalbubbleeffectdir = $(publicapioptionaldir)/shader-effects/bubble-effect
-publicapioptionalbuilderdir = $(publicapioptionaldir)/builder
 publicapioptionaltransitioneffectsdir = $(publicapioptionaldir)/transition-effects
 
 publicapioptional_HEADERS = $(public_api_optional_header_files)
@@ -169,7 +179,6 @@ publicapioptionalview_HEADERS = $(public_api_optional_view_header_files)
 publicapioptionalnavigationframe_HEADERS = $(public_api_optional_navigation_frame_header_files)
 publicapioptionalshadereffects_HEADERS = $(public_api_optional_shader_effects_header_files)
 publicapioptionalbubbleeffect_HEADERS = $(public_api_optional_bubble_effect_header_files)
-publicapioptionalbuilder_HEADERS = $(public_api_optional_builder_header_files)
 publicapioptionaltransitioneffects_HEADERS = $(public_api_optional_transition_effects_header_files)
 
 # Install CAPI headers
@@ -212,6 +221,7 @@ capidevelstyledtextutilitiesdir = $(capideveldir)/styled-text-utilities
 capidevelbuilderdir = $(capideveldir)/builder
 capidevelutilitiesdir = $(capideveldir)/utilities
 capideveltransitioneffectsdir = $(capideveldir)/transition-effects
+capidevelstylingdir = $(capideveldir)/styling
 
 capidevel_HEADERS = $(capi_devel_header_files)
 capidevelcontrols_HEADERS = $(capi_devel_controls_header_files)
@@ -251,3 +261,5 @@ capidevelstyledtextutilities_HEADERS = $(capi_devel_styled_text_utilities_header
 capidevelbuilder_HEADERS = $(capi_devel_builder_header_files)
 capidevelutilities_HEADERS = $(capi_devel_utilities_header_files)
 capideveltransitioneffects_HEADERS = $(capi_devel_transition_effects_header_files)
+capidevelstyling_HEADERS = $(capi_devel_styling_header_files)
+
index 3fbcba9..3ab3acf 100644 (file)
@@ -35,7 +35,6 @@ class StyleManager;
 
 namespace Internal DALI_INTERNAL
 {
-class StyleChangeProcessor;
 class RelayoutControllerImpl;
 class KeyInputFocusManager;
 }
@@ -300,12 +299,9 @@ private: // For derived classes to override
   virtual void OnInitialize() { }
 
   /**
-   * @brief This method should be overridden by deriving classes when
-   * they wish to be notified when the style changes.
-   *
-   * @param[in] change  Information denoting what has changed.
+   * @brief Callback for when the theme changes.
    */
-  virtual void OnStyleChange(StyleChange change) { }
+  virtual void OnThemeChange( Toolkit::StyleManager styleManager );
 
   /**
    * @brief Called whenever a pinch gesture is detected on this control.
@@ -524,13 +520,29 @@ private:
 
 protected: // Construction
 
+  // Flags for the constructor
+  enum ControlBehaviour
+  {
+    CONTROL_BEHAVIOUR_NONE        = 0x0,
+    REQUIRES_TOUCH_EVENTS         = 0x1,     ///< True if the OnTouchEvent() callback is required.
+    REQUIRES_THEME_CHANGE_SIGNALS = 0x2      ///< True if this control should listen to theme change signals
+  };
+
   /**
+   * @deprecated Use the constructor taking flags instead
    * @brief Create a Control.
    *
    * @param[in] requiresTouchEvents True if the OnTouchEvent() callback is required.
    */
   Control(bool requiresTouchEvents);
 
+  /**
+   * @brief Create a Control.
+   *
+   * @param[in] behaviourFlags Behavioural flags from ControlBehaviour enum
+   */
+  Control(ControlBehaviour behaviourFlags);
+
 public:
 
   // Size negotiation
@@ -706,7 +718,6 @@ private:
   class Impl;
   Impl *mImpl;
 
-  friend class Internal::StyleChangeProcessor;
   friend class Internal::RelayoutControllerImpl;   ///< Relayout controller needs to call Relayout() which is private.
   friend class Internal::KeyInputFocusManager;     ///< KeyInputFocusManager needs to call which is private.
 };
index 6f89000..1c13d50 100644 (file)
@@ -60,5 +60,4 @@
 #include <dali-toolkit/public-api/shader-effects/ripple2d-effect.h>
 #include <dali-toolkit/public-api/shader-effects/swirl-effect.h>
 
-
 #endif // __DALI_TOOLKIT_CAPI_INTERNAL_H__
index caf2cb3..a878f04 100644 (file)
@@ -85,3 +85,4 @@ capi_devel_shader_effects_header_files =               \
   $(capi_devel_src_dir)/shader-effects/ripple-effect.h \
   $(capi_devel_src_dir)/shader-effects/ripple2d-effect.h \
   $(capi_devel_src_dir)/shader-effects/swirl-effect.h
+
index ed080fe..3d88968 100644 (file)
@@ -20,8 +20,6 @@
 #include <dali-toolkit/public-api/dali-toolkit-capi-internal.h>
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/public-api/builder/builder.h>
-#include <dali-toolkit/public-api/builder/tree-node.h>
 
 #include <dali-toolkit/public-api/controls/bloom-view/bloom-view.h>
 #include <dali-toolkit/public-api/controls/buttons/check-box-button.h>
@@ -89,4 +87,5 @@
 #include <dali-toolkit/public-api/transition-effects/cube-transition-cross-effect.h>
 #include <dali-toolkit/public-api/transition-effects/cube-transition-fold-effect.h>
 
+
 #endif // __DALI_TOOLKIT_EXT_H__
index dde4f19..4872d4a 100644 (file)
@@ -119,7 +119,7 @@ const char* const COMPOSITE_FRAGMENT_SOURCE =
 
 
 BloomView::BloomView()
-  : Control( false )  // doesn't require touch events
+  : Control( CONTROL_BEHAVIOUR_NONE )
   , mBlurNumSamples(BLOOM_GAUSSIAN_BLUR_VIEW_DEFAULT_NUM_SAMPLES)
   , mBlurBellCurveWidth(BLOOM_GAUSSIAN_BLUR_VIEW_DEFAULT_BLUR_BELL_CURVE_WIDTH)
   , mPixelFormat(BLOOM_GAUSSIAN_BLUR_VIEW_DEFAULT_RENDER_TARGET_PIXEL_FORMAT)
@@ -141,7 +141,7 @@ BloomView::BloomView()
 
 BloomView::BloomView( const unsigned int blurNumSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat,
                                     const float downsampleWidthScale, const float downsampleHeightScale)
-  : Control( false )  // doesn't require touch events
+  : Control( CONTROL_BEHAVIOUR_NONE )
   , mBlurNumSamples(blurNumSamples)
   , mBlurBellCurveWidth(blurBellCurveWidth)
   , mPixelFormat(renderTargetPixelFormat)
index 8083191..ee36706 100644 (file)
@@ -36,7 +36,7 @@ BubbleEmitter::BubbleEmitter( const Vector2& movementArea,
                               Image shapeImage,
                               unsigned int maximumNumberOfBubble,
                               const Vector2& bubbleSizeRange )
-: Control( true ),
+: Control( REQUIRES_TOUCH_EVENTS ),
   mMovementArea( movementArea ),
   mShapeImage( shapeImage ),
   mTotalNumOfBubble( maximumNumberOfBubble ),
index 5659788..4a5e45e 100644 (file)
@@ -80,7 +80,7 @@ Dali::Toolkit::Cluster Cluster::New(Toolkit::ClusterStyle& style)
 }
 
 Cluster::Cluster(Toolkit::ClusterStyle& style)
-: Control(true/*requires touch*/),
+: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ),
   mClusterStyle(style),
   mExpandedCount(0)
 {
index ef36347..c8cb42b 100644 (file)
@@ -100,7 +100,7 @@ Toolkit::EffectsView EffectsView::New()
 }
 
 EffectsView::EffectsView()
-: Control( false ),
+: Control( CONTROL_BEHAVIOUR_NONE ),
   mEffectType( Toolkit::EffectsView::INVALID_TYPE ),
   mPixelFormat( EFFECTS_VIEW_DEFAULT_PIXEL_FORMAT ),
   mSpread(0.0f),
index b77a121..126ada3 100644 (file)
@@ -111,9 +111,8 @@ const char* const GAUSSIAN_BLUR_FRAGMENT_SOURCE =
 
 
 GaussianBlurView::GaussianBlurView()
-  : Control( false )  // doesn't require touch events
+  : Control( CONTROL_BEHAVIOUR_NONE )
   , mNumSamples(GAUSSIAN_BLUR_VIEW_DEFAULT_NUM_SAMPLES)
-
   , mPixelFormat(GAUSSIAN_BLUR_VIEW_DEFAULT_RENDER_TARGET_PIXEL_FORMAT)
   , mDownsampleWidthScale(GAUSSIAN_BLUR_VIEW_DEFAULT_DOWNSAMPLE_WIDTH_SCALE)
   , mDownsampleHeightScale(GAUSSIAN_BLUR_VIEW_DEFAULT_DOWNSAMPLE_HEIGHT_SCALE)
@@ -132,7 +131,7 @@ GaussianBlurView::GaussianBlurView()
 GaussianBlurView::GaussianBlurView( const unsigned int numSamples, const float blurBellCurveWidth, const Pixel::Format renderTargetPixelFormat,
                                     const float downsampleWidthScale, const float downsampleHeightScale,
                                     bool blurUserImage)
-  : Control( false )  // doesn't require touch events
+  : Control( CONTROL_BEHAVIOUR_NONE )
   , mNumSamples(numSamples)
   , mPixelFormat(renderTargetPixelFormat)
   , mDownsampleWidthScale(downsampleWidthScale)
index 68782e9..edd6f4a 100644 (file)
@@ -86,7 +86,7 @@ Dali::Toolkit::ImageView ImageView::New()
 }
 
 ImageView::ImageView()
-: Control(true)
+: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) )
 {
 }
 
index 0422021..38a05a4 100644 (file)
@@ -474,7 +474,7 @@ Dali::Toolkit::MaskedImageView::MaskedImageViewSignal& MaskedImageView::MaskFini
 }
 
 MaskedImageView::MaskedImageView()
-: Control(true),
+: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ),
   mEditMode( Dali::Toolkit::MaskedImageView::EDIT_DISABLED ),
   mSelfPropertySetting( false ),
   mSourceRotation( Dali::Toolkit::MaskedImageView::ROTATE_0 ),
index cbe156b..9c42637 100644 (file)
@@ -161,7 +161,7 @@ Dali::Toolkit::Magnifier Magnifier::New()
 }
 
 Magnifier::Magnifier()
-: Control(true),
+: Control( REQUIRES_TOUCH_EVENTS ),
   mPropertySourcePosition(Property::INVALID_INDEX),
   mActorSize(Vector3::ZERO),
   mMagnificationFactor(1.0f)
index 8731515..71b5441 100644 (file)
@@ -46,7 +46,7 @@ TypeAction a2(mType, Toolkit::NavigationControl::ACTION_POP, &NavigationControl:
 }
 
 NavigationControl::NavigationControl()
-: Control( true ),
+: Control( REQUIRES_TOUCH_EVENTS ),
   mToolBar(NULL),
   mTitleBar(NULL),
   mOrientationAngle( 0 ),
index 4e5c50e..d681218 100644 (file)
@@ -44,7 +44,7 @@ TypeRegistration mType( typeid(Toolkit::Page), typeid(CustomActor), Create );
 } // unnamed namespace
 
 Page::Page()
-: Control(false),
+: Control( CONTROL_BEHAVIOUR_NONE ),
   mTitle(""),
   mSubTitle("")
 {
index f508b54..4a2c079 100644 (file)
@@ -250,7 +250,7 @@ const int PageTurnView::NUMBER_OF_CACHED_PAGES = NUMBER_OF_CACHED_PAGES_EACH_SID
 const float PageTurnView::STATIC_PAGE_INTERVAL_DISTANCE = 1.0f;
 
 PageTurnView::PageTurnView( PageFactory& pageFactory, const Vector2& pageSize )
-: Control( true ),
+: Control( REQUIRES_TOUCH_EVENTS ),
   mPageFactory( pageFactory ),
   mPageSize( pageSize ),
   mIsEditMode( false ),
index dabae5e..9f36b9d 100644 (file)
@@ -101,7 +101,7 @@ void RotatingSelector::OnInitialize()
 }
 
 RotatingSelector::RotatingSelector()
-: Control(true/*requires touch*/),
+: Control( REQUIRES_TOUCH_EVENTS ),
   mSelected(false),
   mSelectable(true),
   mIsAnimating(false)
index ec3197a..b3bb8a5 100644 (file)
@@ -116,7 +116,7 @@ struct EqualToConstraintMatrix
 } // namespace
 
 ShadowView::ShadowView( float downsampleWidthScale, float downsampleHeightScale )
-: Control( false ),  // doesn't require touch events
+: Control( CONTROL_BEHAVIOUR_NONE ),
   mChildrenRoot(Actor::New()),
   mCachedShadowColor(DEFAULT_SHADOW_COLOR),
   mCachedBackgroundColor(DEFAULT_SHADOW_COLOR.r, DEFAULT_SHADOW_COLOR.g, DEFAULT_SHADOW_COLOR.b, 0.0f),
index 7ec9d7b..8a3bbb2 100755 (executable)
@@ -168,7 +168,7 @@ Dali::Toolkit::Slider Slider::New()
 }
 
 Slider::Slider()
-: Control( true ),
+: Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_THEME_CHANGE_SIGNALS ) ),
   mState( NORMAL ),
   mDisableColor( 0.0f, 0.0f, 0.0f, 0.0f ),
   mPopupTextColor( 0.0f, 0.0f, 0.0f, 0.0f ),
index fdbcd34..7ad168f 100644 (file)
@@ -97,7 +97,7 @@ PropertyRegistration property1( typeRegistration, "image", Toolkit::SuperBlurVie
 } // unnamed namespace
 
 SuperBlurView::SuperBlurView( unsigned int blurLevels )
-: Control( false ),
+: Control( CONTROL_BEHAVIOUR_NONE ),
   mBlurLevels( blurLevels ),
   mBlurStrengthPropertyIndex(Property::INVALID_INDEX),
   mResourcesCleared( true ),
index 703cf87..0a52092 100644 (file)
@@ -287,7 +287,7 @@ void ToolBar::RemoveControl( Actor control )
 }
 
 ToolBar::ToolBar()
-: Control( false ),  // doesn't require touch events
+: Control( CONTROL_BEHAVIOUR_NONE ),
   mLayout(),
   mLeftOffset( 0 ),
   mCenterBase( 1 ),
index b27d509..6877c2d 100644 (file)
@@ -269,7 +269,7 @@ bool View::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* trac
 }
 
 View::View(bool fullscreen)
-: Control( false ),  // doesn't require touch events
+: Control( CONTROL_BEHAVIOUR_NONE ),
   mOrientation( -1 ),
   mFullScreen(fullscreen),
   mContentLayers(),
index 5e214a4..797c08b 100644 (file)
@@ -1,15 +1,6 @@
 # Add local source files here
 
 toolkit_optional_src_files = \
-   $(toolkit_optional_src_dir)/builder/builder-impl.cpp \
-   $(toolkit_optional_src_dir)/builder/builder-animations.cpp \
-   $(toolkit_optional_src_dir)/builder/builder-set-property.cpp \
-   $(toolkit_optional_src_dir)/builder/builder-signals.cpp \
-   $(toolkit_optional_src_dir)/builder/builder-actor.cpp \
-   $(toolkit_optional_src_dir)/builder/json-parser-state.cpp \
-   $(toolkit_optional_src_dir)/builder/json-parser-impl.cpp \
-   $(toolkit_optional_src_dir)/builder/tree-node-manipulator.cpp \
-   $(toolkit_optional_src_dir)/builder/replacement.cpp \
    $(toolkit_optional_src_dir)/controls/bloom-view/bloom-view-impl.cpp \
    $(toolkit_optional_src_dir)/controls/cluster/cluster-impl.cpp \
    $(toolkit_optional_src_dir)/controls/cluster/cluster-style-impl.cpp \
index a97558c..ba93b35 100755 (executable)
@@ -49,14 +49,11 @@ public_api_optional_src_files = \
   $(public_api_optional_src_dir)/shader-effects/water-effect.cpp \
   $(public_api_optional_src_dir)/shader-effects/bubble-effect/bubble-effect.cpp \
   $(public_api_optional_src_dir)/shader-effects/bubble-effect/color-adjuster.cpp \
-  $(public_api_optional_src_dir)/builder/builder.cpp \
-  $(public_api_optional_src_dir)/builder/json-parser.cpp \
-  $(public_api_optional_src_dir)/builder/tree-node.cpp \
   $(public_api_optional_src_dir)/transition-effects/cube-transition-effect.cpp \
   $(public_api_optional_src_dir)/transition-effects/cube-transition-wave-effect.cpp \
   $(public_api_optional_src_dir)/transition-effects/cube-transition-cross-effect.cpp \
   $(public_api_optional_src_dir)/transition-effects/cube-transition-fold-effect.cpp
-
+  
 # Add public header files here
 
 public_api_optional_header_files =
@@ -135,13 +132,9 @@ public_api_optional_bubble_effect_header_files =  \
 
 public_api_optional_bubble_emitter_header_files =
 
-public_api_optional_builder_header_files = \
-  $(public_api_optional_src_dir)/builder/builder.h \
-  $(public_api_optional_src_dir)/builder/json-parser.h \
-  $(public_api_optional_src_dir)/builder/tree-node.h
-
 public_api_optional_transition_effects_header_files = \
   $(public_api_optional_src_dir)/transition-effects/cube-transition-effect.h \
   $(public_api_optional_src_dir)/transition-effects/cube-transition-wave-effect.h \
   $(public_api_optional_src_dir)/transition-effects/cube-transition-cross-effect.h \
   $(public_api_optional_src_dir)/transition-effects/cube-transition-fold-effect.h
+
index 20eb0dd..ee41211 100644 (file)
@@ -56,6 +56,7 @@ all the controls provided by the main package.
 %define dali_data_ro_dir            /usr/share/dali/
 %define dali_toolkit_image_files    %{dali_data_ro_dir}/toolkit/images/
 %define dali_toolkit_sound_files    %{dali_data_ro_dir}/toolkit/sounds/
+%define dali_toolkit_style_files    %{dali_data_ro_dir}/toolkit/styles/
 %define dev_include_path %{_includedir}
 
 ##############################
@@ -123,6 +124,7 @@ exit 0
 %{_libdir}/lib%{name}.so*
 %{dali_toolkit_image_files}/*
 %{dali_toolkit_sound_files}/*
+%{dali_toolkit_style_files}/*
 %{_datadir}/license/%{name}
 
 %files devel