1 #ifndef DALI_ADAPTOR_ATSPI_VALUE_H
2 #define DALI_ADAPTOR_ATSPI_VALUE_H
5 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
21 #include <dali/devel-api/atspi-interfaces/accessible.h>
23 namespace Dali::Accessibility
26 * @brief Interface representing objects which can store numeric value.
28 class DALI_ADAPTOR_API Value : public virtual Accessible
32 * @brief Gets the lowest possible value.
34 * @return The minimum value
36 virtual double GetMinimum() const = 0;
39 * @brief Gets the current value.
41 * The application may set the "value_format" attribute to one of the
42 * following values in order to customize what is read by the Screen Reader:
43 * 1. "percent" (the default) - GetCurrent() normalized as a percentage
44 * of the range [GetMinimum(), GetMaximum()],
45 * 2. "number" - GetCurrent() verbatim
46 * 3. "text" - GetValueText() is used instead of GetCurrent()
48 * @return The current value
50 * @see Value::GetMinimum()
51 * @see Value::GetMaximum()
52 * @see Value::GetValueText()
53 * @see Dali::Toolkit::DevelControl::AppendAccessibilityAttribute()
55 virtual double GetCurrent() const = 0;
58 * @brief Gets the formatted current value.
60 * This does not have to be GetCurrent() formatted in any particular way,
61 * i.e. it may be an arbitrary string, e.g. "small font size" for the
64 * @return The current value as text
66 * @note Only used if the "value_format" attribute is "text"
67 * @see Value::GetCurrent()
69 virtual std::string GetValueText() const = 0;
72 * @brief Gets the highest possible value.
74 * @return The highest value.
76 virtual double GetMaximum() const = 0;
79 * @brief Sets the current value.
81 * @param[in] value The current value to set
83 * @return true if value could have been assigned, false otherwise
85 virtual bool SetCurrent(double value) = 0;
88 * @brief Gets the lowest increment that can be distinguished.
90 * @return The lowest increment
92 virtual double GetMinimumIncrement() const = 0;
95 * @brief Downcasts an Accessible to a Value.
97 * @param obj The Accessible
98 * @return A Value or null
100 * @see Dali::Accessibility::Accessible::DownCast()
102 static inline Value* DownCast(Accessible* obj);
108 struct AtspiInterfaceTypeHelper<AtspiInterface::VALUE>
112 } // namespace Internal
114 inline Value* Value::DownCast(Accessible* obj)
116 return Accessible::DownCast<AtspiInterface::VALUE>(obj);
119 } // namespace Dali::Accessibility
121 #endif // DALI_ADAPTOR_ATSPI_VALUE_H