/**
* @brief Gets the current value.
*
+ * The application may set the "value_format" attribute to one of the
+ * following values in order to customize what is read by the Screen Reader:
+ * 1. "percent" (the default) - GetCurrent() normalized as a percentage
+ * of the range [GetMinimum(), GetMaximum()],
+ * 2. "number" - GetCurrent() verbatim
+ * 3. "text" - GetValueText() is used instead of GetCurrent()
+ *
* @return The current value
+ *
+ * @see Value::GetMinimum()
+ * @see Value::GetMaximum()
+ * @see Value::GetValueText()
+ * @see Dali::Toolkit::DevelControl::AppendAccessibilityAttribute()
*/
virtual double GetCurrent() const = 0;
/**
+ * @brief Gets the formatted current value.
+ *
+ * This does not have to be GetCurrent() formatted in any particular way,
+ * i.e. it may be an arbitrary string, e.g. "small font size" for the
+ * numeric value 10.0.
+ *
+ * @return The current value as text
+ *
+ * @note Only used if the "value_format" attribute is "text"
+ * @see Value::GetCurrent()
+ */
+ virtual std::string GetValueText() const = 0;
+
+ /**
* @brief Gets the highest possible value.
*
* @return The highest value.
auto describedByObject = findObjectByRelationType(RelationType::DESCRIBED_BY);
- double currentValue = 0.0;
- double minimumIncrement = 0.0;
- double maximumValue = 0.0;
- double minimumValue = 0.0;
- auto* valueInterface = Value::DownCast(self);
+ double currentValue = 0.0;
+ std::string currentValueText;
+ double minimumIncrement = 0.0;
+ double maximumValue = 0.0;
+ double minimumValue = 0.0;
+ auto* valueInterface = Value::DownCast(self);
if(valueInterface)
{
currentValue = valueInterface->GetCurrent();
+ currentValueText = valueInterface->GetValueText();
minimumIncrement = valueInterface->GetMinimumIncrement();
maximumValue = valueInterface->GetMaximum();
minimumValue = valueInterface->GetMinimum();
localizedRoleName,
childCount,
currentValue,
+ currentValueText,
minimumIncrement,
maximumValue,
minimumValue,
std::string, // localized name
int32_t, // child count
double, // current value
+ std::string, // formatted current value
double, // minimum increment
double, // maximum value
double, // minimum value
{
DBus::DBusInterfaceDescription desc{Accessible::GetInterfaceName(AtspiInterface::VALUE)};
AddGetSetPropertyToInterface(desc, "CurrentValue", &BridgeValue::GetCurrentValue, &BridgeValue::SetCurrentValue);
+ AddGetPropertyToInterface(desc, "Text", &BridgeValue::GetCurrentValueText);
AddGetPropertyToInterface(desc, "MaximumValue", &BridgeValue::GetMaximumValue);
AddGetPropertyToInterface(desc, "MinimumIncrement", &BridgeValue::GetMinimumIncrement);
AddGetPropertyToInterface(desc, "MinimumValue", &BridgeValue::GetMinimumValue);
FindSelf()->SetCurrent(newValue);
}
+std::string BridgeValue::GetCurrentValueText()
+{
+ return FindSelf()->GetValueText();
+}
+
double BridgeValue::GetMaximumValue()
{
return FindSelf()->GetMaximum();
void SetCurrentValue(double newValue);
/**
+ * @copydoc Dali::Accessibility::Value::GetValueText()
+ */
+ std::string GetCurrentValueText();
+
+ /**
* @copydoc Dali::Accessibility::Value::GetMaximum()
*/
double GetMaximumValue();