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_CORNER_RADIUS:
105 impl.mPressedCornerRadius = value.Get<float>();
108 case Toolkit::TextSelectionPopup::Property::POPUP_PRESSED_IMAGE:
110 impl.SetPressedImage(value.Get<std::string>());
113 case Toolkit::TextSelectionPopup::Property::POPUP_FADE_IN_DURATION:
115 impl.mFadeInDuration = value.Get<float>();
118 case Toolkit::TextSelectionPopup::Property::POPUP_FADE_OUT_DURATION:
120 impl.mFadeOutDuration = value.Get<float>();
123 case Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER:
125 Property::Map map = value.Get<Property::Map>();
126 impl.CreateBackgroundBorder(map);
129 case Toolkit::TextSelectionPopup::Property::BACKGROUND:
131 Property::Map map = value.Get<Property::Map>();
132 impl.CreateBackground(map);
135 case Toolkit::TextSelectionPopup::Property::LABEL_MINIMUM_SIZE:
137 impl.mLabelMinimumSize = value.Get<Vector2>();
140 case Toolkit::TextSelectionPopup::Property::LABEL_PADDING:
142 Vector4 padding(value.Get<Vector4>());
143 impl.SetLabelPadding(Padding(padding.x, padding.y, padding.z, padding.w));
146 case Toolkit::TextSelectionPopup::Property::LABEL_TEXT_VISUAL:
148 impl.mLabelTextVisual = value.Get<Property::Map>();
151 case Toolkit::TextSelectionPopup::Property::ENABLE_SCROLL_BAR:
153 impl.mEnableScrollBar = value.Get<bool>();
159 Property::Value TextSelectionPopup::PropertyHandler::GetProperty(Toolkit::TextSelectionPopup selectionPopup, Property::Index index)
161 Property::Value value;
162 TextSelectionPopup& impl(GetImpl(selectionPopup));
166 case Toolkit::TextSelectionPopup::Property::POPUP_MAX_SIZE:
168 value = impl.GetDimensionToCustomise(POPUP_MAXIMUM_SIZE);
171 case Toolkit::TextSelectionPopup::Property::OPTION_MAX_SIZE:
173 value = impl.GetDimensionToCustomise(OPTION_MAXIMUM_SIZE);
176 case Toolkit::TextSelectionPopup::Property::OPTION_MIN_SIZE:
178 value = impl.GetDimensionToCustomise(OPTION_MINIMUM_SIZE);
181 case Toolkit::TextSelectionPopup::Property::OPTION_DIVIDER_SIZE:
183 value = impl.GetDimensionToCustomise(OPTION_DIVIDER_SIZE);
186 case Toolkit::TextSelectionPopup::Property::OPTION_DIVIDER_PADDING:
188 Padding padding = impl.GetOptionDividerPadding();
189 value = Vector4(padding.left, padding.right, padding.top, padding.bottom);
192 case Toolkit::TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE:
194 value = impl.GetButtonImage(Toolkit::TextSelectionPopup::CLIPBOARD);
197 case Toolkit::TextSelectionPopup::Property::POPUP_CUT_BUTTON_ICON_IMAGE:
199 value = impl.GetButtonImage(Toolkit::TextSelectionPopup::CUT);
202 case Toolkit::TextSelectionPopup::Property::POPUP_COPY_BUTTON_ICON_IMAGE:
204 value = impl.GetButtonImage(Toolkit::TextSelectionPopup::COPY);
207 case Toolkit::TextSelectionPopup::Property::POPUP_PASTE_BUTTON_ICON_IMAGE:
209 value = impl.GetButtonImage(Toolkit::TextSelectionPopup::PASTE);
212 case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_BUTTON_ICON_IMAGE:
214 value = impl.GetButtonImage(Toolkit::TextSelectionPopup::SELECT);
217 case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_ALL_BUTTON_ICON_IMAGE:
219 value = impl.GetButtonImage(Toolkit::TextSelectionPopup::SELECT_ALL);
222 case Toolkit::TextSelectionPopup::Property::POPUP_DIVIDER_COLOR:
224 value = impl.mDividerColor;
227 case Toolkit::TextSelectionPopup::Property::POPUP_ICON_COLOR:
229 value = impl.mIconColor;
232 case Toolkit::TextSelectionPopup::Property::POPUP_PRESSED_COLOR:
234 value = impl.mPressedColor;
237 case Toolkit::TextSelectionPopup::Property::POPUP_PRESSED_CORNER_RADIUS:
239 value = impl.mPressedCornerRadius;
242 case Toolkit::TextSelectionPopup::Property::POPUP_PRESSED_IMAGE:
244 value = impl.GetPressedImage();
247 case Toolkit::TextSelectionPopup::Property::POPUP_FADE_IN_DURATION:
249 value = impl.mFadeInDuration;
252 case Toolkit::TextSelectionPopup::Property::POPUP_FADE_OUT_DURATION:
254 value = impl.mFadeOutDuration;
257 case Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER:
260 Toolkit::Visual::Base visual = DevelControl::GetVisual(impl, Toolkit::TextSelectionPopup::Property::BACKGROUND_BORDER);
263 visual.CreatePropertyMap(map);
268 case Toolkit::TextSelectionPopup::Property::BACKGROUND:
271 Toolkit::Visual::Base visual = DevelControl::GetVisual(impl, Toolkit::Control::Property::BACKGROUND);
274 visual.CreatePropertyMap(map);
279 case Toolkit::TextSelectionPopup::Property::LABEL_MINIMUM_SIZE:
281 value = impl.mLabelMinimumSize;
284 case Toolkit::TextSelectionPopup::Property::LABEL_PADDING:
286 Padding padding = impl.GetLabelPadding();
287 value = Vector4(padding.left, padding.right, padding.top, padding.bottom);
290 case Toolkit::TextSelectionPopup::Property::LABEL_TEXT_VISUAL:
292 value = impl.mLabelTextVisual;
295 case Toolkit::TextSelectionPopup::Property::ENABLE_SCROLL_BAR:
297 value = impl.mEnableScrollBar;
305 } // namespace Dali::Toolkit::Internal