2 * Copyright (c) 2022 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.
17 #include <dali-toolkit/internal/controls/text-controls/text-selection-popup-property-handler.h>
18 #include <dali/integration-api/debug.h>
20 #if defined(DEBUG_ENABLED)
21 extern Debug::Filter* gLogFilter;
24 namespace Dali::Toolkit::Internal
26 void TextSelectionPopup::PropertyHandler::SetProperty(Toolkit::TextSelectionPopup selectionPopup, Property::Index index, const Property::Value& value)
28 TextSelectionPopup& impl(GetImpl(selectionPopup));
32 case Toolkit::TextSelectionPopup::Property::POPUP_MAX_SIZE:
34 impl.SetDimensionToCustomise(POPUP_MAXIMUM_SIZE, value.Get<Vector2>());
37 case Toolkit::TextSelectionPopup::Property::OPTION_MAX_SIZE:
39 impl.SetDimensionToCustomise(OPTION_MAXIMUM_SIZE, value.Get<Vector2>());
42 case Toolkit::TextSelectionPopup::Property::OPTION_MIN_SIZE:
44 impl.SetDimensionToCustomise(OPTION_MINIMUM_SIZE, value.Get<Vector2>());
47 case Toolkit::TextSelectionPopup::Property::OPTION_DIVIDER_SIZE:
49 impl.SetDimensionToCustomise(OPTION_DIVIDER_SIZE, value.Get<Vector2>());
52 case Toolkit::TextSelectionPopup::Property::OPTION_DIVIDER_PADDING:
54 Vector4 padding(value.Get<Vector4>());
55 impl.SetOptionDividerPadding(Padding(padding.x, padding.y, padding.z, padding.w));
58 case Toolkit::TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE:
60 impl.SetButtonImage(Toolkit::TextSelectionPopup::CLIPBOARD, value.Get<std::string>());
63 case Toolkit::TextSelectionPopup::Property::POPUP_CUT_BUTTON_ICON_IMAGE:
65 impl.SetButtonImage(Toolkit::TextSelectionPopup::CUT, value.Get<std::string>());
68 case Toolkit::TextSelectionPopup::Property::POPUP_COPY_BUTTON_ICON_IMAGE:
70 impl.SetButtonImage(Toolkit::TextSelectionPopup::COPY, value.Get<std::string>());
73 case Toolkit::TextSelectionPopup::Property::POPUP_PASTE_BUTTON_ICON_IMAGE:
75 impl.SetButtonImage(Toolkit::TextSelectionPopup::PASTE, value.Get<std::string>());
78 case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_BUTTON_ICON_IMAGE:
80 impl.SetButtonImage(Toolkit::TextSelectionPopup::SELECT, value.Get<std::string>());
83 case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_ALL_BUTTON_ICON_IMAGE:
85 impl.SetButtonImage(Toolkit::TextSelectionPopup::SELECT_ALL, value.Get<std::string>());
88 case Toolkit::TextSelectionPopup::Property::POPUP_DIVIDER_COLOR:
90 impl.mDividerColor = value.Get<Vector4>();
93 case Toolkit::TextSelectionPopup::Property::POPUP_ICON_COLOR:
95 impl.mIconColor = value.Get<Vector4>();
98 case Toolkit::TextSelectionPopup::Property::POPUP_PRESSED_COLOR:
100 impl.mPressedColor = value.Get<Vector4>();
103 case Toolkit::TextSelectionPopup::Property::POPUP_PRESSED_IMAGE:
105 impl.SetPressedImage(value.Get<std::string>());
108 case Toolkit::TextSelectionPopup::Property::POPUP_FADE_IN_DURATION:
110 impl.mFadeInDuration = value.Get<float>();
113 case Toolkit::TextSelectionPopup::Property::POPUP_FADE_OUT_DURATION:
115 impl.mFadeOutDuration = value.Get<float>();
118 case Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER:
120 Property::Map map = value.Get<Property::Map>();
121 impl.CreateBackgroundBorder(map);
127 Property::Value TextSelectionPopup::PropertyHandler::GetProperty(Toolkit::TextSelectionPopup selectionPopup, Property::Index index)
129 Property::Value value;
130 TextSelectionPopup& impl(GetImpl(selectionPopup));
134 case Toolkit::TextSelectionPopup::Property::POPUP_MAX_SIZE:
136 value = impl.GetDimensionToCustomise(POPUP_MAXIMUM_SIZE);
139 case Toolkit::TextSelectionPopup::Property::OPTION_MAX_SIZE:
141 value = impl.GetDimensionToCustomise(OPTION_MAXIMUM_SIZE);
144 case Toolkit::TextSelectionPopup::Property::OPTION_MIN_SIZE:
146 value = impl.GetDimensionToCustomise(OPTION_MINIMUM_SIZE);
149 case Toolkit::TextSelectionPopup::Property::OPTION_DIVIDER_SIZE:
151 value = impl.GetDimensionToCustomise(OPTION_DIVIDER_SIZE);
154 case Toolkit::TextSelectionPopup::Property::OPTION_DIVIDER_PADDING:
156 Padding padding = impl.GetOptionDividerPadding();
157 value = Vector4(padding.left, padding.right, padding.top, padding.bottom);
160 case Toolkit::TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE:
162 value = impl.GetButtonImage(Toolkit::TextSelectionPopup::CLIPBOARD);
165 case Toolkit::TextSelectionPopup::Property::POPUP_CUT_BUTTON_ICON_IMAGE:
167 value = impl.GetButtonImage(Toolkit::TextSelectionPopup::CUT);
170 case Toolkit::TextSelectionPopup::Property::POPUP_COPY_BUTTON_ICON_IMAGE:
172 value = impl.GetButtonImage(Toolkit::TextSelectionPopup::COPY);
175 case Toolkit::TextSelectionPopup::Property::POPUP_PASTE_BUTTON_ICON_IMAGE:
177 value = impl.GetButtonImage(Toolkit::TextSelectionPopup::PASTE);
180 case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_BUTTON_ICON_IMAGE:
182 value = impl.GetButtonImage(Toolkit::TextSelectionPopup::SELECT);
185 case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_ALL_BUTTON_ICON_IMAGE:
187 value = impl.GetButtonImage(Toolkit::TextSelectionPopup::SELECT_ALL);
190 case Toolkit::TextSelectionPopup::Property::POPUP_DIVIDER_COLOR:
192 value = impl.mDividerColor;
195 case Toolkit::TextSelectionPopup::Property::POPUP_ICON_COLOR:
197 value = impl.mIconColor;
200 case Toolkit::TextSelectionPopup::Property::POPUP_PRESSED_COLOR:
202 value = impl.mPressedColor;
205 case Toolkit::TextSelectionPopup::Property::POPUP_PRESSED_IMAGE:
207 value = impl.GetPressedImage();
210 case Toolkit::TextSelectionPopup::Property::POPUP_FADE_IN_DURATION:
212 value = impl.mFadeInDuration;
215 case Toolkit::TextSelectionPopup::Property::POPUP_FADE_OUT_DURATION:
217 value = impl.mFadeOutDuration;
220 case Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER:
223 Toolkit::Visual::Base visual = DevelControl::GetVisual(impl, Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER);
226 visual.CreatePropertyMap(map);
236 } // namespace Dali::Toolkit::Internal