+ // Let events pass through the toast popup.
+ popup.SetProperty( Toolkit::Popup::Property::TOUCH_TRANSPARENT, true );
+
+ return popup;
+}
+
+// Setup properties, signals and actions using the type-registry.
+DALI_TYPE_REGISTRATION_BEGIN( Toolkit::Popup, Toolkit::Control, Create )
+
+// Main content related properties.
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "title", MAP, TITLE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "content", MAP, CONTENT )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "footer", MAP, FOOTER )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "display-state", STRING, DISPLAY_STATE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "touch-transparent", BOOLEAN, TOUCH_TRANSPARENT )
+
+// Contextual related properties.
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tail-visibility", BOOLEAN, TAIL_VISIBILITY )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tail-position", VECTOR3, TAIL_POSITION )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "contextual-mode", STRING, CONTEXTUAL_MODE )
+
+// Animation related properties.
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "animation-duration", FLOAT, ANIMATION_DURATION )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "animation-mode", STRING, ANIMATION_MODE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "entry-animation", MAP, ENTRY_ANIMATION )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "exit-animation", MAP, EXIT_ANIMATION )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "auto-hide-delay", INTEGER, AUTO_HIDE_DELAY )
+
+// Style related properties.
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "backing-enabled", BOOLEAN, BACKING_ENABLED )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "backing-color", VECTOR4, BACKING_COLOR )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "popup-background-image", STRING, POPUP_BACKGROUND_IMAGE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tail-up-image", STRING, TAIL_UP_IMAGE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tail-down-image", STRING, TAIL_DOWN_IMAGE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tail-left-image", STRING, TAIL_LEFT_IMAGE )
+DALI_PROPERTY_REGISTRATION( Toolkit, Popup, "tail-right-image", STRING, TAIL_RIGHT_IMAGE )
+
+// Signals.
+DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "touched-outside", SIGNAL_TOUCHED_OUTSIDE )
+DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "showing", SIGNAL_SHOWING )
+DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "shown", SIGNAL_SHOWN )
+DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "hiding", SIGNAL_HIDING )
+DALI_SIGNAL_REGISTRATION( Toolkit, Popup, "hidden", SIGNAL_HIDDEN )
+
+DALI_TYPE_REGISTRATION_END()
+
+// Named type registration.
+
+// Toast Popup: Non-modal popup that displays information at the bottom of the screen.
+TypeRegistration typeRegistrationToast( "popup-toast", typeid( Toolkit::Popup ), CreateToast );
+
+// Enumeration to / from string conversion tables
+
+const Scripting::StringEnum DisplayStateTable[] = {
+ { "SHOWING", Toolkit::Popup::SHOWING },
+ { "SHOWN", Toolkit::Popup::SHOWN },
+ { "HIDING", Toolkit::Popup::HIDING },
+ { "HIDDEN", Toolkit::Popup::HIDDEN },
+}; const unsigned int DisplayStateTableCount = sizeof( DisplayStateTable ) / sizeof( DisplayStateTable[0] );
+
+const Scripting::StringEnum AnimationModeTable[] = {
+ { "NONE", Toolkit::Popup::NONE },
+ { "ZOOM", Toolkit::Popup::ZOOM },
+ { "FADE", Toolkit::Popup::FADE },
+ { "CUSTOM", Toolkit::Popup::CUSTOM },
+}; const unsigned int AnimationModeTableCount = sizeof( AnimationModeTable ) / sizeof( AnimationModeTable[0] );
+
+const Scripting::StringEnum ContextualModeTable[] = {
+ { "NON_CONTEXTUAL", Toolkit::Popup::NON_CONTEXTUAL },
+ { "ABOVE", Toolkit::Popup::ABOVE },
+ { "RIGHT", Toolkit::Popup::RIGHT },
+ { "BELOW", Toolkit::Popup::BELOW },
+ { "LEFT", Toolkit::Popup::LEFT },
+}; const unsigned int ContextualModeTableCount = sizeof( ContextualModeTable ) / sizeof( ContextualModeTable[0] );
+
+// Popup defaults.
+const Vector3 DEFAULT_POPUP_PARENT_RELATIVE_SIZE( 0.75f, 1.0f, 1.0f ); ///< Default size percentage of parent.
+const float DEFAULT_POPUP_ANIMATION_DURATION = 0.6f; ///< Duration of hide/show animations.
+const float POPUP_OUT_MARGIN_WIDTH = 16.f; ///< Space between the screen edge and the popup edge in the horizontal dimension.
+const float POPUP_OUT_MARGIN_HEIGHT = 36.f; ///< Space between the screen edge and the popup edge in the vertical dimension.
+const Vector3 DEFAULT_TAIL_POSITION( 0.5f, 1.0f, 0.0f ); ///< Position the tail will be displayed when enabled without setting the position.
+
+// Contextual defaults.
+const Vector2 DEFAULT_CONTEXTUAL_ADJACENCY_MARGIN( 10.0f, 10.0f ); ///< How close the Popup will be to it's contextual parent.
+const Vector2 DEFAULT_CONTEXTUAL_STAGE_BORDER( 15.0f, 15.0f ); ///< How close the Popup can be to the stage edges.
+
+// Popup style defaults.
+const char* DEFAULT_BACKGROUND_IMAGE_PATH = DALI_IMAGE_DIR "00_popup_bg.9.png"; ///< Background image.
+const char* DEFAULT_TAIL_UP_IMAGE_PATH = DALI_IMAGE_DIR "popup_tail_up.png"; ///< Tail up image.
+const char* DEFAULT_TAIL_DOWN_IMAGE_PATH = DALI_IMAGE_DIR "popup_tail_down.png"; ///< Tail down image.
+const char* DEFAULT_TAIL_LEFT_IMAGE_PATH = DALI_IMAGE_DIR "popup_tail_left.png"; ///< Tail left image.
+const char* DEFAULT_TAIL_RIGHT_IMAGE_PATH = DALI_IMAGE_DIR "popup_tail_right.png"; ///< Tail right image.
+
+const Vector4 DEFAULT_BACKING_COLOR( 0.0f, 0.0f, 0.0f, 0.5f ); ///< Color of the dimmed backing.
+const Vector3 BACKGROUND_OUTER_BORDER( 40.0f, 30.0f, 0.0f ); ///< External border.
+const Rect<float> DEFAULT_TITLE_PADDING( 20.0f, 20.0f, 20.0f, 20.0f ); ///< Title padding used on popups with content and/or controls (from Tizen GUI UX).
+const Rect<float> DEFAULT_TITLE_ONLY_PADDING( 8.0f, 8.0f, 8.0f, 8.0f ); ///< Title padding used on popups with a title only (like toast popups).
+const Vector3 FOOTER_SIZE( 620.0f, 96.0f,0.0f ); ///< Default size of the bottom control area.
+const float DEFAULT_RELATIVE_PARENT_WIDTH = 0.75f; ///< If width is not fixed, relative size to parent is used by default.
+
+} // Unnamed namespace
+
+/*
+ * Implementation.
+ */