X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Ftext-controls%2Ftext-selection-popup-impl.cpp;h=199c8ef0b1f98f200c3a98700cc01a69f873b474;hb=5419ef62a5e3ee36785444083e914804268ea488;hp=91ef03b6b61d1a72ce757bbe96653da648e35688;hpb=4d0611f4911028b53905712013e1034d42531e5f;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp index 91ef03b..199c8ef 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp @@ -20,6 +20,7 @@ // INTERNAL INCLUDES #include +#include #include #include @@ -46,9 +47,9 @@ namespace // todo Move this to adaptor?? #define GET_LOCALE_TEXT(string) dgettext("elementary", string) -const Dali::Vector4 DEFAULT_POPUP_LINE_COLOR( Dali::Vector4( 0.69f, 0.93f, 0.93f, 1.0f ) ); +const Dali::Vector4 DEFAULT_POPUP_DIVIDER_COLOR( Dali::Vector4( 0.23f, 0.72f, 0.8f, 0.11f ) ); const Dali::Vector4 DEFAULT_OPTION_ICON( Dali::Vector4( 1.0f, 1.0f, 1.0f, 1.0f ) ); -const Dali::Vector4 DEFAULT_OPTION_ICON_PRESSED( Dali::Vector4( 0.12f, 0.56f, 1.0f, 1.0f ) ); +const Dali::Vector4 DEFAULT_OPTION_PRESSED_COLOR( Dali::Vector4( 0.24f, 0.72f, 0.8f, 0.11f ) ); const std::string DEFAULT_POPUP_BACKGROUND_IMAGE( DALI_IMAGE_DIR "selection-popup-bg#.png" ); const std::string OPTION_ICON_CLIPBOARD( DALI_IMAGE_DIR "copy_paste_icon_clipboard.png" ); @@ -297,11 +298,27 @@ Property::Value TextSelectionPopup::GetProperty( BaseObject* object, Property::I return value; } +void TextSelectionPopup::RaiseAbove( Layer target ) +{ + if( mToolbar ) + { + mToolbar.RaiseAbove( target ); + } +} + void TextSelectionPopup::OnInitialize() { CreatePopup(); } +void TextSelectionPopup::OnStageConnection( int depth ) +{ + // Call the Control::OnStageConnection() to set the depth of the background. + Control::OnStageConnection( depth ); + + // TextSelectionToolbar::OnStageConnection() will set the depths of all the popup's components. +} + bool TextSelectionPopup::OnCutButtonPressed( Toolkit::Button button ) { if( mCallbackInterface ) @@ -525,6 +542,7 @@ Dali::Image TextSelectionPopup::GetButtonImage( Toolkit::TextSelectionPopup::But void TextSelectionPopup::CreateOrderedListOfPopupOptions() { mOrderListOfButtons.clear(); + mOrderListOfButtons.reserve( 8u ); // Create button for each possible option using Option priority if ( !mCutIconImage ) @@ -567,7 +585,6 @@ Dali::Image TextSelectionPopup::GetButtonImage( Toolkit::TextSelectionPopup::But void TextSelectionPopup::AddOption( const ButtonRequirement& button, bool showDivider, bool showIcons, bool showCaption ) { - const std::string& name = button.name; const std::string& caption = button.caption; Image iconImage = button.icon; @@ -576,12 +593,10 @@ Dali::Image TextSelectionPopup::GetButtonImage( Toolkit::TextSelectionPopup::But // Both containers will be added to a button. Toolkit::TableView optionContainer = Toolkit::TableView::New( (showIcons&showCaption)?2:1 , 1 ); - optionContainer.SetDrawMode( DrawMode::OVERLAY ); optionContainer.SetFitHeight( 0 ); optionContainer.SetFitWidth( 0 ); Toolkit::TableView optionPressedContainer = Toolkit::TableView::New( (showIcons&showCaption)?2:1 , 1 ); - optionPressedContainer.SetDrawMode( DrawMode::OVERLAY ); optionPressedContainer.SetFitHeight( 0 ); optionPressedContainer.SetFitWidth( 0 ); optionPressedContainer.SetBackgroundColor( mPressedColor ); @@ -614,11 +629,14 @@ Dali::Image TextSelectionPopup::GetButtonImage( Toolkit::TextSelectionPopup::But optionPressedContainer.AddChild( pressedCaptionTextLabel, Toolkit::TableView::CellPosition(( showIcons&showCaption)?1:0, 0 ) ); } + int depth = Self().GetHierarchyDepth(); // 3. Create the icons if ( showIcons ) { ImageActor pressedIcon = ImageActor::New( iconImage ); ImageActor icon = ImageActor::New( iconImage ); + icon.SetSortModifier( DECORATION_DEPTH_INDEX + depth - 1 ); + pressedIcon.SetSortModifier( DECORATION_DEPTH_INDEX + depth - 1 ); icon.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); pressedIcon.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); @@ -699,9 +717,13 @@ Dali::Image TextSelectionPopup::GetButtonImage( Toolkit::TextSelectionPopup::But const Size size( mOptionDividerSize.width, 0.0f ); // Height FILL_TO_PARENT ImageActor divider = Toolkit::CreateSolidColorActor( Color::WHITE ); +#ifdef DECORATOR_DEBUG + divider.SetName("Text's popup divider"); +#endif divider.SetSize( size ); divider.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::HEIGHT ); - divider.SetColor( mLineColor ); + divider.SetColor( mDividerColor ); + divider.SetSortModifier( DECORATION_DEPTH_INDEX + depth ); mToolbar.AddDivider( divider ); } } @@ -744,7 +766,7 @@ Dali::Image TextSelectionPopup::GetButtonImage( Toolkit::TextSelectionPopup::But self.SetResizePolicy( ResizePolicy::FIT_TO_CHILDREN, Dimension::ALL_DIMENSIONS ); SetBackgroundImage( NinePatchImage::New( DEFAULT_POPUP_BACKGROUND_IMAGE ) ); - if ( !mToolbar ) + if( !mToolbar ) { mToolbar = Toolkit::TextSelectionToolbar::New(); mToolbar.SetParentOrigin( ParentOrigin::CENTER ); @@ -762,13 +784,13 @@ TextSelectionPopup::TextSelectionPopup( TextSelectionPopupCallbackInterface* cal mOptionDividerSize( Size( 2.0f, 0.0f) ), mEnabledButtons( Toolkit::TextSelectionPopup::NONE ), mCallbackInterface( callbackInterface ), - mLineColor( DEFAULT_POPUP_LINE_COLOR ), + mDividerColor( DEFAULT_POPUP_DIVIDER_COLOR ), mIconColor( DEFAULT_OPTION_ICON ), - mPressedColor( DEFAULT_OPTION_ICON_PRESSED ), + mPressedColor( DEFAULT_OPTION_PRESSED_COLOR ), mSelectOptionPriority( 1 ), mSelectAllOptionPriority ( 2 ), - mCutOptionPriority ( 3 ), - mCopyOptionPriority ( 4 ), + mCutOptionPriority ( 4 ), + mCopyOptionPriority ( 3 ), mPasteOptionPriority ( 5 ), mClipboardOptionPriority( 6 ), mShowIcons( false ),