X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fbuttons%2Fbutton-impl.cpp;h=b696a5255c38f223a31553bbd936424333c8fe9e;hb=refs%2Fchanges%2F48%2F245348%2F9;hp=0305e8a3c85dc64af40135ebbcd8a044c1b665d4;hpb=2b051f9220d4e28225a57d5dabc98e093357cad6;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/buttons/button-impl.cpp b/dali-toolkit/internal/controls/buttons/button-impl.cpp index 0305e8a3..b696a52 100644 --- a/dali-toolkit/internal/controls/buttons/button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/button-impl.cpp @@ -22,7 +22,7 @@ #include // for strcmp #include #include -#include +#include #include #include #include @@ -379,7 +379,7 @@ void Button::CreateVisualsForComponent( Property::Index index, const Property::V else { // if its not a string then get a Property::Map from the property if possible. - Property::Map *map = value.GetMap(); + const Property::Map *map = value.GetMap(); if( map && !map->Empty() ) // Empty map results in current visual removal. { DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "CreateVisualsForComponent Using Map(%d)\n", index ); @@ -619,8 +619,9 @@ void Button::OnInitialize() mTapDetector.DetectedSignal().Connect(this, &Button::OnTap); self.SetProperty( Actor::Property::KEYBOARD_FOCUSABLE, true ); + self.SetProperty( Toolkit::DevelControl::Property::ACCESSIBILITY_HIGHLIGHTABLE, true ); - self.TouchSignal().Connect( this, &Button::OnTouch ); + self.TouchedSignal().Connect( this, &Button::OnTouch ); } bool Button::OnAccessibilityActivated() @@ -628,13 +629,9 @@ bool Button::OnAccessibilityActivated() return OnKeyboardEnter(); } -bool Button::OnTouch( Actor actor, const TouchData& touch ) +bool Button::OnTouch( Actor actor, const TouchEvent& touch ) { - - // Only events are processed when the button is not disabled - auto result( false ); - - if( !IsDisabled() ) + if( !IsDisabled() && (actor == touch.GetHitActor(0)) ) { if ( 1 == touch.GetPointCount() ) { @@ -675,9 +672,8 @@ bool Button::OnTouch( Actor actor, const TouchData& touch ) // Sets the button state to the default mButtonPressedState = UNPRESSED; } - result = true; } - return result; + return false; } bool Button::OnKeyboardEnter() @@ -689,7 +685,7 @@ bool Button::OnKeyboardEnter() return ret; } -void Button::OnStageDisconnection() +void Button::OnSceneDisconnection() { if( DEPRESSED == mButtonPressedState ) { @@ -706,18 +702,18 @@ void Button::OnStageDisconnection() mButtonPressedState = UNPRESSED; - Control::OnStageDisconnection(); // Visuals will be set off stage + Control::OnSceneDisconnection(); // Visuals will be set off stage } -void Button::OnStageConnection( int depth ) +void Button::OnSceneConnection( int depth ) { - DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::OnStageConnection ptr(%p) \n", this ); + DALI_LOG_INFO( gLogButtonFilter, Debug::Verbose, "Button::OnSceneConnection ptr(%p) \n", this ); OnButtonVisualRemoval( VISUAL_INDEX_FOR_STATE[ mPreviousButtonState ][ BACKGROUND ] ); OnButtonVisualRemoval( VISUAL_INDEX_FOR_STATE[ mPreviousButtonState ][ FOREGROUND ] ); SelectRequiredVisual( Toolkit::Button::Property::LABEL ); SelectRequiredVisual( VISUAL_INDEX_FOR_STATE[ mButtonState ][ BACKGROUND ] ); SelectRequiredVisual( VISUAL_INDEX_FOR_STATE[ mButtonState ][ FOREGROUND ] ); - Control::OnStageConnection( depth ); // Enabled visuals will be put on stage + Control::OnSceneConnection( depth ); // Enabled visuals will be put on stage RelayoutRequest(); } @@ -1156,11 +1152,11 @@ void Button::SetProperty( BaseObject* object, Property::Index index, const Prope else { // Get a Property::Map from the property if possible. - Property::Map* setPropertyMap = value.GetMap(); + const Property::Map* setPropertyMap = value.GetMap(); if( setPropertyMap ) { - TextVisual::ConvertStringKeysToIndexKeys( *setPropertyMap ); - GetImplementation( button ).MergeWithExistingLabelProperties( *setPropertyMap, outTextVisualProperties ); + Property::Map indexKeys = TextVisual::ConvertStringKeysToIndexKeys( *setPropertyMap ); + GetImplementation( button ).MergeWithExistingLabelProperties( indexKeys, outTextVisualProperties ); } } @@ -1318,6 +1314,43 @@ Padding Button::GetForegroundPadding() return mForegroundPadding; } +std::string Button::AccessibleImpl::GetNameRaw() +{ + std::string labelText; + auto slf = Toolkit::Button::DownCast( self ); + Property::Map labelMap = slf.GetProperty( Toolkit::Button::Property::LABEL ); + + Property::Value* textPropertyPtr = labelMap.Find( Toolkit::TextVisual::Property::TEXT ); + if ( textPropertyPtr ) + { + textPropertyPtr->Get( labelText ); + } + + return labelText; +} + + +Property::Index Button::AccessibleImpl::GetNamePropertyIndex() +{ + Property::Index label = Toolkit::Button::Property::LABEL; + Property::Map labelMap = self.GetProperty(label); + + if (MapContainsTextString(labelMap)) + return label; + else + return Property::INVALID_INDEX; +} + +Dali::Accessibility::States Button::AccessibleImpl::CalculateStates() +{ + auto tmp = Control::Impl::AccessibleImpl::CalculateStates(); + tmp[Dali::Accessibility::State::SELECTABLE] = true; + auto slf = Toolkit::Button::DownCast( self ); + tmp[Dali::Accessibility::State::ENABLED] = !slf.GetProperty( Toolkit::Button::Property::DISABLED ); + tmp[Dali::Accessibility::State::CHECKED] = slf.GetProperty( Toolkit::Button::Property::SELECTED ); + return tmp; +} + } // namespace Internal } // namespace Toolkit