void DummyControlImplOverride::OnInitialize() { initializeCalled = true; }
-void DummyControlImplOverride::OnActivated() { activatedCalled = true; }
+bool DummyControlImplOverride::OnAccessibilityActivated() { activatedCalled = true; return true; }
void DummyControlImplOverride::OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change )
{
themeChangeCalled = change == StyleChange::THEME_CHANGE;
private: // From Internal::Control
virtual void OnInitialize();
- virtual void OnActivated();
+ virtual bool OnAccessibilityActivated();
virtual void OnStyleChange( Toolkit::StyleManager styleManager, StyleChange::Type change );
virtual void OnPinch(const PinchGesture& pinch);
virtual void OnPan(const PanGesture& pan);
DALI_TEST_CHECK( handle );
Property::Map attributes;
- DALI_TEST_EQUALS( false, handle.DoAction("control-activated", attributes), TEST_LOCATION );
+ DALI_TEST_EQUALS( false, handle.DoAction("accessibility-activated", attributes), TEST_LOCATION );
END_TEST;
}
bool focusedActorActivatedSignalVerified = false;
FocusedActorActivatedCallback focusedActorActivatedCallback(focusedActorActivatedSignalVerified);
- manager.FocusedActorActivatedSignal().Connect( &focusedActorActivatedCallback, &FocusedActorActivatedCallback::Callback );
+ manager.FocusedActorEnterKeySignal().Connect( &focusedActorActivatedCallback, &FocusedActorActivatedCallback::Callback );
Integration::KeyEvent returnEvent("Return", "", 0, 0, 0, Integration::KeyEvent::Up);
bool DoMoveFocus(FocusIDIter focusIDIter, bool forward, bool wrapped);
/**
- * Activate the actor. If the actor is control, call OnActivated virtual function.
+ * Activate the actor. If the actor is control, call OnAccessibilityActivated virtual function.
* This function will emit FocusedActorActivatedSignal.
* @param actor The actor to activate
*/
return mDisabledBackgroundContent;
}
- bool Button::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
+bool Button::DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
{
bool ret = false;
if( 0 == strcmp( actionName.c_str(), ACTION_BUTTON_CLICK ) )
{
- GetImplementation( button ).DoClickAction( attributes );
- ret = true;
+ ret = GetImplementation( button ).DoClickAction( attributes );
}
return ret;
}
- void Button::DoClickAction( const Property::Map& attributes )
+bool Button::DoClickAction( const Property::Map& attributes )
{
// Prevents the button signals from doing a recursive loop by sending an action
// and re-emitting the signals.
mState = ButtonDown;
OnButtonUp();
mClickActionPerforming = false;
+
+ return true;
}
+
+ return false;
}
void Button::UpdatePaintTransitionState()
self.SetKeyboardFocusable( true );
}
-void Button::OnActivated()
+bool Button::OnAccessibilityActivated()
+{
+ return OnKeyboardEnter();
+}
+
+bool Button::OnKeyboardEnter()
{
- // When the button is activated, it performs the click action
+ // When the enter key is pressed, or button is activated, the click action is performed.
Property::Map attributes;
- DoClickAction( attributes );
+ bool ret = DoClickAction( attributes );
+
+ return ret;
}
void Button::OnControlStageDisconnection()
/**
* Perform the click action to click the button.
* @param[in] attributes The attributes to perfrom this action.
+ * @return true if this control can perform action.
*/
- void DoClickAction( const Property::Map& attributes );
+ bool DoClickAction( const Property::Map& attributes );
/**
* This method is called after the button initialization.
virtual void OnInitialize();
/**
- * @copydoc Toolkit::Control::OnActivated()
+ * @copydoc Toolkit::Control::OnAccessibilityActivated()
*/
- virtual void OnActivated();
+ virtual bool OnAccessibilityActivated();
+
+ /**
+ * @copydoc Toolkit::Control::OnKeyboardEnter()
+ */
+ virtual bool OnKeyboardEnter();
/**
* Callback received when the button is disconnected from the stage.
DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboard-pre-focus-change", SIGNAL_PRE_FOCUS_CHANGE )
DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboard-focus-changed", SIGNAL_FOCUS_CHANGED )
DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboard-focus-group-changed", SIGNAL_FOCUS_GROUP_CHANGED )
-DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboard-focused-actor-activated", SIGNAL_FOCUSED_ACTOR_ACTIVATED )
+DALI_SIGNAL_REGISTRATION( Toolkit, KeyboardFocusManager, "keyboard-focused-actor-enter-key", SIGNAL_FOCUSED_ACTOR_ENTER_KEY )
DALI_TYPE_REGISTRATION_END()
return succeed;
}
-void KeyboardFocusManager::DoActivate(Actor actor)
+void KeyboardFocusManager::DoKeyboardEnter(Actor actor)
{
- if(actor)
+ if( actor )
{
- Toolkit::Control control = Toolkit::Control::DownCast(actor);
- if(control)
+ Toolkit::Control control = Toolkit::Control::DownCast( actor );
+ if( control )
{
- // Notify the control that it is activated
- GetImplementation( control ).AccessibilityActivate();
+ // Notify the control that enter has been pressed on it.
+ GetImplementation( control ).KeyboardEnter();
}
- // Send notification for the activation of focused actor
- if( !mFocusedActorActivatedSignal.Empty() )
+ // Send a notification for the actor.
+ if( !mFocusedActorEnterKeySignal.Empty() )
{
- mFocusedActorActivatedSignal.Emit(actor);
+ mFocusedActorEnterKeySignal.Emit( actor );
}
}
}
}
else
{
- // Activate the focused actor
+ // The focused actor has enter pressed on it
Actor actor;
- if(!isAccessibilityEnabled)
+ if( !isAccessibilityEnabled )
{
actor = GetCurrentFocusActor();
}
actor = accessibilityManager.GetCurrentFocusActor();
}
- if(actor)
+ if( actor )
{
- DoActivate(actor);
+ DoKeyboardEnter( actor );
}
}
return mFocusGroupChangedSignal;
}
-Toolkit::KeyboardFocusManager::FocusedActorActivatedSignalType& KeyboardFocusManager::FocusedActorActivatedSignal()
+Toolkit::KeyboardFocusManager::FocusedActorEnterKeySignalType& KeyboardFocusManager::FocusedActorEnterKeySignal()
{
- return mFocusedActorActivatedSignal;
+ return mFocusedActorEnterKeySignal;
}
bool KeyboardFocusManager::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
{
manager->FocusGroupChangedSignal().Connect( tracker, functor );
}
- else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUSED_ACTOR_ACTIVATED ) )
+ else if( 0 == strcmp( signalName.c_str(), SIGNAL_FOCUSED_ACTOR_ENTER_KEY ) )
{
- manager->FocusedActorActivatedSignal().Connect( tracker, functor );
+ manager->FocusedActorEnterKeySignal().Connect( tracker, functor );
}
else
{
Toolkit::KeyboardFocusManager::FocusGroupChangedSignalType& FocusGroupChangedSignal();
/**
- * @copydoc Toolkit::KeyboardFocusManager::FocusedActorActivatedSignal()
+ * @copydoc Toolkit::KeyboardFocusManager::FocusedActorEnterKeySignal()
*/
- Toolkit::KeyboardFocusManager::FocusedActorActivatedSignalType& FocusedActorActivatedSignal();
+ Toolkit::KeyboardFocusManager::FocusedActorEnterKeySignalType& FocusedActorEnterKeySignal();
/**
* Connects a callback function with the object's signals.
bool DoMoveFocusToNextFocusGroup(bool forward);
/**
- * Activate the actor. If the actor is control, call OnActivated virtual function.
- * This function will emit FocusedActorActivatedSignal.
- * @param actor The actor to activate
+ * Enter has been pressed on the actor. If the actor is control, call the OnKeybaordEnter virtual function.
+ * This function will emit FocusedActorEnterKeySignal.
+ * @param actor The actor to notify
*/
- void DoActivate(Actor actor);
+ void DoKeyboardEnter( Actor actor );
/**
* Create the default indicator actor to highlight the focused actor.
Toolkit::KeyboardFocusManager::PreFocusChangeSignalType mPreFocusChangeSignal; ///< The signal to notify the focus will be changed
Toolkit::KeyboardFocusManager::FocusChangedSignalType mFocusChangedSignal; ///< The signal to notify the focus change
Toolkit::KeyboardFocusManager::FocusGroupChangedSignalType mFocusGroupChangedSignal; ///< The signal to notify the focus group change
- Toolkit::KeyboardFocusManager::FocusedActorActivatedSignalType mFocusedActorActivatedSignal; ///< The signal to notify the activation of focused actor
+ Toolkit::KeyboardFocusManager::FocusedActorEnterKeySignalType mFocusedActorEnterKeySignal; ///< The signal to notify that enter has been pressed on the focused actor
unsigned int mCurrentFocusActor; ///< The actor ID of current focused actor
* @param[in] attributes The attributes with which to perfrom this action.
* @return true if action has been accepted by this control
*/
-const char* ACTION_CONTROL_ACTIVATED = "control-activated";
+const char* ACTION_ACCESSIBILITY_ACTIVATED = "accessibility-activated";
static bool DoAction( BaseObject* object, const std::string& actionName, const Property::Map& attributes )
{
bool ret = false;
- if( object && ( 0 == strcmp( actionName.c_str(), ACTION_CONTROL_ACTIVATED ) ) )
+ if( object && ( 0 == strcmp( actionName.c_str(), ACTION_ACCESSIBILITY_ACTIVATED ) ) )
{
Toolkit::Control control = Toolkit::Control::DownCast( BaseHandle( object ) );
if( control )
SignalConnectorType registerSignal6( typeRegistration, SIGNAL_PINCHED, &DoConnectSignal );
SignalConnectorType registerSignal7( typeRegistration, SIGNAL_LONG_PRESSED, &DoConnectSignal );
-TypeAction registerAction( typeRegistration, ACTION_CONTROL_ACTIVATED, &DoAction );
+TypeAction registerAction( typeRegistration, ACTION_ACCESSIBILITY_ACTIVATED, &DoAction );
DALI_TYPE_REGISTRATION_END()
OnAccessibilityActivated();
}
+void Control::KeyboardEnter()
+{
+ // Inform deriving classes
+ OnKeyboardEnter();
+}
+
bool Control::OnAccessibilityActivated()
{
return false; // Accessibility activation is not handled by default
}
+bool Control::OnKeyboardEnter()
+{
+ return false; // Keyboard enter is not handled by default
+}
+
bool Control::OnAccessibilityPan(PanGesture gesture)
{
return false; // Accessibility pan gesture is not handled by default
*/
bool IsKeyboardFocusGroup();
- // Called by Focus Manager
-
/**
- * @brief Called by the accessibility focus manager and keyboard focus manager to activate the Control
+ * @brief Called by the AccessibilityManager to activate the Control.
*/
DALI_INTERNAL void AccessibilityActivate();
+ /**
+ * @brief Called by the KeyboardFocusManager.
+ */
+ DALI_INTERNAL void KeyboardEnter();
+
// Signals
/**
*/
virtual void OnKeyboardFocusChangeCommitted( Actor commitedFocusableActor );
+ /**
+ * @brief This method is called when the control has enter pressed on it.
+ *
+ * Derived classes should override this to perform custom actions.
+ * @return true if this control supported this action.
+ */
+ virtual bool OnKeyboardEnter();
+
// Gestures
/**
* | long-pressed | @ref GetLongPressGestureDetector().DetectedSignal() |
*
* Actions
- * | %Action Name | %Control method called |
- * |-------------------|-----------------------------------------------------|
- * | control-activated | %OnActivated() |
+ * | %Action Name | %Control method called |
+ * |-------------------------|----------------------------------------------------|
+ * | accessibility-activated | %OnAccessibilityActivated() |
*/
class DALI_IMPORT_API Control : public CustomActor
{
return GetImpl(*this).FocusGroupChangedSignal();
}
-KeyboardFocusManager::FocusedActorActivatedSignalType& KeyboardFocusManager::FocusedActorActivatedSignal()
+KeyboardFocusManager::FocusedActorEnterKeySignalType& KeyboardFocusManager::FocusedActorEnterKeySignal()
{
- return GetImpl(*this).FocusedActorActivatedSignal();
+ return GetImpl(*this).FocusedActorEnterKeySignal();
}
} // namespace Toolkit
* | keyboard-pre-focus-change | @ref PreFocusChangeSignal() |
* | keyboard-focus-changed | @ref FocusChangedSignal() |
* | keyboard-focus-group-changed | @ref FocusGroupChangedSignal() |
- * | keyboard-focused-actor-activated | @ref FocusedActorActivatedSignal() |
+ * | keyboard-focused-actor-enter-key | @ref FocusedActorEnterKeySignal() |
*/
class DALI_IMPORT_API KeyboardFocusManager : public BaseHandle
{
/// @brief Focus group changed signal
typedef Signal< void ( Actor, bool ) > FocusGroupChangedSignalType;
- /// @brief Focused actor activated signal
- typedef Signal< void ( Actor ) > FocusedActorActivatedSignalType;
+ /// @brief Focused actor has the enter key pressed signal
+ typedef Signal< void ( Actor ) > FocusedActorEnterKeySignalType;
/**
* @brief Create a KeyboardFocusManager handle; this can be initialised with KeyboardFocusManager::New().
FocusGroupChangedSignalType& FocusGroupChangedSignal();
/**
- * @brief This signal is emitted when the current focused actor is activated.
+ * @brief This signal is emitted when the current focused actor has the enter key pressed on it.
*
* A callback of the following type may be connected:
* @code
- * void YourCallbackName(Actor activatedActor);
+ * void YourCallbackName(Actor enterPressedActor);
* @endcode
* @pre The Object has been initialized.
* @return The signal to connect to.
*/
- FocusedActorActivatedSignalType& FocusedActorActivatedSignal();
+ FocusedActorEnterKeySignalType& FocusedActorEnterKeySignal();
// Not intended for application developers