2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include <dali-toolkit/internal/controls/text-input/text-input-popup-impl.h>
20 #include <dali-toolkit/public-api/controls/buttons/push-button.h>
21 #include <dali-toolkit/public-api/controls/default-controls/solid-color-actor.h>
28 #define GET_LOCALE_TEXT(string) dgettext("sys_string", string)
34 const Vector4 DEFAULT_POPUP_BACKGROUND( Vector4( 0.24f, 0.41f, 0.88f, 1.0f ) );
35 const Vector4 DEFAULT_POPUP_BUTTON_PRESSED( Vector4( 0.18f, 0.56f, 1.0f, 1.0f ) );
36 const Vector4 DEFAULT_BORDER_COLOR( Vector4( 0.2f, 0.2f, 0.2f, 1.0f ) );
37 const Vector3 POPUP_BORDER( Vector3(1.0f, 1.0f, 0.0f) );
40 const char* DEFAULT_PANEL_BUTTON_DIVIDER = DALI_IMAGE_DIR "copypanelLine.png";
42 /* Functionality in place to have the end buttons using different images to inner button.
43 * Supply a centre image and then a left and right image, the centre image can have straight ends while
44 * the left image can be rounded on the left and straight on the right, the right image can be straight on the left and rounded on the right.
48 const char* DEFAULT_POPUP_TAIL_BOTTOM( DALI_IMAGE_DIR "00_popup_bubble_tail_bottom.png" );
50 // Popup: Vertical Constraint
51 // TODO: Remove - this should come from application - it is not possible to get the
52 // height of the indicator actor from Dali-Toolkit.
53 const Vector2 DEFAULT_POPUP_INDICATOR_OFFSET(0.0f, 60.0f);
55 const Vector3 POPUP_TEXT_OFFSET( 0.0f, 0.0f, 0.0f );
56 const Vector3 POPUP_TEXT_ENLARGE( 12.0f, 28.0f, 0.0f );
57 const Vector3 POPUP_MINIMUM_SIZE( 128.0f, 124.0f, 0.0f );
59 const Vector3 BUTTON_TEXT_ENLARGE( 32.0f, 0.0f, 0.0f );
60 const Vector3 BUTTON_TEXT_MINIMUM_SIZE( 128.0f, 126.0f, 0.0f );
61 const Vector3 BUTTON_TEXT_MAXIMUM_SIZE( 190.0f, 126.0f, 0.0f );
62 const Vector3 TEXT_LABEL_MAX_SIZE( 160.0f, 30.0f, 0.0f );
64 const float DIVIDER_WIDTH(2.0f); ///< Width of each button divider
65 const float DIVIDER_MARGIN(0.0f); ///< Top/Bottom Margin between divider and edge of popup.
67 const float DEFAULT_UI_FONT_SIZE(7.0f); ///< Standard font size for Text-Input's UI
69 const float HIDE_POPUP_ANIMATION_DURATION(0.2f); ///< Duration of popup hide animation in seconds.
70 const float SHOW_POPUP_ANIMATION_DURATION(0.2f); ///< Duration of popup show animation in seconds.
72 const Vector2 DEFAULT_ICON_SIZE( 45.0f, 45.0f ); ///< Default icon size for image in options
73 const float TEXT_POSITION_OFFSET( -19.0f ); ///< Default offset for text label
74 const float ICON_POSITION_OFFSET( 19.0f ); ///< Default offset for icon
76 const char* DEFAULT_ICON_CLIPBOARD( DALI_IMAGE_DIR "copy_paste_icon_clipboard.png" );
77 const char* DEFAULT_ICON_COPY( DALI_IMAGE_DIR "copy_paste_icon_copy.png" );
78 const char* DEFAULT_ICON_CUT( DALI_IMAGE_DIR "copy_paste_icon_cut.png" );
79 const char* DEFAULT_ICON_PASTE( DALI_IMAGE_DIR "copy_paste_icon_paste.png" );
80 const char* DEFAULT_ICON_SELECT( DALI_IMAGE_DIR "copy_paste_icon_select.png" );
81 const char* DEFAULT_ICON_SELECT_ALL( DALI_IMAGE_DIR "copy_paste_icon_select_all.png" );
83 // TODO: This should be based on the content for example:
84 // 1. For selection: should be above top of highlighted selection, or below bottom of highlighted selection + end handle.
85 // 2. For cursor: should be above top of cursor, or below bottom of cursor + grab handle.
86 const std::string POPUP_ALTERNATIVE_OFFSET("popup-alternative-offset"); ///< Alternative offset property for confinenment constraint.
90 * Confine Actor to boundaries of reference actor (e.g. Parent)
91 * Actor bounds (top-left position + size) are confined to reference Actor's
94 struct ConfinementConstraint
97 * Confinement constraint constructor.
98 * @param[in] topLeftMargin (optional) Top-Left margins (defaults to 0.0f, 0.0f)
99 * @param[in] bottomRightMargin (optional) Bottom-Right margins (defaults to 0.0f, 0.0f)
100 * @param[in] flipVertical (optional) whether to flip Actor to the other side if near edge, and by
101 * how much (defaults to 0.0f i.e. no flip)
103 ConfinementConstraint(Vector2 topLeftMargin = Vector2::ZERO, Vector2 bottomRightMargin = Vector2::ZERO, bool flipHorizontal = false, bool flipVertical = false)
104 : mMinIndent(topLeftMargin),
105 mMaxIndent(bottomRightMargin),
106 mFlipHorizontal(flipHorizontal),
107 mFlipVertical(flipVertical)
111 Vector3 operator()(const Vector3& constPosition,
112 const PropertyInput& sizeProperty,
113 const PropertyInput& parentOriginProperty,
114 const PropertyInput& anchorPointProperty,
115 const PropertyInput& referenceSizeProperty,
116 const PropertyInput& alternativeOffsetProperty)
118 const Vector3& size = sizeProperty.GetVector3();
119 const Vector3& origin = parentOriginProperty.GetVector3();
120 const Vector3& anchor = anchorPointProperty.GetVector3();
121 const Vector3& referenceSize = referenceSizeProperty.GetVector3();
122 const Vector2& alternativeOffset = alternativeOffsetProperty.GetVector2();
124 Vector3 newPosition(constPosition);
126 // Get actual position of Actor relative to parent's Top-Left.
127 Vector3 position(constPosition + origin * referenceSize);
129 // if top-left corner is outside of Top-Left bounds, then push back in screen.
130 Vector3 corner(position - size * anchor - mMinIndent);
132 if(mFlipHorizontal && corner.x < 0.0f)
135 newPosition.x += size.width + alternativeOffset.width;
138 if(mFlipVertical && corner.y < 0.0f)
141 newPosition.y += size.height + alternativeOffset.height;
144 newPosition.x -= std::min(corner.x, 0.0f);
145 newPosition.y -= std::min(corner.y, 0.0f);
147 // if bottom-right corner is outside of Bottom-Right bounds, then push back in screen.
148 corner += size - referenceSize + mMinIndent + mMaxIndent;
150 if(mFlipHorizontal && corner.x > 0.0f)
153 newPosition.x -= size.width + alternativeOffset.width;
156 if(mFlipVertical && corner.y > 0.0f)
159 newPosition.y -= size.height + alternativeOffset.height;
162 newPosition.x -= std::max(corner.x, 0.0f);
163 newPosition.y -= std::max(corner.y, 0.0f);
168 Vector3 mMinIndent; ///< Top-Left Margin
169 Vector3 mMaxIndent; ///< Bottom-Right Margin.
170 bool mFlipHorizontal; ///< Whether to flip actor's position if exceeds horizontal screen bounds
171 bool mFlipVertical; ///< Whether to flip actor's position if exceeds vertical screen bounds
174 } // unnamed namespace
185 const char* const TextInputPopup::SIGNAL_PRESSED = "pressed";
186 const char* const TextInputPopup::SIGNAL_HIDE_FINISHED = "hide-finished";
187 const char* const TextInputPopup::SIGNAL_SHOW_FINISHED = "show-finished";
189 const char* const TextInputPopup::OPTION_SELECT_WORD = "select_word"; // "Select Word" popup option.
190 const char* const TextInputPopup::OPTION_SELECT_ALL("select_all"); // "Select All" popup option.
191 const char* const TextInputPopup::OPTION_CUT("cut"); // "Cut" popup option.
192 const char* const TextInputPopup::OPTION_COPY("copy"); // "Copy" popup option.
193 const char* const TextInputPopup::OPTION_PASTE("paste"); // "Paste" popup option.
194 const char* const TextInputPopup::OPTION_CLIPBOARD("clipboard"); // "Clipboard" popup option.
196 TextInputPopup::TextInputPopup()
197 : mState(StateHidden),
198 mRootActor(Layer::New()),
199 mContentSize( Vector3::ZERO ),
200 mCutPasteButtonsColor( DEFAULT_POPUP_BACKGROUND ),
201 mCutPasteButtonsPressedColor( DEFAULT_POPUP_BUTTON_PRESSED ),
202 mBorderColor( DEFAULT_BORDER_COLOR ),
203 mSelectOptionPriority(1),
204 mSelectAllOptionPriority(2),
205 mCutOptionPriority(3),
206 mCopyOptionPriority(4),
207 mPasteOptionPriority(5),
208 mClipboardOptionPriority(6),
210 mHideFinishedSignal(),
211 mShowFinishedSignal()
213 mAlternativeOffsetProperty = mRootActor.RegisterProperty( POPUP_ALTERNATIVE_OFFSET, Vector2::ZERO );
214 mRootActor.SetParentOrigin( ParentOrigin::CENTER );
215 mRootActor.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
216 // constrain popup to size of parent.
219 Actor TextInputPopup::Self()
224 void TextInputPopup::AddToStage()
226 // TODO: Confinement constraint borders should be defined by the application.
227 // It should also not use the stage directly, instead it should add to parent container.
228 Stage::GetCurrent().Add(mRootActor);
230 ApplyConfinementConstraint();
233 void TextInputPopup::ApplyConfinementConstraint()
235 mRootActor.RemoveConstraints();
236 Constraint constraint = Constraint::New<Vector3>( Actor::POSITION,
237 LocalSource( Actor::SIZE ),
238 LocalSource( Actor::PARENT_ORIGIN ),
239 LocalSource( Actor::ANCHOR_POINT ),
240 ParentSource( Actor::SIZE ),
241 LocalSource( mAlternativeOffsetProperty ),
242 ConfinementConstraint( DEFAULT_POPUP_INDICATOR_OFFSET,
246 mRootActor.ApplyConstraint(constraint);
249 void TextInputPopup::RemoveFromStage()
251 Actor rootActor = Self();
252 Stage::GetCurrent().Remove( rootActor );
255 void TextInputPopup::Clear()
259 mRootActor.Remove( mBackground );
261 mButtonContainer.clear();
262 mDividerContainer.clear();
265 mRootActor.RemoveConstraints();
267 mState = StateHidden;
271 Toolkit::TextView TextInputPopup::CreateOptionText( const MarkupProcessor::StyledTextArray& styledCaption )
273 Toolkit::TextView label = Toolkit::TextView::New( styledCaption );
274 label.SetSizePolicy( Toolkit::Control::Fixed, Toolkit::Control::Fixed );
275 label.SetWidthExceedPolicy( Toolkit::TextView::Fade );
276 label.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
277 label.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
278 label.SetPosition( 0.0f, TEXT_POSITION_OFFSET );
283 ImageActor TextInputPopup::CreateOptionIcon( Image iconImage )
285 ImageActor icon = ImageActor::New( iconImage );
287 icon.SetSize( DEFAULT_ICON_SIZE );
288 icon.SetParentOrigin( ParentOrigin::TOP_CENTER );
289 icon.SetAnchorPoint( AnchorPoint::TOP_CENTER );
290 icon.SetPosition( 0.0f, ICON_POSITION_OFFSET );
295 void TextInputPopup::CreatePopUpBackground()
297 // Create background-panel if not already created (required if we have at least one option)
300 mBackground = Toolkit::CreateSolidColorActor( GetCutPastePopUpColor(), true, mBorderColor );
302 Self().Add( mBackground );
303 mContentSize = POPUP_TEXT_OFFSET;
309 Image tailImage = Image::New( DEFAULT_POPUP_TAIL_BOTTOM );
311 mTail = ImageActor::New( tailImage );
312 mTail.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
313 mTail.SetAnchorPoint( AnchorPoint::TOP_CENTER );
314 mBackground.Add( mTail );
315 // TODO: Make tail visible, and positioned in relation to original intended position of popup (i.e. before constrained effects)
316 mTail.SetVisible(false);
320 void TextInputPopup::CreateDivider()
322 if(mButtonContainer.size() > 0)
324 Image dividerImage = Image::New( DEFAULT_PANEL_BUTTON_DIVIDER );
325 ImageActor divider = ImageActor::New( dividerImage );
326 divider.SetParentOrigin( ParentOrigin::TOP_LEFT );
327 divider.SetAnchorPoint( AnchorPoint::TOP_LEFT );
328 divider.SetPosition( Vector3( mContentSize.width, POPUP_TEXT_OFFSET.y, 0.0f ) );
329 // Keep track of all the dividers. As their height's need to be updated to the max. of all
330 // buttons currently added.
331 mDividerContainer.push_back(divider);
333 mBackground.Add( divider );
334 mContentSize.width += DIVIDER_WIDTH;
338 ImageActor TextInputPopup::CreatePressedBackground( const Vector3 requiredSize )
340 std::string pressedImageFilename;
341 Vector4 pressedImageBorder;
342 Vector2 pressedImageSize;
344 ImageActor pressedButtonBg = Toolkit::CreateSolidColorActor( GetCutPastePopUpPressedColor() );
346 pressedButtonBg.SetSize ( requiredSize );
347 pressedButtonBg.SetParentOrigin( ParentOrigin::CENTER );
348 pressedButtonBg.SetAnchorPoint( AnchorPoint::CENTER );
350 return pressedButtonBg;
353 TextInputPopup::ButtonRequirement TextInputPopup::CreateRequiredButton( TextInputPopup::Buttons buttonId, std::size_t orderOfPriority,
354 const std::string& name, const std::string& caption, Image iconImage, bool enabled )
356 TextInputPopup::ButtonRequirement currentButton;
358 currentButton.buttonId = buttonId;
359 currentButton.orderOfPriority = orderOfPriority;
360 currentButton.name = name;
361 currentButton.caption = caption;
362 currentButton.iconImage = iconImage;
363 currentButton.enabled = enabled;
365 return currentButton;
368 void TextInputPopup::CreateOrderedListOfOptions()
370 mOrderListOfButtons.clear();
372 for ( std::size_t index= 0; index < ButtonsEnumEnd; index++ )
374 TextInputPopup::ButtonRequirement currentButton;
376 // Create button for each possible option using Option priority
381 Image cutIcon = Image::New( DEFAULT_ICON_CUT );
382 currentButton = CreateRequiredButton( ButtonsCut, mCutOptionPriority, OPTION_CUT, GET_LOCALE_TEXT("IDS_COM_BODY_CUT"), cutIcon, false );
387 Image copyIcon = Image::New( DEFAULT_ICON_COPY );
388 currentButton = CreateRequiredButton( ButtonsCopy, mCopyOptionPriority, OPTION_COPY, GET_LOCALE_TEXT("IDS_COM_BODY_COPY"), copyIcon, false );
393 Image pasteIcon = Image::New( DEFAULT_ICON_PASTE );
394 currentButton = CreateRequiredButton( ButtonsPaste, mPasteOptionPriority, OPTION_PASTE, GET_LOCALE_TEXT("IDS_COM_BODY_PASTE"), pasteIcon, false );
399 Image selectIcon = Image::New( DEFAULT_ICON_SELECT );
400 currentButton = CreateRequiredButton( ButtonsSelect, mSelectOptionPriority, OPTION_SELECT_WORD, GET_LOCALE_TEXT("IDS_COM_SK_SELECT"), selectIcon, false );
403 case ButtonsSelectAll:
405 Image selectAllIcon = Image::New( DEFAULT_ICON_SELECT_ALL );
406 currentButton = CreateRequiredButton( ButtonsSelectAll, mSelectAllOptionPriority, OPTION_SELECT_ALL, GET_LOCALE_TEXT("IDS_COM_BODY_SELECT_ALL"), selectAllIcon, false );
409 case ButtonsClipboard:
411 Image clipboardIcon = Image::New( DEFAULT_ICON_CLIPBOARD );
412 currentButton = CreateRequiredButton( ButtonsClipboard, mClipboardOptionPriority, OPTION_CLIPBOARD, GET_LOCALE_TEXT("IDS_COM_BODY_CLIPBOARD"), clipboardIcon, false );
417 DALI_ASSERT_DEBUG( "ButtonsEnumEnd used but an invalid choice");
418 currentButton.orderOfPriority = 0;
425 // Insert button in list of buttons in order of priority setting.
426 for( std::vector<ButtonRequirement>::iterator it = mOrderListOfButtons.begin(), endIt = mOrderListOfButtons.end(); ( it != endIt && !match ); ++it )
428 const ButtonRequirement& button( *it );
429 if ( currentButton.orderOfPriority < button.orderOfPriority )
431 if ( currentButton.orderOfPriority != 0 ) // If order priority 0 then do not add button as not required.
433 mOrderListOfButtons.insert( it, currentButton );
441 mOrderListOfButtons.push_back( currentButton );
446 void TextInputPopup::AddOption(const std::string& name, const std::string& caption, const Image iconImage, bool finalOption)
448 CreatePopUpBackground();
452 // Create a Button with Text, Icon and highlight when pressed
454 Toolkit::PushButton button = Toolkit::PushButton::New();
455 button.SetSizePolicy( Toolkit::Control::Fixed, Toolkit::Control::Fixed );
456 button.SetName( name );
458 // Create container for text and icon when not pressed
459 Actor iconTextContainer = Actor::New();
460 iconTextContainer.SetParentOrigin( ParentOrigin::TOP_LEFT );
461 iconTextContainer.SetAnchorPoint( AnchorPoint::TOP_LEFT );
465 style.SetFontPointSize( PointSize( DEFAULT_UI_FONT_SIZE ) );
466 MarkupProcessor::StyledTextArray styledCaption;
467 styledCaption.push_back( MarkupProcessor::StyledText( Text( caption ), style ) );
468 Toolkit::TextView label = CreateOptionText( styledCaption );
469 label.SetName( name );
471 iconTextContainer.Add( label );
473 // Get natural size of text and then constrain it to bounds.
474 const Vector3 textSize = label.GetNaturalSize();
475 const Vector3 constrainedTextSize = Min( textSize, TEXT_LABEL_MAX_SIZE );
476 Vector3 buttonSize( Max(constrainedTextSize + BUTTON_TEXT_ENLARGE, BUTTON_TEXT_MINIMUM_SIZE) );
477 buttonSize = ( Min(buttonSize, BUTTON_TEXT_MAXIMUM_SIZE) );
478 label.SetSize( Min( buttonSize + BUTTON_TEXT_ENLARGE, constrainedTextSize ) );
480 button.SetParentOrigin( ParentOrigin::TOP_LEFT );
481 button.SetAnchorPoint( AnchorPoint::TOP_LEFT );
482 button.SetSize( buttonSize );
483 button.SetPosition( Vector3( mContentSize.width, POPUP_BORDER.y, 0.0f ) );
486 ImageActor icon = CreateOptionIcon( iconImage );
488 iconTextContainer.Add( icon );
490 // 3. Add highlight - Pressed state in Pushbutton needs a new image which means creating the text and icon again but including a highlight this time.
491 ImageActor pressedImageBg = CreatePressedBackground( buttonSize );
493 Actor iconPressedTextContainer = Actor::New();
494 iconPressedTextContainer.SetDrawMode( DrawMode::OVERLAY );
496 Toolkit::TextView pressedLabel = CreateOptionText( styledCaption );
497 pressedLabel.SetSize( Min( buttonSize, TEXT_LABEL_MAX_SIZE ) );
498 ImageActor pressedIcon = CreateOptionIcon( iconImage );
500 iconPressedTextContainer.Add( pressedImageBg );
501 iconPressedTextContainer.Add( pressedLabel );
502 iconPressedTextContainer.Add( pressedIcon );
504 // Set Pressed button Image
505 iconPressedTextContainer.SetSize( buttonSize );
506 button.SetPressedImage( iconPressedTextContainer );
508 // Set Normal button Image
509 iconTextContainer.SetSize( buttonSize );
510 button.SetButtonImage( iconTextContainer );
511 mBackground.Add( button );
513 // Update content size (represents size of all content i.e. from top-left of first button, to bottom-right of last button)
514 mContentSize.width += buttonSize.width;
515 mContentSize.height = std::max(mContentSize.height + ( POPUP_BORDER.y ), buttonSize.height);
516 mButtonContainer.push_back(button);
518 // resize all dividers based on the height content (i.e. max of all button heights)
519 const float dividerHeight = mContentSize.height - DIVIDER_MARGIN;
520 for(ActorIter i = mDividerContainer.begin(); i != mDividerContainer.end(); ++i)
522 i->SetSize( DIVIDER_WIDTH, dividerHeight );
525 Vector3 popupSize( Max(mContentSize, POPUP_MINIMUM_SIZE) );
527 mBackground.SetSize( popupSize );
528 // Make Root Actor reflect the size of its content
529 mRootActor.SetSize( popupSize );
530 mTail.SetPosition(Vector3(0.0f, -20.0f, 0.0f));
532 button.ClickedSignal().Connect( this, &TextInputPopup::OnButtonPressed );
535 void TextInputPopup::Hide(bool animate)
547 mAnimation = Animation::New( HIDE_POPUP_ANIMATION_DURATION );
548 mAnimation.AnimateTo( Property(mBackground, Actor::SCALE), Vector3::ZERO, AlphaFunctions::EaseOut );
549 mAnimation.AnimateTo( Property(mBackground, Actor::COLOR_ALPHA), 0.0f, AlphaFunctions::EaseOut );
552 mAnimation.FinishedSignal().Connect( this, &TextInputPopup::OnHideFinished );
553 mState = StateHiding;
557 mBackground.SetProperty(Actor::SCALE, Vector3::ZERO);
558 mBackground.SetProperty(Actor::COLOR_ALPHA, 0.0f);
559 mState = StateHidden;
564 void TextInputPopup::Show(bool animate)
576 mAnimation = Animation::New( SHOW_POPUP_ANIMATION_DURATION );
577 mAnimation.AnimateTo( Property(mBackground, Actor::SCALE), Vector3::ONE, AlphaFunctions::EaseOut );
578 mAnimation.AnimateTo( Property(mBackground, Actor::COLOR_ALPHA), 1.0f, AlphaFunctions::EaseOut );
581 mAnimation.FinishedSignal().Connect( this, &TextInputPopup::OnShowFinished );
582 mState = StateShowing;
586 mBackground.SetProperty(Actor::SCALE, Vector3::ONE);
587 mBackground.SetProperty(Actor::COLOR_ALPHA, 1.0f);
593 void TextInputPopup::SetAlternativeOffset(Vector2 offset)
595 mRootActor.SetProperty( mAlternativeOffsetProperty, offset );
596 ApplyConfinementConstraint();
599 TextInputPopup::State TextInputPopup::GetState(void) const
604 Actor TextInputPopup::GetRootActor() const
611 void TextInputPopup::SetCutPastePopUpColor( const Vector4& color )
613 mCutPasteButtonsColor = color;
616 const Vector4& TextInputPopup::GetCutPastePopUpColor() const
618 return mCutPasteButtonsColor;
621 void TextInputPopup::SetCutPastePopUpPressedColor( const Vector4& color )
623 mCutPasteButtonsPressedColor = color;
626 const Vector4& TextInputPopup::GetCutPastePopUpPressedColor() const
628 return mCutPasteButtonsPressedColor;
631 void TextInputPopup::TogglePopUpButtonOnOff( TextInputPopup::Buttons requiredButton, bool enable )
633 bool match ( false );
634 for( std::vector<ButtonRequirement>::iterator it = mOrderListOfButtons.begin(), endIt = mOrderListOfButtons.end(); ( it != endIt && !match ); ++it )
636 ButtonRequirement& button( *it );
637 if ( requiredButton == button.buttonId )
639 button.enabled = enable;
645 void TextInputPopup::SetButtonPriorityPosition( TextInputPopup::Buttons button, unsigned int priority )
651 mCutOptionPriority = priority;
656 mCopyOptionPriority = priority;
661 mPasteOptionPriority = priority;
666 mSelectOptionPriority = priority;
669 case ButtonsSelectAll:
671 mSelectAllOptionPriority = priority;
674 case ButtonsClipboard:
676 mClipboardOptionPriority = priority;
681 DALI_ASSERT_DEBUG( "ButtonsEnumEnd used but an invalid choice");
685 CreateOrderedListOfOptions(); // Update list of options as priority changed.
688 unsigned int TextInputPopup::GetButtonPriorityPosition( TextInputPopup::Buttons button ) const
690 unsigned int priority = 0;
696 priority = mCutOptionPriority;
701 priority = mCopyOptionPriority;
706 priority = mPasteOptionPriority;
711 priority = mSelectOptionPriority;
714 case ButtonsSelectAll:
716 priority = mSelectAllOptionPriority;
719 case ButtonsClipboard:
721 priority = mClipboardOptionPriority;
726 DALI_ASSERT_DEBUG( "ButtonsEnumEnd used but an invalid choice");
734 void TextInputPopup::AddPopupOptions()
736 for( std::vector<ButtonRequirement>::const_iterator it = mOrderListOfButtons.begin(), endIt = mOrderListOfButtons.end(); ( it != endIt ); ++it )
738 const ButtonRequirement& button( *it );
739 if ( button.enabled )
741 AddOption( button.name, button.caption, button.iconImage, false );
747 bool TextInputPopup::OnButtonPressed( Toolkit::Button button )
749 mPressedSignal.Emit( button );
753 void TextInputPopup::OnHideFinished(Animation& source)
755 source.FinishedSignal().Disconnect( this, &TextInputPopup::OnHideFinished );
757 mState = StateHidden;
758 mHideFinishedSignal.Emit( *this );
761 void TextInputPopup::OnShowFinished(Animation& source)
763 source.FinishedSignal().Disconnect( this, &TextInputPopup::OnShowFinished );
765 mShowFinishedSignal.Emit( *this );
768 TextInputPopup::PressedSignalV2& TextInputPopup::PressedSignal()
770 return mPressedSignal;
773 TextInputPopup::HideFinishedSignalV2& TextInputPopup::HideFinishedSignal()
775 return mHideFinishedSignal;
778 TextInputPopup::ShowFinishedSignalV2& TextInputPopup::ShowFinishedSignal()
780 return mShowFinishedSignal;
783 } // namespace Internal
785 } // namespace Toolkit