- void TextSelectionPopup::CreateOrderedListOfPopupOptions()
- {
- mOrderListOfButtons.clear();
- mOrderListOfButtons.reserve( 8u );
-
- // Create button for each possible option using Option priority
- mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::CUT, mCutOptionPriority, OPTION_CUT, POPUP_CUT_STRING , mCutIconImage, 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::CUT) ) );
- mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::COPY, mCopyOptionPriority, OPTION_COPY, POPUP_COPY_STRING, mCopyIconImage, 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::COPY) ) );
- mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::PASTE, mPasteOptionPriority, OPTION_PASTE, POPUP_PASTE_STRING, mPasteIconImage, 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::PASTE) ) );
- mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::SELECT, mSelectOptionPriority, OPTION_SELECT_WORD, POPUP_SELECT_STRING, mSelectIconImage, 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::SELECT) ) );
- mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::SELECT_ALL, mSelectAllOptionPriority, OPTION_SELECT_ALL, POPUP_SELECT_ALL_STRING, mSelectAllIconImage, 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::SELECT_ALL) ) );
- mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::CLIPBOARD, mClipboardOptionPriority, OPTION_CLIPBOARD, POPUP_CLIPBOARD_STRING, mClipboardIconImage, 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::CLIPBOARD) ) );
-
- // Sort the buttons according their priorities.
- std::sort( mOrderListOfButtons.begin(), mOrderListOfButtons.end(), TextSelectionPopup::ButtonPriorityCompare() );
- }
-
- void TextSelectionPopup::AddOption( const ButtonRequirement& button, bool showDivider, bool showIcons, bool showCaption )
- {
- // 1. Create a option.
- DALI_LOG_INFO( gLogFilter, Debug::General, "TextSelectionPopup::AddOption\n" );
-
- Toolkit::PushButton option = Toolkit::PushButton::New();
- option.SetName( button.name );
- option.SetAnimationTime( 0.0f );
- option.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS );
-
- switch( button.id )
- {
- case Toolkit::TextSelectionPopup::CUT:
- {
- option.ClickedSignal().Connect( this, &TextSelectionPopup::OnCutButtonPressed );
- break;
- }
- case Toolkit::TextSelectionPopup::COPY:
- {
- option.ClickedSignal().Connect( this, &TextSelectionPopup::OnCopyButtonPressed );
- break;
- }
- case Toolkit::TextSelectionPopup::PASTE:
- {
- option.ClickedSignal().Connect( this, &TextSelectionPopup::OnPasteButtonPressed );
- break;
- }
- case Toolkit::TextSelectionPopup::SELECT:
- {
- option.ClickedSignal().Connect( this, &TextSelectionPopup::OnSelectButtonPressed );
- break;
- }
- case Toolkit::TextSelectionPopup::SELECT_ALL:
- {
- option.ClickedSignal().Connect( this, &TextSelectionPopup::OnSelectAllButtonPressed );
- break;
- }
- case Toolkit::TextSelectionPopup::CLIPBOARD:
- {
- option.ClickedSignal().Connect( this, &TextSelectionPopup::OnClipboardButtonPressed );
- break;
- }
- case Toolkit::TextSelectionPopup::NONE:
- {
- // Nothing to do:
- break;
- }
- }
-
- // 2. Set the options contents.
- if( showCaption )
- {
- // PushButton layout properties.
- option.SetProperty( Toolkit::PushButton::Property::LABEL_PADDING, Vector4( 24.0f, 24.0f, 14.0f, 14.0f ) );
-
- // Label properties.
- Property::Map buttonLabelProperties;
- buttonLabelProperties.Insert( "text", button.caption );
- option.SetProperty( Toolkit::Button::Property::LABEL, buttonLabelProperties );
- }
- if( showIcons )
- {
- option.SetProperty( Toolkit::PushButton::Property::ICON_PADDING, Vector4( 10.0f, 10.0f, 10.0f, 10.0f ) );
- option.SetProperty( Toolkit::PushButton::Property::ICON_ALIGNMENT, "TOP" );
-
- // TODO: This is temporarily disabled until the text-selection-popup image API is changed to strings.
- //option.SetProperty( Toolkit::PushButton::Property::SELECTED_ICON, button.icon );
- //option.SetProperty( Toolkit::PushButton::Property::UNSELECTED_ICON, button.icon );
- }
-
- // 3. Set the normal option image (blank / Transparent).
- option.SetUnselectedImage( "" );
-
- // 4. Set the pressed option image.
- // The image can be blank, the color can be used regardless.
- option.SetSelectedImage( mPressedImage );
- option.SetProperty( Toolkit::Button::Property::SELECTED_COLOR, mPressedColor );
- option.SetProperty( Toolkit::Control::Property::STYLE_NAME, TEXT_SELECTION_POPUP_BUTTON_STYLE_NAME );
-
- // 5 Add option to tool bar
- mToolbar.AddOption( option );
-
- // 6. Add the divider
- if( showDivider )
- {
- const Size size( mOptionDividerSize.width, 0.0f ); // Height FILL_TO_PARENT
-
- Toolkit::Control divider = Toolkit::Control::New();