/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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/devel-api/object/property-helper-devel.h>
#include <dali/devel-api/actors/actor-devel.h>
#include <dali/public-api/object/type-registry-helper.h>
-#include <dali/integration-api/adaptors/adaptor.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/text-view.h>
#include <dali-toolkit/internal/styling/style-manager-impl.h>
#include <dali-toolkit/devel-api/controls/control-devel.h>
+#include <dali/integration-api/adaptor-framework/adaptor.h>
using namespace Dali::Toolkit::Text;
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableGrabHandle", BOOLEAN, ENABLE_GRAB_HANDLE )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "matchSystemLanguageDirection", BOOLEAN, MATCH_SYSTEM_LANGUAGE_DIRECTION )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableGrabHandlePopup", BOOLEAN, ENABLE_GRAB_HANDLE_POPUP )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "textBackground", VECTOR4, BACKGROUND )
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED )
}
case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP:
{
- if (impl.mController)
+ if( impl.mController )
{
const bool grabHandlePopupEnabled = value.Get<bool>();
DALI_LOG_INFO(gLogFilter, Debug::General, "TextField %p ENABLE_GRAB_HANDLE_POPUP %d\n", impl.mController.Get(), grabHandlePopupEnabled);
break;
}
}
+ case Toolkit::DevelTextField::Property::BACKGROUND:
+ {
+ if( impl.mController )
+ {
+ const Vector4 backgroundColor = value.Get< Vector4 >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p BACKGROUND %f,%f,%f,%f\n", impl.mController.Get(), backgroundColor.r, backgroundColor.g, backgroundColor.b, backgroundColor.a );
+
+ impl.mController->SetBackgroundEnabled( true );
+ impl.mController->SetBackgroundColor( backgroundColor );
+ }
+ break;
+ }
} // switch
} // textfield
}
}
case Toolkit::DevelTextField::Property::ENABLE_GRAB_HANDLE_POPUP:
{
- if (impl.mController)
+ if( impl.mController )
{
value = impl.mController->IsGrabHandlePopupEnabled();
}
break;
}
+ case Toolkit::DevelTextField::Property::BACKGROUND:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->GetBackgroundColor();
+ }
+ break;
+ }
} //switch
}
mDecorator = Text::Decorator::New( *mController,
*mController );
- mInputMethodContext = InputMethodContext::New();
+ mInputMethodContext = InputMethodContext::New( self );
mController->GetLayoutEngine().SetLayout( Layout::Engine::SINGLE_LINE_BOX );
if( renderableActor != mRenderableActor )
{
+ UnparentAndReset( mBackgroundActor );
UnparentAndReset( mRenderableActor );
mRenderableActor = renderableActor;
+
+ if ( mRenderableActor )
+ {
+ mBackgroundActor = mController->CreateBackgroundActor();
+ }
}
}
{
const Vector2& scrollOffset = mController->GetTextModel()->GetScrollPosition();
+ float renderableActorPositionX, renderableActorPositionY;
+
if( mStencil )
{
- mRenderableActor.SetPosition( scrollOffset.x + mAlignmentOffset, scrollOffset.y );
+ renderableActorPositionX = scrollOffset.x + mAlignmentOffset;
+ renderableActorPositionY = scrollOffset.y;
}
else
{
std::swap( padding.start, padding.end );
}
- mRenderableActor.SetPosition( scrollOffset.x + mAlignmentOffset + padding.start, scrollOffset.y + padding.top );
+ renderableActorPositionX = scrollOffset.x + mAlignmentOffset + padding.start;
+ renderableActorPositionY = scrollOffset.y + padding.top;
}
+ mRenderableActor.SetPosition( renderableActorPositionX, renderableActorPositionY );
// Make sure the actors are parented correctly with/without clipping
Actor self = mStencil ? mStencil : Self();
+ Actor highlightActor;
+
for( std::vector<Actor>::iterator it = mClippingDecorationActors.begin(),
endIt = mClippingDecorationActors.end();
it != endIt;
{
self.Add( *it );
it->LowerToBottom();
+
+ if ( it->GetName() == "HighlightActor" )
+ {
+ highlightActor = *it;
+ }
}
mClippingDecorationActors.clear();
self.Add( mRenderableActor );
+
+ if ( mBackgroundActor )
+ {
+ if ( mDecorator && mDecorator->IsHighlightVisible() )
+ {
+ self.Add( mBackgroundActor );
+ mBackgroundActor.SetPosition( renderableActorPositionX, renderableActorPositionY); // In text field's coords.
+ mBackgroundActor.LowerBelow( highlightActor );
+ }
+ else
+ {
+ mRenderableActor.Add( mBackgroundActor );
+ mBackgroundActor.SetPosition( 0.0f, 0.0f ); // In renderable actor's coords.
+ mBackgroundActor.LowerToBottom();
+ }
+ }
}
}