#include <dali-toolkit/public-api/text/rendering-backend.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.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>
#include <dali-toolkit/internal/text/text-view.h>
#include <dali-toolkit/internal/styling/style-manager-impl.h>
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputFontFamily", STRING, INPUT_FONT_FAMILY )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputFontStyle", STRING, INPUT_FONT_STYLE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputPointSize", FLOAT, INPUT_POINT_SIZE )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "lineSpacing", FLOAT, LINE_SPACING )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputLineSpacing", FLOAT, INPUT_LINE_SPACING )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "underline", STRING, UNDERLINE )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputUnderline", STRING, INPUT_UNDERLINE )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "shadow", STRING, SHADOW )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputShadow", STRING, INPUT_SHADOW )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "emboss", STRING, EMBOSS )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputEmboss", STRING, INPUT_EMBOSS )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "outline", STRING, OUTLINE )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputOutline", STRING, INPUT_OUTLINE )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED )
}
break;
}
+ case Toolkit::TextEditor::Property::LINE_SPACING:
+ {
+ if( impl.mController )
+ {
+ const float lineSpacing = value.Get<float>();
+ impl.mController->SetDefaultLineSpacing( lineSpacing );
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_LINE_SPACING:
+ {
+ if( impl.mController )
+ {
+ const float lineSpacing = value.Get<float>();
+ impl.mController->SetInputLineSpacing( lineSpacing );
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::UNDERLINE:
+ {
+ const bool update = SetUnderlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_UNDERLINE:
+ {
+ const bool update = SetUnderlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::SHADOW:
+ {
+ const bool update = SetShadowProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_SHADOW:
+ {
+ const bool update = SetShadowProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::EMBOSS:
+ {
+ const bool update = SetEmbossProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_EMBOSS:
+ {
+ const bool update = SetEmbossProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::OUTLINE:
+ {
+ const bool update = SetOutlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_OUTLINE:
+ {
+ const bool update = SetOutlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
} // switch
} // texteditor
}
}
break;
}
+ case Toolkit::TextEditor::Property::LINE_SPACING:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->GetDefaultLineSpacing();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_LINE_SPACING:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->GetInputLineSpacing();
+ }
+ break;
+ }
+ case Toolkit::TextEditor::Property::UNDERLINE:
+ {
+ GetUnderlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_UNDERLINE:
+ {
+ GetUnderlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ break;
+ }
+ case Toolkit::TextEditor::Property::SHADOW:
+ {
+ GetShadowProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_SHADOW:
+ {
+ GetShadowProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ break;
+ }
+ case Toolkit::TextEditor::Property::EMBOSS:
+ {
+ GetEmbossProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_EMBOSS:
+ {
+ GetEmbossProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ break;
+ }
+ case Toolkit::TextEditor::Property::OUTLINE:
+ {
+ GetOutlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextEditor::Property::INPUT_OUTLINE:
+ {
+ GetOutlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ break;
+ }
} //switch
}
if( mRenderableActor )
{
- // TODO: Scroll and alignment needs to be refactored.
- const Vector2& alignmentOffset = mController->GetAlignmentOffset();
const Vector2& scrollOffset = mController->GetScrollPosition();
- mRenderableActor.SetPosition( scrollOffset.x, alignmentOffset.y + scrollOffset.y );
+ mRenderableActor.SetPosition( scrollOffset.x, scrollOffset.y );
Actor clipRootActor;
if( mClipper )
#include <dali-toolkit/public-api/text/rendering-backend.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.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>
#include <dali-toolkit/internal/text/text-view.h>
#include <dali-toolkit/internal/styling/style-manager-impl.h>
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputFontFamily", STRING, INPUT_FONT_FAMILY )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputFontStyle", STRING, INPUT_FONT_STYLE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputPointSize", FLOAT, INPUT_POINT_SIZE )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "underline", STRING, UNDERLINE )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputUnderline", STRING, INPUT_UNDERLINE )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "shadow", STRING, SHADOW )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputShadow", STRING, INPUT_SHADOW )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "emboss", STRING, EMBOSS )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputEmboss", STRING, INPUT_EMBOSS )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "outline", STRING, OUTLINE )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputOutline", STRING, INPUT_OUTLINE )
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED )
}
break;
}
+ case Toolkit::TextField::Property::UNDERLINE:
+ {
+ const bool update = SetUnderlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextField::Property::INPUT_UNDERLINE:
+ {
+ const bool update = SetUnderlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextField::Property::SHADOW:
+ {
+ const bool update = SetShadowProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextField::Property::INPUT_SHADOW:
+ {
+ const bool update = SetShadowProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextField::Property::EMBOSS:
+ {
+ const bool update = SetEmbossProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextField::Property::INPUT_EMBOSS:
+ {
+ const bool update = SetEmbossProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextField::Property::OUTLINE:
+ {
+ const bool update = SetOutlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextField::Property::INPUT_OUTLINE:
+ {
+ const bool update = SetOutlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
} // switch
} // textfield
}
}
break;
}
+ case Toolkit::TextField::Property::UNDERLINE:
+ {
+ GetUnderlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextField::Property::INPUT_UNDERLINE:
+ {
+ GetUnderlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ break;
+ }
+ case Toolkit::TextField::Property::SHADOW:
+ {
+ GetShadowProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextField::Property::INPUT_SHADOW:
+ {
+ GetShadowProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ break;
+ }
+ case Toolkit::TextField::Property::EMBOSS:
+ {
+ GetEmbossProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextField::Property::INPUT_EMBOSS:
+ {
+ GetEmbossProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ break;
+ }
+ case Toolkit::TextField::Property::OUTLINE:
+ {
+ GetOutlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextField::Property::INPUT_OUTLINE:
+ {
+ GetOutlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
+ break;
+ }
} //switch
}
if( mRenderableActor )
{
- // TODO: Scroll and alignment needs to be refactored.
- const Vector2& alignmentOffset = mController->GetAlignmentOffset();
const Vector2& scrollOffset = mController->GetScrollPosition();
- mRenderableActor.SetPosition( scrollOffset.x, alignmentOffset.y + scrollOffset.y );
+ mRenderableActor.SetPosition( scrollOffset.x, scrollOffset.y );
Actor clipRootActor;
if( mClipper )
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/text/rendering-backend.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/text/text-effects-style.h>
#include <dali-toolkit/internal/text/text-font-style.h>
#include <dali-toolkit/internal/text/text-view.h>
#include <dali-toolkit/internal/text/text-definitions.h>
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollSpeed", INTEGER, AUTO_SCROLL_SPEED )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollLoopCount", INTEGER, AUTO_SCROLL_LOOP_COUNT )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollGap", FLOAT, AUTO_SCROLL_GAP )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "lineSpacing", FLOAT, LINE_SPACING )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "underline", STRING, UNDERLINE )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "shadow", STRING, SHADOW )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "emboss", STRING, EMBOSS )
+ DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "outline", STRING, OUTLINE )
DALI_TYPE_REGISTRATION_END()
impl.mTextScroller->SetGap( value.Get<float>() );
break;
}
+ case Toolkit::TextLabel::Property::LINE_SPACING:
+ {
+ if( impl.mController )
+ {
+ const float lineSpacing = value.Get<float>();
+ impl.mController->SetDefaultLineSpacing( lineSpacing );
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextLabel::Property::UNDERLINE:
+ {
+ const bool update = SetUnderlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextLabel::Property::SHADOW:
+ {
+ const bool update = SetShadowProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextLabel::Property::EMBOSS:
+ {
+ const bool update = SetEmbossProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::TextLabel::Property::OUTLINE:
+ {
+ const bool update = SetOutlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ if( update )
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
}
}
}
value = impl.mTextScroller->GetGap();
}
break;
+ }
+ case Toolkit::TextLabel::Property::LINE_SPACING:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->GetDefaultLineSpacing();
+ }
+ break;
+ }
+ case Toolkit::TextLabel::Property::UNDERLINE:
+ {
+ GetUnderlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextLabel::Property::SHADOW:
+ {
+ GetShadowProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextLabel::Property::EMBOSS:
+ {
+ GetEmbossProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
+ }
+ case Toolkit::TextLabel::Property::OUTLINE:
+ {
+ GetOutlineProperties( impl.mController, value, Text::EffectStyle::DEFAULT );
+ break;
}
}
}
if( renderableActor )
{
- // TODO: Scroll and alignment needs to be refactored.
- const Vector2& alignmentOffset = mController->GetAlignmentOffset();
- renderableActor.SetPosition( 0.f, alignmentOffset.y );
+ const Vector2& scrollOffset = mController->GetScrollPosition();
+ renderableActor.SetPosition( scrollOffset.x, scrollOffset.y );
self.Add( renderableActor );
}
{
const Size& controlSize = mController->GetView().GetControlSize();
const Size offScreenSize = GetNaturalSize().GetVectorXY(); // As relayout of text may not be done at this point natural size is used to get size. Single line scrolling only.
- const Vector2& alignmentOffset = mController->GetAlignmentOffset();
+ const float alignmentOffset = mController->GetAutoScrollLineAlignment();
const Text::CharacterDirection direction = mController->GetAutoScrollDirection();
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::SetUpAutoScrolling alignmentOffset[%f,%f] offScreenSize[%f,%f] controlSize[%f,%f]\n",
- alignmentOffset.x, alignmentOffset.y, offScreenSize.x,offScreenSize.y , controlSize.x,controlSize.y);
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::SetUpAutoScrolling alignmentOffset[%f] offScreenSize[%f,%f] controlSize[%f,%f]\n",
+ alignmentOffset, offScreenSize.x,offScreenSize.y , controlSize.x,controlSize.y );
if ( !mTextScroller )
{
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::SetUpAutoScrolling Creating default TextScoller\n");
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::SetUpAutoScrolling Creating default TextScoller\n" );
// If speed, loopCount or gap not set via property system then will need to create a TextScroller with defaults
mTextScroller = Text::TextScroller::New( *this );
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/bidirectional-line-info-run.h>
+#include <dali-toolkit/internal/text/cursor-helper-functions.h>
#include <dali-toolkit/internal/text/glyph-metrics-helper.h>
#include <dali-toolkit/internal/text/layouts/layout-parameters.h>
const float MAX_FLOAT = std::numeric_limits<float>::max();
const bool RTL = true;
const float CURSOR_WIDTH = 1.f;
+ const float LINE_SPACING= 0.f;
} //namespace
mHorizontalAlignment( LayoutEngine::HORIZONTAL_ALIGN_BEGIN ),
mVerticalAlignment( LayoutEngine::VERTICAL_ALIGN_TOP ),
mCursorWidth( CURSOR_WIDTH ),
+ mDefaultLineSpacing( LINE_SPACING ),
mEllipsisEnabled( false )
{
}
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--GetLineLayoutForBox\n" );
}
- /**
- * @brief Calculates the vertical offset to add to the new laid-out glyphs.
- *
- * @pre @p lineIndex must be between 0 and the number of lines (both inclusive).
- *
- * @param[in] lines The previously laid-out lines.
- * @param[in] lineIndex Index to the line where the new laid-out lines are inserted.
- *
- * @return The vertical offset of the lines starting from the beginning to the line @p lineIndex.
- */
- float SetParagraphOffset( const Vector<LineRun>& lines,
- LineIndex lineIndex )
- {
- float offset = 0.f;
-
- for( Vector<LineRun>::ConstIterator it = lines.Begin(),
- endIt = lines.Begin() + lineIndex;
- it != endIt;
- ++it )
- {
- const LineRun& line = *it;
-
- offset += line.ascender + -line.descender;
- }
-
- return offset;
- }
-
void SetGlyphPositions( const GlyphInfo* const glyphsBuffer,
Length numberOfGlyphs,
Vector2* glyphPositionsBuffer )
linesBuffer = lines.Begin();
}
- float penY = SetParagraphOffset( lines,
- layoutParameters.startLineIndex );
+ float penY = CalculateLineOffset( lines,
+ layoutParameters.startLineIndex );
for( GlyphIndex index = layoutParameters.startGlyphIndex; index < lastGlyphPlusOne; )
{
LayoutEngine::HorizontalAlignment mHorizontalAlignment;
LayoutEngine::VerticalAlignment mVerticalAlignment;
float mCursorWidth;
+ float mDefaultLineSpacing;
IntrusivePtr<Metrics> mMetrics;
lines );
}
+ void LayoutEngine::SetDefaultLineSpacing( float lineSpacing )
+ {
+ mImpl->mDefaultLineSpacing = lineSpacing;
+ }
+
+ float LayoutEngine::GetDefaultLineSpacing() const
+ {
+ return mImpl->mDefaultLineSpacing;
+ }
+
} // namespace Text
} // namespace Toolkit
InputStyle mInputStyle; ///< The style to be set to the new inputed text.
- /**
- * 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.
-
State mState; ///< Selection mode, edit mode etc.
CharacterIndex mPrimaryCursorPosition; ///< Index into logical model for primary cursor.
}
};
+ struct UnderlineDefaults
+ {
+ std::string properties;
+ // TODO: complete with underline parameters.
+ };
+
+ struct ShadowDefaults
+ {
+ std::string properties;
+ // TODO: complete with shadow parameters.
+ };
+
+ struct EmbossDefaults
+ {
+ std::string properties;
+ // TODO: complete with emboss parameters.
+ };
+
+ struct OutlineDefaults
+ {
+ std::string properties;
+ // TODO: complete with outline parameters.
+ };
+
struct Controller::Impl
{
Impl( ControlInterface& controlInterface )
mLogicalModel(),
mVisualModel(),
mFontDefaults( NULL ),
+ mUnderlineDefaults( NULL ),
+ mShadowDefaults( NULL ),
+ mEmbossDefaults( NULL ),
+ mOutlineDefaults( NULL ),
mEventData( NULL ),
mFontClient(),
mClipboard(),
mLayoutEngine(),
mModifyEvents(),
mTextColor( Color::BLACK ),
- mAlignmentOffset(),
mTextUpdateInfo(),
mOperationsPending( NO_OPERATION ),
mMaximumNumberOfCharacters( 50u ),
~Impl()
{
delete mFontDefaults;
+ delete mUnderlineDefaults;
+ delete mShadowDefaults;
+ delete mEmbossDefaults;
+ delete mOutlineDefaults;
delete mEventData;
}
LogicalModelPtr mLogicalModel; ///< Pointer to the logical model.
VisualModelPtr mVisualModel; ///< Pointer to the visual model.
FontDefaults* mFontDefaults; ///< Avoid allocating this when the user does not specify a font.
+ UnderlineDefaults* mUnderlineDefaults; ///< Avoid allocating this when the user does not specify underline parameters.
+ ShadowDefaults* mShadowDefaults; ///< Avoid allocating this when the user does not specify shadow parameters.
+ EmbossDefaults* mEmbossDefaults; ///< Avoid allocating this when the user does not specify emboss parameters.
+ OutlineDefaults* mOutlineDefaults; ///< Avoid allocating this when the user does not specify outline parameters.
EventData* mEventData; ///< Avoid allocating everything for text input until EnableTextInput().
TextAbstraction::FontClient mFontClient; ///< Handle to the font client.
Clipboard mClipboard; ///< Handle to the system clipboard
LayoutEngine mLayoutEngine; ///< The layout engine.
Vector<ModifyEvent> mModifyEvents; ///< Temporary stores the text set until the next relayout.
Vector4 mTextColor; ///< The regular text color
- Vector2 mAlignmentOffset; ///< Vertical and horizontal offset of the whole text inside the control due to alignment.
+ /**
+ * 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.
TextUpdateInfo mTextUpdateInfo; ///< Info of the characters updated.
OperationsMask mOperationsPending; ///< Operations pending to be done to layout the text.
Length mMaximumNumberOfCharacters; ///< Maximum number of characters that can be inserted.
return mImpl->mAutoScrollDirectionRTL;
}
+float Controller::GetAutoScrollLineAlignment() const
+{
+ float offset = 0.f;
+
+ if( mImpl->mVisualModel &&
+ ( 0u != mImpl->mVisualModel->mLines.Count() ) )
+ {
+ offset = ( *mImpl->mVisualModel->mLines.Begin() ).alignmentOffset;
+ }
+
+ return offset;
+}
+
void Controller::SetText( const std::string& text )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::SetText\n" );
return mImpl->mVisualModel->GetShadowColor();
}
+ void Controller::SetDefaultShadowProperties( const std::string& shadowProperties )
+ {
+ if( NULL == mImpl->mShadowDefaults )
+ {
+ mImpl->mShadowDefaults = new ShadowDefaults();
+ }
+
+ mImpl->mShadowDefaults->properties = shadowProperties;
+ }
+
+ const std::string& Controller::GetDefaultShadowProperties() const
+ {
+ if( NULL != mImpl->mShadowDefaults )
+ {
+ return mImpl->mShadowDefaults->properties;
+ }
+
+ return EMPTY_STRING;
+ }
+
void Controller::SetUnderlineColor( const Vector4& color )
{
mImpl->mVisualModel->SetUnderlineColor( color );
return mImpl->mVisualModel->GetUnderlineHeight();
}
+ void Controller::SetDefaultUnderlineProperties( const std::string& underlineProperties )
+ {
+ if( NULL == mImpl->mUnderlineDefaults )
+ {
+ mImpl->mUnderlineDefaults = new UnderlineDefaults();
+ }
+
+ mImpl->mUnderlineDefaults->properties = underlineProperties;
+ }
+
+ const std::string& Controller::GetDefaultUnderlineProperties() const
+ {
+ if( NULL != mImpl->mUnderlineDefaults )
+ {
+ return mImpl->mUnderlineDefaults->properties;
+ }
+
+ return EMPTY_STRING;
+ }
+
+ void Controller::SetDefaultEmbossProperties( const std::string& embossProperties )
+ {
+ if( NULL == mImpl->mEmbossDefaults )
+ {
+ mImpl->mEmbossDefaults = new EmbossDefaults();
+ }
+
+ mImpl->mEmbossDefaults->properties = embossProperties;
+ }
+
+ const std::string& Controller::GetDefaultEmbossProperties() const
+ {
+ if( NULL != mImpl->mEmbossDefaults )
+ {
+ return mImpl->mEmbossDefaults->properties;
+ }
+
+ return EMPTY_STRING;
+ }
+
+ void Controller::SetDefaultOutlineProperties( const std::string& outlineProperties )
+ {
+ if( NULL == mImpl->mOutlineDefaults )
+ {
+ mImpl->mOutlineDefaults = new OutlineDefaults();
+ }
+
+ mImpl->mOutlineDefaults->properties = outlineProperties;
+ }
+
+ const std::string& Controller::GetDefaultOutlineProperties() const
+ {
+ if( NULL != mImpl->mOutlineDefaults )
+ {
+ return mImpl->mOutlineDefaults->properties;
+ }
+
+ return EMPTY_STRING;
+ }
+
+ void Controller::SetDefaultLineSpacing( float lineSpacing )
+ {
+ //TODO finish implementation
+ mImpl->mLayoutEngine.SetDefaultLineSpacing( lineSpacing );
+ }
+
+ float Controller::GetDefaultLineSpacing() const
+ {
+ return mImpl->mLayoutEngine.GetDefaultLineSpacing();
+ }
+
void Controller::SetInputColor( const Vector4& color )
{
if( NULL != mImpl->mEventData )
return GetDefaultPointSize();
}
+ void Controller::SetInputLineSpacing( float lineSpacing )
+ {
+ if( NULL != mImpl->mEventData )
+ {
+ mImpl->mEventData->mInputStyle.lineSpacing = lineSpacing;
+ }
+ }
+
+ float Controller::GetInputLineSpacing() const
+ {
+ if( NULL != mImpl->mEventData )
+ {
+ return mImpl->mEventData->mInputStyle.lineSpacing;
+ }
+
+ return 0.f;
+ }
+
+ void Controller::SetInputShadowProperties( const std::string& shadowProperties )
+ {
+ if( NULL != mImpl->mEventData )
+ {
+ mImpl->mEventData->mInputStyle.shadowProperties = shadowProperties;
+ }
+ }
+
+ const std::string& Controller::GetInputShadowProperties() const
+ {
+ if( NULL != mImpl->mEventData )
+ {
+ return mImpl->mEventData->mInputStyle.shadowProperties;
+ }
+
+ return GetDefaultShadowProperties();
+ }
+
+ void Controller::SetInputUnderlineProperties( const std::string& underlineProperties )
+ {
+ if( NULL != mImpl->mEventData )
+ {
+ mImpl->mEventData->mInputStyle.underlineProperties = underlineProperties;
+ }
+ }
+
+ const std::string& Controller::GetInputUnderlineProperties() const
+ {
+ if( NULL != mImpl->mEventData )
+ {
+ return mImpl->mEventData->mInputStyle.underlineProperties;
+ }
+
+ return GetDefaultUnderlineProperties();
+ }
+
+ void Controller::SetInputEmbossProperties( const std::string& embossProperties )
+ {
+ if( NULL != mImpl->mEventData )
+ {
+ mImpl->mEventData->mInputStyle.embossProperties = embossProperties;
+ }
+ }
+
+ const std::string& Controller::GetInputEmbossProperties() const
+ {
+ if( NULL != mImpl->mEventData )
+ {
+ return mImpl->mEventData->mInputStyle.embossProperties;
+ }
+
+ return GetDefaultEmbossProperties();
+ }
+
+ void Controller::SetInputOutlineProperties( const std::string& outlineProperties )
+ {
+ if( NULL != mImpl->mEventData )
+ {
+ mImpl->mEventData->mInputStyle.outlineProperties = outlineProperties;
+ }
+ }
+
+ const std::string& Controller::GetInputOutlineProperties() const
+ {
+ if( NULL != mImpl->mEventData )
+ {
+ return mImpl->mEventData->mInputStyle.outlineProperties;
+ }
+
+ return GetDefaultOutlineProperties();
+ }
+
void Controller::SetEnableCursorBlink( bool enable )
{
DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "TextInput disabled" );
const Vector2& Controller::GetScrollPosition() const
{
- if( NULL != mImpl->mEventData )
- {
- return mImpl->mEventData->mScrollPosition;
- }
-
- return Vector2::ZERO;
-}
-
-const Vector2& Controller::GetAlignmentOffset() const
-{
- return mImpl->mAlignmentOffset;
+ return mImpl->mScrollPosition;
}
Vector3 Controller::GetNaturalSize()
// Whether the text control is editable
const bool isEditable = NULL != mImpl->mEventData;
- // Keep the current offset and alignment as it will be used to update the decorator's positions (if the size changes).
+ // Keep the current offset as it will be used to update the decorator's positions (if the size changes).
Vector2 offset;
if( newSize && isEditable )
{
- offset = mImpl->mAlignmentOffset + mImpl->mEventData->mScrollPosition;
+ offset = mImpl->mScrollPosition;
}
- // After doing the text layout, the alignment offset to place the actor in the desired position can be calculated.
- CalculateTextAlignment( size );
+ if( !isEditable || !IsMultiLineEnabled() )
+ {
+ // After doing the text layout, the vertical offset to place the actor in the desired position can be calculated.
+ CalculateVerticalOffset( size );
+ }
if( isEditable )
{
mImpl->ClampHorizontalScroll( layoutSize );
// Update the decorator's positions is needed if there is a new size.
- mImpl->mEventData->mDecorator->UpdatePositions( mImpl->mAlignmentOffset + mImpl->mEventData->mScrollPosition - offset );
+ mImpl->mEventData->mDecorator->UpdatePositions( mImpl->mScrollPosition - offset );
}
// Move the cursor, grab handle etc.
if( NULL != mImpl->mEventData )
{
// Reset the scroll position.
- mImpl->mEventData->mScrollPosition = Vector2::ZERO;
+ mImpl->mScrollPosition = Vector2::ZERO;
mImpl->mEventData->mScrollAfterUpdatePosition = true;
}
}
return mImpl->mLayoutEngine.GetVerticalAlignment();
}
-void Controller::CalculateTextAlignment( const Size& controlSize )
+void Controller::CalculateVerticalOffset( const Size& controlSize )
{
Size layoutSize = mImpl->mVisualModel->GetLayoutSize();
layoutSize.height = mImpl->GetDefaultFontLineHeight();
}
- if( LayoutEngine::SINGLE_LINE_BOX == mImpl->mLayoutEngine.GetLayout() )
- {
- // Get the direction of the first character.
- const CharacterDirection firstParagraphDirection = mImpl->mLogicalModel->GetCharacterDirection( 0u );
-
- // If the first paragraph is right to left swap ALIGN_BEGIN and ALIGN_END;
- LayoutEngine::HorizontalAlignment horizontalAlignment = mImpl->mLayoutEngine.GetHorizontalAlignment();
- if( firstParagraphDirection )
- {
- switch( horizontalAlignment )
- {
- case LayoutEngine::HORIZONTAL_ALIGN_BEGIN:
- {
- horizontalAlignment = LayoutEngine::HORIZONTAL_ALIGN_END;
- break;
- }
- case LayoutEngine::HORIZONTAL_ALIGN_CENTER:
- {
- // Nothing to do.
- break;
- }
- case LayoutEngine::HORIZONTAL_ALIGN_END:
- {
- horizontalAlignment = LayoutEngine::HORIZONTAL_ALIGN_BEGIN;
- break;
- }
- }
- }
-
- switch( horizontalAlignment )
- {
- case LayoutEngine::HORIZONTAL_ALIGN_BEGIN:
- {
- mImpl->mAlignmentOffset.x = 0.f;
- break;
- }
- case LayoutEngine::HORIZONTAL_ALIGN_CENTER:
- {
- mImpl->mAlignmentOffset.x = floorf( 0.5f * ( controlSize.width - layoutSize.width ) ); // try to avoid pixel alignment.
- break;
- }
- case LayoutEngine::HORIZONTAL_ALIGN_END:
- {
- mImpl->mAlignmentOffset.x = controlSize.width - layoutSize.width;
- break;
- }
- }
- }
-
- const LayoutEngine::VerticalAlignment verticalAlignment = mImpl->mLayoutEngine.GetVerticalAlignment();
- switch( verticalAlignment )
+ switch( mImpl->mLayoutEngine.GetVerticalAlignment() )
{
case LayoutEngine::VERTICAL_ALIGN_TOP:
{
- mImpl->mAlignmentOffset.y = 0.f;
+ mImpl->mScrollPosition.y = 0.f;
break;
}
case LayoutEngine::VERTICAL_ALIGN_CENTER:
{
- mImpl->mAlignmentOffset.y = floorf( 0.5f * ( controlSize.height - layoutSize.height ) ); // try to avoid pixel alignment.
+ mImpl->mScrollPosition.y = floorf( 0.5f * ( controlSize.height - layoutSize.height ) ); // try to avoid pixel alignment.
break;
}
case LayoutEngine::VERTICAL_ALIGN_BOTTOM:
{
- mImpl->mAlignmentOffset.y = controlSize.height - layoutSize.height;
+ mImpl->mScrollPosition.y = controlSize.height - layoutSize.height;
break;
}
}
CharacterDirection GetAutoScrollDirection() const;
/**
+ * @brief Get the alignment offset of the first line of text.
+ *
+ * @return The alignment offset.
+ */
+ float GetAutoScrollLineAlignment() const;
+
+ /**
* @brief Replaces any text previously set.
*
* @note This will be converted into UTF-32 when stored in the text model.
const Vector4& GetShadowColor() const;
/**
+ * @brief Sets the shadow's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] shadowProperties The shadow's properties string.
+ */
+ void SetDefaultShadowProperties( const std::string& shadowProperties );
+
+ /**
+ * @brief Retrieves the shadow's properties string.
+ *
+ * @return The shadow's properties string.
+ */
+ const std::string& GetDefaultShadowProperties() const;
+
+ /**
* @brief Set the underline color.
*
* @param[in] color color of underline.
float GetUnderlineHeight() const;
/**
+ * @brief Sets the underline's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] underlineProperties The underline's properties string.
+ */
+ void SetDefaultUnderlineProperties( const std::string& underlineProperties );
+
+ /**
+ * @brief Retrieves the underline's properties string.
+ *
+ * @return The underline's properties string.
+ */
+ const std::string& GetDefaultUnderlineProperties() const;
+
+ /**
+ * @brief Sets the emboss's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] embossProperties The emboss's properties string.
+ */
+ void SetDefaultEmbossProperties( const std::string& embossProperties );
+
+ /**
+ * @brief Retrieves the emboss's properties string.
+ *
+ * @return The emboss's properties string.
+ */
+ const std::string& GetDefaultEmbossProperties() const;
+
+ /**
+ * @brief Sets the outline's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] outlineProperties The outline's properties string.
+ */
+ void SetDefaultOutlineProperties( const std::string& outlineProperties );
+
+ /**
+ * @brief Retrieves the outline's properties string.
+ *
+ * @return The outline's properties string.
+ */
+ const std::string& GetDefaultOutlineProperties() const;
+
+ /**
+ * @brief Sets the default line spacing.
+ *
+ * @param[in] lineSpacing The line spacing.
+ */
+ void SetDefaultLineSpacing( float lineSpacing );
+
+ /**
+ * @brief Retrieves the default line spacing.
+ *
+ * @return The line spacing.
+ */
+ float GetDefaultLineSpacing() const;
+
+ /**
* @brief Sets the input text's color.
*
* @param[in] color The input text's color.
float GetInputFontPointSize() const;
/**
+ * @brief Sets the input line spacing.
+ *
+ * @param[in] lineSpacing The line spacing.
+ */
+ void SetInputLineSpacing( float lineSpacing );
+
+ /**
+ * @brief Retrieves the input line spacing.
+ *
+ * @return The line spacing.
+ */
+ float GetInputLineSpacing() const;
+
+ /**
+ * @brief Sets the input shadow's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] shadowProperties The shadow's properties string.
+ */
+ void SetInputShadowProperties( const std::string& shadowProperties );
+
+ /**
+ * @brief Retrieves the input shadow's properties string.
+ *
+ * @return The shadow's properties string.
+ */
+ const std::string& GetInputShadowProperties() const;
+
+ /**
+ * @brief Sets the input underline's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] underlineProperties The underline's properties string.
+ */
+ void SetInputUnderlineProperties( const std::string& underlineProperties );
+
+ /**
+ * @brief Retrieves the input underline's properties string.
+ *
+ * @return The underline's properties string.
+ */
+ const std::string& GetInputUnderlineProperties() const;
+
+ /**
+ * @brief Sets the input emboss's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] embossProperties The emboss's properties string.
+ */
+ void SetInputEmbossProperties( const std::string& embossProperties );
+
+ /**
+ * @brief Retrieves the input emboss's properties string.
+ *
+ * @return The emboss's properties string.
+ */
+ const std::string& GetInputEmbossProperties() const;
+
+ /**
+ * @brief Sets input the outline's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] outlineProperties The outline's properties string.
+ */
+ void SetInputOutlineProperties( const std::string& outlineProperties );
+
+ /**
+ * @brief Retrieves the input outline's properties string.
+ *
+ * @return The outline's properties string.
+ */
+ const std::string& GetInputOutlineProperties() const;
+
+ /**
* @brief Called to enable/disable cursor blink.
*
* @note Only editable controls should calls this.
const Vector2& GetScrollPosition() const;
/**
- * @brief Query the alignment offset.
- *
- * @return The alignmnet offset.
- */
- const Vector2& GetAlignmentOffset() const;
-
- /**
* @copydoc Control::GetNaturalSize()
*/
Vector3 GetNaturalSize();
LayoutEngine::VerticalAlignment GetVerticalAlignment() const;
/**
- * @brief Calulates the alignment of the whole text inside the bounding box.
+ * @brief Calulates the vertical offset to align the text inside the bounding box.
*
* @param[in] size The size of the bounding box.
*/
- void CalculateTextAlignment( const Size& size );
+ void CalculateVerticalOffset( const Size& size );
/**
* @brief Return the layout engine.