#include <dali/public-api/events/key-event.h>
#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/object/type-registry.h>
+#include <dali/public-api/object/type-registry-helper.h>
#include <dali/public-api/object/property-notification.h>
+#include <dali/public-api/size-negotiation/relayout-container.h>
#include <dali/integration-api/debug.h>
#include <dali/public-api/images/resource-image.h>
const Vector3 UI_OFFSET(0.0f, 0.0f, UI_Z_OFFSET); ///< Text Selection Handles/Cursor offset.
const Vector3 DEFAULT_HANDLE_ONE_OFFSET(0.0f, -5.0f, 0.0f); ///< Handle One's Offset
const Vector3 DEFAULT_HANDLE_TWO_OFFSET(0.0f, -5.0f, 0.0f); ///< Handle Two's Offset
-const float TOP_HANDLE_TOP_OFFSET( 34.0f); ///< Offset between top handle and cutCopyPaste pop-up
-const float BOTTOM_HANDLE_BOTTOM_OFFSET(34.0f); ///< Offset between bottom handle and cutCopyPaste pop-up
+const float TOP_HANDLE_TOP_OFFSET( 34.0f); ///< Offset between top handle and cutCopyPaste pop-up
+const float BOTTOM_HANDLE_BOTTOM_OFFSET(34.0f); ///< Offset between bottom handle and cutCopyPaste pop-up
const float CURSOR_THICKNESS(4.0f);
const Degree CURSOR_ANGLE_OFFSET(2.0f); ///< Offset from the angle of italic angle.
const Vector4 DEFAULT_CURSOR_COLOR(1.0f, 1.0f, 1.0f, 1.0f);
-const std::string NEWLINE( "\n" );
+const char* const NEWLINE = "\n";
const TextStyle DEFAULT_TEXT_STYLE;
namespace Toolkit
{
-// Properties
-const Property::Index TextInput::HIGHLIGHT_COLOR_PROPERTY = Internal::TextInput::TEXTINPUT_PROPERTY_START_INDEX;
-const Property::Index TextInput::CUT_AND_PASTE_COLOR_PROPERTY = Internal::TextInput::TEXTINPUT_PROPERTY_START_INDEX+1;
-const Property::Index TextInput::CUT_AND_PASTE_PRESSED_COLOR_PROPERTY = Internal::TextInput::TEXTINPUT_PROPERTY_START_INDEX+2;
-const Property::Index TextInput::CUT_AND_PASTE_BORDER_COLOR_PROPERTY = Internal::TextInput::TEXTINPUT_PROPERTY_START_INDEX+3;
-const Property::Index TextInput::CUT_AND_PASTE_ICON_COLOR_PROPERTY = Internal::TextInput::TEXTINPUT_PROPERTY_START_INDEX+4;
-const Property::Index TextInput::CUT_AND_PASTE_ICON_PRESSED_COLOR_PROPERTY = Internal::TextInput::TEXTINPUT_PROPERTY_START_INDEX+5;
-const Property::Index TextInput::CUT_AND_PASTE_TEXT_COLOR_PROPERTY = Internal::TextInput::TEXTINPUT_PROPERTY_START_INDEX+6;
-const Property::Index TextInput::CUT_AND_PASTE_TEXT_PRESSED_COLOR_PROPERTY = Internal::TextInput::TEXTINPUT_PROPERTY_START_INDEX+7;
-const Property::Index TextInput::CUT_BUTTON_POSITION_PRIORITY_PROPERTY = Internal::TextInput::TEXTINPUT_PROPERTY_START_INDEX+8;
-const Property::Index TextInput::COPY_BUTTON_POSITION_PRIORITY_PROPERTY = Internal::TextInput::TEXTINPUT_PROPERTY_START_INDEX+9;
-const Property::Index TextInput::PASTE_BUTTON_POSITION_PRIORITY_PROPERTY = Internal::TextInput::TEXTINPUT_PROPERTY_START_INDEX+10;
-const Property::Index TextInput::SELECT_BUTTON_POSITION_PRIORITY_PROPERTY = Internal::TextInput::TEXTINPUT_PROPERTY_START_INDEX+11;
-const Property::Index TextInput::SELECT_ALL_BUTTON_POSITION_PRIORITY_PROPERTY = Internal::TextInput::TEXTINPUT_PROPERTY_START_INDEX+12;
-const Property::Index TextInput::CLIPBOARD_BUTTON_POSITION_PRIORITY_PROPERTY = Internal::TextInput::TEXTINPUT_PROPERTY_START_INDEX+13;
-const Property::Index TextInput::POP_UP_OFFSET_FROM_TEXT_PROPERTY = Internal::TextInput::TEXTINPUT_PROPERTY_START_INDEX+14;
-const Property::Index TextInput::CURSOR_COLOR_PROPERTY = Internal::TextInput::TEXTINPUT_PROPERTY_START_INDEX+15;
-
namespace Internal
{
-namespace
+namespace // Unnamed namespace
{
-// Signals
-
-const char* const SIGNAL_START_INPUT = "start-input";
-const char* const SIGNAL_END_INPUT = "end-input";
-const char* const SIGNAL_STYLE_CHANGED = "style-changed";
-const char* const SIGNAL_MAX_INPUT_CHARACTERS_REACHED = "max-input-characters-reached";
-const char* const SIGNAL_TOOLBAR_DISPLAYED = "toolbar-displayed";
-const char* const SIGNAL_TEXT_EXCEED_BOUNDARIES = "text-exceed-boundaries";
-
BaseHandle Create()
{
return Toolkit::TextInput::New();
}
-TypeRegistration typeRegistration( typeid( Toolkit::TextInput ), typeid( Toolkit::Control ), Create );
+// Setup properties, signals and actions using the type-registry.
+DALI_TYPE_REGISTRATION_BEGIN( Toolkit::TextInput, Toolkit::Control, Create )
-SignalConnectorType signalConnector1( typeRegistration, SIGNAL_START_INPUT, &TextInput::DoConnectSignal );
-SignalConnectorType signalConnector2( typeRegistration, SIGNAL_END_INPUT, &TextInput::DoConnectSignal );
-SignalConnectorType signalConnector3( typeRegistration, SIGNAL_STYLE_CHANGED, &TextInput::DoConnectSignal );
-SignalConnectorType signalConnector4( typeRegistration, SIGNAL_MAX_INPUT_CHARACTERS_REACHED, &TextInput::DoConnectSignal );
-SignalConnectorType signalConnector5( typeRegistration, SIGNAL_TOOLBAR_DISPLAYED, &TextInput::DoConnectSignal );
-SignalConnectorType signalConnector6( typeRegistration, SIGNAL_TEXT_EXCEED_BOUNDARIES, &TextInput::DoConnectSignal );
+DALI_PROPERTY_REGISTRATION( TextInput, "highlight-color", VECTOR4, HIGHLIGHT_COLOR )
+DALI_PROPERTY_REGISTRATION( TextInput, "cut-and-paste-bg-color", VECTOR4, CUT_AND_PASTE_COLOR )
+DALI_PROPERTY_REGISTRATION( TextInput, "cut-and-paste-pressed-color", VECTOR4, CUT_AND_PASTE_PRESSED_COLOR )
+DALI_PROPERTY_REGISTRATION( TextInput, "cut-and-paste-border-color", VECTOR4, CUT_AND_PASTE_BORDER_COLOR )
+DALI_PROPERTY_REGISTRATION( TextInput, "cut-and-paste-icon-color", VECTOR4, CUT_AND_PASTE_ICON_COLOR )
+DALI_PROPERTY_REGISTRATION( TextInput, "cut-and-paste-icon-pressed-color", VECTOR4, CUT_AND_PASTE_ICON_PRESSED_COLOR )
+DALI_PROPERTY_REGISTRATION( TextInput, "cut-and-paste-text-color", VECTOR4, CUT_AND_PASTE_TEXT_COLOR )
+DALI_PROPERTY_REGISTRATION( TextInput, "cut-and-paste-text-pressed-color", VECTOR4, CUT_AND_PASTE_TEXT_PRESSED_COLOR )
+DALI_PROPERTY_REGISTRATION( TextInput, "cut-button-position-priority", UNSIGNED_INTEGER, CUT_BUTTON_POSITION_PRIORITY )
+DALI_PROPERTY_REGISTRATION( TextInput, "copy-button-position-priority", UNSIGNED_INTEGER, COPY_BUTTON_POSITION_PRIORITY )
+DALI_PROPERTY_REGISTRATION( TextInput, "paste-button-position-priority", UNSIGNED_INTEGER, PASTE_BUTTON_POSITION_PRIORITY )
+DALI_PROPERTY_REGISTRATION( TextInput, "select-button-position-priority", UNSIGNED_INTEGER, SELECT_BUTTON_POSITION_PRIORITY )
+DALI_PROPERTY_REGISTRATION( TextInput, "select-all-button-position-priority", UNSIGNED_INTEGER, SELECT_ALL_BUTTON_POSITION_PRIORITY )
+DALI_PROPERTY_REGISTRATION( TextInput, "clipboard-button-position-priority", UNSIGNED_INTEGER, CLIPBOARD_BUTTON_POSITION_PRIORITY )
+DALI_PROPERTY_REGISTRATION( TextInput, "popup-offset-from-text", VECTOR4, POP_UP_OFFSET_FROM_TEXT )
+DALI_PROPERTY_REGISTRATION( TextInput, "cursor-color", VECTOR4, CURSOR_COLOR )
-}
+DALI_SIGNAL_REGISTRATION( TextInput, "start-input", SIGNAL_START_INPUT )
+DALI_SIGNAL_REGISTRATION( TextInput, "end-input", SIGNAL_END_INPUT )
+DALI_SIGNAL_REGISTRATION( TextInput, "style-changed", SIGNAL_STYLE_CHANGED )
+DALI_SIGNAL_REGISTRATION( TextInput, "max-input-characters-reached", SIGNAL_MAX_INPUT_CHARACTERS_REACHED )
+DALI_SIGNAL_REGISTRATION( TextInput, "toolbar-displayed", SIGNAL_TOOLBAR_DISPLAYED )
+DALI_SIGNAL_REGISTRATION( TextInput, "text-exceed-boundaries", SIGNAL_TEXT_EXCEED_BOUNDARIES )
-PropertyRegistration property1( typeRegistration, "highlight-color", Toolkit::TextInput::HIGHLIGHT_COLOR_PROPERTY, Property::VECTOR4, &TextInput::SetProperty, &TextInput::GetProperty );
-PropertyRegistration property2( typeRegistration, "cut-and-paste-bg-color", Toolkit::TextInput::CUT_AND_PASTE_COLOR_PROPERTY, Property::VECTOR4, &TextInput::SetProperty, &TextInput::GetProperty );
-PropertyRegistration property3( typeRegistration, "cut-and-paste-pressed-color", Toolkit::TextInput::CUT_AND_PASTE_PRESSED_COLOR_PROPERTY, Property::VECTOR4, &TextInput::SetProperty, &TextInput::GetProperty );
-PropertyRegistration property4( typeRegistration, "cut-and-paste-icon-color", Toolkit::TextInput::CUT_AND_PASTE_ICON_COLOR_PROPERTY, Property::VECTOR4, &TextInput::SetProperty, &TextInput::GetProperty );
-PropertyRegistration property5( typeRegistration, "cut-and-paste-icon-pressed-color", Toolkit::TextInput::CUT_AND_PASTE_ICON_PRESSED_COLOR_PROPERTY, Property::VECTOR4, &TextInput::SetProperty, &TextInput::GetProperty );
-PropertyRegistration property6( typeRegistration, "cut-and-paste-text-color", Toolkit::TextInput::CUT_AND_PASTE_TEXT_COLOR_PROPERTY, Property::VECTOR4, &TextInput::SetProperty, &TextInput::GetProperty );
-PropertyRegistration property7( typeRegistration, "cut-and-paste-text-pressed-color", Toolkit::TextInput::CUT_AND_PASTE_TEXT_PRESSED_COLOR_PROPERTY, Property::VECTOR4, &TextInput::SetProperty, &TextInput::GetProperty );
-PropertyRegistration property8( typeRegistration, "cut-and-paste-border-color", Toolkit::TextInput::CUT_AND_PASTE_BORDER_COLOR_PROPERTY, Property::VECTOR4, &TextInput::SetProperty, &TextInput::GetProperty );
-PropertyRegistration property9( typeRegistration, "cut-button-position-priority", Toolkit::TextInput::CUT_BUTTON_POSITION_PRIORITY_PROPERTY, Property::UNSIGNED_INTEGER, &TextInput::SetProperty, &TextInput::GetProperty );
-PropertyRegistration property10( typeRegistration, "copy-button-position-priority", Toolkit::TextInput::COPY_BUTTON_POSITION_PRIORITY_PROPERTY, Property::UNSIGNED_INTEGER, &TextInput::SetProperty, &TextInput::GetProperty );
-PropertyRegistration property11( typeRegistration, "paste-button-position-priority", Toolkit::TextInput::PASTE_BUTTON_POSITION_PRIORITY_PROPERTY, Property::UNSIGNED_INTEGER, &TextInput::SetProperty, &TextInput::GetProperty );
-PropertyRegistration property12( typeRegistration, "select-button-position-priority", Toolkit::TextInput::SELECT_BUTTON_POSITION_PRIORITY_PROPERTY, Property::UNSIGNED_INTEGER, &TextInput::SetProperty, &TextInput::GetProperty );
-PropertyRegistration property13( typeRegistration, "select-all-button-position-priority", Toolkit::TextInput::SELECT_ALL_BUTTON_POSITION_PRIORITY_PROPERTY, Property::UNSIGNED_INTEGER, &TextInput::SetProperty, &TextInput::GetProperty );
-PropertyRegistration property14( typeRegistration, "clipboard-button-position-priority", Toolkit::TextInput::CLIPBOARD_BUTTON_POSITION_PRIORITY_PROPERTY, Property::UNSIGNED_INTEGER, &TextInput::SetProperty, &TextInput::GetProperty );
-PropertyRegistration property15( typeRegistration, "popup-offset-from-text", Toolkit::TextInput::POP_UP_OFFSET_FROM_TEXT_PROPERTY, Property::VECTOR4, &TextInput::SetProperty, &TextInput::GetProperty );
-PropertyRegistration property16( typeRegistration, "cursor-color", Toolkit::TextInput::CURSOR_COLOR_PROPERTY, Property::VECTOR4, &TextInput::SetProperty, &TextInput::GetProperty );
+DALI_TYPE_REGISTRATION_END()
+}
// [TextInput::HighlightInfo] /////////////////////////////////////////////////
void TextInput::SetMaterialDiffuseColor( const Vector4& color )
{
mMaterialColor = color;
- if ( mCustomMaterial )
- {
- mCustomMaterial.SetDiffuseColor( mMaterialColor );
- mMeshData.SetMaterial( mCustomMaterial );
- }
}
const Vector4& TextInput::GetMaterialDiffuseColor() const
bool TextInput::IsTextSelected() const
{
- return mHighlightMeshActor;
+ return false;
}
void TextInput::DeSelectText()
mActiveLayer.SetSize(targetSize);
}
-void TextInput::OnRelayout( const Vector2& size, ActorSizeContainer& container )
+void TextInput::OnRelayout( const Vector2& size, RelayoutContainer& container )
{
- Relayout( mDisplayedTextView, size, container );
- Relayout( mPopupPanel.GetRootActor(), size, container );
+ container.Add( mDisplayedTextView, size );
+ container.Add( mPopupPanel.GetRootActor(), size );
GetTextLayoutInfo();
DALI_LOG_INFO( gLogFilter, Debug::General, "OnLongPress\n" );
// Ignore longpress if in selection mode already
- if( mHighlightMeshActor )
- {
- return;
- }
if(longPress.state == Dali::Gesture::Started)
{
popup.HideFinishedSignal().Disconnect( this, &TextInput::OnPopupHideFinished );
// Change Popup menu to Cut/Copy/Paste if text has been selected.
- if(mHighlightMeshActor && mState == StateEdit)
- {
- ShowPopupCutCopyPaste();
- }
}
//FIXME this routine needs to be re-written as it contains too many branches.
} // Return
else if ( keyName == "space" )
{
- if ( mHighlightMeshActor )
- {
- // Some text is selected so erase it before adding space.
- DeleteHighlightedText( true );
- }
mCursorPosition = mCursorPosition + InsertAt(Text(keyString), mCursorPosition, 0);
} // space
else if (keyName == "BackSpace")
{
- if ( mHighlightMeshActor )
- {
- // Some text is selected so erase it
- DeleteHighlightedText( true );
- update = true;
- }
- else
{
if ( mCursorPosition > 0 )
{
mSelectionHandleOne.SetPosition( mSelectionHandleOneActualPosition + UI_OFFSET + mSelectionHandleOneOffset );
mSelectionHandleTwo.SetPosition( mSelectionHandleTwoActualPosition + UI_OFFSET + mSelectionHandleTwoOffset );
- if( mHighlightMeshActor )
- {
- mHighlightMeshActor.SetVisible( true );
- UpdateHighlight();
- }
}
}
mDisplayedTextView.SetLineJustification( Toolkit::TextView::Left );
mDisplayedTextView.SetTextAlignment( static_cast<Toolkit::Alignment::Type>( Toolkit::Alignment::HorizontalLeft | Toolkit::Alignment::VerticalTop ) );
mDisplayedTextView.SetPosition( Vector3( 0.0f, 0.0f, DISPLAYED_TEXT_VIEW_Z_OFFSET ) );
- mDisplayedTextView.SetSizePolicy( Toolkit::Control::Fixed, Toolkit::Control::Fixed );
mDisplayedTextView.ScrolledSignal().Connect( this, &TextInput::OnTextViewScrolled );
mIgnoreFirstCommitFlag = false;
// Some text may be selected, hiding keyboard causes an empty predictive string to be sent, we don't want to delete highlight in this case
- if ( mHighlightMeshActor && (!imfEvent.predictiveString.empty()) )
- {
- // replaces highlighted text with new character
- DeleteHighlightedText( false );
- }
preeditResetRequired = PreEditReceived( imfEvent.predictiveString, imfEvent.cursorOffset );
// A Commit message is a word that has been accepted, it may have been a pre-edit word previously but now commited.
// Some text may be selected, hiding keyboard causes an empty predictive string to be sent, we don't want to delete highlight in this case
- if ( mHighlightMeshActor && (!imfEvent.predictiveString.empty()) )
- {
- // replaces highlighted text with new character
- DeleteHighlightedText( false );
- }
// A PreEditReset can cause a commit message to be sent, the Ignore Commit flag is used in scenarios where the word is
// not needed, one such scenario is when the pre-edit word is too long to fit.
std::size_t toDelete = 0;
std::size_t numberOfCharacters = 0;
- if( mHighlightMeshActor )
- {
- // delete highlighted text.
- toDelete = std::min( mSelectionHandleOnePosition, mSelectionHandleTwoPosition );
- numberOfCharacters = std::max( mSelectionHandleOnePosition, mSelectionHandleTwoPosition ) - toDelete;
- }
- else
{
if( static_cast<std::size_t>(std::abs( imfEvent.cursorOffset )) < mCursorPosition )
{
{
// If text is selected/highlighted and surrounding text received we do not want the keyboard to store the word at cursor and return it as a predictive word along with
// the next key pressed. Instead the Select function sets the cursor position and surrounding text.
- if (! ( mHighlightMeshActor || mSelectingText ) )
+ if (! ( false || mSelectingText ) )
{
std::string text( GetText() );
DALI_LOG_INFO( gLogFilter, Debug::General, "OnKey - surrounding text - set text [%s] and cursor[%u] \n", text.c_str(), mCursorPosition );
{
DALI_LOG_INFO( gLogFilter, Debug::General, "DeleteHighlightedText handlePosOne[%u] handlePosTwo[%u]\n", mSelectionHandleOnePosition, mSelectionHandleTwoPosition);
- if( mHighlightMeshActor )
- {
- mCursorPosition = std::min( mSelectionHandleOnePosition, mSelectionHandleTwoPosition );
-
- MarkupProcessor::StyledTextArray::iterator start = mStyledText.begin() + mCursorPosition;
- MarkupProcessor::StyledTextArray::iterator end = mStyledText.begin() + std::max( mSelectionHandleOnePosition, mSelectionHandleTwoPosition );
-
- // Get the styled text of the characters to be deleted as it may be needed if
- // the "exceed the text-input's boundaries" option is disabled.
- MarkupProcessor::StyledTextArray styledCharactersToDelete;
-
- styledCharactersToDelete.insert( styledCharactersToDelete.begin(), start, end );
-
- mStyledText.erase( start, end ); // erase range of characters
-
- // Remove text from TextView and update place holder text if required
-
- // Set the placeholder text only if the styled text is empty.
- if( mStyledText.empty() )
- {
- ShowPlaceholderText( mStyledPlaceHolderText );
- }
- else
- {
- const std::size_t numberOfCharacters = std::max( mSelectionHandleOnePosition, mSelectionHandleTwoPosition ) - mCursorPosition;
-
- mDisplayedTextView.RemoveTextFrom( mCursorPosition, numberOfCharacters );
-
- // It may happen than after removing a white space or a new line character,
- // two words merge, this new word could be big enough to not fit in its
- // current line, so moved to the next one, and make some part of the text to
- // exceed the text-input's boundary.
- if( !mExceedEnabled )
- {
- // Get the new text layout after removing some characters.
- mDisplayedTextView.GetTextLayoutInfo( mTextLayoutInfo );
-
- // Get text-input's size.
- const Vector3& size = GetControlSize();
-
- if( ( mTextLayoutInfo.mTextSize.width > size.width ) ||
- ( mTextLayoutInfo.mTextSize.height > size.height ) )
- {
- mDisplayedTextView.InsertTextAt( mCursorPosition, styledCharactersToDelete );
-
- mStyledText.insert( mStyledText.begin() + mCursorPosition,
- styledCharactersToDelete.begin(),
- styledCharactersToDelete.end() );
- }
- }
- }
- GetTextLayoutInfo();
-
- RemoveHighlight();
-
- EmitTextModified();
-
- if( inheritStyle )
- {
- const TextStyle oldInputStyle( mInputStyle );
-
- mInputStyle = GetStyleAtCursor(); // Inherit style from cursor position
-
- if( oldInputStyle != mInputStyle )
- {
- // Updates the line height accordingly with the input style.
- UpdateLineHeight();
-
- EmitStyleChangedSignal();
- }
- }
- }
}
void TextInput::DeleteRange( const std::size_t start, const std::size_t ncharacters )
mStyledText.erase(itStart, itEnd);
// update the selection handles if they are visible.
- if( mHighlightMeshActor )
- {
- std::size_t& minHandle = ( mSelectionHandleOnePosition <= mSelectionHandleTwoPosition ? mSelectionHandleOnePosition : mSelectionHandleTwoPosition );
- std::size_t& maxHandle = ( mSelectionHandleTwoPosition > mSelectionHandleOnePosition ? mSelectionHandleTwoPosition : mSelectionHandleOnePosition );
-
- if( minHandle >= start + ncharacters )
- {
- minHandle -= ncharacters;
- }
- else if( ( minHandle > start ) && ( minHandle < start + ncharacters ) )
- {
- minHandle = start;
- }
-
- if( maxHandle >= start + ncharacters )
- {
- maxHandle -= ncharacters;
- }
- else if( ( maxHandle > start ) && ( maxHandle < start + ncharacters ) )
- {
- maxHandle = start;
- }
- }
// Set text is not called here as currently it can not process the set text from deletion and then the set text from the in-coming pre-edit.
}
mCursor.SetSize(size);
// If the character is italic then the cursor also tilts.
- mCursor.SetRotation( mInputStyle.IsItalicsEnabled() ? Degree( mInputStyle.GetItalicsAngle() - CURSOR_ANGLE_OFFSET ) : Degree( 0.f ), Vector3::ZAXIS );
+ mCursor.SetOrientation( mInputStyle.IsItalicsEnabled() ? Degree( mInputStyle.GetItalicsAngle() - CURSOR_ANGLE_OFFSET ) : Degree( 0.f ), Vector3::ZAXIS );
DALI_ASSERT_DEBUG( mCursorPosition <= mTextLayoutInfo.mCharacterLayoutInfoTable.size() );
// 9* *7
//
- if ( mHighlightMeshActor )
- {
- // vertex and triangle buffers should always be present if MeshActor is alive.
- HighlightInfo newHighlightInfo = CalculateHighlightInfoRtl();
- MeshData::VertexContainer vertices;
- Dali::MeshData::FaceIndices faceIndices;
-
- if( !newHighlightInfo.mQuadList.empty() )
- {
- std::vector<QuadCoordinates>::iterator iter = newHighlightInfo.mQuadList.begin();
- std::vector<QuadCoordinates>::iterator endIter = newHighlightInfo.mQuadList.end();
-
- // vertex position defaults to (0 0 0)
- MeshData::Vertex vertex;
- // set normal for all vertices as (0 0 1) pointing outward from TextInput Actor.
- vertex.nZ = 1.0f;
-
- for(std::size_t v = 0; iter != endIter; ++iter,v+=4 )
- {
- // Add each quad geometry (a sub-selection) to the mesh data.
-
- // 0-----1
- // |\ |
- // | \ A |
- // | \ |
- // | B \ |
- // | \|
- // 2-----3
-
- QuadCoordinates& quad = *iter;
- // top-left (v+0)
- vertex.x = quad.min.x;
- vertex.y = quad.min.y;
- vertices.push_back( vertex );
-
- // top-right (v+1)
- vertex.x = quad.max.x;
- vertex.y = quad.min.y;
- vertices.push_back( vertex );
-
- // bottom-left (v+2)
- vertex.x = quad.min.x;
- vertex.y = quad.max.y;
- vertices.push_back( vertex );
-
- // bottom-right (v+3)
- vertex.x = quad.max.x;
- vertex.y = quad.max.y;
- vertices.push_back( vertex );
-
- // triangle A (3, 1, 0)
- faceIndices.push_back( v + 3 );
- faceIndices.push_back( v + 1 );
- faceIndices.push_back( v );
-
- // triangle B (0, 2, 3)
- faceIndices.push_back( v );
- faceIndices.push_back( v + 2 );
- faceIndices.push_back( v + 3 );
-
- mMeshData.SetFaceIndices( faceIndices );
- }
-
- BoneContainer bones(0); // passed empty as bones not required
- mMeshData.SetData( vertices, faceIndices, bones, mCustomMaterial );
- mHighlightMesh.UpdateMeshData(mMeshData);
- }
- }
}
void TextInput::ClearPopup()
Vector3 position;
Vector2 alternativePopupPosition;
- if(mHighlightMeshActor && mState == StateEdit)
+ if(false && mState == StateEdit)
{
Vector3 topHandle;
Vector3 bottomHandle; // referring to the bottom most point of the handle or the bottom line of selection.
bool textInputTouched = (touchedActor && WasTouchedCheck( touchedActor ));
- if ( ( mHighlightMeshActor || popUpShown ) && !textInputTouched )
+ if ( ( false || popUpShown ) && !textInputTouched )
{
EndMonitoringStageForTouch();
HidePopup( true, false );
{
DALI_LOG_INFO(gLogFilter, Debug::General, "RemoveHighlight\n");
- if ( mHighlightMeshActor )
+ if ( false )
{
if ( mSelectionHandleOne )
{
mNewHighlightInfo.mQuadList.clear();
- Self().Remove( mHighlightMeshActor );
SetCursorVisibility( true );
StartCursorBlinkTimer();
- mHighlightMeshActor.Reset();
// NOTE: We cannot dereference mHighlightMesh, due
// to a bug in how the scene-graph MeshRenderer uses the Mesh data incorrectly.
void TextInput::CreateHighlight()
{
- if ( !mHighlightMeshActor )
- {
- mMeshData = MeshData( );
- mMeshData.SetHasNormals( true );
-
- mCustomMaterial = Material::New("CustomMaterial");
- mCustomMaterial.SetDiffuseColor( mMaterialColor );
-
- mMeshData.SetMaterial( mCustomMaterial );
-
- mHighlightMesh = Mesh::New( mMeshData );
-
- mHighlightMeshActor = MeshActor::New( mHighlightMesh );
- mHighlightMeshActor.SetName( "HighlightMeshActor" );
- mHighlightMeshActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
- mHighlightMeshActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
- mHighlightMeshActor.SetPosition( 0.0f, 0.0f, DISPLAYED_HIGHLIGHT_Z_OFFSET );
-
- Self().Add(mHighlightMeshActor);
- }
}
// Any key stroke that results in a visual change of the text-input should
// set this flag to true.
bool update = false;
- if( mHighlightMeshActor )
+ if( false )
{
/* if highlighted, delete entire text, and position cursor at start of deleted text. */
mCursorPosition = std::min(mSelectionHandleOnePosition, mSelectionHandleTwoPosition);
mSelectionHandleOne.SetVisible( true );
mSelectionHandleTwo.SetVisible( true );
- if( mHighlightMeshActor )
- {
- mHighlightMeshActor.SetVisible( true );
- }
}
}
}
switch ( propertyIndex )
{
- case Toolkit::TextInput::HIGHLIGHT_COLOR_PROPERTY:
+ case Toolkit::TextInput::Property::HIGHLIGHT_COLOR:
{
textInputImpl.SetMaterialDiffuseColor( value.Get< Vector4 >() );
break;
}
- case Toolkit::TextInput::CUT_AND_PASTE_COLOR_PROPERTY:
+ case Toolkit::TextInput::Property::CUT_AND_PASTE_COLOR:
{
textInputImpl.mPopupPanel.SetCutPastePopupColor( value.Get< Vector4 >() );
break;
}
- case Toolkit::TextInput::CUT_AND_PASTE_PRESSED_COLOR_PROPERTY:
+ case Toolkit::TextInput::Property::CUT_AND_PASTE_PRESSED_COLOR:
{
textInputImpl.mPopupPanel.SetCutPastePopupPressedColor( value.Get< Vector4 >() );
break;
}
- case Toolkit::TextInput::CUT_AND_PASTE_BORDER_COLOR_PROPERTY:
+ case Toolkit::TextInput::Property::CUT_AND_PASTE_BORDER_COLOR:
{
textInputImpl.mPopupPanel.SetCutPastePopupBorderColor( value.Get< Vector4 >() );
break;
}
- case Toolkit::TextInput::CUT_AND_PASTE_ICON_COLOR_PROPERTY:
+ case Toolkit::TextInput::Property::CUT_AND_PASTE_ICON_COLOR:
{
textInputImpl.mPopupPanel.SetCutPastePopupIconColor( value.Get< Vector4 >() );
break;
}
- case Toolkit::TextInput::CUT_AND_PASTE_ICON_PRESSED_COLOR_PROPERTY:
+ case Toolkit::TextInput::Property::CUT_AND_PASTE_ICON_PRESSED_COLOR:
{
textInputImpl.mPopupPanel.SetCutPastePopupIconPressedColor( value.Get< Vector4 >() );
break;
}
- case Toolkit::TextInput::CUT_AND_PASTE_TEXT_COLOR_PROPERTY:
+ case Toolkit::TextInput::Property::CUT_AND_PASTE_TEXT_COLOR:
{
textInputImpl.mPopupPanel.SetCutPastePopupTextColor( value.Get< Vector4 >() );
break;
}
- case Toolkit::TextInput::CUT_AND_PASTE_TEXT_PRESSED_COLOR_PROPERTY:
+ case Toolkit::TextInput::Property::CUT_AND_PASTE_TEXT_PRESSED_COLOR:
{
textInputImpl.mPopupPanel.SetCutPastePopupTextPressedColor( value.Get< Vector4 >() );
break;
}
- case Toolkit::TextInput::CUT_BUTTON_POSITION_PRIORITY_PROPERTY:
+ case Toolkit::TextInput::Property::CUT_BUTTON_POSITION_PRIORITY:
{
textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsCut, value.Get<unsigned int>() );
break;
}
- case Toolkit::TextInput::COPY_BUTTON_POSITION_PRIORITY_PROPERTY:
+ case Toolkit::TextInput::Property::COPY_BUTTON_POSITION_PRIORITY:
{
textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsCopy, value.Get<unsigned int>() );
break;
}
- case Toolkit::TextInput::PASTE_BUTTON_POSITION_PRIORITY_PROPERTY:
+ case Toolkit::TextInput::Property::PASTE_BUTTON_POSITION_PRIORITY:
{
textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsPaste, value.Get<unsigned int>() );
break;
}
- case Toolkit::TextInput::SELECT_BUTTON_POSITION_PRIORITY_PROPERTY:
+ case Toolkit::TextInput::Property::SELECT_BUTTON_POSITION_PRIORITY:
{
textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsSelect, value.Get<unsigned int>() );
break;
}
- case Toolkit::TextInput::SELECT_ALL_BUTTON_POSITION_PRIORITY_PROPERTY:
+ case Toolkit::TextInput::Property::SELECT_ALL_BUTTON_POSITION_PRIORITY:
{
textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsSelectAll, value.Get<unsigned int>() );
break;
}
- case Toolkit::TextInput::CLIPBOARD_BUTTON_POSITION_PRIORITY_PROPERTY:
+ case Toolkit::TextInput::Property::CLIPBOARD_BUTTON_POSITION_PRIORITY:
{
textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsClipboard, value.Get<unsigned int>() );
break;
}
- case Toolkit::TextInput::POP_UP_OFFSET_FROM_TEXT_PROPERTY:
+ case Toolkit::TextInput::Property::POP_UP_OFFSET_FROM_TEXT:
{
textInputImpl.SetOffsetFromText( value.Get< Vector4 >() );
break;
}
- case Toolkit::TextInput::CURSOR_COLOR_PROPERTY:
+ case Toolkit::TextInput::Property::CURSOR_COLOR:
{
textInputImpl.mCursor.SetColor( value.Get< Vector4 >() );
+ break;
}
}
}
switch ( propertyIndex )
{
- case Toolkit::TextInput::HIGHLIGHT_COLOR_PROPERTY:
+ case Toolkit::TextInput::Property::HIGHLIGHT_COLOR:
{
value = textInputImpl.GetMaterialDiffuseColor();
break;
}
- case Toolkit::TextInput::CUT_AND_PASTE_COLOR_PROPERTY:
+ case Toolkit::TextInput::Property::CUT_AND_PASTE_COLOR:
{
value = textInputImpl.mPopupPanel.GetCutPastePopupColor();
break;
}
- case Toolkit::TextInput::CUT_AND_PASTE_PRESSED_COLOR_PROPERTY:
+ case Toolkit::TextInput::Property::CUT_AND_PASTE_PRESSED_COLOR:
{
value = textInputImpl.mPopupPanel.GetCutPastePopupPressedColor();
break;
}
- case Toolkit::TextInput::CUT_AND_PASTE_BORDER_COLOR_PROPERTY :
+ case Toolkit::TextInput::Property::CUT_AND_PASTE_BORDER_COLOR :
{
value = textInputImpl.mPopupPanel.GetCutPastePopupBorderColor();
break;
}
- case Toolkit::TextInput::CUT_AND_PASTE_ICON_COLOR_PROPERTY:
+ case Toolkit::TextInput::Property::CUT_AND_PASTE_ICON_COLOR:
{
value = textInputImpl.mPopupPanel.GetCutPastePopupIconColor();
break;
}
- case Toolkit::TextInput::CUT_AND_PASTE_ICON_PRESSED_COLOR_PROPERTY:
+ case Toolkit::TextInput::Property::CUT_AND_PASTE_ICON_PRESSED_COLOR:
{
value = textInputImpl.mPopupPanel.GetCutPastePopupIconPressedColor();
break;
}
- case Toolkit::TextInput::CUT_AND_PASTE_TEXT_COLOR_PROPERTY:
+ case Toolkit::TextInput::Property::CUT_AND_PASTE_TEXT_COLOR:
{
value = textInputImpl.mPopupPanel.GetCutPastePopupTextColor();
break;
}
- case Toolkit::TextInput::CUT_AND_PASTE_TEXT_PRESSED_COLOR_PROPERTY:
+ case Toolkit::TextInput::Property::CUT_AND_PASTE_TEXT_PRESSED_COLOR:
{
value = textInputImpl.mPopupPanel.GetCutPastePopupTextPressedColor();
break;
}
- case Toolkit::TextInput::CUT_BUTTON_POSITION_PRIORITY_PROPERTY:
+ case Toolkit::TextInput::Property::CUT_BUTTON_POSITION_PRIORITY:
{
value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsCut );
break;
}
- case Toolkit::TextInput::COPY_BUTTON_POSITION_PRIORITY_PROPERTY:
+ case Toolkit::TextInput::Property::COPY_BUTTON_POSITION_PRIORITY:
{
value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsCopy );
break;
}
- case Toolkit::TextInput::PASTE_BUTTON_POSITION_PRIORITY_PROPERTY:
+ case Toolkit::TextInput::Property::PASTE_BUTTON_POSITION_PRIORITY:
{
value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsPaste );
break;
}
- case Toolkit::TextInput::SELECT_BUTTON_POSITION_PRIORITY_PROPERTY:
+ case Toolkit::TextInput::Property::SELECT_BUTTON_POSITION_PRIORITY:
{
value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsSelect );
break;
}
- case Toolkit::TextInput::SELECT_ALL_BUTTON_POSITION_PRIORITY_PROPERTY:
+ case Toolkit::TextInput::Property::SELECT_ALL_BUTTON_POSITION_PRIORITY:
{
value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsSelectAll );
break;
}
- case Toolkit::TextInput::CLIPBOARD_BUTTON_POSITION_PRIORITY_PROPERTY:
+ case Toolkit::TextInput::Property::CLIPBOARD_BUTTON_POSITION_PRIORITY:
{
value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsClipboard );
break;
}
- case Toolkit::TextInput::POP_UP_OFFSET_FROM_TEXT_PROPERTY:
+ case Toolkit::TextInput::Property::POP_UP_OFFSET_FROM_TEXT:
{
value = textInputImpl.GetOffsetFromText();
break;
}
- case Toolkit::TextInput::CURSOR_COLOR_PROPERTY:
+ case Toolkit::TextInput::Property::CURSOR_COLOR:
{
value = textInputImpl.mCursor.GetCurrentColor();
}