namespace Toolkit
{
+const Property::Index TextView::PROPERTY_MARKUP_ENABLED( Internal::TextView::TEXTVIEW_PROPERTY_START_INDEX );
+
namespace Internal
{
SignalConnectorType signalConnector1( typeRegistration, Toolkit::TextView::SIGNAL_TEXT_SCROLLED , &TextView::DoConnectSignal );
+PropertyRegistration property1( typeRegistration, "markup-enabled", Toolkit::TextView::PROPERTY_MARKUP_ENABLED, Property::BOOLEAN, &TextView::SetProperty, &TextView::GetProperty );
+
/**
* Whether the text-view-processor operation sets, inserts, replaces, removes text.
*
{
// Creates a styled text with the markup or plain string.
MarkupProcessor::StyledTextArray styledText;
- MarkupProcessor::GetStyledTextArray( text, styledText );
+ MarkupProcessor::GetStyledTextArray( text, styledText, IsMarkupProcessingEnabled() );
// Calls SetText() with the styled text array.
SetText( styledText );
{
// Creates a styled text with the markup or plain string.
MarkupProcessor::StyledTextArray styledText;
- MarkupProcessor::GetStyledTextArray( text, styledText );
+ MarkupProcessor::GetStyledTextArray( text, styledText, IsMarkupProcessingEnabled() );
// Calls InsertTextAt() with the styled text array.
InsertTextAt( position, styledText );
{
// Creates a styled text with the markup or plain string.
MarkupProcessor::StyledTextArray styledText;
- MarkupProcessor::GetStyledTextArray( text, styledText );
+ MarkupProcessor::GetStyledTextArray( text, styledText, IsMarkupProcessingEnabled() );
// Calls ReplaceTextFromTo() with the styled text array.
ReplaceTextFromTo( position, numberOfCharacters, styledText );
{
// Creates a styled text with the markup or plain string.
MarkupProcessor::StyledTextArray styledText;
- MarkupProcessor::GetStyledTextArray( ellipsizeText, styledText );
+ MarkupProcessor::GetStyledTextArray( ellipsizeText, styledText, IsMarkupProcessingEnabled() );
SetEllipsizeText( styledText );
}
return mVisualParameters.mSnapshotModeEnabled;
}
+void TextView::SetMarkupProcessingEnabled( bool enable )
+{
+ mMarkUpEnabled = enable;
+}
+
+bool TextView::IsMarkupProcessingEnabled() const
+{
+ return mMarkUpEnabled;
+}
+
void TextView::SetScrollEnabled( const bool enable )
{
if( enable != mVisualParameters.mScrollEnabled )
mVerticalAlignment( Toolkit::Alignment::VerticalCenter ),
mLineJustification( Toolkit::TextView::Left ),
mLineHeightOffset( 0.f ),
- mEllipsizeText()
+ mEllipsizeText(),
+ mMarkUpEnabled( false )
{
// Sets ellipsize text
MarkupProcessor::StyledTextArray styledEllipsize;
- MarkupProcessor::GetStyledTextArray( std::string( "..." ), mEllipsizeText );
+ MarkupProcessor::GetStyledTextArray( std::string( "..." ), mEllipsizeText, false );
}
TextView::LayoutParameters::LayoutParameters( const Toolkit::TextView::MultilinePolicy multilinePolicy,
const Toolkit::Alignment::Type alignmentType,
const Toolkit::TextView::LineJustification lineJustification,
const float lineHeightOffset,
- const std::string& ellipsizeText )
+ const std::string& ellipsizeText,
+ const bool markUpEnabled )
: mMultilinePolicy( multilinePolicy ),
mWidthExceedPolicy( widthExceedPolicy ),
mHeightExceedPolicy( heightExceedPolicy ),
mVerticalAlignment(),
mLineJustification( lineJustification ),
mLineHeightOffset( lineHeightOffset ),
- mEllipsizeText()
+ mEllipsizeText(),
+ mMarkUpEnabled( markUpEnabled )
{
// Sets alignment
Toolkit::Alignment::Type horizontalAlignment( ( alignmentType & Toolkit::Alignment::HorizontalLeft ? Toolkit::Alignment::HorizontalLeft :
// Sets ellipsize text
MarkupProcessor::StyledTextArray styledEllipsize;
- MarkupProcessor::GetStyledTextArray( ellipsizeText, mEllipsizeText );
+ MarkupProcessor::GetStyledTextArray( ellipsizeText, mEllipsizeText, mMarkUpEnabled );
}
TextView::LayoutParameters::LayoutParameters( const TextView::LayoutParameters& layoutParameters )
mVerticalAlignment( layoutParameters.mVerticalAlignment ),
mLineJustification( layoutParameters.mLineJustification ),
mLineHeightOffset( layoutParameters.mLineHeightOffset ),
- mEllipsizeText( layoutParameters.mEllipsizeText )
+ mEllipsizeText( layoutParameters.mEllipsizeText ),
+ mMarkUpEnabled( layoutParameters.mMarkUpEnabled )
{
}
mLineJustification = layoutParameters.mLineJustification;
mLineHeightOffset = layoutParameters.mLineHeightOffset;
mEllipsizeText = layoutParameters.mEllipsizeText;
+ mMarkUpEnabled = layoutParameters.mMarkUpEnabled;
return *this;
}
static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalCenter | Toolkit::Alignment::VerticalCenter ),
Toolkit::TextView::Left,
PointSize( 0.f ),
- std::string( "..." ) ),
+ std::string( "..." ),
+ false ),
mVisualParameters(),
mRelayoutData(),
mRelayoutOperations( NO_RELAYOUT ),
mRenderTask(),
mPanGestureDetector(),
mLockPreviousSnapshotMode( false ),
- mPreviousSnapshotModeEnabled( false )
+ mPreviousSnapshotModeEnabled( false ),
+ mMarkUpEnabled( false )
{
TextViewProcessor::CreateWordTextInfo( mLayoutParameters.mEllipsizeText,
mRelayoutData.mTextLayoutInfo.mEllipsizeLayoutInfo );
}
}
+void TextView::SetProperty( BaseObject* object, Property::Index index, const Property::Value& value )
+{
+ Toolkit::TextView textView = Toolkit::TextView::DownCast( Dali::BaseHandle( object ) );
+
+ if ( textView && ( index == Toolkit::TextView::PROPERTY_MARKUP_ENABLED ) )
+ {
+ Internal::TextView& textViewImpl( GetImpl( textView ) );
+ bool newValue( value.Get<bool>() );
+ if( newValue != textViewImpl.IsMarkupProcessingEnabled() )
+ {
+ textViewImpl.SetMarkupProcessingEnabled( newValue );
+ if( newValue )
+ {
+ // If markup processing has been enabled, Ensure current text is reprocessed.
+ const std::string& currentText( textViewImpl.GetText() );
+ if( ! currentText.empty() )
+ {
+ textViewImpl.SetText( currentText );
+ }
+ }
+ }
+ }
+}
+
+Property::Value TextView::GetProperty( BaseObject* object, Property::Index propertyIndex )
+{
+ Toolkit::TextView textView = Toolkit::TextView::DownCast( Dali::BaseHandle( object ) );
+
+ if ( textView && ( propertyIndex == Toolkit::TextView::PROPERTY_MARKUP_ENABLED ) )
+ {
+ return Property::Value( GetImpl( textView ).mMarkUpEnabled );
+ }
+
+ return Property::Value();
+}
+
} // namespace Internal
} // namespace Toolkit