#include <dali.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/control-devel.h>
#include <dali/devel-api/adaptor-framework/accessibility.h>
#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
END_TEST;
}
+
+int utcDaliAccessibilityHidden(void)
+{
+ ToolkitTestApplication application;
+
+ auto control = Toolkit::Control::New();
+ auto* accessible = Dali::Accessibility::Accessible::Get(control);
+
+ // Check not hidden
+ DALI_TEST_CHECK(accessible);
+ DALI_TEST_CHECK(!accessible->IsHidden());
+ DALI_TEST_CHECK(!control.GetProperty<bool>(Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN));
+
+ control.SetProperty(Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN, true);
+
+ // Check hidden
+ DALI_TEST_CHECK(accessible->IsHidden());
+ DALI_TEST_CHECK(control.GetProperty<bool>(Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN));
+
+ END_TEST;
+}
child_1_accessible -> GetIndexInParent();
DALI_ABORT("Object has parent, test abort");
}
- catch (Dali::DaliException &){}
+ catch (const std::domain_error&){}
parent.Add(child_1);
parent.Add(child_2);
Wait(application);
- auto* accessibleParent = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(scrollView));
+ auto* accessibleParent = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(scrollView));
DALI_TEST_CHECK(accessibleParent);
- auto* accessibleA = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(actorA));
+ auto* accessibleA = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(actorA));
DALI_TEST_CHECK(accessibleA);
- auto* accessibleB = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(actorB));
+ auto* accessibleB = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(actorB));
DALI_TEST_CHECK(accessibleB);
accessibleA->GrabHighlight(); // == scrollView.ScrollTo(actorA)
Wait(application);
- auto* accessibleParent = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(view));
+ auto* accessibleParent = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(view));
DALI_TEST_CHECK(accessibleParent);
- auto* accessibleA = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(view.GetItem(0)));
+ auto* accessibleA = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(view.GetItem(0)));
DALI_TEST_CHECK(accessibleA);
- auto* accessibleB = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(view.GetItem(1)));
+ auto* accessibleB = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(view.GetItem(1)));
DALI_TEST_CHECK(accessibleB);
accessibleA->GrabHighlight(); // == view.ScrollToItem(view.GetItemId(actorA))
TextLabel label = TextLabel::New("123");
- auto* accessible = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(label));
+ auto* accessible = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(label));
DALI_TEST_CHECK(accessible);
DALI_TEST_EQUALS(accessible->IsScrollable(), false, TEST_LOCATION);
DALI_TEST_EQUALS(accessible->ScrollToChild({}), false, TEST_LOCATION);
- DALI_TEST_EQUALS(accessible->GetInternalActor(), Dali::Actor{}, TEST_LOCATION);
+ DALI_TEST_EQUALS(accessible->GetInternalActor(), label, TEST_LOCATION);
Dali::Accessibility::TestEnableSC( false );
END_TEST;
Wait(application);
// Set highlight to first child (A) to enable movement tracking
- auto* accessible = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(buttonA));
+ auto* accessible = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(buttonA));
DALI_TEST_CHECK(accessible);
accessible->GrabHighlight();
Wait(application);
Dali::Accessibility::TestResetMoveOutedCalled();
// Set highlight to second child (B) to enable movement tracking
- accessible = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(buttonB));
+ accessible = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(buttonB));
DALI_TEST_CHECK(accessible);
accessible->GrabHighlight();
Wait(application);
Dali::Accessibility::TestResetMoveOutedCalled();
// Disable movement tracking on B by giving highlight to A
- accessible = dynamic_cast<DevelControl::AccessibleImpl*>(Dali::Accessibility::Accessible::Get(buttonA));
+ accessible = dynamic_cast<DevelControl::ControlAccessible*>(Dali::Accessibility::Accessible::Get(buttonA));
DALI_TEST_CHECK(accessible);
accessible->GrabHighlight();
Wait(application);
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
END_TEST;
}
+
+int UtcDaliDebugRenderingGetVisual3(void)
+{
+ EnvironmentVariable::SetTestingEnvironmentVariable( true );
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliDebugRenderingGetVisual3: Request visual with various parameters" );
+
+ VisualFactory factory = VisualFactory::Get();
+ DALI_TEST_CHECK( factory );
+
+ // Test that image visual is replaced with debug visual
+ Dali::Property::Map map;
+ map[ Toolkit::Visual::Property::TYPE ] = Visual::IMAGE;
+ map[ ImageVisual::Property::URL ] = TEST_IMAGE_FILE_NAME;
+ Visual::Base imageVisual = factory.CreateVisual( map );
+ DALI_TEST_CHECK( imageVisual );
+ TestDebugVisual( application.GetScene(), imageVisual, Visual::IMAGE, Vector2(64.0f, 64.0f /* Broken Image Size */ ));
+
+ // Test that image visual with null string don't make visual
+ map.Clear();
+ map[ Toolkit::Visual::Property::TYPE ] = Visual::IMAGE;
+ map[ ImageVisual::Property::URL ] = "";
+ Visual::Base emptyVisual = factory.CreateVisual( map );
+ DALI_TEST_CHECK( emptyVisual );
+ TestDebugVisual( application.GetScene(), emptyVisual, Visual::WIREFRAME, Vector2::ZERO);
+
+ tet_infoline( "Check that GetVisualObject returns the actual WireframeVisual" );
+ Toolkit::Internal::Visual::Base& visualImpl = GetImplementation( emptyVisual ).GetVisualObject();
+ DALI_TEST_CHECK( dynamic_cast< Toolkit::Internal::WireframeVisual* >( &visualImpl ) );
+
+ tet_infoline( "Compare the returned emptyVisual with the visual implementation, should be the same" );
+ DALI_TEST_CHECK( emptyVisual.GetObjectPtr() == &visualImpl );
+
+ // Test that image view with empty property map don't make visual even DebugRendering is enabled.
+ map.Clear();
+ ImageView imageView = ImageView::New();
+ imageView.SetProperty(Control::Property::BACKGROUND, map);
+ imageView.SetProperty(ImageView::Property::IMAGE, map);
+
+ application.GetScene().Add(imageView);
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( imageView.GetRendererCount(), 0u, TEST_LOCATION );
+
+ EnvironmentVariable::SetTestingEnvironmentVariable(false);
+ END_TEST;
+}
+
+
int UtcDaliDebugRenderingGetVisualObject01(void)
{
EnvironmentVariable::SetTestingEnvironmentVariable( true );
tet_infoline( "Compare the returned TextVisual with the visual implementation, should differ" );
DALI_TEST_CHECK( textVisual.GetObjectPtr() != &visualImpl );
+ EnvironmentVariable::SetTestingEnvironmentVariable( false );
END_TEST;
}
}
END_TEST;
-}
+}
\ No newline at end of file
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
*
*/
-#include <iostream>
#include <stdlib.h>
+#include <iostream>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h>
#include <dali-toolkit/internal/controls/text-controls/text-editor-impl.h>
-#include <dali-toolkit/internal/text/text-controller.h>
+#include <dali-toolkit/internal/text/rendering/atlas/atlas-glyph-manager.h>
#include <dali-toolkit/internal/text/text-controller-impl.h>
+#include <dali-toolkit/internal/text/text-controller.h>
using namespace Dali;
using namespace Toolkit;
int UtcDaliTextEditorSelectText(void)
{
ToolkitTestApplication application;
- tet_infoline( "UtcDaliTextEditorSelectText" );
+ tet_infoline("UtcDaliTextEditorSelectText");
// Create a text editor
TextEditor textEditor = TextEditor::New();
- textEditor.SetProperty( Actor::Property::SIZE, Vector2( 400.f, 60.f ) );
- textEditor.SetProperty( TextEditor::Property::TEXT, "Hello World" );
+ textEditor.SetProperty(Actor::Property::SIZE, Vector2(400.f, 60.f));
+ textEditor.SetProperty(TextEditor::Property::TEXT, "Hello World");
// Add the text editor to the stage
- application.GetScene().Add( textEditor );
+ application.GetScene().Add(textEditor);
application.SendNotification();
application.Render();
- Toolkit::Internal::TextEditor& textEditorImpl = GetImpl( textEditor );
+ Toolkit::Internal::TextEditor& textEditorImpl = GetImpl(textEditor);
application.SendNotification();
application.Render();
application.Render();
std::string selectedText = textEditorImpl.GetSelectedText();
- DALI_TEST_CHECK( selectedText == "Hello World" );
+ DALI_TEST_CHECK(selectedText == "Hello World");
// Select None
textEditorImpl.SelectNone();
application.Render();
selectedText = textEditorImpl.GetSelectedText();
- DALI_TEST_CHECK( selectedText == "" );
+ DALI_TEST_CHECK(selectedText == "");
END_TEST;
}
TextEditor textEditor = TextEditor::New();
- application.GetScene().Add( textEditor );
+ application.GetScene().Add(textEditor);
- textEditor.SetProperty( TextEditor::Property::TEXT, "<u>ABC</u>EF<u>GH</u>" );
- textEditor.SetProperty( TextEditor ::Property::ENABLE_MARKUP, true );
+ textEditor.SetProperty(TextEditor::Property::TEXT, "<u>ABC</u>EF<u>GH</u>");
+ textEditor.SetProperty(TextEditor ::Property::ENABLE_MARKUP, true);
application.SendNotification();
application.Render();
uint32_t expectedNumberOfUnderlinedGlyphs = 5u;
- Toolkit::Internal::TextEditor& textEditorImpl = GetImpl( textEditor );
- const Text::Length numberOfUnderlineRuns = textEditorImpl.GetTextController()->GetTextModel()->GetNumberOfUnderlineRuns();
+ Toolkit::Internal::TextEditor& textEditorImpl = GetImpl(textEditor);
+ const Text::Length numberOfUnderlineRuns = textEditorImpl.GetTextController()->GetTextModel()->GetNumberOfUnderlineRuns();
- DALI_TEST_EQUALS( numberOfUnderlineRuns, expectedNumberOfUnderlinedGlyphs, TEST_LOCATION );
+ DALI_TEST_EQUALS(numberOfUnderlineRuns, expectedNumberOfUnderlinedGlyphs, TEST_LOCATION);
Vector<GlyphRun> underlineRuns;
underlineRuns.Resize(numberOfUnderlineRuns);
textEditorImpl.GetTextController()->GetTextModel()->GetUnderlineRuns(underlineRuns.Begin(), 0u, numberOfUnderlineRuns);
//ABC are underlined
- DALI_TEST_EQUALS( underlineRuns[0u].glyphIndex, 0u, TEST_LOCATION);
- DALI_TEST_EQUALS( underlineRuns[1u].glyphIndex, 1u, TEST_LOCATION);
- DALI_TEST_EQUALS( underlineRuns[2u].glyphIndex, 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(underlineRuns[0u].glyphIndex, 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(underlineRuns[1u].glyphIndex, 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(underlineRuns[2u].glyphIndex, 2u, TEST_LOCATION);
//GH are underlined
- DALI_TEST_EQUALS( underlineRuns[3u].glyphIndex, 5u, TEST_LOCATION);
- DALI_TEST_EQUALS( underlineRuns[4u].glyphIndex, 6u, TEST_LOCATION);
+ DALI_TEST_EQUALS(underlineRuns[3u].glyphIndex, 5u, TEST_LOCATION);
+ DALI_TEST_EQUALS(underlineRuns[4u].glyphIndex, 6u, TEST_LOCATION);
END_TEST;
}
// Create a text editor
TextEditor textEditor = TextEditor::New();
//Set size to avoid automatic eliding
- textEditor.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025));
+ textEditor.SetProperty(Actor::Property::SIZE, Vector2(1025, 1025));
//Set very large font-size using point-size
- textEditor.SetProperty( TextEditor::Property::POINT_SIZE, 1000);
+ textEditor.SetProperty(TextEditor::Property::POINT_SIZE, 1000);
//Specify font-family
- textEditor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
+ textEditor.SetProperty(TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
//Set text to check if appear or not
textEditor.SetProperty(TextEditor::Property::TEXT, "A");
- application.GetScene().Add( textEditor );
+ application.GetScene().Add(textEditor);
application.SendNotification();
application.Render();
//Check if Glyph is added to AtlasGlyphManger or not
int countAtlas = AtlasGlyphManager::Get().GetMetrics().mAtlasMetrics.mAtlasCount;
- DALI_TEST_EQUALS( countAtlas, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(countAtlas, 1, TEST_LOCATION);
END_TEST;
}
-
int UtcDaliTextEditorFontPointSizeLargerThanAtlasPlaceholderCase(void)
{
ToolkitTestApplication application;
//Set Map of placeholder: text, font-family and point-size
Property::Map placeholderMapSet;
- placeholderMapSet["text"] = "A";
+ placeholderMapSet["text"] = "A";
placeholderMapSet["fontFamily"] = "DejaVu Sans";
- placeholderMapSet["pixelSize"] = 1000.0f;
+ placeholderMapSet["pixelSize"] = 1000.0f;
// Create a text editor
TextEditor textEditor = TextEditor::New();
//Set size to avoid automatic eliding
- textEditor.SetProperty( Actor::Property::SIZE, Vector2(1025, 1025));
+ textEditor.SetProperty(Actor::Property::SIZE, Vector2(1025, 1025));
//Set placeholder
- textEditor.SetProperty( TextEditor::Property::PLACEHOLDER, placeholderMapSet) ;
+ textEditor.SetProperty(TextEditor::Property::PLACEHOLDER, placeholderMapSet);
- application.GetScene().Add( textEditor );
+ application.GetScene().Add(textEditor);
application.SendNotification();
application.Render();
//Check if Glyph is added to AtlasGlyphManger or not
int countAtlas = AtlasGlyphManager::Get().GetMetrics().mAtlasMetrics.mAtlasCount;
- DALI_TEST_EQUALS( countAtlas, 1, TEST_LOCATION );
+ DALI_TEST_EQUALS(countAtlas, 1, TEST_LOCATION);
END_TEST;
}
tet_infoline("UtcDaliTextEditorBackgroundTag\n");
TextEditor editor = TextEditor::New();
- DALI_TEST_CHECK( editor );
+ DALI_TEST_CHECK(editor);
- editor.SetProperty( TextEditor ::Property::ENABLE_MARKUP, true );
- editor.SetProperty( TextEditor::Property::TEXT, "H<background color='red'>e</background> Worl<background color='yellow'>d</background>" );
- application.GetScene().Add( editor );
+ editor.SetProperty(TextEditor ::Property::ENABLE_MARKUP, true);
+ editor.SetProperty(TextEditor::Property::TEXT, "H<background color='red'>e</background> Worl<background color='yellow'>d</background>");
+ application.GetScene().Add(editor);
application.SendNotification();
application.Render();
- Toolkit::Internal::TextEditor& editorImpl = GetImpl( editor );
- const ColorIndex* const backgroundColorIndicesBuffer = editorImpl.GetTextController()->GetTextModel()->GetBackgroundColorIndices();
+ Toolkit::Internal::TextEditor& editorImpl = GetImpl(editor);
+ const ColorIndex* const backgroundColorIndicesBuffer = editorImpl.GetTextController()->GetTextModel()->GetBackgroundColorIndices();
- DALI_TEST_CHECK( backgroundColorIndicesBuffer );
+ DALI_TEST_CHECK(backgroundColorIndicesBuffer);
//default color
- DALI_TEST_EQUALS( backgroundColorIndicesBuffer[0], 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(backgroundColorIndicesBuffer[0], 0u, TEST_LOCATION);
//red color
- DALI_TEST_EQUALS( backgroundColorIndicesBuffer[1], 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(backgroundColorIndicesBuffer[1], 1u, TEST_LOCATION);
//yellow color
- DALI_TEST_EQUALS( backgroundColorIndicesBuffer[7], 2u, TEST_LOCATION);
+ DALI_TEST_EQUALS(backgroundColorIndicesBuffer[7], 2u, TEST_LOCATION);
END_TEST;
}
tet_infoline("UtcDaliTextEditorTextWithSpan\n");
TextEditor editor = TextEditor::New();
- DALI_TEST_CHECK( editor );
+ DALI_TEST_CHECK(editor);
- editor.SetProperty( TextEditor ::Property::ENABLE_MARKUP, true );
- editor.SetProperty( TextEditor::Property::TEXT, "Hello Span" );
- application.GetScene().Add( editor );
+ editor.SetProperty(TextEditor ::Property::ENABLE_MARKUP, true);
+ editor.SetProperty(TextEditor::Property::TEXT, "Hello Span");
+ application.GetScene().Add(editor);
application.SendNotification();
application.Render();
Vector3 originalSize = editor.GetNaturalSize();
- editor.SetProperty( TextEditor::Property::TEXT, "H<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red'>ello</span> Span" );
+ editor.SetProperty(TextEditor::Property::TEXT, "H<span font-size='45' font-family='DejaVu Sans' font-width='condensed' font-slant='italic' text-color='red'>ello</span> Span");
application.SendNotification();
application.Render();
DALI_TEST_GREATER(spanSize.width, originalSize.width, TEST_LOCATION);
- Toolkit::Internal::TextEditor& editorImpl = GetImpl( editor );
- const ColorIndex* const colorIndicesBuffer1 = editorImpl.GetTextController()->GetTextModel()->GetColorIndices();
+ Toolkit::Internal::TextEditor& editorImpl = GetImpl(editor);
+ const ColorIndex* const colorIndicesBuffer1 = editorImpl.GetTextController()->GetTextModel()->GetColorIndices();
- DALI_TEST_CHECK( colorIndicesBuffer1 );
+ DALI_TEST_CHECK(colorIndicesBuffer1);
//default color
- DALI_TEST_EQUALS( colorIndicesBuffer1[0], 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(colorIndicesBuffer1[0], 0u, TEST_LOCATION);
//span color
- DALI_TEST_EQUALS( colorIndicesBuffer1[1], 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(colorIndicesBuffer1[1], 1u, TEST_LOCATION);
//default color
- DALI_TEST_EQUALS( colorIndicesBuffer1[6], 0u, TEST_LOCATION);
-
+ DALI_TEST_EQUALS(colorIndicesBuffer1[6], 0u, TEST_LOCATION);
- editor.SetProperty( TextEditor::Property::TEXT, "<span font-size='45'>H</span>ello <span text-color='red'>S</span>pan" );
+ editor.SetProperty(TextEditor::Property::TEXT, "<span font-size='45'>H</span>ello <span text-color='red'>S</span>pan");
application.SendNotification();
application.Render();
const ColorIndex* const colorIndicesBuffer2 = editorImpl.GetTextController()->GetTextModel()->GetColorIndices();
- DALI_TEST_CHECK( colorIndicesBuffer2 );
+ DALI_TEST_CHECK(colorIndicesBuffer2);
//default color
- DALI_TEST_EQUALS( colorIndicesBuffer2[0], 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(colorIndicesBuffer2[0], 0u, TEST_LOCATION);
//default color
- DALI_TEST_EQUALS( colorIndicesBuffer2[1], 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(colorIndicesBuffer2[1], 0u, TEST_LOCATION);
//span color
- DALI_TEST_EQUALS( colorIndicesBuffer2[6], 1u, TEST_LOCATION);
+ DALI_TEST_EQUALS(colorIndicesBuffer2[6], 1u, TEST_LOCATION);
//default color
- DALI_TEST_EQUALS( colorIndicesBuffer2[7], 0u, TEST_LOCATION);
+ DALI_TEST_EQUALS(colorIndicesBuffer2[7], 0u, TEST_LOCATION);
END_TEST;
}
application.SendNotification();
application.Render();
- Toolkit::Internal::TextEditor& editorImpl = GetImpl(editor);
- ControllerPtr controller = editorImpl.GetTextController();
- Controller::Impl& controllerImpl = Controller::Impl::GetImplementation(*controller.Get());
+ Toolkit::Internal::TextEditor& editorImpl = GetImpl(editor);
+ ControllerPtr controller = editorImpl.GetTextController();
+ Controller::Impl& controllerImpl = Controller::Impl::GetImplementation(*controller.Get());
// Default color is transparent
controllerImpl.mEditableControlInterface->GetControlBackgroundColor(backgroundColor);
END_TEST;
}
+
+int UtcDaliTextEditorTextPositionWithMinLineAndBigFont(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextEditorTextPositionWithMinLine ");
+
+ TextEditor textEditor = TextEditor::New();
+
+ textEditor.SetProperty(TextEditor::Property::TEXT, "<span font-size='45'>H</span>\ni");
+ textEditor.SetProperty(DevelTextEditor::Property::MIN_LINE_SIZE, 50);
+ textEditor.SetProperty(TextEditor ::Property::ENABLE_MARKUP, true);
+
+ application.GetScene().Add(textEditor);
+
+ application.SendNotification();
+ application.Render();
+
+ Toolkit::Internal::TextEditor& textEditorImpl = GetImpl(textEditor);
+ Text::ViewInterface& view = textEditorImpl.GetTextController()->GetView();
+
+ Length numberOfGlyphs = view.GetNumberOfGlyphs();
+
+ DALI_TEST_EQUALS(numberOfGlyphs, 3u, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+
+ Vector<GlyphInfo> glyphs;
+ glyphs.Resize(numberOfGlyphs);
+
+ Vector<Vector2> positions;
+ positions.Resize(numberOfGlyphs);
+
+ float alignmentOffset = 0u;
+ numberOfGlyphs = view.GetGlyphs(glyphs.Begin(),
+ positions.Begin(),
+ alignmentOffset,
+ 0u,
+ numberOfGlyphs);
+
+ DALI_TEST_EQUALS(positions[2].y, 165.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION);
+
+ END_TEST;
+}
\ No newline at end of file
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
DALI_TEST_CHECK( value.Get( map ) ); // Value should NOT be empty
DALI_TEST_CHECK( ! visual ); // Visual should be invalid
+ // Set a URL in property map again
+ propertyMap[ImageVisual::Property::URL] = gImage_34_RGBA;
+ imageView.SetProperty( ImageView::Property::IMAGE, propertyMap );
+
+ application.SendNotification();
+ application.Render( 16 );
+
+ value = imageView.GetProperty( imageView.GetPropertyIndex( "image" ) );
+ visual = DevelControl::GetVisual( controlImpl, ImageView::Property::IMAGE );
+
+ DALI_TEST_CHECK( ! value.Get( url ) ); // Value should be empty
+ DALI_TEST_CHECK( value.Get( map ) ); // Value should NOT be empty
+ DALI_TEST_CHECK( visual ); // Visual should be valid
+
+ // Set an empty property map
+ propertyMap.Clear();
+ imageView.SetProperty( ImageView::Property::IMAGE, propertyMap );
+
+ application.SendNotification();
+ application.Render( 16 );
+
+ value = imageView.GetProperty( imageView.GetPropertyIndex( "image" ) );
+ visual = DevelControl::GetVisual( controlImpl, ImageView::Property::IMAGE );
+
+ DALI_TEST_CHECK( ! value.Get( url ) ); // Value should be empty
+ DALI_TEST_CHECK( value.Get( map ) ); // Value should NOT be empty
+ DALI_TEST_CHECK( map.Empty() ); // But PropertyMap should be empty
+ DALI_TEST_CHECK( ! visual ); // Visual should be invalid
+
END_TEST;
}
END_TEST;
}
+int UtcDaliImageViewImageLoadFailure04(void)
+{
+ ToolkitTestApplication application;
+
+ ImageView imageView = ImageView::New("invalidUrl.png");
+ imageView.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
+ application.GetScene().Add( imageView );
+ application.SendNotification();
+ application.Render(16);
+
+ // loading started, this waits for the loader thread
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+
+ Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
+ DevelStyleManager::SetBrokenImageUrl(styleManager, DevelStyleManager::BrokenImageType::SMALL, TEST_BROKEN_IMAGE_S);
+ DevelStyleManager::SetBrokenImageUrl(styleManager, DevelStyleManager::BrokenImageType::NORMAL, "invalidBroken.png");
+ DevelStyleManager::SetBrokenImageUrl(styleManager, DevelStyleManager::BrokenImageType::LARGE, TEST_BROKEN_IMAGE_L);
+
+ ImageView imageView2 = ImageView::New("invalidUrl.png");
+ imageView2.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
+ application.GetScene().Add( imageView2 );
+
+ std::string brokenUrl;
+ brokenUrl = DevelStyleManager::GetBrokenImageUrl(styleManager, DevelStyleManager::BrokenImageType::SMALL);
+ DALI_TEST_EQUALS( TEST_BROKEN_IMAGE_S, brokenUrl, TEST_LOCATION);
+
+ brokenUrl = DevelStyleManager::GetBrokenImageUrl(styleManager, DevelStyleManager::BrokenImageType::LARGE);
+ DALI_TEST_EQUALS( TEST_BROKEN_IMAGE_L, brokenUrl, TEST_LOCATION);
+
+ application.SendNotification();
+ application.Render(16);
+
+ // loading started, this waits for the loader thread
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+
+ DevelStyleManager::SetBrokenImageUrl(styleManager, DevelStyleManager::BrokenImageType::NORMAL, "invalidBroken.9.png");
+
+ ImageView imageView3 = ImageView::New("invalidUrl.png");
+ imageView3.SetProperty( Actor::Property::SIZE, Vector2( 100.f, 100.f ) );
+ application.GetScene().Add( imageView3 );
+
+ application.SendNotification();
+ application.Render(16);
+
+ // loading started, this waits for the loader thread
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ END_TEST;
+}
+
+
namespace
{
const char* const PROPERTY_NAME_INPUT_EMBOSS = "inputEmboss";
const char* const PROPERTY_NAME_OUTLINE = "outline";
const char* const PROPERTY_NAME_INPUT_OUTLINE = "inputOutline";
+const char* const PROPERTY_NAME_STRIKETHROUGH = "strikethrough";
+const char* const PROPERTY_NAME_INPUT_STRIKETHROUGH = "inputStrikethrough";
const char* const PROPERTY_NAME_SMOOTH_SCROLL = "smoothScroll";
const char* const PROPERTY_NAME_SMOOTH_SCROLL_DURATION = "smoothScrollDuration";
const char* const PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION = "matchSystemLanguageDirection";
const char* const PROPERTY_NAME_MAX_LENGTH = "maxLength";
const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
+const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE = "enableFontSizeScale";
const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR = "grabHandleColor";
const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP = "enableGrabHandlePopup";
const char* const PROPERTY_NAME_INPUT_METHOD_SETTINGS = "inputMethodSettings";
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_EMBOSS ) == TextEditor::Property::INPUT_EMBOSS );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextEditor::Property::OUTLINE );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_OUTLINE ) == TextEditor::Property::INPUT_OUTLINE );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_STRIKETHROUGH ) == DevelTextEditor::Property::STRIKETHROUGH );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_STRIKETHROUGH ) == DevelTextEditor::Property::INPUT_STRIKETHROUGH );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SMOOTH_SCROLL ) == TextEditor::Property::SMOOTH_SCROLL );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SMOOTH_SCROLL_DURATION ) == TextEditor::Property::SMOOTH_SCROLL_DURATION );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_SCROLL_BAR ) == TextEditor::Property::ENABLE_SCROLL_BAR );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_SELECTION ) == TextEditor::Property::ENABLE_SELECTION );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER ) == TextEditor::Property::PLACEHOLDER );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextEditor::Property::FONT_SIZE_SCALE );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE ) == DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT ) == DevelTextEditor::Property::PLACEHOLDER_TEXT );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR ) == DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_SHIFT_SELECTION ) == DevelTextEditor::Property::ENABLE_SHIFT_SELECTION );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP ) == DevelTextEditor::Property::ENABLE_GRAB_HANDLE_POPUP );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_METHOD_SETTINGS ) == DevelTextEditor::Property::INPUT_METHOD_SETTINGS );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_FILTER ) == DevelTextEditor::Property::INPUT_FILTER );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_STRIKETHROUGH ) == DevelTextEditor::Property::STRIKETHROUGH );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_STRIKETHROUGH ) == DevelTextEditor::Property::INPUT_STRIKETHROUGH );
END_TEST;
}
DALI_TEST_EQUALS( editor.GetProperty<float>( DevelTextEditor::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
editor.SetProperty( DevelTextEditor::Property::FONT_SIZE_SCALE, 1.0f );
+ editor.SetProperty( DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, false );
+ DALI_TEST_EQUALS( editor.GetProperty<bool>( DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE ), false, TEST_LOCATION );
+ editor.SetProperty( DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE, true );
+
// Reset font style.
fontStyleMapSet.Clear();
fontStyleMapSet.Insert( "weight", "normal" );
inputFilterMapSet.Clear();
editor.SetProperty(DevelTextEditor::Property::INPUT_FILTER, inputFilterMapSet);
+ // Check the strikethrough property
+
+ Property::Map strikethroughMapSet;
+ Property::Map strikethroughMapGet;
+
+ application.SendNotification();
+ application.Render();
+
+ // Check the input strikethrough property
+
+ strikethroughMapSet.Clear();
+ strikethroughMapGet.Clear();
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::BLUE );
+ strikethroughMapSet.Insert( "height", 2.0f );
+
+ editor.SetProperty( DevelTextEditor::Property::STRIKETHROUGH, strikethroughMapSet );
+
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapGet = editor.GetProperty<Property::Map>( DevelTextEditor::Property::STRIKETHROUGH );
+
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapSet, strikethroughMapGet ), true, TEST_LOCATION );
+
+ // Check the input strikethrough property
+ editor.SetProperty( DevelTextEditor::Property::INPUT_STRIKETHROUGH, "Strikethrough input properties" );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( DevelTextEditor::Property::INPUT_STRIKETHROUGH ), std::string("Strikethrough input properties"), TEST_LOCATION );
+
application.SendNotification();
application.Render();
editor.SetProperty( TextEditor::Property::INPUT_SHADOW, "shadow" );
editor.SetProperty( TextEditor::Property::INPUT_EMBOSS, "emboss" );
editor.SetProperty( TextEditor::Property::INPUT_OUTLINE, "outline" );
+ editor.SetProperty( DevelTextEditor::Property::INPUT_STRIKETHROUGH, "strikethrough" );
application.ProcessEvent( GenerateKey( "a", "", "a", KEY_A_CODE, 0, 0, Integration::KeyEvent::DOWN, "a", DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
END_TEST;
}
+int utcDaliTextEditorStrikethroughPropertyStringP(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorStrikethroughPropertyStringP");
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK( editor );
+
+ std::string strikethroughSettings1( "{\"enable\":\"true\",\"color\":\"red\",\"height\":\"2\"}" );
+
+ application.GetScene().Add( editor );
+
+ editor.SetProperty( DevelTextEditor::Property::STRIKETHROUGH, strikethroughSettings1 );
+ DALI_TEST_EQUALS( editor.GetProperty<std::string>( DevelTextEditor::Property::STRIKETHROUGH ), strikethroughSettings1, TEST_LOCATION );
+
+ tet_infoline("Set strikethrough settings with a map");
+ // Check the input strikethrough property
+ Property::Map strikethroughMapSet;
+ Property::Map strikethroughMapGet;
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::BLUE );
+ strikethroughMapSet.Insert( "height", 2.0f );
+
+ editor.SetProperty( DevelTextEditor::Property::STRIKETHROUGH, strikethroughMapSet );
+ strikethroughMapGet = editor.GetProperty<Property::Map>( DevelTextEditor::Property::STRIKETHROUGH );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapSet, strikethroughMapGet ), true, TEST_LOCATION );
+
+ tet_infoline("Set strikethrough settings with a string");
+ editor.SetProperty( DevelTextEditor::Property::STRIKETHROUGH, strikethroughSettings1 );
+ Property::Value value = editor.GetProperty( DevelTextEditor::Property::STRIKETHROUGH );
+ std::string result;
+ value.Get(result);
+ DALI_TEST_EQUALS( result , strikethroughSettings1, TEST_LOCATION );
+
+ tet_infoline("Trying to set invalid strikethrough settings, should not update and stay at previous settings");
+ std::string strikethroughSettingsVoid( "{\"enable\":\"true\",\"coooolor\":\"blue\",\"height\":\"2\"}" );
+ editor.SetProperty( DevelTextEditor::Property::STRIKETHROUGH, strikethroughSettingsVoid );
+ value = editor.GetProperty( TextEditor::Property::UNDERLINE );
+ value.Get(result);
+ DALI_TEST_EQUALS( result , strikethroughSettings1, TEST_LOCATION );
+
+ END_TEST;
+}
+
int utcDaliTextEditorShadowPropertyStringP(void)
{
ToolkitTestApplication application;
END_TEST;
}
+int UtcDaliToolkitTextEditorStrikethroughGeneration(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextEditorStrikethroughGeneration");
+
+ TextEditor textEditor = TextEditor::New();
+ textEditor.SetProperty( TextEditor::Property::TEXT, "Test" );
+ textEditor.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 100.f ) );
+ textEditor.SetProperty( TextEditor::Property::POINT_SIZE, 10) ;
+ textEditor.SetProperty( TextEditor::Property::FONT_FAMILY, "DejaVu Sans");
+
+ application.GetScene().Add( textEditor );
+ application.SendNotification();
+ application.Render();
+
+ Property::Map strikethroughMapSet;
+ Property::Map strikethroughMapGet;
+
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::RED );
+ strikethroughMapSet.Insert( "height", 2.0f );
+
+ // Check the strikethrough property
+ textEditor.SetProperty( DevelTextEditor::Property::STRIKETHROUGH, strikethroughMapSet );
+ strikethroughMapGet = textEditor.GetProperty<Property::Map>( DevelTextEditor::Property::STRIKETHROUGH );
+ textEditor.SetProperty( TextEditor::Property::TEXT, "Test1" );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapSet.Clear();
+ strikethroughMapGet.Clear();
+
+ END_TEST;
+}
int utcDaliTextEditorInsertCharacterAfterInitWithResizePolicyNaturalSize(void)
{
application.Render();
END_TEST;
-}
\ No newline at end of file
+}
const char* const PROPERTY_NAME_INPUT_EMBOSS = "inputEmboss";
const char* const PROPERTY_NAME_OUTLINE = "outline";
const char* const PROPERTY_NAME_INPUT_OUTLINE = "inputOutline";
+const char* const PROPERTY_NAME_STRIKETHROUGH = "strikethrough";
+const char* const PROPERTY_NAME_INPUT_STRIKETHROUGH = "inputStrikethrough";
const char* const PROPERTY_NAME_HIDDEN_INPUT_SETTINGS = "hiddenInputSettings";
const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE_POPUP = "enableGrabHandlePopup";
const char* const PROPERTY_NAME_BACKGROUND = "textBackground";
const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
+const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE = "enableFontSizeScale";
const char* const PROPERTY_NAME_GRAB_HANDLE_COLOR = "grabHandleColor";
const char* const PROPERTY_NAME_INPUT_FILTER = "inputFilter";
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER ) == TextField::Property::PLACEHOLDER );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextField::Property::ELLIPSIS );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextField::Property::FONT_SIZE_SCALE );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE ) == DevelTextField::Property::ENABLE_FONT_SIZE_SCALE );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_SHIFT_SELECTION ) == DevelTextField::Property::ENABLE_SHIFT_SELECTION );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_GRAB_HANDLE ) == DevelTextField::Property::ENABLE_GRAB_HANDLE );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION ) == DevelTextField::Property::MATCH_SYSTEM_LANGUAGE_DIRECTION );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_BACKGROUND ) == DevelTextField::Property::BACKGROUND );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_GRAB_HANDLE_COLOR ) == DevelTextField::Property::GRAB_HANDLE_COLOR );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_FILTER ) == DevelTextField::Property::INPUT_FILTER );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_STRIKETHROUGH ) == DevelTextField::Property::STRIKETHROUGH );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_STRIKETHROUGH ) == DevelTextField::Property::INPUT_STRIKETHROUGH );
END_TEST;
}
DALI_TEST_EQUALS( field.GetProperty<float>( DevelTextField::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
field.SetProperty( DevelTextField::Property::FONT_SIZE_SCALE, 1.0f );
+ field.SetProperty( DevelTextField::Property::ENABLE_FONT_SIZE_SCALE, false );
+ DALI_TEST_EQUALS( field.GetProperty<bool>( DevelTextField::Property::ENABLE_FONT_SIZE_SCALE ), false, TEST_LOCATION );
+ field.SetProperty( DevelTextField::Property::ENABLE_FONT_SIZE_SCALE, true );
+
// Reset font style.
fontStyleMapSet.Clear();
fontStyleMapSet.Insert( "weight", "normal" );
DALI_TEST_EQUALS( fontStyleMapGet.Count(), fontStyleMapSet.Count(), TEST_LOCATION );
DALI_TEST_EQUALS( DaliTestCheckMaps( fontStyleMapGet, fontStyleMapSet ), true, TEST_LOCATION );
+ Property::Map strikethroughMapSet;
+ Property::Map strikethroughMapGet;
+
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::RED );
+ strikethroughMapSet.Insert( "height", 2.0f );
+
+ // Check the strikethrough property
+ field.SetProperty( DevelTextField::Property::STRIKETHROUGH, strikethroughMapSet );
+
+ strikethroughMapGet = field.GetProperty<Property::Map>( DevelTextField::Property::STRIKETHROUGH );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
+
+ // Check the input strikethrough property
+ field.SetProperty( DevelTextField::Property::INPUT_STRIKETHROUGH, "Strikethrough input properties" );
+ DALI_TEST_EQUALS( field.GetProperty<std::string>( DevelTextField::Property::INPUT_STRIKETHROUGH ), std::string("Strikethrough input properties"), TEST_LOCATION );
+
Property::Map underlineMapSet;
Property::Map underlineMapGet;
field.SetProperty( TextField::Property::INPUT_SHADOW, "shadow" );
field.SetProperty( TextField::Property::INPUT_EMBOSS, "emboss" );
field.SetProperty( TextField::Property::INPUT_OUTLINE, "outline" );
+ field.SetProperty( DevelTextField::Property::INPUT_STRIKETHROUGH, "strikethrough" );
// Render and notify
application.SendNotification();
DALI_TEST_EQUALS(oldSelectionEnd, 23, TEST_LOCATION);
END_TEST;
-}
\ No newline at end of file
+}
+
+int UtcDaliToolkitTextFieldStrikethroughGeneration(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldStrikethroughGeneration");
+
+ TextField textField = TextField::New();
+ textField.SetProperty( TextField::Property::TEXT, "Test" );
+ textField.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 100.f ) );
+ textField.SetProperty( TextField::Property::POINT_SIZE, 10) ;
+ textField.SetProperty( TextField::Property::FONT_FAMILY, "DejaVu Sans");
+
+ application.GetScene().Add( textField );
+ application.SendNotification();
+ application.Render();
+
+ Property::Map strikethroughMapSet;
+ Property::Map strikethroughMapGet;
+
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::RED );
+ strikethroughMapSet.Insert( "height", 2.0f );
+
+ // Check the strikethrough property
+ textField.SetProperty( DevelTextField::Property::STRIKETHROUGH, strikethroughMapSet );
+ strikethroughMapGet = textField.GetProperty<Property::Map>( DevelTextField::Property::STRIKETHROUGH );
+ textField.SetProperty( TextField::Property::TEXT, "Test1" );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapSet.Clear();
+ strikethroughMapGet.Clear();
+
+ END_TEST;
+}
+
+int UtcDaliToolkitTextFieldInputStrikethroughGeneration(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextFieldInputStrikethroughGeneration");
+
+ TextField textField = TextField::New();
+ textField.SetProperty( TextField::Property::TEXT, "Test" );
+ textField.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 100.f ) );
+ textField.SetProperty( TextField::Property::POINT_SIZE, 10) ;
+ textField.SetProperty( TextField::Property::FONT_FAMILY, "DejaVu Sans");
+
+ application.GetScene().Add( textField );
+ application.SendNotification();
+ application.Render();
+
+ std::string strikethroughSettings1( "{\"enable\":\"true\",\"color\":\"red\",\"height\":\"2\"}" );
+
+ // Check the strikethrough property
+ textField.SetProperty( DevelTextField::Property::INPUT_STRIKETHROUGH, strikethroughSettings1 );
+ textField.SetProperty( TextField::Property::TEXT, "Test1" );
+ DALI_TEST_EQUALS( textField.GetProperty<std::string>( DevelTextField::Property::INPUT_STRIKETHROUGH ), strikethroughSettings1, TEST_LOCATION );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ END_TEST;
+}
const char* const PROPERTY_NAME_EMBOSS = "emboss";
const char* const PROPERTY_NAME_OUTLINE = "outline";
const char* const PROPERTY_NAME_BACKGROUND = "textBackground";
+const char* const PROPERTY_NAME_STRIKETHROUGH = "strikethrough";
const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
const char* const PROPERTY_NAME_ELLIPSIS = "ellipsis";
const char* const PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY = "autoScrollLoopDelay";
const char* const PROPERTY_NAME_FONT_SIZE_SCALE = "fontSizeScale";
+const char* const PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE = "enableFontSizeScale";
const char* const PROPERTY_NAME_ELLIPSIS_POSITION = "ellipsisPosition";
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextLabel::Property::ELLIPSIS );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY ) == TextLabel::Property::AUTO_SCROLL_LOOP_DELAY );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_FONT_SIZE_SCALE ) == DevelTextLabel::Property::FONT_SIZE_SCALE );
+ DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ENABLE_FONT_SIZE_SCALE ) == DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE );
DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS_POSITION ) == DevelTextLabel::Property::ELLIPSIS_POSITION );
+ DALI_TEST_CHECK( label.GetPropertyIndex( PROPERTY_NAME_STRIKETHROUGH ) == DevelTextLabel::Property::STRIKETHROUGH );
END_TEST;
}
DALI_TEST_EQUALS( label.GetProperty<float>( DevelTextLabel::Property::FONT_SIZE_SCALE ), 2.5f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
label.SetProperty( DevelTextLabel::Property::FONT_SIZE_SCALE, 1.0f );
+ label.SetProperty( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE, false );
+ DALI_TEST_EQUALS( label.GetProperty<bool>( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE ), false, TEST_LOCATION );
+ label.SetProperty( DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE, true );
+
// Reset font style.
fontStyleMapSet.Clear();
fontStyleMapSet.Insert( "weight", "normal" );
label.SetProperty( TextLabel::Property::TEXT_COLOR, Color::BLUE );
DALI_TEST_EQUALS( label.GetProperty<Vector4>( TextLabel::Property::TEXT_COLOR ), Color::BLUE, TEST_LOCATION );
+ Property::Map strikethroughMapSet;
+ Property::Map strikethroughMapGet;
+
+ strikethroughMapSet.Insert( "enable", false );
+ strikethroughMapSet.Insert( "color", Color::BLUE );
+ strikethroughMapSet.Insert( "height", 2.0f );
+
+ label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
+
+ strikethroughMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
+
Property::Map underlineMapSet;
Property::Map underlineMapGet;
label.SetProperty( TextLabel::Property::LINE_SPACING, 10.f );
DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::LINE_SPACING ), 10.0f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ // Check the strikethrough property
+ strikethroughMapSet.Clear();
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::RED );
+ strikethroughMapSet.Insert( "height", 2.0f );
+
+ label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
+
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
+
+ strikethroughMapSet.Clear();
+ strikethroughMapSet.Insert( Toolkit::DevelText::Strikethrough::Property::ENABLE, true );
+ strikethroughMapSet.Insert( Toolkit::DevelText::Strikethrough::Property::COLOR, Color::RED );
+ strikethroughMapSet.Insert( Toolkit::DevelText::Strikethrough::Property::HEIGHT, 2.0f );
+
+ label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
+
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ std::vector<std::string> strikethroughIndicesConversionTable = { "enable", "color","height"};
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet, strikethroughIndicesConversionTable ), true, TEST_LOCATION );
+
+ strikethroughMapSet.Clear();
+
+ Property::Map strikethroughDisabledMapGet;
+ strikethroughDisabledMapGet.Insert( "enable", false );
+ strikethroughDisabledMapGet.Insert( "color", Color::RED );
+ strikethroughDisabledMapGet.Insert( "height", 2.0f );
+
+ label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
+
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapGet = label.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughDisabledMapGet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughDisabledMapGet ), true, TEST_LOCATION );
+
// Check the underline property
underlineMapSet.Clear();
underlineMapSet.Insert( "enable", true );
shadowMap.Insert( "offset", Vector2( 1.0f, 1.0f ) );
label.SetProperty( TextLabel::Property::SHADOW, shadowMap );
+ Property::Map strikethroughMap;
+ strikethroughMap.Insert( "enable", true );
+ strikethroughMap.Insert( "color", Color::GREEN );
+ strikethroughMap.Insert( "height", 2.0f );
+ label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMap );
+
try
{
// Render some text with the shared atlas backend
label.SetProperty( TextLabel::Property::UNDERLINE, underlineMapSet );
label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
+ Property::Map strikethroughMapSet;
+ strikethroughMapSet.Clear();
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::RED );
+ strikethroughMapSet.Insert( "height", 2.0f );
+ label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
+ label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
+
application.GetScene().Add( label );
application.SendNotification();
END_TEST;
}
+int UtcDaliToolkitTextlabelStrikethroughExceedsWidthAndHeight(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextlabelStrikethroughExceedsWidthAndHeight");
+
+ TextLabel label = TextLabel::New();
+ label.SetProperty( TextLabel::Property::TEXT, "Test" );
+ label.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
+
+ //Exeeding BufferWidth
+ label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 400.0f));
+ label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::RIGHT);
+ label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f);
+
+ application.GetScene().Add( label );
+ application.SendNotification();
+ application.Render();
+
+ Property::Map strikethroughMapSet;
+ strikethroughMapSet.Clear();
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::BLUE);
+ strikethroughMapSet.Insert( "height", 2.0f);
+ label.SetProperty( TextLabel::Property::TEXT, "Test1" );
+ label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
+ label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
+ application.GetScene().Add( label );
+ application.SendNotification();
+ application.Render();
+ // Check if the number of renderers is 1.
+ DALI_TEST_EQUALS( 1, label.GetRendererCount(), TEST_LOCATION);
+
+
+ label = TextLabel::New();
+ label.SetProperty( TextLabel::Property::TEXT, "Test" );
+ label.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
+
+ //Exeeding BufferHeight
+ label.SetProperty(Actor::Property::SIZE, Vector2(200.f, 100.0f));
+ label.SetProperty(TextLabel::Property::HORIZONTAL_ALIGNMENT, HorizontalAlignment::RIGHT);
+ label.SetProperty(TextLabel::Property::POINT_SIZE, 200.f);
+
+ application.GetScene().Add( label );
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapSet.Clear();
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::BLUE);
+ strikethroughMapSet.Insert( "height", 2.0f);
+ label.SetProperty( TextLabel::Property::TEXT, "Test2" );
+ label.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
+ label.SetProperty( Toolkit::TextLabel::Property::TEXT_COLOR, Color::BLUE );
+ application.GetScene().Add( label );
+ application.SendNotification();
+ application.Render();
+ // Check if the number of renderers is 1.
+ DALI_TEST_EQUALS( 1, label.GetRendererCount(), TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliToolkitTextlabelLastCharacterIndex(void)
{
ToolkitTestApplication application;
END_TEST;
}
-
int utcDaliTextLabelGetHeightForWidthChangeLineCountWhenTextChanged(void)
{
ToolkitTestApplication application;
END_TEST;
}
+
+int UtcDaliToolkitTextLabelStrikethroughGeneration(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliToolkitTextLabelStrikethroughGeneration");
+
+ TextLabel textLabel = TextLabel::New();
+ textLabel.SetProperty( TextLabel::Property::TEXT, "Test" );
+ textLabel.SetProperty( Actor::Property::SIZE, Vector2( 200.0f, 100.f ) );
+ textLabel.SetProperty( TextLabel::Property::POINT_SIZE, 10) ;
+ textLabel.SetProperty( TextLabel::Property::FONT_FAMILY, "DejaVu Sans");
+
+ application.GetScene().Add( textLabel );
+ application.SendNotification();
+ application.Render();
+
+ Property::Map strikethroughMapSet;
+ Property::Map strikethroughMapGet;
+
+ strikethroughMapSet.Insert( "enable", true );
+ strikethroughMapSet.Insert( "color", Color::RED );
+ strikethroughMapSet.Insert( "height", 2.0f );
+
+ // Check the strikethrough property
+ textLabel.SetProperty( DevelTextLabel::Property::STRIKETHROUGH, strikethroughMapSet );
+ strikethroughMapGet = textLabel.GetProperty<Property::Map>( DevelTextLabel::Property::STRIKETHROUGH );
+ textLabel.SetProperty( TextLabel::Property::TEXT, "Test1" );
+ DALI_TEST_EQUALS( strikethroughMapGet.Count(), strikethroughMapSet.Count(), TEST_LOCATION );
+ DALI_TEST_EQUALS( DaliTestCheckMaps( strikethroughMapGet, strikethroughMapSet ), true, TEST_LOCATION );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ strikethroughMapSet.Clear();
+ strikethroughMapGet.Clear();
+
+ END_TEST;
+}
\ No newline at end of file
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == WrapMode::MIRRORED_REPEAT);
- value = resultMap.Find( "synchronousLoading", Property::BOOLEAN );
+ value = resultMap.Find( ImageVisual::Property::SYNCHRONOUS_LOADING, Property::BOOLEAN );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<bool>() == true );
*/
// CLASS HEADER
-#include "accessible-impl.h"
+#include "control-accessible.h"
// EXTERNAL INCLUDES
#ifdef DGETTEXT_ENABLED
}
} // unnamed namespace
-AccessibleImpl::AccessibleImpl(Dali::Actor self, Dali::Accessibility::Role role, bool modal)
-: mSelf(self),
+ControlAccessible::ControlAccessible(Dali::Actor self, Dali::Accessibility::Role role, bool modal)
+: ActorAccessible(self),
mIsModal(modal)
{
auto control = Dali::Toolkit::Control::DownCast(Self());
});
}
-std::string AccessibleImpl::GetName()
+std::string ControlAccessible::GetName() const
{
auto control = Dali::Toolkit::Control::DownCast(Self());
return GetLocaleText(name);
}
-std::string AccessibleImpl::GetNameRaw()
+std::string ControlAccessible::GetNameRaw() const
{
return {};
}
-std::string AccessibleImpl::GetDescription()
+std::string ControlAccessible::GetDescription() const
{
auto control = Dali::Toolkit::Control::DownCast(Self());
return GetLocaleText(description);
}
-std::string AccessibleImpl::GetDescriptionRaw()
+std::string ControlAccessible::GetDescriptionRaw() const
{
return {};
}
-Dali::Accessibility::Accessible* AccessibleImpl::GetParent()
-{
- return Dali::Accessibility::Accessible::Get(Self().GetParent());
-}
-
-size_t AccessibleImpl::GetChildCount()
-{
- return Self().GetChildCount();
-}
-
-Dali::Accessibility::Accessible* AccessibleImpl::GetChildAtIndex(size_t index)
-{
- return Dali::Accessibility::Accessible::Get(Self().GetChildAt(static_cast<unsigned int>(index)));
-}
-
-size_t AccessibleImpl::GetIndexInParent()
-{
- auto self = Self();
- auto parent = self.GetParent();
- DALI_ASSERT_ALWAYS(parent && "can't call GetIndexInParent on object without parent");
-
- auto count = parent.GetChildCount();
- for(auto i = 0u; i < count; ++i)
- {
- auto child = parent.GetChildAt(i);
- if(child == self)
- {
- return i;
- }
- }
- DALI_ASSERT_ALWAYS(false && "object isn't child of it's parent");
- return static_cast<size_t>(-1);
-}
-
-Dali::Accessibility::Role AccessibleImpl::GetRole()
+Dali::Accessibility::Role ControlAccessible::GetRole() const
{
return Self().GetProperty<Dali::Accessibility::Role>(Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE);
}
-std::string AccessibleImpl::GetLocalizedRoleName()
+std::string ControlAccessible::GetLocalizedRoleName() const
{
return GetLocaleText(GetRoleName());
}
-bool AccessibleImpl::IsShowing()
+bool ControlAccessible::IsShowing()
{
Dali::Actor self = Self();
if(!self.GetProperty<bool>(Actor::Property::VISIBLE) || self.GetProperty<Vector4>(Actor::Property::WORLD_COLOR).a == 0 || self.GetProperty<bool>(Dali::DevelActor::Property::CULLED))
}
auto* child = this;
- auto* parent = dynamic_cast<Toolkit::DevelControl::AccessibleImpl*>(child->GetParent());
+ auto* parent = dynamic_cast<Toolkit::DevelControl::ControlAccessible*>(child->GetParent());
if(!parent)
{
return true;
{
return false;
}
- parent = dynamic_cast<Toolkit::DevelControl::AccessibleImpl*>(parent->GetParent());
+ parent = dynamic_cast<Toolkit::DevelControl::ControlAccessible*>(parent->GetParent());
}
return true;
}
-Dali::Accessibility::States AccessibleImpl::CalculateStates()
+Dali::Accessibility::States ControlAccessible::CalculateStates()
{
Dali::Actor self = Self();
Dali::Accessibility::States state;
return state;
}
-Dali::Accessibility::States AccessibleImpl::GetStates()
+Dali::Accessibility::States ControlAccessible::GetStates()
{
return CalculateStates();
}
-Dali::Accessibility::Attributes AccessibleImpl::GetAttributes()
+Dali::Accessibility::Attributes ControlAccessible::GetAttributes() const
{
std::unordered_map<std::string, std::string> attributeMap;
auto control = Dali::Toolkit::Control::DownCast(Self());
return attributeMap;
}
-Dali::Accessibility::ComponentLayer AccessibleImpl::GetLayer()
-{
- return Dali::Accessibility::ComponentLayer::WINDOW;
-}
-
-Dali::Rect<> AccessibleImpl::GetExtents(Dali::Accessibility::CoordinateType type)
+bool ControlAccessible::IsHidden() const
{
- Dali::Actor self = Self();
-
- Vector2 screenPosition = self.GetProperty(Dali::DevelActor::Property::SCREEN_POSITION).Get<Vector2>();
- auto size = self.GetCurrentProperty<Vector3>(Actor::Property::SIZE) * self.GetCurrentProperty<Vector3>(Actor::Property::WORLD_SCALE);
- bool positionUsesAnchorPoint = self.GetProperty(Dali::DevelActor::Property::POSITION_USES_ANCHOR_POINT).Get<bool>();
- Vector3 anchorPointOffSet = size * (positionUsesAnchorPoint ? self.GetCurrentProperty<Vector3>(Actor::Property::ANCHOR_POINT) : AnchorPoint::TOP_LEFT);
- Vector2 position = Vector2((screenPosition.x - anchorPointOffSet.x), (screenPosition.y - anchorPointOffSet.y));
+ auto control = Dali::Toolkit::Control::DownCast(Self());
- if(type == Dali::Accessibility::CoordinateType::WINDOW)
- {
- return {position.x, position.y, size.x, size.y};
- }
- else // Dali::Accessibility::CoordinateType::SCREEN
- {
- auto window = Dali::DevelWindow::Get(self);
- auto windowPosition = window.GetPosition();
- return {position.x + windowPosition.GetX(), position.y + windowPosition.GetY(), size.x, size.y};
- }
-}
+ Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
+ Internal::Control::Impl& controlImpl = Internal::Control::Impl::Get(internalControl);
-int16_t AccessibleImpl::GetMdiZOrder()
-{
- return 0;
-}
-double AccessibleImpl::GetAlpha()
-{
- return 0;
+ return controlImpl.mAccessibilityHidden;
}
-bool AccessibleImpl::GrabFocus()
+bool ControlAccessible::GrabFocus()
{
return Toolkit::KeyboardFocusManager::Get().SetCurrentFocusActor(Self());
}
-void AccessibleImpl::ScrollToSelf()
+void ControlAccessible::ScrollToSelf()
{
auto* child = this;
- auto* parent = dynamic_cast<Toolkit::DevelControl::AccessibleImpl*>(child->GetParent());
+ auto* parent = dynamic_cast<Toolkit::DevelControl::ControlAccessible*>(child->GetParent());
while (parent)
{
parent->ScrollToChild(child->Self());
}
- parent = dynamic_cast<Toolkit::DevelControl::AccessibleImpl*>(parent->GetParent());
+ parent = dynamic_cast<Toolkit::DevelControl::ControlAccessible*>(parent->GetParent());
}
}
-void AccessibleImpl::RegisterPositionPropertyNotification()
+void ControlAccessible::RegisterPositionPropertyNotification()
{
auto control = Dali::Toolkit::Control::DownCast(Self());
Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
controlImpl.RegisterAccessibilityPositionPropertyNotification();
}
-void AccessibleImpl::UnregisterPositionPropertyNotification()
+void ControlAccessible::UnregisterPositionPropertyNotification()
{
auto control = Dali::Toolkit::Control::DownCast(Self());
Internal::Control& internalControl = Toolkit::Internal::GetImplementation(control);
controlImpl.UnregisterAccessibilityPositionPropertyNotification();
}
-bool AccessibleImpl::GrabHighlight()
+bool ControlAccessible::GrabHighlight()
{
Dali::Actor self = Self();
auto oldHighlightedActor = GetCurrentlyHighlightedActor();
highlight.SetProperty(Actor::Property::POSITION, Vector2(0.0f, 0.0f));
// Need to set resize policy again, to update SIZE property which is set by
- // AccessibleImpl_NUI. The highlight could move from AccessibleImpl_NUI to
- // AccessibleImpl. In this case, highlight has incorrect size.
+ // NUIViewAccessible. The highlight could move from NUIViewAccessible to
+ // ControlAccessible. In this case, highlight has incorrect size.
highlight.SetResizePolicy(ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS);
// Remember the highlight actor, so that when the default is changed with
return true;
}
-bool AccessibleImpl::ClearHighlight()
+bool ControlAccessible::ClearHighlight()
{
Dali::Actor self = Self();
return false;
}
-std::string AccessibleImpl::GetActionName(size_t index)
+std::string ControlAccessible::GetActionName(size_t index) const
{
if(index >= GetActionCount())
{
return type.GetActionName(index);
}
-std::string AccessibleImpl::GetLocalizedActionName(size_t index)
+std::string ControlAccessible::GetLocalizedActionName(size_t index) const
{
return GetLocaleText(GetActionName(index));
}
-std::string AccessibleImpl::GetActionDescription(size_t index)
+std::string ControlAccessible::GetActionDescription(size_t index) const
{
return {};
}
-size_t AccessibleImpl::GetActionCount()
+size_t ControlAccessible::GetActionCount() const
{
Dali::TypeInfo type;
Self().GetTypeInfo(type);
return type.GetActionCount();
}
-std::string AccessibleImpl::GetActionKeyBinding(size_t index)
+std::string ControlAccessible::GetActionKeyBinding(size_t index) const
{
return {};
}
-bool AccessibleImpl::DoAction(size_t index)
+bool ControlAccessible::DoAction(size_t index)
{
std::string actionName = GetActionName(index);
return Self().DoAction(actionName, {});
}
-bool AccessibleImpl::DoAction(const std::string& name)
+bool ControlAccessible::DoAction(const std::string& name)
{
return Self().DoAction(name, {});
}
-bool AccessibleImpl::DoGesture(const Dali::Accessibility::GestureInfo& gestureInfo)
+bool ControlAccessible::DoGesture(const Dali::Accessibility::GestureInfo& gestureInfo)
{
auto control = Dali::Toolkit::Control::DownCast(Self());
return false;
}
-std::vector<Dali::Accessibility::Relation> AccessibleImpl::GetRelationSet()
+std::vector<Dali::Accessibility::Relation> ControlAccessible::GetRelationSet()
{
auto control = Dali::Toolkit::Control::DownCast(Self());
return ret;
}
-Dali::Actor AccessibleImpl::GetInternalActor()
-{
- return Dali::Actor{};
-}
-
-bool AccessibleImpl::ScrollToChild(Actor child)
+bool ControlAccessible::ScrollToChild(Actor child)
{
return false;
}
-Dali::Property::Index AccessibleImpl::GetNamePropertyIndex()
+Dali::Property::Index ControlAccessible::GetNamePropertyIndex()
{
return Actor::Property::NAME;
}
-Dali::Property::Index AccessibleImpl::GetDescriptionPropertyIndex()
+Dali::Property::Index ControlAccessible::GetDescriptionPropertyIndex()
{
return Dali::Property::INVALID_INDEX;
}
-void AccessibleImpl::SetLastPosition(Vector2 position)
+void ControlAccessible::SetLastPosition(Vector2 position)
{
mLastPosition = position;
}
-Vector2 AccessibleImpl::GetLastPosition() const
+Vector2 ControlAccessible::GetLastPosition() const
{
return mLastPosition;
}
-#ifndef DALI_TOOLKIT_ACCESSIBLE_IMPL_H
-#define DALI_TOOLKIT_ACCESSIBLE_IMPL_H
+#ifndef DALI_TOOLKIT_CONTROL_ACCESSIBLE_H
+#define DALI_TOOLKIT_CONTROL_ACCESSIBLE_H
+
/*
* Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* limitations under the License.
*
*/
+
// EXTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/accessibility.h>
#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
-#include <dali/devel-api/atspi-interfaces/accessible.h>
+#include <dali/devel-api/adaptor-framework/actor-accessible.h>
#include <dali/devel-api/atspi-interfaces/action.h>
-#include <dali/devel-api/atspi-interfaces/collection.h>
-#include <dali/devel-api/atspi-interfaces/component.h>
#include <dali/public-api/object/weak-handle.h>
// INTERNAL INCLUDES
* @see Dali::Accessibility::Text
* @see Dali::Accessibility::EditableText
*/
-struct DALI_TOOLKIT_API AccessibleImpl : public virtual Dali::Accessibility::Accessible,
- public virtual Dali::Accessibility::Component,
- public virtual Dali::Accessibility::Collection,
- public virtual Dali::Accessibility::Action
+struct DALI_TOOLKIT_API ControlAccessible : public Dali::Accessibility::ActorAccessible,
+ public virtual Dali::Accessibility::Action
{
protected:
Vector2 mLastPosition{0.0f, 0.0f};
- Dali::WeakHandle<Dali::Actor> mSelf;
Dali::WeakHandle<Dali::Actor> mCurrentHighlightActor;
bool mIsModal = false;
bool mIsRoot = false;
- Dali::Actor Self() const
- {
- auto handle = mSelf.GetHandle();
-
- // Control::Impl holds a std::unique_ptr to the Accessible object,
- // so that one does not outlive the other.
- DALI_ASSERT_ALWAYS(handle);
-
- return handle;
- }
-
void ScrollToSelf();
/**
bool IsShowing();
public:
- AccessibleImpl(Dali::Actor self, Dali::Accessibility::Role role, bool modal = false);
+ ControlAccessible(Dali::Actor self, Dali::Accessibility::Role role, bool modal = false);
/**
* @copydoc Dali::Accessibility::Accessible::GetName()
*/
- std::string GetName() override;
+ std::string GetName() const override;
/**
* @brief Returns the actor's name in the absence of ACCESSIBILITY_NAME property
*/
- virtual std::string GetNameRaw();
+ virtual std::string GetNameRaw() const;
/**
* @copydoc Dali::Accessibility::Accessible::GetDescription()
*/
- std::string GetDescription() override;
+ std::string GetDescription() const override;
/**
* @brief Returns the actor's description in the absence of ACCESSIBILITY_DESCRIPTION property
*/
- virtual std::string GetDescriptionRaw();
-
- /**
- * @copydoc Dali::Accessibility::Accessible::GetParent()
- */
- Dali::Accessibility::Accessible* GetParent() override;
-
- /**
- * @copydoc Dali::Accessibility::Accessible::GetChildCount()
- */
- size_t GetChildCount() override;
-
- /**
- * @copydoc Dali::Accessibility::Accessible::GetChildAtIndex()
- */
- Dali::Accessibility::Accessible* GetChildAtIndex(size_t index) override;
-
- /**
- * @copydoc Dali::Accessibility::Accessible::GetIndexInParent()
- */
- size_t GetIndexInParent() override;
+ virtual std::string GetDescriptionRaw() const;
/**
* @copydoc Dali::Accessibility::Accessible::GetRole()
*/
- Dali::Accessibility::Role GetRole() override;
+ Dali::Accessibility::Role GetRole() const override;
/**
* @copydoc Dali::Accessibility::Accessible::GetLocalizedRoleName()
*/
- std::string GetLocalizedRoleName() override;
+ std::string GetLocalizedRoleName() const override;
/**
* @copydoc Dali::Accessibility::Accessible::GetStates()
/**
* @copydoc Dali::Accessibility::Accessible::GetAttributes()
*/
- Dali::Accessibility::Attributes GetAttributes() override;
-
- /**
- * @copydoc Dali::Accessibility::Component::GetExtents()
- */
- Dali::Rect<> GetExtents(Accessibility::CoordinateType type) override;
-
- /**
- * @copydoc Dali::Accessibility::Component::GetLayer()
- */
- Dali::Accessibility::ComponentLayer GetLayer() override;
+ Dali::Accessibility::Attributes GetAttributes() const override;
/**
- * @copydoc Dali::Accessibility::Component::GetMdiZOrder()
+ * @copydoc Dali::Accessibility::Accessible::IsHidden()
*/
- int16_t GetMdiZOrder() override;
+ bool IsHidden() const override;
/**
* @copydoc Dali::Accessibility::Component::GrabFocus()
bool GrabFocus() override;
/**
- * @copydoc Dali::Accessibility::Component::GetAlpha()
- */
- double GetAlpha() override;
-
- /**
* @copydoc Dali::Accessibility::Component::GrabHighlight()
*/
bool GrabHighlight() override;
/**
* @copydoc Dali::Accessibility::Action::GetActionName()
*/
- std::string GetActionName(size_t index) override;
+ std::string GetActionName(size_t index) const override;
/**
* @copydoc Dali::Accessibility::Action::GetLocalizedActionName()
*/
- std::string GetLocalizedActionName(size_t index) override;
+ std::string GetLocalizedActionName(size_t index) const override;
/**
* @copydoc Dali::Accessibility::Action::GetActionDescription()
*/
- std::string GetActionDescription(size_t index) override;
+ std::string GetActionDescription(size_t index) const override;
/**
* @copydoc Dali::Accessibility::Action::GetActionCount()
*/
- size_t GetActionCount() override;
+ size_t GetActionCount() const override;
/**
* @copydoc Dali::Accessibility::Action::GetActionKeyBinding()
*/
- std::string GetActionKeyBinding(size_t index) override;
+ std::string GetActionKeyBinding(size_t index) const override;
/**
- * @copydoc Dali::Accessibility::Action::DoAction(size_t)
+ * @copydoc Dali::Accessibility::Action::DoAction(std::size_t)
*/
bool DoAction(size_t index) override;
std::vector<Dali::Accessibility::Relation> GetRelationSet() override;
/**
- * @copydoc Dali::Accessibility::Accessible::GetInternalActor()
- */
- Dali::Actor GetInternalActor() override;
-
- /**
* @copydoc Dali::Accessibility::Accessible::GetStates()
*/
virtual Dali::Accessibility::States CalculateStates();
} // namespace Dali::Toolkit::DevelControl
-#endif // DALI_TOOLKIT_ACCESSIBLE_IMPL_H
+#endif // DALI_TOOLKIT_CONTROL_ACCESSIBLE_H
#include <dali/public-api/animation/time-period.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/controls/accessible-impl.h>
+#include <dali-toolkit/devel-api/controls/control-accessible.h>
#include <dali-toolkit/devel-api/visual-factory/visual-base.h>
#include <dali-toolkit/public-api/controls/control.h>
* @see Dali::Accessibility::Role
*/
ACCESSIBILITY_ROLE,
+
/**
* @brief Mark of able to highlight object.
* @details Name "accessibilityHighlightable", type Property::BOOLEAN.
*/
ACCESSIBILITY_HIGHLIGHTABLE,
+
/**
* @brief Set of accessibility attributes describing object in accessibility hierarchy
* @details Name "accessibilityAttributes", type Property::MAP
* @note If a control's dispatchKeyEvents is set to false, then it's children will not emit a key event signal either.
*/
DISPATCH_KEY_EVENTS,
+
+ /**
+ * @brief Marks the object as invisible to AT-SPI clients.
+ * @details Name "accessibilityHidden", type Property::BOOLEAN.
+ * @note The representative Accessible object will not appear in the AT-SPI tree.
+ */
+ ACCESSIBILITY_HIDDEN,
};
} // namespace Property
* @code
* SetAccessibilityConstructor( []( Dali::Actor actor ) {
return std::unique_ptr< Dali::Accessibility::Accessible >(
- new AccessibleImpl( actor, Dali::Accessibility::Role::DIALOG, true ) );
+ new ControlAccessible( actor, Dali::Accessibility::Role::DIALOG, true ) );
} );
* @endcode
*
#define DALI_TOOLKIT_TEXT_EDITOR_DEVEL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
FONT_SIZE_SCALE,
/**
+ * @brief True to enable the font size scale or false to disable.
+ * @details Name "enableFontSizeScale", type Property::BOOLEAN.
+ * @note The default value is true.
+ * If false, font size scale is not apppied.
+ */
+ ENABLE_FONT_SIZE_SCALE,
+
+ /**
* @brief The position for primary cursor.
* @details Name "primaryCursorPosition", type Property::INTEGER.
*/
* @note If the font size is larger than the line size, it works with the font size.
*/
MIN_LINE_SIZE,
+
+ /**
+ * @brief A horizontal line through the text center.
+ * @details Name "strikethrough", type Property::MAP.
+ */
+ STRIKETHROUGH,
+
+ /**
+ * @brief The strikethrough parameters of the new input text.
+ * @details Name "inputStrikethrough", type Property::MAP.
+ */
+ INPUT_STRIKETHROUGH,
};
} // namespace Property
#define DALI_TOOLKIT_TEXT_FIELD_DEVEL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
FONT_SIZE_SCALE,
/**
+ * @brief True to enable the font size scale or false to disable.
+ * @details Name "enableFontSizeScale", type Property::BOOLEAN.
+ * @note The default value is true.
+ * If false, font size scale is not apppied.
+ */
+ ENABLE_FONT_SIZE_SCALE,
+
+ /**
* @brief The position for primary cursor.
* @details Name "primaryCursorPosition", type Property::INTEGER.
*/
* @see DevelText::EllipsisPosition
*/
ELLIPSIS_POSITION,
+
+ /**
+ * @brief A horizontal line through the text center.
+ * @details Name "strikethrough", type Property::MAP.
+ */
+ STRIKETHROUGH,
+
+ /**
+ * @brief The strikethrough parameters of the new input text.
+ * @details Name "inputStrikethrough", type Property::MAP.
+ */
+ INPUT_STRIKETHROUGH,
};
} // namespace Property
#define DALI_TOOLKIT_TEXT_LABEL_DEVEL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
FONT_SIZE_SCALE,
/**
+ * @brief True to enable the font size scale or false to disable.
+ * @details Name "enableFontSizeScale", type Property::BOOLEAN.
+ * @note The default value is true.
+ * If false, font size scale is not apppied.
+ */
+ ENABLE_FONT_SIZE_SCALE,
+
+ /**
* @brief The enumerations used to specify whether to position the ellipsis at the END, START or MIDDLE of the text.
* @details Name "EllipsisPosition", type [Type](@ref Dali::Toolkit::DevelText::EllipsisPosition::Type) (Property::INTEGER), or Property::STRING. Read/Write
* @note Default is EllipsisPosition::END.
* @see DevelText::EllipsisPosition
*/
ELLIPSIS_POSITION,
+
+ /**
+ * @brief The default strikethrough parameters.
+ * @details Name "strikethrough", type Property::MAP.
+ *
+ * The strikethrough map contains the following keys:
+ *
+ * | %Property Name | Type | Required | Description |
+ * |----------------------|----------|----------|--------------------------------------------------------------------------------------------------------------------|
+ * | enable | BOOLEAN | No | True to enable the strikethrough or false to disable (the default value is false) |
+ * | color | VECTOR4 | No | The color of the strikethrough (the default value is Color::BLACK) |
+ * | height | FLOAT | No | The height of the strikethrough (the default value is 0) |
+ *
+ */
+ STRIKETHROUGH,
};
} // namespace Property
} // namespace Background
+namespace Strikethrough
+{
+namespace Property
+{
+enum
+{
+ /**
+ * @brief Whether the strikethrough is enabled.
+ * @details Name "enable", type Property::STRING or Property::BOOLEAN. i.e. "true", "false", true or false
+ * @note Optional. By default is disabled.
+ */
+ ENABLE,
+
+ /**
+ * @brief The color of the strikethrough.
+ * @details Name "color", type Property::STRING or Property::VECTOR4
+ * @note Optional. If not provided then the default color is black.
+ */
+ COLOR,
+
+ /**
+ * @brief The height in pixels of the strikethrough.
+ * @details Name "height", type Property::STRING or Property::FLOAT. i.e. "1.0" or 1.f
+ * @note Optional. If not provided then the default height is used (1 pixel).
+ */
+ HEIGHT
+};
+
+} // namespace Property
+
+} // namespace Strikethrough
+
} // namespace DevelText
/**
${devel_api_src_dir}/builder/builder.cpp
${devel_api_src_dir}/builder/json-parser.cpp
${devel_api_src_dir}/builder/tree-node.cpp
- ${devel_api_src_dir}/controls/accessible-impl.cpp
${devel_api_src_dir}/controls/canvas-view/canvas-view.cpp
+ ${devel_api_src_dir}/controls/control-accessible.cpp
${devel_api_src_dir}/controls/control-devel.cpp
${devel_api_src_dir}/controls/control-wrapper.cpp
${devel_api_src_dir}/controls/control-wrapper-impl.cpp
${devel_api_src_dir}/transition-effects/cube-transition-fold-effect.cpp
${devel_api_src_dir}/transition-effects/cube-transition-wave-effect.cpp
${devel_api_src_dir}/utility/npatch-utilities.cpp
+ ${devel_api_src_dir}/utility/npatch-helper.cpp
${devel_api_src_dir}/visual-factory/transition-data.cpp
${devel_api_src_dir}/visual-factory/visual-factory.cpp
${devel_api_src_dir}/visual-factory/visual-base.cpp
)
SET( devel_api_controls_header_files
- ${devel_api_src_dir}/controls/accessible-impl.h
${devel_api_src_dir}/controls/canvas-view/canvas-view.h
+ ${devel_api_src_dir}/controls/control-accessible.h
${devel_api_src_dir}/controls/control-depth-index-ranges.h
${devel_api_src_dir}/controls/control-devel.h
${devel_api_src_dir}/controls/control-wrapper.h
SET( devel_api_utility_header_files
${devel_api_src_dir}/utility/npatch-utilities.h
+ ${devel_api_src_dir}/utility/npatch-helper.h
)
SET( SOURCES ${SOURCES}
--- /dev/null
+/*
+* Copyright (c) 2021 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.
+*
+*/
+
+// CLASS HEADER
+#include <dali-toolkit/devel-api/utility/npatch-helper.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace NPatchHelper
+{
+namespace
+{
+/**
+ * @brief Creates the geometry formed from the vertices and indices
+ *
+ * @param[in] vertices The vertices to generate the geometry from
+ * @param[in] indices The indices to generate the geometry from
+ * @return The geometry formed from the vertices and indices
+ */
+Geometry GenerateGeometry(const Vector<Vector2>& vertices, const Vector<unsigned short>& indices)
+{
+ Property::Map vertexFormat;
+ vertexFormat["aPosition"] = Property::VECTOR2;
+ VertexBuffer vertexBuffer = VertexBuffer::New(vertexFormat);
+ if(vertices.Size() > 0)
+ {
+ vertexBuffer.SetData(&vertices[0], vertices.Size());
+ }
+
+ // Create the geometry object
+ Geometry geometry = Geometry::New();
+ geometry.AddVertexBuffer(vertexBuffer);
+ if(indices.Size() > 0)
+ {
+ geometry.SetIndexBuffer(&indices[0], indices.Size());
+ }
+
+ return geometry;
+}
+
+/**
+ * @brief Adds the indices to form a quad composed off two triangles where the indices are organised in a grid
+ *
+ * @param[out] indices The indices to add to
+ * @param[in] rowIdx The row index to start the quad
+ * @param[in] nextRowIdx The index to the next row
+ */
+void AddQuadIndices(Vector<unsigned short>& indices, unsigned int rowIdx, unsigned int nextRowIdx)
+{
+ indices.PushBack(rowIdx);
+ indices.PushBack(nextRowIdx + 1);
+ indices.PushBack(rowIdx + 1);
+
+ indices.PushBack(rowIdx);
+ indices.PushBack(nextRowIdx);
+ indices.PushBack(nextRowIdx + 1);
+}
+
+/**
+ * @brief Adds the vertices to create for npatch
+ * @param[out] vertices The vertices to add to
+ * @param[in] x The x value of vector
+ * @param[in] y The y value of vector
+ */
+void AddVertex(Vector<Vector2>& vertices, unsigned int x, unsigned int y)
+{
+ vertices.PushBack(Vector2(x, y));
+}
+
+} // unnamed namespace
+
+Geometry CreateGridGeometry(Uint16Pair gridSize)
+{
+ uint16_t gridWidth = gridSize.GetWidth();
+ uint16_t gridHeight = gridSize.GetHeight();
+
+ // Create vertices
+ Vector<Vector2> vertices;
+ vertices.Reserve((gridWidth + 1) * (gridHeight + 1));
+
+ for(int y = 0; y < gridHeight + 1; ++y)
+ {
+ for(int x = 0; x < gridWidth + 1; ++x)
+ {
+ AddVertex(vertices, x, y);
+ }
+ }
+
+ // Create indices
+ Vector<unsigned short> indices;
+ indices.Reserve(gridWidth * gridHeight * 6);
+
+ unsigned int rowIdx = 0;
+ unsigned int nextRowIdx = gridWidth + 1;
+ for(int y = 0; y < gridHeight; ++y, ++nextRowIdx, ++rowIdx)
+ {
+ for(int x = 0; x < gridWidth; ++x, ++nextRowIdx, ++rowIdx)
+ {
+ AddQuadIndices(indices, rowIdx, nextRowIdx);
+ }
+ }
+
+ return GenerateGeometry(vertices, indices);
+}
+
+Geometry CreateBorderGeometry(Uint16Pair gridSize)
+{
+ uint16_t gridWidth = gridSize.GetWidth();
+ uint16_t gridHeight = gridSize.GetHeight();
+
+ // Create vertices
+ Vector<Vector2> vertices;
+ vertices.Reserve((gridWidth + 1) * (gridHeight + 1));
+
+ //top
+ int y = 0;
+ for(; y < 2; ++y)
+ {
+ for(int x = 0; x < gridWidth + 1; ++x)
+ {
+ AddVertex(vertices, x, y);
+ }
+ }
+
+ for(; y < gridHeight - 1; ++y)
+ {
+ //left
+ AddVertex(vertices, 0, y);
+ AddVertex(vertices, 1, y);
+
+ //right
+ AddVertex(vertices, gridWidth - 1, y);
+ AddVertex(vertices, gridWidth, y);
+ }
+
+ //bottom
+ for(; y < gridHeight + 1; ++y)
+ {
+ for(int x = 0; x < gridWidth + 1; ++x)
+ {
+ AddVertex(vertices, x, y);
+ }
+ }
+
+ // Create indices
+ Vector<unsigned short> indices;
+ indices.Reserve(gridWidth * gridHeight * 6);
+
+ //top
+ unsigned int rowIdx = 0;
+ unsigned int nextRowIdx = gridWidth + 1;
+ for(int x = 0; x < gridWidth; ++x, ++nextRowIdx, ++rowIdx)
+ {
+ AddQuadIndices(indices, rowIdx, nextRowIdx);
+ }
+
+ if(gridHeight > 2)
+ {
+ rowIdx = gridWidth + 1;
+ nextRowIdx = (gridWidth + 1) * 2;
+
+ unsigned increment = gridWidth - 1;
+ if(gridHeight > 3)
+ {
+ increment = 2;
+ //second row left
+ AddQuadIndices(indices, rowIdx, nextRowIdx);
+
+ rowIdx = gridWidth * 2;
+ nextRowIdx = (gridWidth + 1) * 2 + 2;
+ //second row right
+ AddQuadIndices(indices, rowIdx, nextRowIdx);
+
+ //left and right
+ rowIdx = nextRowIdx - 2;
+ nextRowIdx = rowIdx + 4;
+ for(int y = 2; y < 2 * (gridHeight - 3); ++y, rowIdx += 2, nextRowIdx += 2)
+ {
+ AddQuadIndices(indices, rowIdx, nextRowIdx);
+ }
+ }
+
+ //second row left
+ AddQuadIndices(indices, rowIdx, nextRowIdx);
+
+ rowIdx += increment;
+ nextRowIdx += gridWidth - 1;
+ //second row right
+ AddQuadIndices(indices, rowIdx, nextRowIdx);
+ }
+
+ //bottom
+ rowIdx = nextRowIdx - gridWidth + 1;
+ nextRowIdx = rowIdx + gridWidth + 1;
+ for(int x = 0; x < gridWidth; ++x, ++nextRowIdx, ++rowIdx)
+ {
+ AddQuadIndices(indices, rowIdx, nextRowIdx);
+ }
+
+ return GenerateGeometry(vertices, indices);
+}
+
+void RegisterStretchProperties(Renderer& renderer, const char* uniformName, const NPatchUtility::StretchRanges& stretchPixels, uint16_t imageExtent)
+{
+ uint16_t prevEnd = 0;
+ uint16_t prevFix = 0;
+ uint16_t prevStretch = 0;
+ unsigned int i = 1;
+ for(NPatchUtility::StretchRanges::ConstIterator it = stretchPixels.Begin(); it != stretchPixels.End(); ++it, ++i)
+ {
+ uint16_t start = it->GetX();
+ uint16_t end = it->GetY();
+
+ uint16_t fix = prevFix + start - prevEnd;
+ uint16_t stretch = prevStretch + end - start;
+
+ std::stringstream uniform;
+ uniform << uniformName << "[" << i << "]";
+ renderer.RegisterProperty(uniform.str(), Vector2(fix, stretch));
+
+ prevEnd = end;
+ prevFix = fix;
+ prevStretch = stretch;
+ }
+
+ {
+ prevFix += imageExtent - prevEnd;
+ std::stringstream uniform;
+ uniform << uniformName << "[" << i << "]";
+ renderer.RegisterProperty(uniform.str(), Vector2(prevFix, prevStretch));
+ }
+}
+
+void ApplyTextureAndUniforms(Renderer& renderer, const Internal::NPatchData* data)
+{
+ TextureSet textureSet;
+ textureSet = data->GetTextures();
+
+ if(data->GetStretchPixelsX().Size() == 1 && data->GetStretchPixelsY().Size() == 1)
+ {
+ //special case for 9 patch
+ Uint16Pair stretchX = data->GetStretchPixelsX()[0];
+ Uint16Pair stretchY = data->GetStretchPixelsY()[0];
+
+ uint16_t stretchWidth = (stretchX.GetY() >= stretchX.GetX()) ? stretchX.GetY() - stretchX.GetX() : 0;
+ uint16_t stretchHeight = (stretchY.GetY() >= stretchY.GetX()) ? stretchY.GetY() - stretchY.GetX() : 0;
+
+ renderer.RegisterProperty("uFixed[0]", Vector2::ZERO);
+ renderer.RegisterProperty("uFixed[1]", Vector2(stretchX.GetX(), stretchY.GetX()));
+ renderer.RegisterProperty("uFixed[2]", Vector2(data->GetCroppedWidth() - stretchWidth, data->GetCroppedHeight() - stretchHeight));
+ renderer.RegisterProperty("uStretchTotal", Vector2(stretchWidth, stretchHeight));
+ }
+ else
+ {
+ renderer.RegisterProperty("uNinePatchFactorsX[0]", Vector2::ZERO);
+ renderer.RegisterProperty("uNinePatchFactorsY[0]", Vector2::ZERO);
+
+ RegisterStretchProperties(renderer, "uNinePatchFactorsX", data->GetStretchPixelsX(), data->GetCroppedWidth());
+ RegisterStretchProperties(renderer, "uNinePatchFactorsY", data->GetStretchPixelsY(), data->GetCroppedHeight());
+ }
+}
+
+} // namespace NPatchHelper
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_NPATCH_HELPER_H
+#define DALI_TOOLKIT_NPATCH_HELPER_H
+
+/*
+ * Copyright (c) 2021 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.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/math/uint-16-pair.h>
+#include <dali/public-api/rendering/geometry.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/dali-toolkit-common.h>
+#include <dali-toolkit/internal/visuals/npatch-data.h>
+
+namespace Dali
+{
+namespace Toolkit
+{
+namespace NPatchHelper
+{
+/**
+ * The list that includes stretch pixel ranges
+ */
+using StretchRanges = Dali::Vector<Uint16Pair>;
+
+/**
+ * @brief Creates a Npatch Geometry object
+ *
+ * @param[in] gridSize The gridSize for creating a geometry
+ * @return The Geometry for NPatch
+ */
+DALI_TOOLKIT_API Geometry CreateGridGeometry(Uint16Pair gridSize);
+
+/**
+ * @brief Creates a geometry with the border only for the grid size to be used by this visuals' shaders
+ * e.g. a 5x4 grid would create a geometry that would look like:
+ *
+ * ---------------------
+ * | /| /| /| /| /|
+ * |/ |/ |/ |/ |/ |
+ * ---------------------
+ * | /| | /|
+ * |/ | |/ |
+ * ----- -----
+ * | /| | /|
+ * |/ | |/ |
+ * ---------------------
+ * | /| /| /| /| /|
+ * |/ |/ |/ |/ |/ |
+ * ---------------------
+ *
+ * @param[in] gridSize The grid size of the solid geometry to create
+ * @return Returns the created geometry for the grid size
+ */
+DALI_TOOLKIT_API Geometry CreateBorderGeometry(Uint16Pair gridSize);
+
+
+/**
+ * @brief Registers a properties for Stretch Ranges
+ *
+ * @param[in,out] renderer The renderer for broken image
+ * @param[in] uniformName The name of the uniform
+ * @param[in] stretchPixels The stretchable pixels in the cropped image space
+ * @param[in] imageExtent The imageExtent
+ */
+void RegisterStretchProperties(Renderer& renderer, const char* uniformName, const NPatchUtility::StretchRanges& stretchPixels, uint16_t imageExtent);
+
+/**
+ * @brief Apply a texture and uniforms
+ *
+ * @param[in,out] renderer The renderer for broken image
+ * @param[in] data The pointer of npatch-data
+ */
+void ApplyTextureAndUniforms(Renderer& renderer, const Internal::NPatchData* data);
+
+} // namespace NPatchUtility
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_NPATCH_HELPER_H
* @copydoc Dali::Toolkit::DevelTextLabel::Property::BACKGROUND
*/
BACKGROUND = UNDERLINE + 2,
+
+ /**
+ * @copydoc Dali::Toolkit::DevelTextLabel::Property::STRIKETHROUGH
+ */
+ STRIKETHROUGH = UNDERLINE + 3,
};
} // namespace Property
{
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::FILLER));
});
}
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::ANIMATION));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::ANIMATION));
});
}
return mForegroundPadding;
}
-std::string Button::AccessibleImpl::GetNameRaw()
+std::string Button::AccessibleImpl::GetNameRaw() const
{
std::string labelText;
auto slf = Toolkit::Button::DownCast(Self());
Dali::Accessibility::States Button::AccessibleImpl::CalculateStates()
{
- auto tmp = DevelControl::AccessibleImpl::CalculateStates();
+ auto tmp = DevelControl::ControlAccessible::CalculateStates();
tmp[Dali::Accessibility::State::SELECTABLE] = true;
auto slf = Toolkit::Button::DownCast(Self());
tmp[Dali::Accessibility::State::ENABLED] = !slf.GetProperty<bool>(Toolkit::Button::Property::DISABLED);
bool mClickActionPerforming; ///< Used to manage signal emissions during action
protected:
- struct AccessibleImpl : public DevelControl::AccessibleImpl
+ struct AccessibleImpl : public DevelControl::ControlAccessible
{
- using DevelControl::AccessibleImpl::AccessibleImpl;
+ using DevelControl::ControlAccessible::ControlAccessible;
Dali::Accessibility::States CalculateStates() override;
- std::string GetNameRaw() override;
+ std::string GetNameRaw() const override;
Property::Index GetNamePropertyIndex() override;
};
};
return states;
}
-std::string ToggleButton::AccessibleImpl::GetDescriptionRaw()
+std::string ToggleButton::AccessibleImpl::GetDescriptionRaw() const
{
auto button = Toolkit::ToggleButton::DownCast(Self());
auto index = button.GetProperty<int>(Toolkit::ToggleButton::Property::CURRENT_STATE_INDEX);
using Button::AccessibleImpl::AccessibleImpl;
Dali::Accessibility::States CalculateStates() override;
- std::string GetDescriptionRaw() override;
+ std::string GetDescriptionRaw() const override;
Property::Index GetDescriptionPropertyIndex() override;
};
void OnStateChange(State newState) override;
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::IMAGE));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::IMAGE));
});
Adaptor::Get().RegisterProcessor(*this, true);
}
}
-Dali::Rect<> GetShowingGeometry(Dali::Rect<> rect, Dali::Toolkit::DevelControl::AccessibleImpl* accessibleImpl)
+Dali::Rect<> GetShowingGeometry(Dali::Rect<> rect, Dali::Toolkit::DevelControl::ControlAccessible* accessible)
{
Rect<> parentRect;
Vector2 currentPosition;
- auto parent = dynamic_cast<Toolkit::DevelControl::AccessibleImpl*>(accessibleImpl->GetParent());
+ auto parent = dynamic_cast<Toolkit::DevelControl::ControlAccessible*>(accessible->GetParent());
while(parent)
{
return rect;
}
- parent = dynamic_cast<Toolkit::DevelControl::AccessibleImpl*>(parent->GetParent());
+ parent = dynamic_cast<Toolkit::DevelControl::ControlAccessible*>(parent->GetParent());
}
return rect;
const PropertyRegistration Control::Impl::PROPERTY_19(typeRegistration, "accessibilityRole", Toolkit::DevelControl::Property::ACCESSIBILITY_ROLE, Property::INTEGER, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
const PropertyRegistration Control::Impl::PROPERTY_20(typeRegistration, "accessibilityHighlightable", Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
const PropertyRegistration Control::Impl::PROPERTY_21(typeRegistration, "accessibilityAttributes", Toolkit::DevelControl::Property::ACCESSIBILITY_ATTRIBUTES, Property::MAP, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
-const PropertyRegistration Control::Impl::PROPERTY_22(typeRegistration, "dispatchKeyEvents", Toolkit::DevelControl::Property::DISPATCH_KEY_EVENTS, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
+const PropertyRegistration Control::Impl::PROPERTY_22(typeRegistration, "dispatchKeyEvents", Toolkit::DevelControl::Property::DISPATCH_KEY_EVENTS, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
+const PropertyRegistration Control::Impl::PROPERTY_23(typeRegistration, "accessibilityHidden", Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN, Property::BOOLEAN, &Control::Impl::SetProperty, &Control::Impl::GetProperty);
// clang-format on
});
mAccessibilityConstructor = [](Dali::Actor actor) -> std::unique_ptr<Dali::Accessibility::Accessible> {
- return std::unique_ptr<Dali::Accessibility::Accessible>(new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::UNKNOWN));
+ return std::unique_ptr<Dali::Accessibility::Accessible>(new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::UNKNOWN));
};
}
void Control::Impl::CheckHighlightedObjectGeometry()
{
- auto accessibleImpl = dynamic_cast<Dali::Toolkit::DevelControl::AccessibleImpl*>(mAccessibilityObject.get());
- if(!accessibleImpl)
+ auto accessible = dynamic_cast<Dali::Toolkit::DevelControl::ControlAccessible*>(mAccessibilityObject.get());
+ if(!accessible)
{
- DALI_LOG_ERROR("accessibleImpl is not a pointer to a DevelControl::AccessibleImpl type");
+ DALI_LOG_ERROR("accessible is not a pointer to a DevelControl::ControlAccessible type");
return;
}
- auto lastPosition = accessibleImpl->GetLastPosition();
- auto accessibleRect = accessibleImpl->GetExtents(Dali::Accessibility::CoordinateType::WINDOW);
- auto rect = GetShowingGeometry(accessibleRect, accessibleImpl);
+ auto lastPosition = accessible->GetLastPosition();
+ auto accessibleRect = accessible->GetExtents(Dali::Accessibility::CoordinateType::WINDOW);
+ auto rect = GetShowingGeometry(accessibleRect, accessible);
switch(mAccessibilityLastScreenRelativeMoveType)
{
}
}
- accessibleImpl->SetLastPosition(Vector2(accessibleRect.x, accessibleRect.y));
+ accessible->SetLastPosition(Vector2(accessibleRect.x, accessibleRect.y));
}
void Control::Impl::RegisterAccessibilityPositionPropertyNotification()
}
break;
}
+
+ case Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN:
+ {
+ bool hidden;
+ if(value.Get(hidden))
+ {
+ controlImpl.mImpl->mAccessibilityHidden = hidden;
+ }
+ break;
+ }
}
}
}
value = controlImpl.mImpl->mAccessibilityAttributes;
break;
}
+
case Toolkit::DevelControl::Property::DISPATCH_KEY_EVENTS:
{
value = controlImpl.mImpl->mDispatchKeyEvents;
break;
}
+
+ case Toolkit::DevelControl::Property::ACCESSIBILITY_HIDDEN:
+ {
+ value = controlImpl.mImpl->mAccessibilityHidden;
+ break;
+ }
}
}
*/
class Control::Impl : public ConnectionTracker, public Visual::EventObserver
{
- friend class Toolkit::DevelControl::AccessibleImpl;
+ friend class Toolkit::DevelControl::ControlAccessible;
public:
/**
bool mAccessibilityHighlightable = false;
bool mAccessibilityHighlightableSet = false;
+ bool mAccessibilityHidden = false;
+
Dali::Accessibility::Role mAccessibilityRole = Dali::Accessibility::Role::UNKNOWN;
std::map<Dali::Accessibility::RelationType, std::set<Accessibility::Accessible*>> mAccessibilityRelations;
static const PropertyRegistration PROPERTY_20;
static const PropertyRegistration PROPERTY_21;
static const PropertyRegistration PROPERTY_22;
+ static const PropertyRegistration PROPERTY_23;
private:
// Accessibility - notification for highlighted object to check if it is showing.
DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::FILLER));
});
}
DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::FILLER));
});
}
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::FILLER));
});
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::IMAGE));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::IMAGE));
});
}
map = value.GetMap();
if(map)
{
- Property::Value* shaderValue = map->Find(Toolkit::Visual::Property::SHADER, CUSTOM_SHADER);
- // set image only if property map contains image information other than custom shader
- if(map->Count() > 1u || !shaderValue)
+ // the property map is emtpy map. Unregister visual.
+ if(DALI_UNLIKELY(map->Count() == 0u))
{
- impl.SetImage(*map);
+ // Clear cached properties
+ impl.mPropertyMap.Clear();
+ impl.mUrl.clear();
+
+ // Unregister the exsiting visual
+ DevelControl::UnregisterVisual(impl, Toolkit::ImageView::Property::IMAGE);
+
+ // Trigger a size negotiation request that may be needed when unregistering a visual.
+ impl.RelayoutRequest();
}
- // the property map contains only the custom shader
- else if((map->Count() == 1u) && (shaderValue))
+ else
{
- Property::Map* shaderMap = shaderValue->GetMap();
- if(shaderMap)
+ Property::Value* shaderValue = map->Find(Toolkit::Visual::Property::SHADER, CUSTOM_SHADER);
+ // set image only if property map contains image information other than custom shader
+ if(map->Count() > 1u || !shaderValue)
{
- impl.mShaderMap = *shaderMap;
-
- if(!impl.mUrl.empty())
- {
- impl.SetImage(impl.mUrl, impl.mImageSize);
- }
- else if(!impl.mPropertyMap.Empty())
+ impl.SetImage(*map);
+ }
+ // the property map contains only the custom shader
+ else if((map->Count() == 1u) && (shaderValue))
+ {
+ Property::Map* shaderMap = shaderValue->GetMap();
+ if(shaderMap)
{
- impl.SetImage(impl.mPropertyMap);
+ impl.mShaderMap = *shaderMap;
+
+ if(!impl.mUrl.empty())
+ {
+ impl.SetImage(impl.mUrl, impl.mImageSize);
+ }
+ else if(!impl.mPropertyMap.Empty())
+ {
+ impl.SetImage(impl.mPropertyMap);
+ }
}
}
}
DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::FILLER));
});
}
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::IMAGE));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::IMAGE));
});
}
{
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::FILLER));
});
}
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::PAGE_TAB_LIST));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::PAGE_TAB_LIST));
});
}
}
}
-std::string Popup::AccessibleImpl::GetNameRaw()
+std::string Popup::AccessibleImpl::GetNameRaw() const
{
auto popup = Toolkit::Popup::DownCast(Self());
std::string title;
Dali::Accessibility::States Popup::AccessibleImpl::CalculateStates()
{
- auto states = DevelControl::AccessibleImpl::CalculateStates();
+ auto states = DevelControl::ControlAccessible::CalculateStates();
auto popup = Toolkit::Popup::DownCast(Self());
auto displayState = popup.GetProperty<std::string>(Toolkit::Popup::Property::DISPLAY_STATE);
static Property::Value GetProperty(BaseObject* object, Property::Index propertyIndex);
protected:
- struct AccessibleImpl : public DevelControl::AccessibleImpl
+ struct AccessibleImpl : public DevelControl::ControlAccessible
{
- using DevelControl::AccessibleImpl::AccessibleImpl;
+ using DevelControl::ControlAccessible::ControlAccessible;
- std::string GetNameRaw() override;
+ std::string GetNameRaw() const override;
Dali::Accessibility::States CalculateStates() override;
};
}
}
-double ProgressBar::AccessibleImpl::GetMinimum()
+double ProgressBar::AccessibleImpl::GetMinimum() const
{
return DEFAULT_LOWER_BOUND;
}
-double ProgressBar::AccessibleImpl::GetCurrent()
+double ProgressBar::AccessibleImpl::GetCurrent() const
{
auto self = Toolkit::ProgressBar::DownCast(Self());
return self.GetProperty(Toolkit::ProgressBar::Property::PROGRESS_VALUE).Get<float>();
}
-double ProgressBar::AccessibleImpl::GetMaximum()
+double ProgressBar::AccessibleImpl::GetMaximum() const
{
return DEFAULT_UPPER_BOUND;
}
return true;
}
-double ProgressBar::AccessibleImpl::GetMinimumIncrement()
+double ProgressBar::AccessibleImpl::GetMinimumIncrement() const
{
return 0.0;
}
Property::Map mSecondaryProgressVisualMap; ///< To backup visual properties when switching determinate/indeterminate.
protected:
- struct AccessibleImpl : public DevelControl::AccessibleImpl,
+ struct AccessibleImpl : public DevelControl::ControlAccessible,
public virtual Dali::Accessibility::Value
{
- using DevelControl::AccessibleImpl::AccessibleImpl;
- double GetMinimum() override;
- double GetCurrent() override;
- double GetMaximum() override;
+ using DevelControl::ControlAccessible::ControlAccessible;
+
+ double GetMinimum() const override;
+ double GetCurrent() const override;
+ double GetMaximum() const override;
bool SetCurrent(double) override;
- double GetMinimumIncrement() override;
+ double GetMinimumIncrement() const override;
};
};
return handle;
}
-double ScrollBar::AccessibleImpl::GetMinimum()
+double ScrollBar::AccessibleImpl::GetMinimum() const
{
auto self = Toolkit::ScrollBar::DownCast(Self());
Handle scrollableHandle = GetImpl(self).mScrollableObject.GetHandle();
return scrollableHandle ? scrollableHandle.GetCurrentProperty<float>(GetImpl(self).mPropertyMinScrollPosition) : 0.0f;
}
-double ScrollBar::AccessibleImpl::GetCurrent()
+double ScrollBar::AccessibleImpl::GetCurrent() const
{
auto self = Toolkit::ScrollBar::DownCast(Self());
Handle scrollableHandle = GetImpl(self).mScrollableObject.GetHandle();
return scrollableHandle ? scrollableHandle.GetCurrentProperty<float>(GetImpl(self).mPropertyScrollPosition) : 0.0f;
}
-double ScrollBar::AccessibleImpl::GetMaximum()
+double ScrollBar::AccessibleImpl::GetMaximum() const
{
auto self = Toolkit::ScrollBar::DownCast(Self());
Handle scrollableHandle = GetImpl(self).mScrollableObject.GetHandle();
return true;
}
-double ScrollBar::AccessibleImpl::GetMinimumIncrement()
+double ScrollBar::AccessibleImpl::GetMinimumIncrement() const
{
return 1.0;
}
bool mIndicatorFirstShow : 1; ///< True if the indicator has never been shown
protected:
- struct AccessibleImpl : public DevelControl::AccessibleImpl,
+ struct AccessibleImpl : public DevelControl::ControlAccessible,
public virtual Dali::Accessibility::Value
{
- using DevelControl::AccessibleImpl::AccessibleImpl;
- double GetMinimum() override;
- double GetCurrent() override;
- double GetMaximum() override;
+ using DevelControl::ControlAccessible::ControlAccessible;
+
+ double GetMinimum() const override;
+ double GetCurrent() const override;
+ double GetMaximum() const override;
bool SetCurrent(double) override;
- double GetMinimumIncrement() override;
+ double GetMinimumIncrement() const override;
};
};
{
}
-bool Scrollable::AccessibleImpl::IsScrollable()
+bool Scrollable::AccessibleImpl::IsScrollable() const
{
return true;
}
virtual void SetOvershootSize(const Vector2& size) = 0;
protected: // From Control
- struct AccessibleImpl : public DevelControl::AccessibleImpl
+ struct AccessibleImpl : public DevelControl::ControlAccessible
{
- using DevelControl::AccessibleImpl::AccessibleImpl;
+ using DevelControl::ControlAccessible::ControlAccessible;
- bool IsScrollable() override;
+ bool IsScrollable() const override;
};
/**
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::FILLER));
});
}
return value;
}
-double Slider::AccessibleImpl::GetMinimum()
+double Slider::AccessibleImpl::GetMinimum() const
{
auto self = Toolkit::Slider::DownCast(Self());
return self.GetProperty(Toolkit::Slider::Property::LOWER_BOUND).Get<float>();
}
-double Slider::AccessibleImpl::GetCurrent()
+double Slider::AccessibleImpl::GetCurrent() const
{
auto self = Toolkit::Slider::DownCast(Self());
return self.GetProperty(Toolkit::Slider::Property::VALUE).Get<float>();
}
-double Slider::AccessibleImpl::GetMaximum()
+double Slider::AccessibleImpl::GetMaximum() const
{
auto self = Toolkit::Slider::DownCast(Self());
return self.GetProperty(Toolkit::Slider::Property::UPPER_BOUND).Get<float>();
return true;
}
-double Slider::AccessibleImpl::GetMinimumIncrement()
+double Slider::AccessibleImpl::GetMinimumIncrement() const
{
auto self = Toolkit::Slider::DownCast(Self());
mSnapToMarks : 1; ///< Turn on or off snapping to marks
protected:
- struct AccessibleImpl : public DevelControl::AccessibleImpl,
+ struct AccessibleImpl : public DevelControl::ControlAccessible,
public virtual Dali::Accessibility::Value
{
- using DevelControl::AccessibleImpl::AccessibleImpl;
- double GetMinimum() override;
- double GetCurrent() override;
- double GetMaximum() override;
+ using DevelControl::ControlAccessible::ControlAccessible;
+
+ double GetMinimum() const override;
+ double GetCurrent() const override;
+ double GetMaximum() const override;
bool SetCurrent(double) override;
- double GetMinimumIncrement() override;
+ double GetMinimumIncrement() const override;
};
};
DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::FILLER));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::FILLER));
});
}
DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::TABLE));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::TABLE));
});
}
/**
* @brief This structure is to connect TextAnchor with Accessible functions.
*/
- struct AccessibleImpl : public DevelControl::AccessibleImpl,
+ struct AccessibleImpl : public DevelControl::ControlAccessible,
public virtual Dali::Accessibility::Hyperlink
{
- using DevelControl::AccessibleImpl::AccessibleImpl;
+ using DevelControl::ControlAccessible::ControlAccessible;
/**
* @copydoc Dali::Accessibility::Hyperlink::GetEndIndex()
*/
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "enableEditing", BOOLEAN, ENABLE_EDITING )
DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY(Toolkit, TextEditor, "selectedText", STRING, SELECTED_TEXT )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "fontSizeScale", FLOAT, FONT_SIZE_SCALE )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "enableFontSizeScale", BOOLEAN, ENABLE_FONT_SIZE_SCALE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "primaryCursorPosition", INTEGER, PRIMARY_CURSOR_POSITION )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "grabHandleColor", VECTOR4, GRAB_HANDLE_COLOR )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "enableGrabHandlePopup", BOOLEAN, ENABLE_GRAB_HANDLE_POPUP )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "ellipsis", BOOLEAN, ELLIPSIS )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "ellipsisPosition", INTEGER, ELLIPSIS_POSITION )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "minLineSize", FLOAT, MIN_LINE_SIZE )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "strikethrough", MAP, STRIKETHROUGH )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextEditor, "inputStrikethrough", MAP, INPUT_STRIKETHROUGH )
DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION(Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED )
{
editorInputStyleMask = static_cast<Toolkit::TextEditor::InputStyle::Mask>(editorInputStyleMask | Toolkit::TextEditor::InputStyle::OUTLINE);
}
+ if(InputStyle::NONE != static_cast<InputStyle::Mask>(inputStyleMask & InputStyle::INPUT_STRIKETHROUGH))
+ {
+ editorInputStyleMask = static_cast<Toolkit::TextEditor::InputStyle::Mask>(editorInputStyleMask | Toolkit::TextEditor::InputStyle::STRIKETHROUGH);
+ }
+
return editorInputStyleMask;
}
}
}
-std::string TextEditor::AccessibleImpl::GetName()
+std::string TextEditor::AccessibleImpl::GetName() const
{
auto self = Toolkit::TextEditor::DownCast(Self());
return self.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
}
-std::string TextEditor::AccessibleImpl::GetText(size_t startOffset, size_t endOffset)
+std::string TextEditor::AccessibleImpl::GetText(size_t startOffset, size_t endOffset) const
{
if(endOffset <= startOffset)
{
return text.substr(startOffset, endOffset - startOffset);
}
-size_t TextEditor::AccessibleImpl::GetCharacterCount()
+size_t TextEditor::AccessibleImpl::GetCharacterCount() const
{
auto self = Toolkit::TextEditor::DownCast(Self());
auto text = self.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
return text.size();
}
-size_t TextEditor::AccessibleImpl::GetCursorOffset()
+size_t TextEditor::AccessibleImpl::GetCursorOffset() const
{
auto slf = Toolkit::TextEditor::DownCast(Self());
return Dali::Toolkit::GetImpl(slf).GetTextController()->GetCursorPosition();
return true;
}
-Dali::Accessibility::Range TextEditor::AccessibleImpl::GetTextAtOffset(size_t offset, Dali::Accessibility::TextBoundary boundary)
+Dali::Accessibility::Range TextEditor::AccessibleImpl::GetTextAtOffset(size_t offset, Dali::Accessibility::TextBoundary boundary) const
{
auto self = Toolkit::TextEditor::DownCast(Self());
auto text = self.GetProperty(Toolkit::TextEditor::Property::TEXT).Get<std::string>();
return range;
}
-Dali::Accessibility::Range TextEditor::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex)
+Dali::Accessibility::Range TextEditor::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex) const
{
// Since DALi supports only one selection indexes higher than 0 are ignored
if(selectionIndex > 0)
{
using namespace Dali::Accessibility;
- auto states = DevelControl::AccessibleImpl::CalculateStates();
+ auto states = DevelControl::ControlAccessible::CalculateStates();
states[State::EDITABLE] = true;
states[State::FOCUSABLE] = true;
Toolkit::Control focusControl = Toolkit::KeyInputFocusManager::Get().GetCurrentFocusControl();
- if(mSelf == focusControl)
+ if(Self() == focusControl)
{
states[State::FOCUSED] = true;
}
/**
* @brief This structure is to connect TextEditor with Accessible functions.
*/
- struct AccessibleImpl : public DevelControl::AccessibleImpl,
- public virtual Dali::Accessibility::Text,
+ struct AccessibleImpl : public DevelControl::ControlAccessible,
public virtual Dali::Accessibility::EditableText,
public virtual Dali::Accessibility::Hypertext
{
- using DevelControl::AccessibleImpl::AccessibleImpl;
+ using DevelControl::ControlAccessible::ControlAccessible;
/**
* @copydoc Dali::Accessibility::Accessible::GetName()
*/
- std::string GetName() override;
+ std::string GetName() const override;
/**
* @copydoc Dali::Accessibility::Text::GetText()
*/
- std::string GetText(size_t startOffset, size_t endOffset) override;
+ std::string GetText(size_t startOffset, size_t endOffset) const override;
/**
* @copydoc Dali::Accessibility::Text::GetCharacterCount()
*/
- size_t GetCharacterCount() override;
+ size_t GetCharacterCount() const override;
/**
* @copydoc Dali::Accessibility::Text::GetCursorOffset()
*/
- size_t GetCursorOffset() override;
+ size_t GetCursorOffset() const override;
/**
* @copydoc Dali::Accessibility::Text::SetCursorOffset()
/**
* @copydoc Dali::Accessibility::Text::GetTextAtOffset()
*/
- Accessibility::Range GetTextAtOffset(size_t offset, Accessibility::TextBoundary boundary) override;
+ Accessibility::Range GetTextAtOffset(size_t offset, Accessibility::TextBoundary boundary) const override;
/**
* @copydoc Dali::Accessibility::Text::GetRangeOfSelection()
*/
- Accessibility::Range GetRangeOfSelection(size_t selectionIndex) override;
+ Accessibility::Range GetRangeOfSelection(size_t selectionIndex) const override;
/**
* @copydoc Dali::Accessibility::Text::RemoveSelection()
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
* limitations under the License.
*/
-#include <dali-toolkit/internal/controls/text-controls/text-editor-property-handler.h>
#include <dali-toolkit/internal/controls/text-controls/common-text-utils.h>
+#include <dali-toolkit/internal/controls/text-controls/text-editor-property-handler.h>
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
}
break;
}
+ case Toolkit::DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ const bool enableFontSizeScale = value.Get<bool>();
+ if(!Equals(impl.mController->IsFontSizeScaleEnabled(), enableFontSizeScale))
+ {
+ impl.mController->SetFontSizeScaleEnabled(enableFontSizeScale);
+ }
+ break;
+ }
case Toolkit::DevelTextEditor::Property::PRIMARY_CURSOR_POSITION:
{
uint32_t position = static_cast<uint32_t>(value.Get<int>());
impl.mRenderer.Reset();
break;
}
+ case Toolkit::DevelTextEditor::Property::STRIKETHROUGH:
+ {
+ const bool update = SetStrikethroughProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
+ if(update)
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::DevelTextEditor::Property::INPUT_STRIKETHROUGH:
+ {
+ const bool update = SetStrikethroughProperties(impl.mController, value, Text::EffectStyle::INPUT);
+ if(update)
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
}
}
value = impl.mController->GetLineWrapMode();
break;
}
+ case Toolkit::DevelTextEditor::Property::STRIKETHROUGH:
+ {
+ GetStrikethroughProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
+ break;
+ }
+ case Toolkit::DevelTextEditor::Property::INPUT_STRIKETHROUGH:
+ {
+ GetStrikethroughProperties(impl.mController, value, Text::EffectStyle::INPUT);
+ break;
+ }
case Toolkit::DevelTextEditor::Property::ENABLE_SHIFT_SELECTION:
{
value = impl.mController->IsShiftSelectionEnabled();
value = impl.mController->GetFontSizeScale();
break;
}
+ case Toolkit::DevelTextEditor::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ value = impl.mController->IsFontSizeScaleEnabled();
+ break;
+ }
case Toolkit::DevelTextEditor::Property::PRIMARY_CURSOR_POSITION:
{
value = static_cast<int>(impl.mController->GetPrimaryCursorPosition());
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "selectedTextEnd", INTEGER, SELECTED_TEXT_END )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "enableEditing", BOOLEAN, ENABLE_EDITING )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "fontSizeScale", FLOAT, FONT_SIZE_SCALE )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "enableFontSizeScale", BOOLEAN, ENABLE_FONT_SIZE_SCALE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "primaryCursorPosition", INTEGER, PRIMARY_CURSOR_POSITION )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "grabHandleColor", VECTOR4, GRAB_HANDLE_COLOR )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "inputFilter", MAP, INPUT_FILTER )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "ellipsisPosition", INTEGER, ELLIPSIS_POSITION )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "strikethrough", MAP, STRIKETHROUGH )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextField, "inputStrikethrough", MAP, INPUT_STRIKETHROUGH )
DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION(Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED )
return mController->GetTextPosition(startIndex, endIndex);
}
-std::string TextField::AccessibleImpl::GetName()
+std::string TextField::AccessibleImpl::GetName() const
{
auto self = Toolkit::TextField::DownCast(Self());
if(IsHiddenInput(self))
return self.GetProperty(Toolkit::TextField::Property::TEXT).Get<std::string>();
}
-std::string TextField::AccessibleImpl::GetText(size_t startOffset, size_t endOffset)
+std::string TextField::AccessibleImpl::GetText(size_t startOffset, size_t endOffset) const
{
if(endOffset <= startOffset)
{
return text.substr(startOffset, endOffset - startOffset);
}
-size_t TextField::AccessibleImpl::GetCharacterCount()
+size_t TextField::AccessibleImpl::GetCharacterCount() const
{
auto self = Toolkit::TextField::DownCast(Self());
auto text = self.GetProperty(Toolkit::TextField::Property::TEXT).Get<std::string>();
return text.size();
}
-size_t TextField::AccessibleImpl::GetCursorOffset()
+size_t TextField::AccessibleImpl::GetCursorOffset() const
{
auto self = Toolkit::TextField::DownCast(Self());
return Dali::Toolkit::GetImpl(self).GetTextController()->GetCursorPosition();
}
Dali::Accessibility::Range TextField::AccessibleImpl::GetTextAtOffset(
- size_t offset, Dali::Accessibility::TextBoundary boundary)
+ size_t offset, Dali::Accessibility::TextBoundary boundary) const
{
auto self = Toolkit::TextField::DownCast(Self());
auto range = Dali::Accessibility::Range{};
return range;
}
-Dali::Accessibility::Range TextField::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex)
+Dali::Accessibility::Range TextField::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex) const
{
// Since DALi supports only one selection indexes higher than 0 are ignored
if(selectionIndex > 0)
{
using namespace Dali::Accessibility;
- auto states = DevelControl::AccessibleImpl::CalculateStates();
+ auto states = DevelControl::ControlAccessible::CalculateStates();
states[State::EDITABLE] = true;
states[State::FOCUSABLE] = true;
Toolkit::Control focusControl = Toolkit::KeyInputFocusManager::Get().GetCurrentFocusControl();
- if(mSelf == focusControl)
+ if(Self() == focusControl)
{
states[State::FOCUSED] = true;
}
/**
* @brief This structure is to connect TextField with Accessible functions.
*/
- struct AccessibleImpl : public DevelControl::AccessibleImpl,
- public virtual Dali::Accessibility::Text,
+ struct AccessibleImpl : public DevelControl::ControlAccessible,
public virtual Dali::Accessibility::EditableText,
public virtual Dali::Accessibility::Hypertext
{
- using DevelControl::AccessibleImpl::AccessibleImpl;
+ using DevelControl::ControlAccessible::ControlAccessible;
/**
* @copydoc Dali::Accessibility::Accessible::GetName()
*/
- std::string GetName() override;
+ std::string GetName() const override;
/**
* @copydoc Dali::Accessibility::Text::GetText()
*/
- std::string GetText(size_t startOffset, size_t endOffset) override;
+ std::string GetText(size_t startOffset, size_t endOffset) const override;
/**
* @copydoc Dali::Accessibility::Text::GetCharacterCount()
*/
- size_t GetCharacterCount() override;
+ size_t GetCharacterCount() const override;
/**
* @copydoc Dali::Accessibility::Text::GetCursorOffset()
*/
- size_t GetCursorOffset() override;
+ size_t GetCursorOffset() const override;
/**
* @copydoc Dali::Accessibility::Text::SetCursorOffset()
/**
* @copydoc Dali::Accessibility::Text::GetTextAtOffset()
*/
- Accessibility::Range GetTextAtOffset(size_t offset, Accessibility::TextBoundary boundary) override;
+ Accessibility::Range GetTextAtOffset(size_t offset, Accessibility::TextBoundary boundary) const override;
/**
* @copydoc Dali::Accessibility::Text::GetRangeOfSelection()
*/
- Accessibility::Range GetRangeOfSelection(size_t selectionIndex) override;
+ Accessibility::Range GetRangeOfSelection(size_t selectionIndex) const override;
/**
* @copydoc Dali::Accessibility::Text::RemoveSelection()
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
* limitations under the License.
*/
-#include <dali-toolkit/internal/controls/text-controls/text-field-property-handler.h>
#include <dali-toolkit/internal/controls/text-controls/common-text-utils.h>
+#include <dali-toolkit/internal/controls/text-controls/text-field-property-handler.h>
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
#include <dali-toolkit/devel-api/text/rendering-backend.h>
}
break;
}
+ case Toolkit::DevelTextField::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ const bool enableFontSizeScale = value.Get<bool>();
+ if(!Equals(impl.mController->IsFontSizeScaleEnabled(), enableFontSizeScale))
+ {
+ impl.mController->SetFontSizeScaleEnabled(enableFontSizeScale);
+ }
+ break;
+ }
case Toolkit::DevelTextField::Property::PRIMARY_CURSOR_POSITION:
{
uint32_t position = static_cast<uint32_t>(value.Get<int>());
}
break;
}
+ case Toolkit::DevelTextField::Property::STRIKETHROUGH:
+ {
+ const bool update = SetStrikethroughProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
+ if(update)
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
+ case Toolkit::DevelTextField::Property::INPUT_STRIKETHROUGH:
+ {
+ const bool update = SetStrikethroughProperties(impl.mController, value, Text::EffectStyle::INPUT);
+ if(update)
+ {
+ impl.mRenderer.Reset();
+ }
+ break;
+ }
}
}
value = impl.mController->GetFontSizeScale();
break;
}
+ case Toolkit::DevelTextField::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ value = impl.mController->IsFontSizeScaleEnabled();
+ break;
+ }
case Toolkit::DevelTextField::Property::PRIMARY_CURSOR_POSITION:
{
value = static_cast<int>(impl.mController->GetPrimaryCursorPosition());
value = impl.mController->GetEllipsisPosition();
break;
}
+ case Toolkit::DevelTextField::Property::STRIKETHROUGH:
+ {
+ GetStrikethroughProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
+ break;
+ }
+ case Toolkit::DevelTextField::Property::INPUT_STRIKETHROUGH:
+ {
+ GetStrikethroughProperties(impl.mController, value, Text::EffectStyle::INPUT);
+ break;
+ }
} //switch
return value;
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "minLineSize", FLOAT, MIN_LINE_SIZE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "renderingBackend", INTEGER, RENDERING_BACKEND )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "fontSizeScale", FLOAT, FONT_SIZE_SCALE )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "enableFontSizeScale", BOOLEAN, ENABLE_FONT_SIZE_SCALE )
DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "ellipsisPosition", INTEGER, ELLIPSIS_POSITION )
+DALI_DEVEL_PROPERTY_REGISTRATION(Toolkit, TextLabel, "strikethrough", MAP, STRIKETHROUGH )
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)
}
break;
}
+ case Toolkit::DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ const bool enableFontSizeScale = value.Get<bool>();
+ if(!Equals(impl.mController->IsFontSizeScaleEnabled(), enableFontSizeScale))
+ {
+ impl.mController->SetFontSizeScaleEnabled(enableFontSizeScale);
+ }
+ break;
+ }
case Toolkit::DevelTextLabel::Property::ELLIPSIS_POSITION:
{
DevelText::EllipsisPosition::Type ellipsisPositionType(static_cast<DevelText::EllipsisPosition::Type>(-1)); // Set to invalid value to ensure a valid mode does get set
}
break;
}
+ case Toolkit::DevelTextLabel::Property::STRIKETHROUGH:
+ {
+ impl.mTextUpdateNeeded = SetStrikethroughProperties(impl.mController, value, Text::EffectStyle::DEFAULT) || impl.mTextUpdateNeeded;
+ break;
+ }
}
// Request relayout when text update is needed. It's necessary to call it
value = impl.mController->GetFontSizeScale();
break;
}
+ case Toolkit::DevelTextLabel::Property::ENABLE_FONT_SIZE_SCALE:
+ {
+ value = impl.mController->IsFontSizeScaleEnabled();
+ break;
+ }
case Toolkit::DevelTextLabel::Property::ELLIPSIS_POSITION:
{
value = impl.mController->GetEllipsisPosition();
break;
}
+ case Toolkit::DevelTextLabel::Property::STRIKETHROUGH:
+ {
+ GetStrikethroughProperties(impl.mController, value, Text::EffectStyle::DEFAULT);
+ break;
+ }
}
}
return mController->GetTextPosition(startIndex, endIndex);
}
-std::string TextLabel::AccessibleImpl::GetNameRaw()
+std::string TextLabel::AccessibleImpl::GetNameRaw() const
{
auto self = Toolkit::TextLabel::DownCast(Self());
return self.GetProperty(Toolkit::TextLabel::Property::TEXT).Get<std::string>();
return Toolkit::TextLabel::Property::TEXT;
}
-std::string TextLabel::AccessibleImpl::GetText(size_t startOffset, size_t endOffset)
+std::string TextLabel::AccessibleImpl::GetText(size_t startOffset, size_t endOffset) const
{
if(endOffset <= startOffset)
{
return text.substr(startOffset, endOffset - startOffset);
}
-size_t TextLabel::AccessibleImpl::GetCharacterCount()
+size_t TextLabel::AccessibleImpl::GetCharacterCount() const
{
auto self = Toolkit::TextLabel::DownCast(Self());
auto text = self.GetProperty(Toolkit::TextLabel::Property::TEXT).Get<std::string>();
return text.size();
}
-size_t TextLabel::AccessibleImpl::GetCursorOffset()
+size_t TextLabel::AccessibleImpl::GetCursorOffset() const
{
return {};
}
return {};
}
-Dali::Accessibility::Range TextLabel::AccessibleImpl::GetTextAtOffset(size_t offset, Dali::Accessibility::TextBoundary boundary)
+Dali::Accessibility::Range TextLabel::AccessibleImpl::GetTextAtOffset(size_t offset, Dali::Accessibility::TextBoundary boundary) const
{
auto self = Toolkit::TextLabel::DownCast(Self());
auto text = self.GetProperty(Toolkit::TextLabel::Property::TEXT).Get<std::string>();
return range;
}
-Dali::Accessibility::Range TextLabel::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex)
+Dali::Accessibility::Range TextLabel::AccessibleImpl::GetRangeOfSelection(size_t selectionIndex) const
{
// Since DALi supports only one selection indexes higher than 0 are ignored
if(selectionIndex > 0)
/**
* @brief This structure is to connect TextLabel with Accessible functions.
*/
- struct AccessibleImpl : public DevelControl::AccessibleImpl,
+ struct AccessibleImpl : public DevelControl::ControlAccessible,
public virtual Dali::Accessibility::Text,
public virtual Dali::Accessibility::Hypertext
{
- using DevelControl::AccessibleImpl::AccessibleImpl;
+ using DevelControl::ControlAccessible::ControlAccessible;
/**
* @copydoc Dali::Accessibility::Text::GetText()
*/
- std::string GetText(size_t startOffset, size_t endOffset) override;
+ std::string GetText(size_t startOffset, size_t endOffset) const override;
/**
* @copydoc Dali::Accessibility::Text::GetCharacterCount()
*/
- size_t GetCharacterCount() override;
+ size_t GetCharacterCount() const override;
/**
* @copydoc Dali::Accessibility::Text::GetCursorOffset()
*/
- size_t GetCursorOffset() override;
+ size_t GetCursorOffset() const override;
/**
* @copydoc Dali::Accessibility::Text::SetCursorOffset()
/**
* @copydoc Dali::Accessibility::Text::GetTextAtOffset()
*/
- Accessibility::Range GetTextAtOffset(size_t offset, Accessibility::TextBoundary boundary) override;
+ Accessibility::Range GetTextAtOffset(size_t offset, Accessibility::TextBoundary boundary) const override;
/**
* @copydoc Dali::Accessibility::Text::GetRangeOfSelection()
*/
- Accessibility::Range GetRangeOfSelection(size_t selectionIndex) override;
+ Accessibility::Range GetRangeOfSelection(size_t selectionIndex) const override;
/**
* @copydoc Dali::Accessibility::Text::RemoveSelection()
/**
* @copydoc Dali::Accessibility::Text::GetNameRaw()
*/
- std::string GetNameRaw() override;
+ std::string GetNameRaw() const override;
/**
* @copydoc Dali::Accessibility::Text::GetNamePropertyIndex()
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::DIALOG, true));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::DIALOG, true));
});
//Enable highightability
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::TOOL_BAR));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::TOOL_BAR));
});
}
DevelControl::SetAccessibilityConstructor(Self(), [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::TOOL_BAR));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::TOOL_BAR));
});
}
DevelControl::SetAccessibilityConstructor(self, [](Dali::Actor actor) {
return std::unique_ptr<Dali::Accessibility::Accessible>(
- new DevelControl::AccessibleImpl(actor, Dali::Accessibility::Role::VIDEO));
+ new DevelControl::ControlAccessible(actor, Dali::Accessibility::Role::VIDEO));
});
//Enable highightability
Actor self = Self();
self.SetProperty(Actor::Property::KEYBOARD_FOCUSABLE, true);
+ self.SetProperty(DevelActor::Property::TOUCH_FOCUSABLE, true);
self.TouchedSignal().Connect(this, &WebView::OnTouchEvent);
self.HoveredSignal().Connect(this, &WebView::OnHoverEvent);
self.WheelEventSignal().Connect(this, &WebView::OnWheelEvent);
varying mediump vec2 vTexCoord;
uniform sampler2D sTexture;
uniform sampler2D sStyle;
+uniform sampler2D sOverlayStyle;
uniform lowp vec4 uColor;
uniform lowp vec3 mixColor;
{
mediump vec4 textTexture = texture2D( sTexture, vTexCoord );
mediump vec4 styleTexture = texture2D( sStyle, vTexCoord );
+ mediump vec4 overlayStyleTexture = texture2D( sOverlayStyle, vTexCoord );
// Draw the text as overlay above the style
- gl_FragColor = ( textTexture + styleTexture * ( 1.0 - textTexture.a ) ) * uColor * vec4( mixColor, 1.0 );
+ gl_FragColor = ( overlayStyleTexture + textTexture * (1.0 - overlayStyleTexture.a) + styleTexture * ( 1.0 - textTexture.a ) * (1.0 - overlayStyleTexture.a) ) * uColor * vec4( mixColor, 1.0 );
}
varying mediump vec2 vTexCoord;
uniform sampler2D sTexture;
uniform sampler2D sStyle;
+uniform sampler2D sOverlayStyle;
uniform sampler2D sMask;
uniform lowp float uHasMultipleTextColors;
uniform lowp vec4 uTextColorAnimatable;
{
mediump vec4 textTexture = texture2D( sTexture, vTexCoord );
mediump vec4 styleTexture = texture2D( sStyle, vTexCoord );
+ mediump vec4 overlayStyleTexture = texture2D( sOverlayStyle, vTexCoord );
mediump float maskTexture = texture2D( sMask, vTexCoord ).r;
// Set the color of non-transparent pixel in text to what it is animated to.
textTexture.rgb = mix( textTexture.rgb, uTextColorAnimatable.rgb, vstep * maskTexture * ( 1.0 - uHasMultipleTextColors ) );
// Draw the text as overlay above the style
- gl_FragColor = ( textTexture + styleTexture * ( 1.0 - textTexture.a ) ) * uColor * vec4( mixColor, 1.0 );
+ gl_FragColor = ( overlayStyleTexture + textTexture * (1.0 - overlayStyleTexture.a) + styleTexture * ( 1.0 - textTexture.a ) * (1.0 - overlayStyleTexture.a) ) * uColor * vec4( mixColor, 1.0 );
}
varying mediump vec2 vTexCoord;
uniform sampler2D sTexture;
uniform sampler2D sStyle;
+uniform sampler2D sOverlayStyle;
uniform lowp vec4 uTextColorAnimatable;
uniform lowp vec4 uColor;
uniform lowp vec3 mixColor;
{
mediump float textTexture = texture2D( sTexture, vTexCoord ).r;
mediump vec4 styleTexture = texture2D( sStyle, vTexCoord );
+ mediump vec4 overlayStyleTexture = texture2D( sOverlayStyle, vTexCoord );
// Draw the text as overlay above the style
- gl_FragColor = ( uTextColorAnimatable * textTexture + styleTexture * ( 1.0 - uTextColorAnimatable.a * textTexture ) ) * uColor * vec4( mixColor, 1.0 );
-}
+ gl_FragColor = ( overlayStyleTexture + uTextColorAnimatable * textTexture * (1.0 - overlayStyleTexture.a) + styleTexture * ( 1.0 - uTextColorAnimatable.a * textTexture ) * (1.0 - overlayStyleTexture.a) ) * uColor * vec4( mixColor, 1.0 );
+}
\ No newline at end of file
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
const GlyphInfo* const glyphInfoBuffer = parameters.visualModel->mGlyphs.Begin();
CharacterIndex index;
GlyphMetrics glyphMetrics;
- MetricsPtr& metrics = parameters.metrics;
- GlyphIndex glyphIndex = 0u;
- Length numberOfGlyphs = 0u;
+ MetricsPtr& metrics = parameters.metrics;
+ GlyphIndex glyphIndex = 0u;
+ Length numberOfGlyphs = 0u;
if(isLastNewParagraph)
{
cursorInfo.lineHeight = GetLineHeight(newLine);
+ index = 0u;
const Length totalNumberOfCharacters = parameters.logicalModel->mText.Count();
- index = totalNumberOfCharacters - 1;
+ if(totalNumberOfCharacters > 0u)
+ {
+ index = totalNumberOfCharacters - 1u;
+ }
GetGlyphMetricsFromCharacterIndex(index, glyphInfoBuffer, charactersToGlyphBuffer, glyphsPerCharacterBuffer, metrics, glyphMetrics, glyphIndex, numberOfGlyphs);
{
enum Mask
{
- NONE = 0x0000,
- INPUT_COLOR = 0x0001,
- INPUT_FONT_FAMILY = 0x0002,
- INPUT_POINT_SIZE = 0x0004,
- INPUT_FONT_WEIGHT = 0x0008,
- INPUT_FONT_WIDTH = 0x0010,
- INPUT_FONT_SLANT = 0x0020,
- INPUT_LINE_SPACING = 0x0040,
- INPUT_UNDERLINE = 0x0080,
- INPUT_SHADOW = 0x0100,
- INPUT_EMBOSS = 0x0200,
- INPUT_OUTLINE = 0x0400
+ NONE = 0x0000,
+ INPUT_COLOR = 0x0001,
+ INPUT_FONT_FAMILY = 0x0002,
+ INPUT_POINT_SIZE = 0x0004,
+ INPUT_FONT_WEIGHT = 0x0008,
+ INPUT_FONT_WIDTH = 0x0010,
+ INPUT_FONT_SLANT = 0x0020,
+ INPUT_LINE_SPACING = 0x0040,
+ INPUT_UNDERLINE = 0x0080,
+ INPUT_SHADOW = 0x0100,
+ INPUT_EMBOSS = 0x0200,
+ INPUT_OUTLINE = 0x0400,
+ INPUT_STRIKETHROUGH = 0x0800
};
InputStyle()
shadowProperties(),
embossProperties(),
outlineProperties(),
+ strikethroughProperties(),
isDefaultColor(true),
isFamilyDefined(false),
isWeightDefined(false),
isUnderlineDefined(false),
isShadowDefined(false),
isEmbossDefined(false),
- isOutlineDefined(false)
+ isOutlineDefined(false),
+ isStrikethroughDefined(false)
{
}
isOutlineDefined = inputStyle.isOutlineDefined;
outlineProperties = inputStyle.outlineProperties;
+
+ isStrikethroughDefined = inputStyle.isStrikethroughDefined;
+ strikethroughProperties = inputStyle.strikethroughProperties;
}
/**
(underlineProperties != inputStyle.underlineProperties) ||
(shadowProperties != inputStyle.shadowProperties) ||
(embossProperties != inputStyle.embossProperties) ||
- (outlineProperties != inputStyle.outlineProperties))
+ (outlineProperties != inputStyle.outlineProperties) ||
+ (isStrikethroughDefined != inputStyle.isStrikethroughDefined))
{
return false;
}
{
mask = static_cast<Mask>(mask | INPUT_OUTLINE);
}
+ if(strikethroughProperties != inputStyle.strikethroughProperties)
+ {
+ mask = static_cast<Mask>(mask | INPUT_STRIKETHROUGH);
+ }
return mask;
}
float lineSpacing; ///< The line's spacing.
- std::string underlineProperties; ///< The underline properties string.
- std::string shadowProperties; ///< The shadow properties string.
- std::string embossProperties; ///< The emboss properties string.
- std::string outlineProperties; ///< The outline properties string.
+ std::string underlineProperties; ///< The underline properties string.
+ std::string shadowProperties; ///< The shadow properties string.
+ std::string embossProperties; ///< The emboss properties string.
+ std::string outlineProperties; ///< The outline properties string.
+ std::string strikethroughProperties; ///< The strikethrough properties string.
bool isDefaultColor : 1; ///< Whether the text's color is the default.
bool isFamilyDefined : 1; ///< Whether the font's family is defined.
bool isSlantDefined : 1; ///< Whether the font's slant is defined.
bool isSizeDefined : 1; ///< Whether the font's size is defined.
- bool isLineSpacingDefined : 1; ///< Whether the line spacing is defined.
- bool isUnderlineDefined : 1; ///< Whether the underline parameters are defined.
- bool isShadowDefined : 1; ///< Whether the shadow parameters are defined.
- bool isEmbossDefined : 1; ///< Whether the emboss parameters are defined.
- bool isOutlineDefined : 1; ///< Whether the outline parameters are defined.
+ bool isLineSpacingDefined : 1; ///< Whether the line spacing is defined.
+ bool isUnderlineDefined : 1; ///< Whether the underline parameters are defined.
+ bool isShadowDefined : 1; ///< Whether the shadow parameters are defined.
+ bool isEmbossDefined : 1; ///< Whether the emboss parameters are defined.
+ bool isOutlineDefined : 1; ///< Whether the outline parameters are defined.
+ bool isStrikethroughDefined : 1; ///< Whether the strikethrough parameters are defined.
};
} // namespace Text
};
/**
- * brief Struct used to generate the underline mesh.
+ * brief Struct used to generate the underline/striketthrough mesh.
* There is one Extent per line of text.
*/
struct Extent
mLeft(0.0f),
mRight(0.0f),
mUnderlinePosition(0.0f),
- mUnderlineThickness(0.0f),
+ mLineThickness(0.0f),
mMeshRecordIndex(0u),
- mUnderlineChunkId(0u)
+ mUnderlineChunkId(0u),
+ mStrikethroughPosition(0.0f)
{
}
float mLeft;
float mRight;
float mUnderlinePosition;
- float mUnderlineThickness;
+ float mLineThickness;
uint32_t mMeshRecordIndex;
uint32_t mUnderlineChunkId;
+ float mStrikethroughPosition;
};
struct MaxBlockSize
const Vector4& color,
uint16_t outline,
AtlasManager::AtlasSlot& slot,
- bool underlineGlyph,
+ bool decorationlineGlyph,
float currentUnderlinePosition,
- float currentUnderlineThickness,
+ float currentlineThickness,
std::vector<MeshRecord>& meshContainer,
Vector<TextCacheEntry>& newTextCache,
Vector<Extent>& extents,
- uint32_t underlineChunkId)
+ uint32_t underlineChunkId,
+ bool isGlyphCached)
{
// Generate mesh data for this quad, plugging in our supplied position
AtlasManager::Mesh2D newMesh;
mGlyphManager.GenerateMeshData(slot.mImageId, position, newMesh);
- TextCacheEntry textCacheEntry;
- textCacheEntry.mFontId = glyph.fontId;
- textCacheEntry.mImageId = slot.mImageId;
- textCacheEntry.mIndex = glyph.index;
- textCacheEntry.mOutlineWidth = outline;
- textCacheEntry.isItalic = glyph.isItalicRequired;
- textCacheEntry.isBold = glyph.isBoldRequired;
-
- newTextCache.PushBack(textCacheEntry);
+ if(!isGlyphCached)
+ {
+ TextCacheEntry textCacheEntry;
+ textCacheEntry.mFontId = glyph.fontId;
+ textCacheEntry.mImageId = slot.mImageId;
+ textCacheEntry.mIndex = glyph.index;
+ textCacheEntry.mOutlineWidth = outline;
+ textCacheEntry.isItalic = glyph.isItalicRequired;
+ textCacheEntry.isBold = glyph.isBoldRequired;
+
+ newTextCache.PushBack(textCacheEntry);
+ }
AtlasManager::Vertex2D* verticesBuffer = newMesh.mVertices.Begin();
newMesh,
extents,
position.y + glyph.yBearing,
- underlineGlyph,
+ decorationlineGlyph,
currentUnderlinePosition,
- currentUnderlineThickness,
+ currentlineThickness,
slot,
- underlineChunkId);
+ underlineChunkId,
+ position.y + (glyph.height * HALF));
}
void CreateActors(const std::vector<MeshRecord>& meshContainer,
std::vector<MeshRecord> meshContainer;
std::vector<MeshRecord> meshContainerOutline;
Vector<Extent> extents;
+ Vector<Extent> strikethroughExtents;
mDepth = depth;
const Vector2& textSize(view.GetLayoutSize());
const float underlineHeight = view.GetUnderlineHeight();
const uint16_t outlineWidth = view.GetOutlineWidth();
const Vector4& outlineColor(view.GetOutlineColor());
- const bool isOutline = 0u != outlineWidth;
- const GlyphInfo* hyphens = view.GetHyphens();
- const Length* hyphenIndices = view.GetHyphenIndices();
- const Length hyphensCount = view.GetHyphensCount();
+ const bool isOutline = 0u != outlineWidth;
+ const GlyphInfo* hyphens = view.GetHyphens();
+ const Length* hyphenIndices = view.GetHyphenIndices();
+ const Length hyphensCount = view.GetHyphensCount();
+ const bool strikethroughEnabled = view.IsStrikethroughEnabled();
+ const Vector4& strikethroughColor(view.GetStrikethroughColor());
+ const float strikethroughHeight = view.GetStrikethroughHeight();
// Elided text info. Indices according to elided text.
const auto startIndexOfGlyphs = view.GetStartIndexOfElidedGlyphs();
numberOfUnderlineRuns);
bool thereAreUnderlinedGlyphs = false;
+ bool strikethroughGlyphsExist = false;
- float currentUnderlinePosition = ZERO;
- float currentUnderlineThickness = underlineHeight;
- FontId lastFontId = 0;
- FontId lastUnderlinedFontId = 0;
- Style style = STYLE_NORMAL;
+ float currentUnderlinePosition = ZERO;
+ float currentUnderlineThickness = underlineHeight;
+ float currentStrikethroughThickness = strikethroughHeight;
+ FontId lastFontId = 0;
+ FontId lastUnderlinedFontId = 0;
+ Style style = STYLE_NORMAL;
if(fabsf(shadowOffset.x) > Math::MACHINE_EPSILON_1 || fabsf(shadowOffset.y) > Math::MACHINE_EPSILON_1)
{
const bool isGlyphUnderlined = underlineEnabled || IsGlyphUnderlined(i, underlineRuns);
thereAreUnderlinedGlyphs = thereAreUnderlinedGlyphs || isGlyphUnderlined;
+ strikethroughGlyphsExist = strikethroughGlyphsExist || strikethroughEnabled;
// No operation for white space
if(glyph.width && glyph.height)
{
// Are we still using the same fontId as previous
- if(isGlyphUnderlined && (glyph.fontId != lastUnderlinedFontId))
+ if((isGlyphUnderlined || strikethroughGlyphsExist) && (glyph.fontId != lastUnderlinedFontId))
{
// We need to fetch fresh font underline metrics
FontMetrics fontMetrics;
}
}
+ if(fabsf(strikethroughHeight) < Math::MACHINE_EPSILON_1000)
+ {
+ // Ensure strikethrough will be at least a pixel high
+ if(currentStrikethroughThickness < ONE)
+ {
+ currentStrikethroughThickness = ONE;
+ }
+ else
+ {
+ currentStrikethroughThickness = ceil(currentStrikethroughThickness);
+ }
+ }
+
// Clamp the underline position at the font descender and check for ( as EFL describes it ) a broken font
if(currentUnderlinePosition > descender)
{
meshContainer,
newTextCache,
extents,
- underlineChunkId);
+ underlineChunkId,
+ false);
+
+ if(strikethroughGlyphsExist)
+ {
+ GenerateMesh(glyph,
+ positionPlusOutlineOffset,
+ color,
+ NO_OUTLINE,
+ slot,
+ strikethroughGlyphsExist,
+ 0.0f,
+ currentStrikethroughThickness,
+ meshContainer,
+ newTextCache,
+ strikethroughExtents,
+ 0u,
+ true);
+ }
lastFontId = glyph.fontId; // Prevents searching for existing blocksizes when string of the same fontId.
}
meshContainerOutline,
newTextCache,
extents,
- 0u);
+ 0u,
+ false);
}
//The new underlined chunk. Add new id if they are not consecutive indices (this is for Markup case)
GenerateUnderlines(meshContainer, extents, underlineColor);
}
+ if(strikethroughGlyphsExist)
+ {
+ // Check to see if any of the text needs a strikethrough
+ GenerateStrikethrough(meshContainer, strikethroughExtents, strikethroughColor);
+ }
+
// For each MeshData object, create a mesh actor and add to the renderable actor
bool isShadowDrawn = false;
if(!meshContainerOutline.empty())
AtlasManager::Mesh2D& newMesh,
Vector<Extent>& extents,
float baseLine,
- bool underlineGlyph,
+ bool decorationlineGlyph,
float underlinePosition,
- float underlineThickness,
+ float lineThickness,
AtlasManager::AtlasSlot& slot,
- uint32_t underlineChunkId)
+ uint32_t underlineChunkId,
+ float strikethroughPosition)
{
if(slot.mImageId)
{
// Append the mesh to the existing mesh and adjust any extents
Toolkit::Internal::AtlasMeshFactory::AppendMesh(mIt->mMesh, newMesh);
- if(underlineGlyph)
+ if(decorationlineGlyph)
{
AdjustExtents(extents,
meshContainer,
right,
baseLine,
underlinePosition,
- underlineThickness,
- underlineChunkId);
+ lineThickness,
+ underlineChunkId,
+ strikethroughPosition);
}
return;
meshRecord.mMesh = newMesh;
meshContainer.push_back(meshRecord);
- if(underlineGlyph)
+ if(decorationlineGlyph)
{
// Adjust extents for this new meshrecord
AdjustExtents(extents,
right,
baseLine,
underlinePosition,
- underlineThickness,
- underlineChunkId);
+ lineThickness,
+ underlineChunkId,
+ strikethroughPosition);
}
}
}
float right,
float baseLine,
float underlinePosition,
- float underlineThickness,
- uint32_t underlineChunkId)
+ float lineThickness,
+ uint32_t underlineChunkId,
+ float strikethroughPosition)
{
bool foundExtent = false;
for(Vector<Extent>::Iterator eIt = extents.Begin(),
{
eIt->mUnderlinePosition = underlinePosition;
}
- if(underlineThickness > eIt->mUnderlineThickness)
+ if(lineThickness > eIt->mLineThickness)
{
- eIt->mUnderlineThickness = underlineThickness;
+ eIt->mLineThickness = lineThickness;
}
}
}
if(!foundExtent)
{
Extent extent;
- extent.mLeft = left;
- extent.mRight = right;
- extent.mBaseLine = baseLine;
- extent.mUnderlinePosition = underlinePosition;
- extent.mUnderlineThickness = underlineThickness;
- extent.mMeshRecordIndex = index;
- extent.mUnderlineChunkId = underlineChunkId;
+ extent.mLeft = left;
+ extent.mRight = right;
+ extent.mBaseLine = baseLine;
+ extent.mUnderlinePosition = underlinePosition;
+ extent.mMeshRecordIndex = index;
+ extent.mUnderlineChunkId = underlineChunkId;
+ extent.mLineThickness = lineThickness;
+ extent.mStrikethroughPosition = strikethroughPosition;
extents.PushBack(extent);
}
}
// Make sure we don't hit texture edge for single pixel texture ( filled pixel is in top left of every atlas )
float u = HALF / uv.x;
float v = HALF / uv.y;
- float thickness = eIt->mUnderlineThickness;
+ float thickness = eIt->mLineThickness;
float baseLine = eIt->mBaseLine + eIt->mUnderlinePosition - (thickness * HALF);
float tlx = eIt->mLeft;
float brx = eIt->mRight;
}
}
+ void GenerateStrikethrough(std::vector<MeshRecord>& meshRecords,
+ Vector<Extent>& extents,
+ const Vector4& strikethroughColor)
+ {
+ AtlasManager::Mesh2D newMesh;
+ unsigned short faceIndex = 0;
+ for(Vector<Extent>::ConstIterator eIt = extents.Begin(),
+ eEndIt = extents.End();
+ eIt != eEndIt;
+ ++eIt)
+ {
+ AtlasManager::Vertex2D vert;
+ uint32_t index = eIt->mMeshRecordIndex;
+ Vector2 uv = mGlyphManager.GetAtlasSize(meshRecords[index].mAtlasId);
+
+ // Make sure we don't hit texture edge for single pixel texture ( filled pixel is in top left of every atlas )
+ float u = HALF / uv.x;
+ float v = HALF / uv.y;
+ float thickness = eIt->mLineThickness;
+ float tlx = eIt->mLeft;
+ float brx = eIt->mRight;
+ float strikethroughPosition = eIt->mStrikethroughPosition;
+
+ vert.mPosition.x = tlx;
+ vert.mPosition.y = strikethroughPosition;
+ vert.mTexCoords.x = ZERO;
+ vert.mTexCoords.y = ZERO;
+ vert.mColor = strikethroughColor;
+ newMesh.mVertices.PushBack(vert);
+
+ vert.mPosition.x = brx;
+ vert.mPosition.y = strikethroughPosition;
+ vert.mTexCoords.x = u;
+ vert.mColor = strikethroughColor;
+ newMesh.mVertices.PushBack(vert);
+
+ vert.mPosition.x = tlx;
+ vert.mPosition.y = strikethroughPosition + thickness;
+ vert.mTexCoords.x = ZERO;
+ vert.mTexCoords.y = v;
+ vert.mColor = strikethroughColor;
+ newMesh.mVertices.PushBack(vert);
+
+ vert.mPosition.x = brx;
+ vert.mPosition.y = strikethroughPosition + thickness;
+ vert.mTexCoords.x = u;
+ vert.mColor = strikethroughColor;
+ newMesh.mVertices.PushBack(vert);
+
+ // Six indices in counter clockwise winding
+ newMesh.mIndices.PushBack(faceIndex + 1u);
+ newMesh.mIndices.PushBack(faceIndex);
+ newMesh.mIndices.PushBack(faceIndex + 2u);
+ newMesh.mIndices.PushBack(faceIndex + 2u);
+ newMesh.mIndices.PushBack(faceIndex + 3u);
+ newMesh.mIndices.PushBack(faceIndex + 1u);
+ faceIndex += 4;
+
+ Toolkit::Internal::AtlasMeshFactory::AppendMesh(meshRecords[index].mMesh, newMesh);
+ }
+ }
+
Actor mActor; ///< The actor parent which renders the text
AtlasGlyphManager mGlyphManager; ///< Glyph Manager to handle upload and caching
TextAbstraction::FontClient mFontClient; ///< The font client used to supply glyph information
{
namespace
{
+const float HALF(0.5f);
/**
* @brief Data struct used to set the buffer of the glyph's bitmap into the final bitmap's buffer.
*/
}
/// Helper method to fetch the underline metrics for the specified font glyph
-void FetchFontUnderlineMetrics(
+void FetchFontDecorationlinesMetrics(
TextAbstraction::FontClient& fontClient,
const GlyphInfo* const glyphInfo,
float& currentUnderlinePosition,
const float underlineHeight,
float& currentUnderlineThickness,
float& maxUnderlineThickness,
- FontId& lastUnderlinedFontId)
+ FontId& lastlinedFontId,
+ const float strikethroughHeight,
+ float& currentStrikethroughThickness,
+ float& maxStrikethroughThickness)
{
FontMetrics fontMetrics;
fontClient.GetFontMetrics(glyphInfo->fontId, fontMetrics);
}
}
+ if(fabsf(strikethroughHeight) < Math::MACHINE_EPSILON_1000)
+ {
+ // Ensure strikethrough will be at least a pixel high
+ if(currentStrikethroughThickness < 1.0f)
+ {
+ currentStrikethroughThickness = 1.0f;
+ }
+ else
+ {
+ currentStrikethroughThickness = ceil(currentStrikethroughThickness);
+ }
+ }
+
// The underline thickness should be the max underline thickness of all glyphs of the line.
if(currentUnderlineThickness > maxUnderlineThickness)
{
maxUnderlineThickness = currentUnderlineThickness;
}
+ // The strikethrough thickness should be the max strikethrough thickness of all glyphs of the line.
+ if(currentStrikethroughThickness > maxStrikethroughThickness)
+ {
+ maxStrikethroughThickness = currentStrikethroughThickness;
+ }
+
// Clamp the underline position at the font descender and check for ( as EFL describes it ) a broken font
if(currentUnderlinePosition > descender)
{
currentUnderlinePosition = 1.0f;
}
- lastUnderlinedFontId = glyphInfo->fontId;
+ lastlinedFontId = glyphInfo->fontId;
}
/// Draws the specified color to the pixel buffer
return glyphData.bitmapBuffer;
}
+/// Draws the specified strikethrough color to the buffer
+void DrawStrikethrough(
+ const Vector4& strikethroughColor,
+ const unsigned int bufferWidth,
+ const unsigned int bufferHeight,
+ GlyphData& glyphData,
+ const float baseline,
+ const LineRun& line,
+ const float maxStrikethroughThickness,
+ const float lineExtentLeft,
+ const float lineExtentRight,
+ float strikethroughStartingYPosition)
+{
+ uint32_t* bitmapBuffer = reinterpret_cast<uint32_t*>(glyphData.bitmapBuffer.GetBuffer());
+
+ for(unsigned int y = strikethroughStartingYPosition; y < strikethroughStartingYPosition + maxStrikethroughThickness; y++)
+ {
+ if(y > bufferHeight - 1)
+ {
+ // Do not write out of bounds.
+ break;
+ }
+
+ for(unsigned int x = glyphData.horizontalOffset + lineExtentLeft; x <= glyphData.horizontalOffset + lineExtentRight; x++)
+ {
+ if(x > bufferWidth - 1)
+ {
+ // Do not write out of bounds.
+ break;
+ }
+
+ WriteColorToPixelBuffer(glyphData, bitmapBuffer, strikethroughColor, x, y);
+ }
+ }
+}
+
} // namespace
TypesetterPtr Typesetter::New(const ModelInterface* const model)
// Generate the image buffer as an alpha mask for color glyphs.
imageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_MASK, ignoreHorizontalAlignment, pixelFormat, penX, penY, startIndexOfGlyphs, endIndexOfGlyphs);
}
- else if(RENDER_NO_TEXT == behaviour)
+ else if(RENDER_NO_TEXT == behaviour || RENDER_OVERLAY_STYLE == behaviour)
{
// Generate an empty image buffer so that it can been combined with the image buffers for styles
imageBuffer = Devel::PixelBuffer::New(bufferWidth, bufferHeight, Pixel::RGBA8888);
{
// Generate the outline if enabled
const uint16_t outlineWidth = mModel->GetOutlineWidth();
- if(outlineWidth != 0u)
+ if(outlineWidth != 0u && RENDER_OVERLAY_STYLE != behaviour)
{
// Create the image buffer for outline
Devel::PixelBuffer outlineImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_OUTLINE, ignoreHorizontalAlignment, pixelFormat, penX, penY, startIndexOfGlyphs, endIndexOfGlyphs);
// Generate the shadow if enabled
const Vector2& shadowOffset = mModel->GetShadowOffset();
- if(fabsf(shadowOffset.x) > Math::MACHINE_EPSILON_1 || fabsf(shadowOffset.y) > Math::MACHINE_EPSILON_1)
+ if(RENDER_OVERLAY_STYLE != behaviour && (fabsf(shadowOffset.x) > Math::MACHINE_EPSILON_1 || fabsf(shadowOffset.y) > Math::MACHINE_EPSILON_1))
{
// Create the image buffer for shadow
Devel::PixelBuffer shadowImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_SHADOW, ignoreHorizontalAlignment, pixelFormat, penX, penY, startIndexOfGlyphs, endIndexOfGlyphs);
// Generate the underline if enabled
const bool underlineEnabled = mModel->IsUnderlineEnabled();
- if(underlineEnabled)
+ if(underlineEnabled && RENDER_OVERLAY_STYLE == behaviour)
{
// Create the image buffer for underline
Devel::PixelBuffer underlineImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_UNDERLINE, ignoreHorizontalAlignment, pixelFormat, penX, penY, startIndexOfGlyphs, endIndexOfGlyphs);
// Generate the background if enabled
const bool backgroundEnabled = mModel->IsBackgroundEnabled();
const bool backgroundMarkupSet = mModel->IsMarkupBackgroundColorSet();
- if(backgroundEnabled || backgroundMarkupSet)
+ if((backgroundEnabled || backgroundMarkupSet) && RENDER_OVERLAY_STYLE != behaviour)
{
Devel::PixelBuffer backgroundImageBuffer;
imageBuffer = CombineImageBuffer(imageBuffer, backgroundImageBuffer, bufferWidth, bufferHeight);
}
+ // Generate the strikethrough if enabled
+ const bool strikethroughEnabled = mModel->IsStrikethroughEnabled();
+ if(strikethroughEnabled && RENDER_OVERLAY_STYLE == behaviour)
+ {
+ // Create the image buffer for strikethrough
+ Devel::PixelBuffer strikethroughImageBuffer = CreateImageBuffer(bufferWidth, bufferHeight, Typesetter::STYLE_STRIKETHROUGH, ignoreHorizontalAlignment, pixelFormat, penX, penY, 0u, endIndexOfGlyphs);
+
+ // Combine the two buffers
+ imageBuffer = CombineImageBuffer(imageBuffer, strikethroughImageBuffer, bufferWidth, bufferHeight);
+ }
+
// Markup-Processor
imageBuffer = ApplyMarkupProcessorOnPixelBuffer(imageBuffer, bufferWidth, bufferHeight, ignoreHorizontalAlignment, pixelFormat, penX, penY);
const Vector4& underlineColor = mModel->GetUnderlineColor();
const float underlineHeight = mModel->GetUnderlineHeight();
+ const bool strikethroughEnabled = mModel->IsStrikethroughEnabled();
+ const Vector4& strikethroughColor = mModel->GetStrikethroughColor();
+ const float strikethroughHeight = mModel->GetStrikethroughHeight();
+
// Get the underline runs.
const Length numberOfUnderlineRuns = mModel->GetNumberOfUnderlineRuns();
Vector<GlyphRun> underlineRuns;
mModel->GetUnderlineRuns(underlineRuns.Begin(), 0u, numberOfUnderlineRuns);
bool thereAreUnderlinedGlyphs = false;
+ bool strikethroughGlyphsExist = false;
- float currentUnderlinePosition = 0.0f;
- float currentUnderlineThickness = underlineHeight;
- float maxUnderlineThickness = currentUnderlineThickness;
+ float currentUnderlinePosition = 0.0f;
+ float currentUnderlineThickness = underlineHeight;
+ float maxUnderlineThickness = currentUnderlineThickness;
+ float currentStrikethroughThickness = strikethroughHeight;
+ float maxStrikethroughThickness = currentStrikethroughThickness;
+ float strikethroughStartingYPosition = 0.0f;
FontId lastUnderlinedFontId = 0;
const bool underlineGlyph = underlineEnabled || IsGlyphUnderlined(glyphIndex, underlineRuns);
thereAreUnderlinedGlyphs = thereAreUnderlinedGlyphs || underlineGlyph;
+ strikethroughGlyphsExist = strikethroughGlyphsExist || strikethroughEnabled;
+
// Are we still using the same fontId as previous
- if(underlineGlyph && (glyphInfo->fontId != lastUnderlinedFontId))
+ if((strikethroughEnabled || underlineGlyph) && (glyphInfo->fontId != lastUnderlinedFontId))
{
// We need to fetch fresh font underline metrics
- FetchFontUnderlineMetrics(fontClient, glyphInfo, currentUnderlinePosition, underlineHeight, currentUnderlineThickness, maxUnderlineThickness, lastUnderlinedFontId);
+ FetchFontDecorationlinesMetrics(fontClient, glyphInfo, currentUnderlinePosition, underlineHeight, currentUnderlineThickness, maxUnderlineThickness, lastUnderlinedFontId, strikethroughHeight, currentStrikethroughThickness, maxStrikethroughThickness);
} // underline
// Retrieves the glyph's position.
outlineWidth = 0.0f;
}
- if(style != Typesetter::STYLE_UNDERLINE)
+ if(style != Typesetter::STYLE_UNDERLINE && style != Typesetter::STYLE_STRIKETHROUGH)
{
fontClient.CreateBitmap(glyphInfo->fontId,
glyphInfo->index,
DrawBackgroundColor(mModel->GetBackgroundColor(), bufferWidth, bufferHeight, glyphData, baseline, line, lineExtentLeft, lineExtentRight);
}
+ // Draw the strikethrough from the leftmost glyph to the rightmost glyph
+ if(strikethroughGlyphsExist && style == Typesetter::STYLE_STRIKETHROUGH)
+ {
+ //TODO : The currently implemented strikethrough creates a strikethrough on the line level. We need to create different strikethroughs the case of glyphs with different sizes.
+ strikethroughStartingYPosition = (glyphData.verticalOffset + baseline + currentUnderlinePosition) - ((line.ascender) * HALF); // Since Free Type font doesn't contain the strikethrough-position property, strikethrough position will be calculated by moving the underline position upwards by half the value of the line height.
+ DrawStrikethrough(strikethroughColor, bufferWidth, bufferHeight, glyphData, baseline, line, maxStrikethroughThickness, lineExtentLeft, lineExtentRight, strikethroughStartingYPosition);
+ }
+
// Increases the vertical offset with the line's descender.
glyphData.verticalOffset += static_cast<int>(-line.descender);
}
enum RenderBehaviour
{
RENDER_TEXT_AND_STYLES, ///< Render both the text and its styles
- RENDER_NO_TEXT, ///< Do not render the text itself
+ RENDER_NO_TEXT, ///< Do not render the text itself but render the background styles such as outline and background.
RENDER_NO_STYLES, ///< Do not render any styles
- RENDER_MASK ///< Render an alpha mask (for color glyphs with no color animation, e.g. emoji)
+ RENDER_MASK, ///< Render an alpha mask (for color glyphs with no color animation, e.g. emoji)
+ RENDER_OVERLAY_STYLE ///< Do not render the text itself but render the style but overlay the style on the text (foreground styles such as strikethrough and underline)
};
/**
*/
enum Style
{
- STYLE_NONE, ///< No style
- STYLE_MASK, ///< Alpha mask
- STYLE_SHADOW, ///< Hard shadow
- STYLE_SOFT_SHADOW, ///< Soft shadow
- STYLE_UNDERLINE, ///< Underline
- STYLE_OUTLINE, ///< Outline
- STYLE_BACKGROUND ///< Text background
+ STYLE_NONE, ///< No style
+ STYLE_MASK, ///< Alpha mask
+ STYLE_SHADOW, ///< Hard shadow
+ STYLE_SOFT_SHADOW, ///< Soft shadow
+ STYLE_UNDERLINE, ///< Underline
+ STYLE_OUTLINE, ///< Outline
+ STYLE_BACKGROUND, ///< Text background
+ STYLE_STRIKETHROUGH ///< Strikethrough
};
public: // Constructor.
} // namespace Dali
-#endif // DALI_TOOLKIT_TEXT_TYPESETTER_H
+#endif // DALI_TOOLKIT_TEXT_TYPESETTER_H
\ No newline at end of file
}
}
+float ViewModel::GetStrikethroughHeight() const
+{
+ return mModel->GetStrikethroughHeight();
+}
+
+const Vector4& ViewModel::GetStrikethroughColor() const
+{
+ return mModel->GetStrikethroughColor();
+}
+
+bool ViewModel::IsStrikethroughEnabled() const
+{
+ return mModel->IsStrikethroughEnabled();
+}
+
} // namespace Text
} // namespace Toolkit
*/
void ElideGlyphs();
+ float GetStrikethroughHeight() const override;
+
+ const Vector4& GetStrikethroughColor() const override;
+
+ bool IsStrikethroughEnabled() const override;
+
private:
const ModelInterface* const mModel; ///< Pointer to the text's model.
Vector<GlyphInfo> mElidedGlyphs; ///< Stores the glyphs of the elided text.
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
namespace Dali::Toolkit::Text
{
-
namespace
{
#if defined(DEBUG_ENABLED)
// Check whether the indices for updating the text is valid
if(numberOfCharacters > 0u &&
(impl.mTextUpdateInfo.mParagraphCharacterIndex > numberOfCharacters ||
- impl.mTextUpdateInfo.mRequestedNumberOfCharacters > numberOfCharacters))
+ impl.mTextUpdateInfo.mRequestedNumberOfCharacters > numberOfCharacters))
{
std::string currentText;
Utf32ToUtf8(impl.mModel->mLogicalModel->mText.Begin(), numberOfCharacters, currentText);
lineBreakInfo);
if(impl.mModel->mLineWrapMode == ((Text::LineWrap::Mode)DevelText::LineWrap::HYPHENATION) ||
- impl.mModel->mLineWrapMode == ((Text::LineWrap::Mode)DevelText::LineWrap::MIXED))
+ impl.mModel->mLineWrapMode == ((Text::LineWrap::Mode)DevelText::LineWrap::MIXED))
{
CharacterIndex end = startIndex + requestedNumberOfCharacters;
LineBreakInfo* lineBreakInfoBuffer = lineBreakInfo.Begin();
// Get the default font's description.
TextAbstraction::FontDescription defaultFontDescription;
- TextAbstraction::PointSize26Dot6 defaultPointSize = TextAbstraction::FontClient::DEFAULT_POINT_SIZE * impl.mFontSizeScale;
+ TextAbstraction::PointSize26Dot6 defaultPointSize = TextAbstraction::FontClient::DEFAULT_POINT_SIZE * impl.GetFontSizeScale();
//Get the number of points per one unit of point-size
uint32_t numberOfPointsPerOneUnitOfPointSize = impl.mFontClient.GetNumberOfPointsPerOneUnitOfPointSize();
defaultFontDescription = impl.mEventData->mPlaceholderFont->mFontDescription;
if(impl.mEventData->mPlaceholderFont->sizeDefined)
{
- defaultPointSize = impl.mEventData->mPlaceholderFont->mDefaultPointSize * impl.mFontSizeScale * numberOfPointsPerOneUnitOfPointSize;
+ defaultPointSize = impl.mEventData->mPlaceholderFont->mDefaultPointSize * impl.GetFontSizeScale() * numberOfPointsPerOneUnitOfPointSize;
}
}
else if(nullptr != impl.mFontDefaults)
}
else
{
- defaultPointSize = impl.mFontDefaults->mDefaultPointSize * impl.mFontSizeScale * numberOfPointsPerOneUnitOfPointSize;
+ defaultPointSize = impl.mFontDefaults->mDefaultPointSize * impl.GetFontSizeScale() * numberOfPointsPerOneUnitOfPointSize;
}
}
}
if((nullptr != impl.mEventData) &&
- impl.mEventData->mPreEditFlag &&
+ impl.mEventData->mPreEditFlag &&
(0u != impl.mModel->mVisualModel->mCharactersToGlyph.Count()))
{
Dali::InputMethodContext::PreEditAttributeDataContainer attrs;
if((Controller::NO_OPERATION != (Controller::SHAPE_TEXT & operations)) &&
!((nullptr != impl.mEventData) &&
- impl.mEventData->mPreEditFlag &&
+ impl.mEventData->mPreEditFlag &&
(0u != impl.mModel->mVisualModel->mCharactersToGlyph.Count())))
{
//Mark-up processor case
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
if(nullptr == mFontDefaults)
{
TextAbstraction::FontDescription fontDescription;
- defaultFontId = mFontClient.GetFontId(fontDescription, TextAbstraction::FontClient::DEFAULT_POINT_SIZE * mFontSizeScale);
+ defaultFontId = mFontClient.GetFontId(fontDescription, TextAbstraction::FontClient::DEFAULT_POINT_SIZE * GetFontSizeScale());
}
else
{
- defaultFontId = mFontDefaults->GetFontId(mFontClient, mFontDefaults->mDefaultPointSize * mFontSizeScale);
+ defaultFontId = mFontDefaults->GetFontId(mFontClient, mFontDefaults->mDefaultPointSize * GetFontSizeScale());
}
Text::FontMetrics fontMetrics;
#define DALI_TOOLKIT_TEXT_CONTROLLER_IMPL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
mTextFitMaxSize(DEFAULT_TEXTFIT_MAX),
mTextFitStepSize(DEFAULT_TEXTFIT_STEP),
mFontSizeScale(DEFAULT_FONT_SIZE_SCALE),
+ mFontSizeScaleEnabled(true),
mTextFitEnabled(false),
mTextFitChanged(false),
mIsLayoutDirectionChanged(false)
}
}
+ float GetFontSizeScale()
+ {
+ return mFontSizeScaleEnabled ? mFontSizeScale : 1.0f;
+ }
+
/**
* @brief Helper to notify InputMethodContext with surrounding text & cursor changes.
*/
bool mShadowSetByString : 1; ///< Set when shadow is set by string (legacy) instead of map
bool mOutlineSetByString : 1; ///< Set when outline is set by string (legacy) instead of map
bool mFontStyleSetByString : 1; ///< Set when font style is set by string (legacy) instead of map
+ bool mStrikethroughSetByString : 1; ///< Set when strikethrough is set by string (legacy) instead of map
bool mShouldClearFocusOnEscape : 1; ///< Whether text control should clear key input focus
LayoutDirection::Type mLayoutDirection; ///< Current system language direction
float mTextFitMaxSize; ///< Maximum Font Size for text fit. Default 100
float mTextFitStepSize; ///< Step Size for font intervalse. Default 1
float mFontSizeScale; ///< Scale value for Font Size. Default 1.0
+ bool mFontSizeScaleEnabled : 1; ///< Whether the font size scale is enabled.
bool mTextFitEnabled : 1; ///< Whether the text's fit is enabled.
bool mTextFitChanged : 1; ///< Whether the text fit property has changed.
bool mIsLayoutDirectionChanged : 1; ///< Whether the layout has changed.
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
startOfSelectedText,
lengthOfSelectedText);
- fontDescriptionRun.size = static_cast<PointSize26Dot6>(size * controller.mImpl->mFontSizeScale * 64.f);
+ fontDescriptionRun.size = static_cast<PointSize26Dot6>(size * controller.mImpl->GetFontSizeScale() * 64.f);
fontDescriptionRun.sizeDefined = true;
controller.mImpl->mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
if(addFontSizeRun)
{
- fontDescriptionRun.size = static_cast<PointSize26Dot6>(inputStyle.size * impl.mFontSizeScale * 64.f);
+ fontDescriptionRun.size = static_cast<PointSize26Dot6>(inputStyle.size * impl.GetFontSizeScale() * 64.f);
fontDescriptionRun.sizeDefined = true;
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
{
mImpl->mFontSizeScale = scale;
+ // No relayout is required
+ if(!mImpl->mFontSizeScaleEnabled) return;
+
// Update the cursor position if it's in editing mode
UpdateCursorPosition(mImpl->mEventData);
return mImpl->mFontDefaults ? mImpl->mFontSizeScale : 1.0f;
}
+void Controller::SetFontSizeScaleEnabled(bool enabled)
+{
+ mImpl->mFontSizeScaleEnabled = enabled;
+
+ // Update the cursor position if it's in editing mode
+ UpdateCursorPosition(mImpl->mEventData);
+
+ // Clear the font-specific data
+ mImpl->ClearFontData();
+
+ mImpl->RequestRelayout();
+}
+
+bool Controller::IsFontSizeScaleEnabled() const
+{
+ return mImpl->mFontSizeScaleEnabled;
+}
+
void Controller::SetDefaultFontSize(float fontSize, FontSizeType type)
{
EnsureCreated(mImpl->mFontDefaults);
mImpl->mFontStyleSetByString = setByString;
}
+void Controller::SetStrikethroughHeight(float height)
+{
+ mImpl->mModel->mVisualModel->SetStrikethroughHeight(height);
+
+ mImpl->RequestRelayout();
+}
+
+float Controller::GetStrikethroughHeight() const
+{
+ return mImpl->mModel->mVisualModel->GetStrikethroughHeight();
+}
+
+void Controller::SetStrikethroughColor(const Vector4& color)
+{
+ mImpl->mModel->mVisualModel->SetStrikethroughColor(color);
+
+ mImpl->RequestRelayout();
+}
+
+const Vector4& Controller::GetStrikethroughColor() const
+{
+ return mImpl->mModel->mVisualModel->GetStrikethroughColor();
+}
+
+void Controller::SetStrikethroughEnabled(bool enabled)
+{
+ mImpl->mModel->mVisualModel->SetStrikethroughEnabled(enabled);
+
+ mImpl->RequestRelayout();
+}
+
+bool Controller::IsStrikethroughEnabled() const
+{
+ return mImpl->mModel->mVisualModel->IsStrikethroughEnabled();
+}
+
+void Controller::SetInputStrikethroughProperties(const std::string& strikethroughProperties)
+{
+ if(NULL != mImpl->mEventData)
+ {
+ mImpl->mEventData->mInputStyle.strikethroughProperties = strikethroughProperties;
+ }
+}
+
+const std::string& Controller::GetInputStrikethroughProperties() const
+{
+ return (NULL != mImpl->mEventData) ? mImpl->mEventData->mInputStyle.strikethroughProperties : EMPTY_STRING;
+}
+
+bool Controller::IsStrikethroughSetByString()
+{
+ return mImpl->mStrikethroughSetByString;
+}
+
+void Controller::StrikethroughSetByString(bool setByString)
+{
+ mImpl->mStrikethroughSetByString = setByString;
+}
+
Layout::Engine& Controller::GetLayoutEngine()
{
return mImpl->mLayoutEngine;
#define DALI_TOOLKIT_TEXT_CONTROLLER_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
*/
void FontStyleSetByString(bool setByString);
+ /**
+ * @brief Query if Strikethrough settings were provided by string or map
+ * @return bool true if set by string
+ */
+ bool IsStrikethroughSetByString();
+
+ /**
+ * Set method Strikethrough setting were set by
+ * @param[in] bool, true if set by string
+ */
+ void StrikethroughSetByString(bool setByString);
+
+ /**
+ * @brief Set the override used for strikethrough height, 0 indicates height will be supplied by font metrics
+ *
+ * @param[in] height The height in pixels of the strikethrough
+ */
+ void SetStrikethroughHeight(float height);
+
+ /**
+ * @brief Retrieves the override height of an strikethrough, 0 indicates height is supplied by font metrics
+ *
+ * @return The height of the strikethrough, or 0 if height is not overrided.
+ */
+ float GetStrikethroughHeight() const;
+
+ /**
+ * @brief Set the strikethrough color.
+ *
+ * @param[in] color color of strikethrough.
+ */
+ void SetStrikethroughColor(const Vector4& color);
+
+ /**
+ * @brief Retrieve the strikethrough color.
+ *
+ * @return The strikethrough color.
+ */
+ const Vector4& GetStrikethroughColor() const;
+
+ /**
+ * @brief Set the strikethrough enabled flag.
+ *
+ * @param[in] enabled The strikethrough enabled flag.
+ */
+ void SetStrikethroughEnabled(bool enabled);
+
+ /**
+ * @brief Returns whether the text has a strikethrough or not.
+ *
+ * @return The strikethrough state.
+ */
+ bool IsStrikethroughEnabled() const;
+
public: // Update.
/**
* @brief Replaces any text previously set.
float GetFontSizeScale() const;
/**
+ * @brief Set the font size scale enabled flag.
+ *
+ * @param[in] enabled whether to enable the font size scale.
+ */
+ void SetFontSizeScaleEnabled(bool enabled);
+
+ /**
+ * @brief Returns whether the font size scale is enabled or not.
+ *
+ * @return @e true if the font size scale is enabled, otherwise returns @e false.
+ */
+ bool IsFontSizeScaleEnabled() const;
+
+ /**
* @brief Sets the Placeholder text font size.
* @param[in] fontSize The placeholder text font size
* @param[in] type The font size type is point size or pixel size
const std::string& GetInputOutlineProperties() const;
/**
+ * @brief Sets the input strikethrough's properties string.
+ *
+ * @note The string is stored to be recovered.
+ *
+ * @param[in] strikethroughProperties The strikethrough's properties string.
+ */
+ void SetInputStrikethroughProperties(const std::string& strikethroughProperties);
+
+ /**
+ * @brief Retrieves the input strikethrough's properties string.
+ *
+ * @return The strikethrough's properties string.
+ */
+ const std::string& GetInputStrikethroughProperties() const;
+
+ /**
* @brief Set the control's interface.
*
* @param[in] controlInterface The control's interface.
return 0u == numberOfItems;
}
+bool ParseStrikethroughProperties(const Property::Map& strikethroughPropertiesMap,
+ bool& enabled,
+ bool& colorDefined,
+ Vector4& color,
+ bool& heightDefined,
+ float& height)
+{
+ const unsigned int numberOfItems = strikethroughPropertiesMap.Count();
+
+ // Parses and applies the style.
+ for(unsigned int index = 0u; index < numberOfItems; ++index)
+ {
+ const KeyValuePair& valueGet = strikethroughPropertiesMap.GetKeyValue(index);
+
+ if((DevelText::Strikethrough::Property::ENABLE == valueGet.first.indexKey) || (ENABLE_KEY == valueGet.first.stringKey))
+ {
+ /// Enable key.
+ if(valueGet.second.GetType() == Dali::Property::STRING)
+ {
+ const std::string enableStr = valueGet.second.Get<std::string>();
+ enabled = Text::TokenComparison(TRUE_TOKEN, enableStr.c_str(), enableStr.size());
+ }
+ else
+ {
+ enabled = valueGet.second.Get<bool>();
+ }
+ }
+ else if((DevelText::Strikethrough::Property::COLOR == valueGet.first.indexKey) || (COLOR_KEY == valueGet.first.stringKey))
+ {
+ /// Color key.
+ colorDefined = true;
+
+ if(valueGet.second.GetType() == Dali::Property::STRING)
+ {
+ const std::string colorStr = valueGet.second.Get<std::string>();
+ Text::ColorStringToVector4(colorStr.c_str(), colorStr.size(), color);
+ }
+ else
+ {
+ color = valueGet.second.Get<Vector4>();
+ }
+ }
+ else if((DevelText::Strikethrough::Property::HEIGHT == valueGet.first.indexKey) || (HEIGHT_KEY == valueGet.first.stringKey))
+ {
+ /// Height key.
+ heightDefined = true;
+
+ if(valueGet.second.GetType() == Dali::Property::STRING)
+ {
+ const std::string heightStr = valueGet.second.Get<std::string>();
+ height = StringToFloat(heightStr.c_str());
+ }
+ else
+ {
+ height = valueGet.second.Get<float>();
+ }
+ }
+ }
+ return 0u == numberOfItems;
+}
+
bool SetUnderlineProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type)
{
bool update = false;
}
}
+bool SetStrikethroughProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type)
+{
+ bool update = false;
+
+ if(controller)
+ {
+ switch(type)
+ {
+ case EffectStyle::DEFAULT:
+ {
+ const Property::Map& propertiesMap = value.Get<Property::Map>();
+
+ bool enabled = false;
+ bool colorDefined = false;
+ Vector4 color;
+ bool heightDefined = false;
+ float height = 0.f;
+
+ bool empty = true;
+
+ if(propertiesMap.Empty())
+ {
+ // Map empty so check if a string provided
+ const std::string propertyString = value.Get<std::string>();
+
+ if(!propertyString.empty())
+ {
+ Property::Map parsedStringMap;
+ Text::ParsePropertyString(propertyString, parsedStringMap);
+
+ empty = ParseStrikethroughProperties(parsedStringMap,
+ enabled,
+ colorDefined,
+ color,
+ heightDefined,
+ height);
+
+ controller->StrikethroughSetByString(!empty);
+ }
+ }
+ else
+ {
+ empty = ParseStrikethroughProperties(propertiesMap,
+ enabled,
+ colorDefined,
+ color,
+ heightDefined,
+ height);
+
+ controller->StrikethroughSetByString(false);
+ }
+
+ if(!empty)
+ {
+ if(enabled != controller->IsStrikethroughEnabled())
+ {
+ controller->SetStrikethroughEnabled(enabled);
+ update = true;
+ }
+
+ // Sets the default strikethrough values.
+ if(colorDefined && (controller->GetStrikethroughColor() != color))
+ {
+ controller->SetStrikethroughColor(color);
+ update = true;
+ }
+ if(heightDefined && (fabsf(controller->GetStrikethroughHeight() - height) > Math::MACHINE_EPSILON_1000))
+ {
+ controller->SetStrikethroughHeight(height);
+ update = true;
+ }
+ }
+ else
+ {
+ // Disable strikethrough.
+ if(controller->IsStrikethroughEnabled())
+ {
+ controller->SetStrikethroughEnabled(false);
+ update = true;
+ }
+ }
+ break;
+ }
+ case EffectStyle::INPUT:
+ {
+ const std::string& strikethroughProperties = value.Get<std::string>();
+
+ controller->SetInputStrikethroughProperties(strikethroughProperties);
+ update = true;
+ break;
+ }
+ } // switch
+ } // if( controller )
+
+ return update;
+}
+
+void GetStrikethroughProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type)
+{
+ if(controller)
+ {
+ switch(type)
+ {
+ case EffectStyle::DEFAULT:
+ {
+ const bool enabled = controller->IsStrikethroughEnabled();
+ const Vector4& color = controller->GetStrikethroughColor();
+ const float height = controller->GetStrikethroughHeight();
+
+ if(controller->IsStrikethroughSetByString())
+ {
+ std::string strikethroughProperties = "{\"enable\":";
+ const std::string enabledStr = enabled ? "true" : "false";
+ strikethroughProperties += "\"" + enabledStr + "\",";
+
+ std::string colorStr;
+ Vector4ToColorString(color, colorStr);
+ strikethroughProperties += "\"color\":\"" + colorStr + "\",";
+
+ std::string heightStr;
+ FloatToString(height, heightStr);
+ strikethroughProperties += "\"height\":\"" + heightStr + "\"}";
+
+ value = strikethroughProperties;
+ }
+ else
+ {
+ Property::Map map;
+
+ map.Insert(ENABLE_KEY, enabled);
+ map.Insert(COLOR_KEY, color);
+ map.Insert(HEIGHT_KEY, height);
+
+ value = map;
+ }
+
+ break;
+ }
+ case EffectStyle::INPUT:
+ {
+ value = controller->GetInputStrikethroughProperties();
+ break;
+ }
+ }
+ }
+}
+
} // namespace Text
} // namespace Toolkit
Vector4& color);
/**
+ * @brief Parses the strikethrough properties.
+ *
+ * @param[in] strikethroughProperties The map with the strikethrough properties.
+ * @param[out] enabled Whether the strikethrough is enabled.
+ * @param[out] colorDefined Whether the strikethrough's color is defined.
+ * @param[out] color The strikethrough's color.
+ * @param[out] heightDefined Whether the strikethrough's height is defined.
+ * @param[out] height The strikethrough's height.
+ */
+bool ParseStrikethroughProperties(const Property::Map& strikethroughProperties,
+ bool& enabled,
+ bool& colorDefined,
+ Vector4& color,
+ bool& heightDefined,
+ float& height);
+
+/**
* @brief Sets the underline properties.
*
* @param[in] controller The text's controller.
bool SetUnderlineProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
/**
+ * @brief Sets the strikethrough properties.
+ *
+ * @param[in] controller The text's controller.
+ * @param[in] value The values of the strikethrough's properties.
+ * @param[in] type Whether the property is for the default strikethrough or the input strikethrough.
+ *
+ * @return Whether the strikethrough properties have been updated.
+ */
+bool SetStrikethroughProperties(ControllerPtr controller, const Property::Value& value, EffectStyle::Type type);
+
+/**
* @brief Retrieves the underline's properties.
*
* @param[in] controller The text's controller.
void GetUnderlineProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
/**
+ * @brief Retrieves the strikethrough's properties.
+ *
+ * @param[in] controller The text's controller.
+ * @param[out] value The value of the strikethrough's properties.
+ * @param[in] type Whether the property is for the default strikethrough or the input strikethrough.
+ */
+void GetStrikethroughProperties(ControllerPtr controller, Property::Value& value, EffectStyle::Type type);
+
+/**
* @brief Sets the shadow properties.
*
* @param[in] controller The text's controller.
* @return number of hyphens.
*/
virtual Length GetHyphensCount() const = 0;
+
+ /**
+ * @brief Retrieves the strikethrough color.
+ *
+ * @return The strikethrough color.
+ */
+ virtual const Vector4& GetStrikethroughColor() const = 0;
+
+ /**
+ * @brief Returns whether strikethrough is enabled or not.
+ *
+ * @return The strikethrough state.
+ */
+ virtual bool IsStrikethroughEnabled() const = 0;
+
+ /**
+ * @brief Retrieves the strikethrough height override
+ *
+ * @return Returns the override height for a strikethrough, 0 indicates that adaptor will determine the height
+ */
+ virtual float GetStrikethroughHeight() const = 0;
};
} // namespace Text
{
return mVisualModel->mHyphen.glyph.Size();
}
+const Vector4& Model::GetStrikethroughColor() const
+{
+ return mVisualModel->GetStrikethroughColor();
+}
+
+bool Model::IsStrikethroughEnabled() const
+{
+ return mVisualModel->IsStrikethroughEnabled();
+}
+
+float Model::GetStrikethroughHeight() const
+{
+ return mVisualModel->GetStrikethroughHeight();
+}
Model::Model()
: mLogicalModel(),
*/
Length GetHyphensCount() const override;
+ float GetStrikethroughHeight() const override;
+
+ const Vector4& GetStrikethroughColor() const override;
+
+ bool IsStrikethroughEnabled() const override;
+
private: // Private contructors & copy operator.
/**
* @brief Private constructor.
* @return The second middle index of elided glyphs, index of ellipsis of middle.
*/
virtual GlyphIndex GetSecondMiddleIndexOfElidedGlyphs() const = 0;
+
+ /**
+ * @brief Retrieves the strikethrough color.
+ *
+ * @return The strikethrough color.
+ */
+ virtual const Vector4& GetStrikethroughColor() const = 0;
+
+ /**
+ * @brief Returns whether strikethrough is enabled or not.
+ *
+ * @return The strikethrough state.
+ */
+ virtual bool IsStrikethroughEnabled() const = 0;
+
+ /**
+ * @brief Retrieves the strikethrough height override
+ *
+ * @return Returns the override height for a strikethrough, 0 indicates that adaptor will determine the height
+ */
+ virtual float GetStrikethroughHeight() const = 0;
};
} // namespace Text
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
if(lastGlyphIndexOfLine == index)
{
- penY += -line->descender;
+ penY += -line->descender + line->lineSpacing;
// Get the next line.
++lineIndex;
lastGlyphIndexOfLine = (line->isSplitToTwoHalves ? line->glyphRunSecondHalf.glyphIndex + line->glyphRunSecondHalf.numberOfGlyphs : line->glyphRun.glyphIndex + line->glyphRun.numberOfGlyphs) - 1u;
- penY += line->ascender + line->lineSpacing;
+ penY += line->ascender;
}
}
}
return secondMiddleIndexOfElidedGlyphs;
}
+const Vector4& View::GetStrikethroughColor() const
+{
+ return (mImpl->mVisualModel) ? mImpl->mVisualModel->GetStrikethroughColor() : Vector4::ZERO;
+}
+
+bool View::IsStrikethroughEnabled() const
+{
+ return (mImpl->mVisualModel) ? mImpl->mVisualModel->IsStrikethroughEnabled() : false;
+}
+
+float View::GetStrikethroughHeight() const
+{
+ return (mImpl->mVisualModel) ? mImpl->mVisualModel->GetStrikethroughHeight() : 0.0f;
+}
+
} // namespace Text
} // namespace Toolkit
*/
GlyphIndex GetSecondMiddleIndexOfElidedGlyphs() const override;
+ /**
+ * @copydoc Dali::Toolkit::Text::ViewInterface::GetStrikethroughColor()
+ */
+ const Vector4& GetStrikethroughColor() const override;
+
+ /**
+ * @copydoc Dali::Toolkit::Text::ViewInterface::IsStrikethroughEnabled()
+ */
+ bool IsStrikethroughEnabled() const override;
+
+ /**
+ * @copydoc Dali::Toolkit::Text::ViewInterface::GetStrikethroughHeight()
+ */
+ float GetStrikethroughHeight() const override;
+
private:
// Undefined
View(const View& handle);
mSecondMiddleIndexOfElidedGlyphs = secondMiddleIndexOfElidedGlyphs;
}
+void VisualModel::SetStrikethroughColor(const Vector4& color)
+{
+ mStrikethroughColor = color;
+}
+
+void VisualModel::SetStrikethroughEnabled(bool enabled)
+{
+ mStrikethroughEnabled = enabled;
+}
+
+void VisualModel::SetStrikethroughHeight(float height)
+{
+ mStrikethroughHeight = height;
+}
+
const Vector4& VisualModel::GetTextColor() const
{
return mTextColor;
return mUnderlineRuns.Count();
}
+const Vector4& VisualModel::GetStrikethroughColor() const
+{
+ return mStrikethroughColor;
+}
+
+bool VisualModel::IsStrikethroughEnabled() const
+{
+ return mStrikethroughEnabled;
+}
+
+float VisualModel::GetStrikethroughHeight() const
+{
+ return mStrikethroughHeight;
+}
+
void VisualModel::ClearCaches()
{
mCachedLineIndex = 0u;
mUnderlineColor(Color::BLACK),
mOutlineColor(Color::WHITE),
mBackgroundColor(Color::TRANSPARENT),
+ mStrikethroughColor(Color::BLACK),
mControlSize(),
mShadowOffset(),
mUnderlineHeight(0.0f),
+ mStrikethroughHeight(0.0f),
mShadowBlurRadius(0.0f),
mOutlineWidth(0u),
mNaturalSize(),
mUnderlineEnabled(false),
mUnderlineColorSet(false),
mBackgroundEnabled(false),
- mMarkupProcessorEnabled(false)
+ mMarkupProcessorEnabled(false),
+ mStrikethroughEnabled(false)
{
}
*/
GlyphIndex GetSecondMiddleIndexOfElidedGlyphs() const;
+ /**
+ * @brief Sets the text's strikethrough color.
+ *
+ * @param[in] color The text's strikethrough color.
+ */
+ void SetStrikethroughColor(const Vector4& color);
+
+ /**
+ * @brief Retrieves the text's strikethrough color.
+ *
+ * @return The text's strikethrough color.
+ */
+ const Vector4& GetStrikethroughColor() const;
+
+ /**
+ * @brief Sets the text strikethrough flag.
+ *
+ * @param[in] enabled true if strikethrough.
+ */
+ void SetStrikethroughEnabled(bool enabled);
+
+ /**
+ * @brief Returns whether the text is strikethrough or not.
+ *
+ * @return strikethrough state.
+ */
+ bool IsStrikethroughEnabled() const;
+
+ /**
+ * @brief Set the override used for strikethrough height, 0 indicates height will be come from font metrics
+ *
+ * @param[in] height The height in pixels of the strikethrough
+ */
+ void SetStrikethroughHeight(float height);
+
+ /**
+ * @brief Retrieves the strikethrough height override
+ *
+ * @return Returns the override height for a strikethrough, 0 indicates that font metrics will determine the height
+ */
+ float GetStrikethroughHeight() const;
+
protected:
/**
* @brief A reference counted object may only be deleted by calling Unreference().
Vector<Vector4> mBackgroundColors; ///< Background colors of the glyphs.
Vector<ColorIndex> mBackgroundColorIndices; ///< Indices to the vector of background colors for each glyphs.
- Vector4 mTextColor; ///< The text color
- Vector4 mShadowColor; ///< Color of drop shadow
- Vector4 mUnderlineColor; ///< Color of underline
- Vector4 mOutlineColor; ///< Color of outline
- Vector4 mBackgroundColor; ///< Color of text background
- Size mControlSize; ///< The size of the UI control.
- Vector2 mShadowOffset; ///< Offset for drop shadow, 0 indicates no shadow
- float mUnderlineHeight; ///< Fixed height for underline to override font metrics.
- float mShadowBlurRadius; ///< Blur radius of shadow, 0 indicates no blur.
- uint16_t mOutlineWidth; ///< Width of outline.
+ Vector4 mTextColor; ///< The text color
+ Vector4 mShadowColor; ///< Color of drop shadow
+ Vector4 mUnderlineColor; ///< Color of underline
+ Vector4 mOutlineColor; ///< Color of outline
+ Vector4 mBackgroundColor; ///< Color of text background
+ Vector4 mStrikethroughColor; ///< Color of text background
+ Size mControlSize; ///< The size of the UI control.
+ Vector2 mShadowOffset; ///< Offset for drop shadow, 0 indicates no shadow
+ float mUnderlineHeight; ///< Fixed height for underline to override font metrics.
+ float mStrikethroughHeight; ///< Fixed height for strikethrough to override font metrics.
+ float mShadowBlurRadius; ///< Blur radius of shadow, 0 indicates no blur.
+ uint16_t mOutlineWidth; ///< Width of outline.
private:
Size mNaturalSize; ///< Size of the text with no line wrapping.
bool mBackgroundEnabled : 1; ///< Background enabled flag
bool mMarkupProcessorEnabled : 1; ///< Markup-processor enabled flag
HyphenInfo mHyphen; ///< Contains hyphen glyph info & the character index to draw hyphen after.
+ bool mStrikethroughEnabled : 1; ///< Strikethrough enabled flag
};
} // namespace Text
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
map.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE);
bool sync = IsSynchronousLoadingRequired();
- map.Insert(SYNCHRONOUS_LOADING, sync);
+ map.Insert(Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, sync);
if(mImageUrl.IsValid())
{
map.Insert(Toolkit::ImageVisual::Property::URL, mImageUrl.GetUrl());
#include <dali-toolkit/internal/graphics/builtin-shader-extern-gen.h>
#include <dali-toolkit/internal/visuals/image-visual-shader-factory.h>
#include <dali-toolkit/internal/visuals/npatch-loader.h>
+#include <dali-toolkit/devel-api/utility/npatch-helper.h>
#include <dali-toolkit/internal/visuals/rendering-addon.h>
#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
{
namespace Internal
{
-namespace
-{
-/**
- * @brief Creates the geometry formed from the vertices and indices
- *
- * @param[in] vertices The vertices to generate the geometry from
- * @param[in] indices The indices to generate the geometry from
- * @return The geometry formed from the vertices and indices
- */
-Geometry GenerateGeometry(const Vector<Vector2>& vertices, const Vector<unsigned short>& indices)
-{
- Property::Map vertexFormat;
- vertexFormat["aPosition"] = Property::VECTOR2;
- VertexBuffer vertexBuffer = VertexBuffer::New(vertexFormat);
- if(vertices.Size() > 0)
- {
- vertexBuffer.SetData(&ver