[Tizen][AT-SPI] Add Value::GetValueText()
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / atspi-interfaces / value.h
1 #ifndef DALI_ADAPTOR_ATSPI_VALUE_H
2 #define DALI_ADAPTOR_ATSPI_VALUE_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  */
19
20 // INTERNAL INCLUDES
21 #include <dali/devel-api/atspi-interfaces/accessible.h>
22
23 namespace Dali::Accessibility
24 {
25 /**
26  * @brief Interface representing objects which can store numeric value.
27  */
28 class DALI_ADAPTOR_API Value : public virtual Accessible
29 {
30 public:
31   /**
32    * @brief Gets the lowest possible value.
33    *
34    * @return The minimum value
35   */
36   virtual double GetMinimum() const = 0;
37
38   /**
39    * @brief Gets the current value.
40    *
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()
47    *
48    * @return The current value
49    *
50    * @see Value::GetMinimum()
51    * @see Value::GetMaximum()
52    * @see Value::GetValueText()
53    * @see Dali::Toolkit::DevelControl::AppendAccessibilityAttribute()
54   */
55   virtual double GetCurrent() const = 0;
56
57   /**
58    * @brief Gets the formatted current value.
59    *
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
62    * numeric value 10.0.
63    *
64    * @return The current value as text
65    *
66    * @note Only used if the "value_format" attribute is "text"
67    * @see Value::GetCurrent()
68    */
69   virtual std::string GetValueText() const = 0;
70
71   /**
72    * @brief Gets the highest possible value.
73    *
74    * @return The highest value.
75   */
76   virtual double GetMaximum() const = 0;
77
78   /**
79    * @brief Sets the current value.
80    *
81    * @param[in] value The current value to set
82    *
83    * @return true if value could have been assigned, false otherwise
84   */
85   virtual bool SetCurrent(double value) = 0;
86
87   /**
88    * @brief Gets the lowest increment that can be distinguished.
89    *
90    * @return The lowest increment
91   */
92   virtual double GetMinimumIncrement() const = 0;
93
94   /**
95    * @brief Downcasts an Accessible to a Value.
96    *
97    * @param obj The Accessible
98    * @return A Value or null
99    *
100    * @see Dali::Accessibility::Accessible::DownCast()
101    */
102   static inline Value* DownCast(Accessible* obj);
103 };
104
105 namespace Internal
106 {
107 template<>
108 struct AtspiInterfaceTypeHelper<AtspiInterface::VALUE>
109 {
110   using Type = Value;
111 };
112 } // namespace Internal
113
114 inline Value* Value::DownCast(Accessible* obj)
115 {
116   return Accessible::DownCast<AtspiInterface::VALUE>(obj);
117 }
118
119 } // namespace Dali::Accessibility
120
121 #endif // DALI_ADAPTOR_ATSPI_VALUE_H