-//
-// 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>
}
TextInput::TextInput()
-:Control( true ),
+:Control( ControlBehaviour( REQUIRES_TOUCH_EVENTS | REQUIRES_STYLE_CHANGE_SIGNALS ) ),
mState( StateEdit ),
mStyledText(),
mInputStyle(),
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 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();
ShowGrabHandleAndSetVisibility( false );
-
HidePopup();
}
else if(name == OPTION_CLIPBOARD)
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();
}
}
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
{
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.