{
+ "config":
+ {
+ "alwaysShowFocus":false
+ },
"constants":
{
"CONFIG_SCRIPT_LOG_LEVEL":"NoLogging"
END_TEST;
}
+
+int UtcDaliBuilderConfigurationP(void)
+{
+ ToolkitTestApplication application;
+
+ // JSON with a quit event when the actor is touched
+ std::string json(
+ "{\n"
+ " \"config\":\n"
+ " {\n"
+ " \"alwaysShowFocus\":true\n"
+ " }\n"
+ "}\n"
+ );
+
+ Builder builder = Builder::New();
+ builder.LoadFromString( json );
+
+ Property::Map map = builder.GetConfigurations();
+
+ Dali::Property::Value* pValue = map.Find( "alwaysShowFocus" );
+
+ DALI_TEST_CHECK( pValue );
+
+ bool value = pValue->Get<bool>();
+
+ DALI_TEST_CHECK( value );
+
+ END_TEST;
+}
END_TEST;
}
+int UtcDaliImageVisualTextureCancelAsyncLoad(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "Load image asynchronosly, cancel loading, then load again" );
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK( factory );
+
+ Property::Map propertyMap;
+ propertyMap.Insert( Visual::Property::TYPE, Visual::IMAGE );
+ propertyMap.Insert( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
+
+ Visual::Base visual = factory.CreateVisual( propertyMap );
+ DALI_TEST_CHECK( visual );
+
+ TestGlAbstraction& gl = application.GetGlAbstraction();
+ TraceCallStack& textureTrace = gl.GetTextureTrace();
+ textureTrace.Enable( true );
+ TraceCallStack& drawTrace = gl.GetDrawTrace();
+ drawTrace.Enable( true );
+
+ DummyControl actor = DummyControl::New();
+ DummyControlImpl& dummyImpl = static_cast< DummyControlImpl& >( actor.GetImplementation() );
+ dummyImpl.RegisterVisual( Control::Property::BACKGROUND, visual );
+
+ Stage::GetCurrent().Add( actor );
+
+ // Cancel loading
+ Stage::GetCurrent().Remove( actor );
+
+ Stage::GetCurrent().Add( actor );
+
+ // Create another visual with the same image
+ visual = factory.CreateVisual( propertyMap );
+ DALI_TEST_CHECK( visual );
+
+ dummyImpl.RegisterVisual( Control::Property::BACKGROUND, visual );
+
+ application.SendNotification();
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( actor.GetRendererCount(), 1u, TEST_LOCATION );
+ DALI_TEST_EQUALS( textureTrace.FindMethod("GenTextures"), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( drawTrace.FindMethod("DrawArrays"), true, TEST_LOCATION );
+
+ END_TEST;
+}
+
int UtcDaliImageVisualSetInvalidAsyncImage(void)
{
ToolkitTestApplication application;
develapiimageloaderdir = $(develapidir)/image-loader
develapiscriptingdir = $(develapidir)/scripting
develapishadereffectsdir = $(develapidir)/shader-effects
+develapistylingdir = $(develapidir)/styling
develapitransitioneffectsdir = $(develapidir)/transition-effects
develapitoolbardir = $(develapicontrolsdir)/tool-bar
develapitooltipdir = $(develapicontrolsdir)/tooltip
develapiscripting_HEADERS = $(devel_api_scripting_header_files)
develapishadowview_HEADERS = $(devel_api_shadow_view_header_files)
develapishadereffects_HEADERS = $(devel_api_shader_effects_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)
develapitooltip_HEADERS = $(devel_api_tooltip_header_files)
GetImpl(*this).AddConstant( key, value );
}
+const Property::Map& Builder::GetConfigurations() const
+{
+ return GetImpl(*this).GetConfigurations();
+}
+
const Property::Map& Builder::GetConstants() const
{
return GetImpl(*this).GetConstants();
void AddConstant( const std::string& key, const Property::Value& value );
/**
+ * @brief Gets all currently defined configurations.
+ *
+ * @pre The Builder has been initialized.
+ * @return A reference to the currently defined configurations.
+ */
+ const Property::Map& GetConfigurations() const;
+
+ /**
* @brief Gets all currently defined constants.
*
* e.g.
$(devel_api_src_dir)/image-loader/atlas-upload-observer.cpp \
$(devel_api_src_dir)/image-loader/image-atlas.cpp \
$(devel_api_src_dir)/scripting/script.cpp \
+ $(devel_api_src_dir)/styling/style-manager-devel.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)/transition-effects/cube-transition-fold-effect.cpp \
$(devel_api_src_dir)/shader-effects/motion-blur-effect.h \
$(devel_api_src_dir)/shader-effects/motion-stretch-effect.h
+devel_api_styling_header_files= \
+ $(devel_api_src_dir)/styling/style-manager-devel.h
+
devel_api_super_blur_view_header_files = \
$(devel_api_src_dir)/controls/super-blur-view/super-blur-view.h
--- /dev/null
+/*
+ * Copyright (c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/devel-api/styling/style-manager-devel.h>
+#include <dali-toolkit/internal/styling/style-manager-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace DevelStyleManager
+{
+
+const Property::Map GetConfigurations( StyleManager styleManager )
+{
+ return GetImpl(styleManager).GetConfigurations();
+}
+
+} // namespace DevelStyleManager
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_STYLE_MANAGER_DEVEL_H
+#define DALI_TOOLKIT_STYLE_MANAGER_DEVEL_H
+
+/*
+ * Copyright (c) 2017 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/styling/style-manager.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace DevelStyleManager
+{
+
+
+/**
+ * @brief Gets all currently defined configurations.
+ *
+ * @pre The Builder has been initialized.
+ * @param[in] styleManager The instance of StyleManager
+ * @return A property map to the currently defined configurations
+**/
+DALI_IMPORT_API const Property::Map GetConfigurations( StyleManager styleManager );
+
+} // namespace DevelStyleManager
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_STYLE_MANAGER_DEVEL_H
}
else
{
+ // load configuration map
+ LoadConfiguration( *parser.GetRoot(), mConfigurationMap );
// load constant map (allows the user to override the constants in the json after loading)
LoadConstants( *parser.GetRoot(), mReplacementMap );
-
// merge includes
if( OptionalChild includes = IsChild(*parser.GetRoot(), KEYNAME_INCLUDES) )
{
mReplacementMap[key] = value;
}
+const Property::Map& Builder::GetConfigurations() const
+{
+ return mConfigurationMap;
+}
+
const Property::Map& Builder::GetConstants() const
{
return mReplacementMap;
{
}
+void Builder::LoadConfiguration( const TreeNode& root, Property::Map& intoMap )
+{
+ Replacement replacer(intoMap);
+
+ if( OptionalChild constants = IsChild(root, "config") )
+ {
+ for(TreeNode::ConstIterator iter = (*constants).CBegin();
+ iter != (*constants).CEnd(); ++iter)
+ {
+ Dali::Property::Value property;
+ if( (*iter).second.GetName() )
+ {
+ DeterminePropertyFromNode( (*iter).second, property, replacer );
+ intoMap[ (*iter).second.GetName() ] = property;
+ }
+ }
+ }
+}
+
void Builder::LoadConstants( const TreeNode& root, Property::Map& intoMap )
{
Replacement replacer(intoMap);
void AddConstant( const std::string& key, const Property::Value& value );
/**
+ * @copydoc Toolkit::Builder::GetConfigurations
+ */
+ const Property::Map& GetConfigurations() const;
+
+ /**
* @copydoc Toolkit::Builder::GetConstants
*/
const Property::Map& GetConstants() const;
void LoadConstants( const TreeNode& root, Property::Map& intoMap );
+ void LoadConfiguration( const TreeNode& root, Property::Map& intoMap );
+
Animation CreateAnimation( const std::string& animationName,
const Replacement& replacement,
Dali::Actor sourceActor );
LinearConstrainerLut mLinearConstrainerLut;
SlotDelegate<Builder> mSlotDelegate;
Property::Map mReplacementMap;
+ Property::Map mConfigurationMap;
MappingsLut mCompleteMappings;
Dictionary<StylePtr> mStyles; // State based styles
Toolkit::Builder::BuilderSignalType mQuitSignal;
#include <dali/public-api/events/touch-data.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/public-api/object/property-map.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/integration-api/debug.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali-toolkit/public-api/styling/style-manager.h>
+#include <dali-toolkit/devel-api/styling/style-manager-devel.h>
namespace Dali
{
mFocusedActorEnterKeySignal(),
mCurrentFocusActor(),
mFocusIndicatorActor(),
+ mIsFocusIndicatorEnabled( -1 ),
mFocusGroupLoopEnabled( false ),
- mIsFocusIndicatorEnabled( false ),
mIsWaitingKeyboardFocusChangeCommit( false ),
mFocusHistory(),
mSlotDelegate( this ),
{
}
+void KeyboardFocusManager::GetConfigurationFromStyleManger()
+{
+ Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
+ if( styleManager )
+ {
+ Property::Map config = Toolkit::DevelStyleManager::GetConfigurations( styleManager );
+ mIsFocusIndicatorEnabled = static_cast<int>(config["alwaysShowFocus"].Get<bool>());
+ }
+}
+
bool KeyboardFocusManager::SetCurrentFocusActor( Actor actor )
{
DALI_ASSERT_DEBUG( !mIsWaitingKeyboardFocusChangeCommit && "Calling this function in the PreFocusChangeSignal callback?" );
+ if( mIsFocusIndicatorEnabled == -1 )
+ {
+ GetConfigurationFromStyleManger();
+ }
+
return DoSetCurrentFocusActor( actor );
}
}
mCurrentFocusActor.Reset();
- mIsFocusIndicatorEnabled = false;
+ mIsFocusIndicatorEnabled = 0;
}
void KeyboardFocusManager::SetFocusGroupLoop(bool enabled)
std::string keyName = event.keyPressedName;
+ if( mIsFocusIndicatorEnabled == -1 )
+ {
+ GetConfigurationFromStyleManger();
+ }
+
bool isFocusStartableKey = false;
if(event.state == KeyEvent::Down)
if(!mIsFocusIndicatorEnabled)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = true;
+ mIsFocusIndicatorEnabled = 1;
}
else
{
if(!mIsFocusIndicatorEnabled)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = true;
+ mIsFocusIndicatorEnabled = 1;
}
else
{
if(!mIsFocusIndicatorEnabled)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = true;
+ mIsFocusIndicatorEnabled = 1;
}
else
{
if(!mIsFocusIndicatorEnabled)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = true;
+ mIsFocusIndicatorEnabled = 1;
}
else
{
if(!mIsFocusIndicatorEnabled)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = true;
+ mIsFocusIndicatorEnabled = 1;
}
else
{
if(!mIsFocusIndicatorEnabled)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = true;
+ mIsFocusIndicatorEnabled = 1;
}
else
{
if(!mIsFocusIndicatorEnabled)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = true;
+ mIsFocusIndicatorEnabled = 1;
}
else
{
if(!mIsFocusIndicatorEnabled)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = true;
+ mIsFocusIndicatorEnabled = 1;
}
isFocusStartableKey = true;
if(!mIsFocusIndicatorEnabled)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = true;
+ mIsFocusIndicatorEnabled = 1;
}
isFocusStartableKey = true;
if(!mIsFocusIndicatorEnabled && !isAccessibilityEnabled)
{
// Show focus indicator
- mIsFocusIndicatorEnabled = true;
+ mIsFocusIndicatorEnabled = 1;
}
else
{
typedef FocusStack::Iterator FocusStackIterator; ///< Define FocusStack::Iterator as FocusStackIterator to navigate FocusStack
/**
+ * Get configuration from StyleManager.
+ */
+ void GetConfigurationFromStyleManger();
+
+ /**
* Get the focus group of current focused actor.
* @pre The FocusManager has been initialized.
* @return A handle to the parent of the current focused actor which is a focus group,
Actor mFocusIndicatorActor; ///< The focus indicator actor shared by all the keyboard focusable actors for highlight
- bool mFocusGroupLoopEnabled:1; ///< Whether the focus movement is looped within the same focus group
+ int mIsFocusIndicatorEnabled; ///< Whether indicator should be shown / hidden when getting focus. It could be enabled when keyboard focus feature is enabled and navigation keys or 'Tab' key are pressed.
- bool mIsFocusIndicatorEnabled:1; ///< Whether indicator should be shown / hidden. It could be enabled when keyboard focus feature enabled and navigation keys or 'Tab' key pressed.
+ bool mFocusGroupLoopEnabled:1; ///< Whether the focus movement is looped within the same focus group
bool mIsWaitingKeyboardFocusChangeCommit:1; /// A flag to indicate PreFocusChangeSignal emitted but the proposed focus actor is not commited by the application yet.
{
bool themeLoaded = false;
- mThemeBuilder = CreateBuilder( mThemeBuilderConstants );
-
- // Always load the default theme first, then merge in the custom theme if present
- themeLoaded = LoadJSON( mThemeBuilder, DEFAULT_THEME );
- mThemeFile = themeFile;
+ if( mThemeFile.compare(DEFAULT_THEME) == 0 && mThemeBuilder )
+ {
+ // We have already loaded the default theme into mThemeBuilder
+ }
+ else
+ {
+ // Reload the default theme
+ mThemeBuilder = CreateBuilder( mThemeBuilderConstants );
+ themeLoaded = LoadJSON( mThemeBuilder, DEFAULT_THEME );
+ }
if( themeFile.compare(DEFAULT_THEME) != 0 )
{
- themeLoaded = LoadJSON( mThemeBuilder, mThemeFile );
+ // The theme is different to the default: Merge it
+ themeLoaded = LoadJSON( mThemeBuilder, themeFile );
+ mThemeFile = themeFile;
}
if( themeLoaded )
}
}
+const Property::Map StyleManager::GetConfigurations()
+{
+ Property::Map result;
+ if( mThemeBuilder )
+ {
+ result = mThemeBuilder.GetConfigurations();
+ }
+ else
+ {
+ bool themeLoaded = false;
+
+ mThemeBuilder = CreateBuilder( mThemeBuilderConstants );
+
+ // Load default theme because this is first try to load stylesheet.
+ themeLoaded = LoadJSON( mThemeBuilder, DEFAULT_THEME );
+ mThemeFile = DEFAULT_THEME;
+
+ if( themeLoaded )
+ {
+ result = mThemeBuilder.GetConfigurations();
+ }
+ }
+
+ return result;
+}
+
bool StyleManager::LoadFile( const std::string& filename, std::string& stringOut )
{
DALI_ASSERT_DEBUG( 0 != filename.length());
bool GetStyleConstant( const std::string& key, Property::Value& valueOut );
/**
+ * @copydoc Toolkit::StyleManager::GetConfigurations
+ */
+ const Property::Map GetConfigurations();
+
+ /**
* @brief Apply the theme style to a control.
*
* @param[in] control The control to apply style.
{
bool atlasing = false;
mAttemptAtlasing = value.Get( atlasing );
+ break;
}
case Toolkit::DevelImageVisual::Property::ALPHA_MASK_URL:
{
mAlphaMaskUrl = VisualUrl( alphaUrl );
}
+ break;
}
}
}
for( unsigned int i = 0; i < count; ++i )
{
TextureInfo& textureInfo( mTextureInfoContainer[i] );
- for( TextureInfo::ObserverListType::Iterator j = textureInfo.observerList.Begin(); j != textureInfo.observerList.End(); ++j )
+ for( TextureInfo::ObserverListType::Iterator j = textureInfo.observerList.Begin(); j != textureInfo.observerList.End(); )
{
if( *j == observer )
{
- textureInfo.observerList.Erase( j );
- break;
+ j = textureInfo.observerList.Erase( j );
+ }
+ else
+ {
+ ++j;
}
}
}
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 45;
+const unsigned int TOOLKIT_MICRO_VERSION = 46;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
//******************************************************************************
{
+ "config":
+ {
+ "alwaysShowFocus":false
+ },
"styles":
{
"Tooltip":
//******************************************************************************
{
+ "config":
+ {
+ "alwaysShowFocus":false
+ },
"styles":
{
"Tooltip":
//******************************************************************************
{
+ "config":
+ {
+ "alwaysShowFocus":false
+ },
"styles":
{
"TextLabel":
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.2.45
+Version: 1.2.46
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT