#include <iostream>
#include <dali/public-api/adaptor-framework/key.h>
#include <dali/integration-api/debug.h>
+#include <dali/devel-api/adaptor-framework/clipboard-event-notifier.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/text/bidirectional-support.h>
CharacterIndex lastCursorIndex = 0u;
+ if( mImpl->mEventData )
+ {
+ // If popup shown then hide it by switching to Editing state
+ if ( EventData::SELECTING == mImpl->mEventData->mState ||
+ EventData::SELECTION_CHANGED == mImpl->mEventData->mState ||
+ EventData::EDITING_WITH_POPUP == mImpl->mEventData->mState )
+ {
+ mImpl->ChangeState( EventData::EDITING );
+ }
+ }
+
if( !text.empty() )
{
// Convert text into UTF-32
{
textChanged = BackspaceKeyEvent();
}
+ else if ( IsKey( keyEvent, Dali::DALI_KEY_POWER ) || IsKey( keyEvent, Dali::DALI_KEY_MENU ) )
+ {
+ // Do nothing when the Power or Menu Key is pressed.
+ // It avoids call the InsertText() method and delete the selected text.
+ }
else
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Controller::KeyEvent %p keyString %s\n", this, keyString.c_str() );
ResetText();
}
+ mImpl->ChangeState( EventData::EDITING );
+
// Handle the IMF (predicitive text) state changes
if( mImpl->mEventData )
{
const bool isShowingPlaceholderText = mImpl->IsShowingPlaceholderText();
if( 1u == tapCount )
{
- bool tapDuringEditMode( EventData::EDITING == mImpl->mEventData->mState );
-
- if( !isShowingPlaceholderText && tapDuringEditMode )
+ if( !isShowingPlaceholderText &&
+ ( EventData::EDITING == mImpl->mEventData->mState ) )
{
mImpl->mEventData->mDecorator->SetHandleActive( GRAB_HANDLE, true );
mImpl->mEventData->mDecorator->SetPopupActive( false );
}
}
+void Controller::PasteText( const std::string& stringToPaste )
+{
+ InsertText( stringToPaste, Text::Controller::COMMIT );
+ mImpl->ChangeState( EventData::EDITING );
+ mImpl->RequestRelayout();
+}
+
+void Controller::PasteClipboardItemEvent()
+{
+ ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
+ std::string stringToPaste( notifier.GetContent() );
+ PasteText( stringToPaste );
+}
+
void Controller::TextPopupButtonTouched( Dali::Toolkit::TextSelectionPopup::Buttons button )
{
if( NULL == mImpl->mEventData )
{
std::string stringToPaste("");
mImpl->GetTextFromClipboard( 0, stringToPaste ); // Paste latest item from system clipboard
- InsertText( stringToPaste, Text::Controller::COMMIT );
- mImpl->ChangeState( EventData::EDITING );
- mImpl->RequestRelayout();
+ PasteText( stringToPaste );
break;
}
case Toolkit::TextSelectionPopup::SELECT:
}
case Toolkit::TextSelectionPopup::CLIPBOARD:
{
+ mImpl->ShowClipboard();
break;
}
case Toolkit::TextSelectionPopup::NONE:
return callbackData;
}
-
Controller::~Controller()
{
delete mImpl;