Integration::KeyEvent returnEvent("Return", "", 0, 0, 0, Integration::KeyEvent::Up);
+ // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager
+ // It makes mIsFocusIndicatorEnabled true
+ application.ProcessEvent(returnEvent);
+
// Create the first button and add it to the stage
PushButton firstPushButton = PushButton::New();
firstPushButton.SetKeyboardFocusable(true);
Integration::KeyEvent tabEvent("Tab", "", 0, 0, 0, Integration::KeyEvent::Down);
Integration::KeyEvent shiftTabEvent("Tab", "", 0, 1, 0, Integration::KeyEvent::Down);
+ // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager
+ // It makes mIsFocusIndicatorEnabled true
+ application.ProcessEvent(tabEvent);
+
// Send the tab event to change focus group in the forward direction
application.ProcessEvent(tabEvent);
DALI_TEST_CHECK(focusGroupChangedCallback.mSignalVerified);
Integration::KeyEvent pageUpEvent("Prior", "", 0, 0, 0, Integration::KeyEvent::Down);
Integration::KeyEvent pageDownEvent("Next", "", 0, 0, 0, Integration::KeyEvent::Down);
+ // Press Any key to notice physical keyboard event is comming to KeyboardFocusManager
+ // It makes mIsFocusIndicatorEnabled true
+ application.ProcessEvent(leftEvent);
+
// Create a 2x2 table view and try to move focus inside it
TableView tableView = TableView::New( 2, 2 );
Stage::GetCurrent().Add(tableView);
using namespace Dali;
using namespace Toolkit;
+namespace
+{
+
+const char* TEST_IMAGE_FILE_NAME = "selection-popup-border.9.png";
+
+}
+
void dali_textselectionpopup_startup(void)
{
test_return_value = TET_UNDEF;
END_TEST;
}
+int UtcDaliToolkitTextSelectionPopupBackgroundBorderP(void)
+{
+ ToolkitTestApplication application;
+ TextSelectionPopup textSelectionPopup;
+ textSelectionPopup = TextSelectionPopup::New( NULL );
+
+ textSelectionPopup.SetProperty( TextSelectionPopup::Property::BACKGROUND_BORDER,
+ Property::Map().Add( ImageVisual::Property::URL, TEST_IMAGE_FILE_NAME ) );
+
+ Property::Value value = textSelectionPopup.GetProperty( TextSelectionPopup::Property::BACKGROUND_BORDER );
+
+ Property::Map map;
+ value.Get( map );
+
+ Property::Value* returnValue = map.Find( Dali::Toolkit::ImageVisual::Property::URL );
+ DALI_TEST_CHECK( NULL != returnValue );
+
+ if( returnValue )
+ {
+ std::string url;
+ returnValue->Get( url );
+ DALI_TEST_EQUALS( TEST_IMAGE_FILE_NAME, url, TEST_LOCATION );
+ }
+
+ END_TEST;
+}
+
// TextSelectionToolBar is used TextSelectionPopup, below tests it individually
int UtcDaliToolkitTextSelectionToolBarP(void)
{
enum
{
- POPUP_MAX_SIZE = PROPERTY_START_INDEX, ///< name "popupMaxSize", maximum size the Popup can be, type VECTOR2
- POPUP_MIN_SIZE, ///< name "popupMinSize", minimum size the Popup can be, type VECTOR2
- OPTION_MAX_SIZE, ///< name "optionMaxSize", maximum size an option can be, type VECTOR2
- OPTION_MIN_SIZE, ///< name "optionMinSize", minimum size an option can be, type VECTOR2
- OPTION_DIVIDER_SIZE, ///< name "optionDividerSize", size of the divider between options type VECTOR2
- POPUP_CLIPBOARD_BUTTON_ICON_IMAGE, ///< name "popupClipboardButtonImage", The image to use as the popup clipboard icon, type STRING
- POPUP_CUT_BUTTON_ICON_IMAGE, ///< name "popupCutButtonImage", The image to use as the popup cut icon, type STRING
- POPUP_COPY_BUTTON_ICON_IMAGE, ///< name "popupCopyButtonImage", The image to use as the popup copy icon, type STRING
- POPUP_PASTE_BUTTON_ICON_IMAGE, ///< name "popupPasteButtonImage", The image to use as the popup paste icon, type STRING
- POPUP_SELECT_BUTTON_ICON_IMAGE, ///< name "popupSelectButtonImage", The image to use as the popup select icon, type STRING
- POPUP_SELECT_ALL_BUTTON_ICON_IMAGE, ///< name "popupSelectAllButtonImage", The image to use as the popup select all icon, type STRING
- POPUP_DIVIDER_COLOR, ///< name "popupDividerColor", The color of the divider between options, type VECTOR4
- POPUP_ICON_COLOR, ///< name "popupIconColor", The color of the icons (if supplied), type VECTOR4
- POPUP_PRESSED_COLOR, ///< name "popupPressedColor", The color of the option when pressed, type VECTOR4
- POPUP_PRESSED_IMAGE, ///< name "popupPressedImage", The image to use for the option when pressed, type STRING
- POPUP_FADE_IN_DURATION, ///< name "popupFadeInDuration", The duration of the fade-in animation, type FLOAT
- POPUP_FADE_OUT_DURATION, ///< name "popupFadeOutDuration", The duration of the fade-out animation, type FLOAT
+ /**
+ * @brief The maximum size the Popup can be.
+ * @details Name "popupMaxSize", type Vector2.
+ */
+ POPUP_MAX_SIZE = PROPERTY_START_INDEX,
+
+ /**
+ * @brief The minimum size the Popup can be.
+ * @details Name "popupMinSize", type Vector2.
+ */
+ POPUP_MIN_SIZE,
+
+ /**
+ * @brief The maximum size an option can be.
+ * @details Name "optionMaxSize", type Vector2.
+ */
+ OPTION_MAX_SIZE,
+
+ /**
+ * @brief The minimum size an option can be.
+ * @details Name "optionMinSize", type Vector2.
+ */
+ OPTION_MIN_SIZE,
+
+ /**
+ * @brief The size of the divider between options.
+ * @details Name "optionDividerSize", type Vector2.
+ */
+ OPTION_DIVIDER_SIZE,
+
+ /**
+ * @brief The image to use as the popup clipboard icon.
+ * @details Name "popupClipboardButtonImage", type string.
+ */
+ POPUP_CLIPBOARD_BUTTON_ICON_IMAGE,
+
+ /**
+ * @brief The image to use as the popup cut icon.
+ * @details Name "popupCutButtonImage", type string.
+ */
+ POPUP_CUT_BUTTON_ICON_IMAGE,
+
+ /**
+ * @brief The image to use as the popup copy icon.
+ * @details Name "popupCopyButtonImage", type string.
+ */
+ POPUP_COPY_BUTTON_ICON_IMAGE,
+
+ /**
+ * @brief The image to use as the popup paste icon.
+ * @details Name "popupPasteButtonImage", type string.
+ */
+ POPUP_PASTE_BUTTON_ICON_IMAGE,
+
+ /**
+ * @brief The image to use as the popup select icon.
+ * @details Name "popupSelectButtonImage", type string.
+ */
+ POPUP_SELECT_BUTTON_ICON_IMAGE,
+
+ /**
+ * @brief The image to use as the popup select all icon.
+ * @details Name "popupSelectAllButtonImage", type string.
+ */
+ POPUP_SELECT_ALL_BUTTON_ICON_IMAGE,
+
+ /**
+ * @brief The color of the divider between options.
+ * @details Name "popupDividerColor", type Vector4.
+ */
+ POPUP_DIVIDER_COLOR,
+
+ /**
+ * @brief The color of the icons (if supplied).
+ * @details Name "popupIconColor", type Vector4.
+ */
+ POPUP_ICON_COLOR,
+
+ /**
+ * @brief The color of the option when pressed.
+ * @details Name "popupPressedColor", type Vector4.
+ */
+ POPUP_PRESSED_COLOR,
+
+ /**
+ * @brief The image to use for the option when pressed.
+ * @details Name "popupPressedImage", type string.
+ */
+ POPUP_PRESSED_IMAGE,
+
+ /**
+ * @brief The duration of the fade-in animation.
+ * @details Name "popupFadeInDuration", type float.
+ */
+ POPUP_FADE_IN_DURATION,
+
+ /**
+ * @brief The duration of the fade-out animation.
+ * @details Name "popupFadeOutDuration", type float.
+ */
+ POPUP_FADE_OUT_DURATION,
+
+ /**
+ * @brief The popup background can have a separate border with a different color.
+ * @details Name "backgroundBorder", type Property::Map.
+ * @note Optional.
+ */
+ BACKGROUND_BORDER
};
};
mScrollAnimation.AnimateTo( Property(self, Toolkit::ItemView::Property::SCROLL_SPEED), 0.0f, AlphaFunction::EASE_OUT );
mIsFlicking = true;
+
// Check whether it has already scrolled to the end
- if(fabs(currentLayoutPosition - firstItemScrollPosition) > Math::MACHINE_EPSILON_0)
+ if( fabs(currentLayoutPosition - firstItemScrollPosition) < Math::MACHINE_EPSILON_0 )
{
- AnimateScrollOvershoot(0.0f);
+ AnimateScrollOvershoot( 0.0f );
+ RemoveAnimation( mScrollAnimation );
}
}
#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup-callback-interface.h>
#include <dali-toolkit/devel-api/visuals/text-visual-properties.h>
#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
+#include <dali-toolkit/internal/helpers/color-conversion.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
namespace Dali
{
namespace
{
-// todo Move this to adaptor??
+
#define GET_LOCALE_TEXT(string) dgettext("dali-toolkit", string)
const std::string TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME( "TextSelectionPopupButton" );
DALI_PROPERTY_REGISTRATION( Toolkit, TextSelectionPopup, "popupPressedImage", STRING, POPUP_PRESSED_IMAGE )
DALI_PROPERTY_REGISTRATION( Toolkit, TextSelectionPopup, "popupFadeInDuration", FLOAT, POPUP_FADE_IN_DURATION )
DALI_PROPERTY_REGISTRATION( Toolkit, TextSelectionPopup, "popupFadeOutDuration", FLOAT, POPUP_FADE_OUT_DURATION )
+DALI_PROPERTY_REGISTRATION( Toolkit, TextSelectionPopup, "backgroundBorder", MAP, BACKGROUND_BORDER )
DALI_TYPE_REGISTRATION_END()
impl.mFadeOutDuration = value.Get < float >();
break;
}
+ case Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER:
+ {
+ Property::Map map = value.Get<Property::Map>();
+ impl.CreateBackgroundBorder( map );
+ break;
+ }
} // switch
} // TextSelectionPopup
}
value = impl.mFadeOutDuration;
break;
}
+ case Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER:
+ {
+ Property::Map map;
+ Toolkit::Visual::Base visual = impl.GetVisual( Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER );
+ if( visual )
+ {
+ visual.CreatePropertyMap( map );
+ }
+ value = map;
+ break;
+ }
} // switch
}
return value;
}
}
+void TextSelectionPopup::CreateBackgroundBorder( Property::Map& propertyMap )
+{
+ // Removes previous image if necessary
+ UnregisterVisual( Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER );
+
+ if( ! propertyMap.Empty() )
+ {
+ Toolkit::Visual::Base visual = Toolkit::VisualFactory::Get().CreateVisual( propertyMap );
+
+ if( visual )
+ {
+ RegisterVisual( Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER, visual );
+ visual.SetDepthIndex( DepthIndex::CONTENT );
+ }
+ }
+}
+
TextSelectionPopup::TextSelectionPopup( TextSelectionPopupCallbackInterface* callbackInterface )
: Control( ControlBehaviour( CONTROL_BEHAVIOUR_DEFAULT ) ),
mToolbar(),
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/control-impl.h>
#include <dali-toolkit/public-api/controls/buttons/push-button.h>
+#include <dali-toolkit/public-api/controls/image-view/image-view.h>
#include <dali-toolkit/public-api/controls/table-view/table-view.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-selection-popup.h>
#include <dali-toolkit/devel-api/controls/text-controls/text-selection-toolbar.h>
// EXTERNAL INCLUDES
#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/object/property-map.h>
namespace Dali
{
void AddPopupOptionsToToolbar( bool showIcons, bool showCaptions );
/**
+ * Creates the background-border image
+ *
+ * @param[in] propertyMap The properties describing the background-border
+ */
+ void CreateBackgroundBorder( Property::Map& propertyMap );
+
+ /**
* Construct a new TextField.
*/
TextSelectionPopup( TextSelectionPopupCallbackInterface* callbackInterface );
mCurrentFocusActor( 0 ),
mFocusIndicatorActor(),
mFocusGroupLoopEnabled( false ),
- mIsKeyboardFocusEnabled( false ),
mIsFocusIndicatorEnabled( false ),
mIsWaitingKeyboardFocusChangeCommit( false ),
mFocusHistory(),
mSlotDelegate( this )
{
- OnPhysicalKeyboardStatusChanged(PhysicalKeyboard::Get());
-
+ // TODO: Get FocusIndicatorEnable constant from stylesheet to set mIsFocusIndicatorEnabled.
Toolkit::KeyInputFocusManager::Get().UnhandledKeyEventSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnKeyEvent);
Stage::GetCurrent().TouchSignal().Connect( mSlotDelegate, &KeyboardFocusManager::OnTouch );
- PhysicalKeyboard::Get().StatusChangedSignal().Connect(mSlotDelegate, &KeyboardFocusManager::OnPhysicalKeyboardStatusChanged);
}
KeyboardFocusManager::~KeyboardFocusManager()
// Check whether the actor is in the stage and is keyboard focusable.
if( actor && actor.IsKeyboardFocusable() )
{
- mIsFocusIndicatorEnabled = true;
- // Draw the focus indicator upon the focused actor when PhysicalKeyboard is attached
- if( mIsKeyboardFocusEnabled )
+ if( mIsFocusIndicatorEnabled )
{
actor.Add( GetFocusIndicatorActor() );
}
return mFocusIndicatorActor;
}
-void KeyboardFocusManager::OnPhysicalKeyboardStatusChanged(PhysicalKeyboard keyboard)
-{
- mIsKeyboardFocusEnabled = keyboard.IsAttached();
-
- if(mIsKeyboardFocusEnabled)
- {
- // Show indicator when keyboard focus turned on if there is focused actor.
- Actor actor = GetCurrentFocusActor();
- if(actor)
- {
- actor.Add( GetFocusIndicatorActor() );
- }
- mIsFocusIndicatorEnabled = true;
- }
- else
- {
- // Hide indicator when keyboard focus turned off
- Actor actor = GetCurrentFocusActor();
- if( actor && mFocusIndicatorActor )
- {
- actor.Remove( mFocusIndicatorActor );
- }
- mIsFocusIndicatorEnabled = false;
- }
-}
-
void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event)
{
- if(!mIsKeyboardFocusEnabled)
- {
- return;
- }
-
AccessibilityAdaptor accessibilityAdaptor = AccessibilityAdaptor::Get();
bool isAccessibilityEnabled = accessibilityAdaptor.IsEnabled();
*/
// EXTERNAL INCLUDES
-#include <string>
-#include <dali/devel-api/adaptor-framework/physical-keyboard.h>
#include <dali/public-api/object/base-object.h>
// INTERNAL INCLUDES
*/
void OnTouch( const TouchData& touch );
- /**
- * Change the keyboard focus status when keyboard focus feature turned on or off.
- * @return Whether the status is changed or not.
- */
- void OnPhysicalKeyboardStatusChanged(PhysicalKeyboard keyboard);
-
private:
// Undefined
bool mFocusGroupLoopEnabled:1; ///< Whether the focus movement is looped within the same focus group
- bool mIsKeyboardFocusEnabled:1; ///< Whether keyboard focus feature turned on/off
-
bool mIsFocusIndicatorEnabled:1; ///< Whether indicator should be shown / hidden. It could be enabled when keyboard focus feature enabled and navigation keys or 'Tab' key pressed.
bool mIsWaitingKeyboardFocusChangeCommit:1; /// A flag to indicate PreFocusChangeSignal emitted but the proposed focus actor is not commited by the application yet.
"popupPressedColor":[0.24,0.72,0.8,0.11],
"background": {
"rendererType": "image",
- "url": "{DALI_IMAGE_DIR}selection-popup-bg.9.png"
+ "url": "{DALI_IMAGE_DIR}selection-popup-background.9.png"
+ },
+ "backgroundBorder": {
+ "visualType": "IMAGE",
+ "url": "{DALI_IMAGE_DIR}selection-popup-border.9.png",
+ "mixColor":[0.24,0.72,0.8,1.0]
},
"popupFadeInDuration":0.25,
"popupFadeOutDuration":0.25
"popupPressedColor":[0.24,0.72,0.8,0.11],
"background": {
"visualType": "IMAGE",
- "url": "{DALI_IMAGE_DIR}selection-popup-bg.9.png"
+ "url": "{DALI_IMAGE_DIR}selection-popup-background.9.png"
+ },
+ "backgroundBorder": {
+ "visualType": "IMAGE",
+ "url": "{DALI_IMAGE_DIR}selection-popup-border.9.png",
+ "mixColor":[0.24,0.72,0.8,1.0]
},
"popupFadeInDuration":0.25,
"popupFadeOutDuration":0.25
"popupPressedColor":[0.24,0.72,0.8,0.11],
"background": {
"visualType": "IMAGE",
- "url": "{DALI_IMAGE_DIR}selection-popup-bg.9.png"
+ "url": "{DALI_IMAGE_DIR}selection-popup-background.9.png"
+ },
+ "backgroundBorder": {
+ "visualType": "IMAGE",
+ "url": "{DALI_IMAGE_DIR}selection-popup-border.9.png",
+ "mixColor":[0.24,0.72,0.8,1.0]
},
"popupFadeInDuration":0.25,
"popupFadeOutDuration":0.25