../dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/toolkit-vector-image-renderer.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-window.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-scene-holder.cpp
../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp
dali-toolkit-test-utils/toolkit-tts-player.cpp
dali-toolkit-test-utils/toolkit-native-image-source.cpp
dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp
+ dali-toolkit-test-utils/toolkit-vector-image-renderer.cpp
dali-toolkit-test-utils/toolkit-video-player.cpp
dali-toolkit-test-utils/toolkit-web-engine.cpp
dali-toolkit-test-utils/toolkit-window.cpp
--- /dev/null
+/*
+ * Copyright (c) 2020 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.
+ *
+ */
+
+#include <dali/devel-api/adaptor-framework/vector-image-renderer.h>
+#include <dali/public-api/object/base-object.h>
+#include <dali/public-api/rendering/renderer.h>
+#include <toolkit-application.h>
+#include <toolkit-event-thread-callback.h>
+#include <memory>
+#include <sys/stat.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class VectorImageRenderer: public Dali::BaseObject
+{
+public:
+
+ VectorImageRenderer()
+ : mUrl(),
+ mRenderer(),
+ mWidth( 0 ),
+ mHeight( 0 )
+ {
+ }
+
+ ~VectorImageRenderer()
+ {
+ }
+
+ bool Render( float scale )
+ {
+ return true;
+ }
+
+ void SetBuffer( Dali::Devel::PixelBuffer &buffer )
+ {
+ }
+
+ bool Load( const std::string& url )
+ {
+ struct stat sb;
+ if ( stat(url.c_str(), &sb) == 0 )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ bool Load( const char *data, uint32_t size )
+ {
+ return true;
+ }
+
+ void GetDefaultSize( uint32_t& width, uint32_t& height ) const
+ {
+ width = 100;
+ height = 100;
+ }
+
+public:
+
+ std::string mUrl;
+ Dali::Renderer mRenderer;
+ uint32_t mWidth;
+ uint32_t mHeight;
+};
+
+inline VectorImageRenderer& GetImplementation( Dali::VectorImageRenderer& renderer )
+{
+ DALI_ASSERT_ALWAYS( renderer && "VectorImageRenderer handle is empty." );
+ BaseObject& handle = renderer.GetBaseObject();
+ return static_cast< Internal::Adaptor::VectorImageRenderer& >( handle );
+}
+
+inline const VectorImageRenderer& GetImplementation( const Dali::VectorImageRenderer& renderer )
+{
+ DALI_ASSERT_ALWAYS( renderer && "VectorImageRenderer handle is empty." );
+ const BaseObject& handle = renderer.GetBaseObject();
+ return static_cast< const Internal::Adaptor::VectorImageRenderer& >( handle );
+}
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+
+/********************************************************************************/
+/********************************* PUBLIC CLASS *******************************/
+/********************************************************************************/
+
+VectorImageRenderer VectorImageRenderer::New()
+{
+ Internal::Adaptor::VectorImageRenderer* imageRenderer = new Internal::Adaptor::VectorImageRenderer();
+
+ return VectorImageRenderer( imageRenderer );
+}
+
+VectorImageRenderer::VectorImageRenderer()
+{
+}
+
+VectorImageRenderer::~VectorImageRenderer()
+{
+}
+
+VectorImageRenderer::VectorImageRenderer( Internal::Adaptor::VectorImageRenderer* internal )
+: BaseHandle( internal )
+{
+}
+
+void VectorImageRenderer::SetBuffer( Dali::Devel::PixelBuffer &buffer )
+{
+ Internal::Adaptor::GetImplementation( *this ).SetBuffer( buffer );
+}
+
+bool VectorImageRenderer::Render( float scale )
+{
+ return Internal::Adaptor::GetImplementation( *this ).Render( scale );
+}
+
+bool VectorImageRenderer::Load( const std::string& url )
+{
+ return Internal::Adaptor::GetImplementation( *this ).Load( url );
+}
+
+bool VectorImageRenderer::Load( const char *data, uint32_t size )
+{
+ return Internal::Adaptor::GetImplementation( *this ).Load( data, size );
+}
+
+void VectorImageRenderer::GetDefaultSize( uint32_t& width, uint32_t& height ) const
+{
+ Internal::Adaptor::GetImplementation( *this ).GetDefaultSize( width, height );
+}
+
+} // namespace Dali
const Flex::SizeTuple ITEM_SIZE = Flex::SizeTuple{ 10.0f, 10.0f };
const Flex::SizeTuple ITEM_SIZE_CALLBACK_TEST = Flex::SizeTuple{ 15.0f, 15.0f };
-Flex::SizeTuple MeasureChild( Actor child, float width, int measureModeWidth, float height, int measureModeHeight)
+void MeasureChild( Actor child, float width, int measureModeWidth, float height, int measureModeHeight, Flex::SizeTuple *childSize)
{
- Flex::SizeTuple childSize = ITEM_SIZE;
+ *childSize = ITEM_SIZE;
if (child.GetProperty< std::string >( Dali::Actor::Property::NAME ) == "callbackTest")
{
- childSize = ITEM_SIZE_CALLBACK_TEST;
+ *childSize = ITEM_SIZE_CALLBACK_TEST;
}
- tet_printf(" MeasureChild test callback executed (%f,%f)\n", childSize.width, childSize.height );
- return childSize;
+ tet_printf(" MeasureChild test callback executed (%f,%f)\n", childSize->width, childSize->height );
}
}
ADD_DEFINITIONS("-DTRACE_ENABLED")
ENDIF()
+# Remove below when thorvg is ready
+ADD_DEFINITIONS( "-DNO_THORVG" )
+
# Set paths
SET( toolkit_images_dir ${ROOT_SRC_DIR}/dali-toolkit/styles/images-common )
SET( toolkit_sounds_dir ${ROOT_SRC_DIR}/dali-toolkit/sounds )
Toolkit::Flex::SizeTuple nodeSize{8, 8}; // Default size set to 8,8 to aid bug detection.
if(mImpl->mMeasureCallback && mImpl->mActor.GetHandle())
{
- DALI_LOG_INFO(gLogFilter, Debug::Verbose, "MeasureNode MeasureCallback executing on %s\n", mImpl->mActor.GetHandle().GetProperty<std::string>(Dali::Actor::Property::NAME).c_str());
- nodeSize = mImpl->mMeasureCallback(mImpl->mActor.GetHandle(), width, widthMode, height, heightMode);
+ DALI_LOG_INFO(gLogFilter, Debug::Verbose, "MeasureNode MeasureCallback executing on %s\n", mImpl->mActor.GetHandle().GetProperty< std::string >( Dali::Actor::Property::NAME ).c_str());
+ mImpl->mMeasureCallback(mImpl->mActor.GetHandle(), width, widthMode, height, heightMode, &nodeSize);
}
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "MeasureNode nodeSize width:%f height:%f\n", nodeSize.width, nodeSize.height);
return nodeSize;
* @note int, width measure specifcation mode
* @note float, available height for child
* @note int, height measure specification mode
+ * @note SizeTuple, return value
*/
-using MeasureCallback = SizeTuple (*)(Dali::Actor, float, int, float, int);
+using MeasureCallback = void (*)(Dali::Actor, float , int , float , int, SizeTuple *);
/**
* This class provides the API for calling into the Flex layout implementation.
#include <cstring>
#include <limits>
#include <dali/public-api/adaptor-framework/key.h>
+#include <dali/public-api/common/dali-common.h>
#include <dali/devel-api/adaptor-framework/window-devel.h>
#include <dali/devel-api/common/stage.h>
#include <dali/devel-api/actors/actor-devel.h>
if( textEditor )
{
TextEditor& impl( GetImpl( textEditor ) );
+ DALI_ASSERT_DEBUG( impl.mController && "No text contoller" );
+ DALI_ASSERT_DEBUG( impl.mDecorator && "No text decorator" );
switch( index )
{
}
case Toolkit::TextEditor::Property::TEXT:
{
- if( impl.mController )
- {
- const std::string& text = value.Get< std::string >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p TEXT %s\n", impl.mController.Get(), text.c_str() );
+ const std::string& text = value.Get< std::string >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p TEXT %s\n", impl.mController.Get(), text.c_str() );
- impl.mController->SetText( text );
- }
+ impl.mController->SetText( text );
break;
}
case Toolkit::TextEditor::Property::TEXT_COLOR:
{
- if( impl.mController )
+ const Vector4& textColor = value.Get< Vector4 >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a );
+
+ if( impl.mController->GetDefaultColor() != textColor )
{
- const Vector4& textColor = value.Get< Vector4 >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a );
-
- if( impl.mController->GetDefaultColor() != textColor )
- {
- impl.mController->SetDefaultColor( textColor );
- impl.mController->SetInputColor( textColor );
- impl.mRenderer.Reset();
- }
+ impl.mController->SetDefaultColor( textColor );
+ impl.mController->SetInputColor( textColor );
+ impl.mRenderer.Reset();
}
break;
}
case Toolkit::TextEditor::Property::FONT_FAMILY:
{
- if( impl.mController )
- {
- const std::string& fontFamily = value.Get< std::string >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() );
- impl.mController->SetDefaultFontFamily( fontFamily );
- }
+ const std::string& fontFamily = value.Get< std::string >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() );
+ impl.mController->SetDefaultFontFamily( fontFamily );
break;
}
case Toolkit::TextEditor::Property::FONT_STYLE:
}
case Toolkit::TextEditor::Property::POINT_SIZE:
{
- if( impl.mController )
- {
- const float pointSize = value.Get< float >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p POINT_SIZE %f\n", impl.mController.Get(), pointSize );
+ const float pointSize = value.Get< float >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p POINT_SIZE %f\n", impl.mController.Get(), pointSize );
- if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ), pointSize ) )
- {
- impl.mController->SetDefaultFontSize( pointSize, Text::Controller::POINT_SIZE );
- }
+ if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ), pointSize ) )
+ {
+ impl.mController->SetDefaultFontSize( pointSize, Text::Controller::POINT_SIZE );
}
break;
}
case Toolkit::TextEditor::Property::HORIZONTAL_ALIGNMENT:
{
- if( impl.mController )
+ Text::HorizontalAlignment::Type alignment( static_cast< Text::HorizontalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
+ if( Text::GetHorizontalAlignmentEnumeration( value, alignment ) )
{
- Text::HorizontalAlignment::Type alignment( static_cast< Text::HorizontalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
- if( Text::GetHorizontalAlignmentEnumeration( value, alignment ) )
- {
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p HORIZONTAL_ALIGNMENT %d\n", impl.mController.Get(), alignment );
- impl.mController->SetHorizontalAlignment( alignment );
- }
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p HORIZONTAL_ALIGNMENT %d\n", impl.mController.Get(), alignment );
+ impl.mController->SetHorizontalAlignment( alignment );
}
break;
}
const float threshold = value.Get< float >();
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p SCROLL_THRESHOLD %f\n", impl.mController.Get(), threshold );
- if( impl.mDecorator )
- {
- impl.mDecorator->SetScrollThreshold( threshold );
- }
+ impl.mDecorator->SetScrollThreshold( threshold );
break;
}
case Toolkit::TextEditor::Property::SCROLL_SPEED:
const float speed = value.Get< float >();
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p SCROLL_SPEED %f\n", impl.mController.Get(), speed );
- if( impl.mDecorator )
- {
- impl.mDecorator->SetScrollSpeed( speed );
- }
+ impl.mDecorator->SetScrollSpeed( speed );
break;
}
case Toolkit::TextEditor::Property::PRIMARY_CURSOR_COLOR:
{
- if( impl.mDecorator )
- {
- const Vector4& color = value.Get< Vector4 >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p PRIMARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
+ const Vector4& color = value.Get< Vector4 >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p PRIMARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
- impl.mDecorator->SetCursorColor( PRIMARY_CURSOR, color );
- impl.RequestTextRelayout();
- }
+ impl.mDecorator->SetCursorColor( PRIMARY_CURSOR, color );
+ impl.RequestTextRelayout();
break;
}
case Toolkit::TextEditor::Property::SECONDARY_CURSOR_COLOR:
{
- if( impl.mDecorator )
- {
- const Vector4& color = value.Get< Vector4 >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p SECONDARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
+ const Vector4& color = value.Get< Vector4 >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p SECONDARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
- impl.mDecorator->SetCursorColor( SECONDARY_CURSOR, color );
- impl.RequestTextRelayout();
- }
+ impl.mDecorator->SetCursorColor( SECONDARY_CURSOR, color );
+ impl.RequestTextRelayout();
break;
}
case Toolkit::TextEditor::Property::ENABLE_CURSOR_BLINK:
{
- if( impl.mController )
- {
- const bool enable = value.Get< bool >();
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p ENABLE_CURSOR_BLINK %d\n", impl.mController.Get(), enable );
+ const bool enable = value.Get< bool >();
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p ENABLE_CURSOR_BLINK %d\n", impl.mController.Get(), enable );
- impl.mController->SetEnableCursorBlink( enable );
- impl.RequestTextRelayout();
- }
+ impl.mController->SetEnableCursorBlink( enable );
+ impl.RequestTextRelayout();
break;
}
case Toolkit::TextEditor::Property::CURSOR_BLINK_INTERVAL:
{
- if( impl.mDecorator )
- {
- const float interval = value.Get< float >();
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p CURSOR_BLINK_INTERVAL %f\n", impl.mController.Get(), interval );
+ const float interval = value.Get< float >();
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p CURSOR_BLINK_INTERVAL %f\n", impl.mController.Get(), interval );
- impl.mDecorator->SetCursorBlinkInterval( interval );
- }
+ impl.mDecorator->SetCursorBlinkInterval( interval );
break;
}
case Toolkit::TextEditor::Property::CURSOR_BLINK_DURATION:
{
- if( impl.mDecorator )
- {
- const float duration = value.Get< float >();
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p CURSOR_BLINK_DURATION %f\n", impl.mController.Get(), duration );
+ const float duration = value.Get< float >();
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p CURSOR_BLINK_DURATION %f\n", impl.mController.Get(), duration );
- impl.mDecorator->SetCursorBlinkDuration( duration );
- }
+ impl.mDecorator->SetCursorBlinkDuration( duration );
break;
}
case Toolkit::TextEditor::Property::CURSOR_WIDTH:
{
- if( impl.mDecorator )
- {
- const int width = value.Get< int >();
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p CURSOR_WIDTH %d\n", impl.mController.Get(), width );
+ const int width = value.Get< int >();
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p CURSOR_WIDTH %d\n", impl.mController.Get(), width );
- impl.mDecorator->SetCursorWidth( width );
- impl.mController->GetLayoutEngine().SetCursorWidth( width );
- }
+ impl.mDecorator->SetCursorWidth( width );
+ impl.mController->GetLayoutEngine().SetCursorWidth( width );
break;
}
case Toolkit::TextEditor::Property::GRAB_HANDLE_IMAGE:
const std::string imageFileName = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p GRAB_HANDLE_IMAGE %s\n", impl.mController.Get(), imageFileName.c_str() );
- if( impl.mDecorator && imageFileName.size() )
+ if( imageFileName.size() )
{
impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED, imageFileName );
impl.RequestTextRelayout();
const std::string imageFileName = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor %p GRAB_HANDLE_PRESSED_IMAGE %s\n", impl.mController.Get(), imageFileName.c_str() );
- if( impl.mDecorator && imageFileName.size() )
+ if( imageFileName.size() )
{
impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED, imageFileName );
impl.RequestTextRelayout();
{
const std::string filename = GetImageFileNameFromPropertyValue( value );
- if( impl.mDecorator && filename.size() )
+ if( filename.size() )
{
impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, filename );
impl.RequestTextRelayout();
{
const std::string filename = GetImageFileNameFromPropertyValue( value );
- if( impl.mDecorator && filename.size() )
+ if( filename.size() )
{
impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, filename );
impl.RequestTextRelayout();
{
const std::string filename = GetImageFileNameFromPropertyValue( value );
- if( impl.mDecorator && filename.size() )
+ if( filename.size() )
{
impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, filename );
impl.RequestTextRelayout();
{
const std::string filename = GetImageFileNameFromPropertyValue( value );
- if( impl.mDecorator && filename.size() )
+ if( filename.size() )
{
impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, filename );
impl.RequestTextRelayout();
{
const std::string filename = GetImageFileNameFromPropertyValue( value );
- if( impl.mDecorator && filename.size() )
+ if( filename.size() )
{
impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, filename );
impl.RequestTextRelayout();
{
const std::string filename = GetImageFileNameFromPropertyValue( value );
- if( impl.mDecorator && filename.size() )
+ if( filename.size() )
{
impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, filename );
impl.RequestTextRelayout();
const Vector4 color = value.Get< Vector4 >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p SELECTION_HIGHLIGHT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
- if( impl.mDecorator )
- {
- impl.mDecorator->SetHighlightColor( color );
- impl.RequestTextRelayout();
- }
+ impl.mDecorator->SetHighlightColor( color );
+ impl.RequestTextRelayout();
break;
}
case Toolkit::TextEditor::Property::DECORATION_BOUNDING_BOX:
{
- if( impl.mDecorator )
- {
- const Rect<int>& box = value.Get< Rect<int> >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p DECORATION_BOUNDING_BOX %d,%d %dx%d\n", impl.mController.Get(), box.x, box.y, box.width, box.height );
+ const Rect<int>& box = value.Get< Rect<int> >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p DECORATION_BOUNDING_BOX %d,%d %dx%d\n", impl.mController.Get(), box.x, box.y, box.width, box.height );
- impl.mDecorator->SetBoundingBox( box );
- impl.RequestTextRelayout();
- }
+ impl.mDecorator->SetBoundingBox( box );
+ impl.RequestTextRelayout();
break;
}
case Toolkit::TextEditor::Property::ENABLE_MARKUP:
{
- if( impl.mController )
- {
- const bool enableMarkup = value.Get<bool>();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_MARKUP %d\n", impl.mController.Get(), enableMarkup );
+ const bool enableMarkup = value.Get<bool>();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_MARKUP %d\n", impl.mController.Get(), enableMarkup );
- impl.mController->SetMarkupProcessorEnabled( enableMarkup );
- }
+ impl.mController->SetMarkupProcessorEnabled( enableMarkup );
break;
}
case Toolkit::TextEditor::Property::INPUT_COLOR:
{
- if( impl.mController )
- {
- const Vector4& inputColor = value.Get< Vector4 >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p INPUT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), inputColor.r, inputColor.g, inputColor.b, inputColor.a );
+ const Vector4& inputColor = value.Get< Vector4 >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p INPUT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), inputColor.r, inputColor.g, inputColor.b, inputColor.a );
- impl.mController->SetInputColor( inputColor );
- }
+ impl.mController->SetInputColor( inputColor );
break;
}
case Toolkit::TextEditor::Property::INPUT_FONT_FAMILY:
{
- if( impl.mController )
- {
- const std::string& fontFamily = value.Get< std::string >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p INPUT_FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() );
- impl.mController->SetInputFontFamily( fontFamily );
- }
+ const std::string& fontFamily = value.Get< std::string >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p INPUT_FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() );
+ impl.mController->SetInputFontFamily( fontFamily );
break;
}
case Toolkit::TextEditor::Property::INPUT_FONT_STYLE:
}
case Toolkit::TextEditor::Property::INPUT_POINT_SIZE:
{
- if( impl.mController )
- {
- const float pointSize = value.Get< float >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p INPUT_POINT_SIZE %f\n", impl.mController.Get(), pointSize );
- impl.mController->SetInputFontPointSize( pointSize );
- }
+ const float pointSize = value.Get< float >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p INPUT_POINT_SIZE %f\n", impl.mController.Get(), pointSize );
+ impl.mController->SetInputFontPointSize( pointSize );
break;
}
case Toolkit::TextEditor::Property::LINE_SPACING:
{
- if( impl.mController )
- {
-
- // The line spacing isn't supported by the TextEditor. Since it's supported
- // by the TextLabel for now it must be ignored. The property is being shadowed
- // locally so its value isn't affected.
- const float lineSpacing = value.Get<float>();
- impl.mLineSpacing = lineSpacing;
- // set it to 0.0 due to missing implementation
- impl.mController->SetDefaultLineSpacing( 0.0f );
- impl.mRenderer.Reset();
- }
+ // The line spacing isn't supported by the TextEditor. Since it's supported
+ // by the TextLabel for now it must be ignored. The property is being shadowed
+ // locally so its value isn't affected.
+ const float lineSpacing = value.Get<float>();
+ impl.mLineSpacing = lineSpacing;
+ // set it to 0.0 due to missing implementation
+ impl.mController->SetDefaultLineSpacing( 0.0f );
+ impl.mRenderer.Reset();
break;
}
case Toolkit::TextEditor::Property::INPUT_LINE_SPACING:
{
- if( impl.mController )
- {
- const float lineSpacing = value.Get<float>();
- impl.mController->SetInputLineSpacing( lineSpacing );
- impl.mRenderer.Reset();
- }
+ const float lineSpacing = value.Get<float>();
+ impl.mController->SetInputLineSpacing( lineSpacing );
+ impl.mRenderer.Reset();
break;
}
case Toolkit::TextEditor::Property::UNDERLINE:
}
case Toolkit::TextEditor::Property::PIXEL_SIZE:
{
- if( impl.mController )
- {
- const float pixelSize = value.Get< float >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p PIXEL_SIZE %f\n", impl.mController.Get(), pixelSize );
+ const float pixelSize = value.Get< float >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p PIXEL_SIZE %f\n", impl.mController.Get(), pixelSize );
- if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ), pixelSize ) )
- {
- impl.mController->SetDefaultFontSize( pixelSize, Text::Controller::PIXEL_SIZE );
- }
+ if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ), pixelSize ) )
+ {
+ impl.mController->SetDefaultFontSize( pixelSize, Text::Controller::PIXEL_SIZE );
}
break;
}
case Toolkit::DevelTextEditor::Property::PLACEHOLDER_TEXT:
{
- if( impl.mController )
- {
- const std::string& text = value.Get< std::string >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor::OnPropertySet %p PLACEHOLDER_TEXT %s\n", impl.mController.Get(), text.c_str() );
+ const std::string& text = value.Get< std::string >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor::OnPropertySet %p PLACEHOLDER_TEXT %s\n", impl.mController.Get(), text.c_str() );
- impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text );
- }
+ impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text );
break;
}
case Toolkit::DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR:
{
- if( impl.mController )
+ const Vector4& textColor = value.Get< Vector4 >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p PLACEHOLDER_TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a );
+
+ if( impl.mController->GetPlaceholderTextColor() != textColor )
{
- const Vector4& textColor = value.Get< Vector4 >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p PLACEHOLDER_TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a );
-
- if( impl.mController->GetPlaceholderTextColor() != textColor )
- {
- impl.mController->SetPlaceholderTextColor( textColor );
- impl.mRenderer.Reset();
- }
+ impl.mController->SetPlaceholderTextColor( textColor );
+ impl.mRenderer.Reset();
}
break;
}
case Toolkit::TextEditor::Property::ENABLE_SELECTION:
{
- if( impl.mController )
- {
- const bool enableSelection = value.Get< bool >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_SELECTION %d\n", impl.mController.Get(), enableSelection );
- impl.mController->SetSelectionEnabled( enableSelection );
- }
+ const bool enableSelection = value.Get< bool >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_SELECTION %d\n", impl.mController.Get(), enableSelection );
+ impl.mController->SetSelectionEnabled( enableSelection );
break;
}
case Toolkit::TextEditor::Property::PLACEHOLDER:
}
case Toolkit::TextEditor::Property::LINE_WRAP_MODE:
{
- if( impl.mController )
+ Text::LineWrap::Mode lineWrapMode( static_cast< Text::LineWrap::Mode >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
+ if( GetLineWrapModeEnumeration( value, lineWrapMode ) )
{
- Text::LineWrap::Mode lineWrapMode( static_cast< Text::LineWrap::Mode >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
- if( GetLineWrapModeEnumeration( value, lineWrapMode ) )
- {
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p LineWrap::MODE %d\n", impl.mController.Get(), lineWrapMode );
- impl.mController->SetLineWrapMode( lineWrapMode );
- }
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p LineWrap::MODE %d\n", impl.mController.Get(), lineWrapMode );
+ impl.mController->SetLineWrapMode( lineWrapMode );
}
break;
}
case Toolkit::DevelTextEditor::Property::ENABLE_SHIFT_SELECTION:
{
- if( impl.mController )
- {
- const bool shiftSelection = value.Get<bool>();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_SHIFT_SELECTION %d\n", impl.mController.Get(), shiftSelection );
+ const bool shiftSelection = value.Get<bool>();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_SHIFT_SELECTION %d\n", impl.mController.Get(), shiftSelection );
- impl.mController->SetShiftSelectionEnabled( shiftSelection );
- }
+ impl.mController->SetShiftSelectionEnabled( shiftSelection );
break;
}
case Toolkit::DevelTextEditor::Property::ENABLE_GRAB_HANDLE:
{
- if( impl.mController )
- {
- const bool grabHandleEnabled = value.Get<bool>();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_GRAB_HANDLE %d\n", impl.mController.Get(), grabHandleEnabled );
+ const bool grabHandleEnabled = value.Get<bool>();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_GRAB_HANDLE %d\n", impl.mController.Get(), grabHandleEnabled );
- impl.mController->SetGrabHandleEnabled( grabHandleEnabled );
- }
+ impl.mController->SetGrabHandleEnabled( grabHandleEnabled );
break;
}
case Toolkit::DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION:
{
- if( impl.mController )
- {
- impl.mController->SetMatchSystemLanguageDirection(value.Get< bool >());
- }
+ impl.mController->SetMatchSystemLanguageDirection(value.Get< bool >());
break;
}
case Toolkit::DevelTextEditor::Property::MAX_LENGTH:
{
- if( impl.mController )
- {
- const int max = value.Get< int >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p MAX_LENGTH %d\n", impl.mController.Get(), max );
+ const int max = value.Get< int >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p MAX_LENGTH %d\n", impl.mController.Get(), max );
- impl.mController->SetMaximumNumberOfCharacters( max );
- }
+ impl.mController->SetMaximumNumberOfCharacters( max );
break;
}
case Toolkit::DevelTextEditor::Property::SELECTED_TEXT_START:
if( textEditor )
{
TextEditor& impl( GetImpl( textEditor ) );
+ DALI_ASSERT_DEBUG( impl.mController && "No text contoller" );
+ DALI_ASSERT_DEBUG( impl.mDecorator && "No text decorator" );
switch( index )
{
}
case Toolkit::TextEditor::Property::TEXT:
{
- if( impl.mController )
- {
- std::string text;
- impl.mController->GetText( text );
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p returning text: %s\n", impl.mController.Get(), text.c_str() );
- value = text;
- }
+ std::string text;
+ impl.mController->GetText( text );
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p returning text: %s\n", impl.mController.Get(), text.c_str() );
+ value = text;
break;
}
case Toolkit::TextEditor::Property::TEXT_COLOR:
{
- if ( impl.mController )
- {
- value = impl.mController->GetDefaultColor();
- }
+ value = impl.mController->GetDefaultColor();
break;
}
case Toolkit::TextEditor::Property::FONT_FAMILY:
{
- if( impl.mController )
- {
- value = impl.mController->GetDefaultFontFamily();
- }
+ value = impl.mController->GetDefaultFontFamily();
break;
}
case Toolkit::TextEditor::Property::FONT_STYLE:
}
case Toolkit::TextEditor::Property::POINT_SIZE:
{
- if( impl.mController )
- {
- value = impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE );
- }
+ value = impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE );
break;
}
case Toolkit::TextEditor::Property::HORIZONTAL_ALIGNMENT:
{
- if( impl.mController )
+ const char* name = GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() );
+ if( name )
{
- const char* name = GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() );
- if( name )
- {
- value = std::string( name );
- }
+ value = std::string( name );
}
break;
}
case Toolkit::TextEditor::Property::SCROLL_THRESHOLD:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetScrollThreshold();
- }
+ value = impl.mDecorator->GetScrollThreshold();
break;
}
case Toolkit::TextEditor::Property::SCROLL_SPEED:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetScrollSpeed();
- }
+ value = impl.mDecorator->GetScrollSpeed();
break;
}
case Toolkit::TextEditor::Property::PRIMARY_CURSOR_COLOR:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetColor( PRIMARY_CURSOR );
- }
+ value = impl.mDecorator->GetColor( PRIMARY_CURSOR );
break;
}
case Toolkit::TextEditor::Property::SECONDARY_CURSOR_COLOR:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetColor( SECONDARY_CURSOR );
- }
+ value = impl.mDecorator->GetColor( SECONDARY_CURSOR );
break;
}
case Toolkit::TextEditor::Property::ENABLE_CURSOR_BLINK:
}
case Toolkit::TextEditor::Property::CURSOR_BLINK_INTERVAL:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetCursorBlinkInterval();
- }
+ value = impl.mDecorator->GetCursorBlinkInterval();
break;
}
case Toolkit::TextEditor::Property::CURSOR_BLINK_DURATION:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetCursorBlinkDuration();
- }
+ value = impl.mDecorator->GetCursorBlinkDuration();
break;
}
case Toolkit::TextEditor::Property::CURSOR_WIDTH:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetCursorWidth();
- }
+ value = impl.mDecorator->GetCursorWidth();
break;
}
case Toolkit::TextEditor::Property::GRAB_HANDLE_IMAGE:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED );
- }
+ value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED );
break;
}
case Toolkit::TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED );
- }
+ value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED );
break;
}
case Toolkit::TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT:
}
case Toolkit::TextEditor::Property::SELECTION_HIGHLIGHT_COLOR:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetHighlightColor();
- }
+ value = impl.mDecorator->GetHighlightColor();
break;
}
case Toolkit::TextEditor::Property::DECORATION_BOUNDING_BOX:
{
- if( impl.mDecorator )
- {
- Rect<int> boundingBox;
- impl.mDecorator->GetBoundingBox( boundingBox );
- value = boundingBox;
- }
+ Rect<int> boundingBox;
+ impl.mDecorator->GetBoundingBox( boundingBox );
+ value = boundingBox;
break;
}
case Toolkit::TextEditor::Property::ENABLE_MARKUP:
{
- if( impl.mController )
- {
- value = impl.mController->IsMarkupProcessorEnabled();
- }
+ value = impl.mController->IsMarkupProcessorEnabled();
break;
}
case Toolkit::TextEditor::Property::INPUT_COLOR:
{
- if( impl.mController )
- {
- value = impl.mController->GetInputColor();
- }
+ value = impl.mController->GetInputColor();
break;
}
case Toolkit::TextEditor::Property::INPUT_FONT_FAMILY:
{
- if( impl.mController )
- {
- value = impl.mController->GetInputFontFamily();
- }
+ value = impl.mController->GetInputFontFamily();
break;
}
case Toolkit::TextEditor::Property::INPUT_FONT_STYLE:
}
case Toolkit::TextEditor::Property::INPUT_POINT_SIZE:
{
- if( impl.mController )
- {
- value = impl.mController->GetInputFontPointSize();
- }
+ value = impl.mController->GetInputFontPointSize();
break;
}
case Toolkit::TextEditor::Property::LINE_SPACING:
{
- if( impl.mController )
- {
- // LINE_SPACING isn't implemented for the TextEditor. Returning
- // only shadowed value, not the real one.
- value = impl.mLineSpacing;
- }
+ // LINE_SPACING isn't implemented for the TextEditor. Returning
+ // only shadowed value, not the real one.
+ value = impl.mLineSpacing;
break;
}
case Toolkit::TextEditor::Property::INPUT_LINE_SPACING:
{
- if( impl.mController )
- {
- value = impl.mController->GetInputLineSpacing();
- }
+ value = impl.mController->GetInputLineSpacing();
break;
}
case Toolkit::TextEditor::Property::UNDERLINE:
}
case Toolkit::TextEditor::Property::PIXEL_SIZE:
{
- if( impl.mController )
- {
- value = impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE );
- }
+ value = impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE );
break;
}
case Toolkit::TextEditor::Property::LINE_COUNT:
{
- if( impl.mController )
- {
- float width = textEditor.GetProperty( Actor::Property::SIZE_WIDTH ).Get<float>();
- value = impl.mController->GetLineCount( width );
- }
+ float width = textEditor.GetProperty( Actor::Property::SIZE_WIDTH ).Get<float>();
+ value = impl.mController->GetLineCount( width );
break;
}
case Toolkit::DevelTextEditor::Property::PLACEHOLDER_TEXT:
{
- if( impl.mController )
- {
- std::string text;
- impl.mController->GetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text );
- value = text;
- }
+ std::string text;
+ impl.mController->GetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text );
+ value = text;
break;
}
case Toolkit::DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR:
{
- if( impl.mController )
- {
- value = impl.mController->GetPlaceholderTextColor();
- }
+ value = impl.mController->GetPlaceholderTextColor();
break;
}
case Toolkit::TextEditor::Property::ENABLE_SELECTION:
{
- if( impl.mController )
- {
- value = impl.mController->IsSelectionEnabled();
- }
+ value = impl.mController->IsSelectionEnabled();
break;
}
case Toolkit::TextEditor::Property::PLACEHOLDER:
}
case Toolkit::TextEditor::Property::LINE_WRAP_MODE:
{
- if( impl.mController )
- {
- value = impl.mController->GetLineWrapMode();
- }
+ value = impl.mController->GetLineWrapMode();
break;
}
case Toolkit::DevelTextEditor::Property::ENABLE_SHIFT_SELECTION:
{
- if( impl.mController )
- {
- value = impl.mController->IsShiftSelectionEnabled();
- }
+ value = impl.mController->IsShiftSelectionEnabled();
break;
}
case Toolkit::DevelTextEditor::Property::ENABLE_GRAB_HANDLE:
{
- if( impl.mController )
- {
- value = impl.mController->IsGrabHandleEnabled();
- }
+ value = impl.mController->IsGrabHandleEnabled();
break;
}
case Toolkit::DevelTextEditor::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION:
{
- if( impl.mController )
- {
- value = impl.mController->IsMatchSystemLanguageDirection();
- }
+ value = impl.mController->IsMatchSystemLanguageDirection();
break;
}
case Toolkit::DevelTextEditor::Property::MAX_LENGTH:
{
- if( impl.mController )
- {
- value = impl.mController->GetMaximumNumberOfCharacters();
- }
+ value = impl.mController->GetMaximumNumberOfCharacters();
break;
}
case Toolkit::DevelTextEditor::Property::SELECTED_TEXT_START:
// EXTERNAL INCLUDES
#include <cstring>
#include <dali/public-api/adaptor-framework/key.h>
+#include <dali/public-api/common/dali-common.h>
#include <dali/devel-api/adaptor-framework/key-devel.h>
#include <dali/devel-api/adaptor-framework/window-devel.h>
#include <dali/devel-api/common/stage.h>
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField SetProperty\n");
-
if( textField )
{
TextField& impl( GetImpl( textField ) );
+ DALI_ASSERT_DEBUG( impl.mController && "No text contoller" );
+ DALI_ASSERT_DEBUG( impl.mDecorator && "No text decorator" );
switch( index )
{
impl.mRenderingBackend = backend;
impl.mRenderer.Reset();
- if( impl.mController )
- {
- // When using the vector-based rendering, the size of the GLyphs are different
- TextAbstraction::GlyphType glyphType = (DevelText::RENDERING_VECTOR_BASED == impl.mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH;
- impl.mController->SetGlyphType( glyphType );
- }
+ // When using the vector-based rendering, the size of the GLyphs are different
+ TextAbstraction::GlyphType glyphType = (DevelText::RENDERING_VECTOR_BASED == impl.mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH;
+ impl.mController->SetGlyphType( glyphType );
}
break;
}
case Toolkit::TextField::Property::TEXT:
{
- if( impl.mController )
- {
- const std::string& text = value.Get< std::string >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p TEXT %s\n", impl.mController.Get(), text.c_str() );
+ const std::string& text = value.Get< std::string >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p TEXT %s\n", impl.mController.Get(), text.c_str() );
- impl.mController->SetText( text );
- }
+ impl.mController->SetText( text );
break;
}
case Toolkit::TextField::Property::PLACEHOLDER_TEXT:
{
- if( impl.mController )
- {
- const std::string& text = value.Get< std::string >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT %s\n", impl.mController.Get(), text.c_str() );
+ const std::string& text = value.Get< std::string >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT %s\n", impl.mController.Get(), text.c_str() );
- impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text );
- }
+ impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text );
break;
}
case Toolkit::TextField::Property::PLACEHOLDER_TEXT_FOCUSED:
{
- if( impl.mController )
- {
- const std::string& text = value.Get< std::string >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT_FOCUSED %s\n", impl.mController.Get(), text.c_str() );
+ const std::string& text = value.Get< std::string >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT_FOCUSED %s\n", impl.mController.Get(), text.c_str() );
- impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_ACTIVE, text );
- }
+ impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_ACTIVE, text );
break;
}
case Toolkit::TextField::Property::FONT_FAMILY:
{
- if( impl.mController )
- {
- const std::string& fontFamily = value.Get< std::string >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() );
- impl.mController->SetDefaultFontFamily( fontFamily );
- }
+ const std::string& fontFamily = value.Get< std::string >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() );
+ impl.mController->SetDefaultFontFamily( fontFamily );
break;
}
case Toolkit::TextField::Property::FONT_STYLE:
}
case Toolkit::TextField::Property::POINT_SIZE:
{
- if( impl.mController )
- {
- const float pointSize = value.Get< float >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p POINT_SIZE %f\n", impl.mController.Get(), pointSize );
+ const float pointSize = value.Get< float >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p POINT_SIZE %f\n", impl.mController.Get(), pointSize );
- if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ), pointSize ) )
- {
- impl.mController->SetDefaultFontSize( pointSize, Text::Controller::POINT_SIZE );
- }
+ if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ), pointSize ) )
+ {
+ impl.mController->SetDefaultFontSize( pointSize, Text::Controller::POINT_SIZE );
}
break;
}
case Toolkit::TextField::Property::MAX_LENGTH:
{
- if( impl.mController )
- {
- const int max = value.Get< int >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p MAX_LENGTH %d\n", impl.mController.Get(), max );
+ const int max = value.Get< int >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p MAX_LENGTH %d\n", impl.mController.Get(), max );
- impl.mController->SetMaximumNumberOfCharacters( max );
- }
+ impl.mController->SetMaximumNumberOfCharacters( max );
break;
}
case Toolkit::TextField::Property::EXCEED_POLICY:
}
case Toolkit::TextField::Property::HORIZONTAL_ALIGNMENT:
{
- if( impl.mController )
+ Text::HorizontalAlignment::Type alignment( static_cast< Text::HorizontalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
+ if( GetHorizontalAlignmentEnumeration( value, alignment ) )
{
- Text::HorizontalAlignment::Type alignment( static_cast< Text::HorizontalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
- if( GetHorizontalAlignmentEnumeration( value, alignment ) )
- {
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p HORIZONTAL_ALIGNMENT %d\n", impl.mController.Get(), alignment );
- impl.mController->SetHorizontalAlignment( alignment );
- }
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p HORIZONTAL_ALIGNMENT %d\n", impl.mController.Get(), alignment );
+ impl.mController->SetHorizontalAlignment( alignment );
}
break;
}
case Toolkit::TextField::Property::VERTICAL_ALIGNMENT:
{
- if( impl.mController )
+ Toolkit::Text::VerticalAlignment::Type alignment( static_cast< Text::VerticalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
+ if( GetVerticalAlignmentEnumeration( value, alignment ) )
{
- Toolkit::Text::VerticalAlignment::Type alignment( static_cast< Text::VerticalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
- if( GetVerticalAlignmentEnumeration( value, alignment ) )
- {
- impl.mController->SetVerticalAlignment( alignment );
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p VERTICAL_ALIGNMENT %d\n", impl.mController.Get(), alignment );
- }
+ impl.mController->SetVerticalAlignment( alignment );
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p VERTICAL_ALIGNMENT %d\n", impl.mController.Get(), alignment );
}
break;
}
case Toolkit::TextField::Property::TEXT_COLOR:
{
- if( impl.mController )
+ const Vector4& textColor = value.Get< Vector4 >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a );
+
+ if( impl.mController->GetDefaultColor() != textColor )
{
- const Vector4& textColor = value.Get< Vector4 >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a );
-
- if( impl.mController->GetDefaultColor() != textColor )
- {
- impl.mController->SetDefaultColor( textColor );
- impl.mController->SetInputColor( textColor );
- impl.mRenderer.Reset();
- }
+ impl.mController->SetDefaultColor( textColor );
+ impl.mController->SetInputColor( textColor );
+ impl.mRenderer.Reset();
}
break;
}
case Toolkit::TextField::Property::PLACEHOLDER_TEXT_COLOR:
{
- if( impl.mController )
+ const Vector4& textColor = value.Get< Vector4 >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a );
+
+ if( impl.mController->GetPlaceholderTextColor() != textColor )
{
- const Vector4& textColor = value.Get< Vector4 >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a );
-
- if( impl.mController->GetPlaceholderTextColor() != textColor )
- {
- impl.mController->SetPlaceholderTextColor( textColor );
- impl.mRenderer.Reset();
- }
+ impl.mController->SetPlaceholderTextColor( textColor );
+ impl.mRenderer.Reset();
}
break;
}
case Toolkit::TextField::Property::PRIMARY_CURSOR_COLOR:
{
- if( impl.mDecorator )
- {
- const Vector4& color = value.Get< Vector4 >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PRIMARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
+ const Vector4& color = value.Get< Vector4 >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PRIMARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
- impl.mDecorator->SetCursorColor( PRIMARY_CURSOR, color );
- impl.RequestTextRelayout();
- }
+ impl.mDecorator->SetCursorColor( PRIMARY_CURSOR, color );
+ impl.RequestTextRelayout();
break;
}
case Toolkit::TextField::Property::SECONDARY_CURSOR_COLOR:
{
- if( impl.mDecorator )
- {
- const Vector4& color = value.Get< Vector4 >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SECONDARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
+ const Vector4& color = value.Get< Vector4 >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SECONDARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
- impl.mDecorator->SetCursorColor( SECONDARY_CURSOR, color );
- impl.RequestTextRelayout();
- }
+ impl.mDecorator->SetCursorColor( SECONDARY_CURSOR, color );
+ impl.RequestTextRelayout();
break;
}
case Toolkit::TextField::Property::ENABLE_CURSOR_BLINK:
{
- if( impl.mController )
- {
- const bool enable = value.Get< bool >();
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p ENABLE_CURSOR_BLINK %d\n", impl.mController.Get(), enable );
+ const bool enable = value.Get< bool >();
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p ENABLE_CURSOR_BLINK %d\n", impl.mController.Get(), enable );
- impl.mController->SetEnableCursorBlink( enable );
- impl.RequestTextRelayout();
- }
+ impl.mController->SetEnableCursorBlink( enable );
+ impl.RequestTextRelayout();
break;
}
case Toolkit::TextField::Property::CURSOR_BLINK_INTERVAL:
{
- if( impl.mDecorator )
- {
- const float interval = value.Get< float >();
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p CURSOR_BLINK_INTERVAL %f\n", impl.mController.Get(), interval );
+ const float interval = value.Get< float >();
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p CURSOR_BLINK_INTERVAL %f\n", impl.mController.Get(), interval );
- impl.mDecorator->SetCursorBlinkInterval( interval );
- }
+ impl.mDecorator->SetCursorBlinkInterval( interval );
break;
}
case Toolkit::TextField::Property::CURSOR_BLINK_DURATION:
{
- if( impl.mDecorator )
- {
- const float duration = value.Get< float >();
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p CURSOR_BLINK_DURATION %f\n", impl.mController.Get(), duration );
+ const float duration = value.Get< float >();
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p CURSOR_BLINK_DURATION %f\n", impl.mController.Get(), duration );
- impl.mDecorator->SetCursorBlinkDuration( duration );
- }
+ impl.mDecorator->SetCursorBlinkDuration( duration );
break;
}
case Toolkit::TextField::Property::CURSOR_WIDTH:
{
- if( impl.mDecorator )
- {
- const int width = value.Get< int >();
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p CURSOR_WIDTH %d\n", impl.mController.Get(), width );
+ const int width = value.Get< int >();
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p CURSOR_WIDTH %d\n", impl.mController.Get(), width );
- impl.mDecorator->SetCursorWidth( width );
- impl.mController->GetLayoutEngine().SetCursorWidth( width );
- }
+ impl.mDecorator->SetCursorWidth( width );
+ impl.mController->GetLayoutEngine().SetCursorWidth( width );
break;
}
case Toolkit::TextField::Property::GRAB_HANDLE_IMAGE:
const std::string imageFileName = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p GRAB_HANDLE_IMAGE %s\n", impl.mController.Get(), imageFileName.c_str() );
- if( impl.mDecorator && imageFileName.size() )
+ if( imageFileName.size() )
{
impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED, imageFileName );
impl.RequestTextRelayout();
const std::string imageFileName = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p GRAB_HANDLE_PRESSED_IMAGE %s\n", impl.mController.Get(), imageFileName.c_str() );
- if( impl.mDecorator && imageFileName.size() )
+ if( imageFileName.size() )
{
impl.mDecorator->SetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED, imageFileName );
impl.RequestTextRelayout();
const float threshold = value.Get< float >();
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p SCROLL_THRESHOLD %f\n", impl.mController.Get(), threshold );
- if( impl.mDecorator )
- {
- impl.mDecorator->SetScrollThreshold( threshold );
- }
+ impl.mDecorator->SetScrollThreshold( threshold );
break;
}
case Toolkit::TextField::Property::SCROLL_SPEED:
const float speed = value.Get< float >();
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField %p SCROLL_SPEED %f\n", impl.mController.Get(), speed );
- if( impl.mDecorator )
- {
- impl.mDecorator->SetScrollSpeed( speed );
- }
+ impl.mDecorator->SetScrollSpeed( speed );
break;
}
case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_LEFT:
{
const std::string filename = GetImageFileNameFromPropertyValue( value );
- if( impl.mDecorator && filename.size() )
+ if( filename.size() )
{
impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, filename );
impl.RequestTextRelayout();
{
const std::string filename = GetImageFileNameFromPropertyValue( value );
- if( impl.mDecorator && filename.size() )
+ if( filename.size() )
{
impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_RELEASED, filename );
impl.RequestTextRelayout();
{
const std::string filename = GetImageFileNameFromPropertyValue( value );
- if( impl.mDecorator && filename.size() )
+ if( filename.size() )
{
impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, filename );
impl.RequestTextRelayout();
{
const std::string filename = GetImageFileNameFromPropertyValue( value );
- if( impl.mDecorator && filename.size() )
+ if( filename.size() )
{
impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE, HANDLE_IMAGE_PRESSED, filename );
impl.RequestTextRelayout();
{
const std::string filename = GetImageFileNameFromPropertyValue( value );
- if( impl.mDecorator && filename.size() )
+ if( filename.size() )
{
impl.mDecorator->SetHandleImage( LEFT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, filename );
impl.RequestTextRelayout();
{
const std::string filename = GetImageFileNameFromPropertyValue( value );
- if( impl.mDecorator && filename.size() )
+ if( filename.size() )
{
impl.mDecorator->SetHandleImage( RIGHT_SELECTION_HANDLE_MARKER, HANDLE_IMAGE_RELEASED, filename );
impl.RequestTextRelayout();
const Vector4 color = value.Get< Vector4 >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SELECTION_HIGHLIGHT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
- if( impl.mDecorator )
- {
- impl.mDecorator->SetHighlightColor( color );
- impl.RequestTextRelayout();
- }
+ impl.mDecorator->SetHighlightColor( color );
+ impl.RequestTextRelayout();
break;
}
case Toolkit::TextField::Property::DECORATION_BOUNDING_BOX:
{
- if( impl.mDecorator )
- {
- const Rect<int> box = value.Get< Rect<int> >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p DECORATION_BOUNDING_BOX %d,%d %dx%d\n", impl.mController.Get(), box.x, box.y, box.width, box.height );
+ const Rect<int> box = value.Get< Rect<int> >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p DECORATION_BOUNDING_BOX %d,%d %dx%d\n", impl.mController.Get(), box.x, box.y, box.width, box.height );
- impl.mDecorator->SetBoundingBox( box );
- impl.RequestTextRelayout();
- }
+ impl.mDecorator->SetBoundingBox( box );
+ impl.RequestTextRelayout();
break;
}
case Toolkit::TextField::Property::INPUT_METHOD_SETTINGS:
}
case Toolkit::TextField::Property::INPUT_COLOR:
{
- if( impl.mController )
- {
- const Vector4 inputColor = value.Get< Vector4 >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p INPUT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), inputColor.r, inputColor.g, inputColor.b, inputColor.a );
+ const Vector4 inputColor = value.Get< Vector4 >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p INPUT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), inputColor.r, inputColor.g, inputColor.b, inputColor.a );
- impl.mController->SetInputColor( inputColor );
- }
+ impl.mController->SetInputColor( inputColor );
break;
}
case Toolkit::TextField::Property::ENABLE_MARKUP:
{
- if( impl.mController )
- {
- const bool enableMarkup = value.Get<bool>();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_MARKUP %d\n", impl.mController.Get(), enableMarkup );
+ const bool enableMarkup = value.Get<bool>();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_MARKUP %d\n", impl.mController.Get(), enableMarkup );
- impl.mController->SetMarkupProcessorEnabled( enableMarkup );
- }
+ impl.mController->SetMarkupProcessorEnabled( enableMarkup );
break;
}
case Toolkit::TextField::Property::INPUT_FONT_FAMILY:
{
- if( impl.mController )
- {
- const std::string& fontFamily = value.Get< std::string >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p INPUT_FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() );
- impl.mController->SetInputFontFamily( fontFamily );
- }
+ const std::string& fontFamily = value.Get< std::string >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p INPUT_FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() );
+ impl.mController->SetInputFontFamily( fontFamily );
break;
}
case Toolkit::TextField::Property::INPUT_FONT_STYLE:
}
case Toolkit::TextField::Property::INPUT_POINT_SIZE:
{
- if( impl.mController )
- {
- const float pointSize = value.Get< float >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p INPUT_POINT_SIZE %f\n", impl.mController.Get(), pointSize );
- impl.mController->SetInputFontPointSize( pointSize );
- }
+ const float pointSize = value.Get< float >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p INPUT_POINT_SIZE %f\n", impl.mController.Get(), pointSize );
+ impl.mController->SetInputFontPointSize( pointSize );
break;
}
case Toolkit::TextField::Property::UNDERLINE:
}
case Toolkit::TextField::Property::PIXEL_SIZE:
{
- if( impl.mController )
- {
- const float pixelSize = value.Get< float >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PIXEL_SIZE %f\n", impl.mController.Get(), pixelSize );
+ const float pixelSize = value.Get< float >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PIXEL_SIZE %f\n", impl.mController.Get(), pixelSize );
- if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ), pixelSize ) )
- {
- impl.mController->SetDefaultFontSize( pixelSize, Text::Controller::PIXEL_SIZE );
- }
+ if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ), pixelSize ) )
+ {
+ impl.mController->SetDefaultFontSize( pixelSize, Text::Controller::PIXEL_SIZE );
}
break;
}
case Toolkit::TextField::Property::ENABLE_SELECTION:
{
- if( impl.mController )
- {
- const bool enableSelection = value.Get< bool >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_SELECTION %d\n", impl.mController.Get(), enableSelection );
- impl.mController->SetSelectionEnabled( enableSelection );
- }
+ const bool enableSelection = value.Get< bool >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_SELECTION %d\n", impl.mController.Get(), enableSelection );
+ impl.mController->SetSelectionEnabled( enableSelection );
break;
}
case Toolkit::TextField::Property::PLACEHOLDER:
}
case Toolkit::TextField::Property::ELLIPSIS:
{
- if( impl.mController )
- {
- const bool ellipsis = value.Get<bool>();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ELLIPSIS %d\n", impl.mController.Get(), ellipsis );
+ const bool ellipsis = value.Get<bool>();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ELLIPSIS %d\n", impl.mController.Get(), ellipsis );
- impl.mController->SetTextElideEnabled( ellipsis );
- }
+ impl.mController->SetTextElideEnabled( ellipsis );
break;
}
case Toolkit::DevelTextField::Property::ENABLE_SHIFT_SELECTION:
{
- if( impl.mController )
- {
- const bool shiftSelection = value.Get<bool>();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_SHIFT_SELECTION %d\n", impl.mController.Get(), shiftSelection );
+ const bool shiftSelection = value.Get<bool>();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_SHIFT_SELECTION %d\n", impl.mController.Get(), shiftSelection );
- impl.mController->SetShiftSelectionEnabled( shiftSelection );
- }
+ impl.mController->SetShiftSelectionEnabled( shiftSelection );
break;
}
case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE:
{
- if( impl.mController )
- {
- const bool grabHandleEnabled = value.Get<bool>();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_GRAB_HANDLE %d\n", impl.mController.Get(), grabHandleEnabled );
+ const bool grabHandleEnabled = value.Get<bool>();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_GRAB_HANDLE %d\n", impl.mController.Get(), grabHandleEnabled );
- impl.mController->SetGrabHandleEnabled( grabHandleEnabled );
- }
+ impl.mController->SetGrabHandleEnabled( grabHandleEnabled );
break;
}
case Toolkit::DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION:
{
- if( impl.mController )
- {
- impl.mController->SetMatchSystemLanguageDirection(value.Get< bool >());
- }
+ impl.mController->SetMatchSystemLanguageDirection(value.Get< bool >());
break;
}
case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP:
{
- if( impl.mController )
- {
- const bool grabHandlePopupEnabled = value.Get<bool>();
- DALI_LOG_INFO(gLogFilter, Debug::General, "TextField %p ENABLE_GRAB_HANDLE_POPUP %d\n", impl.mController.Get(), grabHandlePopupEnabled);
+ const bool grabHandlePopupEnabled = value.Get<bool>();
+ DALI_LOG_INFO(gLogFilter, Debug::General, "TextField %p ENABLE_GRAB_HANDLE_POPUP %d\n", impl.mController.Get(), grabHandlePopupEnabled);
- impl.mController->SetGrabHandlePopupEnabled(grabHandlePopupEnabled);
- break;
- }
+ impl.mController->SetGrabHandlePopupEnabled(grabHandlePopupEnabled);
+ break;
}
case Toolkit::DevelTextField::Property::BACKGROUND:
{
- if( impl.mController )
- {
- const Vector4 backgroundColor = value.Get< Vector4 >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p BACKGROUND %f,%f,%f,%f\n", impl.mController.Get(), backgroundColor.r, backgroundColor.g, backgroundColor.b, backgroundColor.a );
+ const Vector4 backgroundColor = value.Get< Vector4 >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p BACKGROUND %f,%f,%f,%f\n", impl.mController.Get(), backgroundColor.r, backgroundColor.g, backgroundColor.b, backgroundColor.a );
- impl.mController->SetBackgroundEnabled( true );
- impl.mController->SetBackgroundColor( backgroundColor );
- }
+ impl.mController->SetBackgroundEnabled( true );
+ impl.mController->SetBackgroundColor( backgroundColor );
break;
}
case Toolkit::DevelTextField::Property::SELECTED_TEXT_START:
if( textField )
{
TextField& impl( GetImpl( textField ) );
+ DALI_ASSERT_DEBUG( impl.mController && "No text contoller" );
+ DALI_ASSERT_DEBUG( impl.mDecorator && "No text decorator" );
switch( index )
{
}
case Toolkit::TextField::Property::TEXT:
{
- if( impl.mController )
- {
- std::string text;
- impl.mController->GetText( text );
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p returning text: %s\n", impl.mController.Get(), text.c_str() );
- value = text;
- }
+ std::string text;
+ impl.mController->GetText( text );
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p returning text: %s\n", impl.mController.Get(), text.c_str() );
+ value = text;
break;
}
case Toolkit::TextField::Property::PLACEHOLDER_TEXT:
{
- if( impl.mController )
- {
- std::string text;
- impl.mController->GetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text );
- value = text;
- }
+ std::string text;
+ impl.mController->GetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text );
+ value = text;
break;
}
case Toolkit::TextField::Property::PLACEHOLDER_TEXT_FOCUSED:
{
- if( impl.mController )
- {
- std::string text;
- impl.mController->GetPlaceholderText( Controller::PLACEHOLDER_TYPE_ACTIVE, text );
- value = text;
- }
+ std::string text;
+ impl.mController->GetPlaceholderText( Controller::PLACEHOLDER_TYPE_ACTIVE, text );
+ value = text;
break;
}
case Toolkit::TextField::Property::FONT_FAMILY:
{
- if( impl.mController )
- {
- value = impl.mController->GetDefaultFontFamily();
- }
+ value = impl.mController->GetDefaultFontFamily();
break;
}
case Toolkit::TextField::Property::FONT_STYLE:
}
case Toolkit::TextField::Property::POINT_SIZE:
{
- if( impl.mController )
- {
- value = impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE );
- }
+ value = impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE );
break;
}
case Toolkit::TextField::Property::MAX_LENGTH:
{
- if( impl.mController )
- {
- value = impl.mController->GetMaximumNumberOfCharacters();
- }
+ value = impl.mController->GetMaximumNumberOfCharacters();
break;
}
case Toolkit::TextField::Property::EXCEED_POLICY:
}
case Toolkit::TextField::Property::HORIZONTAL_ALIGNMENT:
{
- if( impl.mController )
- {
- const char* name = Text::GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() );
+ const char* name = Text::GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() );
- if ( name )
- {
- value = std::string( name );
- }
+ if ( name )
+ {
+ value = std::string( name );
}
break;
}
case Toolkit::TextField::Property::VERTICAL_ALIGNMENT:
{
- if( impl.mController )
- {
- const char* name = Text::GetVerticalAlignmentString( impl.mController->GetVerticalAlignment() );
+ const char* name = Text::GetVerticalAlignmentString( impl.mController->GetVerticalAlignment() );
- if( name )
- {
- value = std::string( name );
- }
+ if( name )
+ {
+ value = std::string( name );
}
break;
}
case Toolkit::TextField::Property::TEXT_COLOR:
{
- if ( impl.mController )
- {
- value = impl.mController->GetDefaultColor();
- }
+ value = impl.mController->GetDefaultColor();
break;
}
case Toolkit::TextField::Property::PLACEHOLDER_TEXT_COLOR:
{
- if ( impl.mController )
- {
- value = impl.mController->GetPlaceholderTextColor();
- }
+ value = impl.mController->GetPlaceholderTextColor();
break;
}
case Toolkit::TextField::Property::PRIMARY_CURSOR_COLOR:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetColor( PRIMARY_CURSOR );
- }
+ value = impl.mDecorator->GetColor( PRIMARY_CURSOR );
break;
}
case Toolkit::TextField::Property::SECONDARY_CURSOR_COLOR:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetColor( SECONDARY_CURSOR );
- }
+ value = impl.mDecorator->GetColor( SECONDARY_CURSOR );
break;
}
case Toolkit::TextField::Property::ENABLE_CURSOR_BLINK:
}
case Toolkit::TextField::Property::CURSOR_BLINK_INTERVAL:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetCursorBlinkInterval();
- }
+ value = impl.mDecorator->GetCursorBlinkInterval();
break;
}
case Toolkit::TextField::Property::CURSOR_BLINK_DURATION:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetCursorBlinkDuration();
- }
+ value = impl.mDecorator->GetCursorBlinkDuration();
break;
}
case Toolkit::TextField::Property::CURSOR_WIDTH:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetCursorWidth();
- }
+ value = impl.mDecorator->GetCursorWidth();
break;
}
case Toolkit::TextField::Property::GRAB_HANDLE_IMAGE:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED );
- }
+ value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_RELEASED );
break;
}
case Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED );
- }
+ value = impl.mDecorator->GetHandleImage( GRAB_HANDLE, HANDLE_IMAGE_PRESSED );
break;
}
case Toolkit::TextField::Property::SCROLL_THRESHOLD:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetScrollThreshold();
- }
+ value = impl.mDecorator->GetScrollThreshold();
break;
}
case Toolkit::TextField::Property::SCROLL_SPEED:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetScrollSpeed();
- }
+ value = impl.mDecorator->GetScrollSpeed();
break;
}
case Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_LEFT:
}
case Toolkit::TextField::Property::SELECTION_HIGHLIGHT_COLOR:
{
- if( impl.mDecorator )
- {
- value = impl.mDecorator->GetHighlightColor();
- }
+ value = impl.mDecorator->GetHighlightColor();
break;
}
case Toolkit::TextField::Property::DECORATION_BOUNDING_BOX:
{
- if( impl.mDecorator )
- {
- Rect<int> boundingBox;
- impl.mDecorator->GetBoundingBox( boundingBox );
- value = boundingBox;
- }
+ Rect<int> boundingBox;
+ impl.mDecorator->GetBoundingBox( boundingBox );
+ value = boundingBox;
break;
}
case Toolkit::TextField::Property::INPUT_METHOD_SETTINGS:
}
case Toolkit::TextField::Property::INPUT_COLOR:
{
- if( impl.mController )
- {
- value = impl.mController->GetInputColor();
- }
+ value = impl.mController->GetInputColor();
break;
}
case Toolkit::TextField::Property::ENABLE_MARKUP:
{
- if( impl.mController )
- {
- value = impl.mController->IsMarkupProcessorEnabled();
- }
+ value = impl.mController->IsMarkupProcessorEnabled();
break;
}
case Toolkit::TextField::Property::INPUT_FONT_FAMILY:
{
- if( impl.mController )
- {
- value = impl.mController->GetInputFontFamily();
- }
+ value = impl.mController->GetInputFontFamily();
break;
}
case Toolkit::TextField::Property::INPUT_FONT_STYLE:
}
case Toolkit::TextField::Property::INPUT_POINT_SIZE:
{
- if( impl.mController )
- {
- value = impl.mController->GetInputFontPointSize();
- }
+ value = impl.mController->GetInputFontPointSize();
break;
}
case Toolkit::TextField::Property::UNDERLINE:
}
case Toolkit::TextField::Property::PIXEL_SIZE:
{
- if( impl.mController )
- {
- value = impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE );
- }
+ value = impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE );
break;
}
case Toolkit::TextField::Property::ENABLE_SELECTION:
{
- if( impl.mController )
- {
- value = impl.mController->IsSelectionEnabled();
- }
+ value = impl.mController->IsSelectionEnabled();
break;
}
case Toolkit::TextField::Property::PLACEHOLDER:
}
case Toolkit::TextField::Property::ELLIPSIS:
{
- if( impl.mController )
- {
- value = impl.mController->IsTextElideEnabled();
- }
+ value = impl.mController->IsTextElideEnabled();
break;
}
case Toolkit::DevelTextField::Property::ENABLE_SHIFT_SELECTION:
{
- if( impl.mController )
- {
- value = impl.mController->IsShiftSelectionEnabled();
- }
+ value = impl.mController->IsShiftSelectionEnabled();
break;
}
case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE:
{
- if( impl.mController )
- {
- value = impl.mController->IsGrabHandleEnabled();
- }
+ value = impl.mController->IsGrabHandleEnabled();
break;
}
case Toolkit::DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION:
{
- if( impl.mController )
- {
- value = impl.mController->IsMatchSystemLanguageDirection();
- }
+ value = impl.mController->IsMatchSystemLanguageDirection();
break;
}
case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP:
{
- if( impl.mController )
- {
- value = impl.mController->IsGrabHandlePopupEnabled();
- }
+ value = impl.mController->IsGrabHandlePopupEnabled();
break;
}
case Toolkit::DevelTextField::Property::BACKGROUND:
{
- if( impl.mController )
- {
- value = impl.mController->GetBackgroundColor();
- }
+ value = impl.mController->GetBackgroundColor();
break;
}
case Toolkit::DevelTextField::Property::SELECTED_TEXT:
{
- if( impl.mController )
- {
- value = impl.mController->GetSelectedText( );
- }
+ value = impl.mController->GetSelectedText( );
break;
}
case Toolkit::DevelTextField::Property::SELECTED_TEXT_START:
#include <dali-toolkit/internal/controls/text-controls/text-label-impl.h>
// EXTERNAL INCLUDES
+#include <dali/public-api/common/dali-common.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/devel-api/common/stage.h>
#include <dali/devel-api/object/property-helper-devel.h>
if( label )
{
TextLabel& impl( GetImpl( label ) );
+ DALI_ASSERT_ALWAYS( impl.mController && "No text contoller" );
+
switch( index )
{
case Toolkit::DevelTextLabel::Property::RENDERING_BACKEND:
impl.mRenderingBackend = backend;
impl.mTextUpdateNeeded = true;
- if( impl.mController )
- {
- // When using the vector-based rendering, the size of the GLyphs are different
- TextAbstraction::GlyphType glyphType = (DevelText::RENDERING_VECTOR_BASED == impl.mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH;
- impl.mController->SetGlyphType( glyphType );
- }
+ // When using the vector-based rendering, the size of the GLyphs are different
+ TextAbstraction::GlyphType glyphType = (DevelText::RENDERING_VECTOR_BASED == impl.mRenderingBackend) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH;
+ impl.mController->SetGlyphType( glyphType );
}
break;
}
case Toolkit::TextLabel::Property::TEXT:
{
- if( impl.mController )
- {
- impl.mController->SetText( value.Get< std::string >() );
- }
+ impl.mController->SetText( value.Get< std::string >() );
break;
}
case Toolkit::TextLabel::Property::FONT_FAMILY:
{
- if( impl.mController )
- {
- const std::string& fontFamily = value.Get< std::string >();
+ const std::string& fontFamily = value.Get< std::string >();
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextLabel::SetProperty Property::FONT_FAMILY newFont(%s)\n", fontFamily.c_str() );
- impl.mController->SetDefaultFontFamily( fontFamily );
- }
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextLabel::SetProperty Property::FONT_FAMILY newFont(%s)\n", fontFamily.c_str() );
+ impl.mController->SetDefaultFontFamily( fontFamily );
break;
}
case Toolkit::TextLabel::Property::FONT_STYLE:
}
case Toolkit::TextLabel::Property::POINT_SIZE:
{
- if( impl.mController )
- {
- const float pointSize = value.Get< float >();
+ const float pointSize = value.Get< float >();
- if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ), pointSize ) )
- {
- impl.mController->SetDefaultFontSize( pointSize, Text::Controller::POINT_SIZE );
- }
+ if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE ), pointSize ) )
+ {
+ impl.mController->SetDefaultFontSize( pointSize, Text::Controller::POINT_SIZE );
}
break;
}
case Toolkit::TextLabel::Property::MULTI_LINE:
{
- if( impl.mController )
- {
- impl.mController->SetMultiLineEnabled( value.Get< bool >() );
- }
+ impl.mController->SetMultiLineEnabled( value.Get< bool >() );
break;
}
case Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT:
{
- if( impl.mController )
+ Text::HorizontalAlignment::Type alignment( static_cast< Text::HorizontalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
+ if( Text::GetHorizontalAlignmentEnumeration( value, alignment ) )
{
- Text::HorizontalAlignment::Type alignment( static_cast< Text::HorizontalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
- if( Text::GetHorizontalAlignmentEnumeration( value, alignment ) )
- {
- impl.mController->SetHorizontalAlignment( alignment );
- }
+ impl.mController->SetHorizontalAlignment( alignment );
}
break;
}
case Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT:
{
- if( impl.mController )
+ Toolkit::Text::VerticalAlignment::Type alignment( static_cast< Text::VerticalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
+ if( Text::GetVerticalAlignmentEnumeration( value, alignment ) )
{
- Toolkit::Text::VerticalAlignment::Type alignment( static_cast< Text::VerticalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
- if( Text::GetVerticalAlignmentEnumeration( value, alignment ) )
- {
- impl.mController->SetVerticalAlignment( alignment );
- }
+ impl.mController->SetVerticalAlignment( alignment );
}
break;
}
case Toolkit::TextLabel::Property::ENABLE_MARKUP:
{
- if( impl.mController )
- {
- const bool enableMarkup = value.Get<bool>();
- impl.mController->SetMarkupProcessorEnabled( enableMarkup );
- }
+ const bool enableMarkup = value.Get<bool>();
+ impl.mController->SetMarkupProcessorEnabled( enableMarkup );
break;
}
case Toolkit::TextLabel::Property::ENABLE_AUTO_SCROLL:
{
- if( impl.mController )
+ const bool enableAutoScroll = value.Get<bool>();
+ // If request to auto scroll is the same as current state then do nothing.
+ if ( enableAutoScroll != impl.mController->IsAutoScrollEnabled() )
{
- const bool enableAutoScroll = value.Get<bool>();
- // If request to auto scroll is the same as current state then do nothing.
- if ( enableAutoScroll != impl.mController->IsAutoScrollEnabled() )
- {
- // If request is disable (false) and auto scrolling is enabled then need to stop it
- if ( enableAutoScroll == false )
- {
- if( impl.mTextScroller )
- {
- impl.mTextScroller->StopScrolling();
- }
- }
- // If request is enable (true) then start autoscroll as not already running
- else
+ // If request is disable (false) and auto scrolling is enabled then need to stop it
+ if ( enableAutoScroll == false )
+ {
+ if( impl.mTextScroller )
{
- impl.mController->SetAutoScrollEnabled( enableAutoScroll );
+ impl.mTextScroller->StopScrolling();
}
- }
+ }
+ // If request is enable (true) then start autoscroll as not already running
+ else
+ {
+ impl.mController->SetAutoScrollEnabled( enableAutoScroll );
+ }
}
break;
}
}
case Toolkit::TextLabel::Property::LINE_SPACING:
{
- if( impl.mController )
- {
- const float lineSpacing = value.Get<float>();
+ const float lineSpacing = value.Get<float>();
- // Don't trigger anything if the line spacing didn't change
- if( impl.mController->SetDefaultLineSpacing( lineSpacing ) )
- {
- impl.mTextUpdateNeeded = true;
- }
+ // Don't trigger anything if the line spacing didn't change
+ if( impl.mController->SetDefaultLineSpacing( lineSpacing ) )
+ {
+ impl.mTextUpdateNeeded = true;
}
break;
}
}
case Toolkit::TextLabel::Property::PIXEL_SIZE:
{
- if( impl.mController )
- {
- const float pixelSize = value.Get< float >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel %p PIXEL_SIZE %f\n", impl.mController.Get(), pixelSize );
+ const float pixelSize = value.Get< float >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel %p PIXEL_SIZE %f\n", impl.mController.Get(), pixelSize );
- if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ), pixelSize ) )
- {
- impl.mController->SetDefaultFontSize( pixelSize, Text::Controller::PIXEL_SIZE );
- }
+ if( !Equals( impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE ), pixelSize ) )
+ {
+ impl.mController->SetDefaultFontSize( pixelSize, Text::Controller::PIXEL_SIZE );
}
break;
}
case Toolkit::TextLabel::Property::ELLIPSIS:
{
- if( impl.mController )
- {
- const bool ellipsis = value.Get<bool>();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel %p ELLIPSIS %d\n", impl.mController.Get(), ellipsis );
+ const bool ellipsis = value.Get<bool>();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel %p ELLIPSIS %d\n", impl.mController.Get(), ellipsis );
- impl.mController->SetTextElideEnabled( ellipsis );
- }
+ impl.mController->SetTextElideEnabled( ellipsis );
break;
}
case Toolkit::TextLabel::Property::LINE_WRAP_MODE:
{
- if( impl.mController )
+ Text::LineWrap::Mode lineWrapMode( static_cast< Text::LineWrap::Mode >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
+ if( GetLineWrapModeEnumeration( value, lineWrapMode ) )
{
- Text::LineWrap::Mode lineWrapMode( static_cast< Text::LineWrap::Mode >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
- if( GetLineWrapModeEnumeration( value, lineWrapMode ) )
- {
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel %p LineWrap::MODE %d\n", impl.mController.Get(), lineWrapMode );
- impl.mController->SetLineWrapMode( lineWrapMode );
- }
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel %p LineWrap::MODE %d\n", impl.mController.Get(), lineWrapMode );
+ impl.mController->SetLineWrapMode( lineWrapMode );
}
break;
}
case Toolkit::DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT:
{
- if( impl.mController && impl.mController->GetTextModel() )
+ if( impl.mController->GetTextModel() )
{
DevelText::VerticalLineAlignment::Type alignment = static_cast<DevelText::VerticalLineAlignment::Type>( value.Get<int>() );
}
case Toolkit::DevelTextLabel::Property::MIN_LINE_SIZE:
{
- if( impl.mController )
- {
- const float lineSize = value.Get<float>();
+ const float lineSize = value.Get<float>();
- if( impl.mController->SetDefaultLineSize( lineSize ) )
- {
- impl.mTextUpdateNeeded = true;
- }
+ if( impl.mController->SetDefaultLineSize( lineSize ) )
+ {
+ impl.mTextUpdateNeeded = true;
}
break;
}
if( label )
{
TextLabel& impl( GetImpl( label ) );
+ DALI_ASSERT_DEBUG( impl.mController && "No text contoller" );
+
switch( index )
{
case Toolkit::DevelTextLabel::Property::RENDERING_BACKEND:
}
case Toolkit::TextLabel::Property::TEXT:
{
- if( impl.mController )
- {
- std::string text;
- impl.mController->GetText( text );
- value = text;
- }
+ std::string text;
+ impl.mController->GetText( text );
+ value = text;
break;
}
case Toolkit::TextLabel::Property::FONT_FAMILY:
{
- if( impl.mController )
- {
- value = impl.mController->GetDefaultFontFamily();
- }
+ value = impl.mController->GetDefaultFontFamily();
break;
}
case Toolkit::TextLabel::Property::FONT_STYLE:
}
case Toolkit::TextLabel::Property::POINT_SIZE:
{
- if( impl.mController )
- {
- value = impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE );
- }
+ value = impl.mController->GetDefaultFontSize( Text::Controller::POINT_SIZE );
break;
}
case Toolkit::TextLabel::Property::MULTI_LINE:
{
- if( impl.mController )
- {
- value = impl.mController->IsMultiLineEnabled();
- }
+ value = impl.mController->IsMultiLineEnabled();
break;
}
case Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT:
{
- if( impl.mController )
- {
- const char* name = Text::GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() );
+ const char* name = Text::GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() );
- if ( name )
- {
- value = std::string( name );
- }
+ if ( name )
+ {
+ value = std::string( name );
}
break;
}
case Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT:
{
- if( impl.mController )
+ const char* name = Text::GetVerticalAlignmentString( impl.mController->GetVerticalAlignment() );
+ if( name )
{
- const char* name = Text::GetVerticalAlignmentString( impl.mController->GetVerticalAlignment() );
- if( name )
- {
- value = std::string( name );
- }
+ value = std::string( name );
}
break;
}
case Toolkit::TextLabel::Property::ENABLE_MARKUP:
{
- if( impl.mController )
- {
- value = impl.mController->IsMarkupProcessorEnabled();
- }
+ value = impl.mController->IsMarkupProcessorEnabled();
break;
}
case Toolkit::TextLabel::Property::ENABLE_AUTO_SCROLL:
{
- if( impl.mController )
- {
- value = impl.mController->IsAutoScrollEnabled();
- }
+ value = impl.mController->IsAutoScrollEnabled();
break;
}
case Toolkit::TextLabel::Property::AUTO_SCROLL_STOP_MODE:
}
case Toolkit::TextLabel::Property::AUTO_SCROLL_SPEED:
{
- TextLabel& impl( GetImpl( label ) );
if ( impl.mTextScroller )
{
value = impl.mTextScroller->GetSpeed();
}
case Toolkit::TextLabel::Property::AUTO_SCROLL_LOOP_COUNT:
{
- if( impl.mController )
+ if ( impl.mTextScroller )
{
- TextLabel& impl( GetImpl( label ) );
- if ( impl.mTextScroller )
- {
- value = impl.mTextScroller->GetLoopCount();
- }
+ value = impl.mTextScroller->GetLoopCount();
}
break;
}
case Toolkit::TextLabel::Property::AUTO_SCROLL_LOOP_DELAY:
{
- if( impl.mController )
+ if ( impl.mTextScroller )
{
- TextLabel& impl( GetImpl( label ) );
- if ( impl.mTextScroller )
- {
- value = impl.mTextScroller->GetLoopDelay();
- }
+ value = impl.mTextScroller->GetLoopDelay();
}
break;
}
case Toolkit::TextLabel::Property::AUTO_SCROLL_GAP:
{
- TextLabel& impl( GetImpl( label ) );
if ( impl.mTextScroller )
{
value = impl.mTextScroller->GetGap();
}
case Toolkit::TextLabel::Property::LINE_SPACING:
{
- if( impl.mController )
- {
- value = impl.mController->GetDefaultLineSpacing();
- }
+ value = impl.mController->GetDefaultLineSpacing();
break;
}
case Toolkit::TextLabel::Property::UNDERLINE:
}
case Toolkit::TextLabel::Property::PIXEL_SIZE:
{
- if( impl.mController )
- {
- value = impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE );
- }
+ value = impl.mController->GetDefaultFontSize( Text::Controller::PIXEL_SIZE );
break;
}
case Toolkit::TextLabel::Property::ELLIPSIS:
{
- if( impl.mController )
- {
- value = impl.mController->IsTextElideEnabled();
- }
+ value = impl.mController->IsTextElideEnabled();
break;
}
case Toolkit::TextLabel::Property::LINE_WRAP_MODE:
{
- if( impl.mController )
- {
- value = impl.mController->GetLineWrapMode();
- }
+ value = impl.mController->GetLineWrapMode();
break;
}
case Toolkit::TextLabel::Property::LINE_COUNT:
{
- if( impl.mController )
- {
- float width = label.GetProperty( Actor::Property::SIZE_WIDTH ).Get<float>();
- value = impl.mController->GetLineCount( width );
- }
+ float width = label.GetProperty( Actor::Property::SIZE_WIDTH ).Get<float>();
+ value = impl.mController->GetLineCount( width );
break;
}
case Toolkit::DevelTextLabel::Property::TEXT_DIRECTION:
{
- if( impl.mController )
- {
- value = impl.mController->GetTextDirection();
- }
+ value = impl.mController->GetTextDirection();
break;
}
case Toolkit::DevelTextLabel::Property::VERTICAL_LINE_ALIGNMENT:
{
- if( impl.mController )
- {
- value = impl.mController->GetVerticalLineAlignment();
- }
+ value = impl.mController->GetVerticalLineAlignment();
break;
}
case Toolkit::DevelTextLabel::Property::BACKGROUND:
}
case Toolkit::DevelTextLabel::Property::MIN_LINE_SIZE:
{
- if( impl.mController )
- {
- value = impl.mController->GetDefaultLineSize();
- }
+ value = impl.mController->GetDefaultLineSize();
break;
}
}
TextVisual::SetAnimatableTextColorProperty( mVisual, Toolkit::TextLabel::Property::TEXT_COLOR );
mController = TextVisual::GetController(mVisual);
- if( mController )
- {
- mController->SetControlInterface(this);
- }
+ DALI_ASSERT_DEBUG( mController && "Invalid Text Controller")
+
+ mController->SetControlInterface(this);
// Use height-for-width negotiation by default
self.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::WIDTH );
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
+#ifdef NO_THORVG
#include <dali-toolkit/third-party/nanosvg/nanosvgrast.h>
+#endif /* NO_THORVG */
#include <dali-toolkit/internal/visuals/svg/svg-visual.h>
namespace Dali
const char * const UNITS("px");
}
+#ifdef NO_THORVG
RasterizingTask::RasterizingTask( SvgVisual* svgRenderer, NSVGimage* parsedSvg, const VisualUrl& url, float dpi, unsigned int width, unsigned int height)
: mSvgVisual( svgRenderer ),
mParsedSvg( parsedSvg ),
{
mRasterizer = nsvgCreateRasterizer();
}
+#else /* NO_THORVG */
+RasterizingTask::RasterizingTask( SvgVisual* svgRenderer, VectorImageRenderer vectorRenderer, const VisualUrl& url, float dpi, unsigned int width, unsigned int height, bool loaded)
+: mSvgVisual( svgRenderer ),
+ mVectorRenderer( vectorRenderer ),
+ mUrl( url ),
+ mDpi( dpi ),
+ mWidth( width ),
+ mHeight( height ),
+ mLoaded( loaded )
+{
+
+}
+#endif /* NO_THORVG */
RasterizingTask::~RasterizingTask()
{
+#ifdef NO_THORVG
nsvgDeleteRasterizer( mRasterizer );
+#endif /* NO_THORVG */
}
void RasterizingTask::Load()
{
+#ifdef NO_THORVG
if( mParsedSvg != NULL)
{
return;
remoteBuffer.PushBack( '\0' );
mParsedSvg = nsvgParse( reinterpret_cast<char*>(remoteBuffer.begin()), UNITS, mDpi );
}
+#else /* NO_THORVG */
+ if( !mLoaded && !mUrl.IsLocalResource() )
+ {
+ Dali::Vector<uint8_t> remoteBuffer;
+
+ if( !Dali::FileLoader::DownloadFileSynchronously( mUrl.GetUrl(), remoteBuffer ))
+ {
+ DALI_LOG_ERROR("Failed to download file!\n");
+ return;
+ }
+
+ remoteBuffer.PushBack( '\0' );
+ char *data = reinterpret_cast<char*>(remoteBuffer.begin());
+ if ( !mVectorRenderer.Load( data, remoteBuffer.Size()))
+ {
+ DALI_LOG_ERROR( "Failed to load data!\n" );
+ return;
+ }
+
+ mLoaded = true;
+ }
+#endif /* NO_THORVG */
}
void RasterizingTask::Rasterize( )
{
+#ifdef NO_THORVG
if( mParsedSvg != NULL && mWidth > 0u && mHeight > 0u )
{
float scaleX = static_cast<float>( mWidth ) / mParsedSvg->width;
mPixelData = Dali::PixelData::New( buffer, bufferSize, mWidth, mHeight, Pixel::RGBA8888, Dali::PixelData::DELETE_ARRAY );
}
+#else /* NO_THORVG */
+ if ( mWidth <= 0u || mHeight <= 0u )
+ {
+ DALI_LOG_ERROR( "Size is zero!\n" );
+ return;
+ }
+
+ Devel::PixelBuffer pixelBuffer = Devel::PixelBuffer::New( mWidth, mHeight, Dali::Pixel::RGBA8888 );
+ mVectorRenderer.SetBuffer( pixelBuffer );
+ {
+ uint32_t defaultWidth, defaultHeight;
+ mVectorRenderer.GetDefaultSize( defaultWidth, defaultHeight );
+
+ float scaleX = static_cast<float>( mWidth ) / static_cast<float>( defaultWidth );
+ float scaleY = static_cast<float>( mHeight ) / static_cast<float>( defaultHeight );
+ float scale = scaleX < scaleY ? scaleX : scaleY;
+
+ if ( !mVectorRenderer.Render( scale ) )
+ {
+ DALI_LOG_ERROR( "SVG Render Fail!\n" );
+ return;
+ }
+
+ mPixelData = Devel::PixelBuffer::Convert( pixelBuffer );
+ if ( !mPixelData )
+ {
+ DALI_LOG_ERROR( "Pixel Data is null\n" );
+ }
+ }
+#endif /* NO_THORVG */
}
+#ifdef NO_THORVG
NSVGimage* RasterizingTask::GetParsedImage() const
{
return mParsedSvg;
}
+#else /* NO_THORVG */
+VectorImageRenderer RasterizingTask::GetVectorRenderer() const
+{
+ return mVectorRenderer;
+}
+
+bool RasterizingTask::IsLoaded() const
+{
+ return mLoaded;
+}
+#endif /* NO_THORVG */
SvgVisual* RasterizingTask::GetSvgVisual() const
{
}
}
+#ifdef NO_THORVG
void SvgRasterizeThread::DeleteImage( NSVGimage* parsedSvg )
{
// Lock while adding image to the delete queue
mDeleteSvg.PushBack( parsedSvg );
}
}
+#else /* NO_THORVG */
+void SvgRasterizeThread::DeleteImage( VectorImageRenderer vectorRenderer )
+{
+ // Lock while adding image to the delete queue
+ ConditionalWait::ScopedLock lock( mConditionalWait );
+
+ if( mIsThreadWaiting ) // no rasterization is ongoing, save to delete
+ {
+ // TODO: what?
+ }
+ else // wait to delete until current rasterization completed.
+ {
+ mDeleteSvg.PushBack( &vectorRenderer );
+ }
+}
+#endif /* NO_THORVG */
RasterizingTaskPtr SvgRasterizeThread::NextTaskToProcess()
{
// Delete the image here to make sure that it is not used in the nsvgRasterize()
if( !mDeleteSvg.Empty() )
{
+#ifdef NO_THORVG
for( Vector< NSVGimage* >::Iterator it = mDeleteSvg.Begin(), endIt = mDeleteSvg.End();
it != endIt;
++it )
{
nsvgDelete( *it );
}
+#endif /* NO_THORVG */
mDeleteSvg.Clear();
}
#include <dali/public-api/rendering/texture-set.h>
#include <dali-toolkit/internal/visuals/visual-url.h>
+#ifdef NO_THORVG
struct NSVGimage;
struct NSVGrasterizer;
+#else /* NO_THORVG */
+#include <string.h>
+#include <dali/devel-api/adaptor-framework/vector-image-renderer.h>
+#endif /* NO_THORVG */
namespace Dali
{
class RasterizingTask : public RefObject
{
public:
+#ifdef NO_THORVG
/**
* Constructor
*
* @param[in] height The rasterization height.
*/
RasterizingTask( SvgVisual* svgRenderer, NSVGimage* parsedSvg, const VisualUrl& url, float dpi, unsigned int width, unsigned int height );
+#else /* NO_THORVG */
+ /**
+ * Constructor
+ * @param[in] svgRenderer The renderer which the rasterized image to be applied.
+ * @param[in] url The URL to svg resource to use.
+ * @param[in] width The rasterization width.
+ * @param[in] height The rasterization height.
+ * @param[in] loaded The svg resource is loaded or not.
+ */
+ RasterizingTask( SvgVisual* svgRenderer, VectorImageRenderer vectorRenderer, const VisualUrl& url, float dpi, unsigned int width, unsigned int height, bool loaded );
+#endif /* NO_THORVG */
/**
* Destructor.
*/
PixelData GetPixelData() const;
+#ifdef NO_THORVG
/**
* Get the parsed data.
* @return parsed image data.
*/
NSVGimage* GetParsedImage() const;
+ /**
+ * Get default size of svg
+ *
+ * @param[out] width The default width of svg
+ * @param[out] height The default height of svg
+ */
+ void GetDefaultSize( uint32_t& width, uint32_t& height ) const;
+#else /* NO_THORVG */
+ /**
+ * Get the VectorRenderer.
+ * @return VectorRenderer.
+ */
+ VectorImageRenderer GetVectorRenderer() const;
+ /**
+ * Whether the resource is loaded.
+ * @return True if the resource is loaded.
+ */
+ bool IsLoaded() const;
+#endif /* NO_THORVG */
/**
* Load svg file
private:
SvgVisualPtr mSvgVisual;
+#ifdef NO_THORVG
NSVGimage* mParsedSvg;
+#else /* NO_THORVG */
+ VectorImageRenderer mVectorRenderer;
+#endif /* NO_THORVG */
VisualUrl mUrl;
PixelData mPixelData;
float mDpi;
unsigned int mWidth;
unsigned int mHeight;
+#ifdef NO_THORVG
NSVGrasterizer* mRasterizer;
+#else /* NO_THORVG */
+ bool mLoaded;
+#endif /* NO_THORVG */
};
/**
*/
void RemoveTask( SvgVisual* visual );
+#ifdef NO_THORVG
/**
* Delete the parsed SVG image, called by main thread.
*
- * The parsed svg should be delelted in worker thread, as the main thread does not know whether a rasterization of this svg is ongoing.
+ * The parsed svg should be deleted in worker thread, as the main thread does not know whether a rasterization of this svg is ongoing.
*
* @param[in] parsedImage The image to be deleted
*/
void DeleteImage( NSVGimage* parsedSvg );
+#else /* NO_THORVG */
+ /**
+ * Delete the parsed SVG image, called by main thread.
+ *
+ * The parsed svg should be deleted in worker thread, as the main thread does not know whether a rasterization of this svg is ongoing.
+ *
+ * @param[in] VectorImage The image to be deleted
+ */
+ void DeleteImage( VectorImageRenderer vectorImage );
+#endif /* NO_THORVG */
private:
std::vector<RasterizingTaskPtr> mRasterizeTasks; //The queue of the tasks waiting to rasterize the SVG image
std::vector <RasterizingTaskPtr> mCompletedTasks; //The queue of the tasks with the SVG rasterization completed
+#ifdef NO_THORVG
Vector<NSVGimage*> mDeleteSvg; //The images that the event thread requested to delete
+#else /* NO_THORVG */
+ Vector <VectorImageRenderer*> mDeleteSvg; //The images that the event thread requested to delete
+#endif /* NO_THORVG */
ConditionalWait mConditionalWait;
Dali::Mutex mMutex;
#include "svg-visual.h"
// INTERNAL INCLUDES
+#ifdef NO_THORVG
#include <dali-toolkit/third-party/nanosvg/nanosvg.h>
#include <dali-toolkit/third-party/nanosvg/nanosvgrast.h>
+#endif /* NO_THORVG */
#include <dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h>
#include <dali-toolkit/internal/visuals/image-atlas-manager.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
SvgVisualPtr SvgVisual::New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties )
{
SvgVisualPtr svgVisual( new SvgVisual( factoryCache, shaderFactory, imageUrl ) );
+#ifdef NO_THORVG
svgVisual->ParseFromUrl( imageUrl );
svgVisual->SetProperties( properties );
+#else /* NO_THORVG */
+ svgVisual->Load();
+ svgVisual->SetProperties( properties );
+#endif /* NO_THORVG */
return svgVisual;
}
SvgVisualPtr SvgVisual::New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl )
{
SvgVisualPtr svgVisual( new SvgVisual( factoryCache, shaderFactory, imageUrl ) );
+#ifdef NO_THORVG
svgVisual->ParseFromUrl( imageUrl );
+#else /* NO_THORVG */
+ svgVisual->Load();
+#endif /* NO_THORVG */
return svgVisual;
}
mImageVisualShaderFactory( shaderFactory ),
mAtlasRect( FULL_TEXTURE_RECT ),
mImageUrl( imageUrl ),
+#ifdef NO_THORVG
mParsedImage( NULL ),
+#else
+ mVectorRenderer( VectorImageRenderer::New() ),
+ mDefaultWidth( 0 ),
+ mDefaultHeight( 0 ),
+ mLoaded( false ),
+ mLocalResource( true ),
+#endif /* NO_THORVG */
mPlacementActor(),
mVisualSize(Vector2::ZERO),
mAttemptAtlasing( false )
SvgVisual::~SvgVisual()
{
+#ifdef NO_THORVG
if( mParsedImage )
{
nsvgDelete( mParsedImage );
}
+#endif /* NO_THORVG */
}
void SvgVisual::DoSetProperties( const Property::Map& propertyMap )
void SvgVisual::GetNaturalSize( Vector2& naturalSize )
{
+#ifdef NO_THORVG
if( mParsedImage )
{
naturalSize.x = mParsedImage->width;
naturalSize.y = mParsedImage->height;
}
+#else /* NO_THORVG */
+ if ( mLoaded )
+ {
+ naturalSize.x = mDefaultWidth;
+ naturalSize.y = mDefaultHeight;
+ }
+#endif /* NO_THORVG */
else
{
naturalSize = Vector2::ZERO;
// Do nothing
}
+#ifdef NO_THORVG
void SvgVisual::ParseFromUrl( const VisualUrl& imageUrl )
{
mImageUrl = imageUrl;
}
}
}
+#else /* NO_THORVG */
+void SvgVisual::Load()
+{
+ if( mLoaded || !mLocalResource )
+ {
+ return;
+ }
+
+ mLocalResource = mImageUrl.IsLocalResource();
+
+ if( !mLocalResource )
+ {
+ // load remote resource on svg rasterize thread.
+ return;
+ }
+
+ if( !mVectorRenderer.Load( mImageUrl.GetUrl() ) )
+ {
+ DALI_LOG_ERROR( "Failed to load file!\n" );
+ return;
+ }
+
+ mVectorRenderer.GetDefaultSize(mDefaultWidth, mDefaultHeight);
+ mLoaded = true;
+}
+#endif /* NO_THORVG */
+
void SvgVisual::AddRasterizationTask( const Vector2& size )
{
Vector2 dpi = Stage::GetCurrent().GetDpi();
float meanDpi = ( dpi.height + dpi.width ) * 0.5f;
+#ifdef NO_THORVG
RasterizingTaskPtr newTask = new RasterizingTask( this, mParsedImage, mImageUrl, meanDpi, width, height );
+#else /* NO_THORVG */
+ RasterizingTaskPtr newTask = new RasterizingTask( this, mVectorRenderer, mImageUrl, meanDpi, width, height, mLoaded );
+#endif /* NO_THORVG */
if ( IsSynchronousLoadingRequired() )
{
+#ifdef NO_THORVG
newTask->Rasterize();
ApplyRasterizedImage( newTask->GetParsedImage(), newTask->GetPixelData() );
+#else /* NO_THORVG */
+ newTask->Load();
+ newTask->Rasterize();
+ ApplyRasterizedImage( newTask->GetVectorRenderer(), newTask->GetPixelData(), newTask->IsLoaded() );
+#endif /* NO_THORVG */
}
else
{
}
}
+#ifdef NO_THORVG
void SvgVisual::ApplyRasterizedImage( NSVGimage* parsedSvg, PixelData rasterizedPixelData )
{
if( mParsedImage == NULL)
}
if( mParsedImage && IsOnScene() )
+#else /* NO_THORVG */
+void SvgVisual::ApplyRasterizedImage( VectorImageRenderer vectorRenderer, PixelData rasterizedPixelData, bool isLoaded )
+{
+ mLoaded = isLoaded;
+
+ if( isLoaded && rasterizedPixelData && IsOnScene() )
+#endif /* NO_THORVG */
{
TextureSet currentTextureSet = mImpl->mRenderer.GetTextures();
if( mImpl->mFlags & Impl::IS_ATLASING_APPLIED )
// Svg loaded and ready to display
ResourceReady( Toolkit::Visual::ResourceStatus::READY );
}
+#ifdef NO_THORVG
else if( !mParsedImage )
+#else /* NO_THORVG */
+ else if( !isLoaded || !rasterizedPixelData )
+#endif /* NO_THORVG */
{
ResourceReady( Toolkit::Visual::ResourceStatus::FAILED );
}
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/visuals/visual-url.h>
+#ifdef NO_THORVG
struct NSVGimage;
+#endif /* NO_THORVG */
namespace Dali
{
public:
+#ifdef NO_THORVG
/**
* @bried Apply the rasterized image to the visual.
*
* @param[in] rasterizedPixelData The pixel buffer with the rasterized pixels
*/
void ApplyRasterizedImage( NSVGimage* parsedSvg, PixelData rasterizedPixelData );
+#else /* NO_THORVG */
+ /**
+ * @bried Apply the rasterized image to the visual.
+ *
+ * @param[in] vectorImage The data of vector image.
+ * @param[in] rasterizedPixelData The pixel buffer with the rasterized pixels
+ * @param[in] bool Whether the resource is loaded
+ */
+ void ApplyRasterizedImage( VectorImageRenderer vectorImage, PixelData rasterizedPixelData, bool isLoaded );
+#endif /* NO_THORVG */
private:
+#ifdef NO_THORVG
/**
* @brief Parses the SVG Image from the set URL.
*
* @param[in] imageUrl The URL of the image to parse the SVG from.
*/
void ParseFromUrl( const VisualUrl& imageUrl );
+#else /* NO_THORVG */
+ /**
+ * @brief Load the SVG Image from the set URL.
+ */
+ void Load();
+#endif /* NO_THORVG */
/**
* @bried Rasterize the svg with the given size, and add it to the visual.
ImageVisualShaderFactory& mImageVisualShaderFactory;
Vector4 mAtlasRect;
VisualUrl mImageUrl;
+#ifdef NO_THORVG
NSVGimage* mParsedImage;
+#else /* NO_THORVG */
+ VectorImageRenderer mVectorRenderer;
+ uint32_t mDefaultWidth;
+ uint32_t mDefaultHeight;
+ bool mLoaded;
+ bool mLocalResource;
+#endif /* NO_THORVG */
WeakHandle<Actor> mPlacementActor;
Vector2 mVisualSize;
bool mAttemptAtlasing; ///< If true will attempt atlasing, otherwise create unique texture
{
while( RasterizingTaskPtr task = mSvgRasterizeThread->NextCompletedTask() )
{
+#ifdef NO_THORVG
task->GetSvgVisual()->ApplyRasterizedImage( task->GetParsedImage(), task->GetPixelData() );
+#else /* NO_THORVG */
+ task->GetSvgVisual()->ApplyRasterizedImage( task->GetVectorRenderer(), task->GetPixelData(), task->IsLoaded() );
+#endif /* NO_THORVG */
}
}