Merge "Add text selection popup style" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / controls / text-controls / text-anchor-impl.cpp
index 2fde91c..8abb0ae 100644 (file)
@@ -145,17 +145,21 @@ void TextAnchor::OnInitialize()
 {
   Actor self = Self();
 
-  // Enable highlightability
-  self.SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, true);
+  // Accessibility
+  self.SetProperty(DevelControl::Property::ACCESSIBILITY_ROLE, Dali::Accessibility::Role::LINK);
+  self.SetProperty(DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, true);
+}
 
-  DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
-    return std::unique_ptr<Dali::Accessibility::Accessible>(
-      new AccessibleImpl(actor, Dali::Accessibility::Role::LINK));
-  });
+DevelControl::ControlAccessible* TextAnchor::CreateAccessibleObject()
+{
+  return new TextAnchorAccessible(Self());
 }
 
 TextAnchor::TextAnchor()
-: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT))
+: Control(ControlBehaviour(CONTROL_BEHAVIOUR_DEFAULT)),
+  mStartCharacterIndex(0),
+  mEndCharacterIndex(0),
+  mUri()
 {
 }
 
@@ -163,35 +167,35 @@ TextAnchor::~TextAnchor()
 {
 }
 
-int32_t TextAnchor::AccessibleImpl::GetEndIndex() const
+int32_t TextAnchor::TextAnchorAccessible::GetEndIndex() const
 {
   auto self = Toolkit::TextAnchor::DownCast(Self());
   return self.GetProperty(Toolkit::TextAnchor::Property::END_CHARACTER_INDEX).Get<int>();
 }
 
-int32_t TextAnchor::AccessibleImpl::GetStartIndex() const
+int32_t TextAnchor::TextAnchorAccessible::GetStartIndex() const
 {
   auto self = Toolkit::TextAnchor::DownCast(Self());
   return self.GetProperty(Toolkit::TextAnchor::Property::START_CHARACTER_INDEX).Get<int>();
 }
 
-int32_t TextAnchor::AccessibleImpl::GetAnchorCount() const
+int32_t TextAnchor::TextAnchorAccessible::GetAnchorCount() const
 {
   return 1;
 }
 
-Dali::Accessibility::Accessible* TextAnchor::AccessibleImpl::GetAnchorAccessible(int32_t anchorIndex) const
+Dali::Accessibility::Accessible* TextAnchor::TextAnchorAccessible::GetAnchorAccessible(int32_t anchorIndex) const
 {
-  return Control::Impl::GetAccessibilityObject(Self());
+  return const_cast<TextAnchorAccessible*>(this);
 }
 
-std::string TextAnchor::AccessibleImpl::GetAnchorUri(int32_t anchorIndex) const
+std::string TextAnchor::TextAnchorAccessible::GetAnchorUri(int32_t anchorIndex) const
 {
   auto self = Toolkit::TextAnchor::DownCast(Self());
   return self.GetProperty(Toolkit::TextAnchor::Property::URI).Get<std::string>();
 }
 
-bool TextAnchor::AccessibleImpl::IsValid() const
+bool TextAnchor::TextAnchorAccessible::IsValid() const
 {
   return !GetAnchorUri(0).empty();
 }