return isScrolled;
}
+void Controller::SetHiddenInputOption(const Property::Map& options )
+{
+ if( NULL == mImpl->mHiddenInput )
+ {
+ mImpl->mHiddenInput = new HiddenText( this );
+ }
+ mImpl->mHiddenInput->SetProperties(options);
+}
+
+void Controller::GetHiddenInputOption(Property::Map& options )
+{
+ if( NULL != mImpl->mHiddenInput )
+ {
+ mImpl->mHiddenInput->GetProperties(options);
+ }
+}
+
// public : Relayout.
Controller::UpdateTextType Controller::Relayout( const Size& size )
{
DALI_ASSERT_DEBUG( mImpl->mEventData && "Unexpected KeyEvent" );
- bool textChanged( false );
+ bool textChanged = false;
+ bool relayoutNeeded = false;
if( ( NULL != mImpl->mEventData ) &&
( keyEvent.state == KeyEvent::Down ) )
{
// Escape key is a special case which causes focus loss
KeyboardFocusLostEvent();
+
+ // Will request for relayout.
+ relayoutNeeded = true;
}
else if( ( Dali::DALI_KEY_CURSOR_LEFT == keyCode ) ||
( Dali::DALI_KEY_CURSOR_RIGHT == keyCode ) ||
Event event( Event::CURSOR_KEY_EVENT );
event.p1.mInt = keyCode;
mImpl->mEventData->mEventQueue.push_back( event );
+
+ // Will request for relayout.
+ relayoutNeeded = true;
}
else if( Dali::DALI_KEY_BACKSPACE == keyCode )
{
textChanged = BackspaceKeyEvent();
+
+ // Will request for relayout.
+ relayoutNeeded = true;
}
else if( IsKey( keyEvent, Dali::DALI_KEY_POWER ) ||
IsKey( keyEvent, Dali::DALI_KEY_MENU ) ||
// Power key/Menu/Home key behaviour does not allow edit mode to resume.
mImpl->ChangeState( EventData::INACTIVE );
+ // Will request for relayout.
+ relayoutNeeded = true;
+
// This branch avoids calling the InsertText() method of the 'else' branch which can delete selected text.
}
else if( Dali::DALI_KEY_SHIFT_LEFT == keyCode )
// Do nothing.
}
+ else if( ( Dali::DALI_KEY_VOLUME_UP == keyCode ) || ( Dali::DALI_KEY_VOLUME_DOWN == keyCode ) )
+ {
+ // This branch avoids calling the InsertText() method of the 'else' branch which can delete selected text.
+ // Do nothing.
+ }
else
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::KeyEvent %p keyString %s\n", this, keyString.c_str() );
InsertText( keyString, COMMIT );
textChanged = true;
+
+ // Will request for relayout.
+ relayoutNeeded = true;
}
if ( ( mImpl->mEventData->mState != EventData::INTERRUPTED ) &&
( mImpl->mEventData->mState != EventData::INACTIVE ) &&
( !isNullKey ) &&
- ( Dali::DALI_KEY_SHIFT_LEFT != keyCode ) )
+ ( Dali::DALI_KEY_SHIFT_LEFT != keyCode ) &&
+ ( Dali::DALI_KEY_VOLUME_UP != keyCode ) &&
+ ( Dali::DALI_KEY_VOLUME_DOWN != keyCode ) )
{
// Should not change the state if the key is the shift send by the imf manager.
// Otherwise, when the state is SELECTING the text controller can't send the right
// surrounding info to the imf.
mImpl->ChangeState( EventData::EDITING );
+
+ // Will request for relayout.
+ relayoutNeeded = true;
}
- mImpl->RequestRelayout();
+ if( relayoutNeeded )
+ {
+ mImpl->RequestRelayout();
+ }
}
if( textChanged &&
}
}
+void Controller::DisplayTimeExpired()
+{
+ mImpl->mEventData->mUpdateCursorPosition = true;
+ // Apply modifications to the model
+ mImpl->mOperationsPending = ALL_OPERATIONS;
+
+ mImpl->RequestRelayout();
+}
+
// private : Update.
void Controller::InsertText( const std::string& text, Controller::InsertType type )
{
- bool removedPrevious( false );
- bool maxLengthReached( false );
+ bool removedPrevious = false;
+ bool removedSelected = false;
+ bool maxLengthReached = false;
DALI_ASSERT_DEBUG( NULL != mImpl->mEventData && "Unexpected InsertText" )
// TODO: At the moment the underline runs are only for pre-edit.
mImpl->mModel->mVisualModel->mUnderlineRuns.Clear();
- // Keep the current number of characters.
- const Length currentNumberOfCharacters = mImpl->IsShowingRealText() ? mImpl->mModel->mLogicalModel->mText.Count() : 0u;
-
// Remove the previous IMF pre-edit.
if( mImpl->mEventData->mPreEditFlag && ( 0u != mImpl->mEventData->mPreEditLength ) )
{
else
{
// Remove the previous Selection.
- removedPrevious = RemoveSelectedText();
+ removedSelected = RemoveSelectedText();
+
}
Vector<Character> utf32Characters;
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Inserted %d characters, new size %d new cursor %d\n", maxSizeOfNewText, mImpl->mModel->mLogicalModel->mText.Count(), mImpl->mEventData->mPrimaryCursorPosition );
}
- const Length numberOfCharacters = mImpl->IsShowingRealText() ? mImpl->mModel->mLogicalModel->mText.Count() : 0u;
-
if( ( 0u == mImpl->mModel->mLogicalModel->mText.Count() ) &&
mImpl->IsPlaceholderAvailable() )
{
mImpl->ClearPreEditFlag();
}
else if( removedPrevious ||
+ removedSelected ||
( 0 != utf32Characters.Count() ) )
{
// Queue an inserted event
mImpl->QueueModifyEvent( ModifyEvent::TEXT_INSERTED );
mImpl->mEventData->mUpdateCursorPosition = true;
- if( numberOfCharacters < currentNumberOfCharacters )
+ if( removedSelected )
{
mImpl->mEventData->mScrollAfterDelete = true;
}