utc-Dali-Text-Layout.cpp
utc-Dali-Text-Controller.cpp
utc-Dali-VisualFactoryResolveUrl.cpp
- utc-Dali-Visuals.cpp
utc-Dali-Text-Markup.cpp
+ utc-Dali-Text-Typesetter.cpp
+ utc-Dali-Text-ViewModel.cpp
)
# Append list of test harness files (Won't get parsed for test cases)
../dali-toolkit/dali-toolkit-test-utils/test-render-controller.cpp
../dali-toolkit/dali-toolkit-test-utils/test-trace-call-stack.cpp
../dali-toolkit/dali-toolkit-test-utils/test-native-image.cpp
- dali-toolkit-test-utils/toolkit-text-model.cpp
+ dali-toolkit-test-utils/toolkit-text-utils.cpp
)
*
*/
-#include "toolkit-text-model.h"
+// FILE HEADER
+#include "toolkit-text-utils.h"
// EXTERNAL INCLUDES
+#include <limits>
#include <dali/devel-api/text-abstraction/font-client.h>
// INTERNAL INCLUDES
}
// 9) Layout the text
- LayoutEngine layoutEngine;
+ Layout::Engine layoutEngine;
layoutEngine.SetMetrics( metrics );
- layoutEngine.SetLayout( LayoutEngine::MULTI_LINE_BOX );
+ layoutEngine.SetLayout( Layout::Engine::MULTI_LINE_BOX );
// Set the layout parameters.
const Vector<GlyphIndex>& charactersToGlyph = visualModel->mCharactersToGlyph;
const Vector<Length>& glyphsPerCharacter = visualModel->mGlyphsPerCharacter;
- LayoutParameters layoutParameters( textArea,
- utf32Characters.Begin(),
- lineBreakInfo.Begin(),
- wordBreakInfo.Begin(),
- ( 0u != characterDirections.Count() ) ? characterDirections.Begin() : NULL,
- glyphs.Begin(),
- glyphsToCharactersMap.Begin(),
- charactersPerGlyph.Begin(),
- charactersToGlyph.Begin(),
- glyphsPerCharacter.Begin(),
- numberOfGlyphs );
+ Layout::Parameters layoutParameters( textArea,
+ utf32Characters.Begin(),
+ lineBreakInfo.Begin(),
+ wordBreakInfo.Begin(),
+ ( 0u != characterDirections.Count() ) ? characterDirections.Begin() : NULL,
+ glyphs.Begin(),
+ glyphsToCharactersMap.Begin(),
+ charactersPerGlyph.Begin(),
+ charactersToGlyph.Begin(),
+ glyphsPerCharacter.Begin(),
+ numberOfGlyphs,
+ Layout::HORIZONTAL_ALIGN_BEGIN );
Vector<LineRun>& lines = visualModel->mLines;
layoutEngine.LayoutText( layoutParameters,
glyphPositions,
lines,
- layoutSize );
+ layoutSize,
+ false );
// 10) Reorder the lines
if( 0u != bidirectionalInfo.Count() )
layoutEngine.Align( textArea,
0u,
numberOfCharacters,
+ Layout::HORIZONTAL_ALIGN_BEGIN,
lines );
}
}
+void ConfigureTextLabel( ControllerPtr controller )
+{
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.SetDpi( 93u, 93u );
+
+ // Set the text layout as multi-line.
+ controller->GetLayoutEngine().SetLayout( Layout::Engine::MULTI_LINE_BOX );
+
+ // Set cursor's width to zero.
+ controller->GetLayoutEngine().SetCursorWidth( 0 );
+
+ // Disables the text input.
+ controller->EnableTextInput( NULL );
+
+ // Disables the vertical scrolling.
+ controller->SetVerticalScrollEnabled( false );
+
+ // Disables the horizontal scrolling.
+ controller->SetHorizontalScrollEnabled( false );
+
+ // Enable the text elide.
+ controller->SetTextElideEnabled( true );
+}
+
+void ConfigureTextField( ControllerPtr controller )
+{
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.SetDpi( 93u, 93u );
+
+ // Creates a decorator.
+ Text::DecoratorPtr decorator = Text::Decorator::New( *controller,
+ *controller );
+
+ // Set the text layout as multi-line.
+ controller->GetLayoutEngine().SetLayout( Layout::Engine::SINGLE_LINE_BOX );
+
+ // Enables the text input.
+ controller->EnableTextInput( decorator );
+
+ // Enables the vertical scrolling after the text input has been enabled.
+ controller->SetVerticalScrollEnabled( false );
+
+ // Disables the horizontal scrolling.
+ controller->SetHorizontalScrollEnabled( true );
+
+ // No maximum number of characters.
+ controller->SetMaximumNumberOfCharacters( 50u );
+
+ // Disable the text elide.
+ controller->SetTextElideEnabled( false );
+}
+
+void ConfigureTextEditor( ControllerPtr controller )
+{
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.SetDpi( 93u, 93u );
+
+ // Creates a decorator.
+ Text::DecoratorPtr decorator = Text::Decorator::New( *controller,
+ *controller );
+
+ // Set the text layout as multi-line.
+ controller->GetLayoutEngine().SetLayout( Layout::Engine::MULTI_LINE_BOX );
+
+ // Enables the text input.
+ controller->EnableTextInput( decorator );
+
+ // Enables the vertical scrolling after the text input has been enabled.
+ controller->SetVerticalScrollEnabled( true );
+
+ // Disables the horizontal scrolling.
+ controller->SetHorizontalScrollEnabled( false );
+
+ // No maximum number of characters.
+ controller->SetMaximumNumberOfCharacters( std::numeric_limits<Length>::max() );
+
+ // Disable the text elide.
+ controller->SetTextElideEnabled( false );
+}
+
} // namespace Text
} // namespace Toolkit
-#ifndef __DALI_TOOLKIT_TEXT_MODEL_H__
-#define __DALI_TOOLKIT_TEXT_MODEL_H__
+#ifndef __DALI_TOOLKIT_TEXT_UTILS_H__
+#define __DALI_TOOLKIT_TEXT_UTILS_H__
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
*/
-// EXTERNAL INCLUDES
-
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/logical-model-impl.h>
#include <dali-toolkit/internal/text/metrics.h>
#include <dali-toolkit/internal/text/visual-model-impl.h>
+#include <dali-toolkit/internal/text/text-controller.h>
namespace Dali
{
VisualModelPtr& visualModel,
MetricsPtr& metrics );
+/**
+ * @brief Configures the text @p controller similarly to the one configured by the text-label.
+ *
+ * @param[in,out] The text controller to configure.
+ */
+void ConfigureTextLabel( ControllerPtr controller );
+
+/**
+ * @brief Configures the text @p controller similarly to the one configured by the text-field.
+ *
+ * @param[in,out] The text controller to configure.
+ */
+void ConfigureTextField( ControllerPtr controller );
+
+/**
+ * @brief Configures the text @p controller similarly to the one configured by the text-editor.
+ *
+ * @param[in,out] The text controller to configure.
+ */
+void ConfigureTextEditor( ControllerPtr controller );
+
} // namespace Text
} // namespace Toolkit
} // namespace Dali
-#endif // __DALI_TOOLKIT_TEXT_MODEL_H__
+#endif // __DALI_TOOLKIT_TEXT_UTILS_H__
#include <dali-toolkit/internal/text/text-run-container.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <toolkit-text-model.h>
+#include <toolkit-text-utils.h>
using namespace Dali;
using namespace Toolkit;
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/internal/text/text-run-container.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <toolkit-text-model.h>
+#include <toolkit-text-utils.h>
using namespace Dali;
#include <stdlib.h>
#include <limits>
-#include <unistd.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <toolkit-text-utils.h>
#include <dali-toolkit/internal/text/text-controller.h>
#include <dali-toolkit/internal/text/text-control-interface.h>
#include <dali-toolkit/internal/text/text-editable-control-interface.h>
const Size CONTROL_SIZE( 300.f, 60.f );
-const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
-
-class ControlImpl : public ControlInterface, public Text::EditableControlInterface
-{
-public:
- ControlImpl()
- : ControlInterface()
- {}
-
- virtual ~ControlImpl()
- {}
-
- virtual void AddDecoration( Actor& actor, bool needsClipping )
- {}
-
- virtual void RequestTextRelayout()
- {}
-
- virtual void TextChanged()
- {}
-
- virtual void MaxLengthReached()
- {}
-
- virtual void InputStyleChanged( InputStyle::Mask inputStyleMask )
- {}
-};
-
std::string gClipboardText;
void ContentSelectedCallback( ClipboardEventNotifier& notifier )
{
// Creates a text controller.
ControllerPtr controller = Controller::New();
+ DALI_TEST_CHECK( controller );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextControllerSetGetScrollEnabled(void)
+{
+ tet_infoline(" UtcDaliTextControllerSetGetScrollEnabled");
+ ToolkitTestApplication application;
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
DALI_TEST_CHECK( controller );
+ // Configures the text controller similarly to the text-editor.
+ ConfigureTextEditor( controller );
+
+ DALI_TEST_CHECK( !controller->IsHorizontalScrollEnabled() );
+ DALI_TEST_CHECK( controller->IsVerticalScrollEnabled() );
+
+ // Configures the text controller similarly to the text-field.
+ ConfigureTextField( controller );
+
+ DALI_TEST_CHECK( controller->IsHorizontalScrollEnabled() );
+ DALI_TEST_CHECK( !controller->IsVerticalScrollEnabled() );
+
+ // Configures the text controller similarly to the text-label.
+ ConfigureTextLabel( controller );
+
+ DALI_TEST_CHECK( !controller->IsHorizontalScrollEnabled() );
+ DALI_TEST_CHECK( !controller->IsVerticalScrollEnabled() );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextControllerSetIsTextElide(void)
+{
+ tet_infoline(" UtcDaliTextControllerSetIsTextElide");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+ DALI_TEST_CHECK( controller );
+
+ // Configures the text controller similarly to the text-editor.
+ ConfigureTextEditor( controller );
+ DALI_TEST_EQUALS( false, controller->IsTextElideEnabled(), TEST_LOCATION );
+
+ controller->SetTextElideEnabled( true );
+ DALI_TEST_EQUALS( true, controller->IsTextElideEnabled(), TEST_LOCATION );
+
+ // Configures the text controller similarly to the text-field.
+ ConfigureTextField( controller );
+ DALI_TEST_EQUALS( false, controller->IsTextElideEnabled(), TEST_LOCATION );
+
+ controller->SetTextElideEnabled( true );
+ DALI_TEST_EQUALS( true, controller->IsTextElideEnabled(), TEST_LOCATION );
+
+ // Configures the text controller similarly to the text-label.
+ ConfigureTextLabel( controller );
+ DALI_TEST_EQUALS( true, controller->IsTextElideEnabled(), TEST_LOCATION );
+
+ controller->SetTextElideEnabled( false );
+ DALI_TEST_EQUALS( false, controller->IsTextElideEnabled(), TEST_LOCATION );
+
tet_result(TET_PASS);
END_TEST;
}
// Creates a text controller.
ControllerPtr controller = Controller::New();
-
DALI_TEST_CHECK( controller );
// There is no text input enabled.
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/internal/text/cursor-helper-functions.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <toolkit-text-model.h>
+#include <toolkit-text-utils.h>
using namespace Dali;
#include <dali-toolkit/internal/text/text-run-container.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <toolkit-text-model.h>
+#include <toolkit-text-utils.h>
using namespace Dali;
using namespace Toolkit;
float* positions;
unsigned int numberOfLines;
LineRun* lines;
- LayoutEngine::Layout layout;
+ Layout::Engine::Type layout;
unsigned int startIndex;
unsigned int numberOfGlyphs;
bool ellipsis:1;
glyphPositions.Begin() + data.startIndex + data.numberOfGlyphs );
// 3) Layout
- LayoutEngine engine;
+ Layout::Engine engine;
engine.SetMetrics( metrics );
- engine.SetTextEllipsisEnabled( data.ellipsis );
engine.SetLayout( data.layout );
const Length totalNumberOfGlyphs = visualModel->mGlyphs.Count();
- LayoutParameters layoutParameters( data.textArea,
- logicalModel->mText.Begin(),
- logicalModel->mLineBreakInfo.Begin(),
- logicalModel->mWordBreakInfo.Begin(),
- ( 0u != logicalModel->mCharacterDirections.Count() ) ? logicalModel->mCharacterDirections.Begin() : NULL,
- visualModel->mGlyphs.Begin(),
- visualModel->mGlyphsToCharacters.Begin(),
- visualModel->mCharactersPerGlyph.Begin(),
- visualModel->mCharactersToGlyph.Begin(),
- visualModel->mGlyphsPerCharacter.Begin(),
- totalNumberOfGlyphs );
+ Layout::Parameters layoutParameters( data.textArea,
+ logicalModel->mText.Begin(),
+ logicalModel->mLineBreakInfo.Begin(),
+ logicalModel->mWordBreakInfo.Begin(),
+ ( 0u != logicalModel->mCharacterDirections.Count() ) ? logicalModel->mCharacterDirections.Begin() : NULL,
+ visualModel->mGlyphs.Begin(),
+ visualModel->mGlyphsToCharacters.Begin(),
+ visualModel->mCharactersPerGlyph.Begin(),
+ visualModel->mCharactersToGlyph.Begin(),
+ visualModel->mGlyphsPerCharacter.Begin(),
+ totalNumberOfGlyphs,
+ Layout::HORIZONTAL_ALIGN_BEGIN );
layoutParameters.isLastNewParagraph = isLastNewParagraph;
const bool updated = engine.LayoutText( layoutParameters,
glyphPositions,
lines,
- layoutSize );
+ layoutSize,
+ data.ellipsis );
// 4) Compare the results.
metrics );
// 2) Call the ReLayoutRightToLeftLines() method.
- LayoutEngine engine;
+ Layout::Engine engine;
engine.SetMetrics( metrics );
- LayoutParameters layoutParameters( data.textArea,
- logicalModel->mText.Begin(),
- logicalModel->mLineBreakInfo.Begin(),
- logicalModel->mWordBreakInfo.Begin(),
- ( 0u != logicalModel->mCharacterDirections.Count() ) ? logicalModel->mCharacterDirections.Begin() : NULL,
- visualModel->mGlyphs.Begin(),
- visualModel->mGlyphsToCharacters.Begin(),
- visualModel->mCharactersPerGlyph.Begin(),
- visualModel->mCharactersToGlyph.Begin(),
- visualModel->mGlyphsPerCharacter.Begin(),
- visualModel->mGlyphs.Count() );
+ Layout::Parameters layoutParameters( data.textArea,
+ logicalModel->mText.Begin(),
+ logicalModel->mLineBreakInfo.Begin(),
+ logicalModel->mWordBreakInfo.Begin(),
+ ( 0u != logicalModel->mCharacterDirections.Count() ) ? logicalModel->mCharacterDirections.Begin() : NULL,
+ visualModel->mGlyphs.Begin(),
+ visualModel->mGlyphsToCharacters.Begin(),
+ visualModel->mCharactersPerGlyph.Begin(),
+ visualModel->mCharactersToGlyph.Begin(),
+ visualModel->mGlyphsPerCharacter.Begin(),
+ visualModel->mGlyphs.Count(),
+ Layout::HORIZONTAL_ALIGN_BEGIN );
layoutParameters.numberOfBidirectionalInfoRuns = logicalModel->mBidirectionalLineInfo.Count();
layoutParameters.lineBidirectionalInfoRunsBuffer = logicalModel->mBidirectionalLineInfo.Begin();
struct AlignData
{
- std::string description;
- std::string text;
- Size textArea;
- unsigned int numberOfFonts;
- FontDescriptionRun* fontDescriptions;
- LayoutEngine::HorizontalAlignment horizontalAlignment;
- LayoutEngine::VerticalAlignment verticalAlignment;
- unsigned int startIndex;
- unsigned int numberOfCharacters;
- unsigned int numberOfLines;
- float* lineOffsets;
+ std::string description;
+ std::string text;
+ Size textArea;
+ unsigned int numberOfFonts;
+ FontDescriptionRun* fontDescriptions;
+ Layout::HorizontalAlignment horizontalAlignment;
+ Layout::VerticalAlignment verticalAlignment;
+ unsigned int startIndex;
+ unsigned int numberOfCharacters;
+ unsigned int numberOfLines;
+ float* lineOffsets;
};
bool AlignTest( const AlignData& data )
metrics );
// Call the Align method.
- LayoutEngine engine;
+ Layout::Engine engine;
engine.SetMetrics( metrics );
- engine.SetHorizontalAlignment( data.horizontalAlignment );
- engine.SetVerticalAlignment( data.verticalAlignment );
-
engine.Align( data.textArea,
data.startIndex,
data.numberOfCharacters,
+ data.horizontalAlignment,
visualModel->mLines );
// Compare results.
ToolkitTestApplication application;
tet_infoline(" UtcDaliTextLayoutSetGetLayout");
- LayoutEngine engine;
-
- DALI_TEST_CHECK( LayoutEngine::SINGLE_LINE_BOX == engine.GetLayout() );
-
- engine.SetLayout( LayoutEngine::MULTI_LINE_BOX );
- DALI_TEST_CHECK( LayoutEngine::MULTI_LINE_BOX == engine.GetLayout() );
-
- tet_result(TET_PASS);
- END_TEST;
-}
-
-int UtcDaliTextLayoutSetGetTextEllipsisEnabled(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliTextLayoutSetGetTextEllipsisEnabled");
-
- LayoutEngine engine;
-
- DALI_TEST_CHECK( !engine.GetTextEllipsisEnabled() );
-
- engine.SetTextEllipsisEnabled( true );
- DALI_TEST_CHECK( engine.GetTextEllipsisEnabled() );
-
- tet_result(TET_PASS);
- END_TEST;
-}
-
-int UtcDaliTextLayoutSetGetHorizontalAlignment(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" ");
-
- LayoutEngine engine;
+ Layout::Engine engine;
- DALI_TEST_CHECK( LayoutEngine::HORIZONTAL_ALIGN_BEGIN == engine.GetHorizontalAlignment() );
-
- engine.SetHorizontalAlignment( LayoutEngine::HORIZONTAL_ALIGN_END );
- DALI_TEST_CHECK( LayoutEngine::HORIZONTAL_ALIGN_END == engine.GetHorizontalAlignment() );
-
- tet_result(TET_PASS);
- END_TEST;
-}
-
-int UtcDaliTextLayoutSetGetVerticalAlignment(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliTextLayoutSetGetVerticalAlignment");
-
- LayoutEngine engine;
-
- DALI_TEST_CHECK( LayoutEngine::VERTICAL_ALIGN_TOP == engine.GetVerticalAlignment() );
-
- engine.SetVerticalAlignment( LayoutEngine::VERTICAL_ALIGN_TOP );
- DALI_TEST_CHECK( LayoutEngine::VERTICAL_ALIGN_TOP == engine.GetVerticalAlignment() );
+ DALI_TEST_CHECK( Layout::Engine::SINGLE_LINE_BOX == engine.GetLayout() );
+ engine.SetLayout( Layout::Engine::MULTI_LINE_BOX );
+ DALI_TEST_CHECK( Layout::Engine::MULTI_LINE_BOX == engine.GetLayout() );
tet_result(TET_PASS);
END_TEST;
ToolkitTestApplication application;
tet_infoline(" ");
- LayoutEngine engine;
+ Layout::Engine engine;
DALI_TEST_EQUALS( 1, engine.GetCursorWidth(), TEST_LOCATION );
NULL,
0u,
NULL,
- LayoutEngine::MULTI_LINE_BOX,
+ Layout::Engine::MULTI_LINE_BOX,
0u,
0u,
false,
NULL,
0u,
NULL,
- LayoutEngine::MULTI_LINE_BOX,
+ Layout::Engine::MULTI_LINE_BOX,
0u,
11u,
false,
positions,
1u,
lines.Begin(),
- LayoutEngine::SINGLE_LINE_BOX,
+ Layout::Engine::SINGLE_LINE_BOX,
0u,
11u,
false,
positions,
5u,
lines.Begin(),
- LayoutEngine::MULTI_LINE_BOX,
+ Layout::Engine::MULTI_LINE_BOX,
0u,
48u,
false,
positions,
6u,
lines.Begin(),
- LayoutEngine::MULTI_LINE_BOX,
+ Layout::Engine::MULTI_LINE_BOX,
0u,
55u,
false,
positions,
3u,
lines.Begin(),
- LayoutEngine::MULTI_LINE_BOX,
+ Layout::Engine::MULTI_LINE_BOX,
0u,
29u,
false,
positions,
2u,
lines.Begin(),
- LayoutEngine::MULTI_LINE_BOX,
+ Layout::Engine::MULTI_LINE_BOX,
0u,
13u,
false,
positions,
2u,
lines.Begin(),
- LayoutEngine::MULTI_LINE_BOX,
+ Layout::Engine::MULTI_LINE_BOX,
0u,
17u,
false,
positions,
19u,
lines.Begin(),
- LayoutEngine::MULTI_LINE_BOX,
+ Layout::Engine::MULTI_LINE_BOX,
0u,
64u,
false,
positions,
19u,
lines.Begin(),
- LayoutEngine::MULTI_LINE_BOX,
+ Layout::Engine::MULTI_LINE_BOX,
64u,
64u,
false,
positions,
19u,
lines.Begin(),
- LayoutEngine::MULTI_LINE_BOX,
+ Layout::Engine::MULTI_LINE_BOX,
128u,
64u,
false,
positions,
1u,
lines.Begin(),
- LayoutEngine::SINGLE_LINE_BOX,
+ Layout::Engine::SINGLE_LINE_BOX,
0u,
51u,
true,
positions,
2u,
lines.Begin(),
- LayoutEngine::MULTI_LINE_BOX,
+ Layout::Engine::MULTI_LINE_BOX,
0u,
51u,
true,
positions,
1u,
lines.Begin(),
- LayoutEngine::SINGLE_LINE_BOX,
+ Layout::Engine::SINGLE_LINE_BOX,
0u,
72u,
true,
positions,
2u,
lines.Begin(),
- LayoutEngine::MULTI_LINE_BOX,
+ Layout::Engine::MULTI_LINE_BOX,
0u,
72u,
true,
positions,
1u,
lines.Begin(),
- LayoutEngine::MULTI_LINE_BOX,
+ Layout::Engine::MULTI_LINE_BOX,
0u,
11u,
true,
textArea,
6u,
fontDescriptionRuns.Begin(),
- LayoutEngine::HORIZONTAL_ALIGN_BEGIN,
- LayoutEngine::VERTICAL_ALIGN_TOP,
+ Layout::HORIZONTAL_ALIGN_BEGIN,
+ Layout::VERTICAL_ALIGN_TOP,
0u,
22u,
6u,
textArea,
6u,
fontDescriptionRuns.Begin(),
- LayoutEngine::HORIZONTAL_ALIGN_BEGIN,
- LayoutEngine::VERTICAL_ALIGN_TOP,
+ Layout::HORIZONTAL_ALIGN_BEGIN,
+ Layout::VERTICAL_ALIGN_TOP,
22u,
26u,
6u,
textArea,
6u,
fontDescriptionRuns.Begin(),
- LayoutEngine::HORIZONTAL_ALIGN_BEGIN,
- LayoutEngine::VERTICAL_ALIGN_TOP,
+ Layout::HORIZONTAL_ALIGN_BEGIN,
+ Layout::VERTICAL_ALIGN_TOP,
48u,
26u,
6u,
textArea,
6u,
fontDescriptionRuns.Begin(),
- LayoutEngine::HORIZONTAL_ALIGN_CENTER,
- LayoutEngine::VERTICAL_ALIGN_TOP,
+ Layout::HORIZONTAL_ALIGN_CENTER,
+ Layout::VERTICAL_ALIGN_TOP,
0u,
22u,
6u,
textArea,
6u,
fontDescriptionRuns.Begin(),
- LayoutEngine::HORIZONTAL_ALIGN_CENTER,
- LayoutEngine::VERTICAL_ALIGN_TOP,
+ Layout::HORIZONTAL_ALIGN_CENTER,
+ Layout::VERTICAL_ALIGN_TOP,
22u,
26u,
6u,
textArea,
6u,
fontDescriptionRuns.Begin(),
- LayoutEngine::HORIZONTAL_ALIGN_CENTER,
- LayoutEngine::VERTICAL_ALIGN_TOP,
+ Layout::HORIZONTAL_ALIGN_CENTER,
+ Layout::VERTICAL_ALIGN_TOP,
48u,
26u,
6u,
textArea,
6u,
fontDescriptionRuns.Begin(),
- LayoutEngine::HORIZONTAL_ALIGN_END,
- LayoutEngine::VERTICAL_ALIGN_TOP,
+ Layout::HORIZONTAL_ALIGN_END,
+ Layout::VERTICAL_ALIGN_TOP,
0u,
22u,
6u,
textArea,
6u,
fontDescriptionRuns.Begin(),
- LayoutEngine::HORIZONTAL_ALIGN_END,
- LayoutEngine::VERTICAL_ALIGN_TOP,
+ Layout::HORIZONTAL_ALIGN_END,
+ Layout::VERTICAL_ALIGN_TOP,
22u,
26u,
6u,
textArea,
6u,
fontDescriptionRuns.Begin(),
- LayoutEngine::HORIZONTAL_ALIGN_END,
- LayoutEngine::VERTICAL_ALIGN_TOP,
+ Layout::HORIZONTAL_ALIGN_END,
+ Layout::VERTICAL_ALIGN_TOP,
48u,
26u,
6u,
tet_result(TET_PASS);
END_TEST;
}
+
+int UtcDaliTextLayoutSetGetDefaultLineSpacing(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" UtcDaliTextLayoutSetGetDefaultLineSpacing");
+
+ Layout::Engine engine;
+ DALI_TEST_EQUALS( 0.f, engine.GetDefaultLineSpacing(), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ engine.SetDefaultLineSpacing( 10.f );
+ DALI_TEST_EQUALS( 10.f, engine.GetDefaultLineSpacing(), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <toolkit-text-model.h>
+#include <toolkit-text-utils.h>
#include <dali-toolkit/internal/text/markup-processor.h>
#include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
#include <dali-toolkit/internal/text/color-run.h>
#include <dali-toolkit/internal/text/shaper.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <toolkit-text-model.h>
+#include <toolkit-text-utils.h>
using namespace Dali;
using namespace Toolkit;
--- /dev/null
+/*
+ * Copyright (c) 2016 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.
+ *
+ */
+
+#include <iostream>
+
+#include <stdlib.h>
+#include <limits>
+#include <unistd.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <toolkit-text-utils.h>
+#include <dali-toolkit/internal/text/rendering/text-typesetter.h>
+#include <dali-toolkit/internal/text/rendering/view-model.h>
+#include <dali-toolkit/internal/text/text-controller.h>
+
+using namespace Dali;
+using namespace Toolkit;
+using namespace Text;
+
+namespace
+{
+const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
+const PointSize26Dot6 EMOJI_FONT_SIZE = 62u * 64u;
+} // namespace
+
+int UtcDaliTextTypesetter(void)
+{
+ tet_infoline(" UtcDaliTextTypesetter");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ // Tests the rendering controller has been created.
+ TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
+ DALI_TEST_CHECK( typesetter );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextTypesetterGetViewModel(void)
+{
+ tet_infoline(" UtcDaliTextTypesetter");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ // Tests the rendering controller has been created.
+ TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
+ DALI_TEST_CHECK( typesetter );
+
+ // Tests the view model has been created.
+ ViewModel* model = typesetter->GetViewModel();
+ DALI_TEST_CHECK( NULL != model );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextRenderingControllerRender(void)
+{
+ tet_infoline(" UtcDaliTextRenderingControllerRender");
+ ToolkitTestApplication application;
+
+ // Load some fonts.
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+
+ char* pathNamePtr = get_current_dir_name();
+ const std::string pathName( pathNamePtr );
+ free( pathNamePtr );
+
+ fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenColorEmoji.ttf", EMOJI_FONT_SIZE );
+ fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf" );
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ // Configures the text controller similarly to the text-label.
+ ConfigureTextLabel( controller );
+
+ // Sets the text.
+ controller->SetMarkupProcessorEnabled( true );
+ controller->SetText( "<font family='TizenSansRegular'>Hello world </font><font family='TizenColorEmoji'>\xF0\x9F\x98\x81</font>" );
+
+ // Creates the text's model and relais-out the text.
+ const Size relayoutSize( 120.f, 60.f );
+ controller->Relayout( relayoutSize );
+
+ // Tests the rendering controller has been created.
+ TypesetterPtr renderingController = Typesetter::New( controller->GetTextModel() );
+ DALI_TEST_CHECK( renderingController );
+
+ // Renders the text and creates the final bitmap.
+ PixelData bitmap = renderingController->Render( relayoutSize );
+ DALI_TEST_CHECK( bitmap );
+
+ DALI_TEST_EQUALS( 120u, bitmap.GetWidth(), TEST_LOCATION );
+ DALI_TEST_EQUALS( 60u, bitmap.GetHeight(), TEST_LOCATION );
+ DALI_TEST_EQUALS( Pixel::RGBA8888, bitmap.GetPixelFormat(), TEST_LOCATION );
+
+ // Changes vertical alignment.
+ controller->SetVerticalAlignment( Layout::VERTICAL_ALIGN_CENTER );
+ controller->Relayout( relayoutSize );
+
+ // Renders the text and creates the final bitmap.
+ bitmap = renderingController->Render( relayoutSize );
+ DALI_TEST_CHECK( bitmap );
+
+ DALI_TEST_EQUALS( 120u, bitmap.GetWidth(), TEST_LOCATION );
+ DALI_TEST_EQUALS( 60u, bitmap.GetHeight(), TEST_LOCATION );
+ DALI_TEST_EQUALS( Pixel::RGBA8888, bitmap.GetPixelFormat(), TEST_LOCATION );
+
+ controller->SetVerticalAlignment( Layout::VERTICAL_ALIGN_BOTTOM );
+ controller->Relayout( relayoutSize );
+
+ // Renders the text and creates the final bitmap.
+ bitmap = renderingController->Render( relayoutSize );
+ DALI_TEST_CHECK( bitmap );
+
+ DALI_TEST_EQUALS( 120u, bitmap.GetWidth(), TEST_LOCATION );
+ DALI_TEST_EQUALS( 60u, bitmap.GetHeight(), TEST_LOCATION );
+ DALI_TEST_EQUALS( Pixel::RGBA8888, bitmap.GetPixelFormat(), TEST_LOCATION );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
--- /dev/null
+/*
+ * Copyright (c) 2016 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.
+ *
+ */
+
+#include <iostream>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <dali-toolkit-test-suite-utils.h>
+#include <dali-toolkit/dali-toolkit.h>
+#include <toolkit-text-utils.h>
+#include <dali-toolkit/internal/text/font-description-run.h>
+#include <dali-toolkit/internal/text/rendering/text-typesetter.h>
+#include <dali-toolkit/internal/text/rendering/view-model.h>
+#include <dali-toolkit/internal/text/text-controller.h>
+
+using namespace Dali;
+using namespace Toolkit;
+using namespace Text;
+
+namespace
+{
+
+const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
+
+const Size CONTROL_SIZE( 200.f, 400.f );
+const Size CONTROL_SMALL_SIZE( 50.f, 100.f );
+const char* LOREM_IPSUM = "Lorem ipsum dolor sit amet, aeque definiebas ea mei, posse iracundia ne cum.\n"
+ "Usu ne nisl maiorum iudicabit, veniam epicurei oporteat eos an.\n"
+ "Ne nec nulla regione albucius, mea doctus delenit ad!\n"
+ "Et everti blandit adversarium mei, eam porro neglegentur suscipiantur an.\n"
+ "Quidam corpora at duo. An eos possim scripserit?\n\n"
+ "Aťqui dicant sěnťenťíae aň vel!\n"
+ "Vis viris médiocrem elaboraret ét, verear civibus moderatius ex duo!\n"
+ "Án veri laborě iňtěgré quó, mei aď poššit lobortis, mei prompťa čonsťitůťó eů.\n"
+ "Aliquip sanctůs delicáta quí ěá, et natum aliquam est?\n"
+ "Asšúm sapěret usu ůť.\n"
+ "Síť ut apeirián laboramúš percipitur, sůas hařum ín éos?\n";
+const Vector2 LOREM_SCROLL_POSITION( 0.f, -208.f );
+const Length LOREM_NUMBER_OF_LINES = 32u;
+const Length LOREM_NUMBER_OF_LINES_ELIDED = 21u;
+const Length LOREM_NUMBER_OF_GLYPHS = 632;
+const Length LOREM_NUMBER_OF_GLYPHS_ELIDED = 397u;
+
+// The expected layout size for UtcDaliTextViewModelGetLayoutSize
+const Size LAYOUT_SIZE( 190.f, 48.f );
+
+// The expected color indices for UtcDaliTextViewModelGetColors
+const ColorIndex COLOR_INDICES[] = { 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 2u, 2u, 2u, 2u, 2u, 1u, 1u, 1u, 1u, 1u, 3u, 1u, 1u, 1u, 0u, 0u, 0u, 0u };
+const Length NUMBER_OF_COLORS = 3u;
+const Vector4 COLORS[] = { Color::RED, Color::BLUE, Color::GREEN };
+
+struct ElideData
+{
+ std::string description;
+ std::string text;
+ Vector2 size;
+ unsigned int numberOfLines;
+ unsigned int numberOfGlyphs;
+ float* positions;
+};
+
+bool ElideTest( const ElideData& data )
+{
+ std::cout << " testing : " << data.description << std::endl;
+
+ // Load some fonts.
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.SetDpi( 93u, 93u );
+
+ char* pathNamePtr = get_current_dir_name();
+ const std::string pathName( pathNamePtr );
+ free( pathNamePtr );
+
+ fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf" );
+ fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansHebrewRegular.ttf" );
+ fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansArabicRegular.ttf" );
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ // Tests the rendering controller has been created.
+ TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
+ DALI_TEST_CHECK( typesetter );
+
+ // Tests the view model has been created.
+ ViewModel* model = typesetter->GetViewModel();
+ DALI_TEST_CHECK( NULL != model );
+
+ // Configures the text controller similarly to the text-label.
+ ConfigureTextLabel( controller );
+
+ // Sets a text and relais-out.
+ controller->SetMarkupProcessorEnabled( true );
+
+ controller->SetText( data.text );
+ controller->Relayout( data.size );
+
+ // Elide the glyphs.
+ model->ElideGlyphs();
+
+ if( data.numberOfLines != model->GetNumberOfLines() )
+ {
+ std::cout << " different number of lines : " << model->GetNumberOfLines() << ", expected : " << data.numberOfLines << std::endl;
+ return false;
+ }
+
+ if( data.numberOfGlyphs != model->GetNumberOfGlyphs() )
+ {
+ std::cout << " different number of glyphs : " << model->GetNumberOfGlyphs() << ", expected : " << data.numberOfGlyphs << std::endl;
+ return false;
+ }
+
+ const Vector2* const layoutBuffer = model->GetLayout();
+ const Length numberOfLines = model->GetNumberOfLines();
+
+ if( numberOfLines != 0u )
+ {
+ const LineRun& lastLine = *( model->GetLines() + numberOfLines - 1u );
+ const Length numberOfLastLineGlyphs = data.numberOfGlyphs - lastLine.glyphRun.glyphIndex;
+
+ std::cout << " last line alignment offset : " << lastLine.alignmentOffset << std::endl;
+
+ for( unsigned int index = 0u; index < numberOfLastLineGlyphs; ++index )
+ {
+ if( *( data.positions + index ) != ( lastLine.alignmentOffset + ( *( layoutBuffer + lastLine.glyphRun.glyphIndex + index ) ).x ) )
+ {
+ std::cout << " different layout :";
+ for( unsigned int i = 0; i < numberOfLastLineGlyphs; ++i )
+ {
+ std::cout << " " << ( lastLine.alignmentOffset + ( *( layoutBuffer + lastLine.glyphRun.glyphIndex + i ) ).x );
+ }
+ std::cout << std::endl;
+ std::cout << " expected :";
+ for( unsigned int i = 0; i < numberOfLastLineGlyphs; ++i )
+ {
+ std::cout << " " << *( data.positions + i );
+ }
+ std::cout << std::endl;
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+} // namespace
+
+int UtcDaliTextViewModel(void)
+{
+ tet_infoline(" UtcDaliTextViewModel");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ // Tests the rendering controller has been created.
+ TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
+ DALI_TEST_CHECK( typesetter );
+
+ // Tests the view model has been created.
+ ViewModel* model = typesetter->GetViewModel();
+ DALI_TEST_CHECK( NULL != model );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextViewModelGetControlSize(void)
+{
+ tet_infoline(" UtcDaliTextViewModelGetControlSize");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ // Tests the rendering controller has been created.
+ TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
+ DALI_TEST_CHECK( typesetter );
+
+ // Tests the view model has been created.
+ ViewModel* model = typesetter->GetViewModel();
+ DALI_TEST_CHECK( NULL != model );
+
+ // Configures the text controller similarly to the text-editor.
+ ConfigureTextEditor( controller );
+
+ // The text has not been laid-out. The stored control's size should be zero.
+ DALI_TEST_EQUALS( Size::ZERO, model->GetControlSize(), TEST_LOCATION );
+
+ // Sets a text and relais-out.
+ controller->SetText( "Hello world" );
+ controller->Relayout( CONTROL_SIZE );
+
+ // The control's size should be stored now.
+ DALI_TEST_EQUALS( CONTROL_SIZE, model->GetControlSize(), TEST_LOCATION );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextViewModelGetLayoutSize(void)
+{
+ tet_infoline(" UtcDaliTextViewModelGetLayoutSize");
+ ToolkitTestApplication application;
+
+ // Load some fonts.
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+ fontClient.SetDpi( 93u, 93u );
+
+ char* pathNamePtr = get_current_dir_name();
+ const std::string pathName( pathNamePtr );
+ free( pathNamePtr );
+
+ fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf" );
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ // Tests the rendering controller has been created.
+ TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
+ DALI_TEST_CHECK( typesetter );
+
+ // Tests the view model has been created.
+ ViewModel* model = typesetter->GetViewModel();
+ DALI_TEST_CHECK( NULL != model );
+
+ // Configures the text controller similarly to the text-editor.
+ ConfigureTextEditor( controller );
+
+ // The text has not been laid-out. The stored control's size should be zero.
+ DALI_TEST_EQUALS( Size::ZERO, model->GetLayoutSize(), TEST_LOCATION );
+
+ // Sets a text and relais-out.
+ controller->SetMarkupProcessorEnabled( true );
+ controller->SetText( "<font family='TizenSansRegular' size='10'>Lorem ipsum dolor sit amet, aeque definiebas ea mei, posse iracundia ne cum.</font>" );
+ controller->Relayout( CONTROL_SIZE );
+
+ // The control's size should be stored now.
+ DALI_TEST_EQUALS( LAYOUT_SIZE, model->GetLayoutSize(), TEST_LOCATION );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextViewModelGetScrollPosition(void)
+{
+ tet_infoline(" UtcDaliTextViewModelGetScrollPosition");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ // Tests the rendering controller has been created.
+ TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
+ DALI_TEST_CHECK( typesetter );
+
+ // Tests the view model has been created.
+ ViewModel* model = typesetter->GetViewModel();
+ DALI_TEST_CHECK( NULL != model );
+
+ // Configures the text controller similarly to the text-editor.
+ ConfigureTextEditor( controller );
+
+ // No text has been set. The scroll position should be zero.
+ DALI_TEST_EQUALS( Vector2::ZERO, model->GetScrollPosition(), TEST_LOCATION );
+
+ // Gains the keyboard focus, sets a big text and relais-out.
+ controller->KeyboardFocusGainEvent();
+ controller->SetText( LOREM_IPSUM );
+ controller->Relayout( CONTROL_SIZE );
+
+ // The text should be scrolled to the end.
+ DALI_TEST_EQUALS( LOREM_SCROLL_POSITION, model->GetScrollPosition(), TEST_LOCATION );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextViewModelGetAlignment(void)
+{
+ tet_infoline(" UtcDaliTextViewModelGetAlignment");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ // Tests the rendering controller has been created.
+ TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
+ DALI_TEST_CHECK( typesetter );
+
+ // Tests the view model has been created.
+ ViewModel* model = typesetter->GetViewModel();
+ DALI_TEST_CHECK( NULL != model );
+
+ DALI_TEST_EQUALS( Layout::HORIZONTAL_ALIGN_BEGIN, model->GetHorizontalAlignment(), TEST_LOCATION );
+ DALI_TEST_EQUALS( Layout::VERTICAL_ALIGN_TOP, model->GetVerticalAlignment(), TEST_LOCATION );
+
+ controller->SetHorizontalAlignment( Layout::HORIZONTAL_ALIGN_CENTER );
+ controller->SetVerticalAlignment( Layout::VERTICAL_ALIGN_CENTER );
+
+ DALI_TEST_EQUALS( Layout::HORIZONTAL_ALIGN_CENTER, model->GetHorizontalAlignment(), TEST_LOCATION );
+ DALI_TEST_EQUALS( Layout::VERTICAL_ALIGN_CENTER, model->GetVerticalAlignment(), TEST_LOCATION );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextViewModelIsTextElideEnabled(void)
+{
+ tet_infoline(" UtcDaliTextViewModelIsTextElideEnabled");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ // Tests the rendering controller has been created.
+ TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
+ DALI_TEST_CHECK( typesetter );
+
+ // Tests the view model has been created.
+ ViewModel* model = typesetter->GetViewModel();
+ DALI_TEST_CHECK( NULL != model );
+
+ // Configures the text controller similarly to the text-editor.
+ ConfigureTextEditor( controller );
+
+ // Elide text should be disabled.
+ DALI_TEST_CHECK( !model->IsTextElideEnabled() );
+
+ // Configures the text controller similarly to the text-label.
+ ConfigureTextLabel( controller );
+
+ // Elide text should be enabled.
+ DALI_TEST_CHECK( model->IsTextElideEnabled() );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextViewModelGetLines(void)
+{
+ tet_infoline(" UtcDaliTextViewModelGetLines");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ // Tests the rendering controller has been created.
+ TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
+ DALI_TEST_CHECK( typesetter );
+
+ // Tests the view model has been created.
+ ViewModel* model = typesetter->GetViewModel();
+ DALI_TEST_CHECK( NULL != model );
+
+ // Configures the text controller similarly to the text-editor.
+ ConfigureTextEditor( controller );
+
+ // The number of lines should be zero.
+ DALI_TEST_EQUALS( 0u, model->GetNumberOfLines(), TEST_LOCATION );
+ DALI_TEST_CHECK( NULL == model->GetLines() );
+
+ // Sets a text and relais-out.
+ controller->SetText( LOREM_IPSUM );
+ controller->Relayout( CONTROL_SIZE );
+
+ DALI_TEST_EQUALS( LOREM_NUMBER_OF_LINES, model->GetNumberOfLines(), TEST_LOCATION );
+ DALI_TEST_CHECK( NULL != model->GetLines() );
+
+ // Configures the text controller similarly to the text-label.
+ ConfigureTextLabel( controller );
+
+ // Relais-out for the text-label configuration.
+ controller->Relayout( Size( 100.f, 100.f) ); // Change the size to force a relayout.
+ controller->Relayout( CONTROL_SIZE );
+
+ DALI_TEST_EQUALS( LOREM_NUMBER_OF_LINES_ELIDED, model->GetNumberOfLines(), TEST_LOCATION );
+ DALI_TEST_CHECK( NULL != model->GetLines() );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextViewModelGetGlyphsLayout(void)
+{
+ tet_infoline(" UtcDaliTextViewModelGetGlyphsLayout");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ // Tests the rendering controller has been created.
+ TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
+ DALI_TEST_CHECK( typesetter );
+
+ // Tests the view model has been created.
+ ViewModel* model = typesetter->GetViewModel();
+ DALI_TEST_CHECK( NULL != model );
+
+ // Configures the text controller similarly to the text-editor.
+ ConfigureTextEditor( controller );
+
+ // The number of glyphs should be zero.
+ DALI_TEST_EQUALS( 0u, model->GetNumberOfGlyphs(), TEST_LOCATION );
+ DALI_TEST_CHECK( NULL == model->GetGlyphs() );
+ DALI_TEST_CHECK( NULL == model->GetLayout() );
+
+ // Sets a text and relais-out.
+ controller->SetText( LOREM_IPSUM );
+ controller->Relayout( CONTROL_SIZE );
+
+ DALI_TEST_EQUALS( LOREM_NUMBER_OF_GLYPHS, model->GetNumberOfGlyphs(), TEST_LOCATION );
+ DALI_TEST_CHECK( NULL != model->GetGlyphs() );
+ DALI_TEST_CHECK( NULL != model->GetLayout() );
+
+ // Configures the text controller similarly to the text-label.
+ ConfigureTextLabel( controller );
+
+ // Relais-out for the text-label configuration.
+ controller->Relayout( Size( 100.f, 100.f) ); // Change the size to force a relayout.
+ controller->Relayout( CONTROL_SIZE );
+
+ // Elide the glyphs.
+ model->ElideGlyphs();
+
+ DALI_TEST_EQUALS( LOREM_NUMBER_OF_GLYPHS_ELIDED, model->GetNumberOfGlyphs(), TEST_LOCATION );
+ DALI_TEST_CHECK( NULL != model->GetGlyphs() );
+ DALI_TEST_CHECK( NULL != model->GetLayout() );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextViewModelGetColors(void)
+{
+ tet_infoline(" UtcDaliTextViewModelGetColors");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ // Tests the rendering controller has been created.
+ TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
+ DALI_TEST_CHECK( typesetter );
+
+ // Tests the view model has been created.
+ ViewModel* model = typesetter->GetViewModel();
+ DALI_TEST_CHECK( NULL != model );
+
+ // Configures the text controller similarly to the text-label.
+ ConfigureTextLabel( controller );
+
+ // Sets a text and relais-out.
+ controller->SetMarkupProcessorEnabled( true );
+ controller->SetText( "Lorem <color value='red'>ips<color value='blue'>um do</color>lor s<color value='green'>i</color>t a</color>met." );
+ controller->Relayout( CONTROL_SIZE );
+
+ DALI_TEST_EQUALS( Color::BLACK, model->GetDefaultColor(), TEST_LOCATION );
+
+ const ColorIndex* const colorIndicesBuffer = model->GetColorIndices();
+
+ const Length numberOfGlyphs = model->GetNumberOfGlyphs();
+ for( ColorIndex index = 0u; index < numberOfGlyphs; ++index )
+ {
+ DALI_TEST_EQUALS( COLOR_INDICES[index], *( colorIndicesBuffer + index ), TEST_LOCATION );
+ }
+
+ const Vector4* const colors = model->GetColors();
+ for( unsigned int index = 0u; index < NUMBER_OF_COLORS; ++index )
+ {
+ DALI_TEST_EQUALS( COLORS[index], *( colors + index ), TEST_LOCATION );
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextViewModelElideText01(void)
+{
+ tet_infoline(" UtcDaliTextViewModelElideText01");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ // Tests the rendering controller has been created.
+ TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
+ DALI_TEST_CHECK( typesetter );
+
+ // Tests the view model has been created.
+ ViewModel* model = typesetter->GetViewModel();
+ DALI_TEST_CHECK( NULL != model );
+
+ // Configures the text controller similarly to the text-editor.
+ ConfigureTextEditor( controller );
+
+ // The number of glyphs should be zero.
+ DALI_TEST_EQUALS( 0u, model->GetNumberOfGlyphs(), TEST_LOCATION );
+ DALI_TEST_EQUALS( 0u, model->GetNumberOfLines(), TEST_LOCATION );
+ DALI_TEST_CHECK( NULL == model->GetGlyphs() );
+ DALI_TEST_CHECK( NULL == model->GetLayout() );
+
+ // Sets a text and relais-out.
+ controller->SetText( LOREM_IPSUM );
+ controller->Relayout( CONTROL_SIZE );
+
+ // Keep the pointers to the glyphs and layout.
+ // As the text is not elided with this configuration, the pointers shoud be the same after calling the ElideGlyphs() method.
+ const GlyphInfo* const glyphsModel = model->GetGlyphs();
+ const Vector2* layoutsModel = model->GetLayout();
+
+ // Elide the glyphs. Text shouldn't be elided with this configuration.
+ model->ElideGlyphs();
+
+ DALI_TEST_CHECK( glyphsModel == model->GetGlyphs() );
+ DALI_TEST_CHECK( layoutsModel == model->GetLayout() );
+
+ DALI_TEST_EQUALS( LOREM_NUMBER_OF_GLYPHS, model->GetNumberOfGlyphs(), TEST_LOCATION );
+ DALI_TEST_EQUALS( LOREM_NUMBER_OF_LINES, model->GetNumberOfLines(), TEST_LOCATION );
+
+ // Configures the text controller similarly to the text-label.
+ ConfigureTextLabel( controller );
+
+ // Clear the text and relais-out.
+ controller->SetText( "" );
+ controller->Relayout( CONTROL_SIZE );
+
+ DALI_TEST_EQUALS( 0u, model->GetNumberOfGlyphs(), TEST_LOCATION );
+ DALI_TEST_EQUALS( 0u, model->GetNumberOfLines(), TEST_LOCATION );
+
+ // Elide the glyphs. Should not add the ellipsis glyph.
+ model->ElideGlyphs();
+
+ DALI_TEST_EQUALS( 0u, model->GetNumberOfGlyphs(), TEST_LOCATION );
+
+ // Sets a text that doesn't need to be elided.
+ controller->SetText( "Hello\n" );
+ controller->Relayout( CONTROL_SIZE );
+
+ // Elide the glyphs.
+ model->ElideGlyphs();
+
+ DALI_TEST_EQUALS( 6u, model->GetNumberOfGlyphs(), TEST_LOCATION );
+ DALI_TEST_EQUALS( 2u, model->GetNumberOfLines(), TEST_LOCATION );
+
+ // Sets a text and relais-out.
+ controller->SetText( LOREM_IPSUM );
+ controller->Relayout( CONTROL_SIZE );
+
+ // Elide the glyphs.
+ model->ElideGlyphs();
+
+ DALI_TEST_EQUALS( LOREM_NUMBER_OF_GLYPHS_ELIDED, model->GetNumberOfGlyphs(), TEST_LOCATION );
+ DALI_TEST_EQUALS( LOREM_NUMBER_OF_LINES_ELIDED, model->GetNumberOfLines(), TEST_LOCATION );
+ const GlyphInfo* const glyphs = model->GetGlyphs();
+ const Vector2* layouts = model->GetLayout();
+ DALI_TEST_CHECK( NULL != glyphs );
+ DALI_TEST_CHECK( NULL != layouts );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
+
+int UtcDaliTextViewModelElideText02(void)
+{
+ tet_infoline(" UtcDaliTextViewModelElideText02");
+
+ Size textSize00( 100.f, 100.f );
+
+ Size textSize01( 80.f, 100.f );
+ float positions01[] = { 0.f, 10.f, 16.f, 26.f, 35.f, 38.f, 46.f, 56.f };
+
+ Size textSize02( 80.f, 100.f );
+ float positions02[] = { 72.f, 63.f, 54.f, 50.f, 43.f, 38.f, 30.f, 11.f };
+
+ Size textSize03( 80.f, 100.f );
+ float positions03[] = { 77.f, 76.f, 71.f, 62.f, 60.f, 52.f, 47.f, 42.f, 39.f, 35.f, 32.f, 13.f };
+
+ Size textSize04( 80.f, 10.f );
+ float positions04[] = { 2.f };
+
+ struct ElideData data[] =
+ {
+ {
+ "void text",
+ "",
+ textSize00,
+ 0u,
+ 0u,
+ NULL
+ },
+ {
+ "Latin script",
+ "<font family='TizenSans'>Lorem ipsum dolor sit amet, aeque definiebas ea mei, posse iracundia ne cum.</font>",
+ textSize01,
+ 5u,
+ 42u,
+ positions01
+ },
+ {
+ "Hebrew script",
+ "<font family='TizenSansHebrew'>צעד על לשון המלצת לאחרונה, אם לכאן שנורו סרבול מדע, קרן דת שפות להפוך.</font>",
+ textSize02,
+ 5u,
+ 49u,
+ positions02
+ },
+ {
+ "Arabic script",
+ "<font family='TizenSansArabic'>عل النفط ديسمبر الإمداد بال, بين وترك شعار هو. لمّ من المبرمة النفط بالسيطرة, أم يتم تحرّك وبغطاء, عدم في لإعادة وإقامة رجوعهم.</font>",
+ textSize03,
+ 5u,
+ 79u,
+ positions03
+ },
+ {
+ "Small control size, no line fits.",
+ "<font family='TizenSans'>Lorem ipsum dolor sit amet, aeque definiebas ea mei, posse iracundia ne cum.</font>",
+ textSize04,
+ 1u,
+ 1u,
+ positions04
+ }
+ };
+ const unsigned int numberOfTests = 5u;
+
+ for( unsigned int index = 0u; index < numberOfTests; ++index )
+ {
+ ToolkitTestApplication application;
+ if( !ElideTest( data[index] ) )
+ {
+ tet_result(TET_FAIL);
+ }
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <toolkit-text-model.h>
+#include <toolkit-text-utils.h>
using namespace Dali;
+++ /dev/null
-/*
- * Copyright (c) 2016 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.
- *
- */
-
-#include <iostream>
-
-#include <stdlib.h>
-
-#include <dali-toolkit-test-suite-utils.h>
-#include <dali-toolkit/public-api/visuals/visual-properties.h>
-#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
-#include <dali-toolkit/internal/visuals/wireframe/wireframe-visual.h>
-
-using namespace Dali::Toolkit::Internal;
-
-namespace
-{
-
-class DummyWireframeVisual : public WireframeVisual
-{
-public:
-
- DummyWireframeVisual( VisualFactoryCache& factoryCache )
- : WireframeVisual( factoryCache )
- {}
-
- virtual ~DummyWireframeVisual()
- {}
-
- void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
- {
- WireframeVisual::DoSetProperty( index, propertyValue );
- }
-
- Dali::Property::Value DoGetProperty( Dali::Property::Index index )
- {
- return WireframeVisual::DoGetProperty( index );
- }
-};
-
-} // namespace
-
-int UtcDaliWireframeVisual(void)
-{
- // The goal of this test case is to cover the WireframeVisual::DoSetProperty() and
- // WireframeVisual::DoGetProperty() which are unreachable from the public API.
-
- tet_infoline( " UtcDaliWireframeVisual" );
-
- VisualFactoryCache* visualFactoryCache = new VisualFactoryCache();
-
- DummyWireframeVisual visual( *visualFactoryCache );
-
- visual.DoSetProperty( Dali::Toolkit::Visual::Property::TYPE, Dali::Toolkit::Visual::WIREFRAME );
- Dali::Property::Value value = visual.DoGetProperty( Dali::Toolkit::Visual::Property::TYPE );
-
- tet_result(TET_PASS);
- END_TEST;
-}
PKG_CHECK_MODULES(${CAPI_LIB} REQUIRED
dali-core
dali-toolkit
+ dali-adaptor
)
PKG_CHECK_MODULES(DALI_ADAPTOR REQUIRED
#include <dali-toolkit/dali-toolkit.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/devel-api/align-enums.h>
namespace Dali
{
Property::Map transformMap;
transformMap
- .Add( Toolkit::VisualProperty::Transform::Property::OFFSET, Vector2(0.0f, 0.0f) )
- .Add( Toolkit::VisualProperty::Transform::Property::SIZE, Vector2(1.0f, 1.0f) )
- .Add( Toolkit::VisualProperty::Transform::Property::ORIGIN, Toolkit::Align::CENTER )
- .Add( Toolkit::VisualProperty::Transform::Property::ANCHOR_POINT, Toolkit::Align::CENTER )
- .Add( Toolkit::VisualProperty::Transform::Property::OFFSET_SIZE_MODE, Vector4::ZERO );
+ .Add( Toolkit::DevelVisual::Transform::Property::OFFSET, Vector2(0.0f, 0.0f) )
+ .Add( Toolkit::DevelVisual::Transform::Property::SIZE, Vector2(1.0f, 1.0f) )
+ .Add( Toolkit::DevelVisual::Transform::Property::ORIGIN, Toolkit::Align::CENTER )
+ .Add( Toolkit::DevelVisual::Transform::Property::ANCHOR_POINT, Toolkit::Align::CENTER )
+ .Add( Toolkit::DevelVisual::Transform::Property::OFFSET_SIZE_MODE, Vector4::ZERO );
for( VisualIndices::iterator iter = mRegisteredVisualIndices.begin(); iter != mRegisteredVisualIndices.end() ; ++iter )
{
void GetFontMetrics( FontId fontId, FontMetrics& metrics ){}
GlyphIndex GetGlyphIndex( FontId fontId, Character charcode ){return 0;}
bool GetGlyphMetrics( GlyphInfo* array, uint32_t size, bool horizontal ){return true;}
+ void CreateBitmap( FontId fontId, GlyphIndex glyphIndex, Dali::TextAbstraction::FontClient::GlyphBufferData& data ){}
PixelData CreateBitmap( FontId fontId, GlyphIndex glyphIndex ){return PixelData();}
void CreateVectorBlob( FontId fontId, GlyphIndex glyphIndex, VectorBlob*& blob,
unsigned int& blobLength, unsigned int& nominalWidth, unsigned int& nominalHeight )
blobLength = 0;
}
const GlyphInfo& GetEllipsisGlyph( PointSize26Dot6 pointSize ){return mGlyphInfo;}
+ bool IsColorGlyph( FontId fontId, GlyphIndex glyphIndex ){return false;}
private:
unsigned int mDpiHorizontal;
unsigned int mDpiVertical;
{
}
+FontClient::GlyphBufferData::GlyphBufferData()
+{
+}
+
+FontClient::GlyphBufferData::~GlyphBufferData()
+{
+}
+
FontClient& FontClient::operator=( const FontClient& handle )
{
BaseHandle::operator=( handle );
return GetImplementation(*this).GetGlyphMetrics( array, size, horizontal );
}
+void FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex, Dali::TextAbstraction::FontClient::GlyphBufferData& data )
+{
+ GetImplementation(*this).CreateBitmap( fontId, glyphIndex, data );
+}
+
PixelData FontClient::CreateBitmap( FontId fontId, GlyphIndex glyphIndex )
{
return GetImplementation(*this).CreateBitmap( fontId, glyphIndex );
}
-
void FontClient::CreateVectorBlob( FontId fontId,
GlyphIndex glyphIndex,
VectorBlob*& blob,
return GetImplementation(*this).GetEllipsisGlyph( pointSize );
}
+bool FontClient::IsColorGlyph( FontId fontId, GlyphIndex glyphIndex )
+{
+ return GetImplementation(*this).IsColorGlyph( fontId, glyphIndex );
+}
+
FontClient::FontClient( Internal::FontClient* internal )
: BaseHandle( internal )
{
END_TEST;
}
-int UtcDaliImageViewAsyncLoadingWithAltasing(void)
+int UtcDaliImageViewAsyncLoadingWithAtlasing(void)
{
ToolkitTestApplication application;
callStack.Reset();
callStack.Enable(true);
- application.GetPlatform().SetClosestImageSize(Vector2(34, 34));
- BitmapLoader::ResetLatestCreated();
ImageView imageView = ImageView::New( gImage_34_RGBA, ImageDimensions( 34, 34 ) );
// By default, Aysnc loading is used
// loading is not started if the actor is offStage
- BitmapLoader loader = BitmapLoader::GetLatestCreated();
- DALI_TEST_CHECK( !loader );
Stage::GetCurrent().Add( imageView );
application.SendNotification();
application.Render(16);
application.SendNotification();
- // loading started
- loader = BitmapLoader::GetLatestCreated();
- DALI_TEST_CHECK( loader );
-
- loader.WaitForLoading();// waiting until the image to be loaded
- DALI_TEST_CHECK( loader.IsLoaded() );
-
+ // loading started, this waits for the loader thread for max 30 seconds
DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
application.SendNotification();
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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 UtcDaliPopupSetPopupBackgroundBorderProperty(void)
+{
+ ToolkitTestApplication application;
+
+ tet_infoline( "Set the background border property of a popup & retrieve it" );
+ Popup popup = Popup::New();
+
+ Rect< int > rect( 40, 30, 20, 10 );
+ tet_infoline( "Ensure value we want to set is different from what is already set" );
+ DALI_TEST_CHECK( rect != popup.GetProperty( Popup::Property::POPUP_BACKGROUND_BORDER ).Get< Rect< int > >() );
+
+ tet_infoline( "Set the property and retrieve it to make sure it's the value we set" );
+ popup.SetProperty( Popup::Property::POPUP_BACKGROUND_BORDER, rect );
+ DALI_TEST_EQUALS( rect, popup.GetProperty( Popup::Property::POPUP_BACKGROUND_BORDER ).Get< Rect< int > >(), TEST_LOCATION );
+
+ tet_infoline( "Set a vector4 as well which should also work" );
+ Vector4 vectorValue( 10.0f, 20.0f, 30.0f, 40.0f );
+ popup.SetProperty( Popup::Property::POPUP_BACKGROUND_BORDER, vectorValue );
+ DALI_TEST_EQUALS( Rect< int >( 10, 20, 30, 40 ), popup.GetProperty( Popup::Property::POPUP_BACKGROUND_BORDER ).Get< Rect< int > >(), TEST_LOCATION );
+
+ END_TEST;
+}
END_TEST;
}
+
+int utcDaliTextEditorEvent04(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorEvent04");
+
+ // Checks if the highlight actor is created.
+
+ TextEditor editor = TextEditor::New();
+ DALI_TEST_CHECK( editor );
+
+ Stage::GetCurrent().Add( editor );
+
+ editor.SetProperty( TextEditor::Property::TEXT, "Hello\nworl" );
+ editor.SetProperty( TextEditor::Property::POINT_SIZE, 10.f );
+ editor.SetSize( 100.f, 50.f );
+ editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+
+ // Avoid a crash when core load gl resources.
+ application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Tap on the text editor
+ application.ProcessEvent( GenerateTap( Gesture::Possible, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+ application.ProcessEvent( GenerateTap( Gesture::Started, 1u, 1u, Vector2( 3.f, 25.0f ) ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ // Move at the end of the text.
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_DOWN, 0, 0, Integration::KeyEvent::Down ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ for( unsigned int index = 0u; index < 10u; ++index )
+ {
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, 0, 0, Integration::KeyEvent::Down ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+ }
+
+ // Add a character
+ application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( "Hello\nworld", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
+
+ // Add some key events
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::Down ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_UP, 0, 0, Integration::KeyEvent::Down ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ for( unsigned int index = 0u; index < 10u; ++index )
+ {
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down ) );
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+ }
+
+ // Add a character
+ application.ProcessEvent( GenerateKey( " ", " ", 0, 0, 0, Integration::KeyEvent::Down ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( " Hello\nworld", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
+
+ END_TEST;
+}
#include <iostream>
#include <stdlib.h>
+#include <unistd.h>
+
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
const char* const PROPERTY_NAME_OUTLINE = "outline";
const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
+const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
+const unsigned int EMOJI_FONT_SIZE = 3968u;
bool DaliTestCheckMaps( const Property::Map& fontStyleMapGet, const Property::Map& fontStyleMapSet )
{
application.SendNotification();
application.Render();
- END_TEST;
-}
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
-int UtcDaliToolkitTextLabelVectorBasedP(void)
-{
- ToolkitTestApplication application;
- tet_infoline(" UtcDaliToolkitTextLabelVectorBasedP");
+ char* pathNamePtr = get_current_dir_name();
+ const std::string pathName( pathNamePtr );
+ free( pathNamePtr );
- TestGlAbstraction& glAbstraction = application.GetGlAbstraction();
- glAbstraction.EnableTextureCallTrace( true );
+ fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenColorEmoji.ttf", EMOJI_FONT_SIZE );
- TextLabel label = TextLabel::New();
- label.SetParentOrigin( ParentOrigin::CENTER );
- label.SetSize( Stage::GetCurrent().GetSize() );
- label.SetProperty( TextLabel::Property::TEXT, "Hello World" );
- label.SetProperty( TextLabel::Property::POINT_SIZE, 10.0f );
- label.SetProperty( TextLabel::Property::RENDERING_BACKEND, Toolkit::Text::RENDERING_VECTOR_BASED );
- Stage::GetCurrent().Add( label );
-
- application.SendNotification();
- application.Render();
-
- // Test that the vector data is uploaded to atlas
- DALI_TEST_CHECK( glAbstraction.GetTextureTrace().FindMethod("TexSubImage2D") );
- glAbstraction.GetTextureTrace().Reset();
-
- // Add another label with the same text in a different point-size
- TextLabel label2 = TextLabel::New();
- label2.SetProperty( TextLabel::Property::TEXT, "Hello World" );
- label2.SetProperty( TextLabel::Property::POINT_SIZE, 13.0f );
- label2.SetProperty( TextLabel::Property::RENDERING_BACKEND, Toolkit::Text::RENDERING_VECTOR_BASED );
- Stage::GetCurrent().Add( label2 );
+ const std::string emojis = "<font family='TizenColorEmoji'>\xF0\x9F\x98\x81 \xF0\x9F\x98\x82 \xF0\x9F\x98\x83 \xF0\x9F\x98\x84</font>";
+ label.SetProperty( TextLabel::Property::ENABLE_MARKUP, true );
+ label.SetProperty( TextLabel::Property::TEXT, emojis );
application.SendNotification();
application.Render();
- // Test that no additional vector data was uploaded to atlas
- // i.e. the same vector data can be used to render any point-size
- DALI_TEST_CHECK( ! glAbstraction.GetTextureTrace().FindMethod("TexSubImage2D") );
-
END_TEST;
}
#include <dali/public-api/rendering/texture-set.h>
#include <dali/public-api/rendering/shader.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/devel-api/align-enums.h>
#include <dali-toolkit/dali-toolkit.h>
#include "dummy-control.h"
{
Property::Map transformMap;
transformMap
- .Add( Toolkit::VisualProperty::Transform::Property::OFFSET, Vector2(0.0f, 0.0f) )
- .Add( Toolkit::VisualProperty::Transform::Property::SIZE, Vector2(1.0f, 1.0f) )
- .Add( Toolkit::VisualProperty::Transform::Property::ORIGIN, Toolkit::Align::CENTER )
- .Add( Toolkit::VisualProperty::Transform::Property::ANCHOR_POINT, Toolkit::Align::CENTER )
- .Add( Toolkit::VisualProperty::Transform::Property::OFFSET_SIZE_MODE, Vector4::ZERO );
+ .Add( Toolkit::DevelVisual::Transform::Property::OFFSET, Vector2(0.0f, 0.0f) )
+ .Add( Toolkit::DevelVisual::Transform::Property::SIZE, Vector2(1.0f, 1.0f) )
+ .Add( Toolkit::DevelVisual::Transform::Property::ORIGIN, Toolkit::Align::CENTER )
+ .Add( Toolkit::DevelVisual::Transform::Property::ANCHOR_POINT, Toolkit::Align::CENTER )
+ .Add( Toolkit::DevelVisual::Transform::Property::OFFSET_SIZE_MODE, Vector4::ZERO );
return transformMap;
}
fontClient.GetFontId( pathName + DEFAULT_FONT_DIR + "/tizen/TizenSansRegular.ttf" );
propertyMap.Clear();
- propertyMap.Insert( Visual::Property::TYPE, Visual::TEXT );
+ propertyMap.Insert( Visual::Property::TYPE, DevelVisual::TEXT );
propertyMap.Insert( TextVisual::Property::ENABLE_MARKUP, true );
propertyMap.Insert( TextVisual::Property::TEXT, "<font family='TizenSans' size='12'>Hello world</font>" );
propertyMap.Insert( TextVisual::Property::MULTI_LINE, true );
DALI_TEST_CHECK( colorValue );
DALI_TEST_CHECK( colorValue->Get<Vector4>() == Color::CYAN );
- // Test the properties. TODO: to be completed.
- colorVisual.SetProperty( ColorVisual::Property::MIX_COLOR, Color::RED );
- Property::Value value = colorVisual.GetProperty( ColorVisual::Property::MIX_COLOR );
-
END_TEST;
}
DALI_TEST_CHECK( colorValue );
DALI_TEST_CHECK( colorValue->Get<float>() == 10.f );
- // Test the properties. TODO: to be completed.
- borderVisual.SetProperty( BorderVisual::Property::COLOR, Color::RED );
- Property::Value value = borderVisual.GetProperty( BorderVisual::Property::COLOR );
END_TEST;
}
DALI_TEST_EQUALS( colorArray->GetElementAt(0).Get<Vector4>(), Color::RED , Math::MACHINE_EPSILON_100, TEST_LOCATION );
DALI_TEST_EQUALS( colorArray->GetElementAt(1).Get<Vector4>(), Color::GREEN , Math::MACHINE_EPSILON_100, TEST_LOCATION );
- // Test the properties. TODO: to be completed.
- gradientVisual.SetProperty( GradientVisual::Property::STOP_COLOR, Color::RED );
- Property::Value gradientValue = gradientVisual.GetProperty( GradientVisual::Property::STOP_COLOR );
-
END_TEST;
}
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<std::string>() == TEST_SVG_FILE_NAME );
- // Test the properties. TODO: to be completed.
- svgVisual.SetProperty( ImageVisual::Property::URL, TEST_SVG_FILE_NAME );
- Property::Value svgValue = svgVisual.GetProperty( ImageVisual::Property::URL );
-
END_TEST;
}
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<Vector3>(), Vector3( 5.0f, 10.0f, 15.0f), Math::MACHINE_EPSILON_100, TEST_LOCATION );
- // Test the properties. TODO: to be completed.
- meshVisual.SetProperty( MeshVisual::Property::OBJECT_URL, TEST_OBJ_FILE_NAME );
- Property::Value meshValue = meshVisual.GetProperty( MeshVisual::Property::OBJECT_URL );
-
- END_TEST;
+ END_TEST;
}
//Primitive shape visual
DALI_TEST_CHECK( value );
DALI_TEST_EQUALS( value->Get<Vector3>(), Vector3( 5.0f, 10.0f, 15.0f), Math::MACHINE_EPSILON_100, TEST_LOCATION );
- // Test the properties. TODO: to be completed.
- primitiveVisual.SetProperty( PrimitiveVisual::Property::SHAPE, PrimitiveVisual::Shape::CUBE );
- Property::Value primitiveValue = primitiveVisual.GetProperty( PrimitiveVisual::Property::SHAPE );
-
END_TEST;
}
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == 30 );
- // Test the properties. TODO: to be completed.
- batchImageVisual.SetProperty( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME );
- Property::Value primitiveValue = batchImageVisual.GetProperty( ImageVisual::Property::URL );
-
END_TEST;
}
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
- propertyMap.Insert( Visual::Property::TYPE, Visual::TEXT );
+ propertyMap.Insert( Visual::Property::TYPE, DevelVisual::TEXT );
propertyMap.Insert( "renderingBackend", static_cast<int>( Toolkit::Text::DEFAULT_RENDERING_BACKEND ) );
propertyMap.Insert( "text", "Hello world" );
propertyMap.Insert( "fontFamily", "TizenSans" );
propertyMap.Insert( "verticalAlignment", "CENTER" );
propertyMap.Insert( "textColor", Color::RED );
propertyMap.Insert( "enableMarkup", false );
- propertyMap.Insert( "enableAutoScroll", false );
- propertyMap.Insert( "lineSpacing", 0.f );
- propertyMap.Insert( "batchingEnabled", false );
Visual::Base textVisual = factory.CreateVisual( propertyMap );
Property::Map resultMap;
//Check values in the result map are identical to the initial map's values.
Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER );
DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( value->Get<int>(), (int)Visual::TEXT, TEST_LOCATION );
-
- value = resultMap.Find( TextVisual::Property::RENDERING_BACKEND, Property::INTEGER );
- DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( value->Get<int>(), Toolkit::Text::DEFAULT_RENDERING_BACKEND, TEST_LOCATION );
+ DALI_TEST_EQUALS( value->Get<int>(), (int)DevelVisual::TEXT, TEST_LOCATION );
value = resultMap.Find( TextVisual::Property::TEXT, Property::STRING );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( !value->Get<bool>() );
- value = resultMap.Find( TextVisual::Property::ENABLE_AUTO_SCROLL, Property::BOOLEAN );
- DALI_TEST_CHECK( !value );
-
- value = resultMap.Find( TextVisual::Property::LINE_SPACING, Property::FLOAT );
- DALI_TEST_CHECK( value );
- DALI_TEST_EQUALS( value->Get<float>(), 0.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
-
- value = resultMap.Find( TextVisual::Property::BATCHING_ENABLED, Property::BOOLEAN );
- DALI_TEST_CHECK( value );
- DALI_TEST_CHECK( !value->Get<bool>() );
-
END_TEST;
}
DALI_TEST_CHECK( value );
DALI_TEST_CHECK( value->Get<int>() == Visual::WIREFRAME );
- // Test the properties. TODO: to be completed.
- Property::Value primitiveValue = visual.GetProperty( Visual::Property::TYPE );
-
END_TEST;
}
propertyMap.Insert(ColorVisual::Property::MIX_COLOR, Color::BLUE);
Visual::Base colorVisual = factory.CreateVisual( propertyMap );
- Dali::Property::Map map;
- Dali::Property::Value transformProperty = colorVisual.GetProperty( Dali::Toolkit::Visual::DevelProperty::TRANSFORM );
- transformProperty.Get(map);
+ Dali::Property::Map visualMap;
+ colorVisual.CreatePropertyMap( visualMap );
+ Property::Value* value = visualMap.Find( Dali::Toolkit::DevelVisual::Property::TRANSFORM );
+ Dali::Property::Map* map = value->GetMap();
+ DALI_TEST_CHECK( map );
//Test default values
{
- Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET );
+ Property::Value* typeValue = map->Find( Toolkit::DevelVisual::Transform::Property::OFFSET );
DALI_TEST_CHECK( typeValue );
DALI_TEST_CHECK( typeValue->Get<Vector2>() == Vector2(0.0f,0.0f) );
}
{
- Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::SIZE );
+ Property::Value* typeValue = map->Find( Toolkit::DevelVisual::Transform::Property::SIZE );
DALI_TEST_CHECK( typeValue );
DALI_TEST_CHECK( typeValue->Get<Vector2>() == Vector2(1.0f,1.0f) );
}
{
- Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET_SIZE_MODE );
+ Property::Value* typeValue = map->Find( Toolkit::DevelVisual::Transform::Property::OFFSET_SIZE_MODE );
DALI_TEST_CHECK( typeValue );
DALI_TEST_CHECK( typeValue->Get<Vector4>() == Vector4(0.0f,0.0f,0.0f,0.0f) );
}
{
- Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::ORIGIN );
+ Property::Value* typeValue = map->Find( Toolkit::DevelVisual::Transform::Property::ORIGIN );
DALI_TEST_CHECK( typeValue );
DALI_TEST_CHECK( (Toolkit::Align::Type)typeValue->Get<int>() == Toolkit::Align::CENTER );
}
{
- Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::ANCHOR_POINT );
+ Property::Value* typeValue = map->Find( Toolkit::DevelVisual::Transform::Property::ANCHOR_POINT );
DALI_TEST_CHECK( typeValue );
DALI_TEST_CHECK( (Toolkit::Align::Type)typeValue->Get<int>() == Toolkit::Align::CENTER );
}
static void TestTransform( ToolkitTestApplication& application, Visual::Base visual )
{
Property::Map transform;
- transform.Insert( Visual::DevelProperty::Transform::Property::OFFSET, Vector2(10.0f, 10.0f) );
- transform.Insert( Visual::DevelProperty::Transform::Property::SIZE, Vector2(0.2f, 0.2f) );
- transform.Insert( Visual::DevelProperty::Transform::Property::OFFSET_SIZE_MODE, Vector4(1.0f, 1.0f, 0.0f,0.0f) );
- transform.Insert( Visual::DevelProperty::Transform::Property::ORIGIN, "TOP_BEGIN" );
- transform.Insert( Visual::DevelProperty::Transform::Property::ANCHOR_POINT, Toolkit::Align::BOTTOM_END );
-
- visual.SetProperty( Dali::Toolkit::Visual::DevelProperty::TRANSFORM, transform );
-
- Dali::Property::Map map;
- Dali::Property::Value transformProperty = visual.GetProperty( Dali::Toolkit::Visual::DevelProperty::TRANSFORM );
- transformProperty.Get(map);
+ transform.Insert( DevelVisual::Transform::Property::OFFSET, Vector2(10.0f, 10.0f) );
+ transform.Insert( DevelVisual::Transform::Property::SIZE, Vector2(0.2f, 0.2f) );
+ transform.Insert( DevelVisual::Transform::Property::OFFSET_SIZE_MODE, Vector4(1.0f, 1.0f, 0.0f,0.0f) );
+ transform.Insert( DevelVisual::Transform::Property::ORIGIN, "TOP_BEGIN" );
+ transform.Insert( DevelVisual::Transform::Property::ANCHOR_POINT, Toolkit::Align::BOTTOM_END );
+
+ visual.SetTransformAndSize( transform, Vector2(100, 100) );
+
+ Dali::Property::Map visualMap;
+ visual.CreatePropertyMap( visualMap );
+ Property::Value* value = visualMap.Find( Dali::Toolkit::DevelVisual::Property::TRANSFORM );
+ Dali::Property::Map* map = value->GetMap();
+ DALI_TEST_CHECK( map );
{
- Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET );
+ Property::Value* typeValue = map->Find( Toolkit::DevelVisual::Transform::Property::OFFSET );
DALI_TEST_CHECK( typeValue );
DALI_TEST_EQUALS( typeValue->Get<Vector2>(),Vector2(10.0f,10.0f), TEST_LOCATION );
}
{
- Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::SIZE );
+ Property::Value* typeValue = map->Find( Toolkit::DevelVisual::Transform::Property::SIZE );
DALI_TEST_CHECK( typeValue );
DALI_TEST_EQUALS( typeValue->Get<Vector2>(), Vector2(0.2f,0.2f), TEST_LOCATION );
}
{
- Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET_SIZE_MODE );
+ Property::Value* typeValue = map->Find( Toolkit::DevelVisual::Transform::Property::OFFSET_SIZE_MODE );
DALI_TEST_CHECK( typeValue );
DALI_TEST_EQUALS( typeValue->Get<Vector4>(), Vector4(1.0f,1.0f,0.0f,0.0f), TEST_LOCATION );
}
{
- Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::ORIGIN );
+ Property::Value* typeValue = map->Find( Toolkit::DevelVisual::Transform::Property::ORIGIN );
DALI_TEST_CHECK( typeValue );
DALI_TEST_EQUALS( (Toolkit::Align::Type)typeValue->Get<int>(), Toolkit::Align::TOP_BEGIN, TEST_LOCATION );
}
{
- Property::Value* typeValue = map.Find( Toolkit::Visual::DevelProperty::Transform::Property::ANCHOR_POINT );
+ Property::Value* typeValue = map->Find( Toolkit::DevelVisual::Transform::Property::ANCHOR_POINT );
DALI_TEST_CHECK( typeValue );
DALI_TEST_EQUALS( (Toolkit::Align::Type)typeValue->Get<int>(), Toolkit::Align::BOTTOM_END, TEST_LOCATION );
}
//Set a new transform
transform.Clear();
- transform.Insert( Visual::DevelProperty::Transform::Property::OFFSET, Vector2(20.0f, 20.0f) );
- transform.Insert( Visual::DevelProperty::Transform::Property::SIZE, Vector2(100.0f, 100.0f) );
- transform.Insert( Visual::DevelProperty::Transform::Property::OFFSET_SIZE_MODE, Vector4(0.0f, 0.0f, 1.0f,1.0f) );
- visual.SetProperty( Dali::Toolkit::Visual::DevelProperty::TRANSFORM, transform );
+ transform.Insert( DevelVisual::Transform::Property::OFFSET, Vector2(20.0f, 20.0f) );
+ transform.Insert( DevelVisual::Transform::Property::SIZE, Vector2(100.0f, 100.0f) );
+ transform.Insert( DevelVisual::Transform::Property::OFFSET_SIZE_MODE, Vector4(0.0f, 0.0f, 1.0f,1.0f) );
+ visual.SetTransformAndSize( transform, Vector2(100, 100) );
application.SendNotification();
application.Render(0);
VisualFactory factory = VisualFactory::Get();
Property::Map propertyMap;
- propertyMap.Insert( Visual::Property::TYPE, Visual::TEXT );
+ propertyMap.Insert( Visual::Property::TYPE, DevelVisual::TEXT );
propertyMap.Insert( "renderingBackend", static_cast<int>( Toolkit::Text::DEFAULT_RENDERING_BACKEND ) );
propertyMap.Insert( "text", "Hello world" );
propertyMap.Insert( "fontFamily", "TizenSans" );
propertyMap.Insert( "verticalAlignment", "CENTER" );
propertyMap.Insert( "textColor", Color::RED );
propertyMap.Insert( "enableMarkup", false );
- propertyMap.Insert( "enableAutoScroll", false );
- propertyMap.Insert( "lineSpacing", 0.f );
- propertyMap.Insert( "batchingEnabled", false );
Visual::Base textVisual = factory.CreateVisual( propertyMap );
textVisual.SetDepthIndex( 1.f );
#include <dali/public-api/rendering/shader.h>
#include <dali/devel-api/images/nine-patch-image.h>
#include <dali-toolkit/devel-api/align-enums.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/dali-toolkit.h>
#include "dummy-control.h"
{
Property::Map transformMap;
transformMap
- .Add( Toolkit::VisualProperty::Transform::Property::OFFSET, Vector2(0.0f, 0.0f) )
- .Add( Toolkit::VisualProperty::Transform::Property::SIZE, Vector2(1.0f, 1.0f) )
- .Add( Toolkit::VisualProperty::Transform::Property::ORIGIN, Toolkit::Align::CENTER )
- .Add( Toolkit::VisualProperty::Transform::Property::ANCHOR_POINT, Toolkit::Align::CENTER )
- .Add( Toolkit::VisualProperty::Transform::Property::OFFSET_SIZE_MODE, Vector4::ZERO );
+ .Add( Toolkit::DevelVisual::Transform::Property::OFFSET, Vector2(0.0f, 0.0f) )
+ .Add( Toolkit::DevelVisual::Transform::Property::SIZE, Vector2(1.0f, 1.0f) )
+ .Add( Toolkit::DevelVisual::Transform::Property::ORIGIN, Toolkit::Align::CENTER )
+ .Add( Toolkit::DevelVisual::Transform::Property::ANCHOR_POINT, Toolkit::Align::CENTER )
+ .Add( Toolkit::DevelVisual::Transform::Property::OFFSET_SIZE_MODE, Vector4::ZERO );
return transformMap;
}
develapitoolbardir = $(develapicontrolsdir)/tool-bar
develapitextselectionpopupdir = $(develapicontrolsdir)/text-controls
develapivisualfactorydir = $(develapidir)/visual-factory
+develapivisualsdir = $(develapidir)/visuals
# devel headers
develapi_HEADERS = $(devel_api_header_files)
develapipopup_HEADERS = $(devel_api_popup_header_files)
develapiprogressbar_HEADERS = $(devel_api_progress_bar_header_files)
develapivisualfactory_HEADERS = $(devel_api_visual_factory_header_files)
+develapivisuals_HEADERS = $(devel_api_visuals_header_files)
develapiscripting_HEADERS = $(devel_api_scripting_header_files)
develapishadowview_HEADERS = $(devel_api_shadow_view_header_files)
develapishadereffects_HEADERS = $(devel_api_shader_effects_header_files)
# For Open Source DALi API Reference
ALIASES += SINCE_1_0="@since 1.0"
ALIASES += SINCE_1_1="@since 1.1"
+ALIASES += SINCE_1_2="@since 1.2"
+
+# Extra tags for Tizen 3.0
+ALIASES += SINCE_1_2_2="@since 1.2.2"
+ALIASES += SINCE_1_2_4="@since 1.2.4"
+ALIASES += SINCE_1_2_5="@since 1.2.5"
+ALIASES += SINCE_1_2_10="@since 1.2.10"
+ALIASES += SINCE_1_2_14="@since 1.2.14"
ALIASES += DEPRECATED_1_0="@deprecated Deprecated since 1.0"
ALIASES += DEPRECATED_1_1="@deprecated Deprecated since 1.1"
+ALIASES += DEPRECATED_1_2_10="@deprecated Deprecated since 1.2.10"
+ALIASES += DEPRECATED_1_2="@deprecated Deprecated since 1.2"
ALIASES += PLATFORM=""
ALIASES += PRIVLEVEL_PLATFORM=""
+ALIASES += PRIVLEVEL_PUBLIC=""
ALIASES += PRIVILEGE_KEYGRAB=""
+ALIASES += PRIVILEGE_DISPLAY=""
+ALIASES += REMARK_INTERNET=""
+ALIASES += REMARK_STORAGE=""
############################################
## For Tizen Native API Reference
#ALIASES += SINCE_1_0="\par Since:\n 2.4, DALi version 1.0"
#ALIASES += SINCE_1_1="\par Since:\n 3.0, DALi version 1.1"
+#ALIASES += SINCE_1_2="\par Since:\n 4.0, DALi version 1.2"
+
+## Extra tags for Tizen 3.0
+#ALIASES += SINCE_1_2_2="\par Since:\n 3.0, DALi version 1.2.2"
+#ALIASES += SINCE_1_2_4="\par Since:\n 3.0, DALi version 1.2.4"
+#ALIASES += SINCE_1_2_5="\par Since:\n 3.0, DALi version 1.2.5"
+#ALIASES += SINCE_1_2_10="\par Since:\n 3.0, DALi version 1.2.10"
+#ALIASES += SINCE_1_2_14="\par Since:\n 3.0, DALi version 1.2.14"
## DALi has no deprecated API in Tizen 2.4 because it's DALi's first release.
## Thus deprecated APIs in DALi 1.0.xx will be deprecated in Tizen 3.0.
#ALIASES += DEPRECATED_1_0="@deprecated Deprecated since 3.0, DALi version 1.0"
#ALIASES += DEPRECATED_1_1="@deprecated Deprecated since 3.0, DALi version 1.1"
+#ALIASES += DEPRECATED_1_2_10="@deprecated Deprecated since 3.0, DALi version 1.2.10"
+#ALIASES += DEPRECATED_1_2="@deprecated Deprecated since 4.0, DALi version 1.2"
#ALIASES += PLATFORM="@platform"
#ALIASES += PRIVLEVEL_PLATFORM="\par Privilege Level:\n platform"
+#ALIASES += PRIVLEVEL_PUBLIC="\par Privilege Level:\n public"
#ALIASES += PRIVILEGE_KEYGRAB="\par Privilege:\n http://tizen.org/privilege/keygrab"
-
+#ALIASES += PRIVILEGE_DISPLAY="\par Privilege:\n http://tizen.org/privilege/display"
+#ALIASES += REMARK_INTERNET="@remarks %http://tizen.org/privilege/internet is needed if @a url is a http or https address."
+#ALIASES += REMARK_STORAGE="@remarks %http://tizen.org/privilege/mediastorage is needed if @a url is relevant to media storage. @remarks %http://tizen.org/privilege/externalstorage is needed if @a url is relevant to external storage."
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
ALIASES += PRIVILEGE_KEYGRAB=""
ALIASES += PRIVILEGE_DISPLAY=""
ALIASES += REMARK_INTERNET=""
+ALIASES += REMARK_STORAGE=""
############################################
## For Tizen Native API Reference
#ALIASES += PRIVILEGE_KEYGRAB="\par Privilege:\n http://tizen.org/privilege/keygrab"
#ALIASES += PRIVILEGE_DISPLAY="\par Privilege:\n http://tizen.org/privilege/display"
#ALIASES += REMARK_INTERNET="@remarks %http://tizen.org/privilege/internet is needed if @a url is a http or https address."
-
+#ALIASES += REMARK_STORAGE="@remarks %http://tizen.org/privilege/mediastorage is needed if @a url is relevant to media storage. @remarks %http://tizen.org/privilege/externalstorage is needed if @a url is relevant to external storage."
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
$(dali_swig_dir)/automatic/cpp/dali_wrap.cpp \
$(dali_swig_dir)/automatic/cpp/dali_wrap.h \
$(dali_swig_dir)/manual/cpp/keyboard_focus_manager_wrap.cpp \
- $(dali_swig_dir)/manual/cpp/view-wrapper-impl-wrap.cpp
+ $(dali_swig_dir)/manual/cpp/view-wrapper-impl-wrap.cpp \
+ $(dali_swig_dir)/manual/cpp/callbackbase_wrap.cpp
all-local:
gbs-local: libNDalic.so NDali.dll
-libNDalic.so: $(dali_swig_dir)/automatic/cpp/dali_wrap.o $(dali_swig_dir)/manual/cpp/keyboard_focus_manager_wrap.o $(dali_swig_dir)/manual/cpp/view-wrapper-impl-wrap.o
- $(CXX) -shared $(dali_swig_dir)/automatic/cpp/dali_wrap.o $(dali_swig_dir)/manual/cpp/keyboard_focus_manager_wrap.o $(dali_swig_dir)/manual/cpp/view-wrapper-impl-wrap.o -o $(dali_swig_dir)/libNDalic.so $(DALICORE_LIBS) $(DALIADAPTOR_LIBS) $(DALITOOLKIT_LIBS)
+libNDalic.so: $(dali_swig_dir)/automatic/cpp/dali_wrap.o $(dali_swig_dir)/manual/cpp/keyboard_focus_manager_wrap.o $(dali_swig_dir)/manual/cpp/view-wrapper-impl-wrap.o $(dali_swig_dir)/manual/cpp/callbackbase_wrap.o
+ $(CXX) -shared $(dali_swig_dir)/automatic/cpp/dali_wrap.o $(dali_swig_dir)/manual/cpp/keyboard_focus_manager_wrap.o $(dali_swig_dir)/manual/cpp/view-wrapper-impl-wrap.o $(dali_swig_dir)/manual/cpp/callbackbase_wrap.o -o $(dali_swig_dir)/libNDalic.so $(DALICORE_LIBS) $(DALIADAPTOR_LIBS) $(DALITOOLKIT_LIBS)
$(dali_swig_dir)/automatic/cpp/dali_wrap.o: $(BUILT_SOURCES)
$(CXX) -c -fpic $(CXXFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) $(dali_swig_dir)/automatic/cpp/dali_wrap.cpp -o $(dali_swig_dir)/automatic/cpp/dali_wrap.o
$(dali_swig_dir)/manual/cpp/view-wrapper-impl-wrap.o: $(BUILT_SOURCES)
$(CXX) -c -fpic $(CXXFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) $(dali_swig_dir)/manual/cpp/view-wrapper-impl-wrap.cpp -o $(dali_swig_dir)/manual/cpp/view-wrapper-impl-wrap.o
+$(dali_swig_dir)/manual/cpp/callbackbase_wrap.cpp.o: $(BUILT_SOURCES)
+ $(CXX) -c -fpic $(CXXFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) $(dali_swig_dir)/manual/cpp/callbackbase_wrap.cpp -o $(dali_swig_dir)/manual/cpp/callbackbase_wrap.o
+
NDali.dll: $(BUILT_SOURCES)
# mcs -nologo -target:library -out:$(dali_swig_dir)/NDali.dll $(dali_swig_dir)/automatic/csharp/*.cs $(dali_swig_dir)/manual/csharp/*.cs
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
#include <dali-toolkit/public-api/visuals/mesh-visual-properties.h>
#include <dali-toolkit/public-api/visuals/primitive-visual-properties.h>
-#include <dali-toolkit/public-api/visuals/text-visual-properties.h>
#include <dali-toolkit/public-api/visuals/visual-properties.h>
#include <dali-toolkit/public-api/dali-toolkit-version.h>
#define __DALI_TOOLKIT_POPUP_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
BACKING_ENABLED, ///< name "backingEnabled", type bool
BACKING_COLOR, ///< name "backingColor", type Vector4
POPUP_BACKGROUND_IMAGE, ///< name "popupBackgroundImage", type std::string
+ POPUP_BACKGROUND_BORDER, ///< name "popupBackgroundBorder", type Rect< int >, Values are in the order: left, right, bottom, top
TAIL_UP_IMAGE, ///< name "tailUpImage", type std::string
TAIL_DOWN_IMAGE, ///< name "tailDownImage", type std::string
TAIL_LEFT_IMAGE, ///< name "tailLeftImage", type std::string
devel_api_visual_factory_header_files = \
$(devel_api_src_dir)/visual-factory/transition-data.h \
- $(devel_api_src_dir)/visual-factory/devel-visual-properties.h \
$(devel_api_src_dir)/visual-factory/visual-factory.h \
$(devel_api_src_dir)/visual-factory/visual-base.h
+devel_api_visuals_header_files = \
+ $(devel_api_src_dir)/visuals/text-visual-properties.h \
+ $(devel_api_src_dir)/visuals/visual-properties-devel.h
+
devel_api_shadow_view_header_files = \
$(devel_api_src_dir)/controls/shadow-view/shadow-view.h
#include <dali/public-api/object/property-map.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
namespace Dali
{
Property::Map customShader;
customShader[ Visual::Shader::Property::VERTEX_SHADER ] = vertexShader;
- map[ VisualProperty::SHADER ] = customShader;
+ map[ DevelVisual::Property::SHADER ] = customShader;
return map;
}
GetImplementation( *this ).CreatePropertyMap( map );
}
-void Visual::Base::SetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
-{
- GetImplementation( *this ).SetProperty( index, propertyValue );
-}
-
-Dali::Property::Value Visual::Base::GetProperty( Dali::Property::Index index )
-{
- return GetImplementation( *this ).GetProperty( index );
-}
-
} // namespace Toolkit
} // namespace Dali
*/
void CreatePropertyMap( Dali::Property::Map& map ) const;
- /**
- * @brief Sets the value of an existing property.
- *
- * @param [in] index The index of the property.
- * @param [in] propertyValue The new value of the property.
- */
- void SetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
-
- /**
- * @brief Retrieves a property value.
- *
- * @param [in] index The index of the property.
- *
- * @return The property value.
- */
- Dali::Property::Value GetProperty( Dali::Property::Index index );
-
public: // Not intended for application developers
explicit DALI_INTERNAL Base(Internal::Visual::Base *impl);
--- /dev/null
+#ifndef DALI_TOOLKIT_TEXT_VISUAL_PROPERTIES_H
+#define DALI_TOOLKIT_TEXT_VISUAL_PROPERTIES_H
+
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/toolkit-property-index-ranges.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace TextVisual
+{
+
+namespace Property
+{
+
+enum
+{
+ /**
+ * @brief The text to display in UTF-8 format,
+ * @details name "text", type STRING
+ */
+ TEXT = VISUAL_PROPERTY_START_INDEX,
+
+ /**
+ * @brief The requested font family to use,
+ * @details name "fontFamily", type STRING
+ */
+ FONT_FAMILY,
+
+ /**
+ * @brief The requested font style to use,
+ * @details name "fontStyle", type MAP
+ */
+ FONT_STYLE,
+
+ /**
+ * @brief The size of font in points
+ * @details name "pointSize", type FLOAT
+ */
+ POINT_SIZE,
+
+ /**
+ * @brief The single-line or multi-line layout option
+ * @details name "multiLine", type BOOLEAN, default false
+ */
+ MULTI_LINE,
+
+ /**
+ * @brief The line horizontal alignment
+ * @details name "horizontalAlignment", type STRING, values "BEGIN", "CENTER", "END", default BEGIN
+ */
+ HORIZONTAL_ALIGNMENT,
+
+ /**
+ * @brief The line vertical alignment
+ * @details name "verticalAlignment", type STRING, values "TOP", "CENTER", "BOTTOM", default TOP
+ */
+ VERTICAL_ALIGNMENT,
+
+ /**
+ * @brief The color of the text
+ * @details name "textColor", type VECTOR4
+ */
+ TEXT_COLOR,
+
+ /**
+ * @brief Whether the mark-up processing is enabled
+ * @details name "enableMarkup", type BOOLEAN
+ */
+ ENABLE_MARKUP,
+};
+
+} // namespace Property
+
+} // namespace TextVisual
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_VISUAL_PROPERTIES_H
-#ifndef DALI_TOOLKIT_DEVEL_VISUAL_PROPERTIES_H
-#define DALI_TOOLKIT_DEVEL_VISUAL_PROPERTIES_H
+#ifndef DALI_TOOLKIT_DEVEL_API_VISUALS_VISUAL_PROPERTIES_DEVEL_H
+#define DALI_TOOLKIT_DEVEL_API_VISUALS_VISUAL_PROPERTIES_DEVEL_H
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/toolkit-property-index-ranges.h>
#include <dali-toolkit/public-api/visuals/visual-properties.h>
namespace Dali
namespace Toolkit
{
-namespace Visual
+namespace DevelVisual
{
-// Mirror of public API Property namespace with addition of enums that are not yet
-// public. A namespace alias is used below to reduce implementation cruft.
+/**
+ * @brief All the visual types.
+ */
+enum Type
+{
+ BORDER = Dali::Toolkit::Visual::BORDER,
+ COLOR = Dali::Toolkit::Visual::COLOR,
+ GRADIENT = Dali::Toolkit::Visual::GRADIENT,
+ IMAGE = Dali::Toolkit::Visual::IMAGE,
+ MESH = Dali::Toolkit::Visual::MESH,
+ PRIMITIVE = Dali::Toolkit::Visual::PRIMITIVE,
+ WIREFRAME = Dali::Toolkit::Visual::WIREFRAME,
+
+ TEXT = WIREFRAME + 1, ///< Renders text.
+};
-namespace DevelProperty
+namespace Property
{
enum Type
* @details Name "transform", type Property::Map.
* @note Optional.
- * @see DevelProperty::Transform::Property
+ * @see DevelVisual::Transform::Property
*/
TRANSFORM = SHADER+1//Dali::Toolkit::Visual::Property::SHADER+1
};
+} //namespace Property
+
namespace Transform
{
} //namespace Property
-} //namespace Transform
-
-} // namespace DevelProperty
+} // namespace Transform
-} // namespace Visual
-
-namespace VisualProperty = Visual::DevelProperty;
+} // namespace DevelVisual
} // namespace Toolkit
} // namespace Dali
-
-#endif // DALI_TOOLKIT_DEVEL_VISUAL_PROPERTIES_H
+#endif // DALI_TOOLKIT_DEVEL_API_VISUALS_VISUAL_PROPERTIES_DEVEL_H
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/controls/gaussian-blur-view/gaussian-blur-view.h>
#include <dali-toolkit/devel-api/controls/bloom-view/bloom-view.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/controls/gaussian-blur-view/gaussian-blur-view-impl.h>
namespace Dali
Property::Map customShader;
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = BLOOM_EXTRACT_FRAGMENT_SOURCE;
Property::Map visualMap;
- visualMap.Insert( Toolkit::VisualProperty::SHADER, customShader );
+ visualMap.Insert( Toolkit::DevelVisual::Property::SHADER, customShader );
mBloomExtractImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
// set GaussianBlurView to blur our extracted bloom
mCompositeImageView.SetImage( mRenderTargetForRenderingChildren );
// Create shader used to composite bloom and original image to output render target
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = COMPOSITE_FRAGMENT_SOURCE;
- visualMap[ Toolkit::VisualProperty::SHADER ] = customShader;
+ visualMap[ Toolkit::DevelVisual::Property::SHADER ] = customShader;
mCompositeImageView.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
TextureSet textureSet = mCompositeImageView.GetRendererAt(0).GetTextures();
TextureSetImage( textureSet, 1u, mBlurExtractTarget );
#include <dali/public-api/object/property-map.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#define DALI_COMPOSE_SHADER(STR) #STR
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = fragmentShader;
Property::Map map;
- map[ Toolkit::VisualProperty::SHADER ] = customShader;
+ map[ Toolkit::DevelVisual::Property::SHADER ] = customShader;
return map;
}
#include <dali-toolkit/public-api/controls/text-controls/text-label.h>
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
Toolkit::Visual::Base visual;
Property::Map map;
- map[ Toolkit::VisualProperty::TYPE ] = Toolkit::Visual::COLOR;
+ map[ Toolkit::DevelVisual::Property::TYPE ] = Toolkit::Visual::COLOR;
map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color;
visual = visualFactory.CreateVisual( map );
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
// TODO:
// pixel format / size - set from JSON
horizFragmentShaderStringStream << GAUSSIAN_BLUR_FRAGMENT_SOURCE;
Property::Map source;
source[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = horizFragmentShaderStringStream.str();
- mCustomShader[ Toolkit::VisualProperty::SHADER ] = source;
+ mCustomShader[ Toolkit::DevelVisual::Property::SHADER ] = source;
//////////////////////////////////////////////////////
// Create actors
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/image-view/image-view.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
{
transformMap.Clear();
transformMap
- .Add( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET, Vector2(0.0f, 0.0f) )
- .Add( Toolkit::Visual::DevelProperty::Transform::Property::SIZE, Vector2(1.0f, 1.0f) )
- .Add( Toolkit::Visual::DevelProperty::Transform::Property::ORIGIN, Toolkit::Align::CENTER )
- .Add( Toolkit::Visual::DevelProperty::Transform::Property::ANCHOR_POINT, Toolkit::Align::CENTER )
- .Add( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET_SIZE_MODE, Vector4::ZERO );
+ .Add( Toolkit::DevelVisual::Transform::Property::OFFSET, Vector2(0.0f, 0.0f) )
+ .Add( Toolkit::DevelVisual::Transform::Property::SIZE, Vector2(1.0f, 1.0f) )
+ .Add( Toolkit::DevelVisual::Transform::Property::ORIGIN, Toolkit::Align::CENTER )
+ .Add( Toolkit::DevelVisual::Transform::Property::ANCHOR_POINT, Toolkit::Align::CENTER )
+ .Add( Toolkit::DevelVisual::Transform::Property::OFFSET_SIZE_MODE, Vector4::ZERO );
}
case Toolkit::ImageView::Property::IMAGE:
{
std::string imageUrl;
- Property::Map map;
+ Property::Map* map;
if( value.Get( imageUrl ) )
{
impl.SetImage( imageUrl, ImageDimensions() );
}
// if its not a string then get a Property::Map from the property if possible.
- else if( value.Get( map ) )
+ else
{
- Property::Value* shaderValue = map.Find( Toolkit::VisualProperty::SHADER, CUSTOM_SHADER );
- // set image only if property map contains image information other than custom shader
- if( map.Count() > 1u || !shaderValue )
+ map = value.GetMap();
+ if( map )
{
- impl.SetImage( map );
- }
- // the property map contains only the custom shader
- else if( impl.mVisual && map.Count() == 1u && shaderValue )
- {
- Property::Map shaderMap;
- if( shaderValue->Get( shaderMap ) )
+ Property::Value* shaderValue = map->Find( Toolkit::DevelVisual::Property::SHADER, CUSTOM_SHADER );
+ // set image only if property map contains image information other than custom shader
+ if( map->Count() > 1u || !shaderValue )
+ {
+ impl.SetImage( *map );
+ }
+ // the property map contains only the custom shader
+ else if( ( impl.mVisual )&&( map->Count() == 1u )&&( shaderValue ) )
{
- Internal::Visual::Base& visual = Toolkit::GetImplementation( impl.mVisual );
- visual.SetCustomShader( shaderMap );
- if( imageView.OnStage() )
+ Property::Map* shaderMap = shaderValue->GetMap();
+ if( shaderMap )
{
- // force to create new core renderer to use the newly set shader
- visual.SetOffStage( imageView );
- visual.SetOnStage( imageView );
+ Internal::Visual::Base& visual = Toolkit::GetImplementation( impl.mVisual );
+ visual.SetCustomShader( *shaderMap );
+ if( imageView.OnStage() )
+ {
+ // force to create new core renderer to use the newly set shader
+ visual.SetOffStage( imageView );
+ visual.SetOnStage( imageView );
+ }
}
}
}
#include <dali-toolkit/public-api/visuals/border-visual-properties.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
namespace Dali
{
Toolkit::VisualFactory visualFactory = Toolkit::VisualFactory::Get();
Property::Map map;
- map[ Toolkit::VisualProperty::TYPE ] = Toolkit::Visual::BORDER;
+ map[ Toolkit::DevelVisual::Property::TYPE ] = Toolkit::Visual::BORDER;
map[ Toolkit::BorderVisual::Property::COLOR ] = Color::WHITE;
map[ Toolkit::BorderVisual::Property::SIZE ] = IMAGE_BORDER_INDENT;
Toolkit::Visual::Base borderVisual = visualFactory.CreateVisual( map );
*/
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#define DALI_COMPOSE_SHADER(STR) #STR
customShader[ Toolkit::Visual::Shader::Property::VERTEX_SHADER ] = vertexSource;
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = fragmentSource;
- map[ Toolkit::VisualProperty::SHADER ] = customShader;
+ map[ Toolkit::DevelVisual::Property::SHADER ] = customShader;
return map;
}
#include <dali/public-api/object/property-map.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-effect.h>
using namespace Dali;
customShader[ Toolkit::Visual::Shader::Property::SUBDIVIDE_GRID_X ] = 20;
customShader[ Toolkit::Visual::Shader::Property::SUBDIVIDE_GRID_Y ] = 20;
- map[ Toolkit::VisualProperty::SHADER ] = customShader;
+ map[ Toolkit::DevelVisual::Property::SHADER ] = customShader;
return map;
}
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-effect.h>
#include <dali-toolkit/internal/controls/page-turn-view/page-turn-book-spine-effect.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
Shader PageTurnView::CreateShader( const Property::Map& shaderMap )
{
Shader shader;
- Property::Value* shaderValue = shaderMap.Find( Toolkit::VisualProperty::SHADER, CUSTOM_SHADER );
+ Property::Value* shaderValue = shaderMap.Find( Toolkit::DevelVisual::Property::SHADER, CUSTOM_SHADER );
Property::Map shaderSource;
if( shaderValue && shaderValue->Get( shaderSource ) )
{
DALI_TYPE_REGISTRATION_BEGIN( Toolkit::Popup, Toolkit::Control, Create )
// Main content related properties.
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "title", MAP, TITLE )
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "content", MAP, CONTENT )
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "footer", MAP, FOOTER )
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "displayState", STRING, DISPLAY_STATE )
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "touchTransparent", BOOLEAN, TOUCH_TRANSPARENT )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "title", MAP, TITLE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "content", MAP, CONTENT )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "footer", MAP, FOOTER )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "displayState", STRING, DISPLAY_STATE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "touchTransparent", BOOLEAN, TOUCH_TRANSPARENT )
// Contextual related properties.
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tailVisibility", BOOLEAN, TAIL_VISIBILITY )
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tailPosition", VECTOR3, TAIL_POSITION )
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "contextualMode", STRING, CONTEXTUAL_MODE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tailVisibility", BOOLEAN, TAIL_VISIBILITY )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tailPosition", VECTOR3, TAIL_POSITION )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "contextualMode", STRING, CONTEXTUAL_MODE )
// Animation related properties.
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "animationDuration", FLOAT, ANIMATION_DURATION )
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "animationMode", STRING, ANIMATION_MODE )
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "entryAnimation", MAP, ENTRY_ANIMATION )
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "exitAnimation", MAP, EXIT_ANIMATION )
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "autoHideDelay", INTEGER, AUTO_HIDE_DELAY )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "animationDuration", FLOAT, ANIMATION_DURATION )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "animationMode", STRING, ANIMATION_MODE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "entryAnimation", MAP, ENTRY_ANIMATION )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "exitAnimation", MAP, EXIT_ANIMATION )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "autoHideDelay", INTEGER, AUTO_HIDE_DELAY )
// Style related properties.
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "backingEnabled", BOOLEAN, BACKING_ENABLED )
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "backingColor", VECTOR4, BACKING_COLOR )
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "popupBackgroundImage", STRING, POPUP_BACKGROUND_IMAGE )
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tailUpImage", STRING, TAIL_UP_IMAGE )
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tailDownImage", STRING, TAIL_DOWN_IMAGE )
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tailLeftImage", STRING, TAIL_LEFT_IMAGE )
-DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tailRightImage", STRING, TAIL_RIGHT_IMAGE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "backingEnabled", BOOLEAN, BACKING_ENABLED )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "backingColor", VECTOR4, BACKING_COLOR )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "popupBackgroundImage", STRING, POPUP_BACKGROUND_IMAGE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "popupBackgroundBorder", RECTANGLE, POPUP_BACKGROUND_BORDER )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tailUpImage", STRING, TAIL_UP_IMAGE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tailDownImage", STRING, TAIL_DOWN_IMAGE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tailLeftImage", STRING, TAIL_LEFT_IMAGE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tailRightImage", STRING, TAIL_RIGHT_IMAGE )
// Signals.
-DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "touchedOutside", SIGNAL_TOUCHED_OUTSIDE )
-DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "showing", SIGNAL_SHOWING )
-DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "shown", SIGNAL_SHOWN )
-DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "hiding", SIGNAL_HIDING )
-DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "hidden", SIGNAL_HIDDEN )
+DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "touchedOutside", SIGNAL_TOUCHED_OUTSIDE )
+DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "showing", SIGNAL_SHOWING )
+DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "shown", SIGNAL_SHOWN )
+DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "hiding", SIGNAL_HIDING )
+DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "hidden", SIGNAL_HIDDEN )
DALI_TYPE_REGISTRATION_END()
const char* DEFAULT_TAIL_RIGHT_IMAGE_PATH = DALI_IMAGE_DIR "popup_tail_right.png"; ///< Tail right image.
const Vector4 DEFAULT_BACKING_COLOR( 0.0f, 0.0f, 0.0f, 0.5f ); ///< Color of the dimmed backing.
-const Vector3 BACKGROUND_OUTER_BORDER( 40.0f, 30.0f, 0.0f ); ///< External border.
+const Rect<int> DEFAULT_BACKGROUND_BORDER( 17, 17, 13, 13 ); ///< Default border of the background.
const Rect<float> DEFAULT_TITLE_PADDING( 20.0f, 20.0f, 20.0f, 20.0f ); ///< Title padding used on popups with content and/or controls (from Tizen GUI UX).
const Rect<float> DEFAULT_TITLE_ONLY_PADDING( 8.0f, 8.0f, 8.0f, 8.0f ); ///< Title padding used on popups with a title only (like toast popups).
const Vector3 FOOTER_SIZE( 620.0f, 96.0f,0.0f ); ///< Default size of the bottom control area.
mBackingEnabled( true ),
mBackingColor( DEFAULT_BACKING_COLOR ),
mPopupBackgroundImage(),
- mBackgroundOuterBorder(),
+ mBackgroundBorder( DEFAULT_BACKGROUND_BORDER ),
mMargin(),
mTailUpImage( DEFAULT_TAIL_UP_IMAGE_PATH ),
mTailDownImage( DEFAULT_TAIL_DOWN_IMAGE_PATH ),
// Removes any previous background.
if( mPopupBackgroundImage )
{
- mPopupContainer.Remove( mPopupBackgroundImage );
+ mPopupBackgroundImage.Unparent();
+ if( mTailImage )
+ {
+ mTailImage.Unparent();
+ }
}
// Adds new background to the dialog.
mPopupBackgroundImage.TouchSignal().Connect( this, &Popup::OnDialogTouched );
// Set the popup border to be slightly larger than the layout contents.
- mPopupBackgroundImage.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
- mPopupBackgroundImage.SetSizeModeFactor( BACKGROUND_OUTER_BORDER );
+ UpdateBackgroundPositionAndSize();
const bool prevAlter = mAlterAddedChild;
mAlterAddedChild = false;
mPopupContainer.Add( mPopupBackgroundImage );
mAlterAddedChild = prevAlter;
+ if( mTailImage )
+ {
+ mPopupBackgroundImage.Add( mTailImage );
+ }
+
mLayoutDirty = true;
}
return;
}
- const Vector3& position = GetTailPosition();
+ const Vector3& parentOrigin = GetTailPosition();
+ Vector3 position;
std::string image;
+ Vector3 anchorPoint;
// depending on position of tail around ParentOrigin, a different tail image is used...
- if( position.y < Math::MACHINE_EPSILON_1 )
+ if( parentOrigin.y < Math::MACHINE_EPSILON_1 )
{
image = mTailUpImage;
+ anchorPoint = AnchorPoint::BOTTOM_CENTER;
+ position.y = mBackgroundBorder.top;
}
- else if( position.y > 1.0f - Math::MACHINE_EPSILON_1 )
+ else if( parentOrigin.y > ( 1.0f - Math::MACHINE_EPSILON_1 ) )
{
image = mTailDownImage;
+ anchorPoint = AnchorPoint::TOP_CENTER;
+ position.y = - mBackgroundBorder.bottom;
}
- else if( position.x < Math::MACHINE_EPSILON_1 )
+ else if( parentOrigin.x < Math::MACHINE_EPSILON_1 )
{
image = mTailLeftImage;
+ anchorPoint = AnchorPoint::CENTER_RIGHT;
+ position.x = mBackgroundBorder.left;
}
- else if( position.x > 1.0f - Math::MACHINE_EPSILON_1 )
+ else if( parentOrigin.x > ( 1.0f - Math::MACHINE_EPSILON_1 ) )
{
image = mTailRightImage;
+ anchorPoint = AnchorPoint::CENTER_LEFT;
+ position.x = - mBackgroundBorder.right;
}
if( !image.empty() )
// Adds the tail actor.
mTailImage = Toolkit::ImageView::New( image );
mTailImage.SetName( "tailImage" );
- const Vector3 anchorPoint = AnchorPoint::BOTTOM_RIGHT - position;
- mTailImage.SetParentOrigin( position );
+ mTailImage.SetParentOrigin( parentOrigin );
mTailImage.SetAnchorPoint( anchorPoint );
+ mTailImage.SetPosition( position );
- mPopupContainer.Add( mTailImage );
+ if( mPopupBackgroundImage )
+ {
+ mPopupBackgroundImage.Add( mTailImage );
+ }
}
}
Scripting::NewAnimation( map, mExitAnimationData );
}
+void Popup::UpdateBackgroundPositionAndSize()
+{
+ if( mPopupBackgroundImage )
+ {
+ mPopupBackgroundImage.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
+ mPopupBackgroundImage.SetSizeModeFactor( Vector3( mBackgroundBorder.left + mBackgroundBorder.right, mBackgroundBorder.top + mBackgroundBorder.bottom, 0.0f ) );
+
+ // Adjust the position of the background so the transparent areas are set appropriately
+ mPopupBackgroundImage.SetPosition( ( mBackgroundBorder.right - mBackgroundBorder.left ) * 0.5f, ( mBackgroundBorder.bottom - mBackgroundBorder.top ) * 0.5f );
+ }
+}
+
void Popup::SetAutoHideDelay( int delay )
{
mAutoHideDelay = delay;
{
mTailUpImage = image;
mLayoutDirty = true;
+ LayoutTail();
}
const std::string& Popup::GetTailUpImage() const
{
mTailDownImage = image;
mLayoutDirty = true;
+ LayoutTail();
}
const std::string& Popup::GetTailDownImage() const
{
mTailLeftImage = image;
mLayoutDirty = true;
+ LayoutTail();
}
const std::string& Popup::GetTailLeftImage() const
{
mTailRightImage = image;
mLayoutDirty = true;
+ LayoutTail();
}
const std::string& Popup::GetTailRightImage() const
}
break;
}
+ case Toolkit::Popup::Property::POPUP_BACKGROUND_BORDER:
+ {
+ bool valueUpdated = false;
+
+ Vector4 valueVector4;
+ if( value.Get( popupImpl.mBackgroundBorder ) )
+ {
+ valueUpdated = true;
+ }
+ else if( value.Get( valueVector4 ) )
+ {
+ popupImpl.mBackgroundBorder.left = valueVector4.x;
+ popupImpl.mBackgroundBorder.right = valueVector4.y;
+ popupImpl.mBackgroundBorder.bottom = valueVector4.z;
+ popupImpl.mBackgroundBorder.top = valueVector4.w;
+ valueUpdated = true;
+ }
+
+ if( valueUpdated )
+ {
+ popupImpl.LayoutTail(); // Update the tail if required
+ popupImpl.UpdateBackgroundPositionAndSize(); // Update the background's size and position
+ }
+ break;
+ }
case Toolkit::Popup::Property::TAIL_UP_IMAGE:
{
std::string valueString;
}
break;
}
+ case Toolkit::Popup::Property::POPUP_BACKGROUND_BORDER:
+ {
+ value = popupImpl.mBackgroundBorder;
+ break;
+ }
case Toolkit::Popup::Property::TAIL_UP_IMAGE:
{
value = popupImpl.GetTailUpImage();
#define __DALI_TOOLKIT_INTERNAL_POPUP_H__
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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 SetExitAnimationData( const Property::Map& map );
+ /**
+ * @briefs Updates the popup background's position and size.
+ */
+ void UpdateBackgroundPositionAndSize();
+
public: // Signals
/**
bool mBackingEnabled; ///< True if a dimmed backing will be used.
Vector4 mBackingColor; ///< The color of the backing.
Actor mPopupBackgroundImage; ///< Stores the background image.
- Vector4 mBackgroundOuterBorder; ///< Background external border margin size
+ Rect<int> mBackgroundBorder; ///< Background border.
float mMargin; ///< Internal margin for popup contents.
std::string mTailUpImage; ///< Image used for the tail for the up direction.
std::string mTailDownImage; ///< Image used for the tail for the down direction.
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/controls/shadow-view/shadow-view-impl.h>
#include <dali-toolkit/internal/filters/blur-two-pass-filter.h>
customShader[ Toolkit::Visual::Shader::Property::HINTS ] = Shader::Hint::OUTPUT_IS_TRANSPARENT;
- mShadowVisualMap[ Toolkit::VisualProperty::SHADER ] = customShader;
+ mShadowVisualMap[ Toolkit::DevelVisual::Property::SHADER ] = customShader;
// Create render targets needed for rendering from light's point of view
mSceneFromLightRenderTarget = FrameBufferImage::New( stageSize.width, stageSize.height, Pixel::RGBA8888 );
const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] =
{
- { "BEGIN", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_BEGIN },
- { "CENTER", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_CENTER },
- { "END", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_END },
+ { "BEGIN", Toolkit::Text::Layout::HORIZONTAL_ALIGN_BEGIN },
+ { "CENTER", Toolkit::Text::Layout::HORIZONTAL_ALIGN_CENTER },
+ { "END", Toolkit::Text::Layout::HORIZONTAL_ALIGN_END },
};
const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE ) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] );
{
if( impl.mController )
{
- const std::string text = value.Get< std::string >();
+ const std::string& text = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p TEXT %s\n", impl.mController.Get(), text.c_str() );
impl.mController->SetText( text );
{
if( impl.mController )
{
- const Vector4 textColor = value.Get< Vector4 >();
+ const Vector4& textColor = value.Get< Vector4 >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a );
- if( impl.mController->GetTextColor() != textColor )
+ if( impl.mController->GetDefaultColor() != textColor )
{
- impl.mController->SetTextColor( textColor );
+ impl.mController->SetDefaultColor( textColor );
impl.mController->SetInputColor( textColor );
impl.mRenderer.Reset();
}
{
if( impl.mController )
{
- const std::string fontFamily = value.Get< std::string >();
+ const std::string& fontFamily = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() );
impl.mController->SetDefaultFontFamily( fontFamily );
}
{
if( impl.mController )
{
- const std::string alignStr = value.Get< std::string >();
+ const std::string& alignStr = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p HORIZONTAL_ALIGNMENT %s\n", impl.mController.Get(), alignStr.c_str() );
- LayoutEngine::HorizontalAlignment alignment( LayoutEngine::HORIZONTAL_ALIGN_BEGIN );
- if( Scripting::GetEnumeration< LayoutEngine::HorizontalAlignment >( alignStr.c_str(),
- HORIZONTAL_ALIGNMENT_STRING_TABLE,
- HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT,
- alignment ) )
+ Layout::HorizontalAlignment alignment( Layout::HORIZONTAL_ALIGN_BEGIN );
+ if( Scripting::GetEnumeration< Layout::HorizontalAlignment >( alignStr.c_str(),
+ HORIZONTAL_ALIGNMENT_STRING_TABLE,
+ HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT,
+ alignment ) )
{
impl.mController->SetHorizontalAlignment( alignment );
}
{
if( impl.mDecorator )
{
- const Vector4 color = value.Get< Vector4 >();
+ const Vector4& color = value.Get< Vector4 >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p PRIMARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
impl.mDecorator->SetCursorColor( PRIMARY_CURSOR, color );
{
if( impl.mDecorator )
{
- const Vector4 color = value.Get< Vector4 >();
+ const Vector4& color = value.Get< Vector4 >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p SECONDARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
impl.mDecorator->SetCursorColor( SECONDARY_CURSOR, color );
{
if( impl.mDecorator )
{
- const Rect<int> box = value.Get< Rect<int> >();
+ const Rect<int>& box = value.Get< Rect<int> >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p DECORATION_BOUNDING_BOX %d,%d %dx%d\n", impl.mController.Get(), box.x, box.y, box.width, box.height );
impl.mDecorator->SetBoundingBox( box );
{
if( impl.mController )
{
- const Vector4 inputColor = value.Get< Vector4 >();
+ const Vector4& inputColor = value.Get< Vector4 >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p INPUT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), inputColor.r, inputColor.g, inputColor.b, inputColor.a );
impl.mController->SetInputColor( inputColor );
{
if( impl.mController )
{
- const std::string fontFamily = value.Get< std::string >();
+ const std::string& fontFamily = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p INPUT_FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() );
impl.mController->SetInputFontFamily( fontFamily );
}
{
if ( impl.mController )
{
- value = impl.mController->GetTextColor();
+ value = impl.mController->GetDefaultColor();
}
break;
}
{
if( impl.mController )
{
- const char* name = Scripting::GetEnumerationName< Toolkit::Text::LayoutEngine::HorizontalAlignment >( impl.mController->GetLayoutEngine().GetHorizontalAlignment(),
- HORIZONTAL_ALIGNMENT_STRING_TABLE,
- HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
+ const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::HorizontalAlignment >( impl.mController->GetHorizontalAlignment(),
+ HORIZONTAL_ALIGNMENT_STRING_TABLE,
+ HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
if( name )
{
value = std::string( name );
mDecorator = Text::Decorator::New( *mController,
*mController );
- mController->GetLayoutEngine().SetLayout( LayoutEngine::MULTI_LINE_BOX );
+ mController->GetLayoutEngine().SetLayout( Layout::Engine::MULTI_LINE_BOX );
// Enables the text input.
mController->EnableTextInput( mDecorator );
if( mRenderableActor )
{
- const Vector2& scrollOffset = mController->GetScrollPosition();
+ const Vector2& scrollOffset = mController->GetTextModel()->GetScrollPosition();
mRenderableActor.SetPosition( scrollOffset.x, scrollOffset.y );
const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] =
{
- { "BEGIN", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_BEGIN },
- { "CENTER", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_CENTER },
- { "END", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_END },
+ { "BEGIN", Toolkit::Text::Layout::HORIZONTAL_ALIGN_BEGIN },
+ { "CENTER", Toolkit::Text::Layout::HORIZONTAL_ALIGN_CENTER },
+ { "END", Toolkit::Text::Layout::HORIZONTAL_ALIGN_END },
};
const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE ) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] );
const Scripting::StringEnum VERTICAL_ALIGNMENT_STRING_TABLE[] =
{
- { "TOP", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_TOP },
- { "CENTER", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_CENTER },
- { "BOTTOM", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_BOTTOM },
+ { "TOP", Toolkit::Text::Layout::VERTICAL_ALIGN_TOP },
+ { "CENTER", Toolkit::Text::Layout::VERTICAL_ALIGN_CENTER },
+ { "BOTTOM", Toolkit::Text::Layout::VERTICAL_ALIGN_BOTTOM },
};
const unsigned int VERTICAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( VERTICAL_ALIGNMENT_STRING_TABLE ) / sizeof( VERTICAL_ALIGNMENT_STRING_TABLE[0] );
{
if( impl.mController )
{
- const std::string text = value.Get< std::string >();
+ const std::string& text = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p TEXT %s\n", impl.mController.Get(), text.c_str() );
impl.mController->SetText( text );
{
if( impl.mController )
{
- const std::string text = value.Get< std::string >();
+ const std::string& text = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT %s\n", impl.mController.Get(), text.c_str() );
impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text );
{
if( impl.mController )
{
- const std::string text = value.Get< std::string >();
+ const std::string& text = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT_FOCUSED %s\n", impl.mController.Get(), text.c_str() );
impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_ACTIVE, text );
{
if( impl.mController )
{
- const std::string fontFamily = value.Get< std::string >();
+ const std::string& fontFamily = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() );
impl.mController->SetDefaultFontFamily( fontFamily );
}
{
if( impl.mController )
{
- const std::string alignStr = value.Get< std::string >();
+ const std::string& alignStr = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p HORIZONTAL_ALIGNMENT %s\n", impl.mController.Get(), alignStr.c_str() );
- LayoutEngine::HorizontalAlignment alignment( LayoutEngine::HORIZONTAL_ALIGN_BEGIN );
- if( Scripting::GetEnumeration< LayoutEngine::HorizontalAlignment >( alignStr.c_str(),
- HORIZONTAL_ALIGNMENT_STRING_TABLE,
- HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT,
- alignment ) )
+ Layout::HorizontalAlignment alignment( Layout::HORIZONTAL_ALIGN_BEGIN );
+ if( Scripting::GetEnumeration< Layout::HorizontalAlignment >( alignStr.c_str(),
+ HORIZONTAL_ALIGNMENT_STRING_TABLE,
+ HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT,
+ alignment ) )
{
impl.mController->SetHorizontalAlignment( alignment );
}
{
if( impl.mController )
{
- const std::string alignStr = value.Get< std::string >();
+ const std::string& alignStr = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p VERTICAL_ALIGNMENT %s\n", impl.mController.Get(), alignStr.c_str() );
- LayoutEngine::VerticalAlignment alignment( LayoutEngine::VERTICAL_ALIGN_BOTTOM );
- if( Scripting::GetEnumeration< LayoutEngine::VerticalAlignment >( alignStr.c_str(),
- VERTICAL_ALIGNMENT_STRING_TABLE,
- VERTICAL_ALIGNMENT_STRING_TABLE_COUNT,
- alignment ) )
+ Layout::VerticalAlignment alignment( Layout::VERTICAL_ALIGN_BOTTOM );
+ if( Scripting::GetEnumeration< Layout::VerticalAlignment >( alignStr.c_str(),
+ VERTICAL_ALIGNMENT_STRING_TABLE,
+ VERTICAL_ALIGNMENT_STRING_TABLE_COUNT,
+ alignment ) )
{
impl.mController->SetVerticalAlignment( alignment );
}
{
if( impl.mController )
{
- const Vector4 textColor = value.Get< Vector4 >();
+ const Vector4& textColor = value.Get< Vector4 >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a );
- if( impl.mController->GetTextColor() != textColor )
+ if( impl.mController->GetDefaultColor() != textColor )
{
- impl.mController->SetTextColor( textColor );
+ impl.mController->SetDefaultColor( textColor );
impl.mController->SetInputColor( textColor );
impl.mRenderer.Reset();
}
{
if( impl.mController )
{
- const Vector4 textColor = value.Get< Vector4 >();
+ const Vector4& textColor = value.Get< Vector4 >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PLACEHOLDER_TEXT_COLOR %f,%f,%f,%f\n", impl.mController.Get(), textColor.r, textColor.g, textColor.b, textColor.a );
if( impl.mController->GetPlaceholderTextColor() != textColor )
{
if( impl.mController )
{
- const Vector2 shadowOffset = value.Get< Vector2 >();
+ const Vector2& shadowOffset = value.Get< Vector2 >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SHADOW_OFFSET %f,%f\n", impl.mController.Get(), shadowOffset.x, shadowOffset.y );
if ( impl.mController->GetShadowOffset() != shadowOffset )
{
if( impl.mController )
{
- const Vector4 shadowColor = value.Get< Vector4 >();
+ const Vector4& shadowColor = value.Get< Vector4 >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SHADOW_COLOR %f,%f,%f,%f\n", impl.mController.Get(), shadowColor.r, shadowColor.g, shadowColor.b, shadowColor.a );
if ( impl.mController->GetShadowColor() != shadowColor )
{
if( impl.mDecorator )
{
- const Vector4 color = value.Get< Vector4 >();
+ const Vector4& color = value.Get< Vector4 >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p PRIMARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
impl.mDecorator->SetCursorColor( PRIMARY_CURSOR, color );
{
if( impl.mDecorator )
{
- const Vector4 color = value.Get< Vector4 >();
+ const Vector4& color = value.Get< Vector4 >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p SECONDARY_CURSOR_COLOR %f,%f,%f,%f\n", impl.mController.Get(), color.r, color.g, color.b, color.a );
impl.mDecorator->SetCursorColor( SECONDARY_CURSOR, color );
{
if( impl.mController )
{
- const std::string fontFamily = value.Get< std::string >();
+ const std::string& fontFamily = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p INPUT_FONT_FAMILY %s\n", impl.mController.Get(), fontFamily.c_str() );
impl.mController->SetInputFontFamily( fontFamily );
}
{
if( impl.mController )
{
- const char* name = Scripting::GetEnumerationName< Toolkit::Text::LayoutEngine::HorizontalAlignment >( impl.mController->GetLayoutEngine().GetHorizontalAlignment(),
- HORIZONTAL_ALIGNMENT_STRING_TABLE,
- HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
+ const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::HorizontalAlignment >( impl.mController->GetHorizontalAlignment(),
+ HORIZONTAL_ALIGNMENT_STRING_TABLE,
+ HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
if( name )
{
value = std::string( name );
}
case Toolkit::TextField::Property::VERTICAL_ALIGNMENT:
{
- if( impl.mController )
+ if( impl.mController )
{
- const char* name = Scripting::GetEnumerationName< Toolkit::Text::LayoutEngine::VerticalAlignment >( impl.mController->GetLayoutEngine().GetVerticalAlignment(),
- VERTICAL_ALIGNMENT_STRING_TABLE,
- VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
+ const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::VerticalAlignment >( impl.mController->GetVerticalAlignment(),
+ VERTICAL_ALIGNMENT_STRING_TABLE,
+ VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
if( name )
{
value = std::string( name );
{
if ( impl.mController )
{
- value = impl.mController->GetTextColor();
+ value = impl.mController->GetDefaultColor();
}
break;
}
mDecorator = Text::Decorator::New( *mController,
*mController );
- mController->GetLayoutEngine().SetLayout( LayoutEngine::SINGLE_LINE_BOX );
+ mController->GetLayoutEngine().SetLayout( Layout::Engine::SINGLE_LINE_BOX );
// Enables the text input.
mController->EnableTextInput( mDecorator );
if( mRenderableActor )
{
- const Vector2& scrollOffset = mController->GetScrollPosition();
+ const Vector2& scrollOffset = mController->GetTextModel()->GetScrollPosition();
mRenderableActor.SetPosition( scrollOffset.x, scrollOffset.y );
#include <dali-toolkit/internal/text/text-definitions.h>
#include <dali-toolkit/internal/styling/style-manager-impl.h>
-using Dali::Toolkit::Text::LayoutEngine;
+using namespace Dali::Toolkit::Text;
namespace Dali
{
const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] =
{
- { "BEGIN", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_BEGIN },
- { "CENTER", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_CENTER },
- { "END", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_END },
+ { "BEGIN", Toolkit::Text::Layout::HORIZONTAL_ALIGN_BEGIN },
+ { "CENTER", Toolkit::Text::Layout::HORIZONTAL_ALIGN_CENTER },
+ { "END", Toolkit::Text::Layout::HORIZONTAL_ALIGN_END },
};
const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE ) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] );
const Scripting::StringEnum VERTICAL_ALIGNMENT_STRING_TABLE[] =
{
- { "TOP", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_TOP },
- { "CENTER", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_CENTER },
- { "BOTTOM", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_BOTTOM },
+ { "TOP", Toolkit::Text::Layout::VERTICAL_ALIGN_TOP },
+ { "CENTER", Toolkit::Text::Layout::VERTICAL_ALIGN_CENTER },
+ { "BOTTOM", Toolkit::Text::Layout::VERTICAL_ALIGN_BOTTOM },
};
const unsigned int VERTICAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( VERTICAL_ALIGNMENT_STRING_TABLE ) / sizeof( VERTICAL_ALIGNMENT_STRING_TABLE[0] );
{
if( impl.mController )
{
- const std::string fontFamily = value.Get< std::string >();
+ const std::string& fontFamily = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextLabel::SetProperty Property::FONT_FAMILY newFont(%s)\n", fontFamily.c_str() );
impl.mController->SetDefaultFontFamily( fontFamily );
{
if( impl.mController )
{
- LayoutEngine::HorizontalAlignment alignment( LayoutEngine::HORIZONTAL_ALIGN_BEGIN );
- if( Scripting::GetEnumeration< Toolkit::Text::LayoutEngine::HorizontalAlignment >( value.Get< std::string >().c_str(),
- HORIZONTAL_ALIGNMENT_STRING_TABLE,
- HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT,
- alignment ) )
+ Layout::HorizontalAlignment alignment( Layout::HORIZONTAL_ALIGN_BEGIN );
+ if( Scripting::GetEnumeration< Toolkit::Text::Layout::HorizontalAlignment >( value.Get< std::string >().c_str(),
+ HORIZONTAL_ALIGNMENT_STRING_TABLE,
+ HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT,
+ alignment ) )
{
impl.mController->SetHorizontalAlignment( alignment );
}
{
if( impl.mController )
{
- LayoutEngine::VerticalAlignment alignment( LayoutEngine::VERTICAL_ALIGN_BOTTOM );
- if( Scripting::GetEnumeration< Toolkit::Text::LayoutEngine::VerticalAlignment >( value.Get< std::string >().c_str(),
- VERTICAL_ALIGNMENT_STRING_TABLE,
- VERTICAL_ALIGNMENT_STRING_TABLE_COUNT,
- alignment ) )
+ Layout::VerticalAlignment alignment( Layout::VERTICAL_ALIGN_BOTTOM );
+ if( Scripting::GetEnumeration< Toolkit::Text::Layout::VerticalAlignment >( value.Get< std::string >().c_str(),
+ VERTICAL_ALIGNMENT_STRING_TABLE,
+ VERTICAL_ALIGNMENT_STRING_TABLE_COUNT,
+ alignment ) )
{
impl.mController->SetVerticalAlignment( alignment );
}
{
if( impl.mController )
{
- const Vector4 textColor = value.Get< Vector4 >();
- if( impl.mController->GetTextColor() != textColor )
+ const Vector4& textColor = value.Get< Vector4 >();
+ if( impl.mController->GetDefaultColor() != textColor )
{
- impl.mController->SetTextColor( textColor );
+ impl.mController->SetDefaultColor( textColor );
impl.mRenderer.Reset();
}
}
{
if( impl.mController )
{
- const Vector2 shadowOffset = value.Get< Vector2 >();
+ const Vector2& shadowOffset = value.Get< Vector2 >();
if ( impl.mController->GetShadowOffset() != shadowOffset )
{
impl.mController->SetShadowOffset( shadowOffset );
{
if( impl.mController )
{
- const Vector4 shadowColor = value.Get< Vector4 >();
+ const Vector4& shadowColor = value.Get< Vector4 >();
if ( impl.mController->GetShadowColor() != shadowColor )
{
impl.mController->SetShadowColor( shadowColor );
{
if( impl.mController )
{
- const Vector4 color = value.Get< Vector4 >();
+ const Vector4& color = value.Get< Vector4 >();
if ( impl.mController->GetUnderlineColor() != color )
{
impl.mController->SetUnderlineColor( color );
// If request is enable (true) then start autoscroll as not already running
else
{
- impl.mController->GetLayoutEngine().SetTextEllipsisEnabled( false );
+ impl.mController->SetTextElideEnabled( false );
impl.mController->SetAutoScrollEnabled( enableAutoScroll );
}
}
{
if( impl.mController )
{
- const char* name = Scripting::GetEnumerationName< Toolkit::Text::LayoutEngine::HorizontalAlignment >( impl.mController->GetHorizontalAlignment(),
- HORIZONTAL_ALIGNMENT_STRING_TABLE,
- HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
+ const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::HorizontalAlignment >( impl.mController->GetHorizontalAlignment(),
+ HORIZONTAL_ALIGNMENT_STRING_TABLE,
+ HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
if( name )
{
value = std::string( name );
{
if( impl.mController )
{
- const char* name = Scripting::GetEnumerationName< Toolkit::Text::LayoutEngine::VerticalAlignment >( impl.mController->GetVerticalAlignment(),
- VERTICAL_ALIGNMENT_STRING_TABLE,
- VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
+ const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::VerticalAlignment >( impl.mController->GetVerticalAlignment(),
+ VERTICAL_ALIGNMENT_STRING_TABLE,
+ VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
if( name )
{
value = std::string( name );
{
if ( impl.mController )
{
- value = impl.mController->GetTextColor();
+ value = impl.mController->GetDefaultColor();
}
break;
}
self.SetResizePolicy( ResizePolicy::DIMENSION_DEPENDENCY, Dimension::HEIGHT );
// Enable the text ellipsis.
- LayoutEngine& engine = mController->GetLayoutEngine();
+ mController->SetTextElideEnabled( true ); // If false then text larger than control will overflow
- engine.SetTextEllipsisEnabled( true ); // If false then text larger than control will overflow
+ Layout::Engine& engine = mController->GetLayoutEngine();
engine.SetCursorWidth( 0u ); // Do not layout space for the cursor.
self.OnStageSignal().Connect( this, &TextLabel::OnStageConnect );
if( renderableActor )
{
- const Vector2& scrollOffset = mController->GetScrollPosition();
+ const Vector2& scrollOffset = mController->GetTextModel()->GetScrollPosition();
renderableActor.SetPosition( scrollOffset.x, scrollOffset.y );
self.Add( renderableActor );
// Pure Virtual from TextScroller Interface
DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel::ScrollingFinished\n");
mController->SetAutoScrollEnabled( false );
- mController->GetLayoutEngine().SetTextEllipsisEnabled( true );
+ mController->SetTextElideEnabled( true );
RequestTextRelayout();
}
$(toolkit_src_dir)/text/text-effects-style.cpp \
$(toolkit_src_dir)/text/text-font-style.cpp \
$(toolkit_src_dir)/text/text-io.cpp \
+ $(toolkit_src_dir)/text/text-model.cpp \
$(toolkit_src_dir)/text/text-scroller.cpp \
- $(toolkit_src_dir)/text/text-scroller-interface.cpp \
$(toolkit_src_dir)/text/text-view.cpp \
$(toolkit_src_dir)/text/text-view-interface.cpp \
$(toolkit_src_dir)/text/visual-model-impl.cpp \
$(toolkit_src_dir)/text/rendering/atlas/atlas-manager-impl.cpp \
$(toolkit_src_dir)/text/rendering/atlas/atlas-mesh-factory.cpp \
$(toolkit_src_dir)/text/rendering/text-backend-impl.cpp \
+ $(toolkit_src_dir)/text/rendering/text-typesetter.cpp \
+ $(toolkit_src_dir)/text/rendering/view-model.cpp \
$(toolkit_src_dir)/transition-effects/cube-transition-effect-impl.cpp \
$(toolkit_src_dir)/transition-effects/cube-transition-cross-effect-impl.cpp \
$(toolkit_src_dir)/transition-effects/cube-transition-fold-effect-impl.cpp \
#include <dali/devel-api/images/texture-set-image.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
namespace Dali
{
Property::Map customShader;
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = fragmentSource.str();
Property::Map visualMap;
- visualMap.Insert( Toolkit::VisualProperty::SHADER, customShader );
+ visualMap.Insert( Toolkit::DevelVisual::Property::SHADER, customShader );
mActorForInput.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
mActorForHorz.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
// Set up blend-two-image custom shader
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = BLEND_TWO_IMAGES_FRAGMENT_SOURCE;
- visualMap[ Toolkit::VisualProperty::SHADER ] = customShader;
+ visualMap[ Toolkit::DevelVisual::Property::SHADER ] = customShader;
mActorForBlending.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
mRootActor.Add( mActorForInput );
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
Property::Map customShader;
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = EMBOSS_FRAGMENT_SOURCE;
Property::Map visualMap;
- visualMap.Insert( Toolkit::VisualProperty::SHADER, customShader );
+ visualMap.Insert( Toolkit::DevelVisual::Property::SHADER, customShader );
// create actor to render input with applied emboss effect
mActorForInput1 = Toolkit::ImageView::New(mInputImage);
#include <dali/public-api/render-tasks/render-task-list.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
namespace Dali
{
Property::Map customShader;
customShader[ Toolkit::Visual::Shader::Property::FRAGMENT_SHADER ] = SPREAD_FRAGMENT_SOURCE;
Property::Map visualMap;
- visualMap.Insert( Toolkit::VisualProperty::SHADER, customShader );
+ visualMap.Insert( Toolkit::DevelVisual::Property::SHADER, customShader );
// set SPREAD custom shader
mActorForInput.SetProperty( Toolkit::ImageView::Property::IMAGE, visualMap );
#include "async-image-loader-impl.h"
// EXTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
#include <dali/integration-api/adaptors/adaptor.h>
namespace Dali
mIsLoadThreadStarted = true;
}
- BitmapLoader loader = BitmapLoader::New( url, dimensions, fittingMode, samplingMode, orientationCorrection );
-
- mLoadThread.AddTask( new LoadingTask( ++mLoadTaskId, loader ) );
+ mLoadThread.AddTask( new LoadingTask( ++mLoadTaskId, url, dimensions, fittingMode, samplingMode, orientationCorrection ) );
return mLoadTaskId;
}
{
while( LoadingTask *next = mLoadThread.NextCompletedTask() )
{
- mLoadedSignal.Emit( next->id, next->loader.GetPixelData() );
+ mLoadedSignal.Emit( next->id, next->pixelData );
delete next;
}
}
// CLASS HEADER
#include "image-load-thread.h"
+// EXTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/image-loading.h>
+
namespace Dali
{
namespace Internal
{
-LoadingTask::LoadingTask(uint32_t id, BitmapLoader loader )
-: loader( loader ),
- id( id )
+LoadingTask::LoadingTask( uint32_t id, const std::string& url, ImageDimensions dimensions,
+ FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection )
+: pixelData(),
+ url( url ),
+ id( id ),
+ dimensions( dimensions ),
+ fittingMode( fittingMode ),
+ samplingMode( samplingMode ),
+ orientationCorrection( orientationCorrection )
+{
+}
+
+void LoadingTask::Load()
{
+ pixelData = Dali::LoadImageFromFile( url, dimensions, fittingMode, samplingMode, orientationCorrection );
}
+
ImageLoadThread::ImageLoadThread( EventThreadCallback* trigger )
: mTrigger( trigger )
{
{
while( LoadingTask* task = NextTaskToProcess() )
{
- task->loader.Load();
+ task->Load();
AddCompletedTask( task );
}
}
mTrigger->Trigger();
}
-
-
} // namespace Internal
} // namespace Toolkit
// EXTERNAL INCLUDES
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/object/ref-object.h>
+#include <dali/public-api/images/image-operations.h>
+#include <dali/public-api/images/pixel-data.h>
#include <dali/devel-api/threading/conditional-wait.h>
#include <dali/devel-api/threading/mutex.h>
#include <dali/devel-api/threading/thread.h>
-#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
#include <dali/devel-api/adaptor-framework/event-thread-callback.h>
+
namespace Dali
{
{
/**
* Constructor.
+ * @param [in] id of the task
+ * @param [in] url The URL of the image file to load.
+ * @param [in] size The width and height to fit the loaded image to, 0.0 means whole image
+ * @param [in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter.
+ * @param [in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size.
+ * @param [in] orientationCorrection Reorient the image to respect any orientation metadata in its header.
*/
- LoadingTask( uint32_t id, BitmapLoader loader );
+ LoadingTask( uint32_t id, const std::string& url, ImageDimensions dimensions,
+ FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection );
+
+ /**
+ * Load the image
+ */
+ void Load();
private:
public:
- BitmapLoader loader; ///< The loader used to load the bitmap from URL
- uint32_t id; ///< The id associated with this task.
+ PixelData pixelData; ///< pixelData handle after successfull load
+ std::string url; ///< url of the image to load
+ uint32_t id; ///< The unique id associated with this task.
+ ImageDimensions dimensions; ///< dimensions to load
+ FittingMode::Type fittingMode; ///< fitting options
+ SamplingMode::Type samplingMode; ///< sampling options
+ bool orientationCorrection:1; ///< if orientation correction is needed
+
};
+#ifndef DALI_TOOLKIT_TEXT_LAYOUT_ALIGNMENT_H
+#define DALI_TOOLKIT_TEXT_LAYOUT_ALIGNMENT_H
+
/*
* Copyright (c) 2016 Samsung Electronics Co., Ltd.
*
*
*/
-// CLASS HEADER
-#include <dali-toolkit/internal/text/text-scroller-interface.h>
-
namespace Dali
{
namespace Text
{
-ScrollerInterface::ScrollerInterface()
+namespace Layout
{
-}
-ScrollerInterface::~ScrollerInterface()
+/**
+ * @brief Speficies the horizontal alignment.
+ *
+ * BEGIN is on the left for Left To Right languages whereas is right for Right To Left.
+ * Similarly, END is on the right for Left To Right languages and left for Right To Left.
+ */
+enum HorizontalAlignment
{
-}
+ HORIZONTAL_ALIGN_BEGIN,
+ HORIZONTAL_ALIGN_CENTER,
+ HORIZONTAL_ALIGN_END
+};
+
+/**
+ * @brief Speficies the vertical alignment.
+ */
+enum VerticalAlignment
+{
+ VERTICAL_ALIGN_TOP,
+ VERTICAL_ALIGN_CENTER,
+ VERTICAL_ALIGN_BOTTOM
+};
+
+} // namespace Layout
} // namespace Text
} // namespace Toolkit
} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_LAYOUT_ALIGNMENT_H
namespace Text
{
+namespace Layout
+{
+
namespace
{
float descender; ///< The minimum descender of all fonts in the line.
};
-struct LayoutEngine::Impl
+struct Engine::Impl
{
Impl()
- : mLayout( LayoutEngine::SINGLE_LINE_BOX ),
- mHorizontalAlignment( LayoutEngine::HORIZONTAL_ALIGN_BEGIN ),
- mVerticalAlignment( LayoutEngine::VERTICAL_ALIGN_TOP ),
+ : mLayout( Layout::Engine::SINGLE_LINE_BOX ),
mCursorWidth( CURSOR_WIDTH ),
- mDefaultLineSpacing( LINE_SPACING ),
- mEllipsisEnabled( false )
+ mDefaultLineSpacing( LINE_SPACING )
{
}
* @param[in,out] paragraphDirection in: the current paragraph's direction, out: the next paragraph's direction. Is set after a must break.
* @param[in] completelyFill Whether to completely fill the line ( even if the last word exceeds the boundaries ).
*/
- void GetLineLayoutForBox( const LayoutParameters& parameters,
+ void GetLineLayoutForBox( const Parameters& parameters,
LineLayout& lineLayout,
CharacterDirection& paragraphDirection,
bool completelyFill )
*
* return Whether the line is ellipsized.
*/
- bool EllipsisLine( const LayoutParameters& layoutParameters,
+ bool EllipsisLine( const Parameters& layoutParameters,
const LineLayout& layout,
Size& layoutSize,
LineRun* linesBuffer,
* @param[in,out] numberOfLines The number of laid-out lines.
* @param[in] isLastLine Whether the laid-out line is the last one.
*/
- void UpdateTextLayout( const LayoutParameters& layoutParameters,
+ void UpdateTextLayout( const Parameters& layoutParameters,
const LineLayout& layout,
Size& layoutSize,
LineRun* linesBuffer,
* @param[in,out] linesBuffer Pointer to the line's buffer.
* @param[in,out] numberOfLines The number of laid-out lines.
*/
- void UpdateTextLayout( const LayoutParameters& layoutParameters,
+ void UpdateTextLayout( const Parameters& layoutParameters,
CharacterIndex characterIndex,
GlyphIndex glyphIndex,
Size& layoutSize,
* @param[in] characterOffset The offset to be added to the runs of characters.
* @param[in] glyphOffset The offset to be added to the runs of glyphs.
*/
- void UpdateLineIndexOffsets( const LayoutParameters& layoutParameters,
+ void UpdateLineIndexOffsets( const Parameters& layoutParameters,
Vector<LineRun>& lines,
Length characterOffset,
Length glyphOffset )
}
}
- bool LayoutText( const LayoutParameters& layoutParameters,
+ bool LayoutText( const Parameters& layoutParameters,
Vector<Vector2>& glyphPositions,
Vector<LineRun>& lines,
- Size& layoutSize )
+ Size& layoutSize,
+ bool elideTextEnabled )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->LayoutText\n" );
DALI_LOG_INFO( gLogFilter, Debug::Verbose, " box size %f, %f\n", layoutParameters.boundingBox.width, layoutParameters.boundingBox.height );
DALI_LOG_INFO( gLogFilter, Debug::Verbose, " pen y %f\n", penY );
bool ellipsis = false;
- if( mEllipsisEnabled )
+ if( elideTextEnabled )
{
// Does the ellipsis of the last line.
ellipsis = EllipsisLine( layoutParameters,
return true;
}
- void ReLayoutRightToLeftLines( const LayoutParameters& layoutParameters,
+ void ReLayoutRightToLeftLines( const Parameters& layoutParameters,
CharacterIndex startIndex,
Length numberOfCharacters,
Vector<Vector2>& glyphPositions )
void Align( const Size& size,
CharacterIndex startIndex,
Length numberOfCharacters,
+ HorizontalAlignment horizontalAlignment,
Vector<LineRun>& lines )
{
const CharacterIndex lastCharacterPlusOne = startIndex + numberOfCharacters;
// Calculate the line's alignment offset accordingly with the align option,
// the box width, line length, and the paragraph's direction.
CalculateHorizontalAlignment( size.width,
+ horizontalAlignment,
line );
}
}
void CalculateHorizontalAlignment( float boxWidth,
+ HorizontalAlignment horizontalAlignment,
LineRun& line )
{
line.alignmentOffset = 0.f;
const bool isRTL = RTL == line.direction;
float lineLength = line.width;
- HorizontalAlignment alignment = mHorizontalAlignment;
+ HorizontalAlignment alignment = horizontalAlignment;
if( isRTL )
{
// Swap the alignment type if the line is right to left.
line.ellipsis = false;
}
- LayoutEngine::Layout mLayout;
- LayoutEngine::HorizontalAlignment mHorizontalAlignment;
- LayoutEngine::VerticalAlignment mVerticalAlignment;
+ Type mLayout;
float mCursorWidth;
float mDefaultLineSpacing;
IntrusivePtr<Metrics> mMetrics;
-
- bool mEllipsisEnabled:1;
};
-LayoutEngine::LayoutEngine()
+Engine::Engine()
: mImpl( NULL )
{
- mImpl = new LayoutEngine::Impl();
+ mImpl = new Engine::Impl();
}
-LayoutEngine::~LayoutEngine()
+Engine::~Engine()
{
delete mImpl;
}
-void LayoutEngine::SetMetrics( MetricsPtr& metrics )
+void Engine::SetMetrics( MetricsPtr& metrics )
{
mImpl->mMetrics = metrics;
}
-void LayoutEngine::SetLayout( Layout layout )
+void Engine::SetLayout( Type layout )
{
mImpl->mLayout = layout;
}
-LayoutEngine::Layout LayoutEngine::GetLayout() const
+Engine::Type Engine::GetLayout() const
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "GetLayout[%d]\n", mImpl->mLayout);
return mImpl->mLayout;
}
-void LayoutEngine::SetTextEllipsisEnabled( bool enabled )
-{
- DALI_LOG_INFO( gLogFilter, Debug::General, "-->LayoutEngine::SetTextEllipsisEnabled[%s]\n", (enabled)?"true":"false" );
- mImpl->mEllipsisEnabled = enabled;
-}
-
-bool LayoutEngine::GetTextEllipsisEnabled() const
-{
- return mImpl->mEllipsisEnabled;
-}
-
-void LayoutEngine::SetHorizontalAlignment( HorizontalAlignment alignment )
-{
- mImpl->mHorizontalAlignment = alignment;
-}
-
-LayoutEngine::HorizontalAlignment LayoutEngine::GetHorizontalAlignment() const
-{
- return mImpl->mHorizontalAlignment;
-}
-
-void LayoutEngine::SetVerticalAlignment( VerticalAlignment alignment )
-{
- mImpl->mVerticalAlignment = alignment;
-}
-
-LayoutEngine::VerticalAlignment LayoutEngine::GetVerticalAlignment() const
-{
- return mImpl->mVerticalAlignment;
-}
-
-void LayoutEngine::SetCursorWidth( int width )
+void Engine::SetCursorWidth( int width )
{
mImpl->mCursorWidth = static_cast<float>( width );
}
-int LayoutEngine::GetCursorWidth() const
+int Engine::GetCursorWidth() const
{
return static_cast<int>( mImpl->mCursorWidth );
}
-bool LayoutEngine::LayoutText( const LayoutParameters& layoutParameters,
- Vector<Vector2>& glyphPositions,
- Vector<LineRun>& lines,
- Size& layoutSize )
+bool Engine::LayoutText( const Parameters& layoutParameters,
+ Vector<Vector2>& glyphPositions,
+ Vector<LineRun>& lines,
+ Size& layoutSize,
+ bool elideTextEnabled )
{
return mImpl->LayoutText( layoutParameters,
glyphPositions,
lines,
- layoutSize );
+ layoutSize,
+ elideTextEnabled );
}
-void LayoutEngine::ReLayoutRightToLeftLines( const LayoutParameters& layoutParameters,
- CharacterIndex startIndex,
- Length numberOfCharacters,
- Vector<Vector2>& glyphPositions )
+void Engine::ReLayoutRightToLeftLines( const Parameters& layoutParameters,
+ CharacterIndex startIndex,
+ Length numberOfCharacters,
+ Vector<Vector2>& glyphPositions )
{
mImpl->ReLayoutRightToLeftLines( layoutParameters,
startIndex,
glyphPositions );
}
-void LayoutEngine::Align( const Size& size,
- CharacterIndex startIndex,
- Length numberOfCharacters,
- Vector<LineRun>& lines )
+void Engine::Align( const Size& size,
+ CharacterIndex startIndex,
+ Length numberOfCharacters,
+ Layout::HorizontalAlignment horizontalAlignment,
+ Vector<LineRun>& lines )
{
mImpl->Align( size,
startIndex,
numberOfCharacters,
+ horizontalAlignment,
lines );
}
-void LayoutEngine::SetDefaultLineSpacing( float lineSpacing )
+void Engine::SetDefaultLineSpacing( float lineSpacing )
{
mImpl->mDefaultLineSpacing = lineSpacing;
}
-float LayoutEngine::GetDefaultLineSpacing() const
+float Engine::GetDefaultLineSpacing() const
{
return mImpl->mDefaultLineSpacing;
}
+} // namespace Layout
+
} // namespace Text
} // namespace Toolkit
-#ifndef __DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_H__
-#define __DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_H__
+#ifndef DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_H
+#define DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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 <dali/public-api/math/vector2.h>
// INTERNAL INCLUDE
+#include <dali-toolkit/internal/text/layouts/layout-alignment.h>
#include <dali-toolkit/internal/text/line-run.h>
#include <dali-toolkit/internal/text/metrics.h>
namespace Text
{
-struct LayoutParameters;
+namespace Layout
+{
+
+struct Parameters;
/**
* @brief LayoutEngine is responsible for calculating the visual position of glyphs in layout.
*/
-class LayoutEngine
+class Engine
{
public:
- enum Layout
+ enum Type
{
SINGLE_LINE_BOX,
MULTI_LINE_BOX
};
- enum HorizontalAlignment
- {
- HORIZONTAL_ALIGN_BEGIN,
- HORIZONTAL_ALIGN_CENTER,
- HORIZONTAL_ALIGN_END
- };
-
- enum VerticalAlignment
- {
- VERTICAL_ALIGN_TOP,
- VERTICAL_ALIGN_CENTER,
- VERTICAL_ALIGN_BOTTOM
- };
-
/**
* @brief Create a new instance of a LayoutEngine.
*/
- LayoutEngine();
+ Engine();
/**
* @brief Virtual destructor.
*/
- ~LayoutEngine();
+ ~Engine();
/**
* @brief Provide the wrapper around FontClient used to get metrics
*
* @param[in] layout The required layout.
*/
- void SetLayout( Layout layout );
+ void SetLayout( Type layout );
/**
* @brief Query the required layout.
*
* @return The required layout.
*/
- Layout GetLayout() const;
-
- /**
- * @brief Enable or disable the text ellipsis.
- *
- * @param[in] enabled Whether to enable the text ellipsis.
- */
- void SetTextEllipsisEnabled( bool enabled );
-
- /**
- * @return Whether the text ellipsis is enabled.
- */
- bool GetTextEllipsisEnabled() const;
-
- /**
- * @brief Choose the required text horizontal alignment.
- *
- * @param[in] alignment The required alignment.
- */
- void SetHorizontalAlignment( HorizontalAlignment alignment );
-
- /**
- * @brief Query the required text horizontal alignment.
- *
- * @return The required alignment.
- */
- HorizontalAlignment GetHorizontalAlignment() const;
-
- /**
- * @brief Choose the required text vertical alignment.
- *
- * @param[in] alignment The required alignment.
- */
- void SetVerticalAlignment( VerticalAlignment alignment );
-
- /**
- * @brief Query the required text vertical alignment.
- *
- * @return The required alignment.
- */
- VerticalAlignment GetVerticalAlignment() const;
+ Type GetLayout() const;
/**
* @brief Sets the width of the cursor.
* @param[out] glyphPositions The positions of all the glyphs.
* @param[out] lines The laid-out lines.
* @param[out] layoutSize The size of the text after it has been laid-out.
+ * @param[in] elideTextEnabled Whether the text elide is enabled.
*
* @return \e true if the text has been re-laid-out. \e false means the given width is too small to layout even a single character.
*/
- bool LayoutText( const LayoutParameters& layoutParameters,
+ bool LayoutText( const Parameters& layoutParameters,
Vector<Vector2>& glyphPositions,
Vector<LineRun>& lines,
- Size& layoutSize );
+ Size& layoutSize,
+ bool elideTextEnabled );
/**
* @brief Re-lays out those lines with right to left characters.
* @param[in] numberOfCharacters The number of characters.
* @param[in,out] glyphPositions The positions of all the glyphs.
*/
- void ReLayoutRightToLeftLines( const LayoutParameters& layoutParameters,
+ void ReLayoutRightToLeftLines( const Parameters& layoutParameters,
CharacterIndex startIndex,
Length numberOfCharacters,
Vector<Vector2>& glyphPositions );
* @param[in] size The size of the container where the text is laid-out.
* @param[in] startIndex Character index of the line from where the lines are aligned.
* @param[in] numberOfCharacters The number of characters.
+ * @param[in] horizontalAlignment The horizontal alignment.
* @param[in,out] lines The laid-out lines.
*/
void Align( const Size& size,
CharacterIndex startIndex,
Length numberOfCharacters,
+ Layout::HorizontalAlignment horizontalAlignment,
Vector<LineRun>& lines );
/**
private:
// Undefined
- LayoutEngine( const LayoutEngine& handle );
+ Engine( const Engine& handle );
// Undefined
- LayoutEngine& operator=( const LayoutEngine& handle );
+ Engine& operator=( const Engine& handle );
private:
struct Impl;
Impl* mImpl;
};
+
+} // namespace Layout
+
} // namespace Text
} // namespace Toolkit
} // namespace Dali
-#endif // __DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_H__
+#endif // DALI_TOOLKIT_TEXT_LAYOUT_ENGINE_H
-#ifndef __DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H__
-#define __DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H__
+#ifndef DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H
+#define DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
struct BidirectionalLineInfoRun;
+namespace Layout
+{
+
/**
* @brief Struct used to pass parameters.
*/
-struct LayoutParameters
+struct Parameters
{
/**
* Constructor with the needed parameters to layout the text.
* @param[in] charactersToGlyphsBuffer Vector with indices pointing the first glyph of each character.
* @param[in] glyphsPerCharacterBuffer Vector with the number of glyphs shaped from the character.
* @param[in] totalNumberOfGlyphs The number of glyphs.
+ * @param[in] horizontalAlignment The horizontal alignment.
*/
- LayoutParameters( const Vector2& boundingBox,
- const Character* const textBuffer,
- const LineBreakInfo* const lineBreakInfoBuffer,
- const WordBreakInfo* const wordBreakInfoBuffer,
- const CharacterDirection* const characterDirectionBuffer,
- const GlyphInfo* const glyphsBuffer,
- const CharacterIndex* const glyphsToCharactersBuffer,
- const Length* const charactersPerGlyphBuffer,
- const GlyphIndex* const charactersToGlyphsBuffer,
- const Length* const glyphsPerCharacterBuffer,
- Length totalNumberOfGlyphs )
+ Parameters( const Vector2& boundingBox,
+ const Character* const textBuffer,
+ const LineBreakInfo* const lineBreakInfoBuffer,
+ const WordBreakInfo* const wordBreakInfoBuffer,
+ const CharacterDirection* const characterDirectionBuffer,
+ const GlyphInfo* const glyphsBuffer,
+ const CharacterIndex* const glyphsToCharactersBuffer,
+ const Length* const charactersPerGlyphBuffer,
+ const GlyphIndex* const charactersToGlyphsBuffer,
+ const Length* const glyphsPerCharacterBuffer,
+ Length totalNumberOfGlyphs,
+ HorizontalAlignment horizontalAlignment )
: boundingBox( boundingBox ),
textBuffer( textBuffer ),
lineBreakInfoBuffer( lineBreakInfoBuffer ),
startGlyphIndex( 0u ),
numberOfGlyphs( 0u ),
totalNumberOfGlyphs( totalNumberOfGlyphs ),
+ horizontalAlignment( horizontalAlignment ),
startLineIndex( 0u ),
estimatedNumberOfLines( 0u ),
isLastNewParagraph( false )
GlyphIndex startGlyphIndex; ///< Index to the first glyph to layout.
Length numberOfGlyphs; ///< The number of glyphs to layout.
Length totalNumberOfGlyphs; ///< The number of glyphs.
+ HorizontalAlignment horizontalAlignment; ///< The horizontal alignment.
LineIndex startLineIndex; ///< The line index where to insert the new lines.
Length estimatedNumberOfLines; ///< The estimated number of lines.
bool isLastNewParagraph; ///< Whether the last character is a new paragraph character.
};
+} // namespace Layout
+
} // namespace Text
} // namespace Toolkit
} // namespace Dali
-#endif // __DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H__
+#endif // DALI_TOOLKIT_TEXT_LAYOUT_PARAMETERS_H
if( isValidFont &&
isEmojiScript )
{
- const PixelData bitmap = fontClient.CreateBitmap( fontId, glyphIndex );
-
- // For color emojis, the font is valid if the bitmap is RGBA.
- isValidFont = bitmap && ( Pixel::BGRA8888 == bitmap.GetPixelFormat() );
+ // For color emojis, the font is valid if the glyph is a color glyph (the bitmap is RGBA).
+ isValidFont = fontClient.IsColorGlyph( fontId, glyphIndex );
}
// If there is a valid font, cache it.
--- /dev/null
+/*
+ * Copyright (c) 2016 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/internal/text/rendering/text-typesetter.h>
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/text-abstraction/font-client.h>
+#include <memory.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/rendering/view-model.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+namespace
+{
+
+/**
+ * @brief Data struct used to set the buffer of the glyph's bitmap into the final bitmap's buffer.
+ */
+struct GlyphData
+{
+ uint32_t* bitmapBuffer; ///< The buffer of the whole bitmap. The format is RGBA8888.
+ Vector2* position; ///< The position of the glyph.
+ TextAbstraction::FontClient::GlyphBufferData glyphBitmap; ///< The glyph's bitmap.
+ unsigned int width; ///< The bitmap's width.
+ unsigned int height; ///< The bitmap's height.
+ int horizontalOffset; ///< The horizontal offset to be added to the 'x' glyph's position.
+ int verticalOffset; ///< The vertical offset to be added to the 'y' glyph's position.
+};
+
+/**
+ * @brief Sets the glyph's buffer into the bitmap's buffer.
+ *
+ * @param[in] data Struct which contains the glyph's data and the bitmap's data.
+ * @param[in] position The position of the glyph.
+ * @param[in] color The color of the glyph.
+ */
+void TypesetGlyph( const GlyphData& data,
+ const Vector2* const position,
+ const Vector4* const color )
+{
+ if( ( 0u == data.glyphBitmap.width ) || ( 0u == data.glyphBitmap.height ) )
+ {
+ // Nothing to do if the width or height of the buffer is zero.
+ return;
+ }
+
+ const int widthMinusOne = static_cast<int>( data.width - 1u );
+ const int heightMinusOne = static_cast<int>( data.height - 1u );
+
+ // Whether the given glyph is a color one.
+ const bool isColorGlyph = Pixel::BGRA8888 == data.glyphBitmap.format;
+
+ // Pointer to the color glyph if there is one.
+ const uint32_t* const colorGlyphBuffer = isColorGlyph ? reinterpret_cast<uint32_t*>( data.glyphBitmap.buffer ) : NULL;
+
+ // Pack the given color into a 32bit buffer. The alpha channel will be updated later for each pixel.
+ // The format is RGBA8888.
+ uint32_t packedColor = 0u;
+ uint8_t* packedColorBuffer = reinterpret_cast<uint8_t*>( &packedColor );
+ *( packedColorBuffer + 2 ) = static_cast<uint8_t>( color->b * 255.f );
+ *( packedColorBuffer + 1 ) = static_cast<uint8_t>( color->g * 255.f );
+ *packedColorBuffer = static_cast<uint8_t>( color->r * 255.f );
+
+ // Initial vertical offset.
+ const int yOffset = data.verticalOffset + position->y;
+
+ // Traverse the pixels of the glyph line per line.
+ for( int lineIndex = 0, glyphHeight = static_cast<int>( data.glyphBitmap.height ); lineIndex < glyphHeight; ++lineIndex )
+ {
+ const int yOffsetIndex = yOffset + lineIndex;
+ if( ( 0 > yOffsetIndex ) || ( yOffsetIndex > heightMinusOne ) )
+ {
+ // Do not write out of bounds.
+ break;
+ }
+
+ const int verticalOffset = yOffsetIndex * data.width;
+ const int xOffset = data.horizontalOffset + position->x;
+ const int glyphBufferOffset = lineIndex * static_cast<int>( data.glyphBitmap.width );
+ for( int index = 0, glyphWidth = static_cast<int>( data.glyphBitmap.width ); index < glyphWidth; ++index )
+ {
+ const int xOffsetIndex = xOffset + index;
+ if( ( 0 > xOffsetIndex ) || ( xOffsetIndex > widthMinusOne ) )
+ {
+ // Don't write out of bounds.
+ break;
+ }
+
+ if( isColorGlyph )
+ {
+ // Retrieves the color from the glyph. The format is BGRA8888.
+ uint32_t packedColorGlyph = *( colorGlyphBuffer + glyphBufferOffset + index );
+
+ // Update the alpha channel.
+ uint8_t* packedColorGlyphBuffer = reinterpret_cast<uint8_t*>( &packedColorGlyph );
+ std::swap( *packedColorGlyphBuffer, *( packedColorGlyphBuffer + 2u ) ); // Swap B and R.
+ *( packedColorGlyphBuffer + 3u ) = static_cast<uint8_t>( color->a * static_cast<float>( *( packedColorGlyphBuffer + 3u ) ) );
+
+ // Set the color into the final pixel buffer.
+ *( data.bitmapBuffer + verticalOffset + xOffsetIndex ) = packedColorGlyph;
+ }
+ else
+ {
+ // Update the alpha channel.
+ const uint8_t alpha = *( data.glyphBitmap.buffer + glyphBufferOffset + index );
+ *( packedColorBuffer + 3u ) = static_cast<uint8_t>( color->a * static_cast<float>( alpha ) );
+
+ // Set the color into the final pixel buffer.
+ *( data.bitmapBuffer + verticalOffset + xOffsetIndex ) = packedColor;
+ }
+ }
+ }
+}
+
+} // namespace
+
+TypesetterPtr Typesetter::New( const ModelInterface* const model )
+{
+ return TypesetterPtr( new Typesetter( model ) );
+}
+
+ViewModel* Typesetter::GetViewModel()
+{
+ return mModel;
+}
+
+PixelData Typesetter::Render( const Vector2& size )
+{
+ // @todo. This initial implementation for a TextLabel has only one visible page.
+
+ // Elides the text if needed.
+ mModel->ElideGlyphs();
+
+ // Retrieves the layout size.
+ const Size& layoutSize = mModel->GetLayoutSize();
+
+ // Set the offset for the vertical alignment.
+ int penY = 0u;
+
+ switch( mModel->GetVerticalAlignment() )
+ {
+ case Layout::VERTICAL_ALIGN_TOP:
+ {
+ // No offset to add.
+ break;
+ }
+ case Layout::VERTICAL_ALIGN_CENTER:
+ {
+ penY = static_cast<int>( 0.5f * ( size.height - layoutSize.height ) );
+ break;
+ }
+ case Layout::VERTICAL_ALIGN_BOTTOM:
+ {
+ penY = static_cast<int>( size.height - layoutSize.height );
+ break;
+ }
+ }
+
+ // Retrieve lines, glyphs, positions and colors from the view model.
+ const Length modelNumberOfLines = mModel->GetNumberOfLines();
+ const LineRun* const modelLinesBuffer = mModel->GetLines();
+ const Length numberOfGlyphs = mModel->GetNumberOfGlyphs();
+ const GlyphInfo* const glyphsBuffer = mModel->GetGlyphs();
+ const Vector2* const positionBuffer = mModel->GetLayout();
+ const Vector4* const colorsBuffer = mModel->GetColors();
+ const ColorIndex* const colorIndexBuffer = mModel->GetColorIndices();
+
+ // Whether to use the default color.
+ const bool useDefaultColor = NULL == colorsBuffer;
+ const Vector4& defaultColor = mModel->GetDefaultColor();
+
+ // Create and initialize the pixel buffer.
+ GlyphData glyphData;
+ glyphData.verticalOffset = penY;
+
+ glyphData.width = static_cast<unsigned int>( size.width );
+ glyphData.height = static_cast<unsigned int>( size.height );
+ const unsigned int bufferSizeInt = glyphData.width * glyphData.height;
+ const unsigned int bufferSizeChar = 4u * bufferSizeInt;
+ glyphData.bitmapBuffer = new uint32_t[ bufferSizeInt ]; // This array will get deleted by PixelData because of the DELETE_ARRAY parameter.
+ memset( glyphData.bitmapBuffer, 0u, bufferSizeChar );
+
+ PixelData pixelData = PixelData::New( reinterpret_cast<uint8_t*>( glyphData.bitmapBuffer ),
+ bufferSizeChar,
+ glyphData.width,
+ glyphData.height,
+ Pixel::RGBA8888, // The format is RGBA8888 because is the format accepted by the image atlas manager.
+ PixelData::DELETE_ARRAY );
+
+ // Get a handle of the font client. Used to retrieve the bitmaps of the glyphs.
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+
+ // Traverses the lines of the text.
+ for( LineIndex lineIndex = 0u; lineIndex < modelNumberOfLines; ++lineIndex )
+ {
+ const LineRun& line = *( modelLinesBuffer + lineIndex );
+
+ // Sets the horizontal offset of the line.
+ glyphData.horizontalOffset = static_cast<int>( line.alignmentOffset );
+
+ // Increases the vertical offset with the line's ascender.
+ glyphData.verticalOffset += static_cast<int>( line.ascender );
+
+ // Traverses the glyphs of the line.
+ const GlyphIndex endGlyphIndex = std::min( numberOfGlyphs, line.glyphRun.glyphIndex + line.glyphRun.numberOfGlyphs );
+ for( GlyphIndex glyphIndex = line.glyphRun.glyphIndex; glyphIndex < endGlyphIndex; ++glyphIndex )
+ {
+ // Retrieve the glyph's info.
+ const GlyphInfo* const glyphInfo = glyphsBuffer + glyphIndex;
+
+ if( ( glyphInfo->width < Math::MACHINE_EPSILON_1000 ) ||
+ ( glyphInfo->height < Math::MACHINE_EPSILON_1000 ) )
+ {
+ // Nothing to do if the glyph's width or height is zero.
+ continue;
+ }
+
+ // Retrieves the glyph's position.
+ const Vector2* const position = positionBuffer + glyphIndex;
+
+ // Retrieves the glyph's color.
+ const ColorIndex colorIndex = *( colorIndexBuffer + glyphIndex );
+ const Vector4* const color = ( useDefaultColor || ( 0u == colorIndex ) ) ? &defaultColor : colorsBuffer + ( colorIndex - 1u );
+
+ // Retrieves the glyph's bitmap.
+ glyphData.glyphBitmap.buffer = NULL;
+ fontClient.CreateBitmap( glyphInfo->fontId,
+ glyphInfo->index,
+ glyphData.glyphBitmap );
+
+ // Sets the glyph's bitmap into the bitmap of the whole text.
+ if( NULL != glyphData.glyphBitmap.buffer )
+ {
+ TypesetGlyph( glyphData,
+ position,
+ color );
+ }
+ }
+
+ // Increases the vertical offset with the line's descender.
+ glyphData.verticalOffset += static_cast<int>( -line.descender );
+ }
+
+ return pixelData;
+}
+
+Typesetter::Typesetter( const ModelInterface* const model )
+: mModel( new ViewModel( model ) )
+{
+}
+
+Typesetter::~Typesetter()
+{
+ delete mModel;
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_TEXT_TYPESETTER_H
+#define DALI_TOOLKIT_TEXT_TYPESETTER_H
+
+/*
+ * Copyright (c) 2016 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/common/intrusive-ptr.h>
+#include <dali/public-api/object/ref-object.h>
+#include <dali/public-api/images/pixel-data.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+class ModelInterface;
+class ViewModel;
+class Typesetter;
+
+typedef IntrusivePtr<Typesetter> TypesetterPtr;
+
+/**
+ * @brief This class is responsible of controlling the data flow of the text's rendering process.
+ */
+class Typesetter : public RefObject
+{
+public: // Constructor.
+ /**
+ * @brief Creates a Typesetter instance.
+ *
+ * The typesetter composes the final text retrieving the glyphs and the
+ * styles from the text's model.
+ *
+ * @param[in] model Pointer to the text's data model.
+ */
+ static TypesetterPtr New( const ModelInterface* const model );
+
+public:
+ /**
+ * @brief Retrieves the pointer to the view model.
+ *
+ * @return A pointer to the view model.
+ */
+ ViewModel* GetViewModel();
+
+ /**
+ * @brief Renders the text.
+ *
+ * Does the following operations:
+ * - Finds the visible pages needed to be rendered.
+ * - Elide glyphs if needed.
+ * - Retrieves the data buffers from the text model.
+ * - Creates the pixel data used to generate the final image with the given size.
+ * - Traverse the visible glyphs, retrieve their bitmaps and compose the final pixel data.
+ *
+ * @param[in] size The renderer size.
+ *
+ * @return A pixel data with the text rendered.
+ */
+ PixelData Render( const Vector2& size );
+
+private:
+ /**
+ * @brief Private constructor.
+ *
+ * @param[in] model Pointer to the text's data model.
+ */
+ Typesetter( const ModelInterface* const model );
+
+ // Declared private and left undefined to avoid copies.
+ Typesetter( const Typesetter& handle );
+
+ // Declared private and left undefined to avoid copies.
+ Typesetter& operator=( const Typesetter& handle );
+
+protected:
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ *
+ * Destroys the visual model.
+ */
+ virtual ~Typesetter();
+
+private:
+ ViewModel* mModel;
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_TYPESETTER_H
--- /dev/null
+/*
+ * Copyright (c) 2016 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/internal/text/rendering/view-model.h>
+
+// EXTERNAL INCLUDES
+#include <memory.h>
+#include <dali/devel-api/text-abstraction/font-client.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/line-run.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+ViewModel::ViewModel( const ModelInterface* const model )
+: mModel( model ),
+ mElidedGlyphs(),
+ mElidedLayout(),
+ mIsTextElided( false )
+{
+}
+
+ViewModel::~ViewModel()
+{
+}
+
+const Size& ViewModel::GetControlSize() const
+{
+ return mModel->GetControlSize();
+}
+
+const Size& ViewModel::GetLayoutSize() const
+{
+ return mModel->GetLayoutSize();
+}
+
+const Vector2& ViewModel::GetScrollPosition() const
+{
+ return mModel->GetScrollPosition();
+}
+
+Layout::HorizontalAlignment ViewModel::GetHorizontalAlignment() const
+{
+ return mModel->GetHorizontalAlignment();
+}
+
+Layout::VerticalAlignment ViewModel::GetVerticalAlignment() const
+{
+ return mModel->GetVerticalAlignment();
+}
+
+bool ViewModel::IsTextElideEnabled() const
+{
+ return mModel->IsTextElideEnabled();
+}
+
+Length ViewModel::GetNumberOfLines() const
+{
+ return mModel->GetNumberOfLines();
+}
+
+const LineRun* const ViewModel::GetLines() const
+{
+ return mModel->GetLines();
+}
+
+Length ViewModel::GetNumberOfGlyphs() const
+{
+ if( mIsTextElided && mModel->IsTextElideEnabled() )
+ {
+ return mElidedGlyphs.Count();
+ }
+ else
+ {
+ return mModel->GetNumberOfGlyphs();
+ }
+
+ return 0u;
+}
+
+const GlyphInfo* const ViewModel::GetGlyphs() const
+{
+ if( mIsTextElided && mModel->IsTextElideEnabled() )
+ {
+ return mElidedGlyphs.Begin();
+ }
+ else
+ {
+ return mModel->GetGlyphs();
+ }
+
+ return NULL;
+}
+
+const Vector2* const ViewModel::GetLayout() const
+{
+ if( mIsTextElided && mModel->IsTextElideEnabled() )
+ {
+ return mElidedLayout.Begin();
+ }
+ else
+ {
+ return mModel->GetLayout();
+ }
+
+ return NULL;
+}
+
+const Vector4* const ViewModel::GetColors() const
+{
+ return mModel->GetColors();
+}
+
+const ColorIndex* const ViewModel::GetColorIndices() const
+{
+ return mModel->GetColorIndices();
+}
+
+const Vector4& ViewModel::GetDefaultColor() const
+{
+ return mModel->GetDefaultColor();
+}
+
+void ViewModel::ElideGlyphs()
+{
+ mIsTextElided = false;
+
+ if( mModel->IsTextElideEnabled() )
+ {
+ const Length numberOfLines = mModel->GetNumberOfLines();
+ if( 0u != numberOfLines )
+ {
+ const LineRun* const lines = mModel->GetLines();
+
+ const LineRun& lastLine = *( lines + ( numberOfLines - 1u ) );
+ const Length numberOfLaidOutGlyphs = lastLine.glyphRun.glyphIndex + lastLine.glyphRun.numberOfGlyphs;
+
+ if( lastLine.ellipsis && ( 0u != numberOfLaidOutGlyphs ) )
+ {
+ mIsTextElided = true;
+ TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get();
+
+ const GlyphInfo* const glyphs = mModel->GetGlyphs();
+ const Vector2* const positions = mModel->GetLayout();
+
+ // Copy the glyphs to be elided.
+ mElidedGlyphs.Resize( numberOfLaidOutGlyphs );
+ mElidedLayout.Resize( numberOfLaidOutGlyphs );
+
+ GlyphInfo* elidedGlyphsBuffer = mElidedGlyphs.Begin();
+ Vector2* elidedPositionsBuffer = mElidedLayout.Begin();
+
+ memcpy( elidedGlyphsBuffer, glyphs, numberOfLaidOutGlyphs * sizeof( GlyphInfo ) );
+ memcpy( elidedPositionsBuffer, positions, numberOfLaidOutGlyphs * sizeof( Vector2 ) );
+
+ const Size& controlSize = mModel->GetControlSize();
+
+ if( ( 1u == numberOfLines ) &&
+ ( lastLine.ascender - lastLine.descender > controlSize.height ) )
+ {
+ // Get the first glyph which is going to be replaced and the ellipsis glyph.
+ GlyphInfo& glyphToRemove = *elidedGlyphsBuffer;
+ const GlyphInfo& ellipsisGlyph = fontClient.GetEllipsisGlyph( fontClient.GetPointSize( glyphToRemove.fontId ) );
+
+ // Change the 'x' and 'y' position of the ellipsis glyph.
+ Vector2& position = *elidedPositionsBuffer;
+
+ position.x = ellipsisGlyph.xBearing;
+ position.y = -lastLine.ascender + controlSize.height - ellipsisGlyph.yBearing;
+
+ // Replace the glyph by the ellipsis glyph and resize the buffers.
+ glyphToRemove = ellipsisGlyph;
+
+ mElidedGlyphs.Resize( 1u );
+ mElidedLayout.Resize( 1u );
+
+ return;
+ }
+
+ // firstPenX, penY and firstPenSet are used to position the ellipsis glyph if needed.
+ float firstPenX = 0.f; // Used if rtl text is elided.
+ float penY = 0.f;
+ bool firstPenSet = false;
+
+ // Add the ellipsis glyph.
+ bool inserted = false;
+ float removedGlypsWidth = 0.f;
+ Length numberOfRemovedGlyphs = 0u;
+ GlyphIndex index = numberOfLaidOutGlyphs - 1u;
+
+ // The ellipsis glyph has to fit in the place where the last glyph(s) is(are) removed.
+ while( !inserted )
+ {
+ const GlyphInfo& glyphToRemove = *( elidedGlyphsBuffer + index );
+
+ if( 0u != glyphToRemove.fontId )
+ {
+ // i.e. The font id of the glyph shaped from the '\n' character is zero.
+
+ // Need to reshape the glyph as the font may be different in size.
+ const GlyphInfo& ellipsisGlyph = fontClient.GetEllipsisGlyph( fontClient.GetPointSize( glyphToRemove.fontId ) );
+
+ if( !firstPenSet )
+ {
+ const Vector2& position = *( elidedPositionsBuffer + index );
+
+ // Calculates the penY of the current line. It will be used to position the ellipsis glyph.
+ penY = position.y + glyphToRemove.yBearing;
+
+ // Calculates the first penX which will be used if rtl text is elided.
+ firstPenX = position.x - glyphToRemove.xBearing;
+ if( firstPenX < -ellipsisGlyph.xBearing )
+ {
+ // Avoids to exceed the bounding box when rtl text is elided.
+ firstPenX = -ellipsisGlyph.xBearing;
+ }
+
+ removedGlypsWidth = -ellipsisGlyph.xBearing;
+
+ firstPenSet = true;
+ }
+
+ removedGlypsWidth += std::min( glyphToRemove.advance, ( glyphToRemove.xBearing + glyphToRemove.width ) );
+
+ // Calculate the width of the ellipsis glyph and check if it fits.
+ const float ellipsisGlyphWidth = ellipsisGlyph.width + ellipsisGlyph.xBearing;
+
+ if( ellipsisGlyphWidth < removedGlypsWidth )
+ {
+ GlyphInfo& glyphInfo = *( elidedGlyphsBuffer + index );
+ Vector2& position = *( elidedPositionsBuffer + index );
+ position.x -= ( 0.f > glyphInfo.xBearing ) ? glyphInfo.xBearing : 0.f;
+
+ // Replace the glyph by the ellipsis glyph.
+ glyphInfo = ellipsisGlyph;
+
+ // Change the 'x' and 'y' position of the ellipsis glyph.
+
+ if( position.x > firstPenX )
+ {
+ position.x = firstPenX + removedGlypsWidth - ellipsisGlyphWidth;
+ }
+
+ position.x += ellipsisGlyph.xBearing;
+ position.y = penY - ellipsisGlyph.yBearing;
+
+ inserted = true;
+ }
+ }
+
+ if( !inserted )
+ {
+ if( index > 0u )
+ {
+ --index;
+ }
+ else
+ {
+ // No space for the ellipsis.
+ inserted = true;
+ }
+ ++numberOfRemovedGlyphs;
+ }
+ } // while( !inserted )
+
+ // 'Removes' all the glyphs after the ellipsis glyph.
+ const Length numberOfGlyphs = numberOfLaidOutGlyphs - numberOfRemovedGlyphs;
+ mElidedGlyphs.Resize( numberOfGlyphs );
+ mElidedLayout.Resize( numberOfGlyphs );
+ }
+ }
+ }
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_TEXT_VIEW_MODEL_H
+#define DALI_TOOLKIT_TEXT_VIEW_MODEL_H
+
+/*
+ * Copyright (c) 2016 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/common/dali-vector.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/text-model-interface.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief Responsible of creating and store temporary modifications of the text model.
+ * i.e. The elide of text.
+ */
+class ViewModel : public ModelInterface
+{
+public:
+ /**
+ * @brief Constructor.
+ *
+ * Keeps the pointer to the text's model. It initializes all the members of the class to their defaults.
+ *
+ * @param[in] model Pointer to the text's model interface.
+ */
+ ViewModel( const ModelInterface* const model );
+
+ /**
+ * @brief Virtual destructor.
+ *
+ * It's a default destructor.
+ */
+ virtual ~ViewModel();
+
+ /**
+ * @copydoc ModelInterface::GetControlSize()
+ */
+ virtual const Size& GetControlSize() const;
+
+ /**
+ * @copydoc ModelInterface::GetLayoutSize()
+ */
+ virtual const Size& GetLayoutSize() const;
+
+ /**
+ * @copydoc ModelInterface::GetScrollPosition()
+ */
+ virtual const Vector2& GetScrollPosition() const;
+
+ /**
+ * @copydoc ModelInterface::GetHorizontalAlignment()
+ */
+ virtual Layout::HorizontalAlignment GetHorizontalAlignment() const;
+
+ /**
+ * @copydoc ModelInterface::GetVerticalAlignment()
+ */
+ virtual Layout::VerticalAlignment GetVerticalAlignment() const;
+
+ /**
+ * @copydoc ModelInterface::IsTextElideEnabled()
+ */
+ virtual bool IsTextElideEnabled() const;
+
+ /**
+ * @copydoc ModelInterface::GetNumberOfLines()
+ */
+ virtual Length GetNumberOfLines() const;
+
+ /**
+ * @copydoc ModelInterface::GetLines()
+ */
+ virtual const LineRun* const GetLines() const;
+
+ /**
+ * @copydoc ModelInterface::GetNumberOfGlyphs()
+ */
+ virtual Length GetNumberOfGlyphs() const;
+
+ /**
+ * @copydoc ModelInterface::GetGlyphs()
+ */
+ virtual const GlyphInfo* const GetGlyphs() const;
+
+ /**
+ * @copydoc ModelInterface::GetLayout()
+ */
+ virtual const Vector2* const GetLayout() const;
+
+ /**
+ * @copydoc ModelInterface::GetColors()
+ */
+ virtual const Vector4* const GetColors() const;
+
+ /**
+ * @copydoc ModelInterface::GetColorIndices()
+ */
+ virtual const ColorIndex* const GetColorIndices() const;
+
+ /**
+ * @copydoc ModelInterface::GetDefaultColor()
+ */
+ virtual const Vector4& GetDefaultColor() const;
+
+ /**
+ * @brief Does the text elide.
+ *
+ * It stores a copy of the visible glyphs and removes as many glyphs as needed
+ * from the last visible line to add the ellipsis glyph.
+ *
+ * It stores as well a copy of the positions for each visible glyph.
+ */
+ void ElideGlyphs();
+
+private:
+ const ModelInterface* const mModel; ///< Pointer to the text's model.
+ Vector<GlyphInfo> mElidedGlyphs; ///< Stores the glyphs of the elided text.
+ Vector<Vector2> mElidedLayout; ///< Stores the positions of each glyph of the elided text.
+ bool mIsTextElided : 1; ///< Whether the text has been elided.
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_VIEW_MODEL_H
const CharacterIndex styleIndex = ( mEventData->mPrimaryCursorPosition > 0u ) ? mEventData->mPrimaryCursorPosition - 1u : 0u;
// Retrieve the style from the style runs stored in the logical model.
- mLogicalModel->RetrieveStyle( styleIndex, mEventData->mInputStyle );
+ mModel->mLogicalModel->RetrieveStyle( styleIndex, mEventData->mInputStyle );
// Compare if the input style has changed.
const bool hasInputStyleChanged = !currentInputStyle.Equal( mEventData->mInputStyle );
{
if ( mEventData )
{
- LayoutEngine::Layout layout = mLayoutEngine.GetLayout();
- mEventData->mImfManager.NotifyTextInputMultiLine( layout == LayoutEngine::MULTI_LINE_BOX );
+ Text::Layout::Engine::Type layout = mLayoutEngine.GetLayout();
+ mEventData->mImfManager.NotifyTextInputMultiLine( layout == Text::Layout::Engine::MULTI_LINE_BOX );
}
}
Length numberOfWhiteSpaces = 0u;
// Get the buffer to the text.
- Character* utf32CharacterBuffer = mLogicalModel->mText.Begin();
+ Character* utf32CharacterBuffer = mModel->mLogicalModel->mText.Begin();
- const Length totalNumberOfCharacters = mLogicalModel->mText.Count();
+ const Length totalNumberOfCharacters = mModel->mLogicalModel->mText.Count();
for( ; index < totalNumberOfCharacters; ++index, ++numberOfWhiteSpaces )
{
if( !TextAbstraction::IsWhiteSpace( *( utf32CharacterBuffer + index ) ) )
void Controller::Impl::GetText( CharacterIndex index, std::string& text ) const
{
// Get the total number of characters.
- Length numberOfCharacters = mLogicalModel->mText.Count();
+ Length numberOfCharacters = mModel->mLogicalModel->mText.Count();
// Retrieve the text.
if( 0u != numberOfCharacters )
{
- Utf32ToUtf8( mLogicalModel->mText.Begin() + index, numberOfCharacters - index, text );
+ Utf32ToUtf8( mModel->mLogicalModel->mText.Begin() + index, numberOfCharacters - index, text );
}
}
mTextUpdateInfo.mStartLineIndex = 0u;
numberOfCharacters = 0u;
- const Length numberOfParagraphs = mLogicalModel->mParagraphInfo.Count();
+ const Length numberOfParagraphs = mModel->mLogicalModel->mParagraphInfo.Count();
if( 0u == numberOfParagraphs )
{
mTextUpdateInfo.mParagraphCharacterIndex = 0u;
numberOfCharacters = 0u;
mTextUpdateInfo.mRequestedNumberOfCharacters = mTextUpdateInfo.mNumberOfCharactersToAdd - mTextUpdateInfo.mNumberOfCharactersToRemove;
- mTextUpdateInfo.mStartGlyphIndex = mVisualModel->mGlyphs.Count();
- mTextUpdateInfo.mStartLineIndex = mVisualModel->mLines.Count() - 1u;
+ mTextUpdateInfo.mStartGlyphIndex = mModel->mVisualModel->mGlyphs.Count();
+ mTextUpdateInfo.mStartLineIndex = mModel->mVisualModel->mLines.Count() - 1u;
// Nothing else to do;
return;
{
numberOfCharactersToUpdate = ( mTextUpdateInfo.mNumberOfCharactersToRemove > 0u ) ? mTextUpdateInfo.mNumberOfCharactersToRemove : 1u;
}
- mLogicalModel->FindParagraphs( mTextUpdateInfo.mCharacterIndex,
- numberOfCharactersToUpdate,
- paragraphsToBeUpdated );
+ mModel->mLogicalModel->FindParagraphs( mTextUpdateInfo.mCharacterIndex,
+ numberOfCharactersToUpdate,
+ paragraphsToBeUpdated );
}
if( 0u != paragraphsToBeUpdated.Count() )
{
const ParagraphRunIndex firstParagraphIndex = *( paragraphsToBeUpdated.Begin() );
- const ParagraphRun& firstParagraph = *( mLogicalModel->mParagraphInfo.Begin() + firstParagraphIndex );
+ const ParagraphRun& firstParagraph = *( mModel->mLogicalModel->mParagraphInfo.Begin() + firstParagraphIndex );
mTextUpdateInfo.mParagraphCharacterIndex = firstParagraph.characterRun.characterIndex;
ParagraphRunIndex lastParagraphIndex = *( paragraphsToBeUpdated.End() - 1u );
- const ParagraphRun& lastParagraph = *( mLogicalModel->mParagraphInfo.Begin() + lastParagraphIndex );
+ const ParagraphRun& lastParagraph = *( mModel->mLogicalModel->mParagraphInfo.Begin() + lastParagraphIndex );
if( ( mTextUpdateInfo.mNumberOfCharactersToRemove > 0u ) && // Some character are removed.
( lastParagraphIndex < numberOfParagraphs - 1u ) && // There is a next paragraph.
( mTextUpdateInfo.mCharacterIndex + mTextUpdateInfo.mNumberOfCharactersToRemove ) ) )
{
// The new paragraph character of the last updated paragraph has been removed so is going to be merged with the next one.
- const ParagraphRun& lastParagraph = *( mLogicalModel->mParagraphInfo.Begin() + lastParagraphIndex + 1u );
+ const ParagraphRun& lastParagraph = *( mModel->mLogicalModel->mParagraphInfo.Begin() + lastParagraphIndex + 1u );
numberOfCharacters = lastParagraph.characterRun.characterIndex + lastParagraph.characterRun.numberOfCharacters - mTextUpdateInfo.mParagraphCharacterIndex;
}
}
mTextUpdateInfo.mRequestedNumberOfCharacters = numberOfCharacters + mTextUpdateInfo.mNumberOfCharactersToAdd - mTextUpdateInfo.mNumberOfCharactersToRemove;
- mTextUpdateInfo.mStartGlyphIndex = *( mVisualModel->mCharactersToGlyph.Begin() + mTextUpdateInfo.mParagraphCharacterIndex );
+ mTextUpdateInfo.mStartGlyphIndex = *( mModel->mVisualModel->mCharactersToGlyph.Begin() + mTextUpdateInfo.mParagraphCharacterIndex );
}
void Controller::Impl::ClearFullModelData( OperationsMask operations )
{
if( NO_OPERATION != ( GET_LINE_BREAKS & operations ) )
{
- mLogicalModel->mLineBreakInfo.Clear();
- mLogicalModel->mParagraphInfo.Clear();
+ mModel->mLogicalModel->mLineBreakInfo.Clear();
+ mModel->mLogicalModel->mParagraphInfo.Clear();
}
if( NO_OPERATION != ( GET_WORD_BREAKS & operations ) )
{
- mLogicalModel->mLineBreakInfo.Clear();
+ mModel->mLogicalModel->mLineBreakInfo.Clear();
}
if( NO_OPERATION != ( GET_SCRIPTS & operations ) )
{
- mLogicalModel->mScriptRuns.Clear();
+ mModel->mLogicalModel->mScriptRuns.Clear();
}
if( NO_OPERATION != ( VALIDATE_FONTS & operations ) )
{
- mLogicalModel->mFontRuns.Clear();
+ mModel->mLogicalModel->mFontRuns.Clear();
}
- if( 0u != mLogicalModel->mBidirectionalParagraphInfo.Count() )
+ if( 0u != mModel->mLogicalModel->mBidirectionalParagraphInfo.Count() )
{
if( NO_OPERATION != ( BIDI_INFO & operations ) )
{
- mLogicalModel->mBidirectionalParagraphInfo.Clear();
- mLogicalModel->mCharacterDirections.Clear();
+ mModel->mLogicalModel->mBidirectionalParagraphInfo.Clear();
+ mModel->mLogicalModel->mCharacterDirections.Clear();
}
if( NO_OPERATION != ( REORDER & operations ) )
{
// Free the allocated memory used to store the conversion table in the bidirectional line info run.
- for( Vector<BidirectionalLineInfoRun>::Iterator it = mLogicalModel->mBidirectionalLineInfo.Begin(),
- endIt = mLogicalModel->mBidirectionalLineInfo.End();
+ for( Vector<BidirectionalLineInfoRun>::Iterator it = mModel->mLogicalModel->mBidirectionalLineInfo.Begin(),
+ endIt = mModel->mLogicalModel->mBidirectionalLineInfo.End();
it != endIt;
++it )
{
free( bidiLineInfo.visualToLogicalMap );
bidiLineInfo.visualToLogicalMap = NULL;
}
- mLogicalModel->mBidirectionalLineInfo.Clear();
+ mModel->mLogicalModel->mBidirectionalLineInfo.Clear();
}
}
if( NO_OPERATION != ( SHAPE_TEXT & operations ) )
{
- mVisualModel->mGlyphs.Clear();
- mVisualModel->mGlyphsToCharacters.Clear();
- mVisualModel->mCharactersToGlyph.Clear();
- mVisualModel->mCharactersPerGlyph.Clear();
- mVisualModel->mGlyphsPerCharacter.Clear();
- mVisualModel->mGlyphPositions.Clear();
+ mModel->mVisualModel->mGlyphs.Clear();
+ mModel->mVisualModel->mGlyphsToCharacters.Clear();
+ mModel->mVisualModel->mCharactersToGlyph.Clear();
+ mModel->mVisualModel->mCharactersPerGlyph.Clear();
+ mModel->mVisualModel->mGlyphsPerCharacter.Clear();
+ mModel->mVisualModel->mGlyphPositions.Clear();
}
if( NO_OPERATION != ( LAYOUT & operations ) )
{
- mVisualModel->mLines.Clear();
+ mModel->mVisualModel->mLines.Clear();
}
if( NO_OPERATION != ( COLOR & operations ) )
{
- mVisualModel->mColorIndices.Clear();
+ mModel->mVisualModel->mColorIndices.Clear();
}
}
if( NO_OPERATION != ( GET_LINE_BREAKS & operations ) )
{
// Clear the line break info.
- LineBreakInfo* lineBreakInfoBuffer = mLogicalModel->mLineBreakInfo.Begin();
+ LineBreakInfo* lineBreakInfoBuffer = mModel->mLogicalModel->mLineBreakInfo.Begin();
- mLogicalModel->mLineBreakInfo.Erase( lineBreakInfoBuffer + startIndex,
- lineBreakInfoBuffer + endIndexPlusOne );
+ mModel->mLogicalModel->mLineBreakInfo.Erase( lineBreakInfoBuffer + startIndex,
+ lineBreakInfoBuffer + endIndexPlusOne );
// Clear the paragraphs.
ClearCharacterRuns( startIndex,
endIndex,
- mLogicalModel->mParagraphInfo );
+ mModel->mLogicalModel->mParagraphInfo );
}
if( NO_OPERATION != ( GET_WORD_BREAKS & operations ) )
{
// Clear the word break info.
- WordBreakInfo* wordBreakInfoBuffer = mLogicalModel->mWordBreakInfo.Begin();
+ WordBreakInfo* wordBreakInfoBuffer = mModel->mLogicalModel->mWordBreakInfo.Begin();
- mLogicalModel->mWordBreakInfo.Erase( wordBreakInfoBuffer + startIndex,
+ mModel->mLogicalModel->mWordBreakInfo.Erase( wordBreakInfoBuffer + startIndex,
wordBreakInfoBuffer + endIndexPlusOne );
}
// Clear the scripts.
ClearCharacterRuns( startIndex,
endIndex,
- mLogicalModel->mScriptRuns );
+ mModel->mLogicalModel->mScriptRuns );
}
if( NO_OPERATION != ( VALIDATE_FONTS & operations ) )
// Clear the fonts.
ClearCharacterRuns( startIndex,
endIndex,
- mLogicalModel->mFontRuns );
+ mModel->mLogicalModel->mFontRuns );
}
- if( 0u != mLogicalModel->mBidirectionalParagraphInfo.Count() )
+ if( 0u != mModel->mLogicalModel->mBidirectionalParagraphInfo.Count() )
{
if( NO_OPERATION != ( BIDI_INFO & operations ) )
{
// Clear the bidirectional paragraph info.
ClearCharacterRuns( startIndex,
endIndex,
- mLogicalModel->mBidirectionalParagraphInfo );
+ mModel->mLogicalModel->mBidirectionalParagraphInfo );
// Clear the character's directions.
- CharacterDirection* characterDirectionsBuffer = mLogicalModel->mCharacterDirections.Begin();
+ CharacterDirection* characterDirectionsBuffer = mModel->mLogicalModel->mCharacterDirections.Begin();
- mLogicalModel->mCharacterDirections.Erase( characterDirectionsBuffer + startIndex,
- characterDirectionsBuffer + endIndexPlusOne );
+ mModel->mLogicalModel->mCharacterDirections.Erase( characterDirectionsBuffer + startIndex,
+ characterDirectionsBuffer + endIndexPlusOne );
}
if( NO_OPERATION != ( REORDER & operations ) )
{
- uint32_t startRemoveIndex = mLogicalModel->mBidirectionalLineInfo.Count();
+ uint32_t startRemoveIndex = mModel->mLogicalModel->mBidirectionalLineInfo.Count();
uint32_t endRemoveIndex = startRemoveIndex;
ClearCharacterRuns( startIndex,
endIndex,
- mLogicalModel->mBidirectionalLineInfo,
+ mModel->mLogicalModel->mBidirectionalLineInfo,
startRemoveIndex,
endRemoveIndex );
- BidirectionalLineInfoRun* bidirectionalLineInfoBuffer = mLogicalModel->mBidirectionalLineInfo.Begin();
+ BidirectionalLineInfoRun* bidirectionalLineInfoBuffer = mModel->mLogicalModel->mBidirectionalLineInfo.Begin();
// Free the allocated memory used to store the conversion table in the bidirectional line info run.
for( Vector<BidirectionalLineInfoRun>::Iterator it = bidirectionalLineInfoBuffer + startRemoveIndex,
bidiLineInfo.visualToLogicalMap = NULL;
}
- mLogicalModel->mBidirectionalLineInfo.Erase( bidirectionalLineInfoBuffer + startRemoveIndex,
- bidirectionalLineInfoBuffer + endRemoveIndex );
+ mModel->mLogicalModel->mBidirectionalLineInfo.Erase( bidirectionalLineInfoBuffer + startRemoveIndex,
+ bidirectionalLineInfoBuffer + endRemoveIndex );
}
}
}
const Length numberOfCharactersRemoved = endIndexPlusOne - startIndex;
// Convert the character index to glyph index before deleting the character to glyph and the glyphs per character buffers.
- GlyphIndex* charactersToGlyphBuffer = mVisualModel->mCharactersToGlyph.Begin();
- Length* glyphsPerCharacterBuffer = mVisualModel->mGlyphsPerCharacter.Begin();
+ GlyphIndex* charactersToGlyphBuffer = mModel->mVisualModel->mCharactersToGlyph.Begin();
+ Length* glyphsPerCharacterBuffer = mModel->mVisualModel->mGlyphsPerCharacter.Begin();
const GlyphIndex endGlyphIndexPlusOne = *( charactersToGlyphBuffer + endIndex ) + *( glyphsPerCharacterBuffer + endIndex );
const Length numberOfGlyphsRemoved = endGlyphIndexPlusOne - mTextUpdateInfo.mStartGlyphIndex;
{
// Update the character to glyph indices.
for( Vector<GlyphIndex>::Iterator it = charactersToGlyphBuffer + endIndexPlusOne,
- endIt = charactersToGlyphBuffer + mVisualModel->mCharactersToGlyph.Count();
+ endIt = charactersToGlyphBuffer + mModel->mVisualModel->mCharactersToGlyph.Count();
it != endIt;
++it )
{
}
// Clear the character to glyph conversion table.
- mVisualModel->mCharactersToGlyph.Erase( charactersToGlyphBuffer + startIndex,
- charactersToGlyphBuffer + endIndexPlusOne );
+ mModel->mVisualModel->mCharactersToGlyph.Erase( charactersToGlyphBuffer + startIndex,
+ charactersToGlyphBuffer + endIndexPlusOne );
// Clear the glyphs per character table.
- mVisualModel->mGlyphsPerCharacter.Erase( glyphsPerCharacterBuffer + startIndex,
- glyphsPerCharacterBuffer + endIndexPlusOne );
+ mModel->mVisualModel->mGlyphsPerCharacter.Erase( glyphsPerCharacterBuffer + startIndex,
+ glyphsPerCharacterBuffer + endIndexPlusOne );
// Clear the glyphs buffer.
- GlyphInfo* glyphsBuffer = mVisualModel->mGlyphs.Begin();
- mVisualModel->mGlyphs.Erase( glyphsBuffer + mTextUpdateInfo.mStartGlyphIndex,
- glyphsBuffer + endGlyphIndexPlusOne );
+ GlyphInfo* glyphsBuffer = mModel->mVisualModel->mGlyphs.Begin();
+ mModel->mVisualModel->mGlyphs.Erase( glyphsBuffer + mTextUpdateInfo.mStartGlyphIndex,
+ glyphsBuffer + endGlyphIndexPlusOne );
- CharacterIndex* glyphsToCharactersBuffer = mVisualModel->mGlyphsToCharacters.Begin();
+ CharacterIndex* glyphsToCharactersBuffer = mModel->mVisualModel->mGlyphsToCharacters.Begin();
// Update the glyph to character indices.
for( Vector<CharacterIndex>::Iterator it = glyphsToCharactersBuffer + endGlyphIndexPlusOne,
- endIt = glyphsToCharactersBuffer + mVisualModel->mGlyphsToCharacters.Count();
+ endIt = glyphsToCharactersBuffer + mModel->mVisualModel->mGlyphsToCharacters.Count();
it != endIt;
++it )
{
}
// Clear the glyphs to characters buffer.
- mVisualModel->mGlyphsToCharacters.Erase( glyphsToCharactersBuffer + mTextUpdateInfo.mStartGlyphIndex,
- glyphsToCharactersBuffer + endGlyphIndexPlusOne );
+ mModel->mVisualModel->mGlyphsToCharacters.Erase( glyphsToCharactersBuffer + mTextUpdateInfo.mStartGlyphIndex,
+ glyphsToCharactersBuffer + endGlyphIndexPlusOne );
// Clear the characters per glyph buffer.
- Length* charactersPerGlyphBuffer = mVisualModel->mCharactersPerGlyph.Begin();
- mVisualModel->mCharactersPerGlyph.Erase( charactersPerGlyphBuffer + mTextUpdateInfo.mStartGlyphIndex,
- charactersPerGlyphBuffer + endGlyphIndexPlusOne );
+ Length* charactersPerGlyphBuffer = mModel->mVisualModel->mCharactersPerGlyph.Begin();
+ mModel->mVisualModel->mCharactersPerGlyph.Erase( charactersPerGlyphBuffer + mTextUpdateInfo.mStartGlyphIndex,
+ charactersPerGlyphBuffer + endGlyphIndexPlusOne );
// Clear the positions buffer.
- Vector2* positionsBuffer = mVisualModel->mGlyphPositions.Begin();
- mVisualModel->mGlyphPositions.Erase( positionsBuffer + mTextUpdateInfo.mStartGlyphIndex,
- positionsBuffer + endGlyphIndexPlusOne );
+ Vector2* positionsBuffer = mModel->mVisualModel->mGlyphPositions.Begin();
+ mModel->mVisualModel->mGlyphPositions.Erase( positionsBuffer + mTextUpdateInfo.mStartGlyphIndex,
+ positionsBuffer + endGlyphIndexPlusOne );
}
if( NO_OPERATION != ( LAYOUT & operations ) )
{
// Clear the lines.
- uint32_t startRemoveIndex = mVisualModel->mLines.Count();
+ uint32_t startRemoveIndex = mModel->mVisualModel->mLines.Count();
uint32_t endRemoveIndex = startRemoveIndex;
ClearCharacterRuns( startIndex,
endIndex,
- mVisualModel->mLines,
+ mModel->mVisualModel->mLines,
startRemoveIndex,
endRemoveIndex );
// Will update the glyph runs.
- startRemoveIndex = mVisualModel->mLines.Count();
+ startRemoveIndex = mModel->mVisualModel->mLines.Count();
endRemoveIndex = startRemoveIndex;
ClearGlyphRuns( mTextUpdateInfo.mStartGlyphIndex,
endGlyphIndexPlusOne - 1u,
- mVisualModel->mLines,
+ mModel->mVisualModel->mLines,
startRemoveIndex,
endRemoveIndex );
// Set the line index from where to insert the new laid-out lines.
mTextUpdateInfo.mStartLineIndex = startRemoveIndex;
- LineRun* linesBuffer = mVisualModel->mLines.Begin();
- mVisualModel->mLines.Erase( linesBuffer + startRemoveIndex,
- linesBuffer + endRemoveIndex );
+ LineRun* linesBuffer = mModel->mVisualModel->mLines.Begin();
+ mModel->mVisualModel->mLines.Erase( linesBuffer + startRemoveIndex,
+ linesBuffer + endRemoveIndex );
}
if( NO_OPERATION != ( COLOR & operations ) )
{
- if( 0u != mVisualModel->mColorIndices.Count() )
+ if( 0u != mModel->mVisualModel->mColorIndices.Count() )
{
- ColorIndex* colorIndexBuffer = mVisualModel->mColorIndices.Begin();
- mVisualModel->mColorIndices.Erase( colorIndexBuffer + mTextUpdateInfo.mStartGlyphIndex,
- colorIndexBuffer + endGlyphIndexPlusOne );
+ ColorIndex* colorIndexBuffer = mModel->mVisualModel->mColorIndices.Begin();
+ mModel->mVisualModel->mColorIndices.Erase( colorIndexBuffer + mTextUpdateInfo.mStartGlyphIndex,
+ colorIndexBuffer + endGlyphIndexPlusOne );
}
}
}
}
// The estimated number of lines. Used to avoid reallocations when layouting.
- mTextUpdateInfo.mEstimatedNumberOfLines = std::max( mVisualModel->mLines.Count(), mLogicalModel->mParagraphInfo.Count() );
+ mTextUpdateInfo.mEstimatedNumberOfLines = std::max( mModel->mVisualModel->mLines.Count(), mModel->mLogicalModel->mParagraphInfo.Count() );
- mVisualModel->ClearCaches();
+ mModel->mVisualModel->ClearCaches();
}
bool Controller::Impl::UpdateModel( OperationsMask operationsRequired )
return false;
}
- Vector<Character>& utf32Characters = mLogicalModel->mText;
+ Vector<Character>& utf32Characters = mModel->mLogicalModel->mText;
const Length numberOfCharacters = utf32Characters.Count();
// Whether the model is updated.
bool updated = false;
- Vector<LineBreakInfo>& lineBreakInfo = mLogicalModel->mLineBreakInfo;
+ Vector<LineBreakInfo>& lineBreakInfo = mModel->mLogicalModel->mLineBreakInfo;
const Length requestedNumberOfCharacters = mTextUpdateInfo.mRequestedNumberOfCharacters;
if( NO_OPERATION != ( GET_LINE_BREAKS & operations ) )
lineBreakInfo );
// Create the paragraph info.
- mLogicalModel->CreateParagraphInfo( startIndex,
- requestedNumberOfCharacters );
+ mModel->mLogicalModel->CreateParagraphInfo( startIndex,
+ requestedNumberOfCharacters );
updated = true;
}
- Vector<WordBreakInfo>& wordBreakInfo = mLogicalModel->mWordBreakInfo;
+ Vector<WordBreakInfo>& wordBreakInfo = mModel->mLogicalModel->mWordBreakInfo;
if( NO_OPERATION != ( GET_WORD_BREAKS & operations ) )
{
// Retrieves the word break info. The word break info is used to layout the text (where to wrap the text in lines).
const bool getScripts = NO_OPERATION != ( GET_SCRIPTS & operations );
const bool validateFonts = NO_OPERATION != ( VALIDATE_FONTS & operations );
- Vector<ScriptRun>& scripts = mLogicalModel->mScriptRuns;
- Vector<FontRun>& validFonts = mLogicalModel->mFontRuns;
+ Vector<ScriptRun>& scripts = mModel->mLogicalModel->mScriptRuns;
+ Vector<FontRun>& validFonts = mModel->mLogicalModel->mFontRuns;
if( getScripts || validateFonts )
{
if( validateFonts )
{
// Validate the fonts set through the mark-up string.
- Vector<FontDescriptionRun>& fontDescriptionRuns = mLogicalModel->mFontDescriptionRuns;
+ Vector<FontDescriptionRun>& fontDescriptionRuns = mModel->mLogicalModel->mFontDescriptionRuns;
// Get the default font's description.
TextAbstraction::FontDescription defaultFontDescription;
Vector<Character> mirroredUtf32Characters;
bool textMirrored = false;
- const Length numberOfParagraphs = mLogicalModel->mParagraphInfo.Count();
+ const Length numberOfParagraphs = mModel->mLogicalModel->mParagraphInfo.Count();
if( NO_OPERATION != ( BIDI_INFO & operations ) )
{
- Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = mLogicalModel->mBidirectionalParagraphInfo;
+ Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = mModel->mLogicalModel->mBidirectionalParagraphInfo;
bidirectionalInfo.Reserve( numberOfParagraphs );
// Calculates the bidirectional info for the whole paragraph if it contains right to left scripts.
if( 0u != bidirectionalInfo.Count() )
{
// Only set the character directions if there is right to left characters.
- Vector<CharacterDirection>& directions = mLogicalModel->mCharacterDirections;
+ Vector<CharacterDirection>& directions = mModel->mLogicalModel->mCharacterDirections;
GetCharactersDirection( bidirectionalInfo,
numberOfCharacters,
startIndex,
else
{
// There is no right to left characters. Clear the directions vector.
- mLogicalModel->mCharacterDirections.Clear();
+ mModel->mLogicalModel->mCharacterDirections.Clear();
}
updated = true;
}
- Vector<GlyphInfo>& glyphs = mVisualModel->mGlyphs;
- Vector<CharacterIndex>& glyphsToCharactersMap = mVisualModel->mGlyphsToCharacters;
- Vector<Length>& charactersPerGlyph = mVisualModel->mCharactersPerGlyph;
+ Vector<GlyphInfo>& glyphs = mModel->mVisualModel->mGlyphs;
+ Vector<CharacterIndex>& glyphsToCharactersMap = mModel->mVisualModel->mGlyphsToCharacters;
+ Vector<Length>& charactersPerGlyph = mModel->mVisualModel->mCharactersPerGlyph;
Vector<GlyphIndex> newParagraphGlyphs;
newParagraphGlyphs.Reserve( numberOfParagraphs );
newParagraphGlyphs );
// Create the 'number of glyphs' per character and the glyph to character conversion tables.
- mVisualModel->CreateGlyphsPerCharacterTable( startIndex, mTextUpdateInfo.mStartGlyphIndex, requestedNumberOfCharacters );
- mVisualModel->CreateCharacterToGlyphTable( startIndex, mTextUpdateInfo.mStartGlyphIndex, requestedNumberOfCharacters );
+ mModel->mVisualModel->CreateGlyphsPerCharacterTable( startIndex, mTextUpdateInfo.mStartGlyphIndex, requestedNumberOfCharacters );
+ mModel->mVisualModel->CreateCharacterToGlyphTable( startIndex, mTextUpdateInfo.mStartGlyphIndex, requestedNumberOfCharacters );
updated = true;
}
if( NO_OPERATION != ( COLOR & operations ) )
{
// Set the color runs in glyphs.
- SetColorSegmentationInfo( mLogicalModel->mColorRuns,
- mVisualModel->mCharactersToGlyph,
- mVisualModel->mGlyphsPerCharacter,
+ SetColorSegmentationInfo( mModel->mLogicalModel->mColorRuns,
+ mModel->mVisualModel->mCharactersToGlyph,
+ mModel->mVisualModel->mGlyphsPerCharacter,
startIndex,
mTextUpdateInfo.mStartGlyphIndex,
requestedNumberOfCharacters,
- mVisualModel->mColors,
- mVisualModel->mColorIndices );
+ mModel->mVisualModel->mColors,
+ mModel->mVisualModel->mColorIndices );
updated = true;
}
if( ( NULL != mEventData ) &&
mEventData->mPreEditFlag &&
- ( 0u != mVisualModel->mCharactersToGlyph.Count() ) )
+ ( 0u != mModel->mVisualModel->mCharactersToGlyph.Count() ) )
{
// Add the underline for the pre-edit text.
- const GlyphIndex* const charactersToGlyphBuffer = mVisualModel->mCharactersToGlyph.Begin();
- const Length* const glyphsPerCharacterBuffer = mVisualModel->mGlyphsPerCharacter.Begin();
+ const GlyphIndex* const charactersToGlyphBuffer = mModel->mVisualModel->mCharactersToGlyph.Begin();
+ const Length* const glyphsPerCharacterBuffer = mModel->mVisualModel->mGlyphsPerCharacter.Begin();
const GlyphIndex glyphStart = *( charactersToGlyphBuffer + mEventData->mPreEditStartPosition );
const CharacterIndex lastPreEditCharacter = mEventData->mPreEditStartPosition + ( ( mEventData->mPreEditLength > 0u ) ? mEventData->mPreEditLength - 1u : 0u );
underlineRun.numberOfGlyphs = 1u + glyphEnd - glyphStart;
// TODO: At the moment the underline runs are only for pre-edit.
- mVisualModel->mUnderlineRuns.PushBack( underlineRun );
+ mModel->mVisualModel->mUnderlineRuns.PushBack( underlineRun );
}
// The estimated number of lines. Used to avoid reallocations when layouting.
- mTextUpdateInfo.mEstimatedNumberOfLines = std::max( mVisualModel->mLines.Count(), mLogicalModel->mParagraphInfo.Count() );
+ mTextUpdateInfo.mEstimatedNumberOfLines = std::max( mModel->mVisualModel->mLines.Count(), mModel->mLogicalModel->mParagraphInfo.Count() );
// Set the previous number of characters for the next time the text is updated.
mTextUpdateInfo.mPreviousNumberOfCharacters = numberOfCharacters;
}
else if( Dali::DALI_KEY_CURSOR_RIGHT == keyCode )
{
- if( mLogicalModel->mText.Count() > mEventData->mPrimaryCursorPosition )
+ if( mModel->mLogicalModel->mText.Count() > mEventData->mPrimaryCursorPosition )
{
mEventData->mPrimaryCursorPosition = CalculateNewCursorIndex( mEventData->mPrimaryCursorPosition );
}
characterIndex = mEventData->mPrimaryCursorPosition - 1u;
}
- const LineIndex lineIndex = mVisualModel->GetLineOfCharacter( characterIndex );
+ const LineIndex lineIndex = mModel->mVisualModel->GetLineOfCharacter( characterIndex );
if( lineIndex > 0u )
{
cursorInfo );
// Get the line above.
- const LineRun& line = *( mVisualModel->mLines.Begin() + ( lineIndex - 1u ) );
+ const LineRun& line = *( mModel->mVisualModel->mLines.Begin() + ( lineIndex - 1u ) );
// Get the next hit 'y' point.
const float hitPointY = cursorInfo.lineOffset - 0.5f * ( line.ascender - line.descender );
// Use the cursor hook position 'x' and the next hit 'y' position to calculate the new cursor index.
- mEventData->mPrimaryCursorPosition = Text::GetClosestCursorIndex( mVisualModel,
- mLogicalModel,
+ mEventData->mPrimaryCursorPosition = Text::GetClosestCursorIndex( mModel->mVisualModel,
+ mModel->mLogicalModel,
mMetrics,
mEventData->mCursorHookPositionX,
hitPointY );
characterIndex = mEventData->mPrimaryCursorPosition - 1u;
}
- const LineIndex lineIndex = mVisualModel->GetLineOfCharacter( characterIndex );
+ const LineIndex lineIndex = mModel->mVisualModel->GetLineOfCharacter( characterIndex );
- if( lineIndex + 1u < mVisualModel->mLines.Count() )
+ if( lineIndex + 1u < mModel->mVisualModel->mLines.Count() )
{
// Retrieve the cursor position info.
CursorInfo cursorInfo;
cursorInfo );
// Get the line below.
- const LineRun& line = *( mVisualModel->mLines.Begin() + lineIndex + 1u );
+ const LineRun& line = *( mModel->mVisualModel->mLines.Begin() + lineIndex + 1u );
// Get the next hit 'y' point.
const float hitPointY = cursorInfo.lineOffset + cursorInfo.lineHeight + 0.5f * ( line.ascender - line.descender );
// Use the cursor hook position 'x' and the next hit 'y' position to calculate the new cursor index.
- mEventData->mPrimaryCursorPosition = Text::GetClosestCursorIndex( mVisualModel,
- mLogicalModel,
+ mEventData->mPrimaryCursorPosition = Text::GetClosestCursorIndex( mModel->mVisualModel,
+ mModel->mLogicalModel,
mMetrics,
mEventData->mCursorHookPositionX,
hitPointY );
if( IsShowingRealText() )
{
// Convert from control's coords to text's coords.
- const float xPosition = event.p2.mFloat - mScrollPosition.x;
- const float yPosition = event.p3.mFloat - mScrollPosition.y;
+ const float xPosition = event.p2.mFloat - mModel->mScrollPosition.x;
+ const float yPosition = event.p3.mFloat - mModel->mScrollPosition.y;
// Keep the tap 'x' position. Used to move the cursor.
mEventData->mCursorHookPositionX = xPosition;
- mEventData->mPrimaryCursorPosition = Text::GetClosestCursorIndex( mVisualModel,
- mLogicalModel,
+ mEventData->mPrimaryCursorPosition = Text::GetClosestCursorIndex( mModel->mVisualModel,
+ mModel->mLogicalModel,
mMetrics,
xPosition,
yPosition );
}
case Gesture::Continuing:
{
- const Vector2& layoutSize = mVisualModel->GetLayoutSize();
- const Vector2 currentScroll = mScrollPosition;
+ const Vector2& layoutSize = mModel->mVisualModel->GetLayoutSize();
+ const Vector2 currentScroll = mModel->mScrollPosition;
if( isHorizontalScrollEnabled )
{
const float displacementX = event.p2.mFloat;
- mScrollPosition.x += displacementX;
+ mModel->mScrollPosition.x += displacementX;
ClampHorizontalScroll( layoutSize );
}
if( isVerticalScrollEnabled )
{
const float displacementY = event.p3.mFloat;
- mScrollPosition.y += displacementY;
+ mModel->mScrollPosition.y += displacementY;
ClampVerticalScroll( layoutSize );
}
- mEventData->mDecorator->UpdatePositions( mScrollPosition - currentScroll );
+ mEventData->mDecorator->UpdatePositions( mModel->mScrollPosition - currentScroll );
break;
}
case Gesture::Finished:
if( HANDLE_PRESSED == state )
{
// Convert from decorator's coords to text's coords.
- const float xPosition = event.p2.mFloat - mScrollPosition.x;
- const float yPosition = event.p3.mFloat - mScrollPosition.y;
+ const float xPosition = event.p2.mFloat - mModel->mScrollPosition.x;
+ const float yPosition = event.p3.mFloat - mModel->mScrollPosition.y;
// Need to calculate the handle's new position.
- const CharacterIndex handleNewPosition = Text::GetClosestCursorIndex( mVisualModel,
- mLogicalModel,
+ const CharacterIndex handleNewPosition = Text::GetClosestCursorIndex( mModel->mVisualModel,
+ mModel->mLogicalModel,
mMetrics,
xPosition,
yPosition );
if( handleStopScrolling || isSmoothHandlePanEnabled )
{
// Convert from decorator's coords to text's coords.
- const float xPosition = event.p2.mFloat - mScrollPosition.x;
- const float yPosition = event.p3.mFloat - mScrollPosition.y;
+ const float xPosition = event.p2.mFloat - mModel->mScrollPosition.x;
+ const float yPosition = event.p3.mFloat - mModel->mScrollPosition.y;
- handlePosition = Text::GetClosestCursorIndex( mVisualModel,
- mLogicalModel,
+ handlePosition = Text::GetClosestCursorIndex( mModel->mVisualModel,
+ mModel->mLogicalModel,
mMetrics,
xPosition,
yPosition );
{
const float xSpeed = event.p2.mFloat;
const float ySpeed = event.p3.mFloat;
- const Vector2& layoutSize = mVisualModel->GetLayoutSize();
- const Vector2 currentScrollPosition = mScrollPosition;
+ const Vector2& layoutSize = mModel->mVisualModel->GetLayoutSize();
+ const Vector2 currentScrollPosition = mModel->mScrollPosition;
- mScrollPosition.x += xSpeed;
- mScrollPosition.y += ySpeed;
+ mModel->mScrollPosition.x += xSpeed;
+ mModel->mScrollPosition.y += ySpeed;
ClampHorizontalScroll( layoutSize );
ClampVerticalScroll( layoutSize );
bool endOfScroll = false;
- if( Vector2::ZERO == ( currentScrollPosition - mScrollPosition ) )
+ if( Vector2::ZERO == ( currentScrollPosition - mModel->mScrollPosition ) )
{
// Notify the decorator there is no more text to scroll.
// The decorator won't send more scroll events.
if( mEventData->mDecorator->IsHorizontalScrollEnabled() )
{
// Position the grag handle close to either the left or right edge.
- position.x = scrollRightDirection ? 0.f : mVisualModel->mControlSize.width;
+ position.x = scrollRightDirection ? 0.f : mModel->mVisualModel->mControlSize.width;
}
if( mEventData->mDecorator->IsVerticalScrollEnabled() )
position.x = mEventData->mCursorHookPositionX;
// Position the grag handle close to either the top or bottom edge.
- position.y = scrollBottomDirection ? 0.f : mVisualModel->mControlSize.height;
+ position.y = scrollBottomDirection ? 0.f : mModel->mVisualModel->mControlSize.height;
}
// Get the new handle position.
// The grab handle's position is in decorator's coords. Need to transforms to text's coords.
- const CharacterIndex handlePosition = Text::GetClosestCursorIndex( mVisualModel,
- mLogicalModel,
+ const CharacterIndex handlePosition = Text::GetClosestCursorIndex( mModel->mVisualModel,
+ mModel->mLogicalModel,
mMetrics,
- position.x - mScrollPosition.x,
- position.y - mScrollPosition.y );
+ position.x - mModel->mScrollPosition.x,
+ position.y - mModel->mScrollPosition.y );
if( mEventData->mPrimaryCursorPosition != handlePosition )
{
if( mEventData->mDecorator->IsHorizontalScrollEnabled() )
{
// Position the selection handle close to either the left or right edge.
- position.x = scrollRightDirection ? 0.f : mVisualModel->mControlSize.width;
+ position.x = scrollRightDirection ? 0.f : mModel->mVisualModel->mControlSize.width;
}
if( mEventData->mDecorator->IsVerticalScrollEnabled() )
position.x = mEventData->mCursorHookPositionX;
// Position the grag handle close to either the top or bottom edge.
- position.y = scrollBottomDirection ? 0.f : mVisualModel->mControlSize.height;
+ position.y = scrollBottomDirection ? 0.f : mModel->mVisualModel->mControlSize.height;
}
// Get the new handle position.
// The selection handle's position is in decorator's coords. Need to transform to text's coords.
- const CharacterIndex handlePosition = Text::GetClosestCursorIndex( mVisualModel,
- mLogicalModel,
+ const CharacterIndex handlePosition = Text::GetClosestCursorIndex( mModel->mVisualModel,
+ mModel->mLogicalModel,
mMetrics,
- position.x - mScrollPosition.x,
- position.y - mScrollPosition.y );
+ position.x - mModel->mScrollPosition.x,
+ position.y - mModel->mScrollPosition.y );
if( leftSelectionHandleEvent )
{
if( mEventData->mSelectionEnabled )
{
// Convert from control's coords to text's coords.
- const float xPosition = event.p2.mFloat - mScrollPosition.x;
- const float yPosition = event.p3.mFloat - mScrollPosition.y;
+ const float xPosition = event.p2.mFloat - mModel->mScrollPosition.x;
+ const float yPosition = event.p3.mFloat - mModel->mScrollPosition.y;
// Calculates the logical position from the x,y coords.
RepositionSelectionHandles( xPosition,
ChangeState( EventData::SELECTING );
mEventData->mLeftSelectionPosition = 0u;
- mEventData->mRightSelectionPosition = mLogicalModel->mText.Count();
+ mEventData->mRightSelectionPosition = mModel->mLogicalModel->mText.Count();
mEventData->mScrollAfterUpdatePosition = true;
mEventData->mUpdateLeftSelectionPosition = true;
const CharacterIndex startOfSelectedText = handlesCrossed ? mEventData->mRightSelectionPosition : mEventData->mLeftSelectionPosition;
const Length lengthOfSelectedText = ( handlesCrossed ? mEventData->mLeftSelectionPosition : mEventData->mRightSelectionPosition ) - startOfSelectedText;
- Vector<Character>& utf32Characters = mLogicalModel->mText;
+ Vector<Character>& utf32Characters = mModel->mLogicalModel->mText;
const Length numberOfCharacters = utf32Characters.Count();
// Validate the start and end selection points
currentInputStyle.Copy( mEventData->mInputStyle );
// Set as input style the style of the first deleted character.
- mLogicalModel->RetrieveStyle( startOfSelectedText, mEventData->mInputStyle );
+ mModel->mLogicalModel->RetrieveStyle( startOfSelectedText, mEventData->mInputStyle );
// Compare if the input style has changed.
const bool hasInputStyleChanged = !currentInputStyle.Equal( mEventData->mInputStyle );
mEventData->mInputStyleChangedQueue.PushBack( styleChangedMask );
}
- mLogicalModel->UpdateTextStyleRuns( startOfSelectedText, -static_cast<int>( lengthOfSelectedText ) );
+ mModel->mLogicalModel->UpdateTextStyleRuns( startOfSelectedText, -static_cast<int>( lengthOfSelectedText ) );
// Mark the paragraphs to be updated.
mTextUpdateInfo.mCharacterIndex = startOfSelectedText;
mEventData->mDecorator->ClearHighlights();
- const GlyphIndex* const charactersToGlyphBuffer = mVisualModel->mCharactersToGlyph.Begin();
- const Length* const glyphsPerCharacterBuffer = mVisualModel->mGlyphsPerCharacter.Begin();
- const GlyphInfo* const glyphsBuffer = mVisualModel->mGlyphs.Begin();
- const Vector2* const positionsBuffer = mVisualModel->mGlyphPositions.Begin();
- const Length* const charactersPerGlyphBuffer = mVisualModel->mCharactersPerGlyph.Begin();
- const CharacterIndex* const glyphToCharacterBuffer = mVisualModel->mGlyphsToCharacters.Begin();
- const CharacterDirection* const modelCharacterDirectionsBuffer = ( 0u != mLogicalModel->mCharacterDirections.Count() ) ? mLogicalModel->mCharacterDirections.Begin() : NULL;
+ const GlyphIndex* const charactersToGlyphBuffer = mModel->mVisualModel->mCharactersToGlyph.Begin();
+ const Length* const glyphsPerCharacterBuffer = mModel->mVisualModel->mGlyphsPerCharacter.Begin();
+ const GlyphInfo* const glyphsBuffer = mModel->mVisualModel->mGlyphs.Begin();
+ const Vector2* const positionsBuffer = mModel->mVisualModel->mGlyphPositions.Begin();
+ const Length* const charactersPerGlyphBuffer = mModel->mVisualModel->mCharactersPerGlyph.Begin();
+ const CharacterIndex* const glyphToCharacterBuffer = mModel->mVisualModel->mGlyphsToCharacters.Begin();
+ const CharacterDirection* const modelCharacterDirectionsBuffer = ( 0u != mModel->mLogicalModel->mCharacterDirections.Count() ) ? mModel->mLogicalModel->mCharacterDirections.Begin() : NULL;
- const bool isLastCharacter = selectionEnd >= mLogicalModel->mText.Count();
+ const bool isLastCharacter = selectionEnd >= mModel->mLogicalModel->mText.Count();
const CharacterDirection startDirection = ( ( NULL == modelCharacterDirectionsBuffer ) ? false : *( modelCharacterDirectionsBuffer + selectionStart ) );
const CharacterDirection endDirection = ( ( NULL == modelCharacterDirectionsBuffer ) ? false : *( modelCharacterDirectionsBuffer + ( selectionEnd - ( isLastCharacter ? 1u : 0u ) ) ) );
const GlyphIndex glyphEnd = *( charactersToGlyphBuffer + selectionEndMinusOne ) + ( ( numberOfGlyphs > 0 ) ? numberOfGlyphs - 1u : 0u );
// Get the lines where the glyphs are laid-out.
- const LineRun* lineRun = mVisualModel->mLines.Begin();
+ const LineRun* lineRun = mModel->mVisualModel->mLines.Begin();
LineIndex lineIndex = 0u;
Length numberOfLines = 0u;
- mVisualModel->GetNumberOfLines( glyphStart,
- 1u + glyphEnd - glyphStart,
- lineIndex,
- numberOfLines );
+ mModel->mVisualModel->GetNumberOfLines( glyphStart,
+ 1u + glyphEnd - glyphStart,
+ lineIndex,
+ numberOfLines );
const LineIndex firstLineIndex = lineIndex;
// Create the structure to store some selection box info.
// Retrieve the first line and get the line's vertical offset, the line's height and the index to the last glyph.
// The line's vertical offset of all the lines before the line where the first glyph is laid-out.
- selectionBoxInfo->lineOffset = CalculateLineOffset( mVisualModel->mLines,
+ selectionBoxInfo->lineOffset = CalculateLineOffset( mModel->mVisualModel->mLines,
firstLineIndex );
// Transform to decorator's (control) coords.
- selectionBoxInfo->lineOffset += mScrollPosition.y;
+ selectionBoxInfo->lineOffset += mModel->mScrollPosition.y;
lineRun += firstLineIndex;
// Check if the first glyph is a ligature that must be broken like Latin ff, fi, or Arabic ﻻ, etc which needs special code.
const Length numberOfCharactersStart = *( charactersPerGlyphBuffer + glyphStart );
- bool splitStartGlyph = ( numberOfCharactersStart > 1u ) && HasLigatureMustBreak( mLogicalModel->GetScript( selectionStart ) );
+ bool splitStartGlyph = ( numberOfCharactersStart > 1u ) && HasLigatureMustBreak( mModel->mLogicalModel->GetScript( selectionStart ) );
// Check if the last glyph is a ligature that must be broken like Latin ff, fi, or Arabic ﻻ, etc which needs special code.
const Length numberOfCharactersEnd = *( charactersPerGlyphBuffer + glyphEnd );
- bool splitEndGlyph = ( glyphStart != glyphEnd ) && ( numberOfCharactersEnd > 1u ) && HasLigatureMustBreak( mLogicalModel->GetScript( selectionEndMinusOne ) );
+ bool splitEndGlyph = ( glyphStart != glyphEnd ) && ( numberOfCharactersEnd > 1u ) && HasLigatureMustBreak( mModel->mLogicalModel->GetScript( selectionEndMinusOne ) );
// The number of quads of the selection box.
const unsigned int numberOfQuads = 1u + ( glyphEnd - glyphStart ) + ( ( numberOfLines > 1u ) ? 2u * numberOfLines : 0u );
// Calculate the number of characters selected.
const Length numberOfCharacters = ( glyphStart == glyphEnd ) ? ( selectionEnd - selectionStart ) : ( numberOfCharactersStart - interGlyphIndex );
- quad.x = lineRun->alignmentOffset + position.x - glyph.xBearing + mScrollPosition.x + glyphAdvance * static_cast<float>( isCurrentRightToLeft ? ( numberOfCharactersStart - interGlyphIndex - numberOfCharacters ) : interGlyphIndex );
+ quad.x = lineRun->alignmentOffset + position.x - glyph.xBearing + mModel->mScrollPosition.x + glyphAdvance * static_cast<float>( isCurrentRightToLeft ? ( numberOfCharactersStart - interGlyphIndex - numberOfCharacters ) : interGlyphIndex );
quad.y = selectionBoxInfo->lineOffset;
quad.z = quad.x + static_cast<float>( numberOfCharacters ) * glyphAdvance;
quad.w = selectionBoxInfo->lineOffset + selectionBoxInfo->lineHeight;
const Length numberOfCharacters = numberOfCharactersEnd - interGlyphIndex;
- quad.x = lineRun->alignmentOffset + position.x - glyph.xBearing + mScrollPosition.x + ( isCurrentRightToLeft ? ( glyphAdvance * static_cast<float>( numberOfCharacters ) ) : 0.f );
+ quad.x = lineRun->alignmentOffset + position.x - glyph.xBearing + mModel->mScrollPosition.x + ( isCurrentRightToLeft ? ( glyphAdvance * static_cast<float>( numberOfCharacters ) ) : 0.f );
quad.y = selectionBoxInfo->lineOffset;
quad.z = quad.x + static_cast<float>( interGlyphIndex ) * glyphAdvance;
quad.w = quad.y + selectionBoxInfo->lineHeight;
continue;
}
- quad.x = lineRun->alignmentOffset + position.x - glyph.xBearing + mScrollPosition.x;
+ quad.x = lineRun->alignmentOffset + position.x - glyph.xBearing + mModel->mScrollPosition.x;
quad.y = selectionBoxInfo->lineOffset;
quad.z = quad.x + glyph.advance;
quad.w = quad.y + selectionBoxInfo->lineHeight;
if( 1u < numberOfLines )
{
// Boxify the first line.
- lineRun = mVisualModel->mLines.Begin() + firstLineIndex;
+ lineRun = mModel->mVisualModel->mLines.Begin() + firstLineIndex;
const SelectionBoxInfo& firstSelectionBoxLineInfo = *( selectionBoxLinesInfo.Begin() );
bool boxifyBegin = ( LTR != lineRun->direction ) && ( LTR != startDirection );
{
quad.x = firstSelectionBoxLineInfo.maxX;
quad.y = firstSelectionBoxLineInfo.lineOffset;
- quad.z = mVisualModel->mControlSize.width;
+ quad.z = mModel->mVisualModel->mControlSize.width;
quad.w = firstSelectionBoxLineInfo.lineOffset + firstSelectionBoxLineInfo.lineHeight;
// Boxify at the end of the line.
++actualNumberOfQuads;
// Update the size of the highlighted text.
- maxHighlightX = mVisualModel->mControlSize.width;
+ maxHighlightX = mModel->mVisualModel->mControlSize.width;
}
// Boxify the central lines.
quad.x = info.maxX;
quad.y = info.lineOffset;
- quad.z = mVisualModel->mControlSize.width;
+ quad.z = mModel->mVisualModel->mControlSize.width;
quad.w = info.lineOffset + info.lineHeight;
mEventData->mDecorator->AddHighlight( actualNumberOfQuads,
// Update the size of the highlighted text.
minHighlightX = 0.f;
- maxHighlightX = mVisualModel->mControlSize.width;
+ maxHighlightX = mModel->mVisualModel->mControlSize.width;
}
// Boxify the last line.
- lineRun = mVisualModel->mLines.Begin() + firstLineIndex + numberOfLines - 1u;
+ lineRun = mModel->mVisualModel->mLines.Begin() + firstLineIndex + numberOfLines - 1u;
const SelectionBoxInfo& lastSelectionBoxLineInfo = *( selectionBoxLinesInfo.End() - 1u );
boxifyBegin = ( LTR == lineRun->direction ) && ( LTR == endDirection );
{
quad.x = lastSelectionBoxLineInfo.maxX;
quad.y = lastSelectionBoxLineInfo.lineOffset;
- quad.z = mVisualModel->mControlSize.width;
+ quad.z = mModel->mVisualModel->mControlSize.width;
quad.w = lastSelectionBoxLineInfo.lineOffset + lastSelectionBoxLineInfo.lineHeight;
// Boxify at the end of the line.
++actualNumberOfQuads;
// Update the size of the highlighted text.
- maxHighlightX = mVisualModel->mControlSize.width;
+ maxHighlightX = mModel->mVisualModel->mControlSize.width;
}
}
GetCursorPosition( mEventData->mLeftSelectionPosition,
primaryCursorInfo );
- const Vector2 primaryPosition = primaryCursorInfo.primaryPosition + mScrollPosition;
+ const Vector2 primaryPosition = primaryCursorInfo.primaryPosition + mModel->mScrollPosition;
mEventData->mDecorator->SetPosition( LEFT_SELECTION_HANDLE,
primaryPosition.x,
- primaryCursorInfo.lineOffset + mScrollPosition.y,
+ primaryCursorInfo.lineOffset + mModel->mScrollPosition.y,
primaryCursorInfo.lineHeight );
CursorInfo secondaryCursorInfo;
GetCursorPosition( mEventData->mRightSelectionPosition,
secondaryCursorInfo );
- const Vector2 secondaryPosition = secondaryCursorInfo.primaryPosition + mScrollPosition;
+ const Vector2 secondaryPosition = secondaryCursorInfo.primaryPosition + mModel->mScrollPosition;
mEventData->mDecorator->SetPosition( RIGHT_SELECTION_HANDLE,
secondaryPosition.x,
- secondaryCursorInfo.lineOffset + mScrollPosition.y,
+ secondaryCursorInfo.lineOffset + mModel->mScrollPosition.y,
secondaryCursorInfo.lineHeight );
}
return;
}
- const Length numberOfGlyphs = mVisualModel->mGlyphs.Count();
- const Length numberOfLines = mVisualModel->mLines.Count();
+ const Length numberOfGlyphs = mModel->mVisualModel->mGlyphs.Count();
+ const Length numberOfLines = mModel->mVisualModel->mLines.Count();
if( ( 0 == numberOfGlyphs ) ||
( 0 == numberOfLines ) )
{
// Find which word was selected
CharacterIndex selectionStart( 0 );
CharacterIndex selectionEnd( 0 );
- const bool indicesFound = FindSelectionIndices( mVisualModel,
- mLogicalModel,
+ const bool indicesFound = FindSelectionIndices( mModel->mVisualModel,
+ mModel->mLogicalModel,
mMetrics,
visualX,
visualY,
}
else if( EventData::EDITING_WITH_POPUP == mEventData->mState )
{
- if( mLogicalModel->mText.Count() && !IsShowingPlaceholderText() )
+ if( mModel->mLogicalModel->mText.Count() && !IsShowingPlaceholderText() )
{
buttonsToShow = TextSelectionPopup::Buttons( TextSelectionPopup::SELECT | TextSelectionPopup::SELECT_ALL );
}
cursorInfo.lineHeight = GetDefaultFontLineHeight();
cursorInfo.primaryCursorHeight = cursorInfo.lineHeight;
- switch( mLayoutEngine.GetHorizontalAlignment() )
+ switch( mModel->mHorizontalAlignment )
{
- case LayoutEngine::HORIZONTAL_ALIGN_BEGIN:
+ case Layout::HORIZONTAL_ALIGN_BEGIN:
{
cursorInfo.primaryPosition.x = 0.f;
break;
}
- case LayoutEngine::HORIZONTAL_ALIGN_CENTER:
+ case Layout::HORIZONTAL_ALIGN_CENTER:
{
- cursorInfo.primaryPosition.x = floorf( 0.5f * mVisualModel->mControlSize.width );
+ cursorInfo.primaryPosition.x = floorf( 0.5f * mModel->mVisualModel->mControlSize.width );
break;
}
- case LayoutEngine::HORIZONTAL_ALIGN_END:
+ case Layout::HORIZONTAL_ALIGN_END:
{
- cursorInfo.primaryPosition.x = mVisualModel->mControlSize.width - mEventData->mDecorator->GetCursorWidth();
+ cursorInfo.primaryPosition.x = mModel->mVisualModel->mControlSize.width - mEventData->mDecorator->GetCursorWidth();
break;
}
}
return;
}
- Text::GetCursorPosition( mVisualModel,
- mLogicalModel,
+ Text::GetCursorPosition( mModel->mVisualModel,
+ mModel->mLogicalModel,
mMetrics,
logical,
cursorInfo );
- if( LayoutEngine::MULTI_LINE_BOX == mLayoutEngine.GetLayout() )
+ if( Layout::Engine::MULTI_LINE_BOX == mLayoutEngine.GetLayout() )
{
// If the text is editable and multi-line, the cursor position after a white space shouldn't exceed the boundaries of the text control.
cursorInfo.primaryPosition.x = 0.f;
}
- const float edgeWidth = mVisualModel->mControlSize.width - static_cast<float>( mEventData->mDecorator->GetCursorWidth() );
+ const float edgeWidth = mModel->mVisualModel->mControlSize.width - static_cast<float>( mEventData->mDecorator->GetCursorWidth() );
if( cursorInfo.primaryPosition.x > edgeWidth )
{
cursorInfo.primaryPosition.x = edgeWidth;
CharacterIndex cursorIndex = mEventData->mPrimaryCursorPosition;
- const GlyphIndex* const charactersToGlyphBuffer = mVisualModel->mCharactersToGlyph.Begin();
- const Length* const charactersPerGlyphBuffer = mVisualModel->mCharactersPerGlyph.Begin();
+ const GlyphIndex* const charactersToGlyphBuffer = mModel->mVisualModel->mCharactersToGlyph.Begin();
+ const Length* const charactersPerGlyphBuffer = mModel->mVisualModel->mCharactersPerGlyph.Begin();
GlyphIndex glyphIndex = *( charactersToGlyphBuffer + index );
Length numberOfCharacters = *( charactersPerGlyphBuffer + glyphIndex );
if( numberOfCharacters > 1u )
{
- const Script script = mLogicalModel->GetScript( index );
+ const Script script = mModel->mLogicalModel->GetScript( index );
if( HasLigatureMustBreak( script ) )
{
// Prevents to jump the whole Latin ligatures like fi, ff, or Arabic ﻻ, ...
return;
}
- const Vector2 cursorPosition = cursorInfo.primaryPosition + mScrollPosition;
+ const Vector2 cursorPosition = cursorInfo.primaryPosition + mModel->mScrollPosition;
// Sets the cursor position.
mEventData->mDecorator->SetPosition( PRIMARY_CURSOR,
// Sets the grab handle position.
mEventData->mDecorator->SetPosition( GRAB_HANDLE,
cursorPosition.x,
- cursorInfo.lineOffset + mScrollPosition.y,
+ cursorInfo.lineOffset + mModel->mScrollPosition.y,
cursorInfo.lineHeight );
}
if( cursorInfo.isSecondaryCursor )
{
mEventData->mDecorator->SetPosition( SECONDARY_CURSOR,
- cursorInfo.secondaryPosition.x + mScrollPosition.x,
- cursorInfo.secondaryPosition.y + mScrollPosition.y,
+ cursorInfo.secondaryPosition.x + mModel->mScrollPosition.x,
+ cursorInfo.secondaryPosition.y + mModel->mScrollPosition.y,
cursorInfo.secondaryCursorHeight,
cursorInfo.lineHeight );
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Secondary cursor position: %f,%f\n", cursorInfo.secondaryPosition.x + mScrollPosition.x, cursorInfo.secondaryPosition.y + mScrollPosition.y );
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Secondary cursor position: %f,%f\n", cursorInfo.secondaryPosition.x + mModel->mScrollPosition.x, cursorInfo.secondaryPosition.y + mModel->mScrollPosition.y );
}
// Set which cursors are active according the state.
return;
}
- const Vector2 cursorPosition = cursorInfo.primaryPosition + mScrollPosition;
+ const Vector2 cursorPosition = cursorInfo.primaryPosition + mModel->mScrollPosition;
// Sets the handle's position.
mEventData->mDecorator->SetPosition( handleType,
cursorPosition.x,
- cursorInfo.lineOffset + mScrollPosition.y,
+ cursorInfo.lineOffset + mModel->mScrollPosition.y,
cursorInfo.lineHeight );
// If selection handle at start of the text and other at end of the text then all text is selected.
const CharacterIndex startOfSelection = std::min( mEventData->mLeftSelectionPosition, mEventData->mRightSelectionPosition );
const CharacterIndex endOfSelection = std::max ( mEventData->mLeftSelectionPosition, mEventData->mRightSelectionPosition );
- mEventData->mAllTextSelected = ( startOfSelection == 0 ) && ( endOfSelection == mLogicalModel->mText.Count() );
+ mEventData->mAllTextSelected = ( startOfSelection == 0 ) && ( endOfSelection == mModel->mLogicalModel->mText.Count() );
}
void Controller::Impl::ClampHorizontalScroll( const Vector2& layoutSize )
{
// Clamp between -space & 0.
- if( layoutSize.width > mVisualModel->mControlSize.width )
+ if( layoutSize.width > mModel->mVisualModel->mControlSize.width )
{
- const float space = ( layoutSize.width - mVisualModel->mControlSize.width );
- mScrollPosition.x = ( mScrollPosition.x < -space ) ? -space : mScrollPosition.x;
- mScrollPosition.x = ( mScrollPosition.x > 0.f ) ? 0.f : mScrollPosition.x;
+ const float space = ( layoutSize.width - mModel->mVisualModel->mControlSize.width );
+ mModel->mScrollPosition.x = ( mModel->mScrollPosition.x < -space ) ? -space : mModel->mScrollPosition.x;
+ mModel->mScrollPosition.x = ( mModel->mScrollPosition.x > 0.f ) ? 0.f : mModel->mScrollPosition.x;
mEventData->mDecoratorUpdated = true;
}
else
{
- mScrollPosition.x = 0.f;
+ mModel->mScrollPosition.x = 0.f;
}
}
void Controller::Impl::ClampVerticalScroll( const Vector2& layoutSize )
{
- if( LayoutEngine::SINGLE_LINE_BOX == mLayoutEngine.GetLayout() )
+ if( Layout::Engine::SINGLE_LINE_BOX == mLayoutEngine.GetLayout() )
{
// Nothing to do if the text is single line.
return;
}
// Clamp between -space & 0.
- if( layoutSize.height > mVisualModel->mControlSize.height )
+ if( layoutSize.height > mModel->mVisualModel->mControlSize.height )
{
- const float space = ( layoutSize.height - mVisualModel->mControlSize.height );
- mScrollPosition.y = ( mScrollPosition.y < -space ) ? -space : mScrollPosition.y;
- mScrollPosition.y = ( mScrollPosition.y > 0.f ) ? 0.f : mScrollPosition.y;
+ const float space = ( layoutSize.height - mModel->mVisualModel->mControlSize.height );
+ mModel->mScrollPosition.y = ( mModel->mScrollPosition.y < -space ) ? -space : mModel->mScrollPosition.y;
+ mModel->mScrollPosition.y = ( mModel->mScrollPosition.y > 0.f ) ? 0.f : mModel->mScrollPosition.y;
mEventData->mDecoratorUpdated = true;
}
else
{
- mScrollPosition.y = 0.f;
+ mModel->mScrollPosition.y = 0.f;
}
}
const float positionEndY = position.y + lineHeight;
// Transform the position to decorator coords.
- const float decoratorPositionBeginX = position.x + mScrollPosition.x;
- const float decoratorPositionEndX = positionEndX + mScrollPosition.x;
+ const float decoratorPositionBeginX = position.x + mModel->mScrollPosition.x;
+ const float decoratorPositionEndX = positionEndX + mModel->mScrollPosition.x;
- const float decoratorPositionBeginY = position.y + mScrollPosition.y;
- const float decoratorPositionEndY = positionEndY + mScrollPosition.y;
+ const float decoratorPositionBeginY = position.y + mModel->mScrollPosition.y;
+ const float decoratorPositionEndY = positionEndY + mModel->mScrollPosition.y;
if( decoratorPositionBeginX < 0.f )
{
- mScrollPosition.x = -position.x;
+ mModel->mScrollPosition.x = -position.x;
}
- else if( decoratorPositionEndX > mVisualModel->mControlSize.width )
+ else if( decoratorPositionEndX > mModel->mVisualModel->mControlSize.width )
{
- mScrollPosition.x = mVisualModel->mControlSize.width - positionEndX;
+ mModel->mScrollPosition.x = mModel->mVisualModel->mControlSize.width - positionEndX;
}
if( decoratorPositionBeginY < 0.f )
{
- mScrollPosition.y = -position.y;
+ mModel->mScrollPosition.y = -position.y;
}
- else if( decoratorPositionEndY > mVisualModel->mControlSize.height )
+ else if( decoratorPositionEndY > mModel->mVisualModel->mControlSize.height )
{
- mScrollPosition.y = mVisualModel->mControlSize.height - positionEndY;
+ mModel->mScrollPosition.y = mModel->mVisualModel->mControlSize.height - positionEndY;
}
}
const Vector2& currentCursorPosition = mEventData->mDecorator->GetPosition( PRIMARY_CURSOR );
// Calculate the offset to match the cursor position before the character was deleted.
- mScrollPosition.x = currentCursorPosition.x - cursorInfo.primaryPosition.x;
- mScrollPosition.y = currentCursorPosition.y - cursorInfo.lineOffset;
+ mModel->mScrollPosition.x = currentCursorPosition.x - cursorInfo.primaryPosition.x;
+ mModel->mScrollPosition.y = currentCursorPosition.y - cursorInfo.lineOffset;
- ClampHorizontalScroll( mVisualModel->GetLayoutSize() );
- ClampVerticalScroll( mVisualModel->GetLayoutSize() );
+ ClampHorizontalScroll( mModel->mVisualModel->GetLayoutSize() );
+ ClampVerticalScroll( mModel->mVisualModel->GetLayoutSize() );
// Makes the new cursor position visible if needed.
ScrollToMakePositionVisible( cursorInfo.primaryPosition, cursorInfo.lineHeight );
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/input-style.h>
-#include <dali-toolkit/internal/text/layouts/layout-engine.h>
-#include <dali-toolkit/internal/text/logical-model-impl.h>
#include <dali-toolkit/internal/text/text-controller.h>
+#include <dali-toolkit/internal/text/text-model.h>
#include <dali-toolkit/internal/text/text-view.h>
-#include <dali-toolkit/internal/text/visual-model-impl.h>
namespace Dali
{
EditableControlInterface* editableControlInterface )
: mControlInterface( controlInterface ),
mEditableControlInterface( editableControlInterface ),
- mLogicalModel(),
- mVisualModel(),
+ mModel(),
mFontDefaults( NULL ),
mUnderlineDefaults( NULL ),
mShadowDefaults( NULL ),
mClipboard(),
mView(),
mMetrics(),
- mLayoutEngine(),
mModifyEvents(),
mTextColor( Color::BLACK ),
- mScrollPosition(),
mTextUpdateInfo(),
mOperationsPending( NO_OPERATION ),
mMaximumNumberOfCharacters( 50u ),
mIsAutoScrollEnabled( false ),
mAutoScrollDirectionRTL( false )
{
- mLogicalModel = LogicalModel::New();
- mVisualModel = VisualModel::New();
+ mModel = Model::New();
mFontClient = TextAbstraction::FontClient::Get();
mClipboard = Clipboard::Get();
- mView.SetVisualModel( mVisualModel );
+ mView.SetVisualModel( mModel->mVisualModel );
// Use this to access FontClient i.e. to get down-scaled Emoji metrics.
mMetrics = Metrics::New( mFontClient );
mLayoutEngine.SetMetrics( mMetrics );
// Set the text properties to default
- mVisualModel->SetUnderlineEnabled( false );
- mVisualModel->SetUnderlineHeight( 0.0f );
+ mModel->mVisualModel->SetUnderlineEnabled( false );
+ mModel->mVisualModel->SetUnderlineHeight( 0.0f );
}
~Impl()
bool IsShowingRealText() const
{
return ( !IsShowingPlaceholderText() &&
- 0u != mLogicalModel->mText.Count() );
+ 0u != mModel->mLogicalModel->mText.Count() );
}
/**
mEventData->mIsShowingPlaceholderText = false;
// Remove mPlaceholderTextColor
- mVisualModel->SetTextColor( mTextColor );
+ mModel->mVisualModel->SetTextColor( mTextColor );
}
}
ControlInterface* mControlInterface; ///< Reference to the text controller.
EditableControlInterface* mEditableControlInterface; ///< Reference to the editable text controller.
- LogicalModelPtr mLogicalModel; ///< Pointer to the logical model.
- VisualModelPtr mVisualModel; ///< Pointer to the visual model.
+ ModelPtr mModel; ///< Pointer to the text's model.
FontDefaults* mFontDefaults; ///< Avoid allocating this when the user does not specify a font.
UnderlineDefaults* mUnderlineDefaults; ///< Avoid allocating this when the user does not specify underline parameters.
ShadowDefaults* mShadowDefaults; ///< Avoid allocating this when the user does not specify shadow parameters.
Clipboard mClipboard; ///< Handle to the system clipboard
View mView; ///< The view interface to the rendering back-end.
MetricsPtr mMetrics; ///< A wrapper around FontClient used to get metrics & potentially down-scaled Emoji metrics.
- LayoutEngine mLayoutEngine; ///< The layout engine.
+ Layout::Engine mLayoutEngine; ///< The layout engine.
Vector<ModifyEvent> mModifyEvents; ///< Temporary stores the text set until the next relayout.
Vector4 mTextColor; ///< The regular text color
- /**
- * 0,0 means that the top-left corner of the layout matches the top-left corner of the UI control.
- * Typically this will have a negative value with scrolling occurs.
- */
- Vector2 mScrollPosition; ///< The text is offset by this position when scrolling.
TextUpdateInfo mTextUpdateInfo; ///< Info of the characters updated.
OperationsMask mOperationsPending; ///< Operations pending to be done to layout the text.
Length mMaximumNumberOfCharacters; ///< Maximum number of characters that can be inserted.
void Controller::EnableTextInput( DecoratorPtr decorator )
{
+ if( !decorator )
+ {
+ delete mImpl->mEventData;
+ mImpl->mEventData = NULL;
+
+ // Nothing else to do.
+ return;
+ }
+
if( NULL == mImpl->mEventData )
{
mImpl->mEventData = new EventData( decorator );
void Controller::SetAutoScrollEnabled( bool enable )
{
- DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::SetAutoScrollEnabled[%s] SingleBox[%s]-> [%p]\n", (enable)?"true":"false", ( mImpl->mLayoutEngine.GetLayout() == LayoutEngine::SINGLE_LINE_BOX)?"true":"false", this );
+ DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::SetAutoScrollEnabled[%s] SingleBox[%s]-> [%p]\n", (enable)?"true":"false", ( mImpl->mLayoutEngine.GetLayout() == Layout::Engine::SINGLE_LINE_BOX)?"true":"false", this );
- if( mImpl->mLayoutEngine.GetLayout() == LayoutEngine::SINGLE_LINE_BOX )
+ if( mImpl->mLayoutEngine.GetLayout() == Layout::Engine::SINGLE_LINE_BOX )
{
if( enable )
{
{
float offset = 0.f;
- if( mImpl->mVisualModel &&
- ( 0u != mImpl->mVisualModel->mLines.Count() ) )
+ if( mImpl->mModel->mVisualModel &&
+ ( 0u != mImpl->mModel->mVisualModel->mLines.Count() ) )
{
- offset = ( *mImpl->mVisualModel->mLines.Begin() ).alignmentOffset;
+ offset = ( *mImpl->mModel->mVisualModel->mLines.Begin() ).alignmentOffset;
}
return offset;
mImpl->mEventData->mDecorator->SetHorizontalScrollEnabled( enable );
}
}
-
bool Controller::IsHorizontalScrollEnabled() const
{
if( ( NULL != mImpl->mEventData ) &&
void Controller::SetMultiLineEnabled( bool enable )
{
- const LayoutEngine::Layout layout = enable ? LayoutEngine::MULTI_LINE_BOX : LayoutEngine::SINGLE_LINE_BOX;
+ const Layout::Engine::Type layout = enable ? Layout::Engine::MULTI_LINE_BOX : Layout::Engine::SINGLE_LINE_BOX;
if( layout != mImpl->mLayoutEngine.GetLayout() )
{
bool Controller::IsMultiLineEnabled() const
{
- return LayoutEngine::MULTI_LINE_BOX == mImpl->mLayoutEngine.GetLayout();
+ return Layout::Engine::MULTI_LINE_BOX == mImpl->mLayoutEngine.GetLayout();
}
-void Controller::SetHorizontalAlignment( LayoutEngine::HorizontalAlignment alignment )
+void Controller::SetHorizontalAlignment( Layout::HorizontalAlignment alignment )
{
- if( alignment != mImpl->mLayoutEngine.GetHorizontalAlignment() )
+ if( alignment != mImpl->mModel->mHorizontalAlignment )
{
// Set the alignment.
- mImpl->mLayoutEngine.SetHorizontalAlignment( alignment );
+ mImpl->mModel->mHorizontalAlignment = alignment;
// Set the flag to redo the alignment operation.
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | ALIGN );
}
}
-LayoutEngine::HorizontalAlignment Controller::GetHorizontalAlignment() const
+Layout::HorizontalAlignment Controller::GetHorizontalAlignment() const
{
- return mImpl->mLayoutEngine.GetHorizontalAlignment();
+ return mImpl->mModel->mHorizontalAlignment;
}
-void Controller::SetVerticalAlignment( LayoutEngine::VerticalAlignment alignment )
+void Controller::SetVerticalAlignment( Layout::VerticalAlignment alignment )
{
- if( alignment != mImpl->mLayoutEngine.GetVerticalAlignment() )
+ if( alignment != mImpl->mModel->mVerticalAlignment )
{
// Set the alignment.
- mImpl->mLayoutEngine.SetVerticalAlignment( alignment );
+ mImpl->mModel->mVerticalAlignment = alignment;
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | ALIGN );
}
}
-LayoutEngine::VerticalAlignment Controller::GetVerticalAlignment() const
+Layout::VerticalAlignment Controller::GetVerticalAlignment() const
+{
+ return mImpl->mModel->mVerticalAlignment;
+}
+
+void Controller::SetTextElideEnabled( bool enabled )
{
- return mImpl->mLayoutEngine.GetVerticalAlignment();
+ mImpl->mModel->mElideEnabled = enabled;
+}
+
+bool Controller::IsTextElideEnabled() const
+{
+ return mImpl->mModel->mElideEnabled;
}
// public : Update
if( !text.empty() )
{
- mImpl->mVisualModel->SetTextColor( mImpl->mTextColor );
+ mImpl->mModel->mVisualModel->SetTextColor( mImpl->mTextColor );
- MarkupProcessData markupProcessData( mImpl->mLogicalModel->mColorRuns,
- mImpl->mLogicalModel->mFontDescriptionRuns );
+ MarkupProcessData markupProcessData( mImpl->mModel->mLogicalModel->mColorRuns,
+ mImpl->mModel->mLogicalModel->mFontDescriptionRuns );
Length textSize = 0u;
const uint8_t* utf8 = NULL;
}
// Convert text into UTF-32
- Vector<Character>& utf32Characters = mImpl->mLogicalModel->mText;
+ Vector<Character>& utf32Characters = mImpl->mModel->mLogicalModel->mText;
utf32Characters.Resize( textSize );
// Transform a text array encoded in utf8 into an array encoded in utf32.
utf32Characters.Resize( characterCount );
DALI_ASSERT_DEBUG( textSize >= characterCount && "Invalid UTF32 conversion length" );
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::SetText %p UTF8 size %d, UTF32 size %d\n", this, textSize, mImpl->mLogicalModel->mText.Count() );
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::SetText %p UTF8 size %d, UTF32 size %d\n", this, textSize, mImpl->mModel->mLogicalModel->mText.Count() );
// The characters to be added.
- mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mLogicalModel->mText.Count();
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mModel->mLogicalModel->mText.Count();
// To reset the cursor position
lastCursorIndex = characterCount;
// Update placeholder if there is no text
if( mImpl->IsShowingPlaceholderText() ||
- ( 0u == mImpl->mLogicalModel->mText.Count() ) )
+ ( 0u == mImpl->mModel->mLogicalModel->mText.Count() ) )
{
ShowPlaceholderText();
}
return 0.0f;
}
-void Controller::SetTextColor( const Vector4& textColor )
+void Controller::SetDefaultColor( const Vector4& color )
{
- mImpl->mTextColor = textColor;
+ mImpl->mTextColor = color;
if( !mImpl->IsShowingPlaceholderText() )
{
- mImpl->mVisualModel->SetTextColor( textColor );
+ mImpl->mModel->mVisualModel->SetTextColor( color );
mImpl->RequestRelayout();
}
}
-const Vector4& Controller::GetTextColor() const
+const Vector4& Controller::GetDefaultColor() const
{
return mImpl->mTextColor;
}
if( mImpl->IsShowingPlaceholderText() )
{
- mImpl->mVisualModel->SetTextColor( textColor );
+ mImpl->mModel->mVisualModel->SetTextColor( textColor );
mImpl->RequestRelayout();
}
}
void Controller::SetShadowOffset( const Vector2& shadowOffset )
{
- mImpl->mVisualModel->SetShadowOffset( shadowOffset );
+ mImpl->mModel->mVisualModel->SetShadowOffset( shadowOffset );
mImpl->RequestRelayout();
}
const Vector2& Controller::GetShadowOffset() const
{
- return mImpl->mVisualModel->GetShadowOffset();
+ return mImpl->mModel->mVisualModel->GetShadowOffset();
}
void Controller::SetShadowColor( const Vector4& shadowColor )
{
- mImpl->mVisualModel->SetShadowColor( shadowColor );
+ mImpl->mModel->mVisualModel->SetShadowColor( shadowColor );
mImpl->RequestRelayout();
}
const Vector4& Controller::GetShadowColor() const
{
- return mImpl->mVisualModel->GetShadowColor();
+ return mImpl->mModel->mVisualModel->GetShadowColor();
}
void Controller::SetUnderlineColor( const Vector4& color )
{
- mImpl->mVisualModel->SetUnderlineColor( color );
+ mImpl->mModel->mVisualModel->SetUnderlineColor( color );
mImpl->RequestRelayout();
}
const Vector4& Controller::GetUnderlineColor() const
{
- return mImpl->mVisualModel->GetUnderlineColor();
+ return mImpl->mModel->mVisualModel->GetUnderlineColor();
}
void Controller::SetUnderlineEnabled( bool enabled )
{
- mImpl->mVisualModel->SetUnderlineEnabled( enabled );
+ mImpl->mModel->mVisualModel->SetUnderlineEnabled( enabled );
mImpl->RequestRelayout();
}
bool Controller::IsUnderlineEnabled() const
{
- return mImpl->mVisualModel->IsUnderlineEnabled();
+ return mImpl->mModel->mVisualModel->IsUnderlineEnabled();
}
void Controller::SetUnderlineHeight( float height )
{
- mImpl->mVisualModel->SetUnderlineHeight( height );
+ mImpl->mModel->mVisualModel->SetUnderlineHeight( height );
mImpl->RequestRelayout();
}
float Controller::GetUnderlineHeight() const
{
- return mImpl->mVisualModel->GetUnderlineHeight();
+ return mImpl->mModel->mVisualModel->GetUnderlineHeight();
}
void Controller::SetDefaultEmbossProperties( const std::string& embossProperties )
const Length lengthOfSelectedText = ( handlesCrossed ? mImpl->mEventData->mLeftSelectionPosition : mImpl->mEventData->mRightSelectionPosition ) - startOfSelectedText;
// Add the color run.
- const VectorBase::SizeType numberOfRuns = mImpl->mLogicalModel->mColorRuns.Count();
- mImpl->mLogicalModel->mColorRuns.Resize( numberOfRuns + 1u );
+ const VectorBase::SizeType numberOfRuns = mImpl->mModel->mLogicalModel->mColorRuns.Count();
+ mImpl->mModel->mLogicalModel->mColorRuns.Resize( numberOfRuns + 1u );
- ColorRun& colorRun = *( mImpl->mLogicalModel->mColorRuns.Begin() + numberOfRuns );
+ ColorRun& colorRun = *( mImpl->mModel->mLogicalModel->mColorRuns.Begin() + numberOfRuns );
colorRun.color = color;
colorRun.characterRun.characterIndex = startOfSelectedText;
colorRun.characterRun.numberOfCharacters = lengthOfSelectedText;
CharacterIndex startOfSelectedText = 0u;
Length lengthOfSelectedText = 0u;
FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData,
- mImpl->mLogicalModel,
+ mImpl->mModel->mLogicalModel,
startOfSelectedText,
lengthOfSelectedText );
CharacterIndex startOfSelectedText = 0u;
Length lengthOfSelectedText = 0u;
FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData,
- mImpl->mLogicalModel,
+ mImpl->mModel->mLogicalModel,
startOfSelectedText,
lengthOfSelectedText );
CharacterIndex startOfSelectedText = 0u;
Length lengthOfSelectedText = 0u;
FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData,
- mImpl->mLogicalModel,
+ mImpl->mModel->mLogicalModel,
startOfSelectedText,
lengthOfSelectedText );
CharacterIndex startOfSelectedText = 0u;
Length lengthOfSelectedText = 0u;
FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData,
- mImpl->mLogicalModel,
+ mImpl->mModel->mLogicalModel,
startOfSelectedText,
lengthOfSelectedText );
CharacterIndex startOfSelectedText = 0u;
Length lengthOfSelectedText = 0u;
FontDescriptionRun& fontDescriptionRun = UpdateSelectionFontStyleRun( mImpl->mEventData,
- mImpl->mLogicalModel,
+ mImpl->mModel->mLogicalModel,
startOfSelectedText,
lengthOfSelectedText );
// public : Queries & retrieves.
-LayoutEngine& Controller::GetLayoutEngine()
+Layout::Engine& Controller::GetLayoutEngine()
{
return mImpl->mLayoutEngine;
}
return mImpl->mView;
}
-const Vector2& Controller::GetScrollPosition() const
-{
- return mImpl->mScrollPosition;
-}
-
Vector3 Controller::GetNaturalSize()
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->Controller::GetNaturalSize\n" );
// Set the update info to relayout the whole text.
mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u;
- mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mLogicalModel->mText.Count();
+ mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mModel->mLogicalModel->mText.Count();
// Store the actual control's size to restore later.
- const Size actualControlSize = mImpl->mVisualModel->mControlSize;
+ const Size actualControlSize = mImpl->mModel->mVisualModel->mControlSize;
DoRelayout( Size( MAX_FLOAT, MAX_FLOAT ),
static_cast<OperationsMask>( onlyOnceOperations |
// Stores the natural size to avoid recalculate it again
// unless the text/style changes.
- mImpl->mVisualModel->SetNaturalSize( naturalSize.GetVectorXY() );
+ mImpl->mModel->mVisualModel->SetNaturalSize( naturalSize.GetVectorXY() );
mImpl->mRecalculateNaturalSize = false;
mImpl->mTextUpdateInfo.Clear();
// Restore the actual control's size.
- mImpl->mVisualModel->mControlSize = actualControlSize;
+ mImpl->mModel->mVisualModel->mControlSize = actualControlSize;
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetNaturalSize calculated %f,%f,%f\n", naturalSize.x, naturalSize.y, naturalSize.z );
}
else
{
- naturalSize = mImpl->mVisualModel->GetNaturalSize();
+ naturalSize = mImpl->mModel->mVisualModel->GetNaturalSize();
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetNaturalSize cached %f,%f,%f\n", naturalSize.x, naturalSize.y, naturalSize.z );
}
ProcessModifyEvents();
Size layoutSize;
- if( fabsf( width - mImpl->mVisualModel->mControlSize.width ) > Math::MACHINE_EPSILON_1000 )
+ if( fabsf( width - mImpl->mModel->mVisualModel->mControlSize.width ) > Math::MACHINE_EPSILON_1000 )
{
// Operations that can be done only once until the text changes.
const OperationsMask onlyOnceOperations = static_cast<OperationsMask>( CONVERT_TO_UTF32 |
// Set the update info to relayout the whole text.
mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u;
- mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mLogicalModel->mText.Count();
+ mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mModel->mLogicalModel->mText.Count();
// Store the actual control's width.
- const float actualControlWidth = mImpl->mVisualModel->mControlSize.width;
+ const float actualControlWidth = mImpl->mModel->mVisualModel->mControlSize.width;
DoRelayout( Size( width, MAX_FLOAT ),
static_cast<OperationsMask>( onlyOnceOperations |
mImpl->mTextUpdateInfo.Clear();
// Restore the actual control's width.
- mImpl->mVisualModel->mControlSize.width = actualControlWidth;
+ mImpl->mModel->mVisualModel->mControlSize.width = actualControlWidth;
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetHeightForWidth calculated %f\n", layoutSize.height );
}
else
{
- layoutSize = mImpl->mVisualModel->GetLayoutSize();
+ layoutSize = mImpl->mModel->mVisualModel->GetLayoutSize();
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "<--Controller::GetHeightForWidth cached %f\n", layoutSize.height );
}
return layoutSize.height;
}
+const ModelInterface* const Controller::GetTextModel() const
+{
+ return mImpl->mModel.Get();
+}
+
// public : Relayout.
Controller::UpdateTextType Controller::Relayout( const Size& size )
if( ( size.width < Math::MACHINE_EPSILON_1000 ) || ( size.height < Math::MACHINE_EPSILON_1000 ) )
{
- if( 0u != mImpl->mVisualModel->mGlyphPositions.Count() )
+ if( 0u != mImpl->mModel->mVisualModel->mGlyphPositions.Count() )
{
- mImpl->mVisualModel->mGlyphPositions.Clear();
+ mImpl->mModel->mVisualModel->mGlyphPositions.Clear();
updateTextType = MODEL_UPDATED;
}
}
// Whether a new size has been set.
- const bool newSize = ( size != mImpl->mVisualModel->mControlSize );
+ const bool newSize = ( size != mImpl->mModel->mVisualModel->mControlSize );
if( newSize )
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "new size (previous size %f,%f)\n", mImpl->mVisualModel->mControlSize.width, mImpl->mVisualModel->mControlSize.height );
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "new size (previous size %f,%f)\n", mImpl->mModel->mVisualModel->mControlSize.width, mImpl->mModel->mVisualModel->mControlSize.height );
// Layout operations that need to be done if the size changes.
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending |
Vector2 offset;
if( newSize && isEditable )
{
- offset = mImpl->mScrollPosition;
+ offset = mImpl->mModel->mScrollPosition;
}
if( !isEditable || !IsMultiLineEnabled() )
mImpl->ClampHorizontalScroll( layoutSize );
// Update the decorator's positions is needed if there is a new size.
- mImpl->mEventData->mDecorator->UpdatePositions( mImpl->mScrollPosition - offset );
+ mImpl->mEventData->mDecorator->UpdatePositions( mImpl->mModel->mScrollPosition - offset );
}
// Move the cursor, grab handle etc.
{
mImpl->ChangeState( EventData::EDITING );
mImpl->mEventData->mUpdateCursorPosition = true; //If editing started without tap event, cursor update must be triggered.
+ mImpl->mEventData->mUpdateInputStyle = true;
}
mImpl->NotifyImfMultiLineStatus();
if( mImpl->IsShowingPlaceholderText() )
if( textDeleted )
{
- if( ( 0u != mImpl->mLogicalModel->mText.Count() ) ||
+ if( ( 0u != mImpl->mModel->mLogicalModel->mText.Count() ) ||
!mImpl->IsPlaceholderAvailable() )
{
mImpl->QueueModifyEvent( ModifyEvent::TEXT_DELETED );
void Controller::GetTargetSize( Vector2& targetSize )
{
- targetSize = mImpl->mVisualModel->mControlSize;
+ targetSize = mImpl->mModel->mVisualModel->mControlSize;
}
void Controller::AddDecoration( Actor& actor, bool needsClipping )
mImpl->SendSelectionToClipboard( true ); // Synchronous call to modify text
mImpl->mOperationsPending = ALL_OPERATIONS;
- if( ( 0u != mImpl->mLogicalModel->mText.Count() ) ||
+ if( ( 0u != mImpl->mModel->mLogicalModel->mText.Count() ) ||
!mImpl->IsPlaceholderAvailable() )
{
mImpl->QueueModifyEvent( ModifyEvent::TEXT_DELETED );
mImpl->mEventData->mPrimaryCursorPosition, mImpl->mEventData->mPreEditFlag, mImpl->mEventData->mPreEditStartPosition, mImpl->mEventData->mPreEditLength );
// TODO: At the moment the underline runs are only for pre-edit.
- mImpl->mVisualModel->mUnderlineRuns.Clear();
+ mImpl->mModel->mVisualModel->mUnderlineRuns.Clear();
// Keep the current number of characters.
- const Length currentNumberOfCharacters = mImpl->IsShowingRealText() ? mImpl->mLogicalModel->mText.Count() : 0u;
+ const Length currentNumberOfCharacters = mImpl->IsShowingRealText() ? mImpl->mModel->mLogicalModel->mText.Count() : 0u;
// Remove the previous IMF pre-edit.
if( mImpl->mEventData->mPreEditFlag && ( 0u != mImpl->mEventData->mPreEditLength ) )
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "mPreEditStartPosition %d mPreEditLength %d\n", mImpl->mEventData->mPreEditStartPosition, mImpl->mEventData->mPreEditLength );
}
- const Length numberOfCharactersInModel = mImpl->mLogicalModel->mText.Count();
+ const Length numberOfCharactersInModel = mImpl->mModel->mLogicalModel->mText.Count();
// Restrict new text to fit within Maximum characters setting.
Length maxSizeOfNewText = std::min( ( mImpl->mMaximumNumberOfCharacters - numberOfCharactersInModel ), characterCount );
// Update the text's style.
// Updates the text style runs by adding characters.
- mImpl->mLogicalModel->UpdateTextStyleRuns( cursorIndex, maxSizeOfNewText );
+ mImpl->mModel->mLogicalModel->UpdateTextStyleRuns( cursorIndex, maxSizeOfNewText );
// Get the character index from the cursor index.
const CharacterIndex styleIndex = ( cursorIndex > 0u ) ? cursorIndex - 1u : 0u;
// Retrieve the text's style for the given index.
InputStyle style;
mImpl->RetrieveDefaultInputStyle( style );
- mImpl->mLogicalModel->RetrieveStyle( styleIndex, style );
+ mImpl->mModel->mLogicalModel->RetrieveStyle( styleIndex, style );
// Whether to add a new text color run.
const bool addColorRun = ( style.textColor != mImpl->mEventData->mInputStyle.textColor );
// Add style runs.
if( addColorRun )
{
- const VectorBase::SizeType numberOfRuns = mImpl->mLogicalModel->mColorRuns.Count();
- mImpl->mLogicalModel->mColorRuns.Resize( numberOfRuns + 1u );
+ const VectorBase::SizeType numberOfRuns = mImpl->mModel->mLogicalModel->mColorRuns.Count();
+ mImpl->mModel->mLogicalModel->mColorRuns.Resize( numberOfRuns + 1u );
- ColorRun& colorRun = *( mImpl->mLogicalModel->mColorRuns.Begin() + numberOfRuns );
+ ColorRun& colorRun = *( mImpl->mModel->mLogicalModel->mColorRuns.Begin() + numberOfRuns );
colorRun.color = mImpl->mEventData->mInputStyle.textColor;
colorRun.characterRun.characterIndex = cursorIndex;
colorRun.characterRun.numberOfCharacters = maxSizeOfNewText;
addFontSlantRun ||
addFontSizeRun )
{
- const VectorBase::SizeType numberOfRuns = mImpl->mLogicalModel->mFontDescriptionRuns.Count();
- mImpl->mLogicalModel->mFontDescriptionRuns.Resize( numberOfRuns + 1u );
+ const VectorBase::SizeType numberOfRuns = mImpl->mModel->mLogicalModel->mFontDescriptionRuns.Count();
+ mImpl->mModel->mLogicalModel->mFontDescriptionRuns.Resize( numberOfRuns + 1u );
- FontDescriptionRun& fontDescriptionRun = *( mImpl->mLogicalModel->mFontDescriptionRuns.Begin() + numberOfRuns );
+ FontDescriptionRun& fontDescriptionRun = *( mImpl->mModel->mLogicalModel->mFontDescriptionRuns.Begin() + numberOfRuns );
if( addFontNameRun )
{
}
// Insert at current cursor position.
- Vector<Character>& modifyText = mImpl->mLogicalModel->mText;
+ Vector<Character>& modifyText = mImpl->mModel->mLogicalModel->mText;
if( cursorIndex < numberOfCharactersInModel )
{
// Update the cursor index.
cursorIndex += maxSizeOfNewText;
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Inserted %d characters, new size %d new cursor %d\n", maxSizeOfNewText, mImpl->mLogicalModel->mText.Count(), mImpl->mEventData->mPrimaryCursorPosition );
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Inserted %d characters, new size %d new cursor %d\n", maxSizeOfNewText, mImpl->mModel->mLogicalModel->mText.Count(), mImpl->mEventData->mPrimaryCursorPosition );
}
- const Length numberOfCharacters = mImpl->IsShowingRealText() ? mImpl->mLogicalModel->mText.Count() : 0u;
+ const Length numberOfCharacters = mImpl->IsShowingRealText() ? mImpl->mModel->mLogicalModel->mText.Count() : 0u;
- if( ( 0u == mImpl->mLogicalModel->mText.Count() ) &&
+ if( ( 0u == mImpl->mModel->mLogicalModel->mText.Count() ) &&
mImpl->IsPlaceholderAvailable() )
{
// Show place-holder if empty after removing the pre-edit text
if( maxLengthReached )
{
- DALI_LOG_INFO( gLogFilter, Debug::Verbose, "MaxLengthReached (%d)\n", mImpl->mLogicalModel->mText.Count() );
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "MaxLengthReached (%d)\n", mImpl->mModel->mLogicalModel->mText.Count() );
mImpl->ResetImfManager();
}
DALI_LOG_INFO( gLogFilter, Debug::General, "Controller::RemoveText %p mText.Count() %d cursor %d cursorOffset %d numberOfCharacters %d\n",
- this, mImpl->mLogicalModel->mText.Count(), mImpl->mEventData->mPrimaryCursorPosition, cursorOffset, numberOfCharacters );
+ this, mImpl->mModel->mLogicalModel->mText.Count(), mImpl->mEventData->mPrimaryCursorPosition, cursorOffset, numberOfCharacters );
if( !mImpl->IsShowingPlaceholderText() )
{
// Delete at current cursor position
- Vector<Character>& currentText = mImpl->mLogicalModel->mText;
+ Vector<Character>& currentText = mImpl->mModel->mLogicalModel->mText;
CharacterIndex& oldCursorIndex = mImpl->mEventData->mPrimaryCursorPosition;
CharacterIndex cursorIndex = oldCursorIndex;
mImpl->RetrieveDefaultInputStyle( mImpl->mEventData->mInputStyle );
// Update the input style.
- mImpl->mLogicalModel->RetrieveStyle( cursorIndex, mImpl->mEventData->mInputStyle );
+ mImpl->mModel->mLogicalModel->RetrieveStyle( cursorIndex, mImpl->mEventData->mInputStyle );
// Compare if the input style has changed.
const bool hasInputStyleChanged = !currentInputStyle.Equal( mImpl->mEventData->mInputStyle );
}
// Updates the text style runs by removing characters. Runs with no characters are removed.
- mImpl->mLogicalModel->UpdateTextStyleRuns( cursorIndex, -numberOfCharacters );
+ mImpl->mModel->mLogicalModel->UpdateTextStyleRuns( cursorIndex, -numberOfCharacters );
// Remove the characters.
Vector<Character>::Iterator first = currentText.Begin() + cursorIndex;
const Length requestedNumberOfCharacters = mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters;
// Get the current layout size.
- layoutSize = mImpl->mVisualModel->GetLayoutSize();
+ layoutSize = mImpl->mModel->mVisualModel->GetLayoutSize();
if( NO_OPERATION != ( LAYOUT & operations ) )
{
// Fill the vectors again.
// Calculate the number of glyphs to layout.
- const Vector<GlyphIndex>& charactersToGlyph = mImpl->mVisualModel->mCharactersToGlyph;
- const Vector<Length>& glyphsPerCharacter = mImpl->mVisualModel->mGlyphsPerCharacter;
+ const Vector<GlyphIndex>& charactersToGlyph = mImpl->mModel->mVisualModel->mCharactersToGlyph;
+ const Vector<Length>& glyphsPerCharacter = mImpl->mModel->mVisualModel->mGlyphsPerCharacter;
const GlyphIndex* const charactersToGlyphBuffer = charactersToGlyph.Begin();
const Length* const glyphsPerCharacterBuffer = glyphsPerCharacter.Begin();
const CharacterIndex lastIndex = startIndex + ( ( requestedNumberOfCharacters > 0u ) ? requestedNumberOfCharacters - 1u : 0u );
const GlyphIndex startGlyphIndex = mImpl->mTextUpdateInfo.mStartGlyphIndex;
const Length numberOfGlyphs = ( requestedNumberOfCharacters > 0u ) ? *( charactersToGlyphBuffer + lastIndex ) + *( glyphsPerCharacterBuffer + lastIndex ) - startGlyphIndex : 0u;
- const Length totalNumberOfGlyphs = mImpl->mVisualModel->mGlyphs.Count();
+ const Length totalNumberOfGlyphs = mImpl->mModel->mVisualModel->mGlyphs.Count();
if( 0u == totalNumberOfGlyphs )
{
if( NO_OPERATION != ( UPDATE_LAYOUT_SIZE & operations ) )
{
- mImpl->mVisualModel->SetLayoutSize( Size::ZERO );
+ mImpl->mModel->mVisualModel->SetLayoutSize( Size::ZERO );
}
// Nothing else to do if there is no glyphs.
return true;
}
- const Vector<LineBreakInfo>& lineBreakInfo = mImpl->mLogicalModel->mLineBreakInfo;
- const Vector<WordBreakInfo>& wordBreakInfo = mImpl->mLogicalModel->mWordBreakInfo;
- const Vector<CharacterDirection>& characterDirection = mImpl->mLogicalModel->mCharacterDirections;
- const Vector<GlyphInfo>& glyphs = mImpl->mVisualModel->mGlyphs;
- const Vector<CharacterIndex>& glyphsToCharactersMap = mImpl->mVisualModel->mGlyphsToCharacters;
- const Vector<Length>& charactersPerGlyph = mImpl->mVisualModel->mCharactersPerGlyph;
- const Character* const textBuffer = mImpl->mLogicalModel->mText.Begin();
+ const Vector<LineBreakInfo>& lineBreakInfo = mImpl->mModel->mLogicalModel->mLineBreakInfo;
+ const Vector<WordBreakInfo>& wordBreakInfo = mImpl->mModel->mLogicalModel->mWordBreakInfo;
+ const Vector<CharacterDirection>& characterDirection = mImpl->mModel->mLogicalModel->mCharacterDirections;
+ const Vector<GlyphInfo>& glyphs = mImpl->mModel->mVisualModel->mGlyphs;
+ const Vector<CharacterIndex>& glyphsToCharactersMap = mImpl->mModel->mVisualModel->mGlyphsToCharacters;
+ const Vector<Length>& charactersPerGlyph = mImpl->mModel->mVisualModel->mCharactersPerGlyph;
+ const Character* const textBuffer = mImpl->mModel->mLogicalModel->mText.Begin();
// Set the layout parameters.
- LayoutParameters layoutParameters( size,
- textBuffer,
- lineBreakInfo.Begin(),
- wordBreakInfo.Begin(),
- ( 0u != characterDirection.Count() ) ? characterDirection.Begin() : NULL,
- glyphs.Begin(),
- glyphsToCharactersMap.Begin(),
- charactersPerGlyph.Begin(),
- charactersToGlyphBuffer,
- glyphsPerCharacterBuffer,
- totalNumberOfGlyphs );
+ Layout::Parameters layoutParameters( size,
+ textBuffer,
+ lineBreakInfo.Begin(),
+ wordBreakInfo.Begin(),
+ ( 0u != characterDirection.Count() ) ? characterDirection.Begin() : NULL,
+ glyphs.Begin(),
+ glyphsToCharactersMap.Begin(),
+ charactersPerGlyph.Begin(),
+ charactersToGlyphBuffer,
+ glyphsPerCharacterBuffer,
+ totalNumberOfGlyphs,
+ mImpl->mModel->mHorizontalAlignment );
// Resize the vector of positions to have the same size than the vector of glyphs.
- Vector<Vector2>& glyphPositions = mImpl->mVisualModel->mGlyphPositions;
+ Vector<Vector2>& glyphPositions = mImpl->mModel->mVisualModel->mGlyphPositions;
glyphPositions.Resize( totalNumberOfGlyphs );
// Whether the last character is a new paragraph character.
- mImpl->mTextUpdateInfo.mIsLastCharacterNewParagraph = TextAbstraction::IsNewParagraph( *( textBuffer + ( mImpl->mLogicalModel->mText.Count() - 1u ) ) );
+ mImpl->mTextUpdateInfo.mIsLastCharacterNewParagraph = TextAbstraction::IsNewParagraph( *( textBuffer + ( mImpl->mModel->mLogicalModel->mText.Count() - 1u ) ) );
layoutParameters.isLastNewParagraph = mImpl->mTextUpdateInfo.mIsLastCharacterNewParagraph;
// The initial glyph and the number of glyphs to layout.
Size newLayoutSize;
viewUpdated = mImpl->mLayoutEngine.LayoutText( layoutParameters,
glyphPositions,
- mImpl->mVisualModel->mLines,
- newLayoutSize );
+ mImpl->mModel->mVisualModel->mLines,
+ newLayoutSize,
+ mImpl->mModel->mElideEnabled );
viewUpdated = viewUpdated || ( newLayoutSize != layoutSize );
{
layoutSize = newLayoutSize;
- if ( NO_OPERATION != ( UPDATE_DIRECTION & operations ) )
+ if( NO_OPERATION != ( UPDATE_DIRECTION & operations ) )
{
mImpl->mAutoScrollDirectionRTL = false;
}
// Reorder the lines
if( NO_OPERATION != ( REORDER & operations ) )
{
- Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = mImpl->mLogicalModel->mBidirectionalParagraphInfo;
- Vector<BidirectionalLineInfoRun>& bidirectionalLineInfo = mImpl->mLogicalModel->mBidirectionalLineInfo;
+ Vector<BidirectionalParagraphInfoRun>& bidirectionalInfo = mImpl->mModel->mLogicalModel->mBidirectionalParagraphInfo;
+ Vector<BidirectionalLineInfoRun>& bidirectionalLineInfo = mImpl->mModel->mLogicalModel->mBidirectionalLineInfo;
// Check first if there are paragraphs with bidirectional info.
if( 0u != bidirectionalInfo.Count() )
{
// Get the lines
- const Length numberOfLines = mImpl->mVisualModel->mLines.Count();
+ const Length numberOfLines = mImpl->mModel->mVisualModel->mLines.Count();
// Reorder the lines.
bidirectionalLineInfo.Reserve( numberOfLines ); // Reserve because is not known yet how many lines have right to left characters.
ReorderLines( bidirectionalInfo,
startIndex,
requestedNumberOfCharacters,
- mImpl->mVisualModel->mLines,
+ mImpl->mModel->mVisualModel->mLines,
bidirectionalLineInfo );
// Set the bidirectional info per line into the layout parameters.
if ( ( NO_OPERATION != ( UPDATE_DIRECTION & operations ) ) && ( numberOfLines > 0 ) )
{
- const LineRun* const firstline = mImpl->mVisualModel->mLines.Begin();
+ const LineRun* const firstline = mImpl->mModel->mVisualModel->mLines.Begin();
if ( firstline )
{
mImpl->mAutoScrollDirectionRTL = firstline->direction;
// Sets the layout size.
if( NO_OPERATION != ( UPDATE_LAYOUT_SIZE & operations ) )
{
- mImpl->mVisualModel->SetLayoutSize( layoutSize );
+ mImpl->mModel->mVisualModel->SetLayoutSize( layoutSize );
}
} // view updated
// Store the size used to layout the text.
- mImpl->mVisualModel->mControlSize = size;
+ mImpl->mModel->mVisualModel->mControlSize = size;
}
if( NO_OPERATION != ( ALIGN & operations ) )
{
// The laid-out lines.
- Vector<LineRun>& lines = mImpl->mVisualModel->mLines;
+ Vector<LineRun>& lines = mImpl->mModel->mVisualModel->mLines;
mImpl->mLayoutEngine.Align( size,
startIndex,
requestedNumberOfCharacters,
+ mImpl->mModel->mHorizontalAlignment,
lines );
viewUpdated = true;
void Controller::CalculateVerticalOffset( const Size& controlSize )
{
- Size layoutSize = mImpl->mVisualModel->GetLayoutSize();
+ Size layoutSize = mImpl->mModel->mVisualModel->GetLayoutSize();
if( fabsf( layoutSize.height ) < Math::MACHINE_EPSILON_1000 )
{
layoutSize.height = mImpl->GetDefaultFontLineHeight();
}
- switch( mImpl->mLayoutEngine.GetVerticalAlignment() )
+ switch( mImpl->mModel->mVerticalAlignment )
{
- case LayoutEngine::VERTICAL_ALIGN_TOP:
+ case Layout::VERTICAL_ALIGN_TOP:
{
- mImpl->mScrollPosition.y = 0.f;
+ mImpl->mModel->mScrollPosition.y = 0.f;
break;
}
- case LayoutEngine::VERTICAL_ALIGN_CENTER:
+ case Layout::VERTICAL_ALIGN_CENTER:
{
- mImpl->mScrollPosition.y = floorf( 0.5f * ( controlSize.height - layoutSize.height ) ); // try to avoid pixel alignment.
+ mImpl->mModel->mScrollPosition.y = floorf( 0.5f * ( controlSize.height - layoutSize.height ) ); // try to avoid pixel alignment.
break;
}
- case LayoutEngine::VERTICAL_ALIGN_BOTTOM:
+ case Layout::VERTICAL_ALIGN_BOTTOM:
{
- mImpl->mScrollPosition.y = controlSize.height - layoutSize.height;
+ mImpl->mModel->mScrollPosition.y = controlSize.height - layoutSize.height;
break;
}
}
if( removed )
{
- if( ( 0u != mImpl->mLogicalModel->mText.Count() ) ||
+ if( ( 0u != mImpl->mModel->mLogicalModel->mText.Count() ) ||
!mImpl->IsPlaceholderAvailable() )
{
mImpl->QueueModifyEvent( ModifyEvent::TEXT_DELETED );
void Controller::ResetText()
{
// Reset buffers.
- mImpl->mLogicalModel->mText.Clear();
+ mImpl->mModel->mLogicalModel->mText.Clear();
// We have cleared everything including the placeholder-text
mImpl->PlaceholderCleared();
mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
// Reset model for showing placeholder.
- mImpl->mLogicalModel->mText.Clear();
- mImpl->mVisualModel->SetTextColor( mImpl->mEventData->mPlaceholderTextColor );
+ mImpl->mModel->mLogicalModel->mText.Clear();
+ mImpl->mModel->mVisualModel->SetTextColor( mImpl->mEventData->mPlaceholderTextColor );
// Convert text into UTF-32
- Vector<Character>& utf32Characters = mImpl->mLogicalModel->mText;
+ Vector<Character>& utf32Characters = mImpl->mModel->mLogicalModel->mText;
utf32Characters.Resize( size );
// This is a bit horrible but std::string returns a (signed) char*
// Set flags to update the model.
mImpl->mTextUpdateInfo.mCharacterIndex = 0u;
mImpl->mTextUpdateInfo.mNumberOfCharactersToRemove = mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters;
- mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mLogicalModel->mText.Count();
+ mImpl->mTextUpdateInfo.mNumberOfCharactersToAdd = mImpl->mModel->mLogicalModel->mText.Count();
mImpl->mTextUpdateInfo.mClearAll = true;
mImpl->mTextUpdateInfo.mFullRelayoutNeeded = true;
void Controller::ClearStyleData()
{
- mImpl->mLogicalModel->mColorRuns.Clear();
- mImpl->mLogicalModel->ClearFontDescriptionRuns();
+ mImpl->mModel->mLogicalModel->mColorRuns.Clear();
+ mImpl->mModel->mLogicalModel->ClearFontDescriptionRuns();
}
void Controller::ResetCursorPosition( CharacterIndex cursorIndex )
if( NULL != mImpl->mEventData )
{
// Reset the scroll position.
- mImpl->mScrollPosition = Vector2::ZERO;
+ mImpl->mModel->mScrollPosition = Vector2::ZERO;
mImpl->mEventData->mScrollAfterUpdatePosition = true;
}
}
#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
#include <dali-toolkit/internal/text/decorator/text-decorator.h>
#include <dali-toolkit/internal/text/layouts/layout-engine.h>
+#include <dali-toolkit/internal/text/text-model-interface.h>
namespace Dali
{
class ControlInterface;
class EditableControlInterface;
class View;
+class RenderingController;
typedef IntrusivePtr<Controller> ControllerPtr;
bool IsMultiLineEnabled() const;
/**
- * @copydoc Dali::Toolkit::Text::LayoutEngine::SetHorizontalAlignment()
+ * @brief Sets the text's horizontal alignment.
+ *
+ * @param[in] alignment The horizontal alignment.
+ */
+ void SetHorizontalAlignment( Layout::HorizontalAlignment alignment );
+
+ /**
+ * @copydoc ModelInterface::GetHorizontalAlignment()
*/
- void SetHorizontalAlignment( LayoutEngine::HorizontalAlignment alignment );
+ Layout::HorizontalAlignment GetHorizontalAlignment() const;
/**
- * @copydoc Dali::Toolkit::Text::LayoutEngine::GetHorizontalAlignment()
+ * @brief Sets the text's vertical alignment.
+ *
+ * @param[in] alignment The vertical alignment.
*/
- LayoutEngine::HorizontalAlignment GetHorizontalAlignment() const;
+ void SetVerticalAlignment( Layout::VerticalAlignment alignment );
/**
- * @copydoc Dali::Toolkit::Text::LayoutEngine::SetVerticalAlignment()
+ * @copydoc ModelInterface::GetVerticalAlignment()
*/
- void SetVerticalAlignment( LayoutEngine::VerticalAlignment alignment );
+ Layout::VerticalAlignment GetVerticalAlignment() const;
/**
- * @copydoc Dali::Toolkit::Text::LayoutEngine::GetVerticalAlignment()
+ * @brief Enable or disable the text elide.
+ *
+ * @param[in] enabled Whether to enable the text elide.
*/
- LayoutEngine::VerticalAlignment GetVerticalAlignment() const;
+ void SetTextElideEnabled( bool enabled );
+
+ /**
+ * @copydoc ModelInterface::IsTextElideEnabled()
+ */
+ bool IsTextElideEnabled() const;
public: // Update.
float GetDefaultPointSize() const;
/**
- * @brief Set the text color
+ * @brief Sets the text's default color.
*
- * @param textColor The text color
+ * @param color The default color.
*/
- void SetTextColor( const Vector4& textColor );
+ void SetDefaultColor( const Vector4& color );
/**
- * @brief Retrieve the text color
+ * @brief Retrieves the text's default color.
*
- * @return The text color
+ * @return The default color.
*/
- const Vector4& GetTextColor() const;
+ const Vector4& GetDefaultColor() const;
/**
* @brief Set the text color
*
* @return A reference to the layout engine.
*/
- LayoutEngine& GetLayoutEngine();
+ Layout::Engine& GetLayoutEngine();
/**
* @brief Return a view of the text.
View& GetView();
/**
- * @brief Query the current scroll position; the UI control is responsible for moving actors to this position.
- *
- * @return The scroll position.
- */
- const Vector2& GetScrollPosition() const;
-
- /**
* @copydoc Control::GetNaturalSize()
*/
Vector3 GetNaturalSize();
*/
float GetHeightForWidth( float width );
+ /**
+ * @brief Retrieves the text's model.
+ *
+ * @return A pointer to the text's model.
+ */
+ const ModelInterface* const GetTextModel() const;
+
public: // Relayout.
/**
--- /dev/null
+#ifndef DALI_TOOLKIT_TEXT_MODEL_INTERFACE_H
+#define DALI_TOOLKIT_TEXT_MODEL_INTERFACE_H
+
+/*
+ * Copyright (c) 2016 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/vector2.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/layouts/layout-alignment.h>
+#include <dali-toolkit/internal/text/line-run.h>
+#include <dali-toolkit/internal/text/text-definitions.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+/**
+ * @brief Interface class used to retrieve the text's model from the text-controller.
+ */
+class ModelInterface
+{
+public:
+ /**
+ * @brief Virtual destructor.
+ */
+ virtual ~ModelInterface()
+ {}
+
+ /**
+ * @brief Retrives the control's size.
+ *
+ * @return The control's size.
+ */
+ virtual const Size& GetControlSize() const = 0;
+
+ /**
+ * @brief Retrives the layout's size.
+ *
+ * @return The layout's size.
+ */
+ virtual const Size& GetLayoutSize() const = 0;
+
+ /**
+ * @brief Retrieves the text's scroll position.
+ *
+ * @return The scroll position.
+ */
+ virtual const Vector2& GetScrollPosition() const = 0;
+
+ /**
+ * @brief Retrieves the text's horizontal alignment.
+ *
+ * @return The horizontal alignment.
+ */
+ virtual Layout::HorizontalAlignment GetHorizontalAlignment() const = 0;
+
+ /**
+ * @brief Retrieves the text's vertical alignment.
+ *
+ * @return The vertical alignment.
+ */
+ virtual Layout::VerticalAlignment GetVerticalAlignment() const = 0;
+
+ /**
+ * @brief Whether the text elide property is enabled.
+ *
+ * @return @e true if the text elide property is enabled, @e false otherwise.
+ */
+ virtual bool IsTextElideEnabled() const = 0;
+
+ /**
+ * @brief Retrieves the number of laid-out lines.
+ *
+ * @return The number of laid-out lines.
+ */
+ virtual Length GetNumberOfLines() const = 0;
+
+ /**
+ * @brief Retrieves the laid-out lines.
+ *
+ * @return A pointer to the vector with the laid-out lines.
+ */
+ virtual const LineRun* const GetLines() const = 0;
+
+ /**
+ * @brief Retrieves the number of laid-out glyphs.
+ *
+ * @return The number of laid-out glyphs.
+ */
+ virtual Length GetNumberOfGlyphs() const = 0;
+
+ /**
+ * @brief Retrieves the laid-out glyphs.
+ *
+ * @return A pointer to the vector with the laid-out glyphs.
+ */
+ virtual const GlyphInfo* const GetGlyphs() const = 0;
+
+ /**
+ * @brief Retrieves the text layout.
+ *
+ * @return A pointer to the vector with the positions for each glyph.
+ */
+ virtual const Vector2* const GetLayout() const = 0;
+
+ /**
+ * @brief Retrieves the vector of colors.
+ *
+ * @return Pointer to the vector of colors.
+ */
+ virtual const Vector4* const GetColors() const = 0;
+
+ /**
+ * @brief Retrieves the vector of indices to the vector of colors.
+ *
+ * @return Pointer to a vector which stores for each glyph the index to the vector of colors.
+ */
+ virtual const ColorIndex* const GetColorIndices() const = 0;
+
+ /**
+ * @brief Retrieves the text's default color.
+ *
+ * @return The default color.
+ */
+ virtual const Vector4& GetDefaultColor() const = 0;
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_MODEL_INTERFACE_H
--- /dev/null
+/*
+ * Copyright (c) 2016 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/internal/text/text-model.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+ModelPtr Model::New()
+{
+ return ModelPtr( new Model() );
+}
+
+const Size& Model::GetControlSize() const
+{
+ return mVisualModel->mControlSize;
+}
+
+const Size& Model::GetLayoutSize() const
+{
+ return mVisualModel->GetLayoutSize();
+}
+
+const Vector2& Model::GetScrollPosition() const
+{
+ return mScrollPosition;
+}
+
+Layout::HorizontalAlignment Model::GetHorizontalAlignment() const
+{
+ return mHorizontalAlignment;
+}
+
+Layout::VerticalAlignment Model::GetVerticalAlignment() const
+{
+ return mVerticalAlignment;
+}
+
+bool Model::IsTextElideEnabled() const
+{
+ return mElideEnabled;
+}
+
+Length Model::GetNumberOfLines() const
+{
+ return mVisualModel->mLines.Count();
+}
+
+const LineRun* const Model::GetLines() const
+{
+ return mVisualModel->mLines.Begin();
+}
+
+Length Model::GetNumberOfGlyphs() const
+{
+ return mVisualModel->mGlyphs.Count();
+}
+
+const GlyphInfo* const Model::GetGlyphs() const
+{
+ return mVisualModel->mGlyphs.Begin();
+}
+
+const Vector2* const Model::GetLayout() const
+{
+ return mVisualModel->mGlyphPositions.Begin();
+}
+
+const Vector4* const Model::GetColors() const
+{
+ return mVisualModel->mColors.Begin();
+}
+
+const ColorIndex* const Model::GetColorIndices() const
+{
+ return mVisualModel->mColorIndices.Begin();
+}
+
+const Vector4& Model::GetDefaultColor() const
+{
+ return mVisualModel->mTextColor;
+}
+
+Model::Model()
+: mLogicalModel(),
+ mVisualModel(),
+ mScrollPosition(),
+ mHorizontalAlignment( Layout::HORIZONTAL_ALIGN_BEGIN ),
+ mVerticalAlignment( Layout::VERTICAL_ALIGN_TOP ),
+ mElideEnabled( false )
+{
+ mLogicalModel = LogicalModel::New();
+ mVisualModel = VisualModel::New();
+}
+
+Model::~Model()
+{
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_TEXT_MODEL_H
+#define DALI_TOOLKIT_TEXT_MODEL_H
+
+/*
+ * Copyright (c) 2016 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/object/ref-object.h>
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/internal/text/layouts/layout-alignment.h>
+#include <dali-toolkit/internal/text/logical-model-impl.h>
+#include <dali-toolkit/internal/text/text-model-interface.h>
+#include <dali-toolkit/internal/text/visual-model-impl.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+// Forward declarations.
+class Model;
+
+typedef IntrusivePtr<Model> ModelPtr;
+
+/**
+ * @brief Implementation class used to retrieve the text's model from the text-controller.
+ */
+class Model : public RefObject, public ModelInterface
+{
+
+public: // Constructor.
+
+ /**
+ * @brief Create a new instance of a text Model.
+ *
+ * @return A pointer to a new text Model.
+ */
+ static ModelPtr New();
+
+public:
+
+ /**
+ * @copydoc ModelInterface::GetControlSize()
+ */
+ virtual const Size& GetControlSize() const;
+
+ /**
+ * @copydoc ModelInterface::GetLayoutSize()
+ */
+ virtual const Size& GetLayoutSize() const;
+
+ /**
+ * @copydoc ModelInterface::GetScrollPosition()
+ */
+ virtual const Vector2& GetScrollPosition() const;
+
+ /**
+ * @copydoc ModelInterface::GetHorizontalAlignment()
+ */
+ virtual Layout::HorizontalAlignment GetHorizontalAlignment() const;
+
+ /**
+ * @copydoc ModelInterface::GetVerticalAlignment()
+ */
+ virtual Layout::VerticalAlignment GetVerticalAlignment() const;
+
+ /**
+ * @copydoc ModelInterface::IsTextElideEnabled()
+ */
+ virtual bool IsTextElideEnabled() const;
+
+ /**
+ * @copydoc ModelInterface::GetNumberOfLines()
+ */
+ virtual Length GetNumberOfLines() const;
+
+ /**
+ * @copydoc ModelInterface::GetLines()
+ */
+ virtual const LineRun* const GetLines() const;
+
+ /**
+ * @copydoc ModelInterface::GetNumberOfGlyphs()
+ */
+ virtual Length GetNumberOfGlyphs() const;
+
+ /**
+ * @copydoc ModelInterface::GetGlyphs()
+ */
+ virtual const GlyphInfo* const GetGlyphs() const;
+
+ /**
+ * @copydoc ModelInterface::GetLayout()
+ */
+ virtual const Vector2* const GetLayout() const;
+
+ /**
+ * @copydoc ModelInterface::GetColors()
+ */
+ virtual const Vector4* const GetColors() const;
+
+ /**
+ * @copydoc ModelInterface::GetColorIndices()
+ */
+ virtual const ColorIndex* const GetColorIndices() const;
+
+ /**
+ * @copydoc ModelInterface::GetDefaultColor()
+ */
+ virtual const Vector4& GetDefaultColor() const;
+
+private: // Private contructors & copy operator.
+
+ /**
+ * @brief Private constructor.
+ */
+ Model();
+
+ // Undefined.
+ Model( const Model& handle );
+
+ // Undefined.
+ Model& operator=( const Model& handle );
+
+protected:
+
+ /**
+ * @brief A reference counted object may only be deleted by calling Unreference().
+ */
+ virtual ~Model();
+
+public:
+ LogicalModelPtr mLogicalModel; ///< Pointer to the logical model.
+ VisualModelPtr mVisualModel; ///< Pointer to the visual model.
+ /**
+ * 0,0 means that the top-left corner of the layout matches the top-left corner of the UI control.
+ * Typically this will have a negative value with scrolling occurs.
+ */
+ Vector2 mScrollPosition; ///< The text is offset by this position when scrolling.
+ Layout::HorizontalAlignment mHorizontalAlignment; ///< The layout's horizontal alignment.
+ Layout::VerticalAlignment mVerticalAlignment; ///< The layout's vertical alignment.
+ bool mElideEnabled:1; ///< Whether the text's elide is enabled.
+};
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_MODEL_H
public:
/**
- * @brief Constructor.
- */
- ScrollerInterface();
-
- /**
* @brief Virtual destructor.
*/
- virtual ~ScrollerInterface();
+ virtual ~ScrollerInterface()
+ {}
/**
* @brief Called when the scrolling finishes
mTextColor( Color::BLACK ),
mShadowColor( Color::BLACK ),
mUnderlineColor( Color::BLACK ),
- mShadowOffset( Vector2::ZERO ),
+ mControlSize(),
+ mShadowOffset(),
mUnderlineHeight( 0.0f ),
mNaturalSize(),
mLayoutSize(),
Vector<Vector4> mColors; ///< Colors of the glyphs.
Vector<ColorIndex> mColorIndices; ///< Indices to the vector of colors for each glyphs.
- Vector2 mControlSize; ///< The size of the UI control the decorator is adding it's decorations to.
Vector4 mTextColor; ///< The text color
Vector4 mShadowColor; ///< Color of drop shadow
Vector4 mUnderlineColor; ///< Color of underline
+ 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.
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/border-visual-properties.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
void BorderVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( VisualProperty::TYPE, Toolkit::Visual::BORDER );
+ map.Insert( DevelVisual::Property::TYPE, Toolkit::Visual::BORDER );
map.Insert( Toolkit::BorderVisual::Property::COLOR, mBorderColor );
map.Insert( Toolkit::BorderVisual::Property::SIZE, mBorderSize );
map.Insert( Toolkit::BorderVisual::Property::ANTI_ALIASING, mAntiAliasing );
}
-void BorderVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
-{
- // TODO
-}
-
-Dali::Property::Value BorderVisual::DoGetProperty( Dali::Property::Index index )
-{
- // TODO
- return Dali::Property::Value();
-}
-
void BorderVisual::OnSetTransform()
{
if( mImpl->mRenderer )
virtual void DoCreatePropertyMap( Property::Map& map ) const;
/**
- * @copydoc Visual::Base::DoSetProperty
- */
- virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
-
- /**
- * @copydoc Visual::Base::DoGetProperty
- */
- virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
-
- /**
* @copydoc Visual::Base::OnSetTransform
*/
virtual void OnSetTransform();
//INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
void ColorVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::COLOR );
+ map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::COLOR );
map.Insert( Toolkit::ColorVisual::Property::MIX_COLOR, mMixColor );
}
-void ColorVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
-{
- // TODO
- /* David Steele comented :
-
- Some things to bear in mind:
-
- We currently keep a copy of the mix color in the ColorVisual object, which is then used to instantiate the registered property on the renderer.
-
- The user can get the renderer and animate the mixColor property (it's registered, so is automatically a scene-graph property).
-
- The GetProperty method will have to read from the renderer, or from the cached value in the Visual, and the SetProperty will have to write to cache and to the renderer if present.
- */
-}
-
-Dali::Property::Value ColorVisual::DoGetProperty( Dali::Property::Index index )
-{
- // TODO
- return Dali::Property::Value();
-}
-
void ColorVisual::OnSetTransform()
{
if( mImpl->mRenderer )
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
- /**
- * @copydoc Visual::Base::DoSetProperty
- */
- virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
-
- /**
- * @copydoc Visual::Base::DoGetProperty
- */
- virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
-
protected:
/**
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/gradient-visual-properties.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
void GradientVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::GRADIENT );
+ map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::GRADIENT );
map.Insert( Toolkit::GradientVisual::Property::UNITS, mGradient->GetGradientUnits() );
map.Insert( Toolkit::GradientVisual::Property::SPREAD_METHOD, mGradient->GetSpreadMethod() );
}
}
-void GradientVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
-{
- // TODO
-}
-
-Dali::Property::Value GradientVisual::DoGetProperty( Dali::Property::Index index )
-{
- // TODO
- return Dali::Property::Value();
-}
-
void GradientVisual::InitializeRenderer()
{
Geometry geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
- /**
- * @copydoc Visual::Base::DoSetProperty
- */
- virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
-
- /**
- * @copydoc Visual::Base::DoGetProperty
- */
- virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
-
protected:
/**
// INTERNAL HEADER
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
void BatchImageVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::IMAGE );
+ map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::IMAGE );
if( !mImageUrl.empty() )
{
}
}
-void BatchImageVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
-{
- // TODO
-}
-
-Dali::Property::Value BatchImageVisual::DoGetProperty( Dali::Property::Index index )
-{
- // TODO
- return Dali::Property::Value();
-}
-
Shader BatchImageVisual::GetBatchShader( VisualFactoryCache& factoryCache )
{
Shader shader = factoryCache.GetShader( VisualFactoryCache::BATCH_IMAGE_SHADER );
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
- /**
- * @copydoc Visual::Base::DoSetProperty
- */
- virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
-
- /**
- * @copydoc Visual::Base::DoGetProperty
- */
- virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
-
protected:
/**
// INTERNAL HEADER
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
void ImageVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::IMAGE );
+ map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::IMAGE );
bool sync = IsSynchronousResourceLoading();
map.Insert( SYNCHRONOUS_LOADING, sync );
map.Insert( Toolkit::ImageVisual::Property::WRAP_MODE_V, mWrapModeV );
}
-void ImageVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
-{
- // TODO
-}
-
-Dali::Property::Value ImageVisual::DoGetProperty( Dali::Property::Index index )
-{
- // TODO
- return Dali::Property::Value();
-}
-
void ImageVisual::OnSetTransform()
{
if( mImpl->mRenderer )
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
- /**
- * @copydoc Visual::Base::DoSetProperty
- */
- virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
-
- /**
- * @copydoc Visual::Base::DoGetProperty
- */
- virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
-
protected:
/**
#include <fstream>
//INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
void MeshVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::MESH );
+ map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::MESH );
map.Insert( Toolkit::MeshVisual::Property::OBJECT_URL, mObjectUrl );
map.Insert( Toolkit::MeshVisual::Property::MATERIAL_URL, mMaterialUrl );
map.Insert( Toolkit::MeshVisual::Property::TEXTURES_PATH, mTexturesPath );
map.Insert( Toolkit::MeshVisual::Property::LIGHT_POSITION, mLightPosition );
}
-void MeshVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
-{
- // TODO
-}
-
-Dali::Property::Value MeshVisual::DoGetProperty( Dali::Property::Index index )
-{
- // TODO
- return Dali::Property::Value();
-}
-
void MeshVisual::InitializeRenderer()
{
//Try to load the geometry from the file.
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
- /**
- * @copydoc Visual::Base::DoSetProperty
- */
- virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
-
- /**
- * @copydoc Visual::Base::DoGetProperty
- */
- virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
-
protected:
/**
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/npatch-loader.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
void NPatchVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::IMAGE );
+ map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::IMAGE );
map.Insert( Toolkit::ImageVisual::Property::URL, mImageUrl );
map.Insert( Toolkit::ImageVisual::Property::BORDER_ONLY, mBorderOnly );
}
-void NPatchVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
-{
- // TODO
-}
-
-Dali::Property::Value NPatchVisual::DoGetProperty( Dali::Property::Index index )
-{
- // TODO
- return Dali::Property::Value();
-}
-
NPatchVisual::NPatchVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
mLoader( factoryCache.GetNPatchLoader() ),
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
- /**
- * @copydoc Visual::Base::DoSetProperty
- */
- virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
-
- /**
- * @copydoc Visual::Base::DoGetProperty
- */
- virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
-
protected:
/**
#include <dali/devel-api/scripting/scripting.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
void PrimitiveVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::PRIMITIVE );
+ map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::PRIMITIVE );
map.Insert( Toolkit::PrimitiveVisual::Property::SHAPE, mPrimitiveType );
map.Insert( Toolkit::PrimitiveVisual::Property::MIX_COLOR, mColor );
map.Insert( Toolkit::PrimitiveVisual::Property::SLICES, mSlices );
map.Insert( Toolkit::PrimitiveVisual::Property::LIGHT_POSITION, mLightPosition );
}
-void PrimitiveVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
-{
- // TODO
-}
-
-Dali::Property::Value PrimitiveVisual::DoGetProperty( Dali::Property::Index index )
-{
- // TODO
- return Dali::Property::Value();
-}
-
void PrimitiveVisual::OnSetTransform()
{
if( mImpl->mRenderer )
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
- /**
- * @copydoc Visual::Base::DoSetProperty
- */
- virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
-
- /**
- * @copydoc Visual::Base::DoGetProperty
- */
- virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
-
protected:
/**
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/third-party/nanosvg/nanosvg.h>
#include <dali-toolkit/internal/visuals/svg/svg-rasterize-thread.h>
#include <dali-toolkit/internal/visuals/image/image-visual.h>
void SvgVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::IMAGE );
+ map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::IMAGE );
if( !mImageUrl.empty() )
{
map.Insert( Toolkit::ImageVisual::Property::URL, mImageUrl );
}
}
-void SvgVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
-{
- // TODO
-}
-
-Dali::Property::Value SvgVisual::DoGetProperty( Dali::Property::Index index )
-{
- // TODO
- return Dali::Property::Value();
-}
-
void SvgVisual::ParseFromUrl( const std::string& imageUrl )
{
mImageUrl = imageUrl;
*/
virtual void DoCreatePropertyMap( Property::Map& map ) const;
- /**
- * @copydoc Visual::Base::DoSetProperty
- */
- virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
-
- /**
- * @copydoc Visual::Base::DoGetProperty
- */
- virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
-
protected:
/**
// CLASS HEADER
#include <dali-toolkit/internal/visuals/text/text-visual.h>
-// EXTERNAL HEADER
-#include <dali/devel-api/scripting/enum-helper.h>
-// #include <dali/devel-api/scripting/scripting.h>
-
// INTERNAL HEADER
-#include <dali-toolkit/public-api/text/rendering-backend.h>
-#include <dali-toolkit/public-api/visuals/text-visual-properties.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
-#include <dali-toolkit/internal/text/rendering/text-backend.h>
-#include <dali-toolkit/internal/text/text-view.h>
+#include <dali-toolkit/internal/visuals/image-atlas-manager.h>
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
+#include <dali-toolkit/internal/visuals/visual-string-constants.h>
#include <dali-toolkit/internal/text/text-font-style.h>
-#include <dali-toolkit/internal/text/text-effects-style.h>
-
-using Dali::Toolkit::Text::LayoutEngine;
namespace Dali
{
{
// Property names.
-const char * const RENDERING_BACKEND_PROPERTY( "renderingBackend" );
const char * const TEXT_PROPERTY( "text" );
const char * const FONT_FAMILY_PROPERTY( "fontFamily" );
const char * const FONT_STYLE_PROPERTY( "fontStyle" );
const char * const VERTICAL_ALIGNMENT_PROPERTY( "verticalAlignment" );
const char * const TEXT_COLOR_PROPERTY( "textColor" );
const char * const ENABLE_MARKUP_PROPERTY( "enableMarkup" );
-const char * const ENABLE_AUTO_SCROLL_PROPERTY( "enableAutoScroll" );
-const char * const AUTO_SCROLL_SPEED_PROPERTY( "autoScrollSpeed" );
-const char * const AUTO_SCROLL_LOOP_COUNT_PROPERTY( "autoScrollLoopCount" );
-const char * const AUTO_SCROLL_GAP_PROPERTY( "autoScrollGap" );
-const char * const LINE_SPACING_PROPERTY( "lineSpacing" );
-const char * const UNDERLINE_PROPERTY( "underline" );
-const char * const SHADOW_PROPERTY( "shadow" );
-const char * const OUTLINE_PROPERTY( "outline" );
-const char * const BATCHING_ENABLED_PROPERTY( "batchingEnabled" );
+
+const std::string PIXEL_AREA_UNIFORM_NAME = "pixelArea";
const Scripting::StringEnum HORIZONTAL_ALIGNMENT_STRING_TABLE[] =
{
- { "BEGIN", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_BEGIN },
- { "CENTER", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_CENTER },
- { "END", Toolkit::Text::LayoutEngine::HORIZONTAL_ALIGN_END },
+ { "BEGIN", Toolkit::Text::Layout::HORIZONTAL_ALIGN_BEGIN },
+ { "CENTER", Toolkit::Text::Layout::HORIZONTAL_ALIGN_CENTER },
+ { "END", Toolkit::Text::Layout::HORIZONTAL_ALIGN_END },
};
const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE ) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] );
const Scripting::StringEnum VERTICAL_ALIGNMENT_STRING_TABLE[] =
{
- { "TOP", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_TOP },
- { "CENTER", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_CENTER },
- { "BOTTOM", Toolkit::Text::LayoutEngine::VERTICAL_ALIGN_BOTTOM },
+ { "TOP", Toolkit::Text::Layout::VERTICAL_ALIGN_TOP },
+ { "CENTER", Toolkit::Text::Layout::VERTICAL_ALIGN_CENTER },
+ { "BOTTOM", Toolkit::Text::Layout::VERTICAL_ALIGN_BOTTOM },
};
const unsigned int VERTICAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( VERTICAL_ALIGNMENT_STRING_TABLE ) / sizeof( VERTICAL_ALIGNMENT_STRING_TABLE[0] );
-std::string GetHorizontalAlignment( LayoutEngine::HorizontalAlignment alignment )
+const Vector4 FULL_TEXTURE_RECT( 0.f, 0.f, 1.f, 1.f );
+
+std::string GetHorizontalAlignment( Toolkit::Text::Layout::HorizontalAlignment alignment )
{
- const char* name = Scripting::GetEnumerationName<Toolkit::Text::LayoutEngine::HorizontalAlignment>( alignment,
- HORIZONTAL_ALIGNMENT_STRING_TABLE,
- HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
+ const char* name = Scripting::GetEnumerationName<Toolkit::Text::Layout::HorizontalAlignment>( alignment,
+ HORIZONTAL_ALIGNMENT_STRING_TABLE,
+ HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
return std::string( name );
}
-std::string GetVerticalAlignment( LayoutEngine::VerticalAlignment alignment )
+std::string GetVerticalAlignment( Toolkit::Text::Layout::VerticalAlignment alignment )
{
- const char* name = Scripting::GetEnumerationName< Toolkit::Text::LayoutEngine::VerticalAlignment >( alignment,
- VERTICAL_ALIGNMENT_STRING_TABLE,
- VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
+ const char* name = Scripting::GetEnumerationName< Toolkit::Text::Layout::VerticalAlignment >( alignment,
+ VERTICAL_ALIGNMENT_STRING_TABLE,
+ VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
return std::string( name );
}
uniform mediump vec4 pixelArea;
varying mediump vec2 vTexCoord;\n
\n
+
+ //Visual size and offset
+ uniform mediump vec2 offset;\n
+ uniform mediump vec2 size;\n
+ uniform mediump vec4 offsetSizeMode;\n
+ uniform mediump vec2 origin;\n
+ uniform mediump vec2 anchorPoint;\n
+
+ vec4 ComputeVertexPosition()\n
+ {\n
+ vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );\n
+ vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
+ return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );\n
+ }\n
+
void main()\n
{\n
- mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n
- vertexPosition.xyz *= uSize;\n
- vertexPosition = uMvpMatrix * vertexPosition;\n
- \n
+ mediump vec4 vertexPosition = uMvpMatrix *ComputeVertexPosition();\n
vTexCoord = pixelArea.xy+pixelArea.zw*(aPosition + vec2(0.5) );\n
gl_Position = vertexPosition;\n
}\n
}\n
);
-Geometry CreateGeometry( VisualFactoryCache& factoryCache, ImageDimensions gridSize )
-{
- Geometry geometry;
-
- if( gridSize == ImageDimensions( 1, 1 ) )
- {
- geometry = factoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
- if( !geometry )
- {
- geometry = VisualFactoryCache::CreateQuadGeometry();
- factoryCache.SaveGeometry( VisualFactoryCache::QUAD_GEOMETRY, geometry );
- }
- }
- else
- {
- geometry = VisualFactoryCache::CreateGridGeometry( gridSize );
- }
-
- return geometry;
-}
-
} // unnamed namespace
TextVisualPtr TextVisual::New( VisualFactoryCache& factoryCache )
Property::Value value;
map.Clear();
- map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::TEXT );
-
- map.Insert( Toolkit::TextVisual::Property::RENDERING_BACKEND, mRenderingBackend );
+ map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::DevelVisual::TEXT );
std::string text;
mController->GetText( text );
map.Insert( Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT, GetVerticalAlignment( mController->GetVerticalAlignment() ) );
- map.Insert( Toolkit::TextVisual::Property::TEXT_COLOR, mController->GetTextColor() );
+ map.Insert( Toolkit::TextVisual::Property::TEXT_COLOR, mController->GetDefaultColor() );
map.Insert( Toolkit::TextVisual::Property::ENABLE_MARKUP, mController->IsMarkupProcessorEnabled() );
-
- map.Insert( Toolkit::TextVisual::Property::LINE_SPACING, mController->GetDefaultLineSpacing() );
-
- GetUnderlineProperties( mController, value, Text::EffectStyle::DEFAULT );
- map.Insert( Toolkit::TextVisual::Property::UNDERLINE, value );
-
- GetShadowProperties( mController, value, Text::EffectStyle::DEFAULT );
- map.Insert( Toolkit::TextVisual::Property::SHADOW, value );
-
- GetOutlineProperties( mController, value, Text::EffectStyle::DEFAULT );
- map.Insert( Toolkit::TextVisual::Property::OUTLINE, value );
-
- map.Insert( Toolkit::TextVisual::Property::BATCHING_ENABLED, false ); // TODO
}
TextVisual::TextVisual( VisualFactoryCache& factoryCache )
: Visual::Base( factoryCache ),
mController( Text::Controller::New() ),
- mRenderingBackend( Toolkit::Text::DEFAULT_RENDERING_BACKEND ),
- mHasBeenStaged( false )
+ mTypesetter( Text::Typesetter::New( mController->GetTextModel() ) )
{
}
{
case Property::Key::INDEX:
{
- if( Toolkit::VisualProperty::TYPE != keyValue.first.indexKey ) // Toolkit::VisualProperty::TYPE is not a TextVisual's property.
+ if( Toolkit::DevelVisual::Property::TYPE != keyValue.first.indexKey ) // Toolkit::DevelVisual::Property::TYPE is not a TextVisual's property.
{
- DoSetProperty( keyValue.first.indexKey, keyValue.second );
+ SetProperty( keyValue.first.indexKey, keyValue.second );
}
break;
}
case Property::Key::STRING:
{
- if( keyValue.first.stringKey == RENDERING_BACKEND_PROPERTY )
+ if( keyValue.first.stringKey == TEXT_PROPERTY )
{
- DoSetProperty( Toolkit::TextVisual::Property::RENDERING_BACKEND, keyValue.second );
- }
- else if( keyValue.first.stringKey == TEXT_PROPERTY )
- {
- DoSetProperty( Toolkit::TextVisual::Property::TEXT, keyValue.second );
+ SetProperty( Toolkit::TextVisual::Property::TEXT, keyValue.second );
}
else if( keyValue.first.stringKey == FONT_FAMILY_PROPERTY )
{
- DoSetProperty( Toolkit::TextVisual::Property::FONT_FAMILY, keyValue.second );
+ SetProperty( Toolkit::TextVisual::Property::FONT_FAMILY, keyValue.second );
}
else if( keyValue.first.stringKey == FONT_STYLE_PROPERTY )
{
- DoSetProperty( Toolkit::TextVisual::Property::FONT_STYLE, keyValue.second );
+ SetProperty( Toolkit::TextVisual::Property::FONT_STYLE, keyValue.second );
}
else if( keyValue.first.stringKey == POINT_SIZE_PROPERTY )
{
- DoSetProperty( Toolkit::TextVisual::Property::POINT_SIZE, keyValue.second );
+ SetProperty( Toolkit::TextVisual::Property::POINT_SIZE, keyValue.second );
}
else if( keyValue.first.stringKey == MULTI_LINE_PROPERTY )
{
- DoSetProperty( Toolkit::TextVisual::Property::MULTI_LINE, keyValue.second );
+ SetProperty( Toolkit::TextVisual::Property::MULTI_LINE, keyValue.second );
}
else if( keyValue.first.stringKey == HORIZONTAL_ALIGNMENT_PROPERTY )
{
- DoSetProperty( Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT, keyValue.second );
+ SetProperty( Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT, keyValue.second );
}
else if( keyValue.first.stringKey == VERTICAL_ALIGNMENT_PROPERTY )
{
- DoSetProperty( Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT, keyValue.second );
+ SetProperty( Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT, keyValue.second );
}
else if( keyValue.first.stringKey == TEXT_COLOR_PROPERTY )
{
- DoSetProperty( Toolkit::TextVisual::Property::TEXT_COLOR, keyValue.second );
+ SetProperty( Toolkit::TextVisual::Property::TEXT_COLOR, keyValue.second );
}
else if( keyValue.first.stringKey == ENABLE_MARKUP_PROPERTY )
{
- DoSetProperty( Toolkit::TextVisual::Property::ENABLE_MARKUP, keyValue.second );
- }
- else if( keyValue.first.stringKey == ENABLE_AUTO_SCROLL_PROPERTY )
- {
- DoSetProperty( Toolkit::TextVisual::Property::ENABLE_AUTO_SCROLL, keyValue.second );
- }
- else if( keyValue.first.stringKey == AUTO_SCROLL_SPEED_PROPERTY )
- {
- DoSetProperty( Toolkit::TextVisual::Property::AUTO_SCROLL_SPEED, keyValue.second );
- }
- else if( keyValue.first.stringKey == AUTO_SCROLL_LOOP_COUNT_PROPERTY )
- {
- DoSetProperty( Toolkit::TextVisual::Property::AUTO_SCROLL_LOOP_COUNT, keyValue.second );
- }
- else if( keyValue.first.stringKey == AUTO_SCROLL_GAP_PROPERTY )
- {
- DoSetProperty( Toolkit::TextVisual::Property::AUTO_SCROLL_GAP, keyValue.second );
- }
- else if( keyValue.first.stringKey == LINE_SPACING_PROPERTY )
- {
- DoSetProperty( Toolkit::TextVisual::Property::LINE_SPACING, keyValue.second );
- }
- else if( keyValue.first.stringKey == UNDERLINE_PROPERTY )
- {
- DoSetProperty( Toolkit::TextVisual::Property::UNDERLINE, keyValue.second );
- }
- else if( keyValue.first.stringKey == SHADOW_PROPERTY )
- {
- DoSetProperty( Toolkit::TextVisual::Property::SHADOW, keyValue.second );
- }
- else if( keyValue.first.stringKey == OUTLINE_PROPERTY )
- {
- DoSetProperty( Toolkit::TextVisual::Property::OUTLINE, keyValue.second );
- }
- else if( keyValue.first.stringKey == BATCHING_ENABLED_PROPERTY )
- {
- DoSetProperty( Toolkit::TextVisual::Property::BATCHING_ENABLED, keyValue.second );
+ SetProperty( Toolkit::TextVisual::Property::ENABLE_MARKUP, keyValue.second );
}
break;
}
}
}
- // Retrieve the layout engine to set whether to elide the text and set the cursor's width.
- Text::LayoutEngine& engine = mController->GetLayoutEngine();
-
// Elide the text if it exceeds the boundaries.
- engine.SetTextEllipsisEnabled( true );
+ mController->SetTextElideEnabled( true );
+
+ // Retrieve the layout engine to set the cursor's width.
+ Text::Layout::Engine& engine = mController->GetLayoutEngine();
// Sets 0 as cursor's width.
engine.SetCursorWidth( 0u ); // Do not layout space for the cursor.
void TextVisual::DoSetOnStage( Actor& actor )
{
- // TODO Create the actual renderer(s) for the text!!!!
- // Will crash if no mImpl->mRenderer is set.
- Geometry geometry;
- Shader shader;
+ mControl = actor;
- geometry = CreateGeometry( mFactoryCache, ImageDimensions( 1, 1 ) );
+ CreateRenderer();
+}
- shader = mFactoryCache.GetShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_DEFAULT_WRAP );
- if( !shader )
+void TextVisual::DoSetOffStage( Actor& actor )
+{
+ if( mImpl->mRenderer )
{
- shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_ATLAS_CLAMP );
- mFactoryCache.SaveShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_DEFAULT_WRAP, shader );
- }
+ // Removes the renderer from the actor.
+ actor.RemoveRenderer( mImpl->mRenderer );
- mImpl->mRenderer = Renderer::New( geometry, shader );
-
- mSelf = actor;
-
- if( mHasBeenStaged )
- {
- RenderText();
+ DestroyRenderer();
}
- else
- {
- mHasBeenStaged = true;
- }
-}
-void TextVisual::DoSetOffStage( Actor& actor )
-{
- mSelf.Reset();
+ // Resets the control handle.
+ mControl.Reset();
}
-void TextVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
+void TextVisual::SetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
{
switch( index )
{
- case Toolkit::TextVisual::Property::RENDERING_BACKEND:
- {
- int backend = propertyValue.Get<int>();
-
-#ifndef ENABLE_VECTOR_BASED_TEXT_RENDERING
- if( Text::RENDERING_VECTOR_BASED == backend )
- {
- backend = TextAbstraction::BITMAP_GLYPH; // Fallback to bitmap-based rendering
- }
-#endif
- if( mRenderingBackend != backend )
- {
- mRenderingBackend = backend;
- mRenderer.Reset();
-
- // When using the vector-based rendering, the size of the GLyphs are different
- TextAbstraction::GlyphType glyphType = ( Text::RENDERING_VECTOR_BASED == mRenderingBackend ) ? TextAbstraction::VECTOR_GLYPH : TextAbstraction::BITMAP_GLYPH;
- mController->SetGlyphType( glyphType );
- }
- break;
- }
case Toolkit::TextVisual::Property::TEXT:
{
mController->SetText( propertyValue.Get<std::string>() );
}
case Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT:
{
- LayoutEngine::HorizontalAlignment alignment( LayoutEngine::HORIZONTAL_ALIGN_BEGIN );
- if( Scripting::GetEnumeration< Toolkit::Text::LayoutEngine::HorizontalAlignment >( propertyValue.Get< std::string >().c_str(),
- HORIZONTAL_ALIGNMENT_STRING_TABLE,
- HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT,
- alignment ) )
+ Toolkit::Text::Layout::HorizontalAlignment alignment( Toolkit::Text::Layout::HORIZONTAL_ALIGN_BEGIN );
+ if( Scripting::GetEnumeration< Toolkit::Text::Layout::HorizontalAlignment >( propertyValue.Get< std::string >().c_str(),
+ HORIZONTAL_ALIGNMENT_STRING_TABLE,
+ HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT,
+ alignment ) )
{
mController->SetHorizontalAlignment( alignment );
}
}
case Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT:
{
- LayoutEngine::VerticalAlignment alignment( LayoutEngine::VERTICAL_ALIGN_BOTTOM );
- if( Scripting::GetEnumeration< Toolkit::Text::LayoutEngine::VerticalAlignment >( propertyValue.Get< std::string >().c_str(),
- VERTICAL_ALIGNMENT_STRING_TABLE,
- VERTICAL_ALIGNMENT_STRING_TABLE_COUNT,
- alignment ) )
+ Toolkit::Text::Layout::VerticalAlignment alignment( Toolkit::Text::Layout::VERTICAL_ALIGN_BOTTOM );
+ if( Scripting::GetEnumeration< Toolkit::Text::Layout::VerticalAlignment >( propertyValue.Get< std::string >().c_str(),
+ VERTICAL_ALIGNMENT_STRING_TABLE,
+ VERTICAL_ALIGNMENT_STRING_TABLE_COUNT,
+ alignment ) )
{
mController->SetVerticalAlignment( alignment );
}
}
case Toolkit::TextVisual::Property::TEXT_COLOR:
{
- const Vector4 textColor = propertyValue.Get< Vector4 >();
- if( mController->GetTextColor() != textColor )
+ const Vector4& textColor = propertyValue.Get< Vector4 >();
+ if( mController->GetDefaultColor() != textColor )
{
- mController->SetTextColor( textColor );
- mRenderer.Reset();
+ mController->SetDefaultColor( textColor );
}
break;
}
mController->SetMarkupProcessorEnabled( enableMarkup );
break;
}
- case Toolkit::TextVisual::Property::ENABLE_AUTO_SCROLL:
- {
- // nothing to do.
- break;
- }
- case Toolkit::TextVisual::Property::AUTO_SCROLL_SPEED:
- {
- // nothing to do.
- break;
- }
- case Toolkit::TextVisual::Property::AUTO_SCROLL_LOOP_COUNT:
- {
- // nothing to do.
- break;
- }
- case Toolkit::TextVisual::Property::AUTO_SCROLL_GAP:
- {
- // nothing to do.
- break;
- }
- case Toolkit::TextVisual::Property::LINE_SPACING:
- {
- const float lineSpacing = propertyValue.Get<float>();
- mController->SetDefaultLineSpacing( lineSpacing );
- mRenderer.Reset();
- break;
- }
- case Toolkit::TextVisual::Property::UNDERLINE:
- {
- // TODO : This switch can be removed when the deprecated SHADOW_OFFSET and SHADOW_COLOR properties are finally removed.
- // Only the code for the MAP case should be kept.
- switch( propertyValue.GetType() )
- {
- case Property::VECTOR4:
- {
- const Vector4 color = propertyValue.Get<Vector4>();
- if( mController->GetUnderlineColor() != color )
- {
- mController->SetUnderlineColor( color );
- mRenderer.Reset();
- }
- break;
- }
- case Property::FLOAT:
- {
- float height = propertyValue.Get<float>();
- if( fabsf( mController->GetUnderlineHeight() - height ) > Math::MACHINE_EPSILON_1000 )
- {
- mController->SetUnderlineHeight( height );
- mRenderer.Reset();
- }
- break;
- }
- case Property::BOOLEAN:
- {
- const bool enabled = propertyValue.Get<bool>();
- if( mController->IsUnderlineEnabled() != enabled )
- {
- mController->SetUnderlineEnabled( enabled );
- mRenderer.Reset();
- }
- break;
- }
- case Property::MAP:
- {
- const bool update = SetUnderlineProperties( mController, propertyValue, Text::EffectStyle::DEFAULT );
- if( update )
- {
- mRenderer.Reset();
- }
- break;
- }
- default:
- {
- // Nothing to do.
- break;
- }
- }
-
- break;
- }
- case Toolkit::TextVisual::Property::SHADOW:
- {
- // TODO : This switch can be removed when the deprecated SHADOW_OFFSET and SHADOW_COLOR properties are finally removed.
- // Only the code for the MAP case should be kept.
- switch( propertyValue.GetType() )
- {
- case Property::VECTOR2:
- {
- const Vector2 shadowOffset = propertyValue.Get<Vector2>();
- if( mController->GetShadowOffset() != shadowOffset )
- {
- mController->SetShadowOffset( shadowOffset );
- mRenderer.Reset();
- }
- break;
- }
- case Property::VECTOR4:
- {
- const Vector4 shadowColor = propertyValue.Get<Vector4>();
- if( mController->GetShadowColor() != shadowColor )
- {
- mController->SetShadowColor( shadowColor );
- mRenderer.Reset();
- }
- break;
- }
- case Property::MAP:
- {
- const bool update = SetShadowProperties( mController, propertyValue, Text::EffectStyle::DEFAULT );
- if( update )
- {
- mRenderer.Reset();
- }
- break;
- }
- default:
- {
- // Nothing to do.
- break;
- }
- }
- break;
- }
- case Toolkit::TextVisual::Property::EMBOSS:
- {
- const bool update = SetEmbossProperties( mController, propertyValue, Text::EffectStyle::DEFAULT );
- if( update )
- {
- mRenderer.Reset();
- }
- break;
- }
- case Toolkit::TextVisual::Property::OUTLINE:
- {
- const bool update = SetOutlineProperties( mController, propertyValue, Text::EffectStyle::DEFAULT );
- if( update )
- {
- mRenderer.Reset();
- }
- break;
- }
- case Toolkit::TextVisual::Property::BATCHING_ENABLED:
- {
- // TODO
- break;
- }
default:
{
// Should not arrive here.
}
}
-Dali::Property::Value TextVisual::DoGetProperty( Dali::Property::Index index )
+void TextVisual::OnSetTransform()
{
- Dali::Property::Value value;
+ CreateRenderer();
+}
- switch( index )
+void TextVisual::CreateRenderer()
+{
+ Actor control = mControl.GetHandle();
+ if( !control )
{
- case Toolkit::TextVisual::Property::RENDERING_BACKEND:
- {
- value = mRenderingBackend;
- break;
- }
- case Toolkit::TextVisual::Property::TEXT:
- {
- std::string text;
- mController->GetText( text );
- value = text;
- break;
- }
- case Toolkit::TextVisual::Property::FONT_FAMILY:
- {
- value = mController->GetDefaultFontFamily();
- break;
- }
- case Toolkit::TextVisual::Property::FONT_STYLE:
- {
- GetFontStyleProperty( mController, value, Text::FontStyle::DEFAULT );
- break;
- }
- case Toolkit::TextVisual::Property::POINT_SIZE:
+ // Nothing to do.
+ return;
+ }
+
+ // Calculates the size to be used to relayout.
+ Vector2 relayoutSize;
+
+ const bool isWidthRelative = fabsf( mImpl->mTransform.mOffsetSizeMode.z ) < Math::MACHINE_EPSILON_1000;
+ const bool isHeightRelative = fabsf( mImpl->mTransform.mOffsetSizeMode.w ) < Math::MACHINE_EPSILON_1000;
+
+ // Round the size and offset to avoid pixel alignement issues.
+ relayoutSize.width = floorf( 0.5f + ( isWidthRelative ? mImpl->mControlSize.width * mImpl->mTransform.mSize.x : mImpl->mTransform.mSize.width ) );
+ relayoutSize.height = floorf( 0.5f + ( isHeightRelative ? mImpl->mControlSize.height * mImpl->mTransform.mSize.y : mImpl->mTransform.mSize.height ) );
+
+ if( ( fabsf( relayoutSize.width ) < Math::MACHINE_EPSILON_1000 ) || ( fabsf( relayoutSize.height ) < Math::MACHINE_EPSILON_1000 ) )
+ {
+ // Remove any renderer previously set.
+ if( mImpl->mRenderer )
{
- value = mController->GetDefaultPointSize();
- break;
+ control.RemoveRenderer( mImpl->mRenderer );
+
+ DestroyRenderer();
}
- case Toolkit::TextVisual::Property::MULTI_LINE:
+
+ // Nothing else to do if the relayout size is zero.
+ return;
+ }
+
+ const Text::Controller::UpdateTextType updateTextType = mController->Relayout( relayoutSize );
+
+ if( Text::Controller::NONE_UPDATED != ( Text::Controller::MODEL_UPDATED & updateTextType ) )
+ {
+ // Remove any renderer previously set.
+ if( mImpl->mRenderer )
{
- value = mController->IsMultiLineEnabled();
- break;
+ control.RemoveRenderer( mImpl->mRenderer );
+
+ DestroyRenderer();
}
- case Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT:
+
+ if( ( relayoutSize.width > Math::MACHINE_EPSILON_1000 ) &&
+ ( relayoutSize.height > Math::MACHINE_EPSILON_1000 ) )
{
- const char* name = Scripting::GetEnumerationName< Toolkit::Text::LayoutEngine::HorizontalAlignment >( mController->GetHorizontalAlignment(),
- HORIZONTAL_ALIGNMENT_STRING_TABLE,
- HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT );
- if( name )
+ PixelData data = mTypesetter->Render( relayoutSize );
+
+ Geometry geometry;
+ Shader shader;
+ TextureSet textureSet;
+
+ Vector4 atlasRect;
+
+ textureSet = mFactoryCache.GetAtlasManager()->Add( atlasRect, data );
+ mImpl->mFlags |= Impl::IS_ATLASING_APPLIED;
+
+ // Filter mode needs to be set to nearest to avoid blurry text.
+ Sampler sampler = Sampler::New();
+ sampler.SetFilterMode( FilterMode::NEAREST, FilterMode::NEAREST );
+ textureSet.SetSampler( 0u, sampler );
+
+ geometry = mFactoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
+ if( !geometry )
{
- value = std::string( name );
+ geometry = VisualFactoryCache::CreateQuadGeometry();
+ mFactoryCache.SaveGeometry( VisualFactoryCache::QUAD_GEOMETRY , geometry );
}
- break;
- }
- case Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT:
- {
- const char* name = Scripting::GetEnumerationName< Toolkit::Text::LayoutEngine::VerticalAlignment >( mController->GetVerticalAlignment(),
- VERTICAL_ALIGNMENT_STRING_TABLE,
- VERTICAL_ALIGNMENT_STRING_TABLE_COUNT );
- if( name )
+
+ shader = mFactoryCache.GetShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_DEFAULT_WRAP );
+ if( !shader )
{
- value = std::string( name );
+ shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER_ATLAS_CLAMP );
+ mFactoryCache.SaveShader( VisualFactoryCache::IMAGE_SHADER_ATLAS_DEFAULT_WRAP, shader );
}
- break;
- }
- case Toolkit::TextVisual::Property::TEXT_COLOR:
- {
- value = mController->GetTextColor();
- break;
- }
- case Toolkit::TextVisual::Property::ENABLE_MARKUP:
- {
- value = mController->IsMarkupProcessorEnabled();
- break;
- }
- case Toolkit::TextVisual::Property::ENABLE_AUTO_SCROLL:
- {
- // nothing to do.
- break;
- }
- case Toolkit::TextVisual::Property::AUTO_SCROLL_SPEED:
- {
- // nothing to do.
- break;
- }
- case Toolkit::TextVisual::Property::AUTO_SCROLL_LOOP_COUNT:
- {
- // nothing to do.
- break;
- }
- case Toolkit::TextVisual::Property::AUTO_SCROLL_GAP:
- {
- // nothing to do.
- break;
- }
- case Toolkit::TextVisual::Property::LINE_SPACING:
- {
- value = mController->GetDefaultLineSpacing();
- break;
- }
- case Toolkit::TextVisual::Property::UNDERLINE:
- {
- GetUnderlineProperties( mController, value, Text::EffectStyle::DEFAULT );
- break;
- }
- case Toolkit::TextVisual::Property::SHADOW:
- {
- GetShadowProperties( mController, value, Text::EffectStyle::DEFAULT );
- break;
- }
- case Toolkit::TextVisual::Property::EMBOSS:
- {
- GetEmbossProperties( mController, value, Text::EffectStyle::DEFAULT );
- break;
- }
- case Toolkit::TextVisual::Property::OUTLINE:
- {
- GetOutlineProperties( mController, value, Text::EffectStyle::DEFAULT );
- break;
- }
- case Toolkit::TextVisual::Property::BATCHING_ENABLED:
- {
- // TODO
- break;
- }
- default:
- {
- // Should not arrive here.
- DALI_ASSERT_DEBUG( false );
- }
- }
+ shader.RegisterProperty( PIXEL_AREA_UNIFORM_NAME, FULL_TEXTURE_RECT );
- return value;
-}
+ mImpl->mRenderer = Renderer::New( geometry, shader );
+ mImpl->mRenderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, Toolkit::DepthIndex::TEXT );
+ mImpl->mRenderer.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, atlasRect );
-void TextVisual::OnSetTransform()
-{
- Vector2 visualSize = mImpl->mTransform.GetVisualSize( mImpl->mControlSize );
+ mImpl->mRenderer.SetTextures( textureSet );
- // Note, the direction should come from the layout of the parent control
- mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
+ control.AddRenderer( mImpl->mRenderer );
- const Text::Controller::UpdateTextType updateTextType = mController->Relayout( visualSize );
+ //Register transform properties
+ mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
- if( ( Text::Controller::NONE_UPDATED != ( Text::Controller::MODEL_UPDATED & updateTextType ) ) ||
- !mRenderer )
- {
- if( !mRenderer )
- {
- mRenderer = Text::Backend::Get().NewRenderer( mRenderingBackend );
+ mImpl->mFlags |= Impl::IS_FROM_CACHE;
}
- RenderText();
}
}
-void TextVisual::RenderText()
+void TextVisual::DestroyRenderer()
{
- Actor self = mSelf.GetHandle();
- if( !self )
- {
- // Nothing to do if the handle is not initialized.
- return;
- }
-
- Actor renderableActor;
+ // Removes the text's image from the texture atlas.
+ Vector4 atlasRect;
- if( mRenderer )
+ const Property::Index index = mImpl->mRenderer.GetPropertyIndex( ATLAS_RECT_UNIFORM_NAME );
+ if( index != Property::INVALID_INDEX )
{
- renderableActor = mRenderer->Render( mController->GetView(), Toolkit::DepthIndex::TEXT );
- }
-
- if( renderableActor != mRenderableActor )
- {
- UnparentAndReset( mRenderableActor );
+ const Property::Value& atlasRectValue = mImpl->mRenderer.GetProperty( index );
+ atlasRectValue.Get( atlasRect );
- if( renderableActor )
- {
- const Vector2& scrollOffset = mController->GetScrollPosition();
- renderableActor.SetPosition( scrollOffset.x, scrollOffset.y );
-
- self.Add( renderableActor );
- }
- mRenderableActor = renderableActor;
+ const TextureSet& textureSet = mImpl->mRenderer.GetTextures();
+ mFactoryCache.GetAtlasManager()->Remove( textureSet, atlasRect );
}
+
+ // Resets the renderer.
+ mImpl->mRenderer.Reset();
}
} // namespace Internal
*
*/
-// EXTERNAL INCLUDES
-#include <dali/devel-api/object/weak-handle.h>
-#include <dali/public-api/common/intrusive-ptr.h>
-
// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
-#include <dali-toolkit/internal/text/rendering/text-renderer.h>
+#include <dali-toolkit/internal/text/rendering/text-typesetter.h>
#include <dali-toolkit/internal/text/text-controller.h>
namespace Dali
virtual void DoSetOffStage( Actor& actor );
/**
- *@copydoc Visual::Base::DoSetProperty
+ * @copydoc Visual::Base::OnSetTransform
*/
- virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
+ virtual void OnSetTransform();
+
+private:
/**
- * @copydoc Visual::Base::DoGetProperty
+ * Set the individual property to the given value
+ * @param[in] index The index key used to reference this value within the initial
+ * property map.
+ * @param[in] propertyValue The value to set
*/
- virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
+ void SetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
/**
- * @copydoc Visual::Base::OnSetTransform
+ * @brief Creates the text's renderer.
*/
- virtual void OnSetTransform();
-
-private:
+ void CreateRenderer();
/**
- * @brief Render view, create and attach actor(s) to this TextView.
- * @todo In a next patch a new text render back-end won't add extra actors.
+ * @brief Destroys the text's renderer.
*/
- void RenderText();
+ void DestroyRenderer();
private:
- Text::ControllerPtr mController; ///< The text's controller.
- WeakHandle<Actor> mSelf;
-
- Text::RendererPtr mRenderer;
- Actor mRenderableActor;
-
- int mRenderingBackend;
- bool mHasBeenStaged : 1;
+ Text::ControllerPtr mController; ///< The text's controller.
+ Text::TypesetterPtr mTypesetter; ///< The text's typesetter.
+ WeakHandle<Actor> mControl; ///< The control where the renderer is added.
};
} // namespace Internal
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
namespace Dali
customShader.Insert( Toolkit::Visual::Shader::Property::HINTS, static_cast< int >( mHints ) );
}
- map.Insert( Toolkit::VisualProperty::SHADER, customShader );
+ map.Insert( Toolkit::DevelVisual::Property::SHADER, customShader );
}
}
for( Property::Map::SizeType i(0); i<map.Count(); ++i )
{
KeyValuePair keyValue = map.GetKeyValue( i );
- if( keyValue.first == Toolkit::Visual::DevelProperty::Transform::Property::OFFSET )
+ if( keyValue.first == Toolkit::DevelVisual::Transform::Property::OFFSET )
{
keyValue.second.Get( mOffset );
}
- else if( keyValue.first == Toolkit::Visual::DevelProperty::Transform::Property::SIZE )
+ else if( keyValue.first == Toolkit::DevelVisual::Transform::Property::SIZE )
{
keyValue.second.Get( mSize );
}
- else if( keyValue.first == Toolkit::Visual::DevelProperty::Transform::Property::ORIGIN )
+ else if( keyValue.first == Toolkit::DevelVisual::Transform::Property::ORIGIN )
{
Toolkit::Align::Type align(Toolkit::Align::CENTER);
if( Scripting::GetEnumerationProperty< Toolkit::Align::Type >( keyValue.second, ALIGN_TABLE, ALIGN_TABLE_COUNT, align ) )
mOrigin = align;
}
}
- else if( keyValue.first == Toolkit::Visual::DevelProperty::Transform::Property::ANCHOR_POINT )
+ else if( keyValue.first == Toolkit::DevelVisual::Transform::Property::ANCHOR_POINT )
{
Toolkit::Align::Type align(Toolkit::Align::CENTER);
if( Scripting::GetEnumerationProperty< Toolkit::Align::Type >( keyValue.second, ALIGN_TABLE, ALIGN_TABLE_COUNT, align ) )
mAnchorPoint = align;
}
}
- else if( keyValue.first == Toolkit::Visual::DevelProperty::Transform::Property::OFFSET_SIZE_MODE )
+ else if( keyValue.first == Toolkit::DevelVisual::Transform::Property::OFFSET_SIZE_MODE )
{
keyValue.second.Get( mOffsetSizeMode );
}
void Internal::Visual::Base::Impl::Transform::GetPropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Add( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET, mOffset )
- .Add( Toolkit::Visual::DevelProperty::Transform::Property::SIZE, mSize )
- .Add( Toolkit::Visual::DevelProperty::Transform::Property::ORIGIN, mOrigin )
- .Add( Toolkit::Visual::DevelProperty::Transform::Property::ANCHOR_POINT, mAnchorPoint )
- .Add( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET_SIZE_MODE, mOffsetSizeMode );
+ map.Add( Toolkit::DevelVisual::Transform::Property::OFFSET, mOffset )
+ .Add( Toolkit::DevelVisual::Transform::Property::SIZE, mSize )
+ .Add( Toolkit::DevelVisual::Transform::Property::ORIGIN, mOrigin )
+ .Add( Toolkit::DevelVisual::Transform::Property::ANCHOR_POINT, mAnchorPoint )
+ .Add( Toolkit::DevelVisual::Transform::Property::OFFSET_SIZE_MODE, mOffsetSizeMode );
}
void Internal::Visual::Base::Impl::Transform::RegisterUniforms( Dali::Renderer renderer, Toolkit::Direction::Type direction )
#include <dali/integration-api/debug.h>
//INTERNAL HEARDER
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
void Visual::Base::SetProperties( const Property::Map& propertyMap )
{
- Property::Value* customShaderValue = propertyMap.Find( VisualProperty::SHADER, CUSTOM_SHADER );
+ Property::Value* customShaderValue = propertyMap.Find( DevelVisual::Property::SHADER, CUSTOM_SHADER );
if( customShaderValue )
{
Property::Map shaderMap;
}
}
- Property::Value* transform = propertyMap.Find( Toolkit::Visual::DevelProperty::TRANSFORM, TRANSFORM );
+ Property::Value* transform = propertyMap.Find( DevelVisual::Property::TRANSFORM, TRANSFORM );
if( transform )
{
Property::Map map;
Property::Map transform;
mImpl->mTransform.GetPropertyMap( transform );
- map.Insert( Toolkit::Visual::DevelProperty::TRANSFORM, transform );
+ map.Insert( DevelVisual::Property::TRANSFORM, transform );
}
void Visual::Base::EnablePreMultipliedAlpha( bool preMultipled )
return mImpl->mFlags & Impl::IS_FROM_CACHE;
}
-void Visual::Base::SetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
-{
- DALI_ASSERT_ALWAYS( ( index > Property::INVALID_INDEX ) &&
- ( index > VISUAL_PROPERTY_BASE_START_INDEX ) && // Change the type of visual is not allowed.
- "Property index is out of bounds" );
-
- if( index < VISUAL_PROPERTY_START_INDEX )
- {
- if( index == Dali::Toolkit::Visual::DevelProperty::TRANSFORM )
- {
- Property::Map* transformMap = propertyValue.GetMap();
- if( transformMap )
- {
- SetTransformAndSize( *transformMap, mImpl->mControlSize );
- }
- }
-
- // TODO set the properties of the visual base.
- }
- else
- {
- DoSetProperty( index, propertyValue );
- }
-}
-
-Dali::Property::Value Visual::Base::GetProperty( Dali::Property::Index index )
-{
- DALI_ASSERT_ALWAYS( ( index > Property::INVALID_INDEX ) &&
- ( index >= VISUAL_PROPERTY_BASE_START_INDEX ) &&
- "Property index is out of bounds" );
-
- Dali::Property::Value value;
-
- if( index < VISUAL_PROPERTY_START_INDEX )
- {
- if( index == Dali::Toolkit::Visual::DevelProperty::TRANSFORM )
- {
- Property::Map map;
- mImpl->mTransform.GetPropertyMap( map );
- return map;
- }
- // TODO retrieve the properties of the visual base.
- }
- else
- {
- value = DoGetProperty( index );
- }
-
- return value;
-}
-
} // namespace Internal
} // namespace Toolkit
*/
bool IsFromCache() const;
-protected:
- /**
- * @brief Called by SetProperty(). To be overriden by derived clases in order to set properties.
- *
- * @param [in] index The index of the property.
- * @param [in] propertyValue The new value of the property.
- */
- virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue ) = 0;
-
- /**
- * @brief Called by GetProperty(). To be overriden by derived classes in order to retrieve properties.
- *
- * @param [in] index The index of the property.
- *
- * @return The property value.
- */
- virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index ) = 0;
-
private:
// Undefined
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/border/border-visual.h>
#include <dali-toolkit/internal/visuals/color/color-visual.h>
#include <dali-toolkit/internal/visuals/gradient/gradient-visual.h>
}
else
{
- Property::Value* typeValue = propertyMap.Find( Toolkit::VisualProperty::TYPE, VISUAL_TYPE );
- Toolkit::Visual::Type visualType = Toolkit::Visual::IMAGE; // Default to IMAGE type.
+ Property::Value* typeValue = propertyMap.Find( Toolkit::DevelVisual::Property::TYPE, VISUAL_TYPE );
+ Toolkit::DevelVisual::Type visualType = Toolkit::DevelVisual::IMAGE; // Default to IMAGE type.
if( typeValue )
{
Scripting::GetEnumerationProperty( *typeValue, VISUAL_TYPE_TABLE, VISUAL_TYPE_TABLE_COUNT, visualType );
break;
}
- case Toolkit::Visual::TEXT:
+ case Toolkit::DevelVisual::TEXT:
{
visualPtr = TextVisual::New( *( mFactoryCache.Get() ) );
break;
#include "wireframe-visual.h"
// INTERNAL INCLUDES
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
void WireframeVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::WIREFRAME );
-}
-
-void WireframeVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
-{
- // TODO
-}
-
-Dali::Property::Value WireframeVisual::DoGetProperty( Dali::Property::Index index )
-{
- // TODO
- return Dali::Property::Value();
+ map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::WIREFRAME );
}
void WireframeVisual::InitializeRenderer()
virtual void DoCreatePropertyMap( Property::Map& map ) const;
/**
- * @copydoc Visual::Base::DoSetProperty
- */
- virtual void DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue );
-
- /**
- * @copydoc Visual::Base::DoGetProperty
- */
- virtual Dali::Property::Value DoGetProperty( Dali::Property::Index index );
-
- /**
* @copydoc Visual::Base::OnSetTransform
*/
virtual void OnSetTransform();
#include <dali-toolkit/public-api/styling/style-manager.h>
#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
#include <dali-toolkit/internal/styling/style-manager-impl.h>
{
propertyMap.Clear();
propertyMap
- .Add( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET, Vector2(0.0f, 0.0f) )
- .Add( Toolkit::Visual::DevelProperty::Transform::Property::SIZE, Vector2(1.0f, 1.0f) )
- .Add( Toolkit::Visual::DevelProperty::Transform::Property::ORIGIN, Toolkit::Align::CENTER )
- .Add( Toolkit::Visual::DevelProperty::Transform::Property::ANCHOR_POINT, Toolkit::Align::CENTER )
- .Add( Toolkit::Visual::DevelProperty::Transform::Property::OFFSET_SIZE_MODE, Vector4::ZERO );
+ .Add( Toolkit::DevelVisual::Transform::Property::OFFSET, Vector2(0.0f, 0.0f) )
+ .Add( Toolkit::DevelVisual::Transform::Property::SIZE, Vector2(1.0f, 1.0f) )
+ .Add( Toolkit::DevelVisual::Transform::Property::ORIGIN, Toolkit::Align::CENTER )
+ .Add( Toolkit::DevelVisual::Transform::Property::ANCHOR_POINT, Toolkit::Align::CENTER )
+ .Add( Toolkit::DevelVisual::Transform::Property::OFFSET_SIZE_MODE, Vector4::ZERO );
}
/**
{
mImpl->mBackgroundColor = color;
Property::Map map;
- map[ Toolkit::VisualProperty::TYPE ] = Toolkit::Visual::COLOR;
+ map[ Toolkit::DevelVisual::Property::TYPE ] = Toolkit::Visual::COLOR;
map[ Toolkit::ColorVisual::Property::MIX_COLOR ] = color;
SetBackground( map );
* If the string is empty, ImageView will not display anything.
*
* @SINCE_1_0.0
+ * @REMARK_INTERNET
+ * @REMARK_STORAGE
* @param[in] url The url of the image resource to display.
* @return A handle to a newly allocated ImageView.
*/
* If the string is empty, ImageView will not display anything.
*
* @SINCE_1_1.10
+ * @REMARK_INTERNET
+ * @REMARK_STORAGE
* @param[in] url The url of the image resource to display.
* @param [in] size The width and height to which to fit the loaded image.
* @return A handle to a newly allocated ImageView.
* If the URL is empty, ImageView will not display anything.
*
* @SINCE_1_1.4
+ * @REMARK_INTERNET
+ * @REMARK_STORAGE
* @param[in] url The URL to the image resource to display.
*/
void SetImage( const std::string& url );
* If the URL is empty, ImageView will not display anything.
*
* @SINCE_1_1.10
+ * @REMARK_INTERNET
+ * @REMARK_STORAGE
* @param[in] url The URL to the image resource to display.
* @param [in] size The width and height to fit the loaded image to.
*/
* If the string is empty, VideoView will not display anything
*
* @SINCE_1_1.38
+ * @REMARK_INTERNET
+ * @REMARK_STORAGE
* @param[in] url The url of the video resource to display
* @return A handle to a newly allocated Dali VideoView
*/
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 15;
+const unsigned int TOOLKIT_MICRO_VERSION = 16;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
$(public_api_src_dir)/visuals/image-visual-properties.h \
$(public_api_src_dir)/visuals/mesh-visual-properties.h \
$(public_api_src_dir)/visuals/primitive-visual-properties.h \
- $(public_api_src_dir)/visuals/text-visual-properties.h \
$(public_api_src_dir)/visuals/visual-properties.h
* orientationCorrection = true
*
* @SINCE_1_2_14
+ * @REMARK_INTERNET
+ * @REMARK_STORAGE
*
* @param[in] url The URL of the image file to load.
* @return The loading task id.
* orientationCorrection = true
*
* @SINCE_1_2_14
+ * @REMARK_INTERNET
+ * @REMARK_STORAGE
*
* @param[in] url The URL of the image file to load.
* @param[in] dimensions The width and height to fit the loaded image to.
/**
* @brief Start an image loading task.
* @SINCE_1_2_14
+ * @REMARK_INTERNET
+ * @REMARK_STORAGE
*
* @param[in] url The URL of the image file to load.
* @param[in] dimensions The width and height to fit the loaded image to.
// CLASS HEADER
#include "sync-image-loader.h"
-#include <dali/devel-api/adaptor-framework/bitmap-loader.h>
+#include <dali/devel-api/adaptor-framework/image-loading.h>
namespace Dali
SamplingMode::Type samplingMode,
bool orientationCorrection )
{
- BitmapLoader loader = BitmapLoader::New( url, dimensions, fittingMode, samplingMode, orientationCorrection );
-
// Load the image synchronously (block the thread here).
- loader.Load();
-
- return loader.GetPixelData();
+ return Dali::LoadImageFromFile( url, dimensions, fittingMode, samplingMode, orientationCorrection );
}
* orientationCorrection = true
*
* @SINCE_1_2_14
+ * @REMARK_INTERNET
+ * @REMARK_STORAGE
*
* @param[in] url The URL of the image file to load.
* @return A PixelData object containing the image, or an invalid object on failure.
* orientationCorrection = true
*
* @SINCE_1_2_14
+ * @REMARK_INTERNET
+ * @REMARK_STORAGE
*
* @param[in] url The URL of the image file to load.
* @param[in] dimensions The width and height to fit the loaded image to.
/**
* @brief Load an image synchronously by specifying the target dimensions and options.
* @SINCE_1_2_14
+ * @REMARK_INTERNET
+ * @REMARK_STORAGE
*
* @param[in] url The URL of the image file to load.
* @param[in] dimensions The width and height to fit the loaded image to.
+++ /dev/null
-#ifndef DALI_TOOLKIT_TEXT_VISUAL_PROPERTIES_H
-#define DALI_TOOLKIT_TEXT_VISUAL_PROPERTIES_H
-
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali-toolkit/public-api/toolkit-property-index-ranges.h>
-
-namespace Dali
-{
-
-namespace Toolkit
-{
-
-namespace TextVisual
-{
-
-namespace Property
-{
-
-enum
-{
- /**
- * @brief The type of rendering e.g. bitmap-based
- * @details name "renderingBackend", type INTEGER, default RENDERING_SHARED_ATLAS
- * @SINCE_1_2.11
- */
- RENDERING_BACKEND = VISUAL_PROPERTY_START_INDEX,
-
- /**
- * @brief The text to display in UTF-8 format,
- * @details name "text", type STRING
- * @SINCE_1_2.11
- */
- TEXT,
-
- /**
- * @brief The requested font family to use,
- * @details name "fontFamily", type STRING
- * @SINCE_1_2.11
- */
- FONT_FAMILY,
-
- /**
- * @brief The requested font style to use,
- * @details name "fontStyle", type STRING or MAP
- * @SINCE_1_2.13
- */
- FONT_STYLE,
-
- /**
- * @brief The size of font in points
- * @details name "pointSize", type FLOAT
- * @SINCE_1_2.11
- */
- POINT_SIZE,
-
- /**
- * @brief The single-line or multi-line layout option
- * @details name "multiLine", type BOOLEAN, default false
- * @SINCE_1_2.11
- */
- MULTI_LINE,
-
- /**
- * @brief The line horizontal alignment
- * @details name "horizontalAlignment", type STRING, values "BEGIN", "CENTER", "END", default BEGIN
- * @SINCE_1_2.11
- */
- HORIZONTAL_ALIGNMENT,
-
- /**
- * @brief The line vertical alignment
- * @details name "verticalAlignment", type STRING, values "TOP", "CENTER", "BOTTOM", default TOP
- * @SINCE_1_2.11
- */
- VERTICAL_ALIGNMENT,
-
- /**
- * @brief The color of the text
- * @details name "textColor", type VECTOR4
- * @SINCE_1_2.11
- */
- TEXT_COLOR,
-
- /**
- * @brief Whether the mark-up processing is enabled
- * @details name "enableMarkup", type BOOLEAN
- * @SINCE_1_2.11
- */
- ENABLE_MARKUP,
-
- /**
- * @brief Start or stop auto scrolling,
- * @details name "enableAutoScroll", type BOOLEAN, default is false
- * @SINCE_1_2.11
- */
- ENABLE_AUTO_SCROLL,
-
- /**
- * @brief Sets the speed of scrolling in pixels per second,
- * @details name "autoScrollSpeed", type INTEGER, default in style sheet
- * @SINCE_1_2.11
- */
- AUTO_SCROLL_SPEED,
-
- /**
- * @brief Number of complete loops when scrolling enabled
- * @details name "autoScrollLoopCount", type INTEGER, default in style sheet
- * @SINCE_1_2.11
- */
- AUTO_SCROLL_LOOP_COUNT,
-
- /**
- * @brief Gap before before scrolling wraps
- * @details name "autoScrollGap", type INTEGER, default in style sheet but can be overridden to prevent same text being show at start and end.
- * @SINCE_1_2.11
- */
- AUTO_SCROLL_GAP,
-
- /**
- * @brief The default extra space between lines in points.
- * @details name "lineSpacing", type FLOAT.
- * @SINCE_1_2.11
- */
- LINE_SPACING,
-
- /**
- * @brief The default underline parameters.
- * @details name "underline", type STRING or MAP.
- * @SINCE_1_2.13
- */
- UNDERLINE,
-
- /**
- * @brief The default shadow parameters.
- * @details name "shadow", type STRING or MAP.
- * @SINCE_1_2.13
- */
- SHADOW,
-
- /**
- * @brief The default emboss parameters.
- * @details name "emboss", type STRING or MAP.
- * @SINCE_1_2.13
- */
- EMBOSS,
-
- /**
- * @brief The default outline parameters.
- * @details name "outline", type STRING or MAP.
- * @SINCE_1_2.13
- */
- OUTLINE,
-
- /**
- * @brief This enables Text visuals to automatically be converted to Batch-Text visuals.
- * @details Name "batchingEnabled", type Property::BOOLEAN.
- * @SINCE_1_2.11
- * @note Optional. If not specified, the default is false.
- */
- BATCHING_ENABLED,
-};
-
-} // namespace Property
-
-} // namespace TextVisual
-
-} // namespace Toolkit
-
-} // namespace Dali
-
-#endif // DALI_TOOLKIT_TEXT_VISUAL_PROPERTIES_H
IMAGE, ///< Renders an image into the control's quad. @SINCE_1_1.45
MESH, ///< Renders a mesh using an "obj" file, optionally with textures provided by an "mtl" file. @SINCE_1_1.45
PRIMITIVE, ///< Renders a simple 3D shape, such as a cube or sphere. @SINCE_1_1.45
- WIREFRAME, ///< Renders a simple wire-frame outlining a quad. @SINCE_1_2_2
- TEXT, ///< Renders text. @SINCE_1_2.11
+ WIREFRAME ///< Renders a simple wire-frame outlining a quad. @SINCE_1_2_2
};
namespace Property
},
"Popup":
{
- "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
+ "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png",
+ "tailUpImage":"{DALI_IMAGE_DIR}popup_tail_up.png",
+ "tailDownImage":"{DALI_IMAGE_DIR}popup_tail_down.png",
+ "tailLeftImage":"{DALI_IMAGE_DIR}popup_tail_left.png",
+ "tailRightImage":"{DALI_IMAGE_DIR}popup_tail_right.png",
+ "popupBackgroundBorder":[17,17,13,13]
},
"ConfirmationPopup":
{
- "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
+ "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png",
+ "tailUpImage":"{DALI_IMAGE_DIR}popup_tail_up.png",
+ "tailDownImage":"{DALI_IMAGE_DIR}popup_tail_down.png",
+ "tailLeftImage":"{DALI_IMAGE_DIR}popup_tail_left.png",
+ "tailRightImage":"{DALI_IMAGE_DIR}popup_tail_right.png",
+ "popupBackgroundBorder":[17,17,13,13]
},
"Slider":
{
},
"Popup":
{
- "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
+ "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png",
+ "tailUpImage":"{DALI_IMAGE_DIR}popup_tail_up.png",
+ "tailDownImage":"{DALI_IMAGE_DIR}popup_tail_down.png",
+ "tailLeftImage":"{DALI_IMAGE_DIR}popup_tail_left.png",
+ "tailRightImage":"{DALI_IMAGE_DIR}popup_tail_right.png",
+ "popupBackgroundBorder":[17,17,13,13]
},
"ConfirmationPopup":
{
- "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png"
+ "popupBackgroundImage":"{DALI_IMAGE_DIR}00_popup_bg.9.png",
+ "tailUpImage":"{DALI_IMAGE_DIR}popup_tail_up.png",
+ "tailDownImage":"{DALI_IMAGE_DIR}popup_tail_down.png",
+ "tailLeftImage":"{DALI_IMAGE_DIR}popup_tail_left.png",
+ "tailRightImage":"{DALI_IMAGE_DIR}popup_tail_right.png",
+ "popupBackgroundBorder":[17,17,13,13]
},
"Slider":
{
Name: dali-addon
Summary: DALi module for Node.JS
-Version: 1.2.15
+Version: 1.2.16
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
Name: NDalic
Summary: dali wrapper
-Version: 1.2.15
+Version: 1.2.16
Release: 1
Group: uifw/graphic
License: TO_BE_FILLED_IN
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.2.15
+Version: 1.2.16
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-2-Clause and MIT
all-local: libNDalic.so NDali.dll
-libNDalic.so: automatic/cpp/dali_wrap.o manual/cpp/keyboard_focus_manager_wrap.o manual/cpp/view-wrapper-impl-wrap.o
- g++ -shared automatic/cpp/dali_wrap.o manual/cpp/keyboard_focus_manager_wrap.o manual/cpp/view-wrapper-impl-wrap.o -o libNDalic.so $(DALICORE_LIBS) $(DALIADAPTOR_LIBS) $(DALITOOLKIT_LIBS)
+libNDalic.so: automatic/cpp/dali_wrap.o manual/cpp/keyboard_focus_manager_wrap.o manual/cpp/view-wrapper-impl-wrap.o manual/cpp/callbackbase_wrap.o
+ g++ -shared automatic/cpp/dali_wrap.o manual/cpp/keyboard_focus_manager_wrap.o manual/cpp/view-wrapper-impl-wrap.o manual/cpp/callbackbase_wrap.o -o libNDalic.so $(DALICORE_LIBS) $(DALIADAPTOR_LIBS) $(DALITOOLKIT_LIBS)
automatic/cpp/dali_wrap.o: $(BUILT_SOURCES)
g++ -c -fpic $(CXXFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) automatic/cpp/dali_wrap.cpp -o automatic/cpp/dali_wrap.o
manual/cpp/view-wrapper-impl-wrap.o: $(BUILT_SOURCES)
g++ -c -fpic $(CXXFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) manual/cpp/view-wrapper-impl-wrap.cpp -o manual/cpp/view-wrapper-impl-wrap.o
+manual/cpp/callbackbase_wrap.o: $(BUILT_SOURCES)
+ g++ -c -fpic $(CXXFLAGS) $(DALICORE_CFLAGS) $(DALIADAPTOR_CFLAGS) $(DALITOOLKIT_CFLAGS) manual/cpp/callbackbase_wrap.cpp -o manual/cpp/callbackbase_wrap.o
+
NDali.dll: $(BUILT_SOURCES)
$(MCS) -nologo -target:library -out:NDali.dll automatic/csharp/*.cs manual/csharp/*.cs
+To add the Mono Project GPG signing key and the package repository (http://www.mono-project.com/docs/getting-started/install/linux/):
+
+sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
+echo "deb http://download.mono-project.com/repo/debian wheezy main" | sudo tee /etc/apt/sources.list.d/mono-xamarin.list
+sudo apt-get update
+
+To install Mono:
+
+sudo apt-get install mono-devel
+sudo apt-get install mono-complete
+sudo apt-get install referenceassemblies-pcl
+sudo apt-get install ca-certificates-mono
+
+To install SWIG:
+
+a) Download Swig-3.0.10 from http://www.swig.org/download.html
+b) Untar the files and refer "INSTALL" file to install Swig as mentioned below:
+ 1) ./configure --with-csharp-compiler=/usr/bin/mcs
+ (/usr/bin/mcs is the mono compiler path from step 1)
+ 2) make
+ 3) sudo make install
+
To build C# binding for Ubuntu desktop using SWIG for the first time:
./autogen.sh
--- /dev/null
+/*
+ * Copyright (c) 2016 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.
+ *
+ */
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_##ClassName(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( NameSpace, ClassName )
+%typemap(csdestruct_derived, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_##ClassName(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ base.Dispose();
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~ClassName() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VIDEOVIEWSIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~VideoViewSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VIDEOVIEWSIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_VideoViewSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_APPLICATIONSIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~ApplicationSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_APPLICATIONSIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_ApplicationSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_APPLICATIONCONTROLSIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~ApplicationControlSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_APPLICATIONCONTROLSIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_ApplicationControlSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_IMAGESIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~ImageSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_IMAGESIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_ImageSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RESOURCESIMAGESIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~ResourceImageSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RESOURCESIMAGESIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_ResourceImageSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RECTINT( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~RectInteger() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RECTINT( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_RectInteger(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RECTDOUBLE( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~RectDouble() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RECTDOUBLE( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_RectDouble(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RECTFLOAT( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~RectFloat() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RECTFLOAT( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_RectFloat(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RECTUNSIGNEDINT( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~RectUnsignedInteger() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RECTUNSIGNEDINT( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_RectUnsignedInteger(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_STRINGVALUEPAIR( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~StringValuePair() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_STRINGVALUEPAIR( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_StringValuePair(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TOUCHCONTAINER( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~TouchPointContainer() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TOUCHCONTAINER( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_TouchPointContainer(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_BOOLSIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~BoolSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_BOOLSIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_BoolSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ACCESSIBILITYACTIONSIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~AccessibilityActionSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ACCESSIBILITYACTIONSIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_AccessibilityActionSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ACCESSIBILITYACTIONSCROLLSIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~AccessibilityActionScrollSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ACCESSIBILITYACTIONSCROLLSIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_AccessibilityActionScrollSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ACCESSIBILITYFOCUSSIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~AccessibilityFocusOvershotSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ACCESSIBILITYFOCUSSIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_AccessibilityFocusOvershotSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VECTORINT( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~VectorInteger() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VECTORINT( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_VectorInteger(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VECTORFLOAT( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~VectorFloat() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VECTORFLOAT( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_VectorFloat(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VECTORUNSIGNEDCHAR( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~VectorUnsignedChar() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VECTORUNSIGNEDCHAR( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_VectorUnsignedChar(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VECTORUINT16PAIR( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~VectorUint16Pair() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VECTORUINT16PAIR( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_VectorUint16Pair(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TIMERSIGNALTYPE( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~TimerSignalType() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TIMERSIGNALTYPE( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_TimerSignalType(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ACTOR( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~ActorSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ACTOR( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_ActorSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ANIMATIONSIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~AnimationSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ANIMATIONSIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_AnimationSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_BUTTON( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~ButtonSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_BUTTON( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_ButtonSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_PAGETURNSIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~PageTurnSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_PAGETURNSIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_PageTurnSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_PAGEVIEWSIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~PagePanSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_PAGEVIEWSIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_PagePanSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_PANGESTURESIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~PanGestureDetectedSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_PANGESTURESIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_PanGestureDetectedSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_PINCHGESTURESIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~PinchGestureDetectedSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_PINCHGESTURESIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_PinchGestureDetectedSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENDERTASKSIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~RenderTaskSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENDERTASKSIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_RenderTaskSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_SCROLLABLESIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~ScrollableSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_SCROLLABLESIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_ScrollableSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_SCROLLVIEWSIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~ScrollViewSnapStartedSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_SCROLLVIEWSIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_ScrollViewSnapStartedSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_SLIDERVALUECHANGEDSIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~SliderValueChangedSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_SLIDERVALUECHANGEDSIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_SliderValueChangedSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_SLIDERMARKCHANGEDSIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~SliderMarkReachedSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_SLIDERMARKCHANGEDSIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_SliderMarkReachedSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_STAGESIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~StageWheelEventSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_STAGESIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_StageWheelEventSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_STYLECHANGEDSIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~StyleChangedSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_STYLECHANGEDSIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_StyleChangedSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TAPGESTURESIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~TapGestureDetectedSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TAPGESTURESIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_TapGestureDetectedSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TEXTFIELDSIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~TextFieldSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TEXTFIELDSIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_TextFieldSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TEXTEDITORSIGNAL( NameSpace, ClassName )
+%typemap(csfinalize) NameSpace::ClassName %{
+ ~TextEditorSignal() {
+ DisposeQueue.Instance.Add(this);
+ }
+%}
+%enddef
+
+%define DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TEXTEDITORSIGNAL( NameSpace, ClassName )
+%typemap(csdestruct, methodname="Dispose", methodmodifiers="public") NameSpace::ClassName %{{
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
+ lock(this) {
+ if (swigCPtr.Handle != global::System.IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ NDalicPINVOKE.delete_TextEditorSignal(swigCPtr);
+ }
+ swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ }
+ global::System.GC.SuppressFinalize(this);
+ }
+ }
+%}
+%enddef
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Any );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, Any );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Actor );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, Actor );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, AlphaFunction );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, AlphaFunction );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Animation );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, Animation );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, AngleAxis );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, AngleAxis );
+
+//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, BaseObject );
+//DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, BaseObject );
+//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, RefObject );
+//DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, RefObject );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Handle );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, Handle );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, ObjectRegistry );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, ObjectRegistry );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, BaseHandle );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, BaseHandle );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, BufferImage );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, BufferImage );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, CameraActor );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, CameraActor );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, CustomActor );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, CustomActor );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, CustomActorImpl );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, CustomActorImpl );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, ConnectionTracker );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, ConnectionTracker );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, ConnectionTrackerInterface );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, ConnectionTrackerInterface );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Degree );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, Degree );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, EncodedBufferImage );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, EncodedBufferImage );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, FrameBuffer );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, FrameBuffer );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, FrameBufferImage );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, FrameBufferImage );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Geometry );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, Geometry );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Gesture );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, Gesture );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, GestureDetector );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, GestureDetector );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, TapGesture );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, TapGesture );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, TapGestureDetector );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, TapGestureDetector );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, PanGesture );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, PanGesture );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, PanGestureDetector );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, PanGestureDetector );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, PinchGesture );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, PinchGesture );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, PinchGestureDetector );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, PinchGestureDetector );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, LongPressGesture );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, LongPressGesture );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, LongPressGestureDetector );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, LongPressGestureDetector );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, KeyEvent );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, KeyEvent );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, HoverEvent );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, HoverEvent );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, TouchEvent );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, TouchEvent );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, WheelEvent );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, WheelEvent );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Renderer );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, Renderer );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, RenderTask );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, RenderTask );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, RenderTaskList );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, RenderTaskList );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, RelayoutContainer );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, RelayoutContainer );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Radian );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, Radian );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Quaternion );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, Quaternion );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Matrix );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, Matrix );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Matrix3 );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, Matrix3 );
+
+//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, RulerPtr );
+//DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, RulerPtr );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Layer );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, Layer );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, KeyFrames );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, KeyFrames );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Stage );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, Stage );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Sampler );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, Sampler );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Shader );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, Shader );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Vector2 );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, Vector2 );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Vector3 );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, Vector3 );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Vector4 );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, Vector4 );
+//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, VectorBase );
+//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, VectorBase );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Image );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, Image );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, NativeImage );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, NativeImage );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, NinePatchImage );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, NinePatchImage );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, ResourceImage );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, ResourceImage );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Path );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, Path );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Property );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, Property );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, PropertyBuffer );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, PropertyBuffer );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, PropertyCondition );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, PropertyCondition );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, PropertyNotification );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, PropertyNotification );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, PixelData );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, PixelData );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Uint16Pair );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, Uint16Pair );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, TypeInfo );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, TypeInfo );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Texture );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, Texture );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, TextureSet );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, TextureSet );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, TimePeriod );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, TimePeriod );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, LinearConstrainer );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, LinearConstrainer );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, PathConstrainer );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, PathConstrainer );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, TouchPoint );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali, TouchPoint );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, TouchData );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, TouchData );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Application );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, Application );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, DragAndDropDetector );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, DragAndDropDetector );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Timer );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, Timer );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali, Window );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali, Window );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, AccessibilityManager );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, AccessibilityManager );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, Alignment );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, Alignment );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, Button );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, Button );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, CheckBoxButton );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, CheckBoxButton );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, PushButton );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, PushButton );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, RadioButton );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, RadioButton );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, Builder );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, Builder );
+
+//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, View );
+//DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, View );
+//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, ViewImpl );
+//DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, ViewImpl );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, FlexContainer );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, FlexContainer );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, GaussianBlurView );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, GaussianBlurView );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, ImageView );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, ImageView );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, ItemView );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, ItemView );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, ItemFactory );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali::Toolkit, ItemFactory );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, ItemLayout );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, ItemLayout );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, ItemRange );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali::Toolkit, ItemRange );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, Model3dView );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, Model3dView );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, PageFactory );
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION( Dali::Toolkit, PageFactory );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, PageTurnLandscapeView );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, PageTurnLandscapeView );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, PageTurnPortraitView );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, PageTurnPortraitView );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, PageTurnView );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, PageTurnView );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, Popup );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, Popup );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, ProgressBar );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, ProgressBar );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, Scrollable );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, Scrollable );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, ScrollBar );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, ScrollBar );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, ScrollView );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, ScrollView );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, ScrollViewEffect );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, ScrollViewEffect );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, ScrollViewPagePathEffect );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, ScrollViewPagePathEffect );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, StyleManager );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, StyleManager );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, Slider );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, Slider );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, TableView );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, TableView );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, TextEditor );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, TextEditor );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, TextField );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, TextField );
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, TextLabel );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, TextLabel );
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, VideoView );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, VideoView );
+//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, VisualBase );
+//DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, VisualBase);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION( Dali::Toolkit, VisualFactory );
+DALI_CREATE_CUSTOM_DISPOSE_DERIVED_FUNCTION( Dali::Toolkit, VisualFactory );
+
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_APPLICATIONSIGNAL( Dali, Signal<void(Dali::Application&)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_APPLICATIONSIGNAL( Dali, Signal<void(Dali::Application&)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_APPLICATIONCONTROLSIGNAL( Dali, Signal<void(Dali::Application&, void*)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_APPLICATIONCONTROLSIGNAL( Dali, Signal<void(Dali::Application&, void*)>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VIDEOVIEWSIGNAL( Dali, Signal<void(Dali::Toolkit::VideoView&)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VIDEOVIEWSIGNAL( Dali, Signal<void(Dali::Toolkit::VideoView&)>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_IMAGESIGNAL( Dali, Signal<void(Dali::Image)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_IMAGESIGNAL( Dali, Signal<void(Dali::Image)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RESOURCESIMAGESIGNAL( Dali, Signal<void(Dali::ResourceImage)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RESOURCESIMAGESIGNAL( Dali, Signal<void(Dali::ResourceImage)>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RECTINT( Dali, Rect<int>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RECTINT( Dali, Rect<int>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RECTDOUBLE( Dali, Rect<double>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RECTDOUBLE( Dali, Rect<double>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RECTFLOAT( Dali, Rect<float>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RECTFLOAT( Dali, Rect<float>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RECTUNSIGNEDINT( Dali, Rect<unsigned int>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RECTUNSIGNEDINT( Dali, Rect<unsigned int>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TOUCHCONTAINER( std, vector<Dali::TouchPoint>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TOUCHCONTAINER( std, vector<Dali::TouchPoint>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VECTORINT( Dali, Vector<int>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VECTORINT( Dali, Vector<int>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VECTORFLOAT( Dali, Vector<float>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VECTORFLOAT( Dali, Vector<float>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VECTORUNSIGNEDCHAR( Dali, Vector<unsigned char>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VECTORUNSIGNEDCHAR( Dali, Vector<unsigned char>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_VECTORUINT16PAIR( Dali, Vector<Dali::Uint16Pair>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_VECTORUINT16PAIR( Dali, Vector<Dali::Uint16Pair>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ACCESSIBILITYACTIONSIGNAL( Dali, Signal<bool(Dali::Toolkit::AccessibilityManager&)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ACCESSIBILITYACTIONSIGNAL( Dali, Signal<bool(Dali::Toolkit::AccessibilityManager&)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ACCESSIBILITYACTIONSCROLLSIGNAL( Dali, Signal<bool(Dali::Toolkit::AccessibilityManager&, const Dali::TouchEvent&)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ACCESSIBILITYACTIONSCROLLSIGNAL( Dali, Signal<bool(Dali::Toolkit::AccessibilityManager&, const Dali::TouchEvent&)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ACCESSIBILITYFOCUSSIGNAL( Dali, Signal<void(Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ACCESSIBILITYFOCUSSIGNAL( Dali, Signal<void(Dali::Actor, Dali::Toolkit::AccessibilityManager::FocusOvershotDirection)>);
+//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_STRINGVALUEPAIR( Dali, pair<std::string, Dali::Property::Value>);
+//DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_STRINGVALUEPAIR( Dali, pair<std::string, Dali::Property::Value>);
+//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_BOOLSIGNAL( Dali, Signal<bool()>);
+//DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_BOOLSIGNAL( Dali, Signal<bool()>);
+//DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TIMERSIGNALTYPE( Dali, Signal<bool()>);
+//DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TIMERSIGNALTYPE( Dali, Signal<bool()>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ACTOR( Dali, Signal<void (Dali::Actor)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ACTOR( Dali, Signal<void (Dali::Actor)>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_ANIMATIONSIGNAL( Dali, Signal<void(Dali::Animation&)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_ANIMATIONSIGNAL( Dali, Signal<void(Dali::Animation&)>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_BUTTON( Dali, Signal<bool(Dali::Toolkit::Button)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_BUTTON( Dali, Signal<bool(Dali::Toolkit::Button)>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_PAGETURNSIGNAL( Dali, Signal<void(Dali::Toolkit::PageTurnView, unsigned int, bool)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_PAGETURNSIGNAL( Dali, Signal<void(Dali::Toolkit::PageTurnView, unsigned int, bool)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_PAGEVIEWSIGNAL( Dali, Signal<void(Dali::Toolkit::PageTurnView)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_PAGEVIEWSIGNAL( Dali, Signal<void(Dali::Toolkit::PageTurnView)>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_PANGESTURESIGNAL( Dali, Signal<void (Dali::Actor, const Dali::PanGesture&)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_PANGESTURESIGNAL( Dali, Signal<void (Dali::Actor, const Dali::PanGesture&)>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_PINCHGESTURESIGNAL( Dali, Signal<void (Dali::Actor, const Dali::PinchGesture&)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_PINCHGESTURESIGNAL( Dali, Signal<void (Dali::Actor, const Dali::PinchGesture&)>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_RENDERTASKSIGNAL( Dali, Signal<void(Dali::RenderTask&)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_RENDERTASKSIGNAL( Dali, Signal<void(Dali::RenderTask&)>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_SCROLLABLESIGNAL( Dali, Signal< void(const Dali::Vector2&)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_SCROLLABLESIGNAL( Dali, Signal< void(const Dali::Vector2&)>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_SCROLLVIEWSIGNAL( Dali, Signal< void(const Dali::Toolkit::ScrollView::SnapEvent&)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_SCROLLVIEWSIGNAL( Dali, Signal< void(const Dali::Toolkit::ScrollView::SnapEvent&)>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_SLIDERVALUECHANGEDSIGNAL( Dali, Signal<bool(Dali::Toolkit::Slider, float)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_SLIDERVALUECHANGEDSIGNAL( Dali, Signal<bool(Dali::Toolkit::Slider, float)>);
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_SLIDERMARKCHANGEDSIGNAL( Dali, Signal<bool(Dali::Toolkit::Slider, int)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_SLIDERMARKCHANGEDSIGNAL( Dali, Signal<bool(Dali::Toolkit::Slider, int)>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_STAGESIGNAL( Dali, Signal<void (const Dali::WheelEvent&)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_STAGESIGNAL( Dali, Signal<void (const Dali::WheelEvent&)>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_STYLECHANGEDSIGNAL( Dali, Signal<void(Dali::Toolkit::StyleManager, Dali::StyleChange::Type)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_STYLECHANGEDSIGNAL( Dali, Signal<void(Dali::Toolkit::StyleManager, Dali::StyleChange::Type)>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TAPGESTURESIGNAL( Dali, Signal<void (Dali::Actor, const Dali::TapGesture&)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TAPGESTURESIGNAL( Dali, Signal<void (Dali::Actor, const Dali::TapGesture&)>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TEXTEDITORSIGNAL( Dali, Signal<void(Dali::Toolkit::TextEditor)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TEXTEDITORSIGNAL( Dali, Signal<void(Dali::Toolkit::TextEditor)>);
+
+DALI_CREATE_CUSTOM_DESTRUCTOR_FUNCTION_TEXTFIELDSIGNAL( Dali, Signal<void(Dali::Toolkit::TextField)>);
+DALI_CREATE_CUSTOM_DISPOSE_FUNCTION_TEXTFIELDSIGNAL( Dali, Signal<void(Dali::Toolkit::TextField)>);
%rename(View) Dali::Toolkit::Control;
%rename(ViewImpl) Dali::Toolkit::Internal::Control;
%rename(VisualBase) Dali::Toolkit::Visual::Base;
+%rename(LoadImageSynchronously) Dali::Toolkit::SyncImageLoader::Load;
%rename(ControlOrientationType) Dali::Toolkit::ControlOrientation::Type;
%rename(DefaultItemLayoutType) Dali::Toolkit::DefaultItemLayout::Type;
%rename(NewItemLayout) Dali::Toolkit::DefaultItemLayout::New;
%include <dali-toolkit/public-api/visuals/image-visual-properties.h>
%include <dali-toolkit/public-api/visuals/mesh-visual-properties.h>
%include <dali-toolkit/public-api/visuals/primitive-visual-properties.h>
-%include <dali-toolkit/public-api/visuals/text-visual-properties.h>
+%include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
%include <dali-toolkit/devel-api/builder/builder.h>
%include <dali-toolkit/devel-api/visual-factory/visual-base.h>
%include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+%include <dali-toolkit/public-api/image-loader/async-image-loader.h>
+%include <dali-toolkit/public-api/image-loader/sync-image-loader.h>
+%include <dali-toolkit/public-api/text/rendering-backend.h>
+
%template(ItemIdContainer) std::vector<unsigned int>;
%template(Item) std::pair<unsigned int, Dali::Actor>;
%template(ItemContainer) std::vector<std::pair<unsigned int, Dali::Actor>>;
#endif
%include exception.i
+%include dali-gc.i
%exception {
try {
#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
#include <dali-toolkit/devel-api/visual-factory/transition-data.h>
+#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
+
#include <dali-toolkit/public-api/controls/scrollable/item-view/item-view-declarations.h>
// add here SWIG version check
}
}
- private static Application instance; // singleton
+ private static Application _instance; // singleton
public delegate void InitDelegate();
// instance.InitDelegate();
}
+ public static Application Instance
+ {
+ get
+ {
+ return _instance;
+ }
+ }
+
public static Application GetApplicationFromPtr(global::System.IntPtr cPtr) {
Application ret = new Application(cPtr, false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
public static Application NewApplication() {
- return NewApplication("",Application.WINDOW_MODE.OPAQUE);
+ _instance = NewApplication("", Application.WINDOW_MODE.OPAQUE);
+ return _instance;
}
public static Application NewApplication(string stylesheet) {
- return NewApplication(stylesheet, Application.WINDOW_MODE.OPAQUE);
+ _instance = NewApplication(stylesheet, Application.WINDOW_MODE.OPAQUE);
+ return _instance;
}
public static Application NewApplication(string stylesheet, Application.WINDOW_MODE windowMode) {
// we've got an application now connect the signals
ret.SetupDelegates();
// set the singleton
-
+ _instance = ret;
return ret;
}
+ public bool AddIdle(System.Delegate func) {
+ System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
+ System.IntPtr ip2 = NDalicManualPINVOKE.MakeCallback(new System.Runtime.InteropServices.HandleRef(this, ip));
+
+ bool ret = NDalicPINVOKE.Application_AddIdle(swigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip2));
+
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
%}
%enddef
{
public class FirstScreenApp
{
- private int _currentPostersContainerID;
- private int _totalPostersContainers;
-
- private Application _application;
- private Stage _stage;
- private Vector2 _stageSize;
-
- private List<ScrollContainer> _postersContainer;
-
- private ScrollContainer _menuContainer;
- private Vector3 _menuItemSize;
-
- private Layer _bottomClipLayer;
- private Layer _topClipLayer;
- private View _topContainer;
- private View _bottomContainer;
-
- private FocusEffect _focusEffect;
- private string _imagePath;
-
- private ImageView _keyboardFocusIndicator;
- private ImageView _launcherSeparator;
- private ImageView[] launcherIcon;
- private Animation _showBottomContainerAnimation;
- private Animation _hideBottomContainerAnimation;
-
- public FirstScreenApp(Application application)
+ private Application _application; // Reference to Dali Application.
+ private Stage _stage; // Reference to Dali stage.
+ private Vector2 _stageSize; // Reference to Dali stage size.
+
+ private View _topContainer; // Top Container added to the Stage will contain Poster ScrollContainers.
+ private View _bottomContainer; // Bottom Container added to the Stage will contain Menu ScrollContainer.
+ private int _currentPostersContainerID; // Current Poster Container ID visible on the Top Container / Stage.
+ private int _totalPostersContainers; // Number of Poster ScrollContainers to be added on Top Container.
+ private List<ScrollContainer> _postersContainer; // List collection of Poster ScrollContainers used on the Top Container in this demo application.
+ private ScrollContainer _menuContainer; // Menu ScrollContainer used on the Bottom Container in this demo application.
+ private Layer _bottomClipLayer; // Clip layer (Dali Clip Layer instance) used for Bottom Container.
+ private Layer _topClipLayer; // Clip layer (Dali Clip Layer instance) used for Top Container.
+
+ private FocusEffect _focusEffect; // FocusEffect is used to apply Focus animation effect on any supplied item/image.
+ private string _imagePath; // Contains the physical location of all images used in the demo application.
+
+ private ImageView _keyboardFocusIndicator; // Reference to the ImageView (Keyboard Focus indicator) applied to the focused item on ScrollContainer.
+ private ImageView _launcherSeparator; // Reference to the ImageView used for launcher separation (Launcher consists of three image icons on left of Menu ScrollContainer).
+ private ImageView[] launcherIcon; // ImageViews used for launcher Icons.
+ private Animation _showBottomContainerAnimation; // Animation used to show/unhide Bottom Container (Menu ScrollContainer) when it is focused.
+ private Animation _hideBottomContainerAnimation; // Animation used to hide Bottom Container (Menu ScrollContainer) when it is focused.
+ private Animation _showAnimation; // Animation used to move Poster scrollContainer from bottom to top and make it non-transparent.
+ private Animation _hideAnimation; // Animation used to make the unused specified Poster scrollContainer transparent.
+ private ScrollContainer _hideScrollContainer; // The unused Poster scrollContainer which needs to be transparent.
+ KeyboardFocusManager _keyboardFocusManager; // Reference to Dali KeyboardFocusManager.
+
+ private FirstScreenApp(Application application)
{
_application = application;
_application.Initialized += OnInitialize;
tVApp.MainLoop();
}
- public void MainLoop()
+ private void MainLoop()
{
_application.MainLoop();
}
{
View item = new ImageView(_imagePath + "/poster"+j+"/"+ (i % 6)+ ".jpg");
item.SetName ("poster-item-" + _postersContainer[j].ItemCount);
- _postersContainer[j].AddItem(item);
+ _postersContainer[j].Add(item);
}
else
{
View item = new ImageView(_imagePath + "/poster"+j+"/"+ (i % 6)+ ".jpg");
item.SetName ("poster-item-" + _postersContainer[j].ItemCount);
- _postersContainer[j].AddItem(item);
+ _postersContainer[j].Add(item);
}
}
if (j == 0)
{
- _postersContainer[j].Show();
+ Show(_postersContainer[j]);
}
else
{
- _postersContainer[j].Hide();
+ Hide(_postersContainer[j]);
}
_postersContainer[j].SetFocused(false);
{
View menuItem = new ImageView(_imagePath + "/menu/" + i % 7 + ".png");
menuItem.SetName("menu-item-" + _menuContainer.ItemCount);
- _menuContainer.AddItem(menuItem);
+ _menuContainer.Add(menuItem);
}
}
private Actor OnKeyboardPreFocusChangeSignal(object source, KeyboardFocusManager.PreFocusChangeEventArgs e)
{
- Actor actor = _menuContainer.ItemRoot;
+ if (!e.Current && !e.Proposed)
+ {
+ return _menuContainer;
+ }
+
+ Actor actor = _menuContainer.Container;
if (e.Direction == View.KeyboardFocus.Direction.UP)
{
HideBottomContainer();
// Also apply Focus animation on Focused item on Poster ScrollContainer
- _postersContainer[_currentPostersContainerID].FocusAnimation(_focusEffect, FocusEffectDirection.BottomToTop);
+ FocusAnimation(_postersContainer[_currentPostersContainerID], FocusEffectDirection.BottomToTop);
}
}
else if (e.Direction == View.KeyboardFocus.Direction.DOWN)
_menuContainer.SetFocused(true);
// Also apply Focus animation on Focused item on Menu ScrollContainer
- _menuContainer.FocusAnimation(_focusEffect, FocusEffectDirection.TopToBottom);
+ FocusAnimation(_menuContainer, FocusEffectDirection.TopToBottom);
}
}
- else if (e.Direction == View.KeyboardFocus.Direction.LEFT)
+ else
+ {
+ actor = e.Proposed;
+ }
+
+ if (e.Direction == View.KeyboardFocus.Direction.LEFT)
{
if (_menuContainer.IsFocused)
{
- // Move the Focus to the left item/image of currently focused item on Menu ScrollContainer
- actor = _menuContainer.FocusPrevious();
-
int id = _menuContainer.FocusedItemID % _totalPostersContainers;
if (id != _currentPostersContainerID)
{
- _postersContainer[_currentPostersContainerID].Hide();
+ Hide(_postersContainer[_currentPostersContainerID]);
_currentPostersContainerID = id;
- _postersContainer[_currentPostersContainerID].Show();
+ Show(_postersContainer[_currentPostersContainerID]);
}
}
- else
- {
- // Move the Focus to the left item/image of currently focused item on Poster ScrollContainer
- actor = _postersContainer[_currentPostersContainerID].FocusPrevious();
- }
}
else if (e.Direction == View.KeyboardFocus.Direction.RIGHT)
{
if (_menuContainer.IsFocused)
{
- // Move the Focus to the right item/image of currently focused item on Menu ScrollContainer
- actor = _menuContainer.FocusNext();
-
int id = _menuContainer.FocusedItemID % _totalPostersContainers;
if (id != _currentPostersContainerID)
{
- _postersContainer[_currentPostersContainerID].Hide();
+ Hide(_postersContainer[_currentPostersContainerID]);
_currentPostersContainerID = id;
- _postersContainer[_currentPostersContainerID].Show();
+ Show(_postersContainer[_currentPostersContainerID]);
}
}
- else
- {
- // Move the Focus to the right item/image of currently focused item on Poster ScrollContainer
- actor = _postersContainer[_currentPostersContainerID].FocusNext();
- }
}
return actor;
}
+ // Perform Focus animation Effect on the current Focused Item on ScrollContainer.
+ private void FocusAnimation(ScrollContainer scrollContainer, FocusEffectDirection direction)
+ {
+ _focusEffect.FocusAnimation(scrollContainer.GetCurrentFocusedActor(), scrollContainer.ItemSize, 1.0f, direction);
+ }
+
+ // Perform Show animation on ScrollContainer (used only for Poster Container)
+ private void Show(ScrollContainer scrollContainer)
+ {
+ scrollContainer.Add(scrollContainer.Container);
+
+ _hideScrollContainer = null;
+ _showAnimation = new Animation (0.35f);
+
+ // This animation will move Poster scrollContainer from bottom to top and make it non-transparent.
+ _showAnimation.AnimateTo(new Dali.Property(scrollContainer.Container, Actor.Property.COLOR_ALPHA), new Dali.Property.Value(1.0f));
+
+ scrollContainer.Container.PositionY = scrollContainer.Container.Position.y + 200.0f;
+ float targetPositionY = scrollContainer.Container.Position.y - 200.0f;
+ _showAnimation.AnimateTo(new Dali.Property(scrollContainer.Container, Actor.Property.POSITION_Y), new Dali.Property.Value(targetPositionY),
+ new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR));
+
+ _showAnimation.Play();
+ }
+
+ // Perform Hide animation on ScrollContainer (used only for Poster Container)
+ private void Hide(ScrollContainer scrollContainer)
+ {
+ if (_hideAnimation)
+ {
+ _hideAnimation.Clear();
+ _hideAnimation.Reset();
+ }
+
+ float duration = 0.35f;
+ _hideAnimation = new Animation(duration);
+
+ _hideAnimation.AnimateTo(new Dali.Property(scrollContainer.Container, Actor.Property.COLOR_ALPHA), new Dali.Property.Value(0.0f),
+ new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.0f, duration * 0.75f));
+
+ _hideAnimation.Finished += OnHideAnimationFinished;
+
+ _hideScrollContainer = scrollContainer;
+ _hideAnimation.Play();
+ }
+
+ // This removes all the items from the specified unused Poster ScrollContainer (hence Stage) to improve performance.
+ private void OnHideAnimationFinished(object source, Animation.FinishedEventArgs e)
+ {
+ if (_hideScrollContainer)
+ {
+ _hideScrollContainer.Remove(_hideScrollContainer.Container);
+ }
+ }
+
// Hide Bottom Container (Menu ScrollContainer) when it is not focused
private void HideBottomContainer()
{
// First screen demo Application initialisation
private void OnInitialize(object source, AUIApplicationInitEventArgs e)
{
+ _hideScrollContainer = null;
_stage = Stage.GetCurrent();
_stageSize = _stage.GetSize();
-// _stage.SetBackgroundColor(NDalic.TRANSPARENT);
+ //_stage.SetBackgroundColor(NDalic.TRANSPARENT);
_totalPostersContainers = Constants.TotalPostersContainers;
_imagePath = "./images/"; // Desktop
-// _imagePath = "/home/owner/apps_rw/org.tizen.firstscreen/res/images/"; // Target
+ //_imagePath = "/home/owner/apps_rw/org.tizen.firstscreen/res/images/"; // Target
_postersContainer = new List<ScrollContainer> ();
_menuContainer = new ScrollContainer ();
}
else
{
- _postersContainer[i].ItemSize = new Vector3(_stageSize.width * Constants.Poster1ItemWidthFactor,
+ _postersContainer[i].ItemSize = new Vector3((_stageSize.width * Constants.Poster1ItemWidthFactor) - Constants.PostersContainerPadding,
_stageSize.height * Constants.PostersItemHeightFactor, 0.0f);
}
- _postersContainer[i].Padding = Constants.PostersContainerPadding;
+ _postersContainer[i].Gap = Constants.PostersContainerPadding;
_postersContainer[i].MarginX = Constants.PostersContainerMargin;
- _postersContainer[i].OffsetY = Constants.PostersContainerOffsetYFactor;
+ _postersContainer[i].OffsetYFator = Constants.PostersContainerOffsetYFactor;
_postersContainer[i].Width = _stageSize.width;
_postersContainer[i].Height = _stageSize.height * Constants.PostersContainerHeightFactor;
_postersContainer[i].ShadowBorder = shadowBorder;
_postersContainer[i].ShadowBorder.Position = new Vector3(0.0f, 4.0f, 0.0f);
_postersContainer[i].SpotLight = spotLight;
- _topClipLayer.Add(_postersContainer[i].Container);
+ _topClipLayer.Add(_postersContainer[i]);
}
// Add a clip layer to Bottom Container
_bottomContainer.Add(_launcherSeparator);
// Create Menu Container and add it to Bottom Clip Layer
- _menuItemSize = new Vector3((_stageSize.width * Constants.MenuItemWidthFactor) - Constants.MenuContainerPadding,
+ Vector3 menuItemSize = new Vector3((_stageSize.width * Constants.MenuItemWidthFactor) - Constants.MenuContainerPadding,
_stageSize.height * Constants.MenuItemHeightFactor, 0.0f);
_menuContainer.Container.Name = "menu";
- _menuContainer.ItemSize = _menuItemSize;
- _menuContainer.Padding = Constants.MenuContainerPadding;
+ _menuContainer.ItemSize = menuItemSize;
+ _menuContainer.Gap = Constants.MenuContainerPadding;
_menuContainer.MarginX = Constants.MenuContainerMargin;
- _menuContainer.OffsetY = Constants.MenuContainerOffsetYFactor;
+ _menuContainer.OffsetYFator = Constants.MenuContainerOffsetYFactor;
_menuContainer.OffsetX = Constants.LauncherWidth;
_menuContainer.Width = _stageSize.width - Constants.LauncherWidth;
_menuContainer.Height = _stageSize.height * Constants.MenuContainerHeightFactor;
_menuContainer.ShadowBorder.ParentOrigin = NDalic.ParentOriginCenter;
_menuContainer.ShadowBorder.AnchorPoint = NDalic.AnchorPointCenter;
_menuContainer.SpotLight = spotLight;
- _bottomClipLayer.Add(_menuContainer.Container);
+ _bottomClipLayer.Add(_menuContainer);
CreatePosters(); // Create Items for Poster ScrollContainer
CreateMenu(); // Create Items for Menu ScrollContainer
// Initialize PreFocusChange event of KeyboardFocusManager
- KeyboardFocusManager keyboardFocusManager = KeyboardFocusManager.Get();
- keyboardFocusManager.PreFocusChange += OnKeyboardPreFocusChangeSignal;
+ _keyboardFocusManager = KeyboardFocusManager.Get();
+ _keyboardFocusManager.PreFocusChange += OnKeyboardPreFocusChangeSignal;
_keyboardFocusIndicator = new ImageView(_imagePath + "/highlight_stroke.9.png");
_keyboardFocusIndicator.ParentOrigin = NDalic.ParentOriginCenter;
_keyboardFocusIndicator.WidthResizePolicy = "FILL_TO_PARENT";
_keyboardFocusIndicator.HeightResizePolicy = "FILL_TO_PARENT";
- keyboardFocusManager.SetFocusIndicatorActor(_keyboardFocusIndicator);
+ _keyboardFocusManager.SetFocusIndicatorActor(_keyboardFocusIndicator);
+
+ _keyboardFocusManager.SetAsFocusGroup(_menuContainer, true);
+ _keyboardFocusManager.SetAsFocusGroup(_postersContainer[0], true);
+ _keyboardFocusManager.SetAsFocusGroup(_postersContainer[1], true);
+ _keyboardFocusManager.SetFocusGroupLoop(true);
_focusEffect = new FocusEffect();
}
}
+
public const float BottomClipLayerHeightFactor = 0.84f; // Height Factor of stage height used for Bottom Clip layer height
public const float MenuContainerPadding = 10.0f; // Padding size used between items / images in Menu ScrollContainer
public const float MenuContainerMargin = 25.0f; // Extra margin Padding size used between items / images in Menu ScrollContainer when item / image is focused
- public const float MenuContainerOffsetYFactor = 0.35f; // Position Factor of Poster item height used for Menu items / images position
+ public const float MenuContainerOffsetYFactor = 0.35f; // Position Factor of Menu item height used for Menu items / images position
public const float MenuItemWidthFactor = 0.125f; // Width Factor (1/8) of stage Width used for Menu items / images Width
public const float MenuItemHeightFactor = 0.10f; // Height Factor of stage height used for Menu items / images Height
public const float MenuItemsCount = 14; // Number of Menu items / images used in a Menu ScrollContainer
public const float Poster0ItemWidthFactor = 0.25f; // Width Factor (1/4) of stage Width used for Poster items / images Width in a Poster ScrollContainer 0
- public const float Poster1ItemWidthFactor = 0.24f; // Width Factor of stage Width used for Poster items / images Width in a Poster ScrollContainer 1
+ public const float Poster1ItemWidthFactor = 0.20f; // Width Factor of stage Width used for Poster items / images Width in a Poster ScrollContainer 1
public const float PostersItemHeightFactor = 0.24f; // Height Factor of stage height used for Poster items / images Height
public const float PostersItemsCount = 24; // Number of Menu items / images used in a Poster ScrollContainer
public const float LauncherSeparatorWidth = 20.0f; // Extra area / space to the left of Menu ScrollContainer used for a speration shadow image
public const float LauncherItemsCount = 3.0f; // Total number of Launcher items / images
public const float LauncherIconWidth = (LauncherWidth - LauncherLeftMargin - LauncherSeparatorWidth) / LauncherItemsCount; // Width of each Launcher item / image
+
+ public const float SpotLightDuration = 5.0f; // Duration of Spot Light Animation.
+ public const float FocusTransitionDuration = 0.35f; // Duration of Focus Transition Animation.
+ public const float FocusDuration = 0.35f; // Duration of Focus Animation.
+ public const float ScrollDuration = 0.35f; // Duration of Scroll Animation.
}
}
-
// Initialize FocusData used for key frame animation
public FocusData(string name, string imageName, Direction direction, Vector3 parentOrigin, Vector3 initSize,
- Vector3 targetSize, float keyFrameStart, float keyFrameEnd)
+ Vector3 targetSize, float keyFrameStart, float keyFrameEnd)
{
_name = name;
_imageName = imageName;
_direction = direction;
_imageFocus = new ImageView("./images/focuseffect/" + _imageName); // Desktop
-// _imageFocus = new ImageView("/home/owner/apps_rw/org.tizen.firstscreen/res/images/focuseffect/" + _imageName); // Target
+ // _imageFocus = new ImageView("/home/owner/apps_rw/org.tizen.firstscreen/res/images/focuseffect/" + _imageName); // Target
_imageFocus.ParentOrigin = _parentOrigin;
_imageFocus.AnchorPoint = NDalic.AnchorPointCenter;
}
}
}
-
using Dali;
using System;
using System.Collections.Generic;
-using System.Collections.Specialized;
namespace FirstScreen
{
{
private float _frameThickness;
private FocusData[] _focusData; // Each FocusData is used for one key frame animation (total 6 key frame animations needed for EddenEffect)
- private Animation _animation; // Animation used to apply all six key frame animations
+ private Animation _animation; // Animation used to apply all six key frame animations
public FocusEffect()
{
_frameThickness = 10.0f;
float _bottomFrameTime = 0.6f; // complete the halo/bottom animation 60% of the way through
- float _sideFrameTime = 0.8f; // Start the side frame animation after the bottom animation and complete at 80% of the way through
- float _topFrameTime = 1.0f; // start the top frame animation after the side frame animation and complete at 100% way through
+ float _sideFrameTime = 0.8f; // Start the side frame animation after the bottom animation and complete at 80% of the way through
+ float _topFrameTime = 1.0f; // start the top frame animation after the side frame animation and complete at 100% way through
// Six key frame animations (FocusData objects) needed for EddenEffect
// Two key frame animations for top horizontal effect
_focusData = new FocusData[6];
FocusData focusData = new FocusData("halo", "halo.png", FocusData.Direction.Horizontal, NDalic.ParentOriginTopCenter,
- new Vector3(50,20,0), new Vector3(0.0f, 100.0f , 0.0f), 0.0f, _bottomFrameTime);
+ new Vector3(50,20,0), new Vector3(0.0f, 100.0f , 0.0f), 0.0f, _bottomFrameTime);
_focusData[0] = focusData;
focusData = new FocusData("bottom", "horizontalFrame.png", FocusData.Direction.Horizontal, NDalic.ParentOriginTopCenter,
- new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, _frameThickness, 0.0f), 0.0f, _bottomFrameTime);
+ new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, _frameThickness, 0.0f), 0.0f, _bottomFrameTime);
_focusData[1] = focusData;
focusData = new FocusData("left", "verticalFrame.png", FocusData.Direction.Vertical, NDalic.ParentOriginBottomLeft,
- new Vector3(0.0f, 0.0f, 0.0f), new Vector3(_frameThickness, 0.0f, 0.0f), _bottomFrameTime, _sideFrameTime);
+ new Vector3(0.0f, 0.0f, 0.0f), new Vector3(_frameThickness, 0.0f, 0.0f), _bottomFrameTime, _sideFrameTime);
_focusData[2] = focusData;
focusData = new FocusData("right", "verticalFrame.png", FocusData.Direction.Vertical, NDalic.ParentOriginBottomRight,
- new Vector3(0.0f, 0.0f, 0.0f), new Vector3(_frameThickness, 0.0f, 0.0f), _bottomFrameTime, _sideFrameTime);
+ new Vector3(0.0f, 0.0f, 0.0f), new Vector3(_frameThickness, 0.0f, 0.0f), _bottomFrameTime, _sideFrameTime);
_focusData[3] = focusData;
focusData = new FocusData("top-left", "horizontalFrame.png", FocusData.Direction.Horizontal, NDalic.ParentOriginBottomLeft,
- new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f ,_frameThickness, 0.0f), _sideFrameTime, _topFrameTime);
+ new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f ,_frameThickness, 0.0f), _sideFrameTime, _topFrameTime);
_focusData[4] = focusData;
focusData = new FocusData("top-right", "horizontalFrame.png", FocusData.Direction.Horizontal, NDalic.ParentOriginBottomRight,
- new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, _frameThickness, 0.0f), _sideFrameTime, _topFrameTime);
+ new Vector3(0.0f, 0.0f, 0.0f), new Vector3(0.0f, _frameThickness, 0.0f), _sideFrameTime, _topFrameTime);
_focusData[5] = focusData;
}
}
}
}
-
void FocusAnimation(View parentItem, Vector3 itemSize, float duration, FocusEffectDirection direction);
}
}
-
namespace FirstScreen
{
- public class ScrollContainer
+ public class ScrollContainer : CustomView
{
- private View _container;
- private Actor _itemRoot;
- private Vector3 _itemSize;
- private List<View> _itemList;
- private int _itemCount;
- private int _focusedItem;
- private PanGestureDetector _panGestureDetector;
- private float _scrollDisplacement;
- private float _currentScrollPosition;
- private float _padding;
- private float _width;
- private float _height;
- private bool _isFocused;
- private float _marginX;
- private float _marginY;
- private float _offsetY;
- private float _offsetX;
- private Stage _stage;
- private Vector2 _stageSize;
- private ImageView _shadowBorder;
- private ImageView _spotLight;
- private Animation _spotLightAnimation;
- private Animation _showAnimation;
- private Animation _hideAnimation;
- private Animation _focusAnimation;
- private Animation _scrollAnimation;
- private Animation _focusTransitionAnimation;
- private Path _circularPath;
- private bool _shouldHide;
-
- public ScrollContainer()
+ private View _container; // View Container will be the first item added to ScrollContainer and parent to all the items added to the ScrollContainer.
+ private Vector3 _itemSize; // Size of the item / images added to the ScrollContainer.
+ private List<View> _itemList; // List collection of View items/images added to the ScrollContainer.
+ private int _itemCount; // Number of items / images added to the ScrollContainer.
+ private int _focusedItem; // Index of currently focused View item / image on the ScrollContainer.
+ private float _scrollDisplacement; // Used for horizontal pan displacement.
+ private float _currentScrollPosition; // Used for horizontal scroll position.
+ private float _gap; // Used for gap / padding between items / images on the ScrollContainer.
+ private float _width; // Width of the ScrollContainer.
+ private float _height; // Height of the ScrollContainer.
+ private bool _isFocused; // Flag to check if ScrollContainer is enabled or not.
+ private float _marginX; // Extra horizontal margin is used to add an extra gap between items / images after a focused and scaled item / image.
+ private float _marginY; // Extra vertical margin (not used at the moment).
+ private float _offsetYFactor; // Vertical Position offset Factor of item height.
+ private float _offsetX; // Horizontal Position offset of ScrollContainer.
+ private Stage _stage; // Reference to Dali stage.
+ private Vector2 _stageSize; // Reference to Dali stage size.
+ private ImageView _shadowBorder; // Reference to Shadow border ImageView applied to the focused item on ScrollContainer.
+ private ImageView _spotLight; // Reference to SpotLight ImageView applied to the focused item on ScrollContainer.
+ private Animation _spotLightAnimation; // SpotLight Animation applied to the focused item on ScrollContainer.
+ private Animation _focusAnimation; // Focused position animation on ScrollContainer.
+ private Animation _scrollAnimation; // Scroll animation on items of ScrollContainer.
+ private Animation _focusTransitionAnimation; // Focus Transition (scaling /unscaling) animation on items of ScrollContainer.
+ private Path _circularPath; // Circular path used for SpotLight Animation applied to the focused item on ScrollContainer.
+
+ public ScrollContainer() : base(ViewWrapperImpl.CustomViewBehaviour.DISABLE_STYLE_CHANGE_SIGNALS |
+ ViewWrapperImpl.CustomViewBehaviour.REQUIRES_KEYBOARD_NAVIGATION_SUPPORT)
{
- _itemSize = new Vector3(0.0f, 0.0f, 0.0f);
- _padding = 0.0f;
- _width = 0.0f;
- _height = 0.0f;
- _currentScrollPosition = 0.0f;
- _itemCount = 0;
- _focusedItem = -1;
- _isFocused = false;
- _marginX = 50.0f;
- _marginY = 0.0f;
- _offsetY = 0.0f;
- _offsetX = 0.0f;
-
- _shouldHide = true;
-
- _container = new View();
- _itemRoot = new Actor();
- _container.Add(_itemRoot);
-
- _itemList = new List<View>();
-
- if (_panGestureDetector == null)
- {
- _panGestureDetector = new PanGestureDetector();
- _panGestureDetector.Attach(_container);
- _panGestureDetector.Detected += OnPan;
- }
-
- _container.ParentOrigin = NDalic.ParentOriginTopLeft;
- _container.AnchorPoint = NDalic.AnchorPointTopLeft;
- _itemRoot.ParentOrigin = NDalic.ParentOriginTopLeft;
- _itemRoot.AnchorPoint = NDalic.AnchorPointTopLeft;
-
- _container.WidthResizePolicy = "FILL_TO_PARENT";
- _container.HeightResizePolicy = "FILL_TO_PARENT";
- _itemRoot.WidthResizePolicy = "FILL_TO_PARENT";
- _itemRoot.HeightResizePolicy = "FILL_TO_PARENT";
-
- _stage = Stage.GetCurrent();
- _stageSize = _stage.GetSize();
-
- _spotLightAnimation = new Animation(5.0f);
- _focusTransitionAnimation = new Animation (0.35f);
- _focusAnimation = new Animation (0.35f);
- _focusAnimation.SetEndAction(Animation.EndAction.BakeFinal);
- _scrollAnimation = new Animation (0.35f);
- _scrollAnimation.SetEndAction(Animation.EndAction.BakeFinal);
}
public bool IsFocused
}
}
- public Actor ItemRoot
- {
- get
- {
- return _itemRoot;
- }
- }
-
public Vector3 ItemSize
{
get
}
}
- public float Padding
+ public float Gap
{
get
{
- return _padding;
+ return _gap;
}
set
{
- _padding = value;
+ _gap = value;
}
}
}
}
- public float OffsetY
+ public float OffsetYFator
{
get
{
- return _offsetY;
+ return _offsetYFactor;
}
set
{
- _offsetY = value;
+ _offsetYFactor = value;
}
}
}
}
- public Actor GetCurrentFocusedActor()
+ // This override method is called automatically after the Control has been initialized.
+ // Any second phase initialization is done here.
+ public override void OnInitialize()
{
- if (_focusedItem < 0)
- {
- _focusedItem = 0;
- }
+ _itemSize = new Vector3(0.0f, 0.0f, 0.0f);
+ _gap = 0.0f;
+ _width = 0.0f;
+ _height = 0.0f;
+ _currentScrollPosition = 0.0f;
+ _itemCount = 0;
+ _focusedItem = -1;
+ _isFocused = false;
+ _marginX = 50.0f;
+ _marginY = 0.0f;
+ _offsetYFactor = 0.0f;
+ _offsetX = 0.0f;
- return _itemList[_focusedItem];
- }
+ _container = new View();
+ this.Add(_container);
- public void AddItem(View item)
- {
- item.AnchorPoint = NDalic.AnchorPointBottomCenter;
- item.ParentOrigin = NDalic.ParentOriginBottomCenter;
+ _itemList = new List<View>();
- item.Size = _itemSize;
- item.SetKeyboardFocusable(true);
- item.Position = GetItemPosition(_itemCount, _currentScrollPosition);
+ this.ParentOrigin = NDalic.ParentOriginTopLeft;
+ this.AnchorPoint = NDalic.AnchorPointTopLeft;
+ this.WidthResizePolicy = "FILL_TO_PARENT";
+ this.HeightResizePolicy = "FILL_TO_PARENT";
+ this.SetKeyboardFocusable(true);
- item.Name = _itemCount.ToString();
+ _container.ParentOrigin = NDalic.ParentOriginTopLeft;
+ _container.AnchorPoint = NDalic.AnchorPointTopLeft;
+ _container.WidthResizePolicy = "FILL_TO_PARENT";
+ _container.HeightResizePolicy = "FILL_TO_PARENT";
-// item.ClippingMode = "CLIP_CHILDREN";
+ _stage = Stage.GetCurrent();
+ _stageSize = _stage.GetSize();
+
+ _spotLightAnimation = new Animation(Constants.SpotLightDuration);
+ _focusTransitionAnimation = new Animation(Constants.FocusTransitionDuration);
+ _focusAnimation = new Animation(Constants.FocusDuration);
+ _focusAnimation.SetEndAction(Animation.EndAction.BakeFinal);
+ _scrollAnimation = new Animation(Constants.ScrollDuration);
+ _scrollAnimation.SetEndAction(Animation.EndAction.BakeFinal);
- _itemRoot.Add(item);
- _itemList.Add(item);
- _panGestureDetector.Attach(item);
- _itemCount++;
+ EnableGestureDetection(Gesture.Type.Pan);
}
- // Perform Show animation on ScrollContainer (used only for Poster Container)
- public void Show()
+ // This will be invoked automatically if an item/image is added to the ScrollContainer
+ public override void OnChildAdd(Actor actor)
{
- Container.Add(ItemRoot);
+ View item = View.DownCast(actor);
- _shouldHide = false;
- _showAnimation = new Animation (0.35f);
+ if (item is View && item != _container)
+ {
+ item.AnchorPoint = NDalic.AnchorPointBottomCenter;
+ item.ParentOrigin = NDalic.ParentOriginBottomCenter;
- _showAnimation.AnimateTo(new Property(_container, Actor.Property.COLOR_ALPHA), new Property.Value(1.0f));
+ item.Size = _itemSize;
+ item.SetKeyboardFocusable(true);
+ item.Position = GetItemPosition(_itemCount, _currentScrollPosition);
- _container.PositionY = _container.Position.y + 200.0f;
- float targetPositionY = _container.Position.y - 200.0f;
- _showAnimation.AnimateTo(new Property(_container, Actor.Property.POSITION_Y), new Property.Value(targetPositionY),
- new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR));
+ item.Name = _itemCount.ToString();
- _showAnimation.Play();
- }
+ //item.ClippingMode = "CLIP_CHILDREN";
- // Perform Hide animation on ScrollContainer (used only for Poster Container)
- public void Hide()
- {
- if (_hideAnimation)
- {
- _hideAnimation.Clear();
- _hideAnimation.Reset();
- }
+ _container.Add(item);
+ _itemList.Add(item);
- float duration = 0.35f;
- _hideAnimation = new Animation(duration);
+ _itemCount++;
+ item.SetKeyboardFocusable(true);
+ }
+ }
- _hideAnimation.AnimateTo(new Property(_container, Actor.Property.COLOR_ALPHA), new Property.Value(0.0f),
- new AlphaFunction(AlphaFunction.BuiltinFunction.LINEAR), new TimePeriod(0.0f, duration * 0.75f));
+ // This will be invoked automatically if an item/image is removed from the ScrollContainer
+ public override void OnChildRemove(Actor actor)
+ {
+ View item = View.DownCast(actor);
- _hideAnimation.Finished += OnHideAnimationFinished;
+ if (item is View && item != _container)
+ {
+ _container.Remove(item);
- _shouldHide = true;
- _hideAnimation.Play();
+ _itemCount--;
+ _itemList.Remove(item);
+ }
}
- public View Focus(int itemId)
+ // This override function supports two dimensional keyboard navigation.
+ // This function returns the next keyboard focusable actor in ScrollContainer control towards the given direction.
+ public override Actor GetNextKeyboardFocusableActor(Actor currentFocusedActor, View.KeyboardFocus.Direction direction, bool loopEnabled)
{
- if (itemId < 0)
+ if (direction == View.KeyboardFocus.Direction.LEFT)
{
- itemId = 0;
+ return FocusPrevious(loopEnabled);
}
- else if (itemId >= _itemList.Count)
+ else if (direction == View.KeyboardFocus.Direction.RIGHT)
{
- itemId = _itemList.Count - 1;
+ return FocusNext(loopEnabled);
}
-
- _itemList[itemId].Add(_shadowBorder);
- _itemList[itemId].Add(_spotLight);
-
- // Perform Spot Light animation
- if(_focusedItem != itemId && _spotLight != null)
+ else
{
- _spotLightAnimation.Clear();
- _spotLightAnimation.Animate( _spotLight, _circularPath, new Vector3(0.0f, 0.0f, 0.0f) );
- _spotLightAnimation.SetLooping(true);
- _spotLightAnimation.Play();
+ return currentFocusedActor;
}
+ }
- _focusedItem = itemId;
+ // This override function is invoked before chosen focusable actor will be focused.
+ // This allows the application to preform any actions (i.e. Scroll and SpotLight animations) before the focus is actually moved to the chosen actor.
+ public override void OnKeyboardFocusChangeCommitted(Actor commitedFocusableActor)
+ {
+ Focus(_focusedItem);
+ }
- Vector3 itemPosition = GetItemPosition(_focusedItem, _currentScrollPosition);
+ // This override function is invoked whenever a pan gesture is detected on this control.
+ // Perform Scroll Animation based upon pan gesture velocity / speed.
+ public override void OnPan(PanGesture pan)
+ {
+ switch (pan.state)
+ {
+ case Gesture.State.Started:
+ _scrollDisplacement = 0.0f;
+ break;
- _focusAnimation.Clear();
+ case Gesture.State.Continuing:
+ _scrollDisplacement = pan.displacement.x;
+ break;
- float relativeItemPositionX = itemPosition.x - _itemSize.width * 0.5f + (_stageSize.width * 0.5f) + _offsetX;
- if (relativeItemPositionX < _marginX + _offsetX + _padding)
- {
- float amount = _marginX + _offsetX + _padding - relativeItemPositionX;
- Scroll(amount, itemId + 1); // Perform Scroll animation
- }
- else if (relativeItemPositionX + _itemSize.width + _padding + _marginX > _stageSize.width)
- {
- float amount = relativeItemPositionX + _marginX + _padding + _itemSize.width - _stageSize.width;
- Scroll(-amount, itemId - 1); // Perform Scroll animation
- }
- else
- {
- for (int i = 0; i < _itemList.Count; ++i)
- {
- Vector3 targetPosition = GetItemPosition(i, _currentScrollPosition);
- _focusAnimation.AnimateTo(new Property(_itemList[i], Actor.Property.POSITION),
- new Property.Value(targetPosition),
- new AlphaFunction(AlphaFunction.BuiltinFunction.EASE_OUT_SINE));
- }
- }
+ case Gesture.State.Finished:
+ case Gesture.State.Cancelled:
+ float absScrollDistance = _scrollDisplacement;
+ if (absScrollDistance < 0.0f)
+ absScrollDistance = 0.0f - absScrollDistance;
- for (int i = 0; i < _itemList.Count; ++i)
- {
- SetupItemRenderer(_itemList[i], false);
+ float scrollSpeed = pan.velocity.x * pan.velocity.x + pan.velocity.y * pan.velocity.y;
+ float maxScrollSpeed = 40.0f; // TBD
+ if (scrollSpeed > maxScrollSpeed)
+ scrollSpeed = maxScrollSpeed;
- // Perform Focus animation
- if (i == _focusedItem)
- {
- _focusAnimation.AnimateTo(new Property(_itemList[i], Actor.Property.SCALE),
- new Property.Value(new Vector3(1.2f, 1.2f, 1.2f)),
- new AlphaFunction(AlphaFunction.BuiltinFunction.EASE_OUT_SINE));
- }
- else
+ if (absScrollDistance > 1.0f && scrollSpeed > 0.05f) // Threshold TBD
{
- _focusAnimation.AnimateTo(new Property(_itemList[i], Actor.Property.SCALE),
- new Property.Value(new Vector3(1.0f, 1.0f, 1.0f)),
- new AlphaFunction(AlphaFunction.BuiltinFunction.EASE_OUT_SINE));
+ if (_scrollDisplacement > 0.0f) // scroll constant distance in constant speed.
+ {
+ Scroll((_itemSize.x + _gap) * 2, GetFirstVisibleItemId());
+ }
+ else
+ {
+ Scroll(-(_itemSize.x + _gap) * 2, GetFirstVisibleItemId());
+ }
}
+ break;
}
+ }
- _focusAnimation.Play();
-
- if (_isFocused && _focusedItem >= 0)
+ // This function returns current focused actor
+ public View GetCurrentFocusedActor()
+ {
+ if (_focusedItem < 0)
{
- SetupItemRenderer(_itemList[_focusedItem], true);
- SetupSpotLightRenderer();
+ _focusedItem = 0;
}
return _itemList[_focusedItem];
}
- // Perform EddenEffect animation on Focused Item specified
- public void FocusAnimation(FocusEffect focusEffect, FocusEffectDirection direction)
- {
- focusEffect.FocusAnimation(_itemList[_focusedItem], _itemSize, 1.0f, direction);
- }
-
public void SetFocused(bool focused)
{
_isFocused = focused;
SetupItemRenderer(_itemList[i], false);
Vector3 targetPosition = GetItemPosition(i, _currentScrollPosition);
- _focusTransitionAnimation.AnimateTo(new Property(_itemList[i], Actor.Property.POSITION),
- new Property.Value(targetPosition),
+ _focusTransitionAnimation.AnimateTo(new Dali.Property(_itemList[i], Actor.Property.POSITION),
+ new Dali.Property.Value(targetPosition),
new AlphaFunction(AlphaFunction.BuiltinFunction.EASE_OUT_SINE));
- _focusTransitionAnimation.AnimateTo(new Property(_itemList[i], Actor.Property.SCALE),
- new Property.Value(new Vector3(1.0f, 1.0f, 1.0f)),
+ _focusTransitionAnimation.AnimateTo(new Dali.Property(_itemList[i], Actor.Property.SCALE),
+ new Dali.Property.Value(new Vector3(1.0f, 1.0f, 1.0f)),
new AlphaFunction(AlphaFunction.BuiltinFunction.EASE_OUT_SINE));
}
}
// Obtain ID of first visible item/image on the screen of the ScrollContainer
- public int GetFirstVisibleItemId()
+ private int GetFirstVisibleItemId()
{
int firstItemId = -1;
if (_isFocused)
{
- firstItemId = (int)Math.Floor((-1.0 * _currentScrollPosition + _marginX * 2.0f) / (_itemSize.x + _padding));
+ firstItemId = (int)Math.Floor((-1.0 * _currentScrollPosition + _marginX * 2.0f) / (_itemSize.x + _gap));
}
else
{
- firstItemId = (int)Math.Floor(-1.0 * _currentScrollPosition / (_itemSize.x + _padding));
+ firstItemId = (int)Math.Floor(-1.0 * _currentScrollPosition / (_itemSize.x + _gap));
}
if (firstItemId < 0)
}
// Obtain ID of last visible item/image on the screen of the ScrollContainer
- public int GetLastVisibleItemId()
+ private int GetLastVisibleItemId()
{
int lastItemId = -1;
}
// Obtain Next item/image (Right of the currently focused item) of the ScrollContainer
- public Actor FocusNext()
+ private Actor FocusNext(bool loopEnabled)
{
int nextItem = -1;
nextItem = _focusedItem + 1;
}
- return Focus(nextItem);
+ if (nextItem >= _itemList.Count)
+ {
+ if (loopEnabled)
+ {
+ nextItem = 0;
+ }
+ else
+ {
+ nextItem = _itemList.Count - 1;
+ }
+ }
+
+ _focusedItem = nextItem;
+ return _itemList[_focusedItem];
}
// Obtain Previous item/image (left of the currently focused item) of the ScrollContainer
- public Actor FocusPrevious()
+ private Actor FocusPrevious(bool loopEnabled)
{
int previousItem = -1;
previousItem = _focusedItem - 1;
}
- return Focus(previousItem);
- }
-
- private void OnHideAnimationFinished(object source, Animation.FinishedEventArgs e)
- {
- var currentParent = ItemRoot.GetParent();
- if (_shouldHide && currentParent != null)
+ if (previousItem < 0)
{
- Container.Remove(ItemRoot);
- }
- }
-
- private void OnPan(object source, PanGestureDetector.DetectedEventArgs e)
- {
- switch (e.PanGesture.state)
- {
- case Gesture.State.Started:
- _scrollDisplacement = 0.0f;
- break;
-
- case Gesture.State.Continuing:
- _scrollDisplacement = e.PanGesture.displacement.x;
- break;
-
- case Gesture.State.Finished:
- case Gesture.State.Cancelled:
- float absScrollDistance = _scrollDisplacement;
- if (absScrollDistance < 0.0f)
- absScrollDistance = 0.0f - absScrollDistance;
-
- float scrollSpeed = e.PanGesture.velocity.x * e.PanGesture.velocity.x + e.PanGesture.velocity.y * e.PanGesture.velocity.y;
- float maxScrollSpeed = 40.0f; // TBD
- if (scrollSpeed > maxScrollSpeed)
- scrollSpeed = maxScrollSpeed;
-
- if (absScrollDistance > 1.0f && scrollSpeed > 0.05f) // Threshold TBD
+ if (loopEnabled)
{
- if (_scrollDisplacement > 0.0f) // scroll constant distance in constant speed.
- {
- Scroll((_itemSize.x + _padding) * 2, GetFirstVisibleItemId());
- }
- else
- {
- Scroll(-(_itemSize.x + _padding) * 2, GetFirstVisibleItemId());
- }
+ previousItem = _itemList.Count - 1;
+ }
+ else
+ {
+ previousItem = 0;
}
- break;
}
+
+ _focusedItem = previousItem;
+ return _itemList[_focusedItem];
}
// Perform ScrollAnimation on each item
private void Scroll(float amount, int baseItem)
{
float tagetScrollPosition = _currentScrollPosition + amount;
- float totalItemSize = _itemList.Count * (_itemSize.width + _padding) + _padding + (_marginX * 2.0f);
+ float totalItemSize = _itemList.Count * (_itemSize.width + _gap) + _gap + (_marginX * 2.0f);
float maxScrollPosition = _width - totalItemSize;
{
tagetScrollPosition = 0.0f;
}
-
_scrollAnimation.Clear();
for (int i = 0; i < _itemList.Count; ++i)
{
Vector3 targetPosition = GetItemPosition(i, tagetScrollPosition);
- _scrollAnimation.AnimateTo(new Property(_itemList[i], Actor.Property.POSITION),
- new Property.Value(targetPosition),
+ _scrollAnimation.AnimateTo(new Dali.Property(_itemList[i], Actor.Property.POSITION),
+ new Dali.Property.Value(targetPosition),
new AlphaFunction(AlphaFunction.BuiltinFunction.EASE_OUT_SINE));
}
_scrollAnimation.Play();
}
+ // This function uses ItemId as next FocusedItem and preforms Scroll and SpotLight animations on that item.
+ private void Focus(int itemId)
+ {
+ if (itemId < 0)
+ {
+ itemId = 0;
+ }
+ else if (itemId >= _itemList.Count)
+ {
+ itemId = _itemList.Count - 1;
+ }
+
+ _itemList[itemId].Add(_shadowBorder);
+ _itemList[itemId].Add(_spotLight);
+
+ // Perform Spot Light animation
+ if(_focusedItem != itemId && _spotLight != null)
+ {
+ _spotLightAnimation.Clear();
+ _spotLightAnimation.Animate( _spotLight, _circularPath, new Vector3(0.0f, 0.0f, 0.0f) );
+ _spotLightAnimation.SetLooping(true);
+ _spotLightAnimation.Play();
+ }
+
+ _focusedItem = itemId;
+
+ Vector3 itemPosition = GetItemPosition(_focusedItem, _currentScrollPosition);
+
+ _focusAnimation.Clear();
+
+ float relativeItemPositionX = itemPosition.x - _itemSize.width * 0.5f + (_stageSize.width * 0.5f) + _offsetX;
+ if (relativeItemPositionX < _marginX + _offsetX + _gap)
+ {
+ float amount = _marginX + _offsetX + _gap - relativeItemPositionX;
+ Scroll(amount, itemId + 1); // Perform Scroll animation
+ }
+ else if (relativeItemPositionX + _itemSize.width + _gap + _marginX > _stageSize.width)
+ {
+ float amount = relativeItemPositionX + _marginX + _gap + _itemSize.width - _stageSize.width;
+ Scroll(-amount, itemId - 1); // Perform Scroll animation
+ }
+ else
+ {
+ // Perform animation when item is focused
+ for (int i = 0; i < _itemList.Count; ++i)
+ {
+ Vector3 targetPosition = GetItemPosition(i, _currentScrollPosition);
+ _focusAnimation.AnimateTo(new Dali.Property(_itemList[i], Actor.Property.POSITION),
+ new Dali.Property.Value(targetPosition),
+ new AlphaFunction(AlphaFunction.BuiltinFunction.EASE_OUT_SINE));
+ }
+ }
+
+ for (int i = 0; i < _itemList.Count; ++i)
+ {
+ SetupItemRenderer(_itemList[i], false);
+
+ // Perform scale animation on Focused item
+ if (i == _focusedItem)
+ {
+ _focusAnimation.AnimateTo(new Dali.Property(_itemList[i], Actor.Property.SCALE),
+ new Dali.Property.Value(new Vector3(1.2f, 1.2f, 1.2f)),
+ new AlphaFunction(AlphaFunction.BuiltinFunction.EASE_OUT_SINE));
+ }
+ else
+ {
+ _focusAnimation.AnimateTo(new Dali.Property(_itemList[i], Actor.Property.SCALE),
+ new Dali.Property.Value(new Vector3(1.0f, 1.0f, 1.0f)),
+ new AlphaFunction(AlphaFunction.BuiltinFunction.EASE_OUT_SINE));
+ }
+ }
+
+ _focusAnimation.Play();
+
+ if (_isFocused && _focusedItem >= 0)
+ {
+ SetupItemRenderer(_itemList[_focusedItem], true);
+ SetupSpotLightRenderer();
+ }
+ }
+
// Calculate Position of any item/image of ScrollContainer
private Vector3 GetItemPosition(int itemId, float scrollPosition)
{
// used (_stageSize.width * 0.5f) because of ParentOriginCenter
if (_focusedItem > itemId)
{
- float positionX = (_itemSize.width * itemId) + (_padding * (itemId + 1)) + scrollPosition + (_itemSize.width * 0.5f) - (_stageSize.width * 0.5f);
- return new Vector3(positionX, -_itemSize.height * _offsetY, 0.0f);
+ float positionX = (_itemSize.width * itemId) + (_gap * (itemId + 1)) + scrollPosition + (_itemSize.width * 0.5f) - (_stageSize.width * 0.5f);
+ return new Vector3(positionX, -_itemSize.height * _offsetYFactor, 0.0f);
}
else if (_focusedItem == itemId)
{
- float positionX = (_itemSize.width * itemId) + (_padding * (itemId + 1)) + scrollPosition + _marginX + (_itemSize.width * 0.5f) - (_stageSize.width * 0.5f);
- return new Vector3(positionX, -_itemSize.height * _offsetY, 0.0f);
+ float positionX = (_itemSize.width * itemId) + (_gap * (itemId + 1)) + scrollPosition + _marginX + (_itemSize.width * 0.5f) - (_stageSize.width * 0.5f);
+ return new Vector3(positionX, -_itemSize.height * _offsetYFactor, 0.0f);
}
else
{
- float positionX = (_itemSize.width * itemId) + (_padding * (itemId + 1)) + scrollPosition + _marginX * 2.0f + (_itemSize.width * 0.5f) - (_stageSize.width * 0.5f);
- return new Vector3(positionX, -_itemSize.height * _offsetY, 0.0f);
+ float positionX = (_itemSize.width * itemId) + (_gap * (itemId + 1)) + scrollPosition + _marginX * 2.0f + (_itemSize.width * 0.5f) - (_stageSize.width * 0.5f);
+ return new Vector3(positionX, -_itemSize.height * _offsetYFactor, 0.0f);
}
}
else
{
- float positionX = (_itemSize.width * itemId) + (_padding * (itemId + 1)) + scrollPosition + (_itemSize.width * 0.5f) - (_stageSize.width * 0.5f);
- return new Vector3(positionX, -_itemSize.height * _offsetY, 0.0f);
+ float positionX = (_itemSize.width * itemId) + (_gap * (itemId + 1)) + scrollPosition + (_itemSize.width * 0.5f) - (_stageSize.width * 0.5f);
+ return new Vector3(positionX, -_itemSize.height * _offsetYFactor, 0.0f);
}
}
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProjectGuid>{7606F35D-21C4-48CE-A38F-A24D6BEDB996}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>firstscreen</RootNamespace>
+ <AssemblyName>firstscreen</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug</OutputPath>
+ <DefineConstants>DEBUG;</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ <PlatformTarget>x86</PlatformTarget>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <DebugType>full</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <ConsolePause>false</ConsolePause>
+ <PlatformTarget>x86</PlatformTarget>
+ </PropertyGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <ItemGroup>
+ <Compile Include="App.cs" />
+ <Compile Include="Constants.cs" />
+ <Compile Include="FocusData.cs" />
+ <Compile Include="FocusEffect.cs" />
+ <Compile Include="IFocusEffect.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="ScrollContainer.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Reference Include="NDali">
+ <HintPath>..\..\NDali.dll</HintPath>
+ </Reference>
+ </ItemGroup>
+</Project>
\ No newline at end of file
--- /dev/null
+\r
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio 2012\r
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "firstscreen", "firstscreen.csproj", "{7606F35D-21C4-48CE-A38F-A24D6BEDB996}"\r
+EndProject\r
+Global\r
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+ Debug|x86 = Debug|x86\r
+ Release|x86 = Release|x86\r
+ EndGlobalSection\r
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+ {7606F35D-21C4-48CE-A38F-A24D6BEDB996}.Debug|x86.ActiveCfg = Debug|x86\r
+ {7606F35D-21C4-48CE-A38F-A24D6BEDB996}.Debug|x86.Build.0 = Debug|x86\r
+ {7606F35D-21C4-48CE-A38F-A24D6BEDB996}.Release|x86.ActiveCfg = Release|x86\r
+ {7606F35D-21C4-48CE-A38F-A24D6BEDB996}.Release|x86.Build.0 = Release|x86\r
+ EndGlobalSection\r
+EndGlobal\r
--- /dev/null
+/*
+ * Copyright (c) 2016 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.
+ *
+ */
+
+#ifndef CSHARP_CALLBACK_BASE
+#define CSHARP_CALLBACK_BASE
+#endif
+
+#include "common.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_Dali_MakeCallback(void * jarg1) {
+ void * jresult ;
+ void (*arg1)(void) = (void (*)(void)) 0 ;
+ Dali::CallbackBase *result = 0 ;
+
+ arg1 = (void (*)(void))jarg1;
+ {
+ try {
+ result = (Dali::CallbackBase *)Dali::MakeCallback(arg1);
+ } catch (std::out_of_range& e) {
+ {
+ SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
+ };
+ } catch (std::exception& e) {
+ {
+ SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return 0;
+ };
+ } catch (...) {
+ {
+ SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return 0;
+ };
+ }
+ }
+
+ jresult = (void *)result;
+
+ return jresult;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
--- /dev/null
+// Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+// PROPRIETARY/CONFIDENTIAL
+// This software is the confidential and proprietary
+// information of SAMSUNG ELECTRONICS ("Confidential Information"). You shall
+// not disclose such Confidential Information and shall use it only in
+// accordance with the terms of the license agreement you entered into with
+// SAMSUNG ELECTRONICS.
+//
+
+using System;
+using System.Collections.Generic;
+
+namespace Dali
+{
+
+ public class DisposeQueue
+ {
+ private static DisposeQueue _disposableQueue = new DisposeQueue();
+ private List<IDisposable> _disposables = new List<IDisposable>();
+ private Object _listLock = new object();
+ private delegate int ProcessDisposablesDelegate(IntPtr ptr);
+ private ProcessDisposablesDelegate _disposequeueProcessDisposablesDelegate;
+
+ private DisposeQueue()
+ {
+ _disposequeueProcessDisposablesDelegate = new ProcessDisposablesDelegate(ProcessDisposables);
+ Application.Instance.AddIdle(_disposequeueProcessDisposablesDelegate);
+ }
+
+ ~DisposeQueue()
+ {
+ }
+
+ public static DisposeQueue Instance
+ {
+ get { return _disposableQueue; }
+ }
+
+ public void Add(IDisposable disposable)
+ {
+ lock(_listLock)
+ {
+ _disposables.Add(disposable);
+ }
+ }
+
+ private int ProcessDisposables(IntPtr ptr)
+ {
+ lock(_listLock)
+ {
+ foreach (IDisposable disposable in _disposables)
+ {
+ disposable.Dispose();
+ }
+ _disposables.Clear();
+ }
+ return 0;
+ }
+ }
+}
}
~KeyboardFocusManager() {
- Dispose();
+ DisposeQueue.Instance.Add(this);
}
public override void Dispose() {
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
}
~KeyboardPreFocusChangeSignal() {
- Dispose();
+ DisposeQueue.Instance.Add(this);
}
public virtual void Dispose() {
+ if (!Stage.IsInstalled()) {
+ DisposeQueue.Instance.Add(this);
+ return;
+ }
+
lock(this) {
if (swigCPtr.Handle != global::System.IntPtr.Zero) {
if (swigCMemOwn) {
[global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Dali_ViewWrapperImpl_ApplyThemeStyle")]
public static extern void ViewWrapperImpl_ApplyThemeStyle(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport("NDalic", EntryPoint="CSharp_Dali_MakeCallback")]
+ public static extern global::System.IntPtr MakeCallback(global::System.Runtime.InteropServices.HandleRef jarg1);
+
}
}