#include <dali/integration-api/events/tap-gesture-event.h>
#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h>
using namespace Dali;
using namespace Toolkit;
const char* const PROPERTY_NAME_OUTLINE = "outline";
const char* const PROPERTY_NAME_INPUT_OUTLINE = "inputOutline";
+const char* const PROPERTY_NAME_SMOOTH_SCROLL = "smoothScroll";
+const char* const PROPERTY_NAME_SMOOTH_SCROLL_DURATION = "smoothScrollDuration";
+
const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
const Dali::Vector4 LIGHT_BLUE( 0.75f, 0.96f, 1.f, 1.f ); // The text highlight color.
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_EMBOSS ) == TextEditor::Property::INPUT_EMBOSS );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_OUTLINE ) == TextEditor::Property::OUTLINE );
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_INPUT_OUTLINE ) == TextEditor::Property::INPUT_OUTLINE );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SMOOTH_SCROLL ) == DevelTextEditor::Property::SMOOTH_SCROLL );
+ DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_SMOOTH_SCROLL_DURATION ) == DevelTextEditor::Property::SMOOTH_SCROLL_DURATION );
END_TEST;
}
editor.SetProperty( TextEditor::Property::INPUT_OUTLINE, "Outline input properties" );
DALI_TEST_EQUALS( editor.GetProperty<std::string>( TextEditor::Property::INPUT_OUTLINE ), std::string("Outline input properties"), TEST_LOCATION );
+ // Check the smooth scroll property
+ DALI_TEST_EQUALS( editor.GetProperty<bool>( DevelTextEditor::Property::SMOOTH_SCROLL ), false, TEST_LOCATION );
+ editor.SetProperty( DevelTextEditor::Property::SMOOTH_SCROLL, true );
+ DALI_TEST_EQUALS( editor.GetProperty<bool>( DevelTextEditor::Property::SMOOTH_SCROLL ), true, TEST_LOCATION );
+
+ // Check the smooth scroll duration property
+ editor.SetProperty( DevelTextEditor::Property::SMOOTH_SCROLL_DURATION, 0.2f );
+ DALI_TEST_EQUALS( editor.GetProperty<float>( DevelTextEditor::Property::SMOOTH_SCROLL_DURATION ), 0.2f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+
END_TEST;
}
END_TEST;
}
+
+int utcDaliTextEditorEvent05(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline(" utcDaliTextEditorEvent05");
+
+ // 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( 50.f, 50.f );
+ editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ editor.SetProperty( DevelTextEditor::Property::SMOOTH_SCROLL, true );
+ editor.SetProperty( DevelTextEditor::Property::SMOOTH_SCROLL_DURATION, 0.2f );
+
+ // 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 )
+ {
+ // Add a character
+ application.ProcessEvent( GenerateKey( "d", "d", 0, 0, 0, Integration::KeyEvent::Down ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+ }
+ // Modify duration after scroll is enabled
+ editor.SetProperty( DevelTextEditor::Property::SMOOTH_SCROLL_DURATION, 0.1f );
+
+ // Continuous scroll left to increase coverage
+ for( unsigned int index = 0u; index < 10u; ++index )
+ {
+ application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, 0, 0, Integration::KeyEvent::Down ) );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+ }
+ DALI_TEST_EQUALS( editor.GetProperty<float>( DevelTextEditor::Property::SMOOTH_SCROLL_DURATION ), 0.1f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( editor.GetProperty<bool>( DevelTextEditor::Property::SMOOTH_SCROLL ), true, TEST_LOCATION );
+
+ END_TEST;
+}
--- /dev/null
+#ifndef DALI_TOOLKIT_TEXT_EDITOR_DEVEL_H
+#define DALI_TOOLKIT_TEXT_EDITOR_DEVEL_H
+
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/text-controls/text-editor.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace DevelTextEditor
+{
+
+namespace Property
+{
+ enum Type
+ {
+ RENDERING_BACKEND = Dali::Toolkit::TextEditor::Property::RENDERING_BACKEND,
+ TEXT = Dali::Toolkit::TextEditor::Property::TEXT,
+ TEXT_COLOR = Dali::Toolkit::TextEditor::Property::TEXT_COLOR,
+ FONT_FAMILY = Dali::Toolkit::TextEditor::Property::FONT_FAMILY,
+ FONT_STYLE = Dali::Toolkit::TextEditor::Property::FONT_STYLE,
+ POINT_SIZE = Dali::Toolkit::TextEditor::Property::POINT_SIZE,
+ HORIZONTAL_ALIGNMENT = Dali::Toolkit::TextEditor::Property::HORIZONTAL_ALIGNMENT,
+ SCROLL_THRESHOLD = Dali::Toolkit::TextEditor::Property::SCROLL_THRESHOLD,
+ SCROLL_SPEED = Dali::Toolkit::TextEditor::Property::SCROLL_SPEED,
+ PRIMARY_CURSOR_COLOR = Dali::Toolkit::TextEditor::Property::PRIMARY_CURSOR_COLOR,
+ SECONDARY_CURSOR_COLOR = Dali::Toolkit::TextEditor::Property::SECONDARY_CURSOR_COLOR,
+ ENABLE_CURSOR_BLINK = Dali::Toolkit::TextEditor::Property::ENABLE_CURSOR_BLINK,
+ CURSOR_BLINK_INTERVAL = Dali::Toolkit::TextEditor::Property::CURSOR_BLINK_INTERVAL,
+ CURSOR_BLINK_DURATION = Dali::Toolkit::TextEditor::Property::CURSOR_BLINK_DURATION,
+ CURSOR_WIDTH = Dali::Toolkit::TextEditor::Property::CURSOR_WIDTH,
+ GRAB_HANDLE_IMAGE = Dali::Toolkit::TextEditor::Property::GRAB_HANDLE_IMAGE,
+ GRAB_HANDLE_PRESSED_IMAGE = Dali::Toolkit::TextEditor::Property::GRAB_HANDLE_PRESSED_IMAGE,
+ SELECTION_HANDLE_IMAGE_LEFT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_IMAGE_LEFT,
+ SELECTION_HANDLE_IMAGE_RIGHT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_IMAGE_RIGHT,
+ SELECTION_HANDLE_PRESSED_IMAGE_LEFT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT,
+ SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT,
+ SELECTION_HANDLE_MARKER_IMAGE_LEFT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT,
+ SELECTION_HANDLE_MARKER_IMAGE_RIGHT = Dali::Toolkit::TextEditor::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT,
+ SELECTION_HIGHLIGHT_COLOR = Dali::Toolkit::TextEditor::Property::SELECTION_HIGHLIGHT_COLOR,
+ DECORATION_BOUNDING_BOX = Dali::Toolkit::TextEditor::Property::DECORATION_BOUNDING_BOX,
+ ENABLE_MARKUP = Dali::Toolkit::TextEditor::Property::ENABLE_MARKUP,
+ INPUT_COLOR = Dali::Toolkit::TextEditor::Property::INPUT_COLOR,
+ INPUT_FONT_FAMILY = Dali::Toolkit::TextEditor::Property::INPUT_FONT_FAMILY,
+ INPUT_FONT_STYLE = Dali::Toolkit::TextEditor::Property::INPUT_FONT_STYLE,
+ INPUT_POINT_SIZE = Dali::Toolkit::TextEditor::Property::INPUT_POINT_SIZE,
+ LINE_SPACING = Dali::Toolkit::TextEditor::Property::LINE_SPACING,
+ INPUT_LINE_SPACING = Dali::Toolkit::TextEditor::Property::INPUT_LINE_SPACING,
+ UNDERLINE = Dali::Toolkit::TextEditor::Property::UNDERLINE,
+ INPUT_UNDERLINE = Dali::Toolkit::TextEditor::Property::INPUT_UNDERLINE,
+ SHADOW = Dali::Toolkit::TextEditor::Property::SHADOW,
+ INPUT_SHADOW = Dali::Toolkit::TextEditor::Property::INPUT_SHADOW,
+ EMBOSS = Dali::Toolkit::TextEditor::Property::EMBOSS,
+ INPUT_EMBOSS = Dali::Toolkit::TextEditor::Property::INPUT_EMBOSS,
+ OUTLINE = Dali::Toolkit::TextEditor::Property::OUTLINE,
+ INPUT_OUTLINE = Dali::Toolkit::TextEditor::Property::INPUT_OUTLINE,
+
+ /**
+ * @brief name "smoothScroll", type bool
+ * @details Enable or disable the smooth scroll animation
+ */
+ SMOOTH_SCROLL = INPUT_OUTLINE + 1,
+
+ /**
+ * @brief name "smoothScrollDuration", type float
+ * @details Sets the duration of smooth scroll animation
+ */
+ SMOOTH_SCROLL_DURATION
+ };
+} // namespace Property
+
+} // namespace DevelText
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_EDITOR_DEVEL_H
\ No newline at end of file
$(devel_api_src_dir)/controls/super-blur-view/super-blur-view.h
devel_api_text_controls_header_files = \
+ $(devel_api_src_dir)/controls/text-controls/text-editor-devel.h \
$(devel_api_src_dir)/controls/text-controls/text-selection-popup.h \
$(devel_api_src_dir)/controls/text-controls/text-selection-toolbar.h
#include <dali/public-api/common/stage.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/devel-api/adaptor-framework/virtual-keyboard.h>
+#include <dali/devel-api/object/property-helper-devel.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/integration-api/adaptors/adaptor.h>
#include <dali/integration-api/debug.h>
#include <dali-toolkit/public-api/text/rendering-backend.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/controls/text-controls/text-editor-devel.h>
#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/text/rendering/text-backend.h>
#include <dali-toolkit/internal/text/text-effects-style.h>
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputEmboss", MAP, INPUT_EMBOSS )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "outline", MAP, OUTLINE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "inputOutline", MAP, INPUT_OUTLINE )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "smoothScroll", BOOLEAN, SMOOTH_SCROLL )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "smoothScrollDuration", FLOAT, SMOOTH_SCROLL_DURATION )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED )
}
break;
}
+ case Toolkit::DevelTextEditor::Property::SMOOTH_SCROLL:
+ {
+ const bool enable = value.Get< bool >();
+ DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor SMOOTH_SCROLL %d\n", enable );
+
+ impl.mScrollAnimationEnabled = enable;
+ break;
+ }
+ case Toolkit::DevelTextEditor::Property::SMOOTH_SCROLL_DURATION:
+ {
+ const float duration = value.Get< float >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor SMOOTH_SCROLL_DURATION %f\n", duration );
+
+ impl.mScrollAnimationDuration = duration;
+ if ( impl.mTextVerticalScroller )
+ {
+ impl.mTextVerticalScroller->SetDuration( duration );
+ }
+ break;
+ }
} // switch
} // texteditor
}
GetOutlineProperties( impl.mController, value, Text::EffectStyle::INPUT );
break;
}
+ case Toolkit::DevelTextEditor::Property::SMOOTH_SCROLL:
+ {
+ value = impl.mScrollAnimationEnabled;
+ break;
+ }
+ case Toolkit::DevelTextEditor::Property::SMOOTH_SCROLL_DURATION:
+ {
+ value = impl.mScrollAnimationDuration;
+ break;
+ }
} //switch
}
if( mRenderableActor )
{
- const Vector2& scrollOffset = mController->GetTextModel()->GetScrollPosition();
-
- mRenderableActor.SetPosition( scrollOffset.x + mAlignmentOffset, scrollOffset.y );
-
// Make sure the actors are parented correctly with/without clipping
Actor self = mStencil ? mStencil : Self();
mClippingDecorationActors.clear();
self.Add( mRenderableActor );
+
+ ApplyScrollPosition();
}
}
mIdleCallback = NULL;
}
+void TextEditor::ApplyScrollPosition()
+{
+ const Vector2& scrollOffset = mController->GetTextModel()->GetScrollPosition();
+ float scrollAmount = 0.0f;
+
+ if ( mScrollAnimationEnabled )
+ {
+ scrollAmount = mController->GetScrollAmountByUserInput();
+ }
+ if ( mTextVerticalScroller )
+ {
+ mTextVerticalScroller->CheckStartAnimation( mRenderableActor, scrollOffset.x + mAlignmentOffset, scrollOffset.y - scrollAmount, scrollAmount );
+ }
+ else if ( Equals( scrollAmount, 0.0f, Math::MACHINE_EPSILON_1 ))
+ {
+ mRenderableActor.SetPosition( scrollOffset.x + mAlignmentOffset, scrollOffset.y - scrollAmount );
+ }
+ else
+ {
+ mTextVerticalScroller = Text::TextVerticalScroller::New();
+ if ( !Equals( mScrollAnimationDuration, 0.0f, Math::MACHINE_EPSILON_1 ))
+ {
+ mTextVerticalScroller->SetDuration( mScrollAnimationDuration );
+ }
+ mTextVerticalScroller->CheckStartAnimation( mRenderableActor, scrollOffset.x + mAlignmentOffset, scrollOffset.y - scrollAmount, scrollAmount );
+ }
+}
+
TextEditor::TextEditor()
: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
mIdleCallback( NULL ),
mAlignmentOffset( 0.f ),
+ mScrollAnimationDuration( 0.f ),
mRenderingBackend( DEFAULT_RENDERING_BACKEND ),
- mHasBeenStaged( false )
+ mHasBeenStaged( false ),
+ mScrollAnimationEnabled( false )
{
}
#include <dali-toolkit/internal/text/text-control-interface.h>
#include <dali-toolkit/internal/text/text-editable-control-interface.h>
#include <dali-toolkit/internal/text/text-controller.h>
+#include <dali-toolkit/internal/text/text-vertical-scroller.h>
#include <dali-toolkit/internal/text/rendering/text-renderer.h>
namespace Dali
void OnIdleSignal();
/**
+ * @brief set RenderActor's position with new scrollPosition
+ *
+ * Apply updated scroll position or start scroll animation if VerticalScrollAnimation is enabled
+ */
+ void ApplyScrollPosition();
+
+ /**
* Construct a new TextEditor.
*/
TextEditor();
Text::ControllerPtr mController;
Text::RendererPtr mRenderer;
Text::DecoratorPtr mDecorator;
+ Text::TextVerticalScrollerPtr mTextVerticalScroller;
Toolkit::Control mStencil;
std::vector<Actor> mClippingDecorationActors; ///< Decoration actors which need clipping.
CallbackBase* mIdleCallback;
float mAlignmentOffset;
+ float mScrollAnimationDuration;
int mRenderingBackend;
bool mHasBeenStaged:1;
+ bool mScrollAnimationEnabled:1;
};
} // namespace Internal
$(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-vertical-scroller.cpp \
$(toolkit_src_dir)/text/text-view.cpp \
$(toolkit_src_dir)/text/text-view-interface.cpp \
$(toolkit_src_dir)/text/visual-model-impl.cpp \
bool mScrollAfterDelete : 1; ///< Whether to scroll after delete characters.
bool mAllTextSelected : 1; ///< True if the selection handles are selecting all the text.
bool mUpdateInputStyle : 1; ///< Whether to update the input style after moving the cursor.
+ bool mCheckScrollAmount : 1; ///< Whether to check scrolled amount after updating the position
};
struct ModifyEvent
return mImpl->mModel.Get();
}
+float Controller::GetScrollAmountByUserInput()
+{
+ float scrollAmount = 0.0f;
+
+ if (NULL != mImpl->mEventData && mImpl->mEventData->mCheckScrollAmount)
+ {
+ scrollAmount = mImpl->mModel->mScrollPosition.y - mImpl->mModel->mScrollPositionLast.y;
+ mImpl->mEventData->mCheckScrollAmount = false;
+ }
+ return scrollAmount;
+}
+
// public : Relayout.
Controller::UpdateTextType Controller::Relayout( const Size& size )
// Do not re-do any operation until something changes.
mImpl->mOperationsPending = NO_OPERATION;
+ mImpl->mModel->mScrollPositionLast = mImpl->mModel->mScrollPosition;
// Whether the text control is editable
const bool isEditable = NULL != mImpl->mEventData;
( Dali::DALI_KEY_CURSOR_UP == keyCode ) ||
( Dali::DALI_KEY_CURSOR_DOWN == keyCode ) )
{
+ mImpl->mEventData->mCheckScrollAmount = true;
+
Event event( Event::CURSOR_KEY_EVENT );
event.p1.mInt = keyCode;
mImpl->mEventData->mEventQueue.push_back( event );
return;
}
+ mImpl->mEventData->mCheckScrollAmount = true;
+
// The natural size needs to be re-calculated.
mImpl->mRecalculateNaturalSize = true;
return;
}
+ mImpl->mEventData->mCheckScrollAmount = true;
+
// The natural size needs to be re-calculated.
mImpl->mRecalculateNaturalSize = true;
mImpl->mEventData->mEventQueue.push_back( event );
}
+ mImpl->mEventData->mCheckScrollAmount = true;
mImpl->RequestRelayout();
}
}
*/
const ModelInterface* const GetTextModel() const;
+ /**
+ * @brief Used to get scrolled distance by user input
+ *
+ * @return Distance from last scroll offset to new scroll offset
+ */
+ float GetScrollAmountByUserInput();
+
public: // Relayout.
/**
: mLogicalModel(),
mVisualModel(),
mScrollPosition(),
+ mScrollPositionLast(),
mHorizontalAlignment( Layout::HORIZONTAL_ALIGN_BEGIN ),
mVerticalAlignment( Layout::VERTICAL_ALIGN_TOP ),
mAlignmentOffset( 0.0f ),
* Typically this will have a negative value with scrolling occurs.
*/
Vector2 mScrollPosition; ///< The text is offset by this position when scrolling.
+ Vector2 mScrollPositionLast; ///< The last offset value of mScrollPosition
Layout::HorizontalAlignment mHorizontalAlignment; ///< The layout's horizontal alignment.
Layout::VerticalAlignment mVerticalAlignment; ///< The layout's vertical alignment.
float mAlignmentOffset; ///< The alignment offset.
--- /dev/null
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali-toolkit/internal/text/text-vertical-scroller.h>
+
+// EXTERNAL INCLUDES
+
+// INTERNAL INCLUDES
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace
+{
+
+const float DEFAULT_VERTICAL_SCROLL_DURATION(0.15f); ///< Duration to complete scroll animation
+
+} // namespace
+
+namespace Text
+{
+
+TextVerticalScrollerPtr TextVerticalScroller::New()
+{
+ TextVerticalScrollerPtr textScroller( new TextVerticalScroller() );
+ return textScroller;
+}
+
+TextVerticalScroller::TextVerticalScroller()
+: mDuration( DEFAULT_VERTICAL_SCROLL_DURATION )
+{
+}
+
+TextVerticalScroller::~TextVerticalScroller()
+{
+}
+
+void TextVerticalScroller::CheckStartAnimation( Actor& sourceActor, float x, float y, float scrollAmount )
+{
+ if ( Equals( scrollAmount, 0.0f, Math::MACHINE_EPSILON_1 ) )
+ {
+ // scroll animation isn't required, set position only
+ if( mScrollAnimation && mScrollAnimation.GetState() == Animation::PLAYING )
+ {
+ mScrollAnimation.Clear();
+ }
+ sourceActor.SetPosition( x, y );
+ return;
+ }
+ float toY = y + scrollAmount;
+ // Either actor or scroll area is changed, so restart animation
+ if( mScrollAnimation )
+ {
+ mScrollAnimation.Clear();
+ }
+ else
+ {
+ // Create animation at first
+ mScrollAnimation = Animation::New( mDuration );
+ }
+ mScrollingActor = sourceActor;
+ mScrollTo = toY;
+
+ // Set animation attribute
+ sourceActor.SetPosition( x, y );
+ mScrollAnimation.AnimateTo( Property(sourceActor, Actor::Property::POSITION_Y), mScrollTo, AlphaFunction::EASE_OUT_SINE );
+ mScrollAnimation.Play();
+}
+
+void TextVerticalScroller::SetDuration( float duration )
+{
+ mDuration = duration;
+}
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_TOOLKIT_TEXT_VERTICAL_SCROLLER_H
+#define DALI_TOOLKIT_TEXT_VERTICAL_SCROLLER_H
+
+/*
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/public-api/actors/actor.h>
+#include <dali/public-api/animation/animation.h>
+
+// INTERNAL INCLUDES
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace Text
+{
+
+class TextVerticalScroller;
+
+typedef IntrusivePtr<TextVerticalScroller> TextVerticalScrollerPtr;
+
+/**
+ * @brief A helper class for scrolling text vertically
+ */
+class TextVerticalScroller : public RefObject, public ConnectionTracker
+{
+public:
+
+ /**
+ * @brief Text Scrolling helper, used to automatically scroll text, StartScroll should be called when scrolling is needed.
+ *
+ */
+ static TextVerticalScrollerPtr New();
+
+ /**
+ * @brief variables required to set up scrolling animation
+ * @param[in] sourceActor actor to be animated
+ * @param[in] x The new x position
+ * @param[in] y The new y position
+ * @param[in] scrollAmount The distance to destination y position for actor to be animated
+ */
+ void CheckStartAnimation( Actor& sourceActor, float x, float y, float scrollAmount );
+
+ /**
+ * @brief Set duration the text should scroll
+ * @param[in] duration The duration in seconds
+ */
+ void SetDuration( float duration );
+
+private: // Implementation
+ /**
+ * Constructor
+ */
+ TextVerticalScroller();
+
+ /**
+ * @brief Virtual Destructor.
+ */
+ virtual ~TextVerticalScroller();
+
+private:
+
+ Animation mScrollAnimation; // Animation used to update the actor's position
+ Actor mScrollingActor; // The actor being animated
+ float mDuration; // The duration of text scrolling
+ float mScrollTo; // The destination y position
+}; // TextVerticalScroller class
+
+} // namespace Text
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_VERTICAL_SCROLLER_H
STYLE_NAME = PROPERTY_START_INDEX,
/**
* @DEPRECATED_1_1.3
- * @brief name "background-color", mutually exclusive with BACKGROUND_IMAGE & BACKGROUND, type Vector4
+ * @brief name "backgroundColor", mutually exclusive with BACKGROUND_IMAGE & BACKGROUND, type Vector4
* @SINCE_1_0.0
* @see SetStyleName
*/
BACKGROUND_COLOR,
/**
* @DEPRECATED_1_1.3
- * @brief name "background-image", mutually exclusive with BACKGROUND_COLOR & BACKGROUND, type Map
+ * @brief name "backgroundImage", mutually exclusive with BACKGROUND_COLOR & BACKGROUND, type Map
* @SINCE_1_0.0
*/
BACKGROUND_IMAGE,
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 24;
+const unsigned int TOOLKIT_MICRO_VERSION = 25;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
+ [Border](@ref border-visual)
+ [Mesh](@ref mesh-visual)
+ [Primitive](@ref primitive-visual)
+ + [Text](@ref text-visual)
+ [Wireframe](@ref wireframe-visual)
Controls can provide properties that allow users to specify the visual type ( visualType ).
~~~
___________________________________________________________________________________________________
+## Text Visual {#text-visual}
+
+Renders text within a control.
+
+![ ](../assets/img/visuals/HelloWorld.png)
+![ ](visuals/HelloWorld.png)
+
+### Properties
+
+**VisualType:** Dali::Toolkit::Visual::TEXT, "TEXT"
+
+| Property | String | Type | Required | Description | Default |
+|-------------------------------------------------------------|---------------------|:-------------:|:--------:|-------------------------------------------------------------------------------|------------------------|
+| Dali::Toolkit::TextVisual::Property::TEXT | text | STRING | Yes | The text to display in UTF-8 format | |
+| Dali::Toolkit::TextVisual::Property::FONT_FAMILY | fontFamily | STRING | No | The requested font family to use | |
+| Dali::Toolkit::TextVisual::Property::FONT_STYLE | fontStyle | MAP | No | The requested font style to use | |
+| Dali::Toolkit::TextVisual::Property::POINT_SIZE | pointSize | FLOAT | Yes | The size of font in points | |
+| Dali::Toolkit::TextVisual::Property::MULTI_LINE | multiLine | BOOLEAN | No | The single-line or multi-line layout option | false |
+| Dali::Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT | horizontalAlignment | STRING | No | The line horizontal alignment: "BEGIN", "CENTER", "END" | "BEGIN" |
+| Dali::Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT | verticalAlignment | STRING | No | The line vertical alignment: "TOP", "CENTER", "BOTTOM" | "TOP" |
+| Dali::Toolkit::TextVisual::Property::TEXT_COLOR | textColor | VECTOR4 | No | The color of the text | Color::BLACK |
+| Dali::Toolkit::TextVisual::Property::ENABLE_MARKUP | enableMarkup | BOOL | No | If mark up should be enabled | |
+
+### Usage
+
+~~~{.cpp}
+ // C++
+ Dali::Stage stage = Dali::Stage::GetCurrent();
+ stage.SetBackgroundColor( Dali::Color::WHITE );
+
+ Dali::Toolkit::Control control = Dali::Toolkit::Control::New();
+ control.SetParentOrigin( ParentOrigin::CENTER );
+
+ Dali::Property::Map map;
+ map[ Dali::Toolkit::Visual::Property::TYPE ] = Dali::Toolkit::Visual::TEXT;
+ map[ Dali::Toolkit::TextVisual::Property::TEXT ] = "Hello world";
+ map[ Dali::Toolkit::TextVisual::Property::TEXT_COLOR ] = Dali::Color::BLACK;
+ map[ Dali::Toolkit::TextVisual::Property::FONT_FAMILY ] = "Sans";
+ map[ Dali::Toolkit::TextVisual::Property::POINT_SIZE ] = 30.f;
+ map[ Dali::Toolkit::TextVisual::Property::HORIZONTAL_ALIGNMENT ] = "CENTER";
+ map[ Dali::Toolkit::TextVisual::Property::VERTICAL_ALIGNMENT ] = "CENTER";
+
+ control.SetProperty( Dali::Toolkit::Control::Property::BACKGROUND, map );
+
+ stage.Add( control );
+~~~
+
## Wireframe Visual {#wireframe-visual}
Renders a wireframe around a quad geometry.
Name: dali-addon
Summary: DALi module for Node.JS
-Version: 1.2.24
+Version: 1.2.25
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.2.24
+Version: 1.2.25
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-2-Clause and MIT