/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
tet_result(TET_PASS);
END_TEST;
}
+
+int UtcDaliTextControllerSetGetCheckProperty(void)
+{
+ tet_infoline(" UtcDaliTextControllerSetGetCheckProperty");
+ ToolkitTestApplication application;
+
+ // Creates a text controller.
+ ControllerPtr controller = Controller::New();
+
+ DALI_TEST_CHECK( controller );
+
+ // Enable the text input.
+ // Creates a decorator.
+ Text::DecoratorPtr decorator = Text::Decorator::New( *controller, *controller );
+
+ // Enables the text input.
+ controller->EnableTextInput( decorator );
+
+ DALI_TEST_CHECK( !controller->IsInputModePassword() );
+
+ // Set the text input to password.
+ controller->SetInputModePassword( true );
+
+ DALI_TEST_CHECK( controller->IsInputModePassword() );
+
+ // Unset the text input to password.
+ controller->SetInputModePassword( false );
+
+ DALI_TEST_CHECK( !controller->IsInputModePassword() );
+
+ tet_result(TET_PASS);
+ END_TEST;
+}
public:
typedef Dali::ImfManager::ImfManagerSignalType ImfManagerSignalType;
typedef Dali::ImfManager::ImfEventSignalType ImfEventSignalType;
+ typedef Dali::ImfManager::StatusSignalType ImfStatusSignalType;
+ typedef Dali::ImfManager::VoidSignalType ImfVoidSignalType;
public:
static Dali::ImfManager Get();
unsigned int GetCursorPosition() const;
void SetSurroundingText( const std::string& text );
const std::string& GetSurroundingText() const;
+ void ApplyOptions( const InputMethodOptions& options );
public: // Signals
ImfManagerSignalType& ActivatedSignal() { return mActivatedSignal; }
ImfEventSignalType& EventReceivedSignal() { return mEventSignal; }
+ ImfStatusSignalType& StatusChangedSignal() { return mKeyboardStatusSignal; }
+ ImfVoidSignalType& ResizedSignal() { return mKeyboardResizeSignal; }
+ ImfVoidSignalType& LanguageChangedSignal() { return mKeyboardLanguageChangedSignal; }
protected:
virtual ~ImfManager();
std::string mSurroundingText;
bool mRestoreAfterFocusLost:1; ///< Whether the keyboard needs to be restored (activated ) after focus regained.
bool mIdleCallbackConnected:1; ///< Whether the idle callback is already connected.
+ InputMethodOptions mOptions;
ImfManagerSignalType mActivatedSignal;
ImfEventSignalType mEventSignal;
-
+ ImfStatusSignalType mKeyboardStatusSignal;
+ ImfVoidSignalType mKeyboardResizeSignal;
+ ImfVoidSignalType mKeyboardLanguageChangedSignal;
static Dali::ImfManager mToolkitImfManager;
return mSurroundingText;
}
+void ImfManager::ApplyOptions( const InputMethodOptions& options )
+{
+}
+
} // Adaptor
} // Internal
{
}
+void ImfManager::ApplyOptions( const InputMethodOptions& options )
+{
+ Internal::Adaptor::ImfManager::GetImplementation(*this).ApplyOptions( options );
+}
+
ImfManager::ImfManagerSignalType& ImfManager::ActivatedSignal()
{
return Internal::Adaptor::ImfManager::GetImplementation(*this).ActivatedSignal();
return Internal::Adaptor::ImfManager::GetImplementation(*this).EventReceivedSignal();
}
+ImfManager::StatusSignalType& ImfManager::StatusChangedSignal()
+{
+ return Internal::Adaptor::ImfManager::GetImplementation(*this).StatusChangedSignal();
+}
+
+ImfManager::VoidSignalType& ImfManager::ResizedSignal()
+{
+ return Internal::Adaptor::ImfManager::GetImplementation(*this).ResizedSignal();
+}
+
+ImfManager::VoidSignalType& ImfManager::LanguageChangedSignal()
+{
+ return Internal::Adaptor::ImfManager::GetImplementation(*this).LanguageChangedSignal();
+}
+
ImfManager::ImfManager(Internal::Adaptor::ImfManager *impl)
: BaseHandle(impl)
{
#define __DALI_IMF_MANAGER_H__
#include <dali/public-api/object/base-handle.h>
#include <dali/public-api/signals/dali-signal.h>
+#include <dali/devel-api/adaptor-framework/input-method-options.h>
namespace Dali DALI_IMPORT_API
{
typedef Signal< void (ImfManager&) > ImfManagerSignalType; ///< Keyboard actived signal
typedef Signal< ImfCallbackData ( ImfManager&, const ImfEventData& ) > ImfEventSignalType; ///< keyboard events
+ typedef Signal< void () > VoidSignalType;
+ typedef Signal< void (bool) > StatusSignalType;
public:
*/
void NotifyTextInputMultiLine( bool multiLine );
+ /**
+ * @brief Set one or more of the Input Method options
+ * @param[in] options The options to be applied
+ */
+ void ApplyOptions( const InputMethodOptions& options );
+
public:
// Signals
*/
ImfEventSignalType& EventReceivedSignal();
+ /**
+ * @brief Connect to this signal to be notified when the virtual keyboard is shown or hidden.
+ *
+ * @return The signal connect to status changed event.
+ */
+ StatusSignalType& StatusChangedSignal();
+
+ /**
+ * @brief Connect to this signal to be notified when the virtual keyboard is resized.
+ *
+ * @return The signal to connect to resized event.
+ */
+ VoidSignalType& ResizedSignal();
+
+ /**
+ * @brief Connect to this signal to be notified when the virtual keyboard's language is changed.
+ *
+ * @return The signal to connect to language changed event.
+ */
+ VoidSignalType& LanguageChangedSignal();
+
// Construction & Destruction
/**
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
field.SetProperty( TextField::Property::DECORATION_BOUNDING_BOX, Rect<int>( 0, 0, 1, 1 ) );
DALI_TEST_EQUALS( field.GetProperty<Rect <int > >( TextField::Property::DECORATION_BOUNDING_BOX ), Rect<int>( 0, 0, 1, 1 ), TEST_LOCATION );
+ // Check the input method setting
+ Property::Map propertyMap;
+ InputMethod::PanelLayout::Type panelLayout = InputMethod::PanelLayout::NUMBER;
+ InputMethod::AutoCapital::Type autoCapital = InputMethod::AutoCapital::WORD;
+ InputMethod::ActionButtonTitle::Type actionButton = InputMethod::ActionButtonTitle::GO;
+ int inputVariation = 1;
+ propertyMap["PANEL_LAYOUT"] = panelLayout;
+ propertyMap["AUTO_CAPITALISE"] = autoCapital;
+ propertyMap["ACTION_BUTTON"] = actionButton;
+ propertyMap["VARIATION"] = inputVariation;
+ field.SetProperty( TextField::Property::INPUT_METHOD_SETTINGS, propertyMap );
+
+ Property::Value value = field.GetProperty( TextField::Property::INPUT_METHOD_SETTINGS );
+ Property::Map map;
+ DALI_TEST_CHECK( value.Get( map ) );
+
+ int layout = 0;
+ DALI_TEST_CHECK( map[ "PANEL_LAYOUT" ].Get( layout ) );
+ DALI_TEST_EQUALS( static_cast<int>(panelLayout), layout, TEST_LOCATION );
+
+ int capital = 0;
+ DALI_TEST_CHECK( map[ "AUTO_CAPITALISE" ].Get( capital ) );
+ DALI_TEST_EQUALS( static_cast<int>(autoCapital), capital, TEST_LOCATION );
+
+ int action = 0;
+ DALI_TEST_CHECK( map[ "ACTION_BUTTON" ].Get( action ) );
+ DALI_TEST_EQUALS( static_cast<int>(actionButton), action, TEST_LOCATION );
+
+ int variation = 0;
+ DALI_TEST_CHECK( map[ "VARIATION" ].Get( variation ) );
+ DALI_TEST_EQUALS( inputVariation, variation, TEST_LOCATION );
+
// Check input color property.
field.SetProperty( TextField::Property::INPUT_COLOR, Color::YELLOW );
DALI_TEST_EQUALS( field.GetProperty<Vector4>( TextField::Property::INPUT_COLOR ), Color::YELLOW, TEST_LOCATION );
field.SetSize( 300.f, 50.f );
field.SetParentOrigin( ParentOrigin::TOP_LEFT );
field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ Property::Map propertyMap;
+ propertyMap["PANEL_LAYOUT"] = InputMethod::PanelLayout::PASSWORD;
+ field.SetProperty( TextField::Property::INPUT_METHOD_SETTINGS, propertyMap );
// Avoid a crash when core load gl resources.
application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
#include <dali/public-api/adaptor-framework/key.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/images/resource-image.h>
-#include <dali/devel-api/adaptor-framework/virtual-keyboard.h>
#include <dali/devel-api/object/property-helper-devel.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/integration-api/adaptors/adaptor.h>
EnableGestureDetection( static_cast<Gesture::Type>( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) );
GetTapGestureDetector().SetMaximumTapsRequired( 2 );
+ mImfManager = ImfManager::Get();
+
self.TouchSignal().Connect( this, &TextEditor::OnTouched );
// Set BoundingBox to stage size if not already set.
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor::OnKeyInputFocusGained %p\n", mController.Get() );
- VirtualKeyboard::StatusChangedSignal().Connect( this, &TextEditor::KeyboardStatusChanged );
+ mImfManager.StatusChangedSignal().Connect( this, &TextEditor::KeyboardStatusChanged );
- ImfManager imfManager = ImfManager::Get();
+ mImfManager.EventReceivedSignal().Connect( this, &TextEditor::OnImfEvent );
- if ( imfManager )
- {
- imfManager.EventReceivedSignal().Connect( this, &TextEditor::OnImfEvent );
+ // Notify that the text editing start.
+ mImfManager.Activate();
- // Notify that the text editing start.
- imfManager.Activate();
-
- // When window gain lost focus, the imf manager is deactivated. Thus when window gain focus again, the imf manager must be activated.
- imfManager.SetRestoreAfterFocusLost( true );
- }
+ // When window gain lost focus, the imf manager is deactivated. Thus when window gain focus again, the imf manager must be activated.
+ mImfManager.SetRestoreAfterFocusLost( true );
ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor:OnKeyInputFocusLost %p\n", mController.Get() );
- VirtualKeyboard::StatusChangedSignal().Disconnect( this, &TextEditor::KeyboardStatusChanged );
+ mImfManager.StatusChangedSignal().Disconnect( this, &TextEditor::KeyboardStatusChanged );
- ImfManager imfManager = ImfManager::Get();
- if ( imfManager )
- {
- // The text editing is finished. Therefore the imf manager don't have restore activation.
- imfManager.SetRestoreAfterFocusLost( false );
+ // The text editing is finished. Therefore the imf manager don't have restore activation.
+ mImfManager.SetRestoreAfterFocusLost( false );
- // Notify that the text editing finish.
- imfManager.Deactivate();
+ // Notify that the text editing finish.
+ mImfManager.Deactivate();
- imfManager.EventReceivedSignal().Disconnect( this, &TextEditor::OnImfEvent );
- }
+ mImfManager.EventReceivedSignal().Disconnect( this, &TextEditor::OnImfEvent );
ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextEditor::OnTap %p\n", mController.Get() );
- // Show the keyboard if it was hidden.
- if (!VirtualKeyboard::IsVisible())
- {
- VirtualKeyboard::Show();
- }
+ mImfManager.Activate();
// Deliver the tap before the focus event to controller; this allows us to detect when focus is gained due to tap-gestures
mController->TapEvent( gesture.numberOfTaps, gesture.localPoint.x, gesture.localPoint.y );
void TextEditor::OnLongPress( const LongPressGesture& gesture )
{
- // Show the keyboard if it was hidden.
- if (!VirtualKeyboard::IsVisible())
- {
- VirtualKeyboard::Show();
- }
+ mImfManager.Activate();
mController->LongPressEvent( gesture.state, gesture.localPoint.x, gesture.localPoint.y );
#define DALI_TOOLKIT_INTERNAL_TEXT_EDITOR_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
Toolkit::TextEditor::TextChangedSignalType mTextChangedSignal;
Toolkit::TextEditor::InputStyleChangedSignalType mInputStyleChangedSignal;
+ ImfManager mImfManager;
Text::ControllerPtr mController;
Text::RendererPtr mRenderer;
Text::DecoratorPtr mDecorator;
#include <dali/public-api/adaptor-framework/key.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/images/resource-image.h>
-#include <dali/devel-api/adaptor-framework/virtual-keyboard.h>
#include <dali/public-api/object/type-registry-helper.h>
#include <dali/integration-api/adaptors/adaptor.h>
#include <dali/integration-api/debug.h>
#include <dali-toolkit/public-api/text/rendering-backend.h>
#include <dali-toolkit/public-api/visuals/color-visual-properties.h>
#include <dali-toolkit/devel-api/controls/control-depth-index-ranges.h>
+#include <dali-toolkit/devel-api/focus-manager/keyinput-focus-manager.h>
#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/text/rendering/text-backend.h>
#include <dali-toolkit/internal/text/text-effects-style.h>
}
case Toolkit::TextField::Property::INPUT_METHOD_SETTINGS:
{
- const Property::Map map = value.Get<Property::Map>();
- VirtualKeyboard::ApplySettings( map );
+ const Property::Map* map = value.GetMap();
+ if (map)
+ {
+ impl.mInputMethodOptions.ApplyProperty( *map );
+ }
+ impl.mController->SetInputModePassword( impl.mInputMethodOptions.IsPassword() );
+
+ Toolkit::Control control = Toolkit::KeyInputFocusManager::Get().GetCurrentFocusControl();
+ if (control == textField)
+ {
+ impl.mImfManager.ApplyOptions( impl.mInputMethodOptions );
+ }
break;
}
case Toolkit::TextField::Property::INPUT_COLOR:
}
case Toolkit::TextField::Property::INPUT_METHOD_SETTINGS:
{
+ Property::Map map;
+ impl.mInputMethodOptions.RetrieveProperty( map );
+ value = map;
break;
}
case Toolkit::TextField::Property::INPUT_COLOR:
EnableGestureDetection( static_cast<Gesture::Type>( Gesture::Tap | Gesture::Pan | Gesture::LongPress ) );
GetTapGestureDetector().SetMaximumTapsRequired( 2 );
+ mImfManager = ImfManager::Get();
+
self.TouchSignal().Connect( this, &TextField::OnTouched );
// Set BoundingBox to stage size if not already set.
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnKeyInputFocusGained %p\n", mController.Get() );
- VirtualKeyboard::StatusChangedSignal().Connect( this, &TextField::KeyboardStatusChanged );
+ mImfManager.ApplyOptions( mInputMethodOptions );
- ImfManager imfManager = ImfManager::Get();
+ mImfManager.StatusChangedSignal().Connect( this, &TextField::KeyboardStatusChanged );
- if ( imfManager )
- {
- imfManager.EventReceivedSignal().Connect( this, &TextField::OnImfEvent );
+ mImfManager.EventReceivedSignal().Connect( this, &TextField::OnImfEvent );
- // Notify that the text editing start.
- imfManager.Activate();
+ // Notify that the text editing start.
+ mImfManager.Activate();
- // When window gain lost focus, the imf manager is deactivated. Thus when window gain focus again, the imf manager must be activated.
- imfManager.SetRestoreAfterFocusLost( true );
- }
+ // When window gain lost focus, the imf manager is deactivated. Thus when window gain focus again, the imf manager must be activated.
+ mImfManager.SetRestoreAfterFocusLost( true );
ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField:OnKeyInputFocusLost %p\n", mController.Get() );
- VirtualKeyboard::StatusChangedSignal().Disconnect( this, &TextField::KeyboardStatusChanged );
+ mImfManager.StatusChangedSignal().Disconnect( this, &TextField::KeyboardStatusChanged );
+ // The text editing is finished. Therefore the imf manager don't have restore activation.
+ mImfManager.SetRestoreAfterFocusLost( false );
- ImfManager imfManager = ImfManager::Get();
- if ( imfManager )
- {
- // The text editing is finished. Therefore the imf manager don't have restore activation.
- imfManager.SetRestoreAfterFocusLost( false );
-
- // Notify that the text editing finish.
- imfManager.Deactivate();
+ // Notify that the text editing finish.
+ mImfManager.Deactivate();
- imfManager.EventReceivedSignal().Disconnect( this, &TextField::OnImfEvent );
- }
+ mImfManager.EventReceivedSignal().Disconnect( this, &TextField::OnImfEvent );
ClipboardEventNotifier notifier( ClipboardEventNotifier::Get() );
{
DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextField::OnTap %p\n", mController.Get() );
- // Show the keyboard if it was hidden.
- if (!VirtualKeyboard::IsVisible())
- {
- VirtualKeyboard::Show();
- }
+ mImfManager.Activate();
// Deliver the tap before the focus event to controller; this allows us to detect when focus is gained due to tap-gestures
mController->TapEvent( gesture.numberOfTaps, gesture.localPoint.x, gesture.localPoint.y );
void TextField::OnLongPress( const LongPressGesture& gesture )
{
- // Show the keyboard if it was hidden.
- if (!VirtualKeyboard::IsVisible())
- {
- VirtualKeyboard::Show();
- }
+ mImfManager.Activate();
mController->LongPressEvent( gesture.state, gesture.localPoint.x, gesture.localPoint.y );
#define DALI_TOOLKIT_INTERNAL_TEXT_FIELD_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
Toolkit::TextField::MaxLengthReachedSignalType mMaxLengthReachedSignal;
Toolkit::TextField::InputStyleChangedSignalType mInputStyleChangedSignal;
+ ImfManager mImfManager;
Text::ControllerPtr mController;
Text::RendererPtr mRenderer;
Text::DecoratorPtr mDecorator;
Toolkit::Control mStencil; ///< For EXCEED_POLICY_CLIP
std::vector<Actor> mClippingDecorationActors; ///< Decoration actors which need clipping.
+ Dali::InputMethodOptions mInputMethodOptions;
Actor mRenderableActor;
CallbackBase* mIdleCallback;
const float MAX_FLOAT = std::numeric_limits<float>::max();
const float MIN_FLOAT = std::numeric_limits<float>::min();
const Dali::Toolkit::Text::CharacterDirection LTR = false; ///< Left To Right direction
+const uint32_t STAR = 0x2A;
} // namespace
mScrollAfterUpdatePosition( false ),
mScrollAfterDelete( false ),
mAllTextSelected( false ),
- mUpdateInputStyle( false )
+ mUpdateInputStyle( false ),
+ mPasswordInput( false )
{
mImfManager = ImfManager::Get();
}
return false;
}
- Vector<Character>& utf32Characters = mModel->mLogicalModel->mText;
+ Vector<Character> utf32CharactersStar;
+ const Length characterCount = mModel->mLogicalModel->mText.Count();
+ const bool isPasswordInput = ( mEventData != NULL && mEventData->mPasswordInput &&
+ !mEventData->mIsShowingPlaceholderText && characterCount > 0 );
+
+ if (isPasswordInput)
+ {
+ utf32CharactersStar.Resize( characterCount );
+
+ uint32_t* begin = utf32CharactersStar.Begin();
+ uint32_t* end = begin + characterCount;
+ while ( begin < end )
+ {
+ *begin++ = STAR;
+ }
+ }
+ Vector<Character>& utf32Characters = isPasswordInput ? utf32CharactersStar : mModel->mLogicalModel->mText;
const Length numberOfCharacters = utf32Characters.Count();
// Index to the first character of the first paragraph to be updated.
const Script script = mModel->mLogicalModel->GetScript( index );
if( HasLigatureMustBreak( script ) )
{
- // Prevents to jump the whole Latin ligatures like fi, ff, or Arabic ﻻ, ...
+ // Prevents to jump the whole Latin ligatures like fi, ff, or Arabic ﻻ, ...
numberOfCharacters = 1u;
}
}
bool mScrollAfterDelete : 1; ///< Whether to scroll after delete characters.
bool mAllTextSelected : 1; ///< True if the selection handles are selecting all the text.
bool mUpdateInputStyle : 1; ///< Whether to update the input style after moving the cursor.
+ bool mPasswordInput : 1; ///< True if password input is enabled.
bool mCheckScrollAmount : 1; ///< Whether to check scrolled amount after updating the position
};
return GetDefaultOutlineProperties();
}
+void Controller::SetInputModePassword( bool passwordInput )
+{
+ if( NULL != mImpl->mEventData )
+ {
+ mImpl->mEventData->mPasswordInput = passwordInput;
+ }
+}
+
+bool Controller::IsInputModePassword()
+{
+ if( NULL != mImpl->mEventData )
+ {
+ return mImpl->mEventData->mPasswordInput;
+ }
+ return false;
+}
+
// public : Queries & retrieves.
Layout::Engine& Controller::GetLayoutEngine()
*/
bool IsTextElideEnabled() const;
+ /**
+ * @brief Sets input type to password
+ *
+ * @note The string is displayed continuous "*"
+ *
+ * @param[in] passwordInput True if password input is enabled.
+ */
+ void SetInputModePassword( bool passwordInput );
+
+ /**
+ * @brief Returns whether the input mode type is set as password.
+ *
+ * @return True if input mode type is password
+ */
+ bool IsInputModePassword();
+
public: // Update.
/**