-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.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://floralicense.org/license/
-//
-// 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.
-//
+/*
+ * Copyright (c) 2014 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 <dali/dali.h>
#include <dali-toolkit/internal/controls/text-view/text-processor.h>
#include <dali-toolkit/public-api/controls/buttons/push-button.h>
#include <dali-toolkit/public-api/controls/alignment/alignment.h>
+#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
#include <dali/integration-api/debug.h>
#include <math.h>
#include <sstream>
#include <algorithm>
-#include <libintl.h>
-
-#define GET_LOCALE_TEXT(string) dgettext("sys_string", string)
using namespace std;
using namespace Dali;
const Vector3 DEFAULT_SELECTION_HANDLE_SIZE( 51.0f, 79.0f, 0.0f ); // Selection cursor image size
const Vector3 DEFAULT_GRAB_HANDLE_RELATIVE_SIZE( 1.5f, 2.0f, 1.0f );
const Vector3 DEFAULT_SELECTION_HANDLE_RELATIVE_SIZE( 1.5f, 1.5f, 1.0f );
-const Vector4 LIGHTBLUE( 10.0f/255.0f, 140.0f/255.0f, 210.0f/255.0f, 1.0f ); // Used for Selection highlight
+const Vector4 LIGHTBLUE( 0.07f, 0.41f, 0.59f, 1.0f ); // Used for Selection highlight
const char* DEFAULT_GRAB_HANDLE( DALI_IMAGE_DIR "insertpoint-icon.png" );
const char* DEFAULT_SELECTION_HANDLE_ONE( DALI_IMAGE_DIR "text-input-selection-handle-left.png" );
const char* DEFAULT_SELECTION_HANDLE_TWO( DALI_IMAGE_DIR "text-input-selection-handle-right.png" );
const char* DEFAULT_SELECTION_HANDLE_ONE_PRESSED( DALI_IMAGE_DIR "text-input-selection-handle-left-press.png" );
const char* DEFAULT_SELECTION_HANDLE_TWO_PRESSED( DALI_IMAGE_DIR "text-input-selection-handle-right-press.png" );
-const char* DEFAULT_CURSOR( DALI_IMAGE_DIR "cursor.png" );
-
-const char* DEFAULT_ICON_CLIPBOARD( DALI_IMAGE_DIR "copy_paste_icon_clipboard.png" );
-const char* DEFAULT_ICON_COPY( DALI_IMAGE_DIR "copy_paste_icon_copy.png" );
-const char* DEFAULT_ICON_CUT( DALI_IMAGE_DIR "copy_paste_icon_cut.png" );
-const char* DEFAULT_ICON_PASTE( DALI_IMAGE_DIR "copy_paste_icon_paste.png" );
-const char* DEFAULT_ICON_SELECT( DALI_IMAGE_DIR "copy_paste_icon_select.png" );
-const char* DEFAULT_ICON_SELECT_ALL( DALI_IMAGE_DIR "copy_paste_icon_select_all.png" );
-
-const Vector4 DEFAULT_CURSOR_IMAGE_9_BORDER( 2.0f, 2.0f, 2.0f, 2.0f );
-
-const std::string OPTION_SELECT_WORD("select_word"); ///< "Select Word" popup option.
-const std::string OPTION_SELECT_ALL("select_all"); ///< "Select All" popup option.
-const std::string OPTION_CUT("cut"); ///< "Cut" popup option.
-const std::string OPTION_COPY("copy"); ///< "Copy" popup option.
-const std::string OPTION_PASTE("paste"); ///< "Paste" popup option.
-const std::string OPTION_CLIPBOARD("clipboard"); ///< "Clipboard" popup option.
const std::size_t CURSOR_BLINK_INTERVAL = 500; ///< Cursor blink interval
const float CHARACTER_THRESHOLD( 2.5f ); ///< the threshold of a line.
-const float DISPLAYED_HIGHLIGHT_Z_OFFSET( 0.0f ); ///< 1. Highlight rendered (z-offset).
-const float DISPLAYED_TEXT_VIEW_Z_OFFSET( 0.1f ); ///< 2. Text rendered (z-offset).
+const float DISPLAYED_HIGHLIGHT_Z_OFFSET( 0.1f ); ///< 1. Highlight rendered (z-offset).
+const float DISPLAYED_TEXT_VIEW_Z_OFFSET( 0.2f ); ///< 2. Text rendered (z-offset).
const float UI_Z_OFFSET( 0.2f ); ///< 3. Text Selection Handles/Cursor z-offset.
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(-1.5f); ///< Offset between top handle and cutCopyPaste pop-up
-const float BOTTOM_HANDLE_BOTTOM_OFFSET(1.5f); ///< Offset between bottom handle and cutCopyPaste pop-up
-const float CURSOR_THICKNESS(6.0f);
+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 float SCROLL_SPEED = 15.f;
/**
+ * Selection state enumeration (FSM)
+ */
+enum SelectionState
+{
+ SelectionNone, ///< Currently not encountered selected section.
+ SelectionStarted, ///< Encountered selected section
+ SelectionFinished ///< Finished selected section
+};
+
+/**
* Whether the given style is the default style or not.
* @param[in] style The given style.
* @return \e true if the given style is the default. Otherwise it returns \e false.
return true;
}
-/**
- * Selection state enumeration (FSM)
- */
-enum SelectionState
-{
- SelectionNone, ///< Currently not encountered selected section.
- SelectionStarted, ///< Encountered selected section
- SelectionFinished ///< Finished selected section
-};
-
std::size_t FindVisibleCharacterLeft( std::size_t cursorPosition, const Toolkit::TextView::CharacterLayoutInfoContainer& characterLayoutInfoTable )
{
for( Toolkit::TextView::CharacterLayoutInfoContainer::const_reverse_iterator it = characterLayoutInfoTable.rbegin() + characterLayoutInfoTable.size() - cursorPosition, endIt = characterLayoutInfoTable.rend();
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
{
}
+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 );
+
+
// [TextInput::HighlightInfo] /////////////////////////////////////////////////
void TextInput::HighlightInfo::AddQuad( float x1, float y1, float x2, float y2 )
TextInputPtr textInput(new TextInput());
// Pass ownership to CustomActor via derived handle
Dali::Toolkit::TextInput handle(*textInput);
+ handle.SetName( "TextInput");
textInput->Initialize();
-
return handle;
}
TextInput::TextInput()
-:ControlImpl( true ),
+:Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
mState( StateEdit ),
mStyledText(),
mInputStyle(),
mTouchStartTime( 0 ),
mTextLayoutInfo(),
mCurrentCopySelecton(),
+ mPopupPanel(),
mScrollTimer(),
mScrollDisplacement(),
mCurrentHandlePosition(),
mSelectionHandleFlipMargin( 0.0f, 0.0f, 0.0f, 0.0f ),
mBoundingRectangleWorldCoordinates( 0.0f, 0.0f, 0.0f, 0.0f ),
mClipboard(),
+ mMaterialColor( LIGHTBLUE ),
+ mPopupOffsetFromText ( Vector4( 0.0f, TOP_HANDLE_TOP_OFFSET, 0.0f, BOTTOM_HANDLE_BOTTOM_OFFSET ) ),
mOverrideAutomaticAlignment( false ),
mCursorRTLEnabled( false ),
mClosestCursorPositionEOL ( false ),
RemoveHighlight();
DrawCursor();
+
+ EmitTextModified();
}
void TextInput::SetText( const MarkupProcessor::StyledTextArray& styleText )
Toolkit::Alignment::VerticalTop ) );
mDisplayedTextView.SetLineJustification( leftToRight ? Toolkit::TextView::Left : Toolkit::TextView::Right);
}
+
+ EmitTextModified();
}
void TextInput::SetMaxCharacterLength(std::size_t maxChars)
return mStyledText.size();
}
+// Styling
+void TextInput::SetMaterialDiffuseColor( const Vector4& color )
+{
+ mMaterialColor = color;
+ if ( mCustomMaterial )
+ {
+ mCustomMaterial.SetDiffuseColor( mMaterialColor );
+ mMeshData.SetMaterial( mCustomMaterial );
+ }
+}
+
+const Vector4& TextInput::GetMaterialDiffuseColor() const
+{
+ return mMaterialColor;
+}
+
+// Signals
+
Toolkit::TextInput::InputSignalV2& TextInput::InputStartedSignal()
{
return mInputStartedSignalV2;
return mStyleChangedSignalV2;
}
+Toolkit::TextInput::TextModifiedSignalType& TextInput::TextModifiedSignal()
+{
+ return mTextModifiedSignal;
+}
+
Toolkit::TextInput::MaxInputCharactersReachedSignalV2& TextInput::MaxInputCharactersReachedSignal()
{
return mMaxInputCharactersReachedSignalV2;
RemovePreEditStyle();
const std::size_t numberOfCharactersDeleted = DeletePreEdit();
InsertAt( mPreEditString, mPreEditStartPosition, numberOfCharactersDeleted );
+ EmitTextModified();
}
ImfManager imfManager = ImfManager::Get();
{
Actor self = Self();
mActiveLayer = Layer::New();
+ mActiveLayer.SetName ( "ActiveLayerActor" );
mActiveLayer.SetAnchorPoint( AnchorPoint::CENTER);
mActiveLayer.SetParentOrigin( ParentOrigin::CENTER);
// Create 2 cursors (standard LTR and RTL cursor for when text can be added at
// different positions depending on language)
- Image mCursorImage = Image::New( DEFAULT_CURSOR );
- mCursor = CreateCursor( mCursorImage, DEFAULT_CURSOR_IMAGE_9_BORDER );
- mCursorRTL = CreateCursor( mCursorImage, DEFAULT_CURSOR_IMAGE_9_BORDER );
+ mCursor = CreateCursor(DEFAULT_CURSOR_COLOR);
+ mCursorRTL = CreateCursor(DEFAULT_CURSOR_COLOR);
Actor self = Self();
self.Add( mCursor );
void TextInput::OnRelaidOut( Vector2 size, ActorSizeContainer& container )
{
Relayout( mDisplayedTextView, size, container );
+ Relayout( mPopupPanel.GetRootActor(), size, container );
+
GetTextLayoutInfo();
DrawCursor();
{
mActualGrabHandlePosition = MoveGrabHandle( gesture.displacement );
SetCursorVisibility( true );
- SetUpPopUpSelection();
+ SetUpPopupSelection();
ShowPopup();
}
if (actor == mHandleOneGrabArea)
SelectText( start, end );
}
// if no text but clipboard has content then show paste option
- if ( mClipboard.NumberOfItems() || !mStyledText.empty() )
+ if ( ( mClipboard && mClipboard.NumberOfItems() ) || !mStyledText.empty() )
{
ShowPopupCutCopyPaste();
}
if( mGrabArea == actor )
{
- if( mPopUpPanel.GetState() == TextInputPopup::StateHidden || mPopUpPanel.GetState() == TextInputPopup::StateHiding )
+ if( mPopupPanel.GetState() == TextInputPopup::StateHidden || mPopupPanel.GetState() == TextInputPopup::StateHiding )
{
- SetUpPopUpSelection();
+ SetUpPopupSelection();
ShowPopup();
}
{
DALI_LOG_INFO( gLogFilter, Debug::General, "OnLongPress\n" );
+ // Ignore longpress if in selection mode already
+ if( mHighlightMeshActor )
+ {
+ return;
+ }
+
if(longPress.state == Dali::Gesture::Started)
{
// Start edit mode on long press
}
// if no text but clipboard has content then show paste option, if no text and clipboard empty then do nothing
- if ( mClipboard.NumberOfItems() || !mStyledText.empty() )
+ if ( ( mClipboard && mClipboard.NumberOfItems() ) || !mStyledText.empty() )
{
ShowPopupCutCopyPaste();
}
bool TextInput::OnPopupButtonPressed( Toolkit::Button button )
{
- mPopUpPanel.PressedSignal().Disconnect( this, &TextInput::OnPopupButtonPressed );
+ mPopupPanel.PressedSignal().Disconnect( this, &TextInput::OnPopupButtonPressed );
const std::string& name = button.GetName();
- if(name == OPTION_SELECT_WORD)
+ if(name == TextInputPopup::OPTION_SELECT_WORD)
{
std::size_t start = 0;
std::size_t end = 0;
SelectText( start, end );
}
- else if(name == OPTION_SELECT_ALL)
+ else if(name == TextInputPopup::OPTION_SELECT_ALL)
{
SetCursorVisibility(false);
StopCursorBlinkTimer();
SelectText( start, end );
}
- else if(name == OPTION_CUT)
+ else if(name == TextInputPopup::OPTION_CUT)
{
bool ret = CopySelectedTextToClipboard();
HidePopup();
}
- else if(name == OPTION_COPY)
+ else if(name == TextInputPopup::OPTION_COPY)
{
CopySelectedTextToClipboard();
HidePopup();
}
- else if(name == OPTION_PASTE)
+ else if(name == TextInputPopup::OPTION_PASTE)
{
const Text retrievedString( mClipboard.GetItem( 0 ) ); // currently can only get first item in clip board, index 0;
ShowGrabHandleAndSetVisibility( false );
-
HidePopup();
}
- else if(name == OPTION_CLIPBOARD)
+ else if(name == TextInputPopup::OPTION_CLIPBOARD)
{
// In the case of clipboard being shown we do not want to show updated pop-up after hide animation completes
// Hence pass the false parameter for signalFinished.
mPreEditFlag = true;
mIgnoreCommitFlag = false;
}
-
+ EmitTextModified();
update = true;
}
else
{
mCommitByKeyInput = true;
}
-
+ EmitTextModified();
update = true;
} // space
else if (keyName == "BackSpace")
update = true;
}
}
+ EmitTextModified();
} // BackSpace
else if (keyName == "Right")
{
// Received key String
mCursorPosition = mCursorPosition + InsertAt( Text( keyString ), mCursorPosition, 0 );
update = true;
+ EmitTextModified();
}
}
scrollOffset.x += cursorPosition.x;
}
- if( cursorPosition.y - cursorSize.height < 0.f )
- {
- scrollOffset.y += ( cursorPosition.y - cursorSize.height );
- }
- else if( cursorPosition.y > controlSize.height )
+ if( cursorPosition.y - cursorSize.height < 0.f || cursorPosition.y > controlSize.height )
{
scrollOffset.y += cursorPosition.y;
}
void TextInput::CreateTextViewActor()
{
mDisplayedTextView = Toolkit::TextView::New();
+ mDisplayedTextView.SetName( "TextView ");
mDisplayedTextView.SetMarkupProcessingEnabled( mMarkUpEnabled );
mDisplayedTextView.SetParentOrigin(ParentOrigin::TOP_LEFT);
mDisplayedTextView.SetAnchorPoint(AnchorPoint::TOP_LEFT);
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( Control::Fixed, Control::Fixed );
+ mDisplayedTextView.SetSizePolicy( Toolkit::Control::Fixed, Toolkit::Control::Fixed );
mDisplayedTextView.ScrolledSignal().Connect( this, &TextInput::OnTextViewScrolled );
{
if ( mPreEditFlag && ( preEditStringLength > 0 ) )
{
- mUnderlinedPriorToPreEdit = mInputStyle.GetUnderline();
+ mUnderlinedPriorToPreEdit = mInputStyle.IsUnderlineEnabled();
TextStyle style;
style.SetUnderline( true );
ApplyStyleToRange( style, TextStyle::UNDERLINE , preEditStartPosition, preEditStartPosition + preEditStringLength -1 );
}
else
{
- if( std::abs( imfEvent.cursorOffset ) < mCursorPosition )
+ if( static_cast<std::size_t>(std::abs( imfEvent.cursorOffset )) < mCursorPosition )
{
toDelete = mCursorPosition + imfEvent.cursorOffset;
}
mCursorPosition = toDelete;
mNumberOfSurroundingCharactersDeleted = numberOfCharacters;
+ EmitTextModified();
+
DALI_LOG_INFO( gLogFilter, Debug::General, "ImfEventReceived - deleteSurrounding post-delete range mCursorPosition[%u] \n", mCursorPosition);
break;
}
mDisplayedTextView.RemoveTextFrom( mPreEditStartPosition, numberOfCharactersToReplace );
}
GetTextLayoutInfo();
+ EmitTextModified();
}
else
{
mCursorPosition = mPreEditStartPosition + std::min( cursorOffset, mPreEditLength );
ApplyPreEditStyle( mPreEditStartPosition, mPreEditLength );
DALI_LOG_INFO(gLogFilter, Debug::General, "PreEditReceived mCursorPosition[%u] \n", mCursorPosition);
+ EmitTextModified();
}
// cursor update to keyboard is not done here as the keyboard knows the cursor position and provides the 'cursorOffset'.
DrawCursor();
mCursorPosition = mPreEditStartPosition + std::min( cursorOffset, mPreEditLength );
ApplyPreEditStyle( mPreEditStartPosition, mPreEditLength );
DALI_LOG_INFO(gLogFilter, Debug::General, "PreEditReceived mCursorPosition[%u] mPreEditStartPosition[%u]\n", mCursorPosition, mPreEditStartPosition);
-
// cursor update to keyboard is not done here as the keyboard knows the cursor position and provides the 'cursorOffset'.
DrawCursor();
+ EmitTextModified();
}
else
{
}
}
+ EmitTextModified();
+
if ( mSelectTextOnCommit )
{
SelectText(mRequestedSelection.mStartOfSelection, mRequestedSelection.mEndOfSelection );
mCursorPosition = mCursorPosition + InsertAt( Text( keyString ), mCursorPosition, mNumberOfSurroundingCharactersDeleted );
update = true;
mNumberOfSurroundingCharactersDeleted = 0;
+ EmitTextModified();
}
else
{
RemoveHighlight();
+ EmitTextModified();
+
if( inheritStyle )
{
const TextStyle oldInputStyle( mInputStyle );
return insertedStringLength;
}
-ImageActor TextInput::CreateCursor( Image cursorImage, const Vector4& border )
+ImageActor TextInput::CreateCursor( const Vector4& color)
{
ImageActor cursor;
-
- if ( cursorImage )
- {
- cursor = ImageActor::New( cursorImage );
- }
- else
- {
- cursor = ImageActor::New( Image::New( DEFAULT_CURSOR ) );
- }
-
- cursor.SetStyle(ImageActor::STYLE_NINE_PATCH);
- cursor.SetNinePatchBorder( border );
+ cursor = CreateSolidColorActor(color);
cursor.SetParentOrigin(ParentOrigin::TOP_LEFT);
cursor.SetAnchorPoint(AnchorPoint::BOTTOM_CENTER);
mCursor.SetSize(size);
// If the character is italic then the cursor also tilts.
- mCursor.SetRotation( mInputStyle.GetItalics() ? Degree( mInputStyle.GetItalicsAngle() - CURSOR_ANGLE_OFFSET ) : Degree( 0.f ), Vector3::ZAXIS );
+ mCursor.SetRotation( mInputStyle.IsItalicsEnabled() ? Degree( mInputStyle.GetItalicsAngle() - CURSOR_ANGLE_OFFSET ) : Degree( 0.f ), Vector3::ZAXIS );
DALI_ASSERT_DEBUG( mCursorPosition <= mTextLayoutInfo.mCharacterLayoutInfoTable.size() );
// TODO: TextView should have a table of visual rows, and each character a reference to the row
// that it resides on. That way this enumeration is not necessary.
Vector2 min, max;
- if(lastIt->mIsNewLineChar)
+ if(lastIt->mIsNewParagraphChar)
{
// If the last character is a new line, then to get the row rect, we need to scan from the character before the new line.
lastIt = std::max( mTextLayoutInfo.mCharacterLayoutInfoTable.begin(), lastIt - 1 );
{
// finished selection.
Vector2 min, max;
- if(lastIt->mIsNewLineChar)
+ if(lastIt->mIsNewParagraphChar)
{
lastIt = std::max( mTextLayoutInfo.mCharacterLayoutInfoTable.begin(), lastIt - 1 );
}
void TextInput::ClearPopup()
{
- mPopUpPanel.Clear();
+ mPopupPanel.Clear();
}
-void TextInput::AddPopupOption(const std::string& name, const std::string& caption, const Image icon, bool finalOption)
+void TextInput::AddPopupOptions()
{
- mPopUpPanel.AddOption(name, caption, icon, finalOption);
+ mPopupPanel.AddPopupOptions();
}
-void TextInput::SetPopupPosition(const Vector3& position)
+void TextInput::SetPopupPosition( const Vector3& position, const Vector2& alternativePosition )
{
- mPopUpPanel.Self().SetPosition( position );
+ const Vector3& visiblePopUpSize = mPopupPanel.GetVisibileSize();
+
+ Vector3 clampedPosition ( position );
+ Vector3 tailOffsetPosition ( position );
+
+ float xOffSet( 0.0f );
+
+ Actor self = Self();
+ const Vector3 textViewTopLeftWorldPosition = self.GetCurrentWorldPosition() - self.GetCurrentSize()*0.5f;
+
+ const float popUpLeft = textViewTopLeftWorldPosition.x + position.x - visiblePopUpSize.width*0.5f;
+ const float popUpTop = textViewTopLeftWorldPosition.y + position.y - visiblePopUpSize.height;
+
+ // Clamp to left or right or of boundary
+ if( popUpLeft < mBoundingRectangleWorldCoordinates.x )
+ {
+ xOffSet = mBoundingRectangleWorldCoordinates.x - popUpLeft ;
+ }
+ else if ( popUpLeft + visiblePopUpSize.width > mBoundingRectangleWorldCoordinates.z )
+ {
+ xOffSet = mBoundingRectangleWorldCoordinates.z - ( popUpLeft + visiblePopUpSize.width );
+ }
+
+ clampedPosition.x = position.x + xOffSet;
+ tailOffsetPosition.x = -xOffSet;
+
+ // Check if top left of PopUp outside of top bounding rectangle, if so then flip to lower position.
+ bool flipTail( false );
+
+ if ( popUpTop < mBoundingRectangleWorldCoordinates.y )
+ {
+ clampedPosition.y = alternativePosition.y + visiblePopUpSize.height;
+ flipTail = true;
+ }
+
+ mPopupPanel.GetRootActor().SetPosition( clampedPosition );
+ mPopupPanel.SetTailPosition( tailOffsetPosition, flipTail );
}
void TextInput::HidePopup(bool animate, bool signalFinished )
{
- if ( ( mPopUpPanel.GetState() == TextInputPopup::StateShowing ) || ( mPopUpPanel.GetState() == TextInputPopup::StateShown ) )
+ if ( ( mPopupPanel.GetState() == TextInputPopup::StateShowing ) || ( mPopupPanel.GetState() == TextInputPopup::StateShown ) )
{
- mPopUpPanel.Hide( animate );
+ mPopupPanel.Hide( animate );
if( animate && signalFinished )
{
- mPopUpPanel.HideFinishedSignal().Connect( this, &TextInput::OnPopupHideFinished );
+ mPopupPanel.HideFinishedSignal().Connect( this, &TextInput::OnPopupHideFinished );
}
}
}
-void TextInput::ShowPopup(bool animate)
+void TextInput::ShowPopup( bool animate )
{
Vector3 position;
+ Vector2 alternativePopupPosition;
if(mHighlightMeshActor && mState == StateEdit)
{
Vector3 topHandle;
+ Vector3 bottomHandle; // referring to the bottom most point of the handle or the bottom line of selection.
Size rowSize;
// When text is selected, show popup above top handle (and text), or below bottom handle.
// topHandle: referring to the top most point of the handle or the top line of selection.
if ( mSelectionHandleTwoActualPosition.y > mSelectionHandleOneActualPosition.y )
{
topHandle = mSelectionHandleOneActualPosition;
+ bottomHandle = mSelectionHandleTwoActualPosition;
rowSize= GetRowRectFromCharacterPosition( mSelectionHandleOnePosition );
}
else
{
topHandle = mSelectionHandleTwoActualPosition;
+ bottomHandle = mSelectionHandleOneActualPosition;
rowSize = GetRowRectFromCharacterPosition( mSelectionHandleTwoPosition );
}
- topHandle.y += TOP_HANDLE_TOP_OFFSET - rowSize.height;
+ topHandle.y += -mPopupOffsetFromText.y - rowSize.height;
position = Vector3(topHandle.x, topHandle.y, 0.0f);
- // bottomHandle: referring to the bottom most point of the handle or the bottom line of selection.
- Vector3 bottomHandle;
- bottomHandle.y = std::max ( mSelectionHandleTwoActualPosition.y , mSelectionHandleOneActualPosition.y );
- bottomHandle.y += GetSelectionHandleSize().y + BOTTOM_HANDLE_BOTTOM_OFFSET;
- mPopUpPanel.SetAlternativeOffset(Vector2(0.0f, bottomHandle.y - topHandle.y));
+ float xPosition = ( fabsf( topHandle.x - bottomHandle.x ) )*0.5f + std::min( mSelectionHandleOneActualPosition.x , mSelectionHandleTwoActualPosition.x );
+
+ position.x = xPosition;
+
+ // Alternative position if no upper space
+ bottomHandle.y += GetSelectionHandleSize().y + mPopupOffsetFromText.w;
+ alternativePopupPosition = Vector2 ( position.x, bottomHandle.y );
}
else
{
// When no text is selected, show popup at world position of grab handle or cursor
position = GetActualPositionFromCharacterPosition( mCursorPosition );
const Size rowSize = GetRowRectFromCharacterPosition( mCursorPosition );
- position.y -= rowSize.height;
+ position.y -= ( mPopupOffsetFromText.y + rowSize.height );
// if can't be positioned above, then position below row.
- Vector2 alternativePopUpPosition( 0.0f, position.y ); // default if no grab handle
+ alternativePopupPosition = Vector2( position.x, position.y ); // default if no grab handle
if ( mGrabHandle )
{
- alternativePopUpPosition.y = rowSize.height + ( mGrabHandle.GetCurrentSize().height * DEFAULT_GRAB_HANDLE_RELATIVE_SIZE.y ) ;
// If grab handle enabled then position pop-up below the grab handle.
+ alternativePopupPosition.y = rowSize.height + mGrabHandle.GetCurrentSize().height + mPopupOffsetFromText.w +50.0f;
}
- mPopUpPanel.SetAlternativeOffset( alternativePopUpPosition );
}
- // reposition popup above the desired cursor posiiton.
- Vector3 textViewSize = mDisplayedTextView.GetCurrentSize();
- textViewSize.z = 0.0f;
- // World position = world position of ParentOrigin of cursor (i.e. top-left corner of TextView) + cursor position;
- Vector3 worldPosition = mDisplayedTextView.GetCurrentWorldPosition() - (textViewSize * 0.5f) + position;
-
- SetPopupPosition( worldPosition );
+ SetPopupPosition( position, alternativePopupPosition );
// Show popup
- mPopUpPanel.Show(animate);
+ mPopupPanel.Show( Self(), animate );
StartMonitoringStageForTouch();
- mPopUpPanel.PressedSignal().Connect( this, &TextInput::OnPopupButtonPressed );
+ mPopupPanel.PressedSignal().Connect( this, &TextInput::OnPopupButtonPressed );
}
void TextInput::ShowPopupCutCopyPaste()
{
ClearPopup();
+
+ mPopupPanel.CreateOrderedListOfOptions(); // todo Move this so only run when order has changed
// Check the selected text is whole text or not.
if( IsTextSelected() && ( mStyledText.size() != GetSelectedText().size() ) )
{
- Image selectAllIcon = Image::New( DEFAULT_ICON_SELECT_ALL );
- AddPopupOption( OPTION_SELECT_ALL, GET_LOCALE_TEXT("IDS_COM_BODY_SELECT_ALL"), selectAllIcon );
+ mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsSelectAll, true );
}
if ( !mStyledText.empty() )
{
- Image cutIcon = Image::New( DEFAULT_ICON_CUT );
- Image copyIcon = Image::New( DEFAULT_ICON_COPY );
- AddPopupOption( OPTION_CUT, GET_LOCALE_TEXT("IDS_COM_BODY_CUT"), cutIcon );
- AddPopupOption( OPTION_COPY, GET_LOCALE_TEXT("IDS_COM_BODY_COPY"), copyIcon, true );
+ mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsCopy, true );
+ mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsCut, true );
}
- if(mClipboard.NumberOfItems())
+ if( mClipboard && mClipboard.NumberOfItems() )
{
- Image pasteIcon = Image::New( DEFAULT_ICON_PASTE );
- Image clipboardIcon = Image::New( DEFAULT_ICON_CLIPBOARD );
- AddPopupOption( OPTION_PASTE, GET_LOCALE_TEXT("IDS_COM_BODY_PASTE"), pasteIcon );
- AddPopupOption( OPTION_CLIPBOARD, GET_LOCALE_TEXT("IDS_COM_BODY_CLIPBOARD"), clipboardIcon, true );
+ mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsPaste, true );
+ mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsClipboard, true );
}
- mPopUpPanel.Hide(false);
+ AddPopupOptions();
+
+ mPopupPanel.Hide(false);
ShowPopup();
}
-void TextInput::SetUpPopUpSelection()
+void TextInput::SetUpPopupSelection()
{
ClearPopup();
-
+ mPopupPanel.CreateOrderedListOfOptions(); // todo Move this so only run when order has changed
// If no text exists then don't offer to select
if ( !mStyledText.empty() )
{
- Image selectIcon = Image::New( DEFAULT_ICON_SELECT );
- Image selectAllIcon = Image::New( DEFAULT_ICON_SELECT_ALL );
- AddPopupOption( OPTION_SELECT_WORD, GET_LOCALE_TEXT("IDS_COM_SK_SELECT"), selectIcon );
- AddPopupOption( OPTION_SELECT_ALL, GET_LOCALE_TEXT("IDS_COM_BODY_SELECT_ALL"), selectAllIcon );
+ mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsSelectAll, true );
+ mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsSelect, true );
+ mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsCut, true );
}
// if clipboard has valid contents then offer paste option
- if( mClipboard.NumberOfItems() )
+ if( mClipboard && mClipboard.NumberOfItems() )
{
- Image pasteIcon = Image::New( DEFAULT_ICON_PASTE );
- Image clipboardIcon = Image::New( DEFAULT_ICON_CLIPBOARD );
- AddPopupOption( OPTION_PASTE, GET_LOCALE_TEXT("IDS_COM_BODY_PASTE"), pasteIcon, true );
- AddPopupOption( OPTION_CLIPBOARD, GET_LOCALE_TEXT("IDS_COM_BODY_CLIPBOARD"), clipboardIcon, true );
+ mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsPaste, true );
+ mPopupPanel.TogglePopupButtonOnOff( TextInputPopup::ButtonsClipboard, true );
}
- mPopUpPanel.Hide(false);
+ AddPopupOptions();
+
+ mPopupPanel.Hide(false);
}
bool TextInput::ReturnClosestIndex(const Vector2& source, std::size_t& closestIndex )
if( fabsf( closestYdifference - currentYdifference ) < CHARACTER_THRESHOLD )
{
// ignore new line character.
- if( !info.mIsNewLineChar )
+ if( !info.mIsNewParagraphChar )
{
matchedCharacters.push_back( info );
numberOfMatchedCharacters++;
// and check if user is touching below previous line.
const Toolkit::TextView::CharacterLayoutInfo& lastInfo( mTextLayoutInfo.mCharacterLayoutInfoTable[mTextLayoutInfo.mCharacterLayoutInfoTable.size() - 1] );
- if( ( lastInfo.mIsVisible ) && ( lastInfo.mIsNewLineChar ) && ( sourceScrollOffset.y > lastInfo.mPosition.y ) )
+ if( ( lastInfo.mIsVisible ) && ( lastInfo.mIsNewParagraphChar ) && ( sourceScrollOffset.y > lastInfo.mPosition.y ) )
{
closestIndex = mTextLayoutInfo.mCharacterLayoutInfoTable.size();
}
}
Toolkit::TextView::CharacterLayoutInfo info = mTextLayoutInfo.mCharacterLayoutInfoTable[ visualCharacterPosition ];
- if( ( visualCharacterPosition > 0 ) && info.mIsNewLineChar && !IsScrollEnabled() )
+ if( ( visualCharacterPosition > 0 ) && info.mIsNewParagraphChar && !IsScrollEnabled() )
{
// Prevents the cursor to exceed the boundary if the last visible character is a 'new line character' and the scroll is not enabled.
const Vector3& size = GetControlSize();
info = mTextLayoutInfo.mCharacterLayoutInfoTable[ visualCharacterPosition ];
}
- if(!info.mIsNewLineChar)
+ if(!info.mIsNewParagraphChar)
{
cursorPosition = PositionCursorAfterWordWrap( characterPosition ); // Get position of cursor/handles taking in account auto word wrap.
}
{
logicalPosition--;
std::size_t visualPosition = GetVisualPosition(logicalPosition);
- if(mTextLayoutInfo.mCharacterLayoutInfoTable[visualPosition].mIsNewLineChar)
+ if(mTextLayoutInfo.mCharacterLayoutInfoTable[visualPosition].mIsNewParagraphChar)
{
logicalPosition++;
break;
--it;
if( (it->mPosition.y < referenceLine) ||
- (it->mIsNewLineChar) ||
+ (it->mIsNewParagraphChar) ||
(!it->mIsVisible) )
{
break;
while(it != end)
{
if( (it->mPosition.y > referenceLine) ||
- (it->mIsNewLineChar) ||
+ (it->mIsNewParagraphChar) ||
(!it->mIsVisible) )
{
break;
bool TextInput::WasTouchedCheck( const Actor& touchedActor ) const
{
- Actor popUpPanel = mPopUpPanel.GetRootActor();
+ Actor popUpPanel = mPopupPanel.GetRootActor();
if ( ( touchedActor == Self() ) || ( touchedActor == popUpPanel ) )
{
bool popUpShown( false );
- if ( ( mPopUpPanel.GetState() == TextInputPopup::StateShowing ) || ( mPopUpPanel.GetState() == TextInputPopup::StateShown ) )
+ if ( ( mPopupPanel.GetState() == TextInputPopup::StateShowing ) || ( mPopupPanel.GetState() == TextInputPopup::StateShown ) )
{
popUpShown = true;
}
ShowGrabHandleAndSetVisibility( false );
// If the keyboard is not now being shown, then hide the popup panel
- mPopUpPanel.Hide( true );
+ mPopupPanel.Hide( true );
}
}
mMeshData.SetHasNormals( true );
mCustomMaterial = Material::New("CustomMaterial");
- mCustomMaterial.SetDiffuseColor( LIGHTBLUE );
+ mCustomMaterial.SetDiffuseColor( mMaterialColor );
mMeshData.SetMaterial( mCustomMaterial );
mHighlightMeshActor = MeshActor::New( mHighlightMesh );
mHighlightMeshActor.SetName( "HighlightMeshActor" );
- mHighlightMeshActor.SetInheritShaderEffect( false );
mHighlightMeshActor.SetParentOrigin( ParentOrigin::TOP_LEFT );
mHighlightMeshActor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
mHighlightMeshActor.SetPosition( 0.0f, 0.0f, DISPLAYED_HIGHLIGHT_Z_OFFSET );
if( update )
{
CursorUpdate();
+ EmitTextModified();
}
if( insertedStringLength < text.GetLength() )
}
}
+void TextInput::SetOffsetFromText( const Vector4& offset )
+{
+ mPopupOffsetFromText = offset;
+}
+
+const Vector4& TextInput::GetOffsetFromText() const
+{
+ return mPopupOffsetFromText;
+}
+
+void TextInput::SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value )
+{
+ Toolkit::TextInput textInput = Toolkit::TextInput::DownCast( Dali::BaseHandle( object ) );
+
+ if ( textInput )
+ {
+ TextInput& textInputImpl( GetImpl( textInput ) );
+
+ switch ( propertyIndex )
+ {
+ case Toolkit::TextInput::HIGHLIGHT_COLOR_PROPERTY:
+ {
+ textInputImpl.SetMaterialDiffuseColor( value.Get< Vector4 >() );
+ break;
+ }
+ case Toolkit::TextInput::CUT_AND_PASTE_COLOR_PROPERTY:
+ {
+ textInputImpl.mPopupPanel.SetCutPastePopupColor( value.Get< Vector4 >() );
+ break;
+ }
+ case Toolkit::TextInput::CUT_AND_PASTE_PRESSED_COLOR_PROPERTY:
+ {
+ textInputImpl.mPopupPanel.SetCutPastePopupPressedColor( value.Get< Vector4 >() );
+ break;
+ }
+ case Toolkit::TextInput::CUT_AND_PASTE_BORDER_COLOR_PROPERTY:
+ {
+ textInputImpl.mPopupPanel.SetCutPastePopupBorderColor( value.Get< Vector4 >() );
+ break;
+ }
+ case Toolkit::TextInput::CUT_AND_PASTE_ICON_COLOR_PROPERTY:
+ {
+ textInputImpl.mPopupPanel.SetCutPastePopupIconColor( value.Get< Vector4 >() );
+ break;
+ }
+ case Toolkit::TextInput::CUT_AND_PASTE_ICON_PRESSED_COLOR_PROPERTY:
+ {
+ textInputImpl.mPopupPanel.SetCutPastePopupIconPressedColor( value.Get< Vector4 >() );
+ break;
+ }
+ case Toolkit::TextInput::CUT_AND_PASTE_TEXT_COLOR_PROPERTY:
+ {
+ textInputImpl.mPopupPanel.SetCutPastePopupTextColor( value.Get< Vector4 >() );
+ break;
+ }
+ case Toolkit::TextInput::CUT_AND_PASTE_TEXT_PRESSED_COLOR_PROPERTY:
+ {
+ textInputImpl.mPopupPanel.SetCutPastePopupTextPressedColor( value.Get< Vector4 >() );
+ break;
+ }
+ case Toolkit::TextInput::CUT_BUTTON_POSITION_PRIORITY_PROPERTY:
+ {
+ textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsCut, value.Get<unsigned int>() );
+ break;
+ }
+ case Toolkit::TextInput::COPY_BUTTON_POSITION_PRIORITY_PROPERTY:
+ {
+ textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsCopy, value.Get<unsigned int>() );
+ break;
+ }
+ case Toolkit::TextInput::PASTE_BUTTON_POSITION_PRIORITY_PROPERTY:
+ {
+ textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsPaste, value.Get<unsigned int>() );
+ break;
+ }
+ case Toolkit::TextInput::SELECT_BUTTON_POSITION_PRIORITY_PROPERTY:
+ {
+ textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsSelect, value.Get<unsigned int>() );
+ break;
+ }
+ case Toolkit::TextInput::SELECT_ALL_BUTTON_POSITION_PRIORITY_PROPERTY:
+ {
+ textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsSelectAll, value.Get<unsigned int>() );
+ break;
+ }
+ case Toolkit::TextInput::CLIPBOARD_BUTTON_POSITION_PRIORITY_PROPERTY:
+ {
+ textInputImpl.mPopupPanel.SetButtonPriorityPosition( TextInputPopup::ButtonsClipboard, value.Get<unsigned int>() );
+ break;
+ }
+ case Toolkit::TextInput::POP_UP_OFFSET_FROM_TEXT_PROPERTY:
+ {
+ textInputImpl.SetOffsetFromText( value.Get< Vector4 >() );
+ break;
+ }
+ case Toolkit::TextInput::CURSOR_COLOR_PROPERTY:
+ {
+ textInputImpl.mCursor.SetColor( value.Get< Vector4 >() );
+ }
+ }
+ }
+}
+
+Property::Value TextInput::GetProperty( BaseObject* object, Property::Index propertyIndex )
+{
+ Property::Value value;
+
+ Toolkit::TextInput textInput = Toolkit::TextInput::DownCast( Dali::BaseHandle( object ) );
+
+ if ( textInput )
+ {
+ TextInput& textInputImpl( GetImpl( textInput ) );
+
+ switch ( propertyIndex )
+ {
+ case Toolkit::TextInput::HIGHLIGHT_COLOR_PROPERTY:
+ {
+ value = textInputImpl.GetMaterialDiffuseColor();
+ break;
+ }
+ case Toolkit::TextInput::CUT_AND_PASTE_COLOR_PROPERTY:
+ {
+ value = textInputImpl.mPopupPanel.GetCutPastePopupColor();
+ break;
+ }
+ case Toolkit::TextInput::CUT_AND_PASTE_PRESSED_COLOR_PROPERTY:
+ {
+ value = textInputImpl.mPopupPanel.GetCutPastePopupPressedColor();
+ break;
+ }
+ case Toolkit::TextInput::CUT_AND_PASTE_BORDER_COLOR_PROPERTY :
+ {
+ value = textInputImpl.mPopupPanel.GetCutPastePopupBorderColor();
+ break;
+ }
+ case Toolkit::TextInput::CUT_AND_PASTE_ICON_COLOR_PROPERTY:
+ {
+ value = textInputImpl.mPopupPanel.GetCutPastePopupIconColor();
+ break;
+ }
+ case Toolkit::TextInput::CUT_AND_PASTE_ICON_PRESSED_COLOR_PROPERTY:
+ {
+ value = textInputImpl.mPopupPanel.GetCutPastePopupIconPressedColor();
+ break;
+ }
+ case Toolkit::TextInput::CUT_AND_PASTE_TEXT_COLOR_PROPERTY:
+ {
+ value = textInputImpl.mPopupPanel.GetCutPastePopupTextColor();
+ break;
+ }
+ case Toolkit::TextInput::CUT_AND_PASTE_TEXT_PRESSED_COLOR_PROPERTY:
+ {
+ value = textInputImpl.mPopupPanel.GetCutPastePopupTextPressedColor();
+ break;
+ }
+ case Toolkit::TextInput::CUT_BUTTON_POSITION_PRIORITY_PROPERTY:
+ {
+ value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsCut );
+ break;
+ }
+ case Toolkit::TextInput::COPY_BUTTON_POSITION_PRIORITY_PROPERTY:
+ {
+ value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsCopy );
+ break;
+ }
+ case Toolkit::TextInput::PASTE_BUTTON_POSITION_PRIORITY_PROPERTY:
+ {
+ value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsPaste );
+ break;
+ }
+ case Toolkit::TextInput::SELECT_BUTTON_POSITION_PRIORITY_PROPERTY:
+ {
+ value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsSelect );
+ break;
+ }
+ case Toolkit::TextInput::SELECT_ALL_BUTTON_POSITION_PRIORITY_PROPERTY:
+ {
+ value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsSelectAll );
+ break;
+ }
+ case Toolkit::TextInput::CLIPBOARD_BUTTON_POSITION_PRIORITY_PROPERTY:
+ {
+ value = textInputImpl.mPopupPanel.GetButtonPriorityPosition( TextInputPopup::ButtonsClipboard );
+ break;
+ }
+ case Toolkit::TextInput::POP_UP_OFFSET_FROM_TEXT_PROPERTY:
+ {
+ value = textInputImpl.GetOffsetFromText();
+ break;
+ }
+ case Toolkit::TextInput::CURSOR_COLOR_PROPERTY:
+ {
+ value = textInputImpl.mCursor.GetCurrentColor();
+ }
+ }
+ }
+ return value;
+}
+
void TextInput::EmitStyleChangedSignal()
{
// emit signal if input style changes.
-
Toolkit::TextInput handle( GetOwner() );
mStyleChangedSignalV2.Emit( handle, mInputStyle );
}
+void TextInput::EmitTextModified()
+{
+ // emit signal when text changes.
+ Toolkit::TextInput handle( GetOwner() );
+ mTextModifiedSignal.Emit( handle );
+}
+
+
void TextInput::EmitMaxInputCharactersReachedSignal()
{
// emit signal if max characters is reached during text input.