X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-input%2Ftext-input-popup-impl.cpp;h=e92e4d02fa44d6bad77fe6aca0cb4adbc194048e;hp=a133275474ef674652a1cd856986b71318365364;hb=22e89375677d1fe737d5472e21ab681f2f3e4ca7;hpb=2ddfbb9e23a7c3fc30e604236c41e0ef6d2ed6a2 diff --git a/dali-toolkit/internal/controls/text-input/text-input-popup-impl.cpp b/dali-toolkit/internal/controls/text-input/text-input-popup-impl.cpp index a133275..e92e4d0 100644 --- a/dali-toolkit/internal/controls/text-input/text-input-popup-impl.cpp +++ b/dali-toolkit/internal/controls/text-input/text-input-popup-impl.cpp @@ -18,6 +18,7 @@ // EXTERNAL INCLUDES #include #include +#include #include // INTERNAL INCLUDES @@ -39,23 +40,23 @@ const Vector2 DEFAULT_POPUP_INDICATOR_OFFSET(0.0f, 60.0f); /** * Image resource paths */ -const std::string POPUP_BACKGROUND( DALI_IMAGE_DIR "popup_bubble_bg.#.png" ); -const std::string POPUP_BACKGROUND_EFFECT( DALI_IMAGE_DIR "popup_bubble_bg_ef.#.png" ); -const std::string POPUP_BACKGROUND_LINE( DALI_IMAGE_DIR "popup_bubble_bg_line.#.png" ); - -const std::string POPUP_TAIL_BOTTOM( DALI_IMAGE_DIR "popup_bubble_tail_bottom.png" ); -const std::string POPUP_TAIL_BOTTOM_EFFECT( DALI_IMAGE_DIR "popup_bubble_tail_bottom_ef.png" ); -const std::string POPUP_TAIL_BOTTOM_LINE( DALI_IMAGE_DIR "popup_bubble_tail_bottom_line.png" ); -const std::string POPUP_TAIL_TOP( DALI_IMAGE_DIR "popup_bubble_tail_top.png" ); -const std::string POPUP_TAIL_TOP_EFFECT( DALI_IMAGE_DIR "popup_bubble_tail_top_ef.png" ); -const std::string POPUP_TAIL_TOP_LINE( DALI_IMAGE_DIR "popup_bubble_tail_top_line.png" ); - -const std::string OPTION_ICON_CLIPBOARD( DALI_IMAGE_DIR "copy_paste_icon_clipboard.png" ); -const std::string OPTION_ICON_COPY( DALI_IMAGE_DIR "copy_paste_icon_copy.png" ); -const std::string OPTION_ICON_CUT( DALI_IMAGE_DIR "copy_paste_icon_cut.png" ); -const std::string OPTION_ICON_PASTE( DALI_IMAGE_DIR "copy_paste_icon_paste.png" ); -const std::string OPTION_ICON_SELECT( DALI_IMAGE_DIR "copy_paste_icon_select.png" ); -const std::string OPTION_ICON_SELECT_ALL( DALI_IMAGE_DIR "copy_paste_icon_select_all.png" ); +const char* const POPUP_BACKGROUND = DALI_IMAGE_DIR "popup_bubble_bg.#.png"; +const char* const POPUP_BACKGROUND_EFFECT = DALI_IMAGE_DIR "popup_bubble_bg_ef.#.png"; +const char* const POPUP_BACKGROUND_LINE = DALI_IMAGE_DIR "popup_bubble_bg_line.#.png"; + +const char* const POPUP_TAIL_BOTTOM = DALI_IMAGE_DIR "popup_bubble_tail_bottom.png"; +const char* const POPUP_TAIL_BOTTOM_EFFECT = DALI_IMAGE_DIR "popup_bubble_tail_bottom_ef.png"; +const char* const POPUP_TAIL_BOTTOM_LINE = DALI_IMAGE_DIR "popup_bubble_tail_bottom_line.png"; +const char* const POPUP_TAIL_TOP = DALI_IMAGE_DIR "popup_bubble_tail_top.png"; +const char* const POPUP_TAIL_TOP_EFFECT = DALI_IMAGE_DIR "popup_bubble_tail_top_ef.png"; +const char* const POPUP_TAIL_TOP_LINE = DALI_IMAGE_DIR "popup_bubble_tail_top_line.png"; + +const char* const OPTION_ICON_CLIPBOARD = DALI_IMAGE_DIR "copy_paste_icon_clipboard.png"; +const char* const OPTION_ICON_COPY = DALI_IMAGE_DIR "copy_paste_icon_copy.png"; +const char* const OPTION_ICON_CUT = DALI_IMAGE_DIR "copy_paste_icon_cut.png"; +const char* const OPTION_ICON_PASTE = DALI_IMAGE_DIR "copy_paste_icon_paste.png"; +const char* const OPTION_ICON_SELECT = DALI_IMAGE_DIR "copy_paste_icon_select.png"; +const char* const OPTION_ICON_SELECT_ALL = DALI_IMAGE_DIR "copy_paste_icon_select_all.png"; /** * Constant values for building the GUI @@ -100,9 +101,16 @@ namespace Toolkit namespace Internal { -const char* const TextInputPopup::SIGNAL_PRESSED = "pressed"; -const char* const TextInputPopup::SIGNAL_HIDE_FINISHED = "hide-finished"; -const char* const TextInputPopup::SIGNAL_SHOW_FINISHED = "show-finished"; +namespace +{ + +// Signals + +const char* const SIGNAL_PRESSED = "pressed"; +const char* const SIGNAL_HIDE_FINISHED = "hide-finished"; +const char* const SIGNAL_SHOW_FINISHED = "show-finished"; + +} const char* const TextInputPopup::OPTION_SELECT_WORD = "option-select_word"; // "Select Word" popup option. const char* const TextInputPopup::OPTION_SELECT_ALL("option-select_all"); // "Select All" popup option. @@ -252,7 +260,6 @@ Toolkit::TextView TextInputPopup::CreateOptionCaption( const std::string& captio styledCaption.push_back( MarkupProcessor::StyledText( Text( caption ), style ) ); Toolkit::TextView textView = Toolkit::TextView::New( styledCaption ); - textView.SetSizePolicy( Toolkit::Control::Fixed, Toolkit::Control::Fixed ); textView.SetWidthExceedPolicy( Toolkit::TextView::EllipsizeEnd ); textView.SetHeightExceedPolicy( Toolkit::TextView::EllipsizeEnd ); textView.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); @@ -274,28 +281,28 @@ void TextInputPopup::CreateBackground() // Create background-panel if not already created (required if we have at least one option) if ( !mBackground ) { - Image bgImg = Image::New( POPUP_BACKGROUND ); + Image bgImg = ResourceImage::New( POPUP_BACKGROUND ); mBackground = ImageActor::New( bgImg ); mBackground.SetAnchorPoint( AnchorPoint::CENTER ); mBackground.SetParentOrigin( ParentOrigin::CENTER ); mBackground.SetName( "text-input-popup-background" ); mBackground.SetColor( mBackgroundColor ); - Image bgEffectImg = Image::New( POPUP_BACKGROUND_EFFECT ); + Image bgEffectImg = ResourceImage::New( POPUP_BACKGROUND_EFFECT ); mBackgroundEffect = ImageActor::New( bgEffectImg ); mBackgroundEffect.SetAnchorPoint( AnchorPoint::CENTER ); mBackgroundEffect.SetParentOrigin( ParentOrigin::CENTER ); mBackgroundEffect.SetName( "text-input-popup-background-effect" ); - mBackgroundEffect.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mBackgroundEffect.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); mBackgroundEffect.SetZ( 1.0f ); mBackground.Add( mBackgroundEffect ); - Image bgLine = Image::New( POPUP_BACKGROUND_LINE ); + Image bgLine = ResourceImage::New( POPUP_BACKGROUND_LINE ); mBackgroundLine = ImageActor::New( bgLine ); mBackgroundLine.SetAnchorPoint( AnchorPoint::CENTER); mBackgroundLine.SetParentOrigin( ParentOrigin::CENTER ); mBackgroundLine.SetName( "text-input-popup-background-effect" ); - mBackgroundLine.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mBackgroundLine.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); mBackgroundLine.SetColor( mLineColor ); mBackgroundLine.SetZ( 0.1f ); mBackgroundEffect.Add( mBackgroundLine ); @@ -308,7 +315,7 @@ void TextInputPopup::CreateTail() { if ( !mTail ) { - Image tail = Image::New( POPUP_TAIL_BOTTOM ); + Image tail = ResourceImage::New( POPUP_TAIL_BOTTOM ); mTail = ImageActor::New( tail ); mTail.SetParentOrigin( ParentOrigin::BOTTOM_CENTER ); mTail.SetAnchorPoint( AnchorPoint::TOP_CENTER ); @@ -316,20 +323,20 @@ void TextInputPopup::CreateTail() mTail.SetPosition( 0.0f, POPUP_TAIL_Y_OFFSET - POPUP_BORDER.w, 1.2f ); mTail.SetColor( mBackgroundColor ); - Image tailEffect = Image::New( POPUP_TAIL_BOTTOM_EFFECT ); + Image tailEffect = ResourceImage::New( POPUP_TAIL_BOTTOM_EFFECT ); mTailEffect = ImageActor::New( tailEffect ); mTailEffect.SetParentOrigin( ParentOrigin::CENTER ); mTailEffect.SetAnchorPoint( AnchorPoint::CENTER ); mTailEffect.SetName( "text-input-popup-tail-effect" ); - mTailEffect.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mTailEffect.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); mTailEffect.SetZ( 0.1f ); mTail.Add( mTailEffect ); - Image tailLine = Image::New( POPUP_TAIL_BOTTOM_LINE ); + Image tailLine = ResourceImage::New( POPUP_TAIL_BOTTOM_LINE ); mTailLine = ImageActor::New( tailLine ); mTailLine.SetParentOrigin( ParentOrigin::CENTER ); mTailLine.SetAnchorPoint( AnchorPoint::CENTER ); - mTailLine.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mTailLine.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); mTailLine.SetName( "text-input-popup-tail-line" ); mTailLine.SetColor( mLineColor ); mTailLine.SetZ( 0.1f ); @@ -389,37 +396,37 @@ void TextInputPopup::CreateOrderedListOfOptions() { case ButtonsCut: { - Image cutIcon = Image::New( OPTION_ICON_CUT ); + Image cutIcon = ResourceImage::New( OPTION_ICON_CUT ); currentButton = CreateRequiredButton( ButtonsCut, mCutOptionPriority, OPTION_CUT, GET_LOCALE_TEXT("IDS_COM_BODY_CUT"), cutIcon, false ); break; } case ButtonsCopy: { - Image copyIcon = Image::New( OPTION_ICON_COPY ); + Image copyIcon = ResourceImage::New( OPTION_ICON_COPY ); currentButton = CreateRequiredButton( ButtonsCopy, mCopyOptionPriority, OPTION_COPY, GET_LOCALE_TEXT("IDS_COM_BODY_COPY"), copyIcon, false ); break; } case ButtonsPaste: { - Image pasteIcon = Image::New( OPTION_ICON_PASTE ); + Image pasteIcon = ResourceImage::New( OPTION_ICON_PASTE ); currentButton = CreateRequiredButton( ButtonsPaste, mPasteOptionPriority, OPTION_PASTE, GET_LOCALE_TEXT("IDS_COM_BODY_PASTE"), pasteIcon, false ); break; } case ButtonsSelect: { - Image selectIcon = Image::New( OPTION_ICON_SELECT ); + Image selectIcon = ResourceImage::New( OPTION_ICON_SELECT ); currentButton = CreateRequiredButton( ButtonsSelect, mSelectOptionPriority, OPTION_SELECT_WORD, GET_LOCALE_TEXT("IDS_COM_SK_SELECT"), selectIcon, false ); break; } case ButtonsSelectAll: { - Image selectAllIcon = Image::New( OPTION_ICON_SELECT_ALL ); + Image selectAllIcon = ResourceImage::New( OPTION_ICON_SELECT_ALL ); currentButton = CreateRequiredButton( ButtonsSelectAll, mSelectAllOptionPriority, OPTION_SELECT_ALL, GET_LOCALE_TEXT("IDS_COM_BODY_SELECT_ALL"), selectAllIcon, false ); break; } case ButtonsClipboard: { - Image clipboardIcon = Image::New( OPTION_ICON_CLIPBOARD ); + Image clipboardIcon = ResourceImage::New( OPTION_ICON_CLIPBOARD ); currentButton = CreateRequiredButton( ButtonsClipboard, mClipboardOptionPriority, OPTION_CLIPBOARD, GET_LOCALE_TEXT("IDS_COM_BODY_CLIPBOARD"), clipboardIcon, false ); break; } @@ -483,7 +490,6 @@ void TextInputPopup::AddOption(const std::string& name, const std::string& capti // 5. Create a option. Toolkit::PushButton option = Toolkit::PushButton::New(); - option.SetSizePolicy( Toolkit::Control::Fixed, Toolkit::Control::Fixed ); option.SetParentOrigin( ParentOrigin::TOP_LEFT ); option.SetAnchorPoint( AnchorPoint::TOP_LEFT ); option.SetSize( constrainedOptionSize ); @@ -541,8 +547,8 @@ void TextInputPopup::Hide(bool animate) if(animate) { mAnimation = Animation::New( HIDE_POPUP_ANIMATION_DURATION ); - mAnimation.AnimateTo( Property(mRoot, Actor::SCALE), Vector3::ZERO, AlphaFunctions::EaseOut ); - mAnimation.AnimateTo( Property(mRoot, Actor::COLOR_ALPHA), 0.0f, AlphaFunctions::EaseOut ); + mAnimation.AnimateTo( Property(mRoot, Actor::Property::SCALE), Vector3::ZERO, AlphaFunctions::EaseOut ); + mAnimation.AnimateTo( Property(mRoot, Actor::Property::COLOR_ALPHA), 0.0f, AlphaFunctions::EaseOut ); mAnimation.Play(); mAnimation.FinishedSignal().Connect( this, &TextInputPopup::OnHideFinished ); @@ -550,8 +556,8 @@ void TextInputPopup::Hide(bool animate) } else { - mRoot.SetProperty(Actor::SCALE, Vector3::ZERO); - mRoot.SetProperty(Actor::COLOR_ALPHA, 0.0f); + mRoot.SetProperty(Actor::Property::SCALE, Vector3::ZERO); + mRoot.SetProperty(Actor::Property::COLOR_ALPHA, 0.0f); mState = StateHidden; } } @@ -577,8 +583,8 @@ void TextInputPopup::Show( Actor target, bool animate ) if(animate) { mAnimation = Animation::New( SHOW_POPUP_ANIMATION_DURATION ); - mAnimation.AnimateTo( Property(mRoot, Actor::SCALE), Vector3::ONE, AlphaFunctions::EaseOut ); - mAnimation.AnimateTo( Property(mRoot, Actor::COLOR_ALPHA), 1.0f, AlphaFunctions::EaseOut ); + mAnimation.AnimateTo( Property(mRoot, Actor::Property::SCALE), Vector3::ONE, AlphaFunctions::EaseOut ); + mAnimation.AnimateTo( Property(mRoot, Actor::Property::COLOR_ALPHA), 1.0f, AlphaFunctions::EaseOut ); mAnimation.Play(); mAnimation.FinishedSignal().Connect( this, &TextInputPopup::OnShowFinished ); @@ -586,8 +592,8 @@ void TextInputPopup::Show( Actor target, bool animate ) } else { - mRoot.SetProperty(Actor::SCALE, Vector3::ONE); - mRoot.SetProperty(Actor::COLOR_ALPHA, 1.0f); + mRoot.SetProperty(Actor::Property::SCALE, Vector3::ONE); + mRoot.SetProperty(Actor::Property::COLOR_ALPHA, 1.0f); mState = StateShown; } } @@ -854,9 +860,9 @@ void TextInputPopup::SetTailPosition( const Vector3& position, bool yAxisFlip ) if ( yAxisFlip ) { - Image tail = Image::New( POPUP_TAIL_TOP ); - Image tailEffect = Image::New( POPUP_TAIL_TOP_EFFECT ); - Image tailLine = Image::New( POPUP_TAIL_TOP_LINE ); + Image tail = ResourceImage::New( POPUP_TAIL_TOP ); + Image tailEffect = ResourceImage::New( POPUP_TAIL_TOP_EFFECT ); + Image tailLine = ResourceImage::New( POPUP_TAIL_TOP_LINE ); mTail.SetImage( tail ); mTailEffect.SetImage( tailEffect ); @@ -894,12 +900,12 @@ TextInputPopup::PressedSignalType& TextInputPopup::PressedSignal() return mPressedSignal; } -TextInputPopup::HideFinishedSignalType& TextInputPopup::HideFinishedSignal() +TextInputPopup::VisibilityChangeFinishedSignalType& TextInputPopup::HideFinishedSignal() { return mHideFinishedSignal; } -TextInputPopup::ShowFinishedSignalType& TextInputPopup::ShowFinishedSignal() +TextInputPopup::VisibilityChangeFinishedSignalType& TextInputPopup::ShowFinishedSignal() { return mShowFinishedSignal; } @@ -909,4 +915,3 @@ TextInputPopup::ShowFinishedSignalType& TextInputPopup::ShowFinishedSignal() } // namespace Toolkit } // namespace Dali -