X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fpopup%2Fpopup-impl.cpp;h=e11c89fa481eb899d6b0527ef95280bff5a31721;hp=979492137a57f8cf6d8e5fde251c2c8115c1a990;hb=a00bbe499550a054e6692eb46b32f8c1548f3647;hpb=0e462103c222ad05916840bc7d7c902cf5fc82a1 diff --git a/dali-toolkit/internal/controls/popup/popup-impl.cpp b/dali-toolkit/internal/controls/popup/popup-impl.cpp index 9794921..e11c89f 100644 --- a/dali-toolkit/internal/controls/popup/popup-impl.cpp +++ b/dali-toolkit/internal/controls/popup/popup-impl.cpp @@ -30,9 +30,11 @@ #include #include #include +#include #include // INTERNAL INCLUDES +#include #include #include #include @@ -176,29 +178,29 @@ const Scripting::StringEnum ContextualModeTable[] = { }; 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. +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. +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 Rect DEFAULT_BACKGROUND_BORDER( 17, 17, 13, 13 ); ///< Default border of the background. -const Rect 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 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. +const char* DEFAULT_BACKGROUND_IMAGE_FILE_NAME = "00_popup_bg.9.png"; ///< Background image. +const char* DEFAULT_TAIL_UP_IMAGE_FILE_NAME = "popup_tail_up.png"; ///< Tail up image. +const char* DEFAULT_TAIL_DOWN_IMAGE_FILE_NAME = "popup_tail_down.png"; ///< Tail down image. +const char* DEFAULT_TAIL_LEFT_IMAGE_FILE_NAME = "popup_tail_left.png"; ///< Tail left image. +const char* DEFAULT_TAIL_RIGHT_IMAGE_FILE_NAME = "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 Rect DEFAULT_BACKGROUND_BORDER( 17, 17, 13, 13 ); ///< Default border of the background. +const Rect 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 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 @@ -256,12 +258,18 @@ Popup::Popup() mPopupBackgroundImage(), mBackgroundBorder( DEFAULT_BACKGROUND_BORDER ), mMargin(), - mTailUpImage( DEFAULT_TAIL_UP_IMAGE_PATH ), - mTailDownImage( DEFAULT_TAIL_DOWN_IMAGE_PATH ), - mTailLeftImage( DEFAULT_TAIL_LEFT_IMAGE_PATH ), - mTailRightImage( DEFAULT_TAIL_RIGHT_IMAGE_PATH ) + mTailUpImage(), + mTailDownImage(), + mTailLeftImage(), + mTailRightImage() { SetKeyboardNavigationSupport( true ); + + const std::string imageDirPath = AssetManager::GetDaliImagePath(); + mTailUpImage = imageDirPath + DEFAULT_TAIL_UP_IMAGE_FILE_NAME; + mTailDownImage = imageDirPath + DEFAULT_TAIL_DOWN_IMAGE_FILE_NAME; + mTailLeftImage = imageDirPath + DEFAULT_TAIL_LEFT_IMAGE_FILE_NAME; + mTailRightImage = imageDirPath + DEFAULT_TAIL_RIGHT_IMAGE_FILE_NAME; } void Popup::OnInitialize() @@ -307,7 +315,8 @@ void Popup::OnInitialize() mPopupLayout = Toolkit::TableView::New( 3, 1 ); // Adds the default background image. - SetPopupBackgroundImage( Toolkit::ImageView::New( DEFAULT_BACKGROUND_IMAGE_PATH ) ); + const std::string imageDirPath = AssetManager::GetDaliImagePath(); + SetPopupBackgroundImage( Toolkit::ImageView::New( imageDirPath + DEFAULT_BACKGROUND_IMAGE_FILE_NAME ) ); mPopupLayout.SetName( "popupLayoutTable" ); mPopupLayout.SetParentOrigin( ParentOrigin::CENTER ); @@ -592,6 +601,7 @@ void Popup::SetPopupBackgroundImage( Actor image ) const bool prevAlter = mAlterAddedChild; mAlterAddedChild = false; mPopupContainer.Add( mPopupBackgroundImage ); + mPopupBackgroundImage.LowerToBottom(); mAlterAddedChild = prevAlter; if( mTailImage ) @@ -917,7 +927,6 @@ Toolkit::Control Popup::CreateBacking() // Must always be positioned top-left of stage, regardless of parent. backing.SetInheritPosition(false); - backing.SetAnchorPoint( AnchorPoint::TOP_LEFT ); // Always the full size of the stage. backing.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS );