TextVisual and TextControls now share the Horizontal and Vertical alignment enumerations.
The Enums are public, internal versions are replaced hence reducing internal conversion.
Change-Id: I7343430d61a278d9a4eb97b7a0568a7f934cf54f
charactersToGlyph.Begin(),
glyphsPerCharacter.Begin(),
numberOfGlyphs,
- Layout::HORIZONTAL_ALIGN_BEGIN,
+ Text::HorizontalAlignment::BEGIN,
Layout::LineWrap::WORD );
Vector<LineRun>& lines = visualModel->mLines;
layoutEngine.Align( textArea,
0u,
numberOfCharacters,
- Layout::HORIZONTAL_ALIGN_BEGIN,
+ Text::HorizontalAlignment::BEGIN,
lines,
alignmentOffset );
}
visualModel->mCharactersToGlyph.Begin(),
visualModel->mGlyphsPerCharacter.Begin(),
totalNumberOfGlyphs,
- Layout::HORIZONTAL_ALIGN_BEGIN,
+ Text::HorizontalAlignment::BEGIN,
Layout::LineWrap::WORD );
layoutParameters.isLastNewParagraph = isLastNewParagraph;
visualModel->mCharactersToGlyph.Begin(),
visualModel->mGlyphsPerCharacter.Begin(),
visualModel->mGlyphs.Count(),
- Layout::HORIZONTAL_ALIGN_BEGIN,
+ Text::HorizontalAlignment::BEGIN,
Layout::LineWrap::WORD );
layoutParameters.numberOfBidirectionalInfoRuns = logicalModel->mBidirectionalLineInfo.Count();
struct AlignData
{
- std::string description;
- std::string text;
- Size textArea;
- unsigned int numberOfFonts;
- FontDescriptionRun* fontDescriptions;
- Layout::HorizontalAlignment horizontalAlignment;
- Layout::VerticalAlignment verticalAlignment;
- unsigned int startIndex;
- unsigned int numberOfCharacters;
- unsigned int numberOfLines;
- float* lineOffsets;
+ std::string description;
+ std::string text;
+ Size textArea;
+ unsigned int numberOfFonts;
+ FontDescriptionRun* fontDescriptions;
+ Text::HorizontalAlignment::Type horizontalAlignment;
+ Text::VerticalAlignment::Type verticalAlignment;
+ unsigned int startIndex;
+ unsigned int numberOfCharacters;
+ unsigned int numberOfLines;
+ float* lineOffsets;
};
bool AlignTest( const AlignData& data )
textArea,
6u,
fontDescriptionRuns.Begin(),
- Layout::HORIZONTAL_ALIGN_BEGIN,
- Layout::VERTICAL_ALIGN_TOP,
+ Text::HorizontalAlignment::BEGIN,
+ Text::VerticalAlignment::TOP,
0u,
22u,
6u,
textArea,
6u,
fontDescriptionRuns.Begin(),
- Layout::HORIZONTAL_ALIGN_BEGIN,
- Layout::VERTICAL_ALIGN_TOP,
+ Text::HorizontalAlignment::BEGIN,
+ Text::VerticalAlignment::TOP,
22u,
26u,
6u,
textArea,
6u,
fontDescriptionRuns.Begin(),
- Layout::HORIZONTAL_ALIGN_BEGIN,
- Layout::VERTICAL_ALIGN_TOP,
+ Text::HorizontalAlignment::BEGIN,
+ Text::VerticalAlignment::TOP,
48u,
26u,
6u,
textArea,
6u,
fontDescriptionRuns.Begin(),
- Layout::HORIZONTAL_ALIGN_CENTER,
- Layout::VERTICAL_ALIGN_TOP,
+ Text::HorizontalAlignment::CENTER,
+ Text::VerticalAlignment::TOP,
0u,
22u,
6u,
textArea,
6u,
fontDescriptionRuns.Begin(),
- Layout::HORIZONTAL_ALIGN_CENTER,
- Layout::VERTICAL_ALIGN_TOP,
+ Text::HorizontalAlignment::CENTER,
+ Text::VerticalAlignment::TOP,
22u,
26u,
6u,
textArea,
6u,
fontDescriptionRuns.Begin(),
- Layout::HORIZONTAL_ALIGN_CENTER,
- Layout::VERTICAL_ALIGN_TOP,
+ Text::HorizontalAlignment::CENTER,
+ Text::VerticalAlignment::TOP,
48u,
26u,
6u,
textArea,
6u,
fontDescriptionRuns.Begin(),
- Layout::HORIZONTAL_ALIGN_END,
- Layout::VERTICAL_ALIGN_TOP,
+ Text::HorizontalAlignment::END,
+ Text::VerticalAlignment::TOP,
0u,
22u,
6u,
textArea,
6u,
fontDescriptionRuns.Begin(),
- Layout::HORIZONTAL_ALIGN_END,
- Layout::VERTICAL_ALIGN_TOP,
+ Text::HorizontalAlignment::END,
+ Text::VerticalAlignment::TOP,
22u,
26u,
6u,
textArea,
6u,
fontDescriptionRuns.Begin(),
- Layout::HORIZONTAL_ALIGN_END,
- Layout::VERTICAL_ALIGN_TOP,
+ Text::HorizontalAlignment::END,
+ Text::VerticalAlignment::TOP,
48u,
26u,
6u,
DALI_TEST_EQUALS( Pixel::RGBA8888, bitmap.GetPixelFormat(), TEST_LOCATION );
// Changes vertical alignment.
- controller->SetVerticalAlignment( Layout::VERTICAL_ALIGN_CENTER );
+ controller->SetVerticalAlignment( Text::VerticalAlignment::CENTER );
controller->Relayout( relayoutSize );
// Renders the text and creates the final bitmap.
DALI_TEST_EQUALS( 60u, bitmap.GetHeight(), TEST_LOCATION );
DALI_TEST_EQUALS( Pixel::RGBA8888, bitmap.GetPixelFormat(), TEST_LOCATION );
- controller->SetVerticalAlignment( Layout::VERTICAL_ALIGN_BOTTOM );
+ controller->SetVerticalAlignment( Text::VerticalAlignment::BOTTOM );
controller->Relayout( relayoutSize );
// Renders the text and creates the final bitmap.
ViewModel* model = typesetter->GetViewModel();
DALI_TEST_CHECK( NULL != model );
- DALI_TEST_EQUALS( Layout::HORIZONTAL_ALIGN_BEGIN, model->GetHorizontalAlignment(), TEST_LOCATION );
- DALI_TEST_EQUALS( Layout::VERTICAL_ALIGN_TOP, model->GetVerticalAlignment(), TEST_LOCATION );
+ DALI_TEST_EQUALS( Text::HorizontalAlignment::BEGIN, model->GetHorizontalAlignment(), TEST_LOCATION );
+ DALI_TEST_EQUALS( Text::VerticalAlignment::TOP, model->GetVerticalAlignment(), TEST_LOCATION );
- controller->SetHorizontalAlignment( Layout::HORIZONTAL_ALIGN_CENTER );
- controller->SetVerticalAlignment( Layout::VERTICAL_ALIGN_CENTER );
+ controller->SetHorizontalAlignment( Text::HorizontalAlignment::CENTER );
+ controller->SetVerticalAlignment( Text::VerticalAlignment::CENTER );
- DALI_TEST_EQUALS( Layout::HORIZONTAL_ALIGN_CENTER, model->GetHorizontalAlignment(), TEST_LOCATION );
- DALI_TEST_EQUALS( Layout::VERTICAL_ALIGN_CENTER, model->GetVerticalAlignment(), TEST_LOCATION );
+ DALI_TEST_EQUALS( Text::HorizontalAlignment::CENTER, model->GetHorizontalAlignment(), TEST_LOCATION );
+ DALI_TEST_EQUALS( Text::VerticalAlignment::CENTER, model->GetVerticalAlignment(), TEST_LOCATION );
tet_result(TET_PASS);
END_TEST;
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<bool>() );
- value = resultMap.Find( TextVisual::Property::HORIZONTAL_ALIGNMENT, Property::STRING );
+ value = resultMap.Find( TextVisual::Property::HORIZONTAL_ALIGNMENT, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( value->Get<std::string>(), "CENTER", TEST_LOCATION );
+ DALI_TEST_EQUALS( value->Get<int>(), (int)Text::HorizontalAlignment::CENTER, TEST_LOCATION );
- value = resultMap.Find( TextVisual::Property::VERTICAL_ALIGNMENT, Property::STRING );
+ value = resultMap.Find( TextVisual::Property::VERTICAL_ALIGNMENT, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( value->Get<std::string>(), "CENTER", TEST_LOCATION );
+ DALI_TEST_EQUALS( value->Get<int>(), (int)Text::VerticalAlignment::CENTER, TEST_LOCATION );
value = resultMap.Find( TextVisual::Property::TEXT_COLOR, Property::VECTOR4 );
DALI_TEST_CHECK( value );
publicapitableviewdir = $(publicapicontrolsdir)/table-view
publicapitextcontrolsdir = $(publicapicontrolsdir)/text-controls
publicapifocusmanagerdir = $(publicapidir)/focus-manager
-publicapirenderingbackenddir = $(publicapidir)/text
+publicapitextdir = $(publicapidir)/text
publicapisliderdir = $(publicapicontrolsdir)/slider
publicapivisualsdir = $(publicapidir)/visuals
publicapitableview_HEADERS = $(public_api_table_view_header_files)
publicapitextcontrols_HEADERS = $(public_api_text_controls_header_files)
publicapifocusmanager_HEADERS = $(public_api_focus_manager_header_files)
-publicapirenderingbackend_HEADERS = $(public_api_rendering_backend_header_files)
+publicapitext_HEADERS = $(public_api_text_header_files)
publicapislider_HEADERS = $(public_api_slider_header_files)
publicapivisuals_HEADERS = $(public_api_visuals_header_files)
#include <dali-toolkit/public-api/styling/style-manager.h>
#include <dali-toolkit/public-api/text/rendering-backend.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
#include <dali-toolkit/public-api/visuals/border-visual-properties.h>
#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/text/rendering-backend.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/internal/text/text-enumerations-impl.h>
#include <dali-toolkit/internal/text/rendering/text-backend.h>
#include <dali-toolkit/internal/text/text-effects-style.h>
#include <dali-toolkit/internal/text/text-font-style.h>
namespace
{
-
-const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] =
-{
- { "BEGIN", Toolkit::Text::Layout::HORIZONTAL_ALIGN_BEGIN },
- { "CENTER", Toolkit::Text::Layout::HORIZONTAL_ALIGN_CENTER },
- { "END", Toolkit::Text::Layout::HORIZONTAL_ALIGN_END },
-};
-const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE ) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] );
-
-
const Scripting::StringEnum LINE_WRAP_MODE_STRING_TABLE[] =
{
{ "WORD", Toolkit::Text::Layout::LineWrap::WORD },
const std::string& alignStr = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p HORIZONTAL_ALIGNMENT %s\n", impl.mController.Get(), alignStr.c_str() );
- Layout::HorizontalAlignment alignment( Layout::HORIZONTAL_ALIGN_BEGIN );
- if( Scripting::GetEnumeration< Layout::HorizontalAlignment >( alignStr.c_str(),
- HORIZONTAL_ALIGNMENT_STRING_TABLE,
- HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT,
- alignment ) )
+ Text::HorizontalAlignment::Type alignment( Text::HorizontalAlignment::BEGIN );
+
+ Text::GetHorizontalAlignmentEnum( value, alignment );
{
impl.mController->SetHorizontalAlignment( alignment );
}
{
if( impl.mController )
{
- const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::HorizontalAlignment >( impl.mController->GetHorizontalAlignment(),
- HORIZONTAL_ALIGNMENT_STRING_TABLE,
- HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
+ const char* name = GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() );
if( name )
{
value = std::string( name );
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/text/rendering-backend.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/internal/text/text-enumerations-impl.h>
#include <dali-toolkit/internal/text/rendering/text-backend.h>
#include <dali-toolkit/internal/text/text-effects-style.h>
#include <dali-toolkit/internal/text/text-font-style.h>
namespace
{
-
-const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] =
-{
- { "BEGIN", Toolkit::Text::Layout::HORIZONTAL_ALIGN_BEGIN },
- { "CENTER", Toolkit::Text::Layout::HORIZONTAL_ALIGN_CENTER },
- { "END", Toolkit::Text::Layout::HORIZONTAL_ALIGN_END },
-};
-const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE ) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] );
-
-const Scripting::StringEnum VERTICAL_ALIGNMENT_STRING_TABLE[] =
-{
- { "TOP", Toolkit::Text::Layout::VERTICAL_ALIGN_TOP },
- { "CENTER", Toolkit::Text::Layout::VERTICAL_ALIGN_CENTER },
- { "BOTTOM", Toolkit::Text::Layout::VERTICAL_ALIGN_BOTTOM },
-};
-const unsigned int VERTICAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( VERTICAL_ALIGNMENT_STRING_TABLE ) / sizeof( VERTICAL_ALIGNMENT_STRING_TABLE[0] );
-
// Type registration
BaseHandle Create()
{
const std::string& alignStr = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p HORIZONTAL_ALIGNMENT %s\n", impl.mController.Get(), alignStr.c_str() );
- Layout::HorizontalAlignment alignment( Layout::HORIZONTAL_ALIGN_BEGIN );
- if( Scripting::GetEnumeration< Layout::HorizontalAlignment >( alignStr.c_str(),
- HORIZONTAL_ALIGNMENT_STRING_TABLE,
- HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT,
- alignment ) )
- {
- impl.mController->SetHorizontalAlignment( alignment );
- }
+ Text::HorizontalAlignment::Type alignment( Text::HorizontalAlignment::BEGIN );
+ GetHorizontalAlignmentEnum( value, alignment );
+ impl.mController->SetHorizontalAlignment( alignment );
}
break;
}
const std::string& alignStr = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p VERTICAL_ALIGNMENT %s\n", impl.mController.Get(), alignStr.c_str() );
- Layout::VerticalAlignment alignment( Layout::VERTICAL_ALIGN_BOTTOM );
- if( Scripting::GetEnumeration< Layout::VerticalAlignment >( alignStr.c_str(),
- VERTICAL_ALIGNMENT_STRING_TABLE,
- VERTICAL_ALIGNMENT_STRING_TABLE_COUNT,
- alignment ) )
- {
- impl.mController->SetVerticalAlignment( alignment );
- }
+ Text::VerticalAlignment::Type alignment( Text::VerticalAlignment::BOTTOM );
+ GetVerticalAlignmentEnum( value, alignment );
+ impl.mController->SetVerticalAlignment( alignment );
}
break;
}
{
if( impl.mController )
{
- const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::HorizontalAlignment >( impl.mController->GetHorizontalAlignment(),
- HORIZONTAL_ALIGNMENT_STRING_TABLE,
- HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
- if( name )
+ const char* name = Text::GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() );
+
+ if ( name )
{
value = std::string( name );
}
{
if( impl.mController )
{
- const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::VerticalAlignment >( impl.mController->GetVerticalAlignment(),
- VERTICAL_ALIGNMENT_STRING_TABLE,
- VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
+ const char* name = Text::GetVerticalAlignmentString( impl.mController->GetVerticalAlignment() );
+
if( name )
{
value = std::string( name );
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/text/rendering-backend.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/internal/text/property-string-parser.h>
#include <dali-toolkit/internal/text/rendering/text-backend.h>
#include <dali-toolkit/internal/styling/style-manager-impl.h>
#include <dali-toolkit/public-api/align-enumerations.h>
+#include <dali-toolkit/internal/text/text-enumerations-impl.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
#include <dali-toolkit/public-api/visuals/text-visual-properties.h>
};
const unsigned int AUTO_SCROLL_STOP_MODE_TABLE_COUNT = sizeof( AUTO_SCROLL_STOP_MODE_TABLE ) / sizeof( AUTO_SCROLL_STOP_MODE_TABLE[0] );
-const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] =
-{
- { "BEGIN", Toolkit::Text::Layout::HORIZONTAL_ALIGN_BEGIN },
- { "CENTER", Toolkit::Text::Layout::HORIZONTAL_ALIGN_CENTER },
- { "END", Toolkit::Text::Layout::HORIZONTAL_ALIGN_END },
-};
-const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE ) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] );
-
-const Scripting::StringEnum VERTICAL_ALIGNMENT_STRING_TABLE[] =
-{
- { "TOP", Toolkit::Text::Layout::VERTICAL_ALIGN_TOP },
- { "CENTER", Toolkit::Text::Layout::VERTICAL_ALIGN_CENTER },
- { "BOTTOM", Toolkit::Text::Layout::VERTICAL_ALIGN_BOTTOM },
-};
-const unsigned int VERTICAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( VERTICAL_ALIGNMENT_STRING_TABLE ) / sizeof( VERTICAL_ALIGNMENT_STRING_TABLE[0] );
-
const Scripting::StringEnum LINE_WRAP_MODE_STRING_TABLE[] =
{
{ "WRAP_MODE_WORD", Toolkit::Text::Layout::LineWrap::WORD },
{
if( impl.mController )
{
- Layout::HorizontalAlignment alignment( Layout::HORIZONTAL_ALIGN_BEGIN );
- if( Scripting::GetEnumeration< Toolkit::Text::Layout::HorizontalAlignment >( value.Get< std::string >().c_str(),
- HORIZONTAL_ALIGNMENT_STRING_TABLE,
- HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT,
- alignment ) )
- {
- impl.mController->SetHorizontalAlignment( alignment );
- }
+ Toolkit::Text::HorizontalAlignment::Type alignment( Toolkit::Text::HorizontalAlignment::BEGIN );
+ Text::GetHorizontalAlignmentEnum( value, alignment );
+
+ impl.mController->SetHorizontalAlignment( alignment );
+
}
break;
}
{
if( impl.mController )
{
- Layout::VerticalAlignment alignment( Layout::VERTICAL_ALIGN_BOTTOM );
- if( Scripting::GetEnumeration< Toolkit::Text::Layout::VerticalAlignment >( value.Get< std::string >().c_str(),
- VERTICAL_ALIGNMENT_STRING_TABLE,
- VERTICAL_ALIGNMENT_STRING_TABLE_COUNT,
- alignment ) )
- {
- impl.mController->SetVerticalAlignment( alignment );
- }
+ Toolkit::Text::VerticalAlignment::Type alignment( Toolkit::Text::VerticalAlignment::BOTTOM );
+ Text::GetVerticalAlignmentEnum( value, alignment );
+
+ impl.mController->SetVerticalAlignment( alignment );
}
break;
}
{
if( impl.mController )
{
- const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::HorizontalAlignment >( impl.mController->GetHorizontalAlignment(),
- HORIZONTAL_ALIGNMENT_STRING_TABLE,
- HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
- if( name )
- {
- value = std::string( name );
- }
+ const char* name = Text::GetHorizontalAlignmentString( impl.mController->GetHorizontalAlignment() );
+
+ if ( name )
+ {
+ value = std::string( name );
+ }
}
break;
}
{
if( impl.mController )
{
- const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::VerticalAlignment >( impl.mController->GetVerticalAlignment(),
- VERTICAL_ALIGNMENT_STRING_TABLE,
- VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
+ const char* name = Text::GetVerticalAlignmentString( impl.mController->GetVerticalAlignment() );
if( name )
{
value = std::string( name );
$(toolkit_src_dir)/text/property-string-parser.cpp \
$(toolkit_src_dir)/text/segmentation.cpp \
$(toolkit_src_dir)/text/shaper.cpp \
+ $(toolkit_src_dir)/text/text-enumerations-impl.cpp \
$(toolkit_src_dir)/text/text-controller.cpp \
$(toolkit_src_dir)/text/text-controller-impl.cpp \
$(toolkit_src_dir)/text/text-effects-style.cpp \
+++ /dev/null
-#ifndef DALI_TOOLKIT_TEXT_LAYOUT_ALIGNMENT_H
-#define DALI_TOOLKIT_TEXT_LAYOUT_ALIGNMENT_H
-
-/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace Text
-{
-
-namespace Layout
-{
-
-/**
- * @brief Speficies the horizontal alignment.
- *
- * BEGIN is on the left for Left To Right languages whereas is right for Right To Left.
- * Similarly, END is on the right for Left To Right languages and left for Right To Left.
- */
-enum HorizontalAlignment
-{
- HORIZONTAL_ALIGN_BEGIN,
- HORIZONTAL_ALIGN_CENTER,
- HORIZONTAL_ALIGN_END
-};
-
-/**
- * @brief Speficies the vertical alignment.
- */
-enum VerticalAlignment
-{
- VERTICAL_ALIGN_TOP,
- VERTICAL_ALIGN_CENTER,
- VERTICAL_ALIGN_BOTTOM
-};
-
-enum AlignmentCount
-{
- HORIZONTAL_ALIGN_COUNT = HORIZONTAL_ALIGN_END + 1,
- VERTICAL_ALIGN_COUNT = VERTICAL_ALIGN_BOTTOM + 1
-};
-
-} // namespace Layout
-
-} // namespace Text
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_TEXT_LAYOUT_ALIGNMENT_H
void Align( const Size& size,
CharacterIndex startIndex,
Length numberOfCharacters,
- HorizontalAlignment horizontalAlignment,
+ Text::HorizontalAlignment::Type horizontalAlignment,
Vector<LineRun>& lines,
float& alignmentOffset )
{
}
void CalculateHorizontalAlignment( float boxWidth,
- HorizontalAlignment horizontalAlignment,
+ HorizontalAlignment::Type horizontalAlignment,
LineRun& line )
{
line.alignmentOffset = 0.f;
const bool isRTL = RTL == line.direction;
float lineLength = line.width;
- HorizontalAlignment alignment = horizontalAlignment;
+ HorizontalAlignment::Type alignment = horizontalAlignment;
if( isRTL )
{
// Swap the alignment type if the line is right to left.
switch( alignment )
{
- case HORIZONTAL_ALIGN_BEGIN:
+ case HorizontalAlignment::BEGIN:
{
- alignment = HORIZONTAL_ALIGN_END;
+ alignment = HorizontalAlignment::END;
break;
}
- case HORIZONTAL_ALIGN_CENTER:
+ case HorizontalAlignment::CENTER:
{
// Nothing to do.
break;
}
- case HORIZONTAL_ALIGN_END:
+ case HorizontalAlignment::END:
{
- alignment = HORIZONTAL_ALIGN_BEGIN;
+ alignment = HorizontalAlignment::BEGIN;
break;
}
}
// Calculate the horizontal line offset.
switch( alignment )
{
- case HORIZONTAL_ALIGN_BEGIN:
+ case HorizontalAlignment::BEGIN:
{
line.alignmentOffset = 0.f;
}
break;
}
- case HORIZONTAL_ALIGN_CENTER:
+ case HorizontalAlignment::CENTER:
{
line.alignmentOffset = 0.5f * ( boxWidth - lineLength );
line.alignmentOffset = floorf( line.alignmentOffset ); // try to avoid pixel alignment.
break;
}
- case HORIZONTAL_ALIGN_END:
+ case HorizontalAlignment::END:
{
if( isRTL )
{
void Engine::Align( const Size& size,
CharacterIndex startIndex,
Length numberOfCharacters,
- Layout::HorizontalAlignment horizontalAlignment,
+ Text::HorizontalAlignment::Type horizontalAlignment,
Vector<LineRun>& lines,
float& alignmentOffset )
{
#include <dali/public-api/math/vector2.h>
// INTERNAL INCLUDE
-#include <dali-toolkit/internal/text/layouts/layout-alignment.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
#include <dali-toolkit/internal/text/line-run.h>
#include <dali-toolkit/internal/text/metrics.h>
void Align( const Size& size,
CharacterIndex startIndex,
Length numberOfCharacters,
- Layout::HorizontalAlignment horizontalAlignment,
+ Text::HorizontalAlignment::Type horizontalAlignment,
Vector<LineRun>& lines,
float& alignmentOffset );
#include <dali/public-api/math/vector2.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-enumerations.h>
#include <dali-toolkit/internal/text/text-definitions.h>
#include <dali-toolkit/internal/text/layouts/layout-wrap-mode.h>
const GlyphIndex* const charactersToGlyphsBuffer,
const Length* const glyphsPerCharacterBuffer,
Length totalNumberOfGlyphs,
- HorizontalAlignment horizontalAlignment,
+ Text::HorizontalAlignment::Type horizontalAlignment,
LineWrap::Mode lineWrapMode )
: boundingBox( boundingBox ),
textBuffer( textBuffer ),
GlyphIndex startGlyphIndex; ///< Index to the first glyph to layout.
Length numberOfGlyphs; ///< The number of glyphs to layout.
Length totalNumberOfGlyphs; ///< The number of glyphs.
- HorizontalAlignment horizontalAlignment; ///< The horizontal alignment.
+ HorizontalAlignment::Type horizontalAlignment; ///< The horizontal alignment.
LineIndex startLineIndex; ///< The line index where to insert the new lines.
Length estimatedNumberOfLines; ///< The estimated number of lines.
LineWrap::Mode lineWrapMode; ///< The line wrap mode for moving to next line.
switch( mModel->GetVerticalAlignment() )
{
- case Layout::VERTICAL_ALIGN_TOP:
+ case VerticalAlignment::TOP:
{
// No offset to add.
break;
}
- case Layout::VERTICAL_ALIGN_CENTER:
+ case VerticalAlignment::CENTER:
{
penY = static_cast<int>( 0.5f * ( size.height - layoutSize.height ) );
break;
}
- case Layout::VERTICAL_ALIGN_BOTTOM:
+ case VerticalAlignment::BOTTOM:
{
penY = static_cast<int>( size.height - layoutSize.height );
break;
return mModel->GetScrollPosition();
}
-Layout::HorizontalAlignment ViewModel::GetHorizontalAlignment() const
+HorizontalAlignment::Type ViewModel::GetHorizontalAlignment() const
{
return mModel->GetHorizontalAlignment();
}
-Layout::VerticalAlignment ViewModel::GetVerticalAlignment() const
+VerticalAlignment::Type ViewModel::GetVerticalAlignment() const
{
return mModel->GetVerticalAlignment();
}
#include <dali/public-api/common/dali-vector.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-enumerations.h>
#include <dali-toolkit/internal/text/text-model-interface.h>
namespace Dali
/**
* @copydoc ModelInterface::GetHorizontalAlignment()
*/
- virtual Layout::HorizontalAlignment GetHorizontalAlignment() const;
+ virtual Text::HorizontalAlignment::Type GetHorizontalAlignment() const;
/**
* @copydoc ModelInterface::GetVerticalAlignment()
*/
- virtual Layout::VerticalAlignment GetVerticalAlignment() const;
+ virtual Text::VerticalAlignment::Type GetVerticalAlignment() const;
/**
* @copydoc ModelInterface::IsTextElideEnabled()
switch( mModel->mHorizontalAlignment )
{
- case Layout::HORIZONTAL_ALIGN_BEGIN:
+ case Text::HorizontalAlignment::BEGIN :
{
cursorInfo.primaryPosition.x = 0.f;
break;
}
- case Layout::HORIZONTAL_ALIGN_CENTER:
+ case Text::HorizontalAlignment::CENTER:
{
cursorInfo.primaryPosition.x = floorf( 0.5f * mModel->mVisualModel->mControlSize.width );
break;
}
- case Layout::HORIZONTAL_ALIGN_END:
+ case Text::HorizontalAlignment::END:
{
cursorInfo.primaryPosition.x = mModel->mVisualModel->mControlSize.width - mEventData->mDecorator->GetCursorWidth();
break;
return Layout::Engine::MULTI_LINE_BOX == mImpl->mLayoutEngine.GetLayout();
}
-void Controller::SetHorizontalAlignment( Layout::HorizontalAlignment alignment )
+void Controller::SetHorizontalAlignment( Text::HorizontalAlignment::Type alignment )
{
if( alignment != mImpl->mModel->mHorizontalAlignment )
{
}
}
-Layout::HorizontalAlignment Controller::GetHorizontalAlignment() const
+Text::HorizontalAlignment::Type Controller::GetHorizontalAlignment() const
{
return mImpl->mModel->mHorizontalAlignment;
}
-void Controller::SetVerticalAlignment( Layout::VerticalAlignment alignment )
+void Controller::SetVerticalAlignment( VerticalAlignment::Type alignment )
{
if( alignment != mImpl->mModel->mVerticalAlignment )
{
}
}
-Layout::VerticalAlignment Controller::GetVerticalAlignment() const
+VerticalAlignment::Type Controller::GetVerticalAlignment() const
{
return mImpl->mModel->mVerticalAlignment;
}
switch( mImpl->mModel->mVerticalAlignment )
{
- case Layout::VERTICAL_ALIGN_TOP:
+ case VerticalAlignment::TOP:
{
mImpl->mModel->mScrollPosition.y = 0.f;
break;
}
- case Layout::VERTICAL_ALIGN_CENTER:
+ case VerticalAlignment::CENTER:
{
mImpl->mModel->mScrollPosition.y = floorf( 0.5f * ( controlSize.height - layoutSize.height ) ); // try to avoid pixel alignment.
break;
}
- case Layout::VERTICAL_ALIGN_BOTTOM:
+ case VerticalAlignment::BOTTOM:
{
mImpl->mModel->mScrollPosition.y = controlSize.height - layoutSize.height;
break;
#include <dali/public-api/events/gesture.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-enumerations.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
#include <dali-toolkit/internal/text/decorator/text-decorator.h>
#include <dali-toolkit/internal/text/layouts/layout-engine.h>
#include <dali-toolkit/internal/text/hidden-text.h>
#include <dali-toolkit/internal/text/text-model-interface.h>
-
namespace Dali
{
*
* @param[in] alignment The horizontal alignment.
*/
- void SetHorizontalAlignment( Layout::HorizontalAlignment alignment );
+ void SetHorizontalAlignment( HorizontalAlignment::Type alignment );
/**
* @copydoc ModelInterface::GetHorizontalAlignment()
*/
- Layout::HorizontalAlignment GetHorizontalAlignment() const;
+ HorizontalAlignment::Type GetHorizontalAlignment() const;
/**
* @brief Sets the text's vertical alignment.
*
* @param[in] alignment The vertical alignment.
*/
- void SetVerticalAlignment( Layout::VerticalAlignment alignment );
+ void SetVerticalAlignment( VerticalAlignment::Type alignment );
/**
* @copydoc ModelInterface::GetVerticalAlignment()
*/
- Layout::VerticalAlignment GetVerticalAlignment() const;
+ VerticalAlignment::Type GetVerticalAlignment() const;
/**
* @brief Sets the text's wrap mode
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/internal/text/text-enumerations-impl.h>
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/scripting/enum-helper.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-enumerations.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+namespace
+{
+DALI_ENUM_TO_STRING_TABLE_BEGIN( HORIZONTAL_ALIGNMENT_TYPE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::HorizontalAlignment::Type, BEGIN )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::HorizontalAlignment::Type, CENTER )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::HorizontalAlignment::Type, END )
+DALI_ENUM_TO_STRING_TABLE_END( HORIZONTAL_ALIGNMENT_TYPE )
+
+DALI_ENUM_TO_STRING_TABLE_BEGIN( VERTICAL_ALIGNMENT_TYPE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::VerticalAlignment::Type, TOP )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::VerticalAlignment::Type, CENTER )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::VerticalAlignment::Type, BOTTOM )
+DALI_ENUM_TO_STRING_TABLE_END( VERTICAL_ALIGNMENT_TYPE )
+
+} // namespace
+
+bool GetHorizontalAlignmentEnum( const Property::Value& propertyValue, Toolkit::Text::HorizontalAlignment::Type& alignment )
+{
+ return Scripting::GetEnumerationProperty( propertyValue, HORIZONTAL_ALIGNMENT_TYPE_TABLE, HORIZONTAL_ALIGNMENT_TYPE_TABLE_COUNT, alignment );
+}
+
+bool GetVerticalAlignmentEnum( const Property::Value& propertyValue, Toolkit::Text::VerticalAlignment::Type& alignment )
+{
+ return Scripting::GetEnumerationProperty( propertyValue, VERTICAL_ALIGNMENT_TYPE_TABLE, VERTICAL_ALIGNMENT_TYPE_TABLE_COUNT, alignment );
+}
+
+const char* GetHorizontalAlignmentString( const Toolkit::Text::HorizontalAlignment::Type& alignment )
+{
+ return Scripting::GetLinearEnumerationName< Toolkit::Text::HorizontalAlignment::Type >( alignment,
+ HORIZONTAL_ALIGNMENT_TYPE_TABLE,
+ HORIZONTAL_ALIGNMENT_TYPE_TABLE_COUNT );
+
+}
+
+const char* GetVerticalAlignmentString( const Toolkit::Text::VerticalAlignment::Type& alignment )
+{
+ return Scripting::GetLinearEnumerationName< Toolkit::Text::VerticalAlignment::Type >( alignment,
+ VERTICAL_ALIGNMENT_TYPE_TABLE,
+ VERTICAL_ALIGNMENT_TYPE_TABLE_COUNT );
+}
+
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_TEXT_ENUMERATION_IMPL_H
+#define DALI_TOOLKIT_TEXT_ENUMERATION_IMPL_H
+
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/object/property-value.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-enumerations.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief Get the alignment from the provided property value.
+ * @param[in] propertyValue the source value
+ * @param[out] alignment the resulting alignment from the given source
+ * @return true if the resulting alignment has been updated
+ */
+bool GetHorizontalAlignmentEnum( const Property::Value& propertyValue, Toolkit::Text::HorizontalAlignment::Type& alignment );
+
+/**
+ * @brief Get the alignment from the provided property value.
+ * @param[in] propertyValue the source value
+ * @param[out] alignment the resulting alignment from the given source
+ * @return true if the resulting alignment has been updated
+ */
+bool GetVerticalAlignmentEnum( const Property::Value& propertyValue, Toolkit::Text::VerticalAlignment::Type& alignment );
+
+/**
+ * @brief Get the alignment string from the provided alignment string.
+ * @param[in] alignment the Text::Horizontal enum source
+ * @return the string equivalent
+ */
+const char* GetHorizontalAlignmentString( const Toolkit::Text::HorizontalAlignment::Type& alignment );
+
+/**
+ * @brief Get the alignment string from the provided alignment string.
+ * @param[in] alignment the Text::VerticalAlignment enum source
+ * @return the string equivalent
+ */
+const char* GetVerticalAlignmentString( const Toolkit::Text::VerticalAlignment::Type& alignment );
+
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_ENUMERATION_IMPL_H
#include <dali/public-api/math/vector2.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/text/layouts/layout-alignment.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
#include <dali-toolkit/internal/text/line-run.h>
#include <dali-toolkit/internal/text/script-run.h>
#include <dali-toolkit/internal/text/text-definitions.h>
*
* @return The horizontal alignment.
*/
- virtual Layout::HorizontalAlignment GetHorizontalAlignment() const = 0;
+ virtual HorizontalAlignment::Type GetHorizontalAlignment() const = 0;
/**
* @brief Retrieves the text's vertical alignment.
*
* @return The vertical alignment.
*/
- virtual Layout::VerticalAlignment GetVerticalAlignment() const = 0;
+ virtual VerticalAlignment::Type GetVerticalAlignment() const = 0;
/**
* @brief Whether the text elide property is enabled.
return mScrollPosition;
}
-Layout::HorizontalAlignment Model::GetHorizontalAlignment() const
+HorizontalAlignment::Type Model::GetHorizontalAlignment() const
{
return mHorizontalAlignment;
}
-Layout::VerticalAlignment Model::GetVerticalAlignment() const
+VerticalAlignment::Type Model::GetVerticalAlignment() const
{
return mVerticalAlignment;
}
mVisualModel(),
mScrollPosition(),
mScrollPositionLast(),
- mHorizontalAlignment( Layout::HORIZONTAL_ALIGN_BEGIN ),
- mVerticalAlignment( Layout::VERTICAL_ALIGN_TOP ),
+ mHorizontalAlignment( HorizontalAlignment::BEGIN ),
+ mVerticalAlignment( VerticalAlignment::TOP ),
mLineWrapMode( Layout::LineWrap::WORD ),
mAlignmentOffset( 0.0f ),
mElideEnabled( false )
#include <dali/public-api/object/ref-object.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/internal/text/layouts/layout-alignment.h>
+#include <dali-toolkit/public-api/text/text-enumerations.h>
#include <dali-toolkit/internal/text/layouts/layout-wrap-mode.h>
#include <dali-toolkit/internal/text/logical-model-impl.h>
#include <dali-toolkit/internal/text/text-model-interface.h>
/**
* @copydoc ModelInterface::GetHorizontalAlignment()
*/
- virtual Layout::HorizontalAlignment GetHorizontalAlignment() const;
+ virtual HorizontalAlignment::Type GetHorizontalAlignment() const;
/**
* @copydoc ModelInterface::GetVerticalAlignment()
*/
- virtual Layout::VerticalAlignment GetVerticalAlignment() const;
+ virtual VerticalAlignment::Type GetVerticalAlignment() const;
/**
* @copydoc ModelInterface::IsTextElideEnabled()
* 0,0 means that the top-left corner of the layout matches the top-left corner of the UI control.
* Typically this will have a negative value with scrolling occurs.
*/
- Vector2 mScrollPosition; ///< The text is offset by this position when scrolling.
- Vector2 mScrollPositionLast; ///< The last offset value of mScrollPosition
- Layout::HorizontalAlignment mHorizontalAlignment; ///< The layout's horizontal alignment.
- Layout::VerticalAlignment mVerticalAlignment; ///< The layout's vertical alignment.
- Layout::LineWrap::Mode mLineWrapMode; ///< The text wrap mode
- float mAlignmentOffset; ///< The alignment offset.
- bool mElideEnabled:1; ///< Whether the text's elide is enabled.
+ Vector2 mScrollPosition; ///< The text is offset by this position when scrolling.
+ Vector2 mScrollPositionLast; ///< The last offset value of mScrollPosition
+ HorizontalAlignment::Type mHorizontalAlignment; ///< The layout's horizontal alignment.
+ VerticalAlignment::Type mVerticalAlignment; ///< The layout's vertical alignment.
+ Layout::LineWrap::Mode mLineWrapMode; ///< The text wrap mode
+ float mAlignmentOffset; ///< The alignment offset.
+ bool mElideEnabled:1; ///< Whether the text's elide is enabled.
};
} // namespace Text
*
* -0.5f aligns the text to the left, 0.0f aligns the text to the center, 0.5f aligns the text to the right.
* The final alignment depends on two factors:
- * 1) The alignment value of the text label (Use Text::Layout::HorizontalAlignment enumerations).
+ * 1) The alignment value of the text label (Use Text::HorizontalAlignment enumerations).
* 2) The text direction, i.e. whether it's LTR or RTL (0 = LTR, 1 = RTL).
*/
-const float HORIZONTAL_ALIGNMENT_TABLE[ Text::Layout::HORIZONTAL_ALIGN_COUNT ][ 2 ] =
+const float HORIZONTAL_ALIGNMENT_TABLE[ Text::HorizontalAlignment::END+1 ][ 2 ] =
{
- // HORIZONTAL_ALIGN_BEGIN
+ // HorizontalAlignment::BEGIN
{
-0.5f, // LTR
0.5f // RTL
},
- // HORIZONTAL_ALIGN_CENTER
+ // HorizontalAlignment::CENTER
{
0.0f, // LTR
0.0f // RTL
},
- // HORIZONTAL_ALIGN_END
+ // HorizontalAlignment::END
{
0.5f, // LTR
-0.5f // RTL
* @brief How the text should be aligned vertically when scrolling the text.
*
* -0.5f aligns the text to the top, 0.0f aligns the text to the center, 0.5f aligns the text to the bottom.
- * The alignment depends on the alignment value of the text label (Use Text::Layout::VerticalAlignment enumerations).
+ * The alignment depends on the alignment value of the text label (Use Text::VerticalAlignment enumerations).
*/
-const float VERTICAL_ALIGNMENT_TABLE[ Text::Layout::VERTICAL_ALIGN_COUNT ] =
+const float VERTICAL_ALIGNMENT_TABLE[ Text::VerticalAlignment::BOTTOM+1 ] =
{
- -0.5f, // VERTICAL_ALIGN_TOP
- 0.0f, // VERTICAL_ALIGN_CENTER
- 0.5f // VERTICAL_ALIGN_BOTTOM
+ -0.5f, // VerticalAlignment::TOP
+ 0.0f, // VerticalAlignment::CENTER
+ 0.5f // VerticalAlignment::BOTTOM
};
} // namespace
{
}
-void TextScroller::SetParameters( Actor scrollingTextActor, Renderer renderer, TextureSet textureSet, const Size& controlSize, const Size& textNaturalSize, CharacterDirection direction, Layout::HorizontalAlignment horizontalAlignment, Layout::VerticalAlignment verticalAlignment )
+void TextScroller::SetParameters( Actor scrollingTextActor, Renderer renderer, TextureSet textureSet, const Size& controlSize, const Size& textNaturalSize, CharacterDirection direction, HorizontalAlignment::Type horizontalAlignment, VerticalAlignment::Type verticalAlignment )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters controlSize[%f,%f] offscreenSize[%f,%f] direction[%d]\n",
controlSize.x, controlSize.y, textNaturalSize.x, textNaturalSize.y, direction );
#include <dali/public-api/rendering/renderer.h>
// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/text/text-enumerations.h>
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
#include <dali-toolkit/internal/text/text-definitions.h>
-#include <dali-toolkit/internal/text/layouts/layout-alignment.h>
namespace Dali
{
* @param[in] horizontalAlignment horizontal alignment of the text
* @param[in] verticalAlignment vertical alignment of the text
*/
- void SetParameters( Actor scrollingTextActor, Dali::Renderer renderer, TextureSet textureSet, const Size& controlSize, const Size& offScreenSize, CharacterDirection direction, Layout::HorizontalAlignment horizontalAlignment, Layout::VerticalAlignment verticalAlignment );
+ void SetParameters( Actor scrollingTextActor, Dali::Renderer renderer, TextureSet textureSet, const Size& controlSize, const Size& offScreenSize, CharacterDirection direction, HorizontalAlignment::Type horizontalAlignment, VerticalAlignment::Type verticalAlignment );
/**
* @brief Set the gap distance to elapse before the text wraps around
#include <dali-toolkit/internal/text/text-font-style.h>
#include <dali-toolkit/internal/text/text-effects-style.h>
#include <dali-toolkit/internal/text/script-run.h>
+#include <dali-toolkit/internal/text/text-enumerations-impl.h>
namespace Dali
{
const char * const SHADOW_PROPERTY( "shadow" );
const char * const UNDERLINE_PROPERTY( "underline" );
-const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] =
-{
- { "BEGIN", Toolkit::Text::Layout::HORIZONTAL_ALIGN_BEGIN },
- { "CENTER", Toolkit::Text::Layout::HORIZONTAL_ALIGN_CENTER },
- { "END", Toolkit::Text::Layout::HORIZONTAL_ALIGN_END },
-};
-const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE ) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] );
-
-const Scripting::StringEnum VERTICAL_ALIGNMENT_STRING_TABLE[] =
-{
- { "TOP", Toolkit::Text::Layout::VERTICAL_ALIGN_TOP },
- { "CENTER", Toolkit::Text::Layout::VERTICAL_ALIGN_CENTER },
- { "BOTTOM", Toolkit::Text::Layout::VERTICAL_ALIGN_BOTTOM },
-};
-const unsigned int VERTICAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( VERTICAL_ALIGNMENT_STRING_TABLE ) / sizeof( VERTICAL_ALIGNMENT_STRING_TABLE[0] );
-
const Vector4 FULL_TEXTURE_RECT( 0.f, 0.f, 1.f, 1.f );
-std::string GetHorizontalAlignment( Toolkit::Text::Layout::HorizontalAlignment alignment )
-{
- const char* name = Scripting::GetEnumerationName<Toolkit::Text::Layout::HorizontalAlignment>( alignment,
- HORIZONTAL_ALIGNMENT_STRING_TABLE,
- HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
-
- if( name )
- {
- return std::string( name );
- }
- return std::string();
-}
-
-std::string GetVerticalAlignment( Toolkit::Text::Layout::VerticalAlignment alignment )
-{
- const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::VerticalAlignment >( alignment,
- VERTICAL_ALIGNMENT_STRING_TABLE,
- VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
-
- if( name )
- {
- return std::string( name );
- }
- return std::string();
-}
-
const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
attribute mediump vec2 aPosition;\n
uniform mediump mat4 uMvpMatrix;\n
map.Insert( Toolkit::TextVisual::Property::MULTI_LINE, mController->IsMultiLineEnabled() );
- map.Insert( Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT, GetHorizontalAlignment( mController->GetHorizontalAlignment() ) );
+ map.Insert( Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT, mController->GetHorizontalAlignment() );
- map.Insert( Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT, GetVerticalAlignment( mController->GetVerticalAlignment() ) );
+ map.Insert( Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT, mController->GetVerticalAlignment() );
map.Insert( Toolkit::TextVisual::Property::TEXT_COLOR, mController->GetDefaultColor() );
}
case Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT:
{
- Toolkit::Text::Layout::HorizontalAlignment alignment( Toolkit::Text::Layout::HORIZONTAL_ALIGN_BEGIN );
- if( Scripting::GetEnumeration< Toolkit::Text::Layout::HorizontalAlignment >( propertyValue.Get< std::string >().c_str(),
- HORIZONTAL_ALIGNMENT_STRING_TABLE,
- HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT,
- alignment ) )
- {
- mController->SetHorizontalAlignment( alignment );
- }
+ Text::HorizontalAlignment::Type alignment( Toolkit::Text::HorizontalAlignment::BEGIN );
+ Toolkit::Text::GetHorizontalAlignmentEnum( propertyValue, alignment );
+
+ mController->SetHorizontalAlignment( alignment );
break;
}
case Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT:
{
- Toolkit::Text::Layout::VerticalAlignment alignment( Toolkit::Text::Layout::VERTICAL_ALIGN_BOTTOM );
- if( Scripting::GetEnumeration< Toolkit::Text::Layout::VerticalAlignment >( propertyValue.Get< std::string >().c_str(),
- VERTICAL_ALIGNMENT_STRING_TABLE,
- VERTICAL_ALIGNMENT_STRING_TABLE_COUNT,
- alignment ) )
- {
- mController->SetVerticalAlignment( alignment );
- }
+ Text::VerticalAlignment::Type alignment( Toolkit::Text::VerticalAlignment::BOTTOM );
+ Toolkit::Text::GetVerticalAlignmentEnum( propertyValue, alignment);
+
+ mController->SetVerticalAlignment( alignment );
break;
}
case Toolkit::TextVisual::Property::TEXT_COLOR:
/**
* @brief The text horizontal alignment.
- * @details Name "horizontalAlignment", type Property::STRING.
+ * @details Name "horizontalAlignment", type Property::STRING or type HorizontalAlignment::Type (Property::INTEGER)
* Values "BEGIN" "CENTER" "END".
+ * @note Return type is Property::STRING
* @SINCE_1_1.37
*/
HORIZONTAL_ALIGNMENT,
/**
* @brief The line horizontal alignment.
- * @details Name "horizontalAlignment", type Property::STRING.
+ * @details Name "horizontalAlignment", type Property::STRING or type HorizontalAlignment::Type (Property::INTEGER)
* Values "BEGIN", "CENTER", "END".
+ * @note Return type is Property::STRING
* @SINCE_1_0.0
*/
HORIZONTAL_ALIGNMENT,
/**
* @brief The line vertical alignment.
- * @details Name "verticalAlignment", type Property::STRING.
+ * @details Name "verticalAlignment", type Property::STRING type VerticalAlignment::Type (Property::INTEGER)
* Values "TOP", "CENTER", "BOTTOM".
+ * @note Return type is Property::STRING
* @SINCE_1_0.0
*/
VERTICAL_ALIGNMENT,
/**
* @brief The line horizontal alignment.
- * @details Name "horizontalAlignment", type Property::STRING
+ * @details Name "horizontalAlignment", type Property::STRING or type HorizontalAlignment::Type (Property::INTEGER)
* Values "BEGIN", "CENTER", "END", default BEGIN.
+ * @note Return type is Property::STRING
* @SINCE_1_0.0
*/
HORIZONTAL_ALIGNMENT,
/**
* @brief The line vertical alignment.
- * @details Name "verticalAlignment", type Property::STRING.
+ * @details Name "verticalAlignment", type Property::STRING or type VerticalAlignment::Type (Property::INTEGER).
* Values "TOP", "CENTER", "BOTTOM" @SINCE_1_0.0, default TOP.
+ * @note Return type is Property::STRING
* @SINCE_1_0.0
*/
VERTICAL_ALIGNMENT,
public_api_focus_manager_header_files = \
$(public_api_src_dir)/focus-manager/keyboard-focus-manager.h
-public_api_rendering_backend_header_files = \
- $(public_api_src_dir)/text/rendering-backend.h
+public_api_text_header_files = \
+ $(public_api_src_dir)/text/rendering-backend.h \
+ $(public_api_src_dir)/text/text-enumerations.h
public_api_video_view_header_files = \
$(public_api_src_dir)/controls/video-view/video-view.h
--- /dev/null
+#ifndef DALI_TOOLKIT_TEXT_ENUMERATIONS_H
+#define DALI_TOOLKIT_TEXT_ENUMERATIONS_H
+
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+/**
+ * @addtogroup dali_toolkit_controls
+ * @{
+ */
+
+namespace Text
+{
+
+/**
+ * @brief The available Horizontal alignments for text
+ * @SINCE_1_2.60
+ */
+namespace HorizontalAlignment
+{
+ /**
+ * @brief Enumerations for Horizontal alignment
+ *
+ * @SINCE_1_2.60
+ */
+ enum Type
+ {
+ BEGIN, ///< @SINCE_1_2.60
+ CENTER, ///< @SINCE_1_2.60
+ END ///< @SINCE_1_2.60
+ };
+}
+
+/**
+ * @brief The available Vertical alignments for text
+ * @SINCE_1_2.60
+ */
+namespace VerticalAlignment
+{
+ /**
+ * @brief Enumerations for Vertical alignment
+ *
+ * @SINCE_1_2.60
+ */
+ enum Type
+ {
+ TOP, ///< @SINCE_1_2.60
+ CENTER, ///< @SINCE_1_2.60
+ BOTTOM ///< @SINCE_1_2.60
+ };
+}
+
+} // Text
+
+/**
+ * @}
+ */
+
+} // Toolkit
+
+} // Dali
+
+#endif //DALI_TOOLKIT_TEXT_ENUMERATIONS_H
/**
* @brief The line horizontal alignment.
- * @details name "horizontalAlignment", type Property::STRING, values "BEGIN", "CENTER", "END", default BEGIN.
+ * @details Name "horizontalAlignment", type HorizontalAlignment::Type (Property::INTEGER) or Property::STRING.
+ * @note Optional. If not specified, the default is HorizontalAlignment::BEGIN
+ * @note Return type is HorizontalAlignment::Type (Property::INTEGER)
* @SINCE_1_2.60
*/
HORIZONTAL_ALIGNMENT,
/**
* @brief The line vertical alignment.
- * @details name "verticalAlignment", type Property::STRING, values "TOP", "CENTER", "BOTTOM", default TOP.
+ * @details name "verticalAlignment", VerticalAlignment::Type (Property::INTEGER) or Property::STRING
+ * @note Optional. If not specified, the default is VerticalAlignment::TOP
+ * @note Return type is VerticalAlignment::Type (Property::INTEGER)`
* @SINCE_1_2.60
*/
VERTICAL_ALIGNMENT,