#include <dali-toolkit/internal/controls/popup/popup-impl.h>
// EXTERNAL INCLUDES
+#include <cstring> // for strcmp
#include <dali/public-api/adaptor-framework/key.h>
-#include <dali/public-api/adaptor-framework/physical-keyboard.h>
+#include <dali/devel-api/adaptor-framework/physical-keyboard.h>
#include <dali/public-api/animation/constraints.h>
#include <dali/public-api/common/stage.h>
#include <dali/public-api/events/key-event.h>
#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/object/type-registry.h>
-#include <dali/public-api/object/type-registry-helper.h>
+#include <dali/devel-api/object/type-registry-helper.h>
#include <dali/public-api/size-negotiation/relayout-container.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/buttons/button.h>
#include <dali-toolkit/public-api/controls/control-impl.h>
+#include <dali-toolkit/public-api/controls/control-depth-index-ranges.h>
#include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
-#include <dali-toolkit/public-api/focus-manager/focus-manager.h>
+#include <dali-toolkit/public-api/accessibility-manager/accessibility-manager.h>
#include <dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.h>
+#include <dali-toolkit/internal/controls/buttons/button-impl.h>
using namespace Dali;
// Setup properties, signals and actions using the type-registry.
DALI_TYPE_REGISTRATION_BEGIN( Toolkit::Popup, Toolkit::Control, Create )
-DALI_SIGNAL_REGISTRATION( Popup, "touched-outside", SIGNAL_TOUCHED_OUTSIDE )
-DALI_SIGNAL_REGISTRATION( Popup, "hidden", SIGNAL_HIDDEN )
+DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "touched-outside", SIGNAL_TOUCHED_OUTSIDE )
+DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "hidden", SIGNAL_HIDDEN )
DALI_TYPE_REGISTRATION_END()
// Create Layer
mLayer = Layer::New();
mLayer.SetName( "POPUP_LAYER" );
+ mLayer.SetDepthTestDisabled( true );
mLayer.SetParentOrigin(ParentOrigin::CENTER);
mLayer.SetAnchorPoint(AnchorPoint::CENTER);
mLayer.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
- mLayer.SetDrawMode( DrawMode::OVERLAY );
// Any content after this point which is added to Self() will be reparented to
// mContent.
SetAsKeyboardFocusGroup(true);
}
-void Popup::MarkDirtyForRelayout()
-{
- // Flag all the popup controls for relayout as it is about to be hidden and miss the main flagging pass
- mLayer.RelayoutRequestTree();
-}
-
void Popup::OnPropertySet( Property::Index index, Property::Value propertyValue )
{
if( index == mPropertyTitle )
mBackgroundImage.SetAnchorPoint( AnchorPoint::CENTER );
mBackgroundImage.SetParentOrigin( ParentOrigin::CENTER );
+ if ( ImageActor imageActor = DownCast< ImageActor >( image ) )
+ {
+ imageActor.SetSortModifier( BACKGROUND_DEPTH_INDEX );
+ }
+
Vector3 border( mPopupStyle->backgroundOuterBorder.x, mPopupStyle->backgroundOuterBorder.z, 0.0f );
mBackgroundImage.SetSizeModeFactor( border );
// Adds new area image to the dialog.
mButtonAreaImage = image;
+ if ( ImageActor imageActor = DownCast< ImageActor >( image ) )
+ {
+ imageActor.SetSortModifier( BACKGROUND_DEPTH_INDEX + 1 );
+ }
+
// OnDialogTouched only consume the event. It prevents the touch event to be caught by the backing.
mButtonAreaImage.TouchedSignal().Connect( this, &Popup::OnDialogTouched );
// Adds bottom background
mBottomBg = Actor::New();
mBottomBg.SetName( "POPUP_BOTTOM_BG" );
- mBottomBg.SetRelayoutEnabled( true );
mBottomBg.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mPopupLayout.SetFixedHeight( 2, mPopupStyle->bottomSize.height ); // Buttons
{
mBacking = Dali::Toolkit::CreateSolidColorActor( mPopupStyle->backingColor );
mBacking.SetName( "POPUP_BACKING" );
-
+ mBacking.SetSortModifier( BACKGROUND_DEPTH_INDEX - 1 );
mBacking.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
mBacking.SetSensitive(true);
mLayer.Add( mBacking );
mBacking.SetOpacity(0.0f);
mBacking.TouchedSignal().Connect( this, &Popup::OnBackingTouched );
- mBacking.MouseWheelEventSignal().Connect(this, &Popup::OnBackingMouseWheelEvent);
+ mBacking.WheelEventSignal().Connect(this, &Popup::OnBackingWheelEvent);
}
void Popup::CreateDialog()
if(mShowing)
{
- mAnimation.AnimateTo( Property(mBacking, Actor::Property::COLOR_ALPHA), targetBackingAlpha, AlphaFunctions::EaseInOut, TimePeriod(0.0f, duration * 0.5f) );
- mAnimation.AnimateTo( Property(self, Actor::Property::SCALE), targetSize, AlphaFunctions::EaseInOut, TimePeriod(duration * 0.5f, duration * 0.5f) );
+ mAnimation.AnimateTo( Property(mBacking, Actor::Property::COLOR_ALPHA), targetBackingAlpha, AlphaFunction::EASE_IN_OUT, TimePeriod(0.0f, duration * 0.5f) );
+ mAnimation.AnimateTo( Property(self, Actor::Property::SCALE), targetSize, AlphaFunction::EASE_IN_OUT, TimePeriod(duration * 0.5f, duration * 0.5f) );
}
else
{
- mAnimation.AnimateTo( Property(mBacking, Actor::Property::COLOR_ALPHA), targetBackingAlpha, AlphaFunctions::EaseInOut, TimePeriod(0.0f, duration * 0.5f) );
- mAnimation.AnimateTo( Property(self, Actor::Property::SCALE), targetSize, AlphaFunctions::EaseInOut, TimePeriod(0.0f, duration * 0.5f) );
+ mAnimation.AnimateTo( Property(mBacking, Actor::Property::COLOR_ALPHA), targetBackingAlpha, AlphaFunction::EASE_IN_OUT, TimePeriod(0.0f, duration * 0.5f) );
+ mAnimation.AnimateTo( Property(self, Actor::Property::SCALE), targetSize, AlphaFunction::EASE_IN_OUT, TimePeriod(0.0f, duration * 0.5f) );
}
mAnimation.Play();
mAnimation.FinishedSignal().Connect(this, &Popup::OnStateAnimationFinished);
return true;
}
-bool Popup::OnBackingMouseWheelEvent(Actor actor, const MouseWheelEvent& event)
+bool Popup::OnBackingWheelEvent(Actor actor, const WheelEvent& event)
{
- // consume mouse wheel event in dimmed backing actor
+ // consume wheel event in dimmed backing actor
return true;
}
mBackgroundImage.SetVisible( !( mButtons.empty() && mPopupLayout.GetChildCount() == 0 ) );
// Relayout All buttons
- if ( !mButtons.empty() )
+ if( !mButtons.empty() )
{
// All buttons should be the same size and fill the button area. The button spacing needs to be accounted for as well.
Vector2 buttonSize( ( ( size.width - mPopupStyle->buttonSpacing * ( mButtons.size() + 1 ) ) / mButtons.size() ),
Vector3 buttonPosition( mPopupStyle->buttonSpacing, 0.0f, 0.0f );
- for ( ActorIter iter = mButtons.begin(), endIter = mButtons.end();
+ for( std::vector< Actor >::iterator iter = mButtons.begin(), endIter = mButtons.end();
iter != endIter;
++iter, buttonPosition.x += mPopupStyle->buttonSpacing + buttonSize.width )
{
button.SetPosition( buttonPosition );
- button.PropagateRelayoutFlags(); // Reset relayout flags for relayout
- container.Add( button, buttonSize );
+ //Todo: Use the size negotiation pass instead of SetSize directly
+ button.SetSize( buttonSize );
}
}
}
return GetNaturalSize().width;
}
-Actor Popup::GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::Control::KeyboardFocusNavigationDirection direction, bool loopEnabled)
+Actor Popup::GetNextKeyboardFocusableActor(Actor currentFocusedActor, Toolkit::Control::KeyboardFocus::Direction direction, bool loopEnabled)
{
Actor nextFocusableActor( currentFocusedActor );
else
{
// Rebuild the focus chain because button or content can be added or removed dynamically
- ActorContainer focusableActors;
+ std::vector< Actor > focusableActors;
if( mContent && mContent.IsKeyboardFocusable() )
{
focusableActors.push_back(mContent);
}
}
- for ( ActorContainer::iterator iter = focusableActors.begin(), end = focusableActors.end(); iter != end; ++iter )
+ for( std::vector< Actor >::iterator iter = focusableActors.begin(), end = focusableActors.end(); iter != end; ++iter )
{
if ( currentFocusedActor == *iter )
{
switch ( direction )
{
- case Toolkit::Control::Left:
+ case Toolkit::Control::KeyboardFocus::LEFT:
{
if ( iter == focusableActors.begin() )
{
}
break;
}
- case Toolkit::Control::Right:
+ case Toolkit::Control::KeyboardFocus::RIGHT:
{
if ( iter == focusableActors.end() - 1 )
{
break;
}
- case Toolkit::Control::Up:
+ case Toolkit::Control::KeyboardFocus::UP:
{
if ( *iter == mContent )
{
break;
}
- case Toolkit::Control::Down:
+ case Toolkit::Control::KeyboardFocus::DOWN:
{
if ( mContent && mContent.IsKeyboardFocusable() )
{