// INTERNAL INCLUDES
#include <dali-toolkit/public-api/text/layouts/layout-engine.h>
-#include <dali-toolkit/public-api/text/rendering/basic/text-basic-renderer.h> // TODO - Get from RendererFactory
+#include <dali-toolkit/public-api/text/rendering/text-backend.h>
using namespace Dali::Toolkit::Text;
namespace Toolkit
{
-const Property::Index TextField::PROPERTY_PLACEHOLDER_TEXT( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX );
-const Property::Index TextField::PROPERTY_TEXT( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 1 );
-const Property::Index TextField::PROPERTY_CURSOR_IMAGE( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 2 );
-const Property::Index TextField::PROPERTY_PRIMARY_CURSOR_COLOR( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 3 );
-const Property::Index TextField::PROPERTY_SECONDARY_CURSOR_COLOR( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 4 );
-const Property::Index TextField::PROPERTY_ENABLE_CURSOR_BLINK( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 5 );
-const Property::Index TextField::PROPERTY_CURSOR_BLINK_INTERVAL( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 6 );
-const Property::Index TextField::PROPERTY_CURSOR_BLINK_DURATION( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 7 );
-const Property::Index TextField::PROPERTY_GRAB_HANDLE_IMAGE( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 8 );
+const Property::Index TextField::PROPERTY_RENDERING_BACKEND( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX );
+const Property::Index TextField::PROPERTY_PLACEHOLDER_TEXT( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 1 );
+const Property::Index TextField::PROPERTY_TEXT( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 2 );
+const Property::Index TextField::PROPERTY_CURSOR_IMAGE( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 3 );
+const Property::Index TextField::PROPERTY_PRIMARY_CURSOR_COLOR( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 4 );
+const Property::Index TextField::PROPERTY_SECONDARY_CURSOR_COLOR( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 5 );
+const Property::Index TextField::PROPERTY_ENABLE_CURSOR_BLINK( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 6 );
+const Property::Index TextField::PROPERTY_CURSOR_BLINK_INTERVAL( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 7 );
+const Property::Index TextField::PROPERTY_CURSOR_BLINK_DURATION( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 8 );
+const Property::Index TextField::PROPERTY_GRAB_HANDLE_IMAGE( Internal::TextField::TEXTFIELD_PROPERTY_START_INDEX + 9 );
namespace Internal
{
TypeRegistration mType( typeid(Toolkit::TextField), typeid(Toolkit::Control), Create );
-PropertyRegistration property1( mType, "placeholder-text", Toolkit::TextField::PROPERTY_PLACEHOLDER_TEXT, Property::STRING, &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property2( mType, "text", Toolkit::TextField::PROPERTY_TEXT, Property::STRING, &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property3( mType, "cursor-image", Toolkit::TextField::PROPERTY_CURSOR_IMAGE, Property::STRING, &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property4( mType, "primary-cursor-color", Toolkit::TextField::PROPERTY_PRIMARY_CURSOR_COLOR, Property::VECTOR4, &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property5( mType, "secondary-cursor-color", Toolkit::TextField::PROPERTY_SECONDARY_CURSOR_COLOR, Property::VECTOR4, &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property6( mType, "enable-cursor-blink", Toolkit::TextField::PROPERTY_ENABLE_CURSOR_BLINK, Property::BOOLEAN, &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property7( mType, "cursor-blink-interval", Toolkit::TextField::PROPERTY_CURSOR_BLINK_INTERVAL, Property::FLOAT, &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property8( mType, "cursor-blink-duration", Toolkit::TextField::PROPERTY_CURSOR_BLINK_DURATION, Property::FLOAT, &TextField::SetProperty, &TextField::GetProperty );
-PropertyRegistration property9( mType, "grab-handle-image", Toolkit::TextField::PROPERTY_GRAB_HANDLE_IMAGE, Property::STRING, &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property01( mType, "rendering-backend", Toolkit::TextField::PROPERTY_RENDERING_BACKEND, Property::UNSIGNED_INTEGER, &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property02( mType, "placeholder-text", Toolkit::TextField::PROPERTY_PLACEHOLDER_TEXT, Property::STRING, &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property03( mType, "text", Toolkit::TextField::PROPERTY_TEXT, Property::STRING, &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property04( mType, "cursor-image", Toolkit::TextField::PROPERTY_CURSOR_IMAGE, Property::STRING, &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property05( mType, "primary-cursor-color", Toolkit::TextField::PROPERTY_PRIMARY_CURSOR_COLOR, Property::VECTOR4, &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property06( mType, "secondary-cursor-color", Toolkit::TextField::PROPERTY_SECONDARY_CURSOR_COLOR, Property::VECTOR4, &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property07( mType, "enable-cursor-blink", Toolkit::TextField::PROPERTY_ENABLE_CURSOR_BLINK, Property::BOOLEAN, &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property08( mType, "cursor-blink-interval", Toolkit::TextField::PROPERTY_CURSOR_BLINK_INTERVAL, Property::FLOAT, &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property09( mType, "cursor-blink-duration", Toolkit::TextField::PROPERTY_CURSOR_BLINK_DURATION, Property::FLOAT, &TextField::SetProperty, &TextField::GetProperty );
+PropertyRegistration property10( mType, "grab-handle-image", Toolkit::TextField::PROPERTY_GRAB_HANDLE_IMAGE, Property::STRING, &TextField::SetProperty, &TextField::GetProperty );
} // namespace
return handle;
}
-void TextField::SetRenderer( Text::RendererPtr renderer )
-{
- mRenderer = renderer;
-}
-
void TextField::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
{
Toolkit::TextField textField = Toolkit::TextField::DownCast( Dali::BaseHandle( object ) );
switch( index )
{
+ case Toolkit::TextField::PROPERTY_RENDERING_BACKEND:
+ {
+ unsigned int backend = value.Get< unsigned int >();
+
+ if( impl.mRenderingBackend != backend )
+ {
+ impl.mRenderingBackend = backend;
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
case Toolkit::TextField::PROPERTY_PLACEHOLDER_TEXT:
{
if( impl.mController )
switch( index )
{
+ case Toolkit::TextField::PROPERTY_RENDERING_BACKEND:
+ {
+ value = impl.mRenderingBackend;
+ break;
+ }
case Toolkit::TextField::PROPERTY_PLACEHOLDER_TEXT:
{
DALI_LOG_WARNING( "UTF-8 text representation was discarded\n" );
{
if( !mRenderer )
{
- // TODO - Get from RendererFactory
- mRenderer = Dali::Toolkit::Text::BasicRenderer::New();
+ mRenderer = Backend::Get().NewRenderer( mRenderingBackend );
}
if( mRenderer )
-#ifndef __DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H__
-#define __DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H__
+#ifndef __DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H__
+#define __DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H__
/*
* Copyright (c) 2015 Samsung Electronics Co., Ltd.
*/
static Toolkit::TextField New();
- /**
- * @copydoc Dali::Toollkit::TextField::SetRenderer()
- */
- void SetRenderer( Text::RendererPtr renderer );
-
// Properties
/**
Text::ControllerPtr mController;
Text::RendererPtr mRenderer;
Text::DecoratorPtr mDecorator;
+
+ unsigned int mRenderingBackend;
};
} // namespace Internal
// Helpers for public-api forwarding methods
-inline Toolkit::Internal::TextField& GetImpl( Toolkit::TextField& textLabel )
+inline Toolkit::Internal::TextField& GetImpl( Toolkit::TextField& textField )
{
- DALI_ASSERT_ALWAYS(textLabel);
+ DALI_ASSERT_ALWAYS(textField);
- Dali::RefObject& handle = textLabel.GetImplementation();
+ Dali::RefObject& handle = textField.GetImplementation();
return static_cast<Toolkit::Internal::TextField&>(handle);
}
-inline const Toolkit::Internal::TextField& GetImpl( const Toolkit::TextField& textLabel )
+inline const Toolkit::Internal::TextField& GetImpl( const Toolkit::TextField& textField )
{
- DALI_ASSERT_ALWAYS(textLabel);
+ DALI_ASSERT_ALWAYS(textField);
- const Dali::RefObject& handle = textLabel.GetImplementation();
+ const Dali::RefObject& handle = textField.GetImplementation();
return static_cast<const Toolkit::Internal::TextField&>(handle);
}
} // namespace Dali
-#endif // __DALI_TOOLKIT_INTERNAL_TEXT_LABEL_H__
+#endif // __DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H__
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/text/layouts/layout-engine.h>
-#include <dali-toolkit/public-api/text/rendering/basic/text-basic-renderer.h> // TODO - Get from RendererFactory
+#include <dali-toolkit/public-api/text/rendering/text-backend.h>
using Dali::Toolkit::Text::LayoutEngine;
+using Dali::Toolkit::Text::Backend;
namespace
{
+const unsigned int DEFAULT_RENDERING_BACKEND = 0;
+
} // namespace
namespace Dali
namespace Toolkit
{
-const Property::Index TextLabel::PROPERTY_TEXT( Internal::TextLabel::TEXTLABEL_PROPERTY_START_INDEX );
-const Property::Index TextLabel::PROPERTY_MULTI_LINE( Internal::TextLabel::TEXTLABEL_PROPERTY_START_INDEX + 1 );
+const Property::Index TextLabel::PROPERTY_RENDERING_BACKEND( Internal::TextLabel::TEXTLABEL_PROPERTY_START_INDEX );
+const Property::Index TextLabel::PROPERTY_TEXT( Internal::TextLabel::TEXTLABEL_PROPERTY_START_INDEX + 1 );
+const Property::Index TextLabel::PROPERTY_MULTI_LINE( Internal::TextLabel::TEXTLABEL_PROPERTY_START_INDEX + 2 );
namespace Internal
{
TypeRegistration mType( typeid(Toolkit::TextLabel), typeid(Toolkit::Control), Create );
-PropertyRegistration property1( mType, "text", Toolkit::TextLabel::PROPERTY_TEXT, Property::STRING, &TextLabel::SetProperty, &TextLabel::GetProperty );
-PropertyRegistration property2( mType, "multi-line", Toolkit::TextLabel::PROPERTY_MULTI_LINE, Property::STRING, &TextLabel::SetProperty, &TextLabel::GetProperty );
+PropertyRegistration property1( mType, "rendering-backend", Toolkit::TextLabel::PROPERTY_RENDERING_BACKEND, Property::UNSIGNED_INTEGER, &TextLabel::SetProperty, &TextLabel::GetProperty );
+PropertyRegistration property2( mType, "text", Toolkit::TextLabel::PROPERTY_TEXT, Property::STRING, &TextLabel::SetProperty, &TextLabel::GetProperty );
+PropertyRegistration property3( mType, "multi-line", Toolkit::TextLabel::PROPERTY_MULTI_LINE, Property::STRING, &TextLabel::SetProperty, &TextLabel::GetProperty );
} // namespace
return handle;
}
-void TextLabel::SetRenderer( Text::RendererPtr renderer )
-{
- mRenderer = renderer;
-}
-
void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
{
Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( Dali::BaseHandle( object ) );
if( label )
{
- TextLabel& labelImpl( GetImpl( label ) );
+ TextLabel& impl( GetImpl( label ) );
switch( index )
{
+ case Toolkit::TextLabel::PROPERTY_RENDERING_BACKEND:
+ {
+ unsigned int backend = value.Get< unsigned int >();
+
+ if( impl.mRenderingBackend != backend )
+ {
+ impl.mRenderingBackend = backend;
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
case Toolkit::TextLabel::PROPERTY_TEXT:
{
- labelImpl.SetText( value.Get< std::string >() );
+ if( impl.mController )
+ {
+ impl.mController->SetText( value.Get< std::string >() );
+ }
break;
}
case Toolkit::TextLabel::PROPERTY_MULTI_LINE:
{
- labelImpl.SetMultiLine( value.Get< bool >() );
+ if( impl.mController )
+ {
+ LayoutEngine::Layout layout = value.Get< bool >() ? LayoutEngine::MULTI_LINE_BOX : LayoutEngine::SINGLE_LINE_BOX;
+ impl.mController->GetLayoutEngine().SetLayout( layout );
+ }
break;
}
}
if( label )
{
+ TextLabel& impl( GetImpl( label ) );
switch( index )
{
+ case Toolkit::TextLabel::PROPERTY_RENDERING_BACKEND:
+ {
+ value = impl.mRenderingBackend;
+ break;
+ }
+
case Toolkit::TextLabel::PROPERTY_TEXT:
{
DALI_LOG_WARNING( "UTF-8 text representation was discarded\n" );
break;
}
+
+ case Toolkit::TextLabel::PROPERTY_MULTI_LINE:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->GetLayoutEngine().GetLayout();
+ }
+ break;
+ }
}
}
{
if( !mRenderer )
{
- // TODO - Get from RendererFactory
- mRenderer = Dali::Toolkit::Text::BasicRenderer::New();
+ mRenderer = Backend::Get().NewRenderer( mRenderingBackend );
}
if( mRenderer )
}
}
-void TextLabel::SetText( const std::string& text )
-{
- if( mController )
- {
- // The Controller updates the View for the renderer
- mController->SetText( text );
- }
-}
-
-void TextLabel::SetMultiLine( bool multiLine )
-{
- if( mController )
- {
- if( multiLine )
- {
- mController->GetLayoutEngine().SetLayout( LayoutEngine::MULTI_LINE_BOX );
- }
- else
- {
- mController->GetLayoutEngine().SetLayout( LayoutEngine::SINGLE_LINE_BOX );
- }
- }
-}
-
void TextLabel::RequestTextRelayout()
{
RelayoutRequest();
}
TextLabel::TextLabel()
-: Control( ControlBehaviour( CONTROL_BEHAVIOUR_NONE ) )
+: Control( ControlBehaviour( CONTROL_BEHAVIOUR_NONE ) ),
+ mRenderingBackend( DEFAULT_RENDERING_BACKEND )
{
}
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
#include <dali-toolkit/public-api/text/text-controller.h>
+#include <dali-toolkit/public-api/text/rendering/text-renderer.h>
namespace Dali
{
*/
static Toolkit::TextLabel New();
- /**
- * @copydoc Dali::Toollkit::TextLabel::SetRenderer()
- */
- void SetRenderer( Text::RendererPtr renderer );
-
// Properties
/**
private: // Implementation
/**
- * Helper for SetProperty.
- * @param[in] text The new "text" property value.
- */
- void SetText( const std::string& text );
-
- /**
- * Helper for SetProperty.
- * @param[in] multiLine The new "multi-line" property value.
- */
- void SetMultiLine( bool multiLine );
-
- /**
* Construct a new TextLabel.
*/
TextLabel();
Text::ControllerPtr mController;
Text::RendererPtr mRenderer;
+
+ unsigned int mRenderingBackend;
};
} // namespace Internal
$(toolkit_src_dir)/shader-effects/page-turn-effect-impl.cpp \
$(toolkit_src_dir)/shader-effects/water-effect-impl.cpp \
$(toolkit_src_dir)/styling/style-manager-impl.cpp \
+ $(toolkit_src_dir)/text/rendering/text-backend-impl.cpp \
$(toolkit_src_dir)/text/multi-language-support-impl.cpp \
$(toolkit_src_dir)/transition-effects/cube-transition-effect-impl.cpp \
$(toolkit_src_dir)/transition-effects/cube-transition-cross-effect-impl.cpp \
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/internal/text/rendering/text-backend-impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/adaptor-framework/singleton-service.h>
+#include <dali/integration-api/debug.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/rendering/basic/text-basic-renderer.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+namespace Internal
+{
+
+struct Backend::Impl
+{
+ int temp; // placeholder for future backend implemenations
+};
+
+Backend::Backend()
+: mImpl( NULL )
+{
+ mImpl = new Impl();
+}
+
+Backend::~Backend()
+{
+ delete mImpl;
+}
+
+Dali::Toolkit::Text::Backend Backend::Get()
+{
+ Dali::Toolkit::Text::Backend backendHandle;
+
+ Dali::SingletonService service( SingletonService::Get() );
+ if ( service )
+ {
+ // Check whether the singleton is already created
+ Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::Toolkit::Text::Backend ) );
+ if(handle)
+ {
+ // If so, downcast the handle
+ Backend* impl = dynamic_cast< Dali::Toolkit::Text::Internal::Backend* >( handle.GetObjectPtr() );
+ backendHandle = Dali::Toolkit::Text::Backend( impl );
+ }
+ else // create and register the object
+ {
+ backendHandle = Dali::Toolkit::Text::Backend( new Backend );
+ service.Register( typeid( backendHandle ), backendHandle );
+ }
+ }
+
+ return backendHandle;
+}
+
+RendererPtr Backend::NewRenderer( unsigned int renderingType )
+{
+ RendererPtr renderer;
+
+ switch( renderingType )
+ {
+ case Dali::Toolkit::Text::RENDERING_BASIC:
+ {
+ renderer = Dali::Toolkit::Text::BasicRenderer::New();
+ }
+ break;
+
+ case Dali::Toolkit::Text::RENDERING_SHARED_ATLAS:
+ {
+ // TODO
+ }
+ break;
+
+ default:
+ {
+ DALI_LOG_WARNING( "Unknown renderer type: %d", renderingType );
+ break;
+ }
+ }
+
+ return renderer;
+}
+
+} // namespace Internal
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_INTERNAL_TEXT_BACKEND_H__
+#define __DALI_TOOLKIT_INTERNAL_TEXT_BACKEND_H__
+
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-object.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/rendering/text-backend.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+namespace Internal
+{
+
+/**
+ * Implementation of the text rendering backend
+ */
+class Backend : public BaseObject
+{
+public:
+
+ /**
+ * Constructor
+ */
+ Backend();
+
+ /**
+ * Destructor
+ */
+ ~Backend();
+
+ /**
+ * @copydoc Dali::Toolkit::Text::Backend::Get()
+ */
+ static Dali::Toolkit::Text::Backend Get();
+
+ /**
+ * @copydoc Dali::Toolkit::Text::Backend::NewRenderer()
+ */
+ RendererPtr NewRenderer( unsigned int renderingType );
+
+private:
+
+ // Undefined copy constructor.
+ Backend( const Backend& );
+
+ // Undefined assignment constructor.
+ Backend& operator=( Backend& );
+
+private:
+
+ struct Impl;
+ Impl* mImpl;
+
+}; // class Backend
+
+} // namespace Internal
+
+inline static Internal::Backend& GetImplementation(Backend& backend)
+{
+ DALI_ASSERT_ALWAYS( backend && "backend handle is empty" );
+ BaseObject& handle = backend.GetBaseObject();
+ return static_cast<Internal::Backend&>(handle);
+}
+
+inline static const Internal::Backend& GetImplementation(const Backend& backend)
+{
+ DALI_ASSERT_ALWAYS( backend && "backend handle is empty" );
+ const BaseObject& handle = backend.GetBaseObject();
+ return static_cast<const Internal::Backend&>(handle);
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_INTERNAL_TEXT_BACKEND_H__
namespace Toolkit
{
+const std::string TextField::RENDERING_BACKEND_PROPERTY_NAME("rendering-backend");
const std::string TextField::PLACEHOLDER_TEXT_PROPERTY_NAME("placeholder-text");
const std::string TextField::TEXT_PROPERTY_NAME("text");
const std::string TextField::CURSOR_IMAGE_PROPERTY_NAME("cursor-image");
return Control::DownCast<TextField, Internal::TextField>(handle);
}
-void TextField::SetRenderer( Text::RendererPtr renderer )
-{
- GetImpl(*this).SetRenderer( renderer );
-}
-
TextField::TextField( Internal::TextField& implementation )
: Control(implementation)
{
public:
// Property indices
+ static const Property::Index PROPERTY_RENDERING_BACKEND; ///< name "rendering-backend", type UNSIGNED INT
static const Property::Index PROPERTY_PLACEHOLDER_TEXT; ///< name "placeholder-text", type STRING
static const Property::Index PROPERTY_TEXT; ///< name "text", type STRING
static const Property::Index PROPERTY_CURSOR_IMAGE; ///< name "cursor-image", type STRING
static const Property::Index PROPERTY_GRAB_HANDLE_IMAGE; ///< name "grab-handle-image", type STRING
// Property names
+ static const std::string RENDERING_BACKEND_PROPERTY_NAME; ///< Property, name "rendering-backend", type UNSIGNED INT
static const std::string PLACEHOLDER_TEXT_PROPERTY_NAME; ///< Property, name "placeholder-text", type STRING
static const std::string TEXT_PROPERTY_NAME; ///< Property, name "text", type STRING
static const std::string CURSOR_IMAGE_PROPERTY_NAME; ///< Property, name "cursor-image", type STRING
*/
static TextField DownCast( BaseHandle handle );
- /**
- * @brief Set the rendering back-end used by the TextField.
- *
- * @param[in] renderer The text renderer to use.
- */
- void SetRenderer( Text::RendererPtr renderer );
-
public: // Not intended for application developers
/**
namespace Toolkit
{
+const std::string TextLabel::RENDERING_BACKEND_PROPERTY_NAME("rendering-backend");
const std::string TextLabel::TEXT_PROPERTY_NAME("text");
const std::string TextLabel::MULTI_LINE_PROPERTY_NAME("multi-line");
return Control::DownCast<TextLabel, Internal::TextLabel>(handle);
}
-void TextLabel::SetRenderer( Text::RendererPtr renderer )
-{
- GetImpl(*this).SetRenderer( renderer );
-}
-
TextLabel::TextLabel( Internal::TextLabel& implementation )
: Control(implementation)
{
public:
// Property indices
- static const Property::Index PROPERTY_TEXT; ///< name "text", type STRING
- static const Property::Index PROPERTY_MULTI_LINE; ///< name "multi-line", type BOOLEAN
+ static const Property::Index PROPERTY_RENDERING_BACKEND; ///< name "rendering-backend", type UNSIGNED INT
+ static const Property::Index PROPERTY_TEXT; ///< name "text", type STRING
+ static const Property::Index PROPERTY_MULTI_LINE; ///< name "multi-line", type BOOLEAN
// Property names
- static const std::string TEXT_PROPERTY_NAME; ///< Property, name "text", type STRING
- static const std::string MULTI_LINE_PROPERTY_NAME; ///< Property, name "multi-line", type BOOLEAN
+ static const std::string RENDERING_BACKEND_PROPERTY_NAME; ///< Property, name "rendering-backend", type UNSIGNED INT
+ static const std::string TEXT_PROPERTY_NAME; ///< Property, name "text", type STRING
+ static const std::string MULTI_LINE_PROPERTY_NAME; ///< Property, name "multi-line", type BOOLEAN
/**
* Create the TextLabel control.
*/
static TextLabel DownCast( BaseHandle handle );
- /**
- * @brief Set the rendering back-end used by the TextLabel.
- *
- * @param[in] renderer The text renderer to use.
- */
- void SetRenderer( Text::RendererPtr renderer );
-
public: // Not intended for application developers
/**
$(public_api_src_dir)/text/visual-model.cpp \
$(public_api_src_dir)/text/decorator/text-decorator.cpp \
$(public_api_src_dir)/text/layouts/layout-engine.cpp \
+ $(public_api_src_dir)/text/rendering/text-backend.cpp \
$(public_api_src_dir)/text/rendering/text-renderer.cpp \
$(public_api_src_dir)/text/rendering/basic/text-basic-renderer.cpp \
$(public_api_src_dir)/text/rendering/shaders/text-basic-shader.cpp \
$(public_api_src_dir)/text/layouts/layout-engine.h
public_api_text_rendering_header_files = \
+ $(public_api_src_dir)/text/rendering/text-backend.h \
$(public_api_src_dir)/text/rendering/text-renderer.h
public_api_text_rendering_basic_header_files = \
mImpl->mLayout = layout;
}
+unsigned int LayoutEngine::GetLayout() const
+{
+ return mImpl->mLayout;
+}
+
void LayoutEngine::UpdateVisualModel( const Vector2& boundingBox,
const Vector<GlyphInfo>& glyphs,
const Vector<CharacterIndex>& characterIndices,
void SetLayout( Layout layout );
/**
+ * @brief Query the required layout.
+ *
+ * @return The required layout.
+ */
+ unsigned int GetLayout() const;
+
+ /**
* @brief Store the visual position of glyphs in the VisualModel.
*
* @param[in] boundingBox The size of the box containing the text.
--- /dev/null
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/public-api/text/rendering/text-backend.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/rendering/text-backend-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+Backend Backend::Get()
+{
+ return Internal::Backend::Get();
+}
+
+RendererPtr Backend::NewRenderer( unsigned int renderingType )
+{
+ return GetImplementation(*this).NewRenderer( renderingType );
+}
+
+Backend::Backend()
+{
+}
+
+Backend::~Backend()
+{
+}
+
+Backend::Backend( const Backend& handle )
+: BaseHandle( handle )
+{
+}
+
+Backend& Backend::operator=( const Backend& handle )
+{
+ BaseHandle::operator=( handle );
+ return *this;
+}
+
+Backend::Backend( Internal::Backend* internal )
+: BaseHandle( internal )
+{
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef __DALI_TOOLKIT_TEXT_BACKEND_H__
+#define __DALI_TOOLKIT_TEXT_BACKEND_H__
+
+/*
+ * Copyright (c) 2015 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/base-handle.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/rendering/text-renderer.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+namespace Internal DALI_INTERNAL
+{
+class Backend;
+}
+
+// The type of text renderer required
+enum RenderingType
+{
+ RENDERING_BASIC, ///< A bitmap-based reference implementation
+ RENDERING_SHARED_ATLAS ///< A bitmap-based solution where renderers can share a texture atlas
+};
+
+/**
+ * @brief Provides access to different text rendering backends.
+ */
+class DALI_IMPORT_API Backend : public BaseHandle
+{
+public:
+
+ /**
+ * @brief Retrieve a handle to the Backend instance.
+ *
+ * @return A handle to the Backend
+ */
+ static Backend Get();
+
+ /**
+ * @brief Create a renderer from a particluar rendering type.
+ *
+ * @param[in] renderingType The type of rendering required.
+ * @return A handle to the newly created renderer.
+ */
+ RendererPtr NewRenderer( unsigned int renderingType );
+
+ /**
+ * @brief Create an uninitialized TextAbstraction handle.
+ */
+ Backend();
+
+ /**
+ * @brief Destructor
+ *
+ * This is non-virtual since derived Handle types must not contain data or virtual methods.
+ */
+ ~Backend();
+
+ /**
+ * @brief This copy constructor is required for (smart) pointer semantics.
+ *
+ * @param[in] handle A reference to the copied handle.
+ */
+ Backend( const Backend& handle );
+
+ /**
+ * @brief This assignment operator is required for (smart) pointer semantics.
+ *
+ * @param [in] handle A reference to the copied handle.
+ * @return A reference to this.
+ */
+ Backend& operator=( const Backend& handle );
+
+public: // Not intended for application developers
+
+ /**
+ * @brief This constructor is used by Backend::Get().
+ *
+ * @param[in] backend A pointer to the internal backend object.
+ */
+ explicit DALI_INTERNAL Backend( Internal::Backend* backend );
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // __DALI_TOOLKIT_TEXT_BACKEND_H__
typedef IntrusivePtr<Renderer> RendererPtr;
/**
- * @brief Abstract base class for Text rendering back-ends.
+ * @brief Abstract base class for Text renderers.
*
* This is reponsible for rendering the glyphs from a ViewInterface in the specified positions.
* It is implemented by returning a RenderableActor intended as the child of a UI control.