X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller.cpp;h=dce67ff237535fda637b51c6fe298ec9ff732e55;hb=a88db82a75443d573185aea2938f1f0be141ca64;hp=b2b6550ddba0f3eaeffc1e95ec2872fa3fb0c380;hpb=85a9005b80fce7dedf0acc52cf73aa950905e3ec;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index b2b6550..dce67ff 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -19,6 +19,8 @@ #include // EXTERNAL INCLUDES +#include +#include #include #include #include @@ -134,6 +136,11 @@ bool Controller::IsMarkupProcessorEnabled() const return mImpl->mMarkupProcessorEnabled; } +bool Controller::HasAnchors() const +{ + return (mImpl->mMarkupProcessorEnabled && mImpl->mModel->mLogicalModel->mAnchors.Count() && mImpl->IsShowingRealText()); +} + void Controller::SetAutoScrollEnabled(bool enable) { DALI_LOG_INFO(gLogFilter, Debug::General, "Controller::SetAutoScrollEnabled[%s] SingleBox[%s]-> [%p]\n", (enable) ? "true" : "false", (mImpl->mLayoutEngine.GetLayout() == Layout::Engine::SINGLE_LINE_BOX) ? "true" : "false", this); @@ -382,14 +389,19 @@ void Controller::SetIgnoreSpacesAfterText(bool ignore) mImpl->mModel->mIgnoreSpacesAfterText = ignore; } -bool Controller::IsMatchSystemLanguageDirection() const +void Controller::ChangedLayoutDirection() { - return mImpl->mModel->mMatchSystemLanguageDirection; + mImpl->mIsLayoutDirectionChanged = true; } -void Controller::SetMatchSystemLanguageDirection(bool match) +void Controller::SetMatchLayoutDirection(DevelText::MatchLayoutDirection type) { - mImpl->mModel->mMatchSystemLanguageDirection = match; + mImpl->mModel->mMatchLayoutDirection = type; +} + +DevelText::MatchLayoutDirection Controller::GetMatchLayoutDirection() const +{ + return mImpl->mModel->mMatchLayoutDirection; } void Controller::SetLayoutDirection(Dali::LayoutDirection::Type layoutDirection) @@ -397,6 +409,19 @@ void Controller::SetLayoutDirection(Dali::LayoutDirection::Type layoutDirection) mImpl->mLayoutDirection = layoutDirection; } +Dali::LayoutDirection::Type Controller::GetLayoutDirection(Dali::Actor& actor) const +{ + if(mImpl->mModel->mMatchLayoutDirection == DevelText::MatchLayoutDirection::LOCALE || + (mImpl->mModel->mMatchLayoutDirection == DevelText::MatchLayoutDirection::INHERIT && !mImpl->mIsLayoutDirectionChanged)) + { + return static_cast(DevelWindow::Get(actor).GetRootLayer().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get()); + } + else + { + return static_cast(actor.GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get()); + } +} + bool Controller::IsShowingRealText() const { return mImpl->IsShowingRealText(); @@ -439,6 +464,7 @@ Text::LineWrap::Mode Controller::GetLineWrapMode() const void Controller::SetTextElideEnabled(bool enabled) { mImpl->mModel->mElideEnabled = enabled; + mImpl->mModel->mVisualModel->SetTextElideEnabled(enabled); } bool Controller::IsTextElideEnabled() const @@ -1699,6 +1725,17 @@ void Controller::SetVerticalLineAlignment(Toolkit::DevelText::VerticalLineAlignm mImpl->mModel->mVerticalLineAlignment = alignment; } +Toolkit::DevelText::EllipsisPosition::Type Controller::GetEllipsisPosition() const +{ + return mImpl->mModel->GetEllipsisPosition(); +} + +void Controller::SetEllipsisPosition(Toolkit::DevelText::EllipsisPosition::Type ellipsisPosition) +{ + mImpl->mModel->mEllipsisPosition = ellipsisPosition; + mImpl->mModel->mVisualModel->SetEllipsisPosition(ellipsisPosition); +} + // public : Relayout. Controller::UpdateTextType Controller::Relayout(const Size& size, Dali::LayoutDirection::Type layoutDirection) @@ -1785,6 +1822,11 @@ void Controller::SelectEvent(float x, float y, SelectionType selectType) EventHandler::SelectEvent(*this, x, y, selectType); } +void Controller::SelectEvent(const uint32_t start, const uint32_t end, SelectionType selectType) +{ + EventHandler::SelectEvent(*this, start, end, selectType); +} + void Controller::SetTextSelectionRange(const uint32_t* start, const uint32_t* end) { if(mImpl->mEventData) @@ -1808,7 +1850,7 @@ CharacterIndex Controller::GetPrimaryCursorPosition() const return mImpl->GetPrimaryCursorPosition(); } -bool Controller::SetPrimaryCursorPosition(CharacterIndex index) +bool Controller::SetPrimaryCursorPosition(CharacterIndex index, bool focused) { if(mImpl->mEventData) { @@ -1816,7 +1858,7 @@ bool Controller::SetPrimaryCursorPosition(CharacterIndex index) mImpl->mEventData->mIsLeftHandleSelected = true; mImpl->mEventData->mIsRightHandleSelected = true; mImpl->mEventData->mCheckScrollAmount = true; - if(mImpl->SetPrimaryCursorPosition(index)) + if(mImpl->SetPrimaryCursorPosition(index, focused) && focused) { KeyboardFocusGainEvent(); return true; @@ -1835,6 +1877,11 @@ void Controller::SelectNone() SelectEvent(0.f, 0.f, SelectionType::NONE); } +void Controller::SelectText(const uint32_t start, const uint32_t end) +{ + SelectEvent(start, end, SelectionType::RANGE); +} + string Controller::GetSelectedText() const { string text;