- ENABLE_SELECTION property is to enable or disable the text selection and clipboard.
Change-Id: Iff778b4dc414415b83d04aff8bccdc2d8f3a93a3
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
const char* const PROPERTY_NAME_LINE_COUNT = "lineCount";
const char* const PROPERTY_NAME_PLACEHOLDER_TEXT = "placeholderText";
const char* const PROPERTY_NAME_PLACEHOLDER_TEXT_COLOR = "placeholderTextColor";
+const char* const PROPERTY_NAME_ENABLE_SELECTION = "enableSelection";
const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
DALI_TEST_CHECK( editor.GetPropertyIndex( PROPERTY_NAME_LINE_COUNT) == DevelTextEditor::Property::LINE_COUNT );
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_SELECTION ) == DevelTextEditor::Property::ENABLE_SELECTION );
END_TEST;
}
editor.SetProperty( DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR, Color::RED );
DALI_TEST_EQUALS( editor.GetProperty<Vector4>( DevelTextEditor::Property::PLACEHOLDER_TEXT_COLOR ), Color::RED, TEST_LOCATION );
+ editor.SetProperty( DevelTextEditor::Property::ENABLE_SELECTION, false );
+ DALI_TEST_EQUALS( editor.GetProperty<bool>( DevelTextEditor::Property::ENABLE_SELECTION ), false, TEST_LOCATION );
+
END_TEST;
}
const char* const PROPERTY_NAME_HIDDEN_INPUT_SETTINGS = "hiddenInputSettings";
const char* const PROPERTY_NAME_PIXEL_SIZE = "pixelSize";
+const char* const PROPERTY_NAME_ENABLE_SELECTION = "enableSelection";
const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_INPUT_OUTLINE ) == TextField::Property::INPUT_OUTLINE );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_HIDDEN_INPUT_SETTINGS ) == DevelTextField::Property::HIDDEN_INPUT_SETTINGS );
DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_PIXEL_SIZE ) == DevelTextField::Property::PIXEL_SIZE );
+ DALI_TEST_CHECK( field.GetPropertyIndex( PROPERTY_NAME_ENABLE_SELECTION ) == DevelTextField::Property::ENABLE_SELECTION );
END_TEST;
}
field.SetProperty( DevelTextField::Property::PIXEL_SIZE, 20.f );
DALI_TEST_EQUALS( field.GetProperty<float>( DevelTextField::Property::PIXEL_SIZE ), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ field.SetProperty( DevelTextField::Property::ENABLE_SELECTION, false );
+ DALI_TEST_EQUALS( field.GetProperty<bool>( DevelTextField::Property::ENABLE_SELECTION ), false, TEST_LOCATION );
+
END_TEST;
}
* @brief The placeholder-text color.
* @details name "placeholderTextColor", type vector4
*/
- PLACEHOLDER_TEXT_COLOR
+ PLACEHOLDER_TEXT_COLOR,
+
+ /**
+ * @brief Enables Text selection, such as the cursor, handle, clipboard, and highlight color.
+ * @details name "enableSelection", type bool
+ */
+ ENABLE_SELECTION
};
} // namespace Property
* @details name "pixelSize", type float
*/
PIXEL_SIZE = INPUT_OUTLINE + 2,
+
+ /**
+ * @brief Enables Text selection, such as the cursor, handle, clipboard, and highlight color.
+ * @details name "enableSelection", type bool
+ */
+ ENABLE_SELECTION = INPUT_OUTLINE + 3
};
} // namespace Property
DALI_DEVEL_PROPERTY_REGISTRATION_READ_ONLY( Toolkit, TextEditor, "lineCount", INTEGER, LINE_COUNT )
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, "enableSelection", BOOLEAN, ENABLE_SELECTION )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, TextEditor, "inputStyleChanged", SIGNAL_INPUT_STYLE_CHANGED )
}
break;
}
+ case Toolkit::DevelTextEditor::Property::ENABLE_SELECTION:
+ {
+ if( impl.mController )
+ {
+ const bool enableSelection = value.Get< bool >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextEditor %p ENABLE_SELECTION %d\n", impl.mController.Get(), enableSelection );
+ impl.mController->SetSelectionEnabled( enableSelection );
+ }
+ break;
+ }
} // switch
} // texteditor
}
}
break;
}
+ case Toolkit::DevelTextEditor::Property::ENABLE_SELECTION:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->IsSelectionEnabled();
+ }
+ break;
+ }
} //switch
}
DALI_PROPERTY_REGISTRATION( Toolkit, TextField, "inputOutline", MAP, INPUT_OUTLINE )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "hiddenInputSettings", MAP, HIDDEN_INPUT_SETTINGS )
DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "pixelSize", FLOAT, PIXEL_SIZE )
+DALI_DEVEL_PROPERTY_REGISTRATION( Toolkit, TextField, "enableSelection", BOOLEAN, ENABLE_SELECTION )
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "textChanged", SIGNAL_TEXT_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, TextField, "maxLengthReached", SIGNAL_MAX_LENGTH_REACHED )
}
break;
}
+ case Toolkit::DevelTextField::Property::ENABLE_SELECTION:
+ {
+ if( impl.mController )
+ {
+ const bool enableSelection = value.Get< bool >();
+ DALI_LOG_INFO( gLogFilter, Debug::General, "TextField %p ENABLE_SELECTION %d\n", impl.mController.Get(), enableSelection );
+ impl.mController->SetSelectionEnabled( enableSelection );
+ }
+ break;
+ }
} // switch
} // textfield
}
}
break;
}
+ case Toolkit::DevelTextField::Property::ENABLE_SELECTION:
+ {
+ if( impl.mController )
+ {
+ value = impl.mController->IsSelectionEnabled();
+ }
+ break;
+ }
} //switch
}
return mImpl->mModel->mElideEnabled;
}
+void Controller::SetSelectionEnabled( bool enabled )
+{
+ mImpl->mEventData->mSelectionEnabled = enabled;
+}
+
+bool Controller::IsSelectionEnabled() const
+{
+ return mImpl->mEventData->mSelectionEnabled;
+}
+
// public : Update
void Controller::SetText( const std::string& text )
bool IsTextElideEnabled() const;
/**
+ * @brief Enable or disable the text selection.
+ * @param[in] enabled Whether to enable the text selection.
+ */
+ void SetSelectionEnabled( bool enabled );
+
+ /**
+ * @brief Whether the text selection is enabled or not.
+ * @return True if the text selection is enabled
+ */
+ bool IsSelectionEnabled() const;
+
+ /**
* @brief Sets input type to password
*
* @note The string is displayed hidden character
"selectionHighlightColor":[0.75,0.96,1.0,1.0],
"grabHandleImage" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png",
"selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
- "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
+ "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" },
+ "enableSelection":false
},
"TextFieldFontSize0":
"selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" },
"enableScrollBar":true,
"scrollBarShowDuration":0.8,
- "scrollBarFadeDuration":0.5
+ "scrollBarFadeDuration":0.5,
+ "enableSelection":false
},
"ProgressBar":
{
"selectionHighlightColor":[0.75,0.96,1.0,1.0],
"grabHandleImage" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png",
"selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
- "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
+ "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" },
+ "enableSelection":true
},
"TextFieldFontSize0":
"selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" },
"enableScrollBar":true,
"scrollBarShowDuration":0.8,
- "scrollBarFadeDuration":0.5
+ "scrollBarFadeDuration":0.5,
+ "enableSelection":true
},
"Popup":
{
"selectionHighlightColor":[0.75,0.96,1.0,1.0],
"grabHandleImage" : "{DALI_STYLE_IMAGE_DIR}cursor_handler_drop_center.png",
"selectionHandleImageLeft" : {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_left.png" },
- "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" }
+ "selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" },
+ "enableSelection":true
},
"TextFieldFontSize0":
"selectionHandleImageRight": {"filename":"{DALI_STYLE_IMAGE_DIR}selection_handle_drop_right.png" },
"enableScrollBar":true,
"scrollBarShowDuration":0.8,
- "scrollBarFadeDuration":0.5
+ "scrollBarFadeDuration":0.5,
+ "enableSelection":true
},
"Popup":
{