#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
+#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
using namespace Dali;
using namespace Toolkit;
END_TEST;
}
+
+int UtcDaliToolkitTextlabelTextDirection(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelTextDirection");
+
+ TextLabel label = TextLabel::New();
+ label.SetProperty( TextLabel::Property::TEXT, "Hello world" );
+ label.SetProperty( TextLabel::Property::POINT_SIZE, 20 );
+ Stage::GetCurrent().Add( label );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT ), TEST_LOCATION );
+
+ label.SetProperty( TextLabel::Property::TEXT, "ﻡﺮﺤﺑﺍ ﺏﺎﻠﻋﺎﻠﻣ ﻡﺮﺤﺑﺍ" );
+ application.SendNotification();
+ application.Render();
+ DALI_TEST_EQUALS( label.GetProperty< int >( DevelTextLabel::Property::TEXT_DIRECTION ), static_cast< int >( Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT ), TEST_LOCATION );
+
+ END_TEST;
+}
--- /dev/null
+#ifndef DALI_TOOLKIT_TEXT_LABEL_DEVEL_H
+#define DALI_TOOLKIT_TEXT_LABEL_DEVEL_H
+
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace DevelTextLabel
+{
+
+namespace Property
+{
+ enum Type
+ {
+ RENDERING_BACKEND = Dali::Toolkit::TextLabel::Property::RENDERING_BACKEND,
+ TEXT = Dali::Toolkit::TextLabel::Property::TEXT,
+ FONT_FAMILY = Dali::Toolkit::TextLabel::Property::FONT_FAMILY,
+ FONT_STYLE = Dali::Toolkit::TextLabel::Property::FONT_STYLE,
+ POINT_SIZE = Dali::Toolkit::TextLabel::Property::POINT_SIZE,
+ MULTI_LINE = Dali::Toolkit::TextLabel::Property::MULTI_LINE,
+ HORIZONTAL_ALIGNMENT = Dali::Toolkit::TextLabel::Property::HORIZONTAL_ALIGNMENT,
+ VERTICAL_ALIGNMENT = Dali::Toolkit::TextLabel::Property::VERTICAL_ALIGNMENT,
+ UNUSED_PROPERTY_TEXT_COLOR = Dali::Toolkit::TextLabel::Property::UNUSED_PROPERTY_TEXT_COLOR,
+ SHADOW_OFFSET = Dali::Toolkit::TextLabel::Property::SHADOW_OFFSET,
+ SHADOW_COLOR = Dali::Toolkit::TextLabel::Property::SHADOW_COLOR,
+ UNDERLINE_ENABLED = Dali::Toolkit::TextLabel::Property::UNDERLINE_ENABLED,
+ UNDERLINE_COLOR = Dali::Toolkit::TextLabel::Property::UNDERLINE_COLOR,
+ UNDERLINE_HEIGHT = Dali::Toolkit::TextLabel::Property::UNDERLINE_HEIGHT,
+ ENABLE_MARKUP = Dali::Toolkit::TextLabel::Property::ENABLE_MARKUP,
+ ENABLE_AUTO_SCROLL = Dali::Toolkit::TextLabel::Property::ENABLE_AUTO_SCROLL,
+ AUTO_SCROLL_SPEED = Dali::Toolkit::TextLabel::Property::AUTO_SCROLL_SPEED,
+ AUTO_SCROLL_LOOP_COUNT = Dali::Toolkit::TextLabel::Property::AUTO_SCROLL_LOOP_COUNT,
+ AUTO_SCROLL_GAP = Dali::Toolkit::TextLabel::Property::AUTO_SCROLL_GAP,
+ LINE_SPACING = Dali::Toolkit::TextLabel::Property::LINE_SPACING,
+ UNDERLINE = Dali::Toolkit::TextLabel::Property::UNDERLINE,
+ SHADOW = Dali::Toolkit::TextLabel::Property::SHADOW,
+ EMBOSS = Dali::Toolkit::TextLabel::Property::EMBOSS,
+ OUTLINE = Dali::Toolkit::TextLabel::Property::OUTLINE,
+ PIXEL_SIZE = Dali::Toolkit::TextLabel::Property::PIXEL_SIZE,
+ ELLIPSIS = Dali::Toolkit::TextLabel::Property::ELLIPSIS,
+ AUTO_SCROLL_LOOP_DELAY = Dali::Toolkit::TextLabel::Property::AUTO_SCROLL_LOOP_DELAY,
+ AUTO_SCROLL_STOP_MODE = Dali::Toolkit::TextLabel::Property::AUTO_SCROLL_STOP_MODE,
+ LINE_COUNT = Dali::Toolkit::TextLabel::Property::LINE_COUNT,
+ LINE_WRAP_MODE = Dali::Toolkit::TextLabel::Property::LINE_WRAP_MODE,
+
+ /**
+ * @brief The direction of the layout.
+ * @details Name "textDirection", type Property::Integer, Read-Only.
+ * @see TextDirection::Type for supported values.
+ */
+ TEXT_DIRECTION,
+ };
+
+} // namespace Property
+
+} // namespace DevelTextLabel
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_LABEL_DEVEL_H
--- /dev/null
+#ifndef DALI_TOOLKIT_TEXT_ENUMERATIONS_DEVEL_H
+#define DALI_TOOLKIT_TEXT_ENUMERATIONS_DEVEL_H
+
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace DevelText
+{
+
+namespace TextDirection
+{
+
+enum Type
+{
+ LEFT_TO_RIGHT,
+ RIGHT_TO_LEFT
+};
+
+} // namespace TextDirection
+
+} // namespace DevelText
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif //DALI_TOOLKIT_TEXT_ENUMERATIONS_DEVEL_H
#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
+
using namespace Dali::Toolkit::Text;
namespace Dali
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "autoScrollStopMode", STRING, AUTO_SCROLL_STOP_MODE )
DALI_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextLabel, "lineCount", INTEGER, LINE_COUNT )
DALI_PROPERTY_REGISTRATION( Toolkit, TextLabel, "lineWrapMode", INTEGER, LINE_WRAP_MODE )
+DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextLabel, "textDirection", INTEGER, TEXT_DIRECTION )
DALI_ANIMATABLE_PROPERTY_REGISTRATION_WITH_DEFAULT( Toolkit, TextLabel, "textColor", Color::BLACK, TEXT_COLOR )
DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, TextLabel, "textColorRed", TEXT_COLOR_RED, TEXT_COLOR, 0 )
DALI_ANIMATABLE_PROPERTY_COMPONENT_REGISTRATION( Toolkit, TextLabel, "textColorGreen", TEXT_COLOR_GREEN, TEXT_COLOR, 1 )
}
break;
}
+ case Toolkit::DevelTextLabel::Property::TEXT_DIRECTION:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->GetTextDirection();
+ }
+ break;
+ }
}
}
}
}
+Toolkit::DevelText::TextDirection::Type Controller::GetTextDirection()
+{
+ const LineRun* const firstline = mImpl->mModel->mVisualModel->mLines.Begin();
+ if ( firstline && firstline->direction )
+ {
+ return Toolkit::DevelText::TextDirection::RIGHT_TO_LEFT;
+ }
+
+ return Toolkit::DevelText::TextDirection::LEFT_TO_RIGHT;
+}
+
// public : Relayout.
Controller::UpdateTextType Controller::Relayout( const Size& size )
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/text/text-enumerations.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-label-devel.h>
+#include <dali-toolkit/devel-api/text/text-enumerations-devel.h>
#include <dali-toolkit/internal/text/decorator/text-decorator.h>
#include <dali-toolkit/internal/text/layouts/layout-engine.h>
#include <dali-toolkit/internal/text/hidden-text.h>
*/
void GetPlaceholderProperty( Property::Map& map );
+ /**
+ * @brief Checks text direction.
+ * @return The text direction.
+ */
+ Toolkit::DevelText::TextDirection::Type GetTextDirection();
+
public: // Relayout.
/**