+void Popup::SetTailVisibility( bool visible )
+{
+ mTailVisible = visible;
+ mLayoutDirty = true;
+}
+
+const bool Popup::IsTailVisible() const
+{
+ return mTailVisible;
+}
+
+void Popup::SetTailPosition( Vector3 position )
+{
+ mTailPosition = position;
+ mLayoutDirty = true;
+}
+
+const Vector3& Popup::GetTailPosition() const
+{
+ return mTailPosition;
+}
+
+void Popup::SetAnimationDuration( float duration )
+{
+ mAnimationDuration = duration;
+ mLayoutDirty = true;
+}
+
+float Popup::GetAnimationDuration() const
+{
+ return mAnimationDuration;
+}
+
+void Popup::SetAnimationMode( Toolkit::Popup::AnimationMode animationMode )
+{
+ mAnimationMode = animationMode;
+ mLayoutDirty = true;
+}
+
+Toolkit::Popup::AnimationMode Popup::GetAnimationMode() const
+{
+ return mAnimationMode;
+}
+
+void Popup::SetEntryAnimationData( const Property::Map& map )
+{
+ mEntryAnimationData.Clear();
+ Scripting::NewAnimation( map, mEntryAnimationData );
+}
+
+void Popup::SetExitAnimationData( const Property::Map& map )
+{
+ mExitAnimationData.Clear();
+ Scripting::NewAnimation( map, mExitAnimationData );
+}
+
+void Popup::UpdateBackgroundPositionAndSize()
+{
+ if( mPopupBackgroundImage )
+ {
+ mPopupBackgroundImage.SetResizePolicy( ResizePolicy::SIZE_FIXED_OFFSET_FROM_PARENT, Dimension::ALL_DIMENSIONS );
+ mPopupBackgroundImage.SetProperty( Actor::Property::SIZE_MODE_FACTOR, Vector3( mBackgroundBorder.left + mBackgroundBorder.right, mBackgroundBorder.top + mBackgroundBorder.bottom, 0.0f ) );
+
+ // Adjust the position of the background so the transparent areas are set appropriately
+ mPopupBackgroundImage.SetProperty( Actor::Property::POSITION, Vector2( ( mBackgroundBorder.right - mBackgroundBorder.left ) * 0.5f, ( mBackgroundBorder.bottom - mBackgroundBorder.top ) * 0.5f ));
+ }
+}
+
+void Popup::SetAutoHideDelay( int delay )
+{
+ mAutoHideDelay = delay;
+}
+
+int Popup::GetAutoHideDelay() const
+{
+ return mAutoHideDelay;
+}
+
+void Popup::SetBackingEnabled( bool enabled )
+{
+ mBackingEnabled = enabled;
+ mLayoutDirty = true;
+}
+
+const bool Popup::IsBackingEnabled() const
+{
+ return mBackingEnabled;
+}
+
+void Popup::SetBackingColor( Vector4 color )
+{
+ mBackingColor = color;
+ mBacking.SetBackgroundColor( Vector4( color.r, color.g, color.b, 1.0f ) );
+ mLayoutDirty = true;
+}
+
+const Vector4& Popup::GetBackingColor() const
+{
+ return mBackingColor;
+}
+
+void Popup::SetTailUpImage( std::string image )
+{
+ mTailUpImage = image;
+ mLayoutDirty = true;
+ LayoutTail();
+}
+
+const std::string& Popup::GetTailUpImage() const
+{
+ return mTailUpImage;
+}
+
+void Popup::SetTailDownImage( std::string image )
+{
+ mTailDownImage = image;
+ mLayoutDirty = true;
+ LayoutTail();
+}
+
+const std::string& Popup::GetTailDownImage() const
+{
+ return mTailDownImage;
+}
+
+void Popup::SetTailLeftImage( std::string image )
+{
+ mTailLeftImage = image;
+ mLayoutDirty = true;
+ LayoutTail();
+}
+
+const std::string& Popup::GetTailLeftImage() const
+{
+ return mTailLeftImage;
+}
+
+void Popup::SetTailRightImage( std::string image )
+{
+ mTailRightImage = image;
+ mLayoutDirty = true;
+ LayoutTail();
+}
+
+const std::string& Popup::GetTailRightImage() const
+{
+ return mTailRightImage;
+}
+
+void Popup::SetTouchTransparent( bool enabled )
+{
+ mTouchTransparent = enabled;
+}
+
+const bool Popup::IsTouchTransparent() const
+{
+ return mTouchTransparent;
+}
+
+void Popup::SetProperty( BaseObject* object, Property::Index propertyIndex, const Property::Value& value )
+{
+ Toolkit::Popup popup = Toolkit::Popup::DownCast( Dali::BaseHandle( object ) );
+
+ if ( popup )
+ {
+ Popup& popupImpl( GetImpl( popup ) );
+
+ switch ( propertyIndex )
+ {
+ case Toolkit::Popup::Property::TITLE:
+ {
+ Property::Map valueMap;
+ if( value.Get( valueMap ) )
+ {
+ popupImpl.SetTitle( Scripting::NewActor( valueMap ) );
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::CONTENT:
+ {
+ Property::Map valueMap;
+ if( value.Get( valueMap ) )
+ {
+ popupImpl.SetContent( Scripting::NewActor( valueMap ) );
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::FOOTER:
+ {
+ Property::Map valueMap;
+ if( value.Get( valueMap ) )
+ {
+ popupImpl.SetFooter( Scripting::NewActor( valueMap ) );
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::DISPLAY_STATE:
+ {
+ std::string valueString;
+ if( value.Get( valueString ) )
+ {
+ Toolkit::Popup::DisplayState displayState( Toolkit::Popup::HIDDEN );
+ if( Scripting::GetEnumeration< Toolkit::Popup::DisplayState >( valueString.c_str(), DisplayStateTable, DisplayStateTableCount, displayState ) )
+ {
+ popupImpl.SetDisplayState( displayState );
+ }
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::TOUCH_TRANSPARENT:
+ {
+ bool valueBool;
+ if( value.Get( valueBool ) )
+ {
+ popupImpl.SetTouchTransparent( valueBool );
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::TAIL_VISIBILITY:
+ {
+ bool valueBool;
+ if( value.Get( valueBool ) )
+ {
+ popupImpl.SetTailVisibility( valueBool );
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::TAIL_POSITION:
+ {
+ Vector3 valueVector3;
+ if( value.Get( valueVector3 ) )
+ {
+ popupImpl.SetTailPosition( valueVector3 );
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::CONTEXTUAL_MODE:
+ {
+ std::string valueString;
+ if( value.Get( valueString ) )
+ {
+ Toolkit::Popup::ContextualMode contextualMode( Toolkit::Popup::BELOW );
+ if( Scripting::GetEnumeration< Toolkit::Popup::ContextualMode >( valueString.c_str(), ContextualModeTable, ContextualModeTableCount, contextualMode ) )
+ {
+ popupImpl.SetContextualMode( contextualMode );
+ }
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::ANIMATION_DURATION:
+ {
+ float valueFloat;
+ if( value.Get( valueFloat ) )
+ {
+ popupImpl.SetAnimationDuration( valueFloat );
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::ANIMATION_MODE:
+ {
+ std::string valueString;
+ if( value.Get( valueString ) )
+ {
+ Toolkit::Popup::AnimationMode animationMode( Toolkit::Popup::FADE );
+ if( Scripting::GetEnumeration< Toolkit::Popup::AnimationMode >( valueString.c_str(), AnimationModeTable, AnimationModeTableCount, animationMode ) )
+ {
+ popupImpl.SetAnimationMode( animationMode );
+ }
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::ENTRY_ANIMATION:
+ {
+ Property::Map valueMap;
+ if( value.Get( valueMap ) )
+ {
+ popupImpl.SetEntryAnimationData( valueMap );
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::EXIT_ANIMATION:
+ {
+ Property::Map valueMap;
+ if( value.Get( valueMap ) )
+ {
+ popupImpl.SetExitAnimationData( valueMap );
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::AUTO_HIDE_DELAY:
+ {
+ int valueInt;
+ if( value.Get( valueInt ) )
+ {
+ popupImpl.SetAutoHideDelay( valueInt );
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::BACKING_ENABLED:
+ {
+ bool valueBool;
+ if( value.Get( valueBool ) )
+ {
+ popupImpl.SetBackingEnabled( valueBool );
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::BACKING_COLOR:
+ {
+ Vector4 valueVector4;
+ if( value.Get( valueVector4 ) )
+ {
+ popupImpl.SetBackingColor( valueVector4 );
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::POPUP_BACKGROUND_IMAGE:
+ {
+ std::string valueString;
+ if( value.Get( valueString ) )
+ {
+ Toolkit::ImageView actor = Toolkit::ImageView::New( valueString );
+ popupImpl.SetPopupBackgroundImage( actor );
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::POPUP_BACKGROUND_BORDER:
+ {
+ bool valueUpdated = false;
+
+ Vector4 valueVector4;
+ if( value.Get( popupImpl.mBackgroundBorder ) )
+ {
+ valueUpdated = true;
+ }
+ else if( value.Get( valueVector4 ) )
+ {
+ popupImpl.mBackgroundBorder.left = valueVector4.x;
+ popupImpl.mBackgroundBorder.right = valueVector4.y;
+ popupImpl.mBackgroundBorder.bottom = valueVector4.z;
+ popupImpl.mBackgroundBorder.top = valueVector4.w;
+ valueUpdated = true;
+ }
+
+ if( valueUpdated )
+ {
+ popupImpl.LayoutTail(); // Update the tail if required
+ popupImpl.UpdateBackgroundPositionAndSize(); // Update the background's size and position
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::TAIL_UP_IMAGE:
+ {
+ std::string valueString;
+ if( value.Get( valueString ) )
+ {
+ popupImpl.SetTailUpImage( valueString );
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::TAIL_DOWN_IMAGE:
+ {
+ std::string valueString;
+ if( value.Get( valueString ) )
+ {
+ popupImpl.SetTailDownImage( valueString );
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::TAIL_LEFT_IMAGE:
+ {
+ std::string valueString;
+ if( value.Get( valueString ) )
+ {
+ popupImpl.SetTailLeftImage( valueString );
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::TAIL_RIGHT_IMAGE:
+ {
+ std::string valueString;
+ if( value.Get( valueString ) )
+ {
+ popupImpl.SetTailRightImage( valueString );
+ }
+ break;
+ }
+ }
+ }
+}
+
+Property::Value Popup::GetProperty( BaseObject* object, Property::Index propertyIndex )
+{
+ Property::Value value;
+
+ Toolkit::Popup popup = Toolkit::Popup::DownCast( Dali::BaseHandle( object ) );
+
+ if ( popup )
+ {
+ Popup& popupImpl( GetImpl( popup ) );
+
+ switch ( propertyIndex )
+ {
+ case Toolkit::Popup::Property::TITLE:
+ {
+ Property::Map map;
+ Scripting::CreatePropertyMap( popupImpl.GetTitle(), map );
+ value = map;
+ break;
+ }
+ case Toolkit::Popup::Property::CONTENT:
+ {
+ Property::Map map;
+ Scripting::CreatePropertyMap( popupImpl.GetContent(), map );
+ value = map;
+ break;
+ }
+ case Toolkit::Popup::Property::FOOTER:
+ {
+ Property::Map map;
+ Scripting::CreatePropertyMap( popupImpl.GetFooter(), map );
+ value = map;
+ break;
+ }
+ case Toolkit::Popup::Property::DISPLAY_STATE:
+ {
+ value = Scripting::GetLinearEnumerationName< Toolkit::Popup::DisplayState >( popupImpl.GetDisplayState(), DisplayStateTable, DisplayStateTableCount );
+ break;
+ }
+ case Toolkit::Popup::Property::TOUCH_TRANSPARENT:
+ {
+ value = popupImpl.IsTouchTransparent();
+ break;
+ }
+ case Toolkit::Popup::Property::TAIL_VISIBILITY:
+ {
+ value = popupImpl.IsTailVisible();
+ break;
+ }
+ case Toolkit::Popup::Property::TAIL_POSITION:
+ {
+ value = popupImpl.GetTailPosition();
+ break;
+ }
+ case Toolkit::Popup::Property::CONTEXTUAL_MODE:
+ {
+ value = Scripting::GetLinearEnumerationName< Toolkit::Popup::ContextualMode >( popupImpl.GetContextualMode(), ContextualModeTable, ContextualModeTableCount );
+ break;
+ }
+ case Toolkit::Popup::Property::ANIMATION_DURATION:
+ {
+ value = popupImpl.GetAnimationDuration();
+ break;
+ }
+ case Toolkit::Popup::Property::ANIMATION_MODE:
+ {
+ value = Scripting::GetLinearEnumerationName< Toolkit::Popup::AnimationMode >( popupImpl.GetAnimationMode(), AnimationModeTable, AnimationModeTableCount );
+ break;
+ }
+ case Toolkit::Popup::Property::ENTRY_ANIMATION:
+ {
+ // Note: Cannot retrieve property map from animation.
+ Property::Map map;
+ value = map;
+ break;
+ }
+ case Toolkit::Popup::Property::EXIT_ANIMATION:
+ {
+ // Note: Cannot retrieve property map from animation.
+ Property::Map map;
+ value = map;
+ break;
+ }
+ case Toolkit::Popup::Property::AUTO_HIDE_DELAY:
+ {
+ value = popupImpl.GetAutoHideDelay();
+ break;
+ }
+ case Toolkit::Popup::Property::BACKING_ENABLED:
+ {
+ value = popupImpl.IsBackingEnabled();
+ break;
+ }
+ case Toolkit::Popup::Property::BACKING_COLOR:
+ {
+ value = popupImpl.GetBackingColor();
+ break;
+ }
+ case Toolkit::Popup::Property::POPUP_BACKGROUND_IMAGE:
+ {
+ Toolkit::ImageView imageView = Toolkit::ImageView::DownCast( popupImpl.GetPopupBackgroundImage() );
+ if( imageView )
+ {
+ value = imageView.GetProperty( Toolkit::ImageView::Property::IMAGE );
+ }
+ break;
+ }
+ case Toolkit::Popup::Property::POPUP_BACKGROUND_BORDER:
+ {
+ value = popupImpl.mBackgroundBorder;
+ break;
+ }
+ case Toolkit::Popup::Property::TAIL_UP_IMAGE:
+ {
+ value = popupImpl.GetTailUpImage();
+ break;
+ }
+ case Toolkit::Popup::Property::TAIL_DOWN_IMAGE:
+ {
+ value = popupImpl.GetTailDownImage();
+ break;
+ }
+ case Toolkit::Popup::Property::TAIL_LEFT_IMAGE:
+ {
+ value = popupImpl.GetTailLeftImage();
+ break;
+ }
+ case Toolkit::Popup::Property::TAIL_RIGHT_IMAGE:
+ {
+ value = popupImpl.GetTailRightImage();
+ break;
+ }
+ }
+ }
+
+ return value;
+}
+