[4.0] Add ENABLE_SHIFT_SELECTION property 78/164378/1
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Wed, 13 Dec 2017 10:43:29 +0000 (19:43 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Tue, 19 Dec 2017 02:10:25 +0000 (11:10 +0900)
 - Added ENABLE_SHIFT_SELECTION property in DevelTextField and DevelTextEditor
 - ENABLE_SHIFT_SELECTION property is enabled or disabled Text selection using
 Keyboard Shift key.

Change-Id: I70a712ffd5eab04b1dc81768b6b39ca29c785a2e
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
automated-tests/src/dali-toolkit/utc-Dali-TextEditor.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp
dali-toolkit/devel-api/controls/text-controls/text-editor-devel.h
dali-toolkit/devel-api/controls/text-controls/text-field-devel.h [new file with mode: 0644]
dali-toolkit/devel-api/file.list
dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/text/text-controller-impl.cpp
dali-toolkit/internal/text/text-controller-impl.h
dali-toolkit/internal/text/text-controller.cpp
dali-toolkit/internal/text/text-controller.h

index 6f9784f4ea104399fdeb05a71e2782752497ede8..9fc074fbe85558afbef11a1841a1c7929c5cf849 100644 (file)
@@ -99,6 +99,7 @@ const char* const PROPERTY_NAME_PLACEHOLDER_TEXT                     = "placehol
 const char* const PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR               = "placeholderTextColor";
 const char* const PROPERTY_NAME_ENABLE_SELECTION                     = "enableSelection";
 const char* const PROPERTY_NAME_PLACEHOLDER                          = "placeholder";
+const char* const PROPERTY_NAME_ENABLE_SHIFT_SELECTION               = "enableShiftSelection";
 
 const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
 
@@ -536,6 +537,7 @@ int UtcDaliTextEditorGetPropertyP(void)
   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER ) == TextEditor::Property::PLACEHOLDER );
   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT ) == DevelTextEditor::Property::PLACEHOLDER_TEXT );
   DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR ) == DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR );
+  DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_ENABLE_SHIFT_SELECTION ) == DevelTextEditor::Property::ENABLE_SHIFT_SELECTION );
 
   END_TEST;
 }
@@ -2175,6 +2177,52 @@ int utcDaliTextEditorEvent07(void)
 
   DALI_TEST_EQUALS( "Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
 
+
+  // Disable Shift Selection
+  editor.SetProperty( DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false );
+
+  // Test to select some text in the right of the current cursor position
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_RIGHT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Cut the selected text
+  application.ProcessEvent( GenerateKey( "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "x", "x", KEY_X_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // The text isn't selected and not changed because of 'SetProperty( DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false )'
+  DALI_TEST_EQUALS( "Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
+
+  // Test to select some text in the left of the current cursor position
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_SHIFT_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "", "", DALI_KEY_CURSOR_LEFT, KEY_SHIFT_MODIFIER, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // Copy the selected text
+  application.ProcessEvent( GenerateKey( "", "", Dali::DevelKey::DALI_KEY_CONTROL_LEFT, 0, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+  application.ProcessEvent( GenerateKey( "c", "c", KEY_C_CODE, KEY_CONTROL_MODIFIER, 0, Integration::KeyEvent::Down, DEFAULT_DEVICE_NAME, Device::Class::NONE, Device::Subclass::NONE ) );
+
+  // Render and notify
+  application.SendNotification();
+  application.Render();
+
+  // The text is not selected and not changed because of 'SetProperty( DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false )'
+  DALI_TEST_EQUALS( "Hello\nld\nHello lo\nworld", editor.GetProperty<std::string>( TextEditor::Property::TEXT ), TEST_LOCATION );
+
   END_TEST;
 }
 
@@ -2510,3 +2558,31 @@ int UtcDaliTextEditorSetPaddingProperty(void)
 
   END_TEST;
 }
+
+int UtcDaliTextEditorEnableShiftSelectionProperty(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliTextEditorEnableShiftSelectionProperty");
+
+  TextEditor editor = TextEditor::New();
+  DALI_TEST_CHECK( editor );
+  editor.SetSize( 300.f, 50.f );
+  editor.SetParentOrigin( ParentOrigin::TOP_LEFT );
+  editor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+  Stage::GetCurrent().Add( editor );
+
+  application.SendNotification();
+  application.Render();
+
+  // The default value of ENABLE_SHIFT_SELECTION is 'true'.
+  DALI_TEST_EQUALS( editor.GetProperty<bool>( DevelTextEditor::Property::ENABLE_SHIFT_SELECTION ), true, TEST_LOCATION );
+
+  // Check the enable shift selection property
+  editor.SetProperty( DevelTextEditor::Property::ENABLE_SHIFT_SELECTION, false );
+  DALI_TEST_EQUALS( editor.GetProperty<bool>( DevelTextEditor::Property::ENABLE_SHIFT_SELECTION ), false, TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render();
+
+  END_TEST;
+}
index 633ff81d56bcb26ab40a3efc07ed5a6b2fe00442..07f1cac4ea65b5e9dd2621c9964a92bd6130aaff 100644 (file)
@@ -27,6 +27,7 @@
 #include <dali/integration-api/events/long-press-gesture-event.h>
 #include <dali-toolkit-test-suite-utils.h>
 #include <dali-toolkit/dali-toolkit.h>
+#include <dali-toolkit/devel-api/controls/text-controls/text-field-devel.h>
 #include "toolkit-clipboard.h"
 
 using namespace Dali;
@@ -99,6 +100,7 @@ const char* const PROPERTY_NAME_PIXEL_SIZE                           = "pixelSiz
 const char* const PROPERTY_NAME_ENABLE_SELECTION                     = "enableSelection";
 const char* const PROPERTY_NAME_PLACEHOLDER                          = "placeholder";
 const char* const PROPERTY_NAME_ELLIPSIS                             = "ellipsis";
+const char* const PROPERTY_NAME_ENABLE_SHIFT_SELECTION               = "enableShiftSelection";
 
 const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
 
@@ -539,6 +541,7 @@ int UtcDaliTextFieldGetPropertyP(void)
   DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_SELECTION ) == TextField::Property::ENABLE_SELECTION );
   DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PLACEHOLDER ) == TextField::Property::PLACEHOLDER );
   DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ELLIPSIS ) == TextField::Property::ELLIPSIS );
+  DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_SHIFT_SELECTION ) == DevelTextField::Property::ENABLE_SHIFT_SELECTION );
 
   END_TEST;
 }
@@ -2747,3 +2750,31 @@ int UtcDaliTextFieldSetPaddingProperty(void)
 
   END_TEST;
 }
+
+int UtcDaliTextFieldEnableShiftSelectionProperty(void)
+{
+  ToolkitTestApplication application;
+  tet_infoline("UtcDaliTextFieldEnableShiftSelectionProperty");
+
+  TextField field = TextField::New();
+  DALI_TEST_CHECK( field );
+  field.SetSize( 300.f, 50.f );
+  field.SetParentOrigin( ParentOrigin::TOP_LEFT );
+  field.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+  Stage::GetCurrent().Add( field );
+
+  application.SendNotification();
+  application.Render();
+
+  // The default value of ENABLE_SHIFT_SELECTION is 'true'.
+  DALI_TEST_EQUALS( field.GetProperty<bool>( DevelTextField::Property::ENABLE_SHIFT_SELECTION ), true, TEST_LOCATION );
+
+  // Check the enable shift selection property
+  field.SetProperty( DevelTextField::Property::ENABLE_SHIFT_SELECTION, false );
+  DALI_TEST_EQUALS( field.GetProperty<bool>( DevelTextField::Property::ENABLE_SHIFT_SELECTION ), false, TEST_LOCATION );
+
+  application.SendNotification();
+  application.Render();
+
+  END_TEST;
+}
index 153a538da1b7a33ce68ef860a32401deb3e1e2c1..3a8fa6f71e0fde541600469a2e8c614202b997e7 100644 (file)
@@ -96,6 +96,12 @@ namespace Property
        * @details Name "placeholderTextColor", type Property::VECTOR4.
        */
       PLACEHOLDER_TEXT_COLOR,
+
+      /**
+       * @brief Enables Text selection using Shift key.
+       * @details Name "enableShiftSelection", type Property::BOOLEAN.
+       */
+      ENABLE_SHIFT_SELECTION
   };
 
 } // namespace Property
diff --git a/dali-toolkit/devel-api/controls/text-controls/text-field-devel.h b/dali-toolkit/devel-api/controls/text-controls/text-field-devel.h
new file mode 100644 (file)
index 0000000..8e73c99
--- /dev/null
@@ -0,0 +1,104 @@
+#ifndef DALI_TOOLKIT_TEXT_FIELD_DEVEL_H
+#define DALI_TOOLKIT_TEXT_FIELD_DEVEL_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali-toolkit/public-api/controls/text-controls/text-field.h>
+
+namespace Dali
+{
+
+namespace Toolkit
+{
+
+namespace DevelTextField
+{
+
+namespace Property
+{
+  enum
+  {
+      RENDERING_BACKEND = Dali::Toolkit::TextField::Property::RENDERING_BACKEND,
+      TEXT = Dali::Toolkit::TextField::Property::TEXT,
+      PLACEHOLDER_TEXT = Dali::Toolkit::TextField::Property::PLACEHOLDER_TEXT,
+      PLACEHOLDER_TEXT_FOCUSED = Dali::Toolkit::TextField::Property::PLACEHOLDER_TEXT_FOCUSED,
+      FONT_FAMILY = Dali::Toolkit::TextField::Property::FONT_FAMILY,
+      FONT_STYLE = Dali::Toolkit::TextField::Property::FONT_STYLE,
+      POINT_SIZE = Dali::Toolkit::TextField::Property::POINT_SIZE,
+      MAX_LENGTH = Dali::Toolkit::TextField::Property::MAX_LENGTH,
+      EXCEED_POLICY = Dali::Toolkit::TextField::Property::EXCEED_POLICY,
+      HORIZONTAL_ALIGNMENT = Dali::Toolkit::TextField::Property::HORIZONTAL_ALIGNMENT,
+      VERTICAL_ALIGNMENT = Dali::Toolkit::TextField::Property::VERTICAL_ALIGNMENT,
+      TEXT_COLOR = Dali::Toolkit::TextField::Property::TEXT_COLOR,
+      PLACEHOLDER_TEXT_COLOR = Dali::Toolkit::TextField::Property::PLACEHOLDER_TEXT_COLOR,
+      SHADOW_OFFSET = Dali::Toolkit::TextField::Property::SHADOW_OFFSET,
+      SHADOW_COLOR = Dali::Toolkit::TextField::Property::SHADOW_COLOR,
+      PRIMARY_CURSOR_COLOR = Dali::Toolkit::TextField::Property::PRIMARY_CURSOR_COLOR,
+      SECONDARY_CURSOR_COLOR = Dali::Toolkit::TextField::Property::SECONDARY_CURSOR_COLOR,
+      ENABLE_CURSOR_BLINK = Dali::Toolkit::TextField::Property::ENABLE_CURSOR_BLINK,
+      CURSOR_BLINK_INTERVAL = Dali::Toolkit::TextField::Property::CURSOR_BLINK_INTERVAL,
+      CURSOR_BLINK_DURATION = Dali::Toolkit::TextField::Property::CURSOR_BLINK_DURATION,
+      CURSOR_WIDTH = Dali::Toolkit::TextField::Property::CURSOR_WIDTH,
+      GRAB_HANDLE_IMAGE = Dali::Toolkit::TextField::Property::GRAB_HANDLE_IMAGE,
+      GRAB_HANDLE_PRESSED_IMAGE = Dali::Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE,
+      SCROLL_THRESHOLD = Dali::Toolkit::TextField::Property::SCROLL_THRESHOLD,
+      SCROLL_SPEED = Dali::Toolkit::TextField::Property::SCROLL_SPEED,
+      SELECTION_HANDLE_IMAGE_LEFT = Dali::Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_LEFT,
+      SELECTION_HANDLE_IMAGE_RIGHT = Dali::Toolkit::TextField::Property::SELECTION_HANDLE_IMAGE_RIGHT,
+      SELECTION_HANDLE_PRESSED_IMAGE_LEFT = Dali::Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_LEFT,
+      SELECTION_HANDLE_PRESSED_IMAGE_RIGHT = Dali::Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT,
+      SELECTION_HANDLE_MARKER_IMAGE_LEFT = Dali::Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT,
+      SELECTION_HANDLE_MARKER_IMAGE_RIGHT = Dali::Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT,
+      SELECTION_HIGHLIGHT_COLOR = Dali::Toolkit::TextField::Property::SELECTION_HIGHLIGHT_COLOR,
+      DECORATION_BOUNDING_BOX = Dali::Toolkit::TextField::Property::DECORATION_BOUNDING_BOX,
+      INPUT_METHOD_SETTINGS = Dali::Toolkit::TextField::Property::INPUT_METHOD_SETTINGS,
+      INPUT_COLOR = Dali::Toolkit::TextField::Property::INPUT_COLOR,
+      ENABLE_MARKUP = Dali::Toolkit::TextField::Property::ENABLE_MARKUP,
+      INPUT_FONT_FAMILY = Dali::Toolkit::TextField::Property::INPUT_FONT_FAMILY,
+      INPUT_FONT_STYLE = Dali::Toolkit::TextField::Property::INPUT_FONT_STYLE,
+      INPUT_POINT_SIZE = Dali::Toolkit::TextField::Property::INPUT_POINT_SIZE,
+      UNDERLINE = Dali::Toolkit::TextField::Property::UNDERLINE,
+      INPUT_UNDERLINE = Dali::Toolkit::TextField::Property::INPUT_UNDERLINE,
+      SHADOW = Dali::Toolkit::TextField::Property::SHADOW,
+      INPUT_SHADOW = Dali::Toolkit::TextField::Property::INPUT_SHADOW,
+      EMBOSS = Dali::Toolkit::TextField::Property::EMBOSS,
+      INPUT_EMBOSS = Dali::Toolkit::TextField::Property::INPUT_EMBOSS,
+      OUTLINE = Dali::Toolkit::TextField::Property::OUTLINE,
+      INPUT_OUTLINE = Dali::Toolkit::TextField::Property::INPUT_OUTLINE,
+      HIDDEN_INPUT_SETTINGS = Dali::Toolkit::TextField::Property::HIDDEN_INPUT_SETTINGS,
+      PIXEL_SIZE = Dali::Toolkit::TextField::Property::PIXEL_SIZE,
+      ENABLE_SELECTION = Dali::Toolkit::TextField::Property::ENABLE_SELECTION,
+      PLACEHOLDER = Dali::Toolkit::TextField::Property::PLACEHOLDER,
+      ELLIPSIS = Dali::Toolkit::TextField::Property::ELLIPSIS,
+
+      /**
+       * @brief Enables Text selection using Shift key.
+       * @details Name "enableShiftSelection", type Property::BOOLEAN.
+       */
+      ENABLE_SHIFT_SELECTION = ELLIPSIS + 1
+  };
+} // namespace Property
+
+} // namespace DevelText
+
+} // namespace Toolkit
+
+} // namespace Dali
+
+#endif // DALI_TOOLKIT_TEXT_FIELD_DEVEL_H
index 3c4af4e49e84294f1f7cb66c188d7395a4809929..656eabeb692769848b2777b357a41670b9171067 100644 (file)
@@ -131,6 +131,7 @@ devel_api_super_blur_view_header_files = \
 
 devel_api_text_controls_header_files = \
   $(devel_api_src_dir)/controls/text-controls/text-editor-devel.h \
+  $(devel_api_src_dir)/controls/text-controls/text-field-devel.h \
   $(devel_api_src_dir)/controls/text-controls/text-label-devel.h \
   $(devel_api_src_dir)/controls/text-controls/text-selection-popup.h \
   $(devel_api_src_dir)/controls/text-controls/text-selection-toolbar.h
index 8ac3938d2fe3dbadc2610c66f6f956f4ecb8815c..a75d7031ac92bf8c37dc46344cc6db0b07e32a9d 100644 (file)
@@ -135,6 +135,7 @@ DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "placeholder",
 DALI_PROPERTY_REGISTRATION( Toolkit, TextEditor, "lineWrapMode",                         INTEGER,   LINE_WRAP_MODE                       )
 DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "placeholderText",                STRING,    PLACEHOLDER_TEXT                     )
 DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "placeholderTextColor",           VECTOR4,   PLACEHOLDER_TEXT_COLOR               )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextEditor, "enableShiftSelection",           BOOLEAN,   ENABLE_SHIFT_SELECTION               )
 
 DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "textChanged",        SIGNAL_TEXT_CHANGED )
 DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "inputStyleChanged",  SIGNAL_INPUT_STYLE_CHANGED )
@@ -708,12 +709,23 @@ void TextEditor::SetProperty( BaseObject* object, Property::Index index, const P
           Text::LineWrap::Mode lineWrapMode( static_cast< Text::LineWrap::Mode >( -1 ) ); // Set to invalid value to ensure a valid mode does get set
           if( GetLineWrapModeEnumeration( value, lineWrapMode ) )
           {
-            DALI_LOG_INFO( gLogFilter, Debug::General, "TextLabel %p LineWrap::MODE %d\n", impl.mController.Get(), lineWrapMode );
+            DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p LineWrap::MODE %d\n", impl.mController.Get(), lineWrapMode );
             impl.mController->SetLineWrapMode( lineWrapMode );
           }
         }
         break;
       }
+      case Toolkit::DevelTextEditor::Property::ENABLE_SHIFT_SELECTION:
+      {
+        if( impl.mController )
+        {
+          const bool shiftSelection = value.Get<bool>();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_SHIFT_SELECTION %d\n", impl.mController.Get(), shiftSelection );
+
+          impl.mController->SetShiftSelectionEnabled( shiftSelection );
+        }
+        break;
+      }
     } // switch
   } // texteditor
 }
@@ -1094,6 +1106,15 @@ Property::Value TextEditor::GetProperty( BaseObject* object, Property::Index ind
         {
           value = impl.mController->GetLineWrapMode();
         }
+        break;
+      }
+      case Toolkit::DevelTextEditor::Property::ENABLE_SHIFT_SELECTION:
+      {
+        if( impl.mController )
+        {
+          value = impl.mController->IsShiftSelectionEnabled();
+        }
+        break;
       }
     } //switch
   }
index 1417743391b187cebfa89be612fb5d04f6a8dfc5..737d507755445e70a544bf34e6c3e6428c0211aa 100644 (file)
@@ -35,6 +35,7 @@
 #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/controls/text-controls/text-field-devel.h>
 #include <dali-toolkit/public-api/visuals/visual-properties.h>
 #include <dali-toolkit/internal/text/text-enumerations-impl.h>
 #include <dali-toolkit/internal/text/rendering/text-backend.h>
@@ -127,6 +128,7 @@ DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "pixelSize",
 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "enableSelection",                      BOOLEAN,   ENABLE_SELECTION                     )
 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "placeholder",                          MAP,       PLACEHOLDER                          )
 DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "ellipsis",                             BOOLEAN,   ELLIPSIS                             )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableShiftSelection",           BOOLEAN,   ENABLE_SHIFT_SELECTION               )
 
 DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "textChanged",        SIGNAL_TEXT_CHANGED )
 DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "maxLengthReached",   SIGNAL_MAX_LENGTH_REACHED )
@@ -758,6 +760,17 @@ void TextField::SetProperty( BaseObject* object, Property::Index index, const Pr
         }
         break;
       }
+      case Toolkit::DevelTextField::Property::ENABLE_SHIFT_SELECTION:
+      {
+        if( impl.mController )
+        {
+          const bool shiftSelection = value.Get<bool>();
+          DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_SHIFT_SELECTION %d\n", impl.mController.Get(), shiftSelection );
+
+          impl.mController->SetShiftSelectionEnabled( shiftSelection );
+        }
+        break;
+      }
     } // switch
   } // textfield
 }
@@ -1157,6 +1170,14 @@ Property::Value TextField::GetProperty( BaseObject* object, Property::Index inde
         }
         break;
       }
+      case Toolkit::DevelTextField::Property::ENABLE_SHIFT_SELECTION:
+      {
+        if( impl.mController )
+        {
+          value = impl.mController->IsShiftSelectionEnabled();
+        }
+        break;
+      }
     } //switch
   }
 
index dbb5012cd03ead633b62969f552bce83656adf5b..46dadbf4abc0fa768ee90d4292bc576c6ea962fb 100644 (file)
@@ -108,7 +108,8 @@ EventData::EventData( DecoratorPtr decorator )
   mPasswordInput( false ),
   mIsPlaceholderPixelSize( false ),
   mIsPlaceholderElideEnabled( false ),
-  mPlaceholderEllipsisFlag( false )
+  mPlaceholderEllipsisFlag( false ),
+  mShiftSelectionFlag( true )
 {
   mImfManager = ImfManager::Get();
 }
@@ -1262,7 +1263,7 @@ void Controller::Impl::OnCursorKeyEvent( const Event& event )
     mEventData->mRightSelectionPosition = mEventData->mPrimaryCursorPosition;
   }
 
-  if ( isShiftModifier && IsShowingRealText() )
+  if ( isShiftModifier && IsShowingRealText() && mEventData->mShiftSelectionFlag )
   {
     // Handle text selection
     bool selecting = false;
index a5de1519773fe13db64c9c60dcf2c27f481f979f..47c9bc0271f7fce526182aeacb1494ed03173ed7 100644 (file)
@@ -162,6 +162,7 @@ struct EventData
   bool mIsPlaceholderPixelSize          : 1;   ///< True if the placeholder font size is set as pixel size.
   bool mIsPlaceholderElideEnabled       : 1;   ///< True if the placeholder text's elide is enabled.
   bool mPlaceholderEllipsisFlag         : 1;   ///< True if the text controller sets the placeholder ellipsis.
+  bool mShiftSelectionFlag              : 1;   ///< True if the text selection using Shift key is enabled.
 };
 
 struct ModifyEvent
index 70f8288af800c3829aa010591a3ddeca654e472e..b8057b913f2320979d99442ecb936107075fdb5c 100755 (executable)
@@ -475,6 +475,16 @@ bool Controller::IsSelectionEnabled() const
   return mImpl->mEventData->mSelectionEnabled;
 }
 
+void Controller::SetShiftSelectionEnabled( bool enabled )
+{
+  mImpl->mEventData->mShiftSelectionFlag = enabled;
+}
+
+bool Controller::IsShiftSelectionEnabled() const
+{
+  return mImpl->mEventData->mShiftSelectionFlag;
+}
+
 // public : Update
 
 void Controller::SetText( const std::string& text )
index 88831dbf6d444a6d2d5027754fb37526c0703c9b..dc2b4c4a392d0935cb29d1d437231a551547ed14 100755 (executable)
@@ -393,6 +393,18 @@ public: // Configure the text controller.
    */
   bool IsSelectionEnabled() const;
 
+  /**
+   * @brief Enable or disable the text selection using Shift key.
+   * @param enabled Whether to enable the text selection using Shift key
+   */
+  void SetShiftSelectionEnabled( bool enabled );
+
+  /**
+   * @brief Whether the text selection using Shift key is enabled or not.
+   * @return True if the text selection using Shift key is enabled
+   */
+  bool IsShiftSelectionEnabled() const;
+
   /**
    * @brief Sets input type to password
    *