X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-controls%2Ftext-field-impl.cpp;h=f98093e01735fb106e4ab5b5b0711c651d6c0e9d;hp=1e87035196c6a40421d16baeaccbb96b3ce8369b;hb=646440beeb663fc5efcccadeba73dd46016ed1b3;hpb=78c9c036de63d8b56040e11dd91e9f5370091c57 diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index 1e87035..f98093e 100644 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -21,7 +21,6 @@ // EXTERNAL INCLUDES #include #include -#include #include #include #include @@ -36,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -697,7 +695,7 @@ void TextField::SetProperty(BaseObject* object, Property::Index index, const Pro } case Toolkit::DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION: { - impl.mController->SetMatchSystemLanguageDirection(value.Get()); + impl.mController->SetMatchLayoutDirection(value.Get() ? DevelText::MatchLayoutDirection::LOCALE : DevelText::MatchLayoutDirection::CONTENTS); break; } case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP: @@ -1082,7 +1080,7 @@ Property::Value TextField::GetProperty(BaseObject* object, Property::Index index } case Toolkit::DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION: { - value = impl.mController->IsMatchSystemLanguageDirection(); + value = impl.mController->GetMatchLayoutDirection() != DevelText::MatchLayoutDirection::CONTENTS; break; } case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP: @@ -1150,10 +1148,7 @@ void TextField::SelectWholeText() if(mController && mController->IsShowingRealText()) { mController->SelectWholeText(); - if(!Self().GetProperty(Actor::Property::KEYBOARD_FOCUSABLE) || !Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(Self())) - { - SetKeyInputFocus(); - } + SetKeyInputFocus(); } } @@ -1180,10 +1175,7 @@ void TextField::SetTextSelectionRange(const uint32_t* start, const uint32_t* end if(mController && mController->IsShowingRealText()) { mController->SetTextSelectionRange(start, end); - if(!Self().GetProperty(Actor::Property::KEYBOARD_FOCUSABLE) || !Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(Self())) - { - SetKeyInputFocus(); - } + SetKeyInputFocus(); } } @@ -1308,6 +1300,8 @@ void TextField::OnInitialize() Dali::LayoutDirection::Type layoutDirection = static_cast(stage.GetRootLayer().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get()); mController->SetLayoutDirection(layoutDirection); + self.LayoutDirectionChangedSignal().Connect(this, &TextField::OnLayoutDirectionChanged); + // Forward input events to controller EnableGestureDetection(static_cast(GestureType::TAP | GestureType::PAN | GestureType::LONG_PRESS)); GetTapGestureDetector().SetMaximumTapsRequired(2); @@ -1420,15 +1414,8 @@ void TextField::OnRelayout(const Vector2& size, RelayoutContainer& container) Vector2 contentSize(size.x - (padding.start + padding.end), size.y - (padding.top + padding.bottom)); // Support Right-To-Left of padding - Dali::LayoutDirection::Type layoutDirection; - if(mController->IsMatchSystemLanguageDirection()) - { - layoutDirection = static_cast(DevelWindow::Get(self).GetRootLayer().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get()); - } - else - { - layoutDirection = static_cast(self.GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get()); - } + Dali::LayoutDirection::Type layoutDirection = mController->GetLayoutDirection(self); + if(Dali::LayoutDirection::RIGHT_TO_LEFT == layoutDirection) { std::swap(padding.start, padding.end); @@ -1673,10 +1660,7 @@ void TextField::OnTap(const TapGesture& gesture) mController->TapEvent(gesture.GetNumberOfTaps(), localPoint.x - padding.start, localPoint.y - padding.top); mController->AnchorEvent(localPoint.x - padding.start, localPoint.y - padding.top); - if(!Self().GetProperty(Actor::Property::KEYBOARD_FOCUSABLE) || !Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(Self())) - { - SetKeyInputFocus(); - } + SetKeyInputFocus(); } void TextField::OnPan(const PanGesture& gesture) @@ -1695,10 +1679,7 @@ void TextField::OnLongPress(const LongPressGesture& gesture) const Vector2& localPoint = gesture.GetLocalPoint(); mController->LongPressEvent(gesture.GetState(), localPoint.x - padding.start, localPoint.y - padding.top); - if(!Self().GetProperty(Actor::Property::KEYBOARD_FOCUSABLE) || !Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(Self())) - { - SetKeyInputFocus(); - } + SetKeyInputFocus(); } bool TextField::OnKeyEvent(const KeyEvent& event) @@ -1969,6 +1950,11 @@ bool TextField::OnTouched(Actor actor, const TouchEvent& touch) return false; } +void TextField::OnLayoutDirectionChanged(Actor actor, LayoutDirection::Type type) +{ + mController->ChangedLayoutDirection(); +} + void TextField::OnIdleSignal() { // Emits the change of input style signals. @@ -2056,8 +2042,8 @@ bool TextField::AccessibleImpl::SetCursorOffset(size_t offset) Dali::Accessibility::Range TextField::AccessibleImpl::GetTextAtOffset( size_t offset, Dali::Accessibility::TextBoundary boundary) { - auto self = Toolkit::TextField::DownCast(Self()); - auto text = self.GetProperty(Toolkit::TextField::Property::TEXT).Get(); + auto self = Toolkit::TextField::DownCast(Self()); + auto text = self.GetProperty(Toolkit::TextField::Property::TEXT).Get(); auto textSize = text.size(); auto range = Dali::Accessibility::Range{}; @@ -2078,7 +2064,7 @@ Dali::Accessibility::Range TextField::AccessibleImpl::GetTextAtOffset( case Dali::Accessibility::TextBoundary::LINE: { auto textString = text.c_str(); - auto breaks = std::vector(textSize, 0); + auto breaks = std::vector(textSize, 0); if(boundary == Dali::Accessibility::TextBoundary::WORD) { @@ -2153,8 +2139,8 @@ Dali::Accessibility::Range TextField::AccessibleImpl::GetRangeOfSelection(size_t return {}; } - auto self = Toolkit::TextField::DownCast(Self()); - auto controller = Dali::Toolkit::GetImpl(self).GetTextController(); + auto self = Toolkit::TextField::DownCast(Self()); + auto controller = Dali::Toolkit::GetImpl(self).GetTextController(); std::string value{}; controller->RetrieveSelection(value); auto indices = controller->GetSelectionIndexes(); @@ -2253,7 +2239,7 @@ Dali::Accessibility::States TextField::AccessibleImpl::CalculateStates() bool TextField::AccessibleImpl::InsertText(size_t startPosition, std::string text) { - auto self = Toolkit::TextField::DownCast(Self()); + auto self = Toolkit::TextField::DownCast(Self()); auto insertedText = self.GetProperty(Toolkit::TextField::Property::TEXT).Get(); insertedText.insert(startPosition, text);