/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * 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.
glyphsPerCharacter.Begin(),
numberOfGlyphs,
Text::HorizontalAlignment::BEGIN,
- Layout::LineWrap::WORD );
+ Text::LineWrap::WORD );
Vector<LineRun>& lines = visualModel->mLines;
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * 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.
visualModel->mGlyphsPerCharacter.Begin(),
totalNumberOfGlyphs,
Text::HorizontalAlignment::BEGIN,
- Layout::LineWrap::WORD );
+ Text::LineWrap::WORD );
layoutParameters.isLastNewParagraph = isLastNewParagraph;
visualModel->mGlyphsPerCharacter.Begin(),
visualModel->mGlyphs.Count(),
Text::HorizontalAlignment::BEGIN,
- Layout::LineWrap::WORD );
+ Text::LineWrap::WORD );
layoutParameters.numberOfBidirectionalInfoRuns = logicalModel->mBidirectionalLineInfo.Count();
layoutParameters.lineBidirectionalInfoRunsBuffer = logicalModel->mBidirectionalLineInfo.Begin();
END_TEST;
}
-int UtcDaliToolkitTextEditorTextWarpMode(void)
+
+int UtcDaliToolkitTextEditorTextWrapMode(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliToolkitTextEditorTextWarpMode");
Stage::GetCurrent().Add( editor );
editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, "WORD" );
+ DALI_TEST_EQUALS( editor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
application.SendNotification();
application.Render();
lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
+ editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, "CHARACTER" );
+ DALI_TEST_EQUALS( editor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
+ application.SendNotification();
+ application.Render();
- editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, "CHARACTER" );
+ lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+ DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );
+
+ editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, Text::LineWrap::WORD );
+ DALI_TEST_EQUALS( editor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
application.SendNotification();
application.Render();
+ lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
+ DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
+
+ editor.SetProperty( TextEditor::Property::LINE_WRAP_MODE, Text::LineWrap::CHARACTER );
+ DALI_TEST_EQUALS( editor.GetProperty< int >( TextEditor::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
lineCount = editor.GetProperty<int>( TextEditor::Property::LINE_COUNT );
DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );
END_TEST;
}
-int UtcDaliToolkitTextlabelTextWarpMode(void)
+int UtcDaliToolkitTextlabelTextWrapMode(void)
{
ToolkitTestApplication application;
tet_infoline(" UtcDaliToolkitTextlabelTextWarpMode");
//label.SetProperty( TextLabel::Property::POINT_SIZE, 18 );
Stage::GetCurrent().Add( label );
- label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "WRAP_MODE_WORD" );
+ label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "WORD" );
+ DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
application.SendNotification();
application.Render();
lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
+ label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "CHARACTER" );
+ DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
+ application.SendNotification();
+ application.Render();
- label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "WRAP_MODE_CHARACTER" );
+ label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::WORD );
+ DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::WORD ), TEST_LOCATION );
application.SendNotification();
application.Render();
+ lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
+ DALI_TEST_EQUALS( lineCount, 4, TEST_LOCATION );
+
+ label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, Text::LineWrap::CHARACTER );
+ DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
+
+ application.SendNotification();
+ application.Render();
lineCount = label.GetProperty<int>( TextLabel::Property::LINE_COUNT );
DALI_TEST_EQUALS( lineCount, 3, TEST_LOCATION );
+ tet_infoline( "Ensure invalid string does not change wrapping mode" );
+ label.SetProperty( TextLabel::Property::LINE_WRAP_MODE, "InvalidWrapMode" );
+ DALI_TEST_EQUALS( label.GetProperty< int >( TextLabel::Property::LINE_WRAP_MODE ), static_cast< int >( Text::LineWrap::CHARACTER ), TEST_LOCATION );
+
END_TEST;
}
namespace
{
-const Scripting::StringEnum LINE_WRAP_MODE_STRING_TABLE[] =
-{
- { "WORD", Toolkit::Text::Layout::LineWrap::WORD },
- { "CHARACTER", Toolkit::Text::Layout::LineWrap::CHARACTER }
-};
-const unsigned int LINE_WRAP_MODE_STRING_TABLE_COUNT = sizeof( LINE_WRAP_MODE_STRING_TABLE ) / sizeof( LINE_WRAP_MODE_STRING_TABLE[0] );
-
const char* const SCROLL_BAR_POSITION("sourcePosition");
const char* const SCROLL_BAR_POSITION_MIN("sourcePositionMin");
const char* const SCROLL_BAR_POSITION_MAX("sourcePositionMax");
DALI_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextEditor, "lineCount", INTEGER, LINE_COUNT )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "enableSelection", BOOLEAN, ENABLE_SELECTION )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "placeholder", MAP, PLACEHOLDER )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "lineWrapMode", STRING, LINE_WRAP_MODE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "lineWrapMode", INTEGER, LINE_WRAP_MODE )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "placeholderText", STRING, PLACEHOLDER_TEXT )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "placeholderTextColor", VECTOR4, PLACEHOLDER_TEXT_COLOR )
{
if( impl.mController )
{
- 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() );
-
- Text::HorizontalAlignment::Type alignment( Text::HorizontalAlignment::BEGIN );
-
- Text::GetHorizontalAlignmentEnum( 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 );
}
}
}
case Toolkit::TextEditor::Property::LINE_WRAP_MODE:
{
- const std::string& wrapModeStr = value.Get< std::string >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p LINE_WRAP_MODE %s\n", impl.mController.Get(), wrapModeStr.c_str() );
-
- Layout::LineWrap::Mode lineWrapMode( Layout::LineWrap::WORD );
- if( Scripting::GetEnumeration< Layout::LineWrap::Mode >( wrapModeStr.c_str(),
- LINE_WRAP_MODE_STRING_TABLE,
- LINE_WRAP_MODE_STRING_TABLE_COUNT,
- lineWrapMode ) )
+ if( impl.mController )
{
- impl.mController->SetLineWrapMode( 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 );
+ }
}
break;
}
{
if( impl.mController )
{
- 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() );
-
- Text::HorizontalAlignment::Type alignment( Text::HorizontalAlignment::BEGIN );
- GetHorizontalAlignmentEnum( value, alignment );
- impl.mController->SetHorizontalAlignment( 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 );
+ }
}
break;
}
{
if( impl.mController )
{
- 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() );
-
- Text::VerticalAlignment::Type alignment( Text::VerticalAlignment::BOTTOM );
- GetVerticalAlignmentEnum( value, alignment );
- impl.mController->SetVerticalAlignment( 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 );
+ }
}
break;
}
};
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 LINE_WRAP_MODE_STRING_TABLE[] =
-{
- { "WRAP_MODE_WORD", Toolkit::Text::Layout::LineWrap::WORD },
- { "WRAP_MODE_CHARACTER", Toolkit::Text::Layout::LineWrap::CHARACTER }
-};
-const unsigned int LINE_WRAP_MODE_STRING_TABLE_COUNT = sizeof( LINE_WRAP_MODE_STRING_TABLE ) / sizeof( LINE_WRAP_MODE_STRING_TABLE[0] );
-
// Type registration
BaseHandle Create()
{
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollLoopDelay", FLOAT, AUTO_SCROLL_LOOP_DELAY )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollStopMode", STRING, AUTO_SCROLL_STOP_MODE )
DALI_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextLabel, "lineCount", INTEGER, LINE_COUNT )
-DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "lineWrapMode", STRING, LINE_WRAP_MODE )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "lineWrapMode", INTEGER, LINE_WRAP_MODE )
DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT( Toolkit, TextLabel, "textColor", Color::BLACK, TEXT_COLOR )
DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, TextLabel, "textColorRed", TEXT_COLOR_RED, TEXT_COLOR, 0 )
DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, TextLabel, "textColorGreen", TEXT_COLOR_GREEN, TEXT_COLOR, 1 )
{
if( impl.mController )
{
- Toolkit::Text::HorizontalAlignment::Type alignment( Toolkit::Text::HorizontalAlignment::BEGIN );
- Text::GetHorizontalAlignmentEnum( value, alignment );
-
- impl.mController->SetHorizontalAlignment( 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 );
+ }
}
break;
}
{
if( impl.mController )
{
- Toolkit::Text::VerticalAlignment::Type alignment( Toolkit::Text::VerticalAlignment::BOTTOM );
- Text::GetVerticalAlignmentEnum( value, alignment );
-
- impl.mController->SetVerticalAlignment( 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 );
+ }
}
break;
}
}
case Toolkit::TextLabel::Property::LINE_WRAP_MODE:
{
- const std::string& wrapModeStr = value.Get< std::string >();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel %p LINE_WRAP_MODE %s\n", impl.mController.Get(), wrapModeStr.c_str() );
-
- Layout::LineWrap::Mode lineWrapMode( Layout::LineWrap::WORD );
- if( Scripting::GetEnumeration< Layout::LineWrap::Mode >( wrapModeStr.c_str(),
- LINE_WRAP_MODE_STRING_TABLE,
- LINE_WRAP_MODE_STRING_TABLE_COUNT,
- lineWrapMode ) )
+ if( impl.mController )
{
- impl.mController->SetLineWrapMode( 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 );
+ }
}
break;
}
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * 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.
LineLayout tmpLineLayout;
const bool isMultiline = mLayout == MULTI_LINE_BOX;
- const bool isWordLaidOut = parameters.lineWrapMode == Layout::LineWrap::WORD;
+ const bool isWordLaidOut = parameters.lineWrapMode == Text::LineWrap::WORD;
// The last glyph to be laid-out.
const GlyphIndex lastGlyphOfParagraphPlusOne = parameters.startGlyphIndex + parameters.numberOfGlyphs;
#define DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * 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.
// 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>
namespace Dali
{
const Length* const glyphsPerCharacterBuffer,
Length totalNumberOfGlyphs,
Text::HorizontalAlignment::Type horizontalAlignment,
- LineWrap::Mode lineWrapMode )
+ Text::LineWrap::Mode lineWrapMode )
: boundingBox( boundingBox ),
textBuffer( textBuffer ),
lineBreakInfoBuffer( lineBreakInfoBuffer ),
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.
+ Text::LineWrap::Mode lineWrapMode; ///< The line wrap mode for moving to next line.
bool isLastNewParagraph; ///< Whether the last character is a new paragraph character.
};
+++ /dev/null
-#ifndef DALI_TOOLKIT_TEXT_LAYOUT_WRAPMODE_H
-#define DALI_TOOLKIT_TEXT_LAYOUT_WRAPMODE_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 Unit of wrapping for moving to next line
- *
- * If layout width too short to show full text,
- * WRAP_MODE_WORD mode will move word to next line,
- * +---------+
- * |HELLO |
- * |WORLLD |
- * +---------+
- *
- * but WRAP_MODE_CHARACTER mode will move character by character to next line
- * +---------+
- * |HELLO WOR|
- * |LD |
- * +---------+
- */
-
-namespace LineWrap {
-
-enum Mode
-{
- WORD,
- CHARACTER
-};
-
-} // namespace LineWrap
-
-} // namespace Layout
-
-} // namespace Text
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_TEXT_LAYOUT_WRAPMODE_H
return mImpl->mModel->mVerticalAlignment;
}
-void Controller::SetLineWrapMode( Layout::LineWrap::Mode lineWrapMode )
+void Controller::SetLineWrapMode( Text::LineWrap::Mode lineWrapMode )
{
if( lineWrapMode != mImpl->mModel->mLineWrapMode )
{
}
}
-Layout::LineWrap::Mode Controller::GetLineWrapMode() const
+Text::LineWrap::Mode Controller::GetLineWrapMode() const
{
return mImpl->mModel->mLineWrapMode;
}
#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/layouts/layout-wrap-mode.h>
#include <dali-toolkit/internal/text/hidden-text.h>
#include <dali-toolkit/internal/text/text-model-interface.h>
* @brief Sets the text's wrap mode
* @param[in] text wrap mode The unit of wrapping
*/
- void SetLineWrapMode( Layout::LineWrap::Mode textWarpMode );
+ void SetLineWrapMode( Text::LineWrap::Mode textWarpMode );
/**
* @brief Retrieve text wrap mode previously set.
* @return text wrap mode
*/
- Layout::LineWrap::Mode GetLineWrapMode() const;
+ Text::LineWrap::Mode GetLineWrapMode() const;
/**
* @brief Enable or disable the text elide.
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_WITH_SCOPE( Toolkit::Text::HorizontalAlignment, BEGIN )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::HorizontalAlignment, CENTER )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::HorizontalAlignment, 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_WITH_SCOPE( Toolkit::Text::VerticalAlignment, TOP )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::VerticalAlignment, CENTER )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::VerticalAlignment, BOTTOM )
DALI_ENUM_TO_STRING_TABLE_END( VERTICAL_ALIGNMENT_TYPE )
+DALI_ENUM_TO_STRING_TABLE_BEGIN( LINE_WRAP_MODE )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::LineWrap, WORD )
+DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Text::LineWrap, CHARACTER )
+DALI_ENUM_TO_STRING_TABLE_END( LINE_WRAP_MODE )
} // namespace
-bool GetHorizontalAlignmentEnum( const Property::Value& propertyValue, Toolkit::Text::HorizontalAlignment::Type& alignment )
+bool GetHorizontalAlignmentEnumeration( 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 )
+bool GetVerticalAlignmentEnumeration( const Property::Value& propertyValue, Toolkit::Text::VerticalAlignment::Type& alignment )
{
return Scripting::GetEnumerationProperty( propertyValue, VERTICAL_ALIGNMENT_TYPE_TABLE, VERTICAL_ALIGNMENT_TYPE_TABLE_COUNT, alignment );
}
+bool GetLineWrapModeEnumeration( const Property::Value& propertyValue, Toolkit::Text::LineWrap::Mode& lineWrapMode )
+{
+ return Scripting::GetEnumerationProperty( propertyValue, LINE_WRAP_MODE_TABLE, LINE_WRAP_MODE_TABLE_COUNT, lineWrapMode );
+}
+
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 )
VERTICAL_ALIGNMENT_TYPE_TABLE_COUNT );
}
-
} // namespace Text
} // namespace Toolkit
/**
* @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
+ * @param[in] propertyValue The source value (which can be a Property::INTEGER or Property::STRING type)
+ * @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 );
+bool GetHorizontalAlignmentEnumeration( 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
+ * @param[in] propertyValue The source value (which can be a Property::INTEGER or Property::STRING type)
+ * @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 );
+bool GetVerticalAlignmentEnumeration( const Property::Value& propertyValue, Toolkit::Text::VerticalAlignment::Type& alignment );
+
+/**
+ * @brief Get the line-wrap-mode from the provided property value.
+ * @param[in] propertyValue The source value (which can be a Property::INTEGER or Property::STRING type)
+ * @param[out] alignment The resulting lineWrapMode from the given source
+ * @return true if the resulting lineWrapMode has been updated
+ */
+bool GetLineWrapModeEnumeration( const Property::Value& propertyValue, Toolkit::Text::LineWrap::Mode& lineWrapMode );
/**
* @brief Get the alignment string from the provided alignment string.
*/
const char* GetVerticalAlignmentString( const Toolkit::Text::VerticalAlignment::Type& alignment );
-
} // namespace Text
} // namespace Toolkit
mVisualModel(),
mScrollPosition(),
mScrollPositionLast(),
- mHorizontalAlignment( HorizontalAlignment::BEGIN ),
- mVerticalAlignment( VerticalAlignment::TOP ),
- mLineWrapMode( Layout::LineWrap::WORD ),
+ mHorizontalAlignment( Text::HorizontalAlignment::BEGIN ),
+ mVerticalAlignment( Text::VerticalAlignment::TOP ),
+ mLineWrapMode( Text::LineWrap::WORD ),
mAlignmentOffset( 0.0f ),
mElideEnabled( false )
{
// INTERNAL INCLUDES
#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>
#include <dali-toolkit/internal/text/visual-model-impl.h>
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
+ Text::LineWrap::Mode mLineWrapMode; ///< The text wrap mode
float mAlignmentOffset; ///< The alignment offset.
bool mElideEnabled:1; ///< Whether the text's elide is enabled.
};
}
case Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT:
{
- Text::HorizontalAlignment::Type alignment( Toolkit::Text::HorizontalAlignment::BEGIN );
- Toolkit::Text::GetHorizontalAlignmentEnum( propertyValue, alignment );
-
- mController->SetHorizontalAlignment( alignment );
+ if( mController )
+ {
+ Text::HorizontalAlignment::Type alignment( static_cast< Text::HorizontalAlignment::Type >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
+ if( Toolkit::Text::GetHorizontalAlignmentEnumeration( propertyValue, alignment ) )
+ {
+ mController->SetHorizontalAlignment( alignment );
+ }
+ }
break;
}
case Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT:
{
- Text::VerticalAlignment::Type alignment( Toolkit::Text::VerticalAlignment::BOTTOM );
- Toolkit::Text::GetVerticalAlignmentEnum( propertyValue, alignment);
-
- mController->SetVerticalAlignment( alignment );
+ if( 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( Toolkit::Text::GetVerticalAlignmentEnumeration( propertyValue, alignment) )
+ {
+ mController->SetVerticalAlignment( alignment );
+ }
+ }
break;
}
case Toolkit::TextVisual::Property::TEXT_COLOR:
PLACEHOLDER,
/**
- * @brief line wrap mode when the text lines over layout width.
- * @details Name "lineWrapMode", type Property::STRING.
+ * @brief Line wrap mode when text lines are greater than the layout width.
+ * @details Name "lineWrapMode", type Text::LineWrap::Mode (Text::Property::INTEGER) or Property::STRING.
* @SINCE_1_2.60
+ * @note Default is Text::LineWrap::WORD.
+ * @note Return type is Text::LineWrap::Mode (Text::Property::INTEGER).
+ * @see Text::LineWrap
*/
LINE_WRAP_MODE,
};
/**
* @brief Line wrap mode when text lines are greater than the layout width.
- * @details Name "lineWrapMode", type Property::STRING.
+ * @details Name "lineWrapMode", type Text::LineWrap::Mode (Text::Property::INTEGER) or Property::STRING.
* @SINCE_1_2.60
+ * @note Default is Text::LineWrap::WORD.
+ * @note Return type is Text::LineWrap::Mode (Text::Property::INTEGER).
+ * @see Text::LineWrap
*/
LINE_WRAP_MODE,
{
/**
- * @brief The available Horizontal alignments for 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
+ * @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
+};
+
+} // namespace HorizontalAlignment
+
+/**
+ * @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
+
+/**
+ * @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
+};
+
+} // namespace VerticalAlignment
+
+/**
+ * @brief Contains modes which specify how lines are wrapped.
+ *
+ * If the layout width is too short to show the full text, then a wrapping mode can be specified.
+ *
+ * LineWrap::WORD mode will move an entire word to the next line:
+ * @code
+ * +---------+
+ * |HELLO |
+ * |WORLD |
+ * +---------+
+ * @endcode
+ *
+ * LineWrap::CHARACTER mode will move character by character to the next line:
+ * @code
+ * +---------+
+ * |HELLO WOR|
+ * |LD |
+ * +---------+
+ * @endcode
+ *
+ * @SINCE_1_2.60
+ */
+namespace LineWrap
+{
+
+/**
+ * @brief Enumerations specifying how a line is wrapped.
+ * @SINCE_1_2.60
+ * @see LineWrap
+ */
+enum Mode
+{
+ WORD, ///< @SINCE_1_2.60
+ CHARACTER ///< @SINCE_1_2.60
+};
+
+} // namespace LineWrap
+
+} // namespace Text
/**
* @}
*/
-} // Toolkit
+} // namespace Toolkit
-} // Dali
+} // namespace Dali
#endif //DALI_TOOLKIT_TEXT_ENUMERATIONS_H