};
const unsigned int HORIZONTAL_ALIGNMENT_STRING_TABLE_COUNT = sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE ) / sizeof( HORIZONTAL_ALIGNMENT_STRING_TABLE[0] );
+
+const Scripting::StringEnum LINE_WRAP_MODE_STRING_TABLE[] =
+{
+ { "WRAP_MODE_WORD", Toolkit::Text::Layout::LineWrap::WORD },
+ { "WRAP_MODE_CHARACTER", Toolkit::Text::Layout::LineWrap::CHARACTER }
+};
+const unsigned int LINE_WRAP_MODE_STRING_TABLE_COUNT = sizeof( LINE_WRAP_MODE_STRING_TABLE ) / sizeof( LINE_WRAP_MODE_STRING_TABLE[0] );
+
const char* const SCROLL_BAR_POSITION("sourcePosition");
const char* const SCROLL_BAR_POSITION_MIN("sourcePositionMin");
const char* const SCROLL_BAR_POSITION_MAX("sourcePositionMax");
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "placeholderTextColor", VECTOR4, PLACEHOLDER_TEXT_COLOR )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "enableSelection", BOOLEAN, ENABLE_SELECTION )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "placeholder", MAP, PLACEHOLDER )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "lineWrapMode", STRING, LINE_WRAP_MODE )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED )
const std::string& text = value.Get< std::string >();
DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor::OnPropertySet %p PLACEHOLDER_TEXT %s\n", impl.mController.Get(), text.c_str() );
- impl.mController->SetPlaceholderText( text );
+ impl.mController->SetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text );
}
break;
}
}
break;
}
+ case Toolkit::DevelTextEditor::Property::LINE_WRAP_MODE:
+ {
+ const std::string& wrapModeStr = value.Get< std::string >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p LINE_WRAP_MODE %s\n", impl.mController.Get(), wrapModeStr.c_str() );
+
+ Layout::LineWrap::Mode lineWrapMode( Layout::LineWrap::WORD );
+ if( Scripting::GetEnumeration< Layout::LineWrap::Mode >( wrapModeStr.c_str(),
+ LINE_WRAP_MODE_STRING_TABLE,
+ LINE_WRAP_MODE_STRING_TABLE_COUNT,
+ lineWrapMode ) )
+ {
+ impl.mController->SetLineWrapMode( lineWrapMode );
+ }
+ break;
+ }
} // switch
} // texteditor
}
if( impl.mController )
{
std::string text;
- impl.mController->GetPlaceholderText( text );
+ impl.mController->GetPlaceholderText( Controller::PLACEHOLDER_TYPE_INACTIVE, text );
value = text;
}
break;
value = map;
break;
}
+ case Toolkit::DevelTextEditor::Property::LINE_WRAP_MODE:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->GetLineWrapMode();
+ }
+ }
} //switch
}
// Creates an extra control to be used as stencil buffer.
mStencil = Control::New();
- mStencil.SetAnchorPoint( AnchorPoint::CENTER );
- mStencil.SetParentOrigin( ParentOrigin::CENTER );
+ mStencil.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ mStencil.SetParentOrigin( ParentOrigin::TOP_LEFT );
// Creates a background visual. Even if the color is transparent it updates the stencil.
mStencil.SetProperty( Toolkit::Control::Property::BACKGROUND,
float TextEditor::GetHeightForWidth( float width )
{
- return mController->GetHeightForWidth( width );
+ Padding padding;
+ Self().GetPadding( padding );
+ return mController->GetHeightForWidth( width ) + padding.top + padding.bottom;
}
void TextEditor::OnRelayout( const Vector2& size, RelayoutContainer& container )
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor OnRelayout\n");
- const Text::Controller::UpdateTextType updateTextType = mController->Relayout( size );
+ Actor self = Self();
+ Padding padding;
+
+ self.GetPadding( padding );
+ Vector2 contentSize( size.x - ( padding.left + padding.right ), size.y - ( padding.top + padding.bottom ) );
+
+ if( mStencil )
+ {
+ mStencil.SetPosition( padding.left , padding.top );
+ }
+ if( mActiveLayer )
+ {
+ mActiveLayer.SetPosition( padding.left , padding.top );
+ }
+
+
+ const Text::Controller::UpdateTextType updateTextType = mController->Relayout( contentSize );
if( ( Text::Controller::NONE_UPDATED != updateTextType ) ||
!mRenderer )
}
RenderText( updateTextType );
+
}
// The text-editor emits signals when the input style changes. These changes of style are
{
if( mRenderer )
{
+ Dali::Toolkit::TextEditor handle = Dali::Toolkit::TextEditor( GetOwner() );
+
renderableActor = mRenderer->Render( mController->GetView(),
+ handle,
+ Property::INVALID_INDEX, // Animatable property not supported
mAlignmentOffset,
DepthIndex::CONTENT );
}
mImfManager.Activate();
// Deliver the tap before the focus event to controller; this allows us to detect when focus is gained due to tap-gestures
- mController->TapEvent( gesture.numberOfTaps, gesture.localPoint.x, gesture.localPoint.y );
+ Padding padding;
+ Self().GetPadding( padding );
+ mController->TapEvent( gesture.numberOfTaps, gesture.localPoint.x - padding.left, gesture.localPoint.y - padding.top );
SetKeyInputFocus();
}
{
mImfManager.Activate();
- mController->LongPressEvent( gesture.state, gesture.localPoint.x, gesture.localPoint.y );
+ Padding padding;
+ Self().GetPadding( padding );
+ mController->LongPressEvent( gesture.state, gesture.localPoint.x - padding.left, gesture.localPoint.y - padding.top );
SetKeyInputFocus();
}
}
else
{
+ actor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
Self().Add( actor );
+ mActiveLayer = actor;
}
}
}