virtual bool SetTextContents(std::string newContents) = 0;
};
+/**
+ * @brief Interface representing objects which can store a set of selected items
+ */
+class DALI_ADAPTOR_API Selection : public virtual Accessible
+{
+public:
+ /**
+ * @brief Gets number of selected children
+ *
+ * @return number of selected children (zero if none)
+ */
+ virtual int GetSelectedChildrenCount() = 0;
+
+ /**
+ * @brief Gets a specific selected child
+ *
+ * @param selectedChildIndex index of the selected child
+ *
+ * @note @p selectedChildIndex refers to the list of selected children,
+ * not the list of all children
+ *
+ * @return selected child or nullptr if index is invalid
+ */
+ virtual Accessible* GetSelectedChild(int selectedChildIndex) = 0;
+
+ /**
+ * @brief Selects a child
+ *
+ * @param childIndex index of the child
+ *
+ * @return true on success, false otherwise
+ */
+ virtual bool SelectChild(int childIndex) = 0;
+
+ /**
+ * @brief Deselects a selected child
+ *
+ * @param selectedChildIndex index of the selected child
+ *
+ * @note @p selectedChildIndex refers to the list of selected children,
+ * not the list of all children
+ *
+ * @return true on success, false otherwise
+ *
+ * @see Dali::Accessibility::Selection::DeselectChild
+ */
+ virtual bool DeselectSelectedChild(int selectedChildIndex) = 0;
+
+ /**
+ * @brief Checks whether a child is selected
+ *
+ * @param childIndex index of the child
+ *
+ * @return true if given child is selected, false otherwise
+ */
+ virtual bool IsChildSelected(int childIndex) = 0;
+
+ /**
+ * @brief Selects all children
+ *
+ * @return true on success, false otherwise
+ */
+ virtual bool SelectAll() = 0;
+
+ /**
+ * @brief Deselects all children
+ *
+ * @return true on success, false otherwise
+ */
+ virtual bool ClearSelection() = 0;
+
+ /**
+ * @brief Deselects a child
+ *
+ * @param childIndex index of the child
+ *
+ * @return true on success, false otherwise
+ *
+ * @see Dali::Accessibility::Selection::DeselectSelectedChild
+ */
+ virtual bool DeselectChild(int childIndex) = 0;
+};
+
/**
* @brief minimalistic, always empty Accessible object with settable address
*
tmp.push_back(AtspiDbusInterfaceAction);
}
}
+ if(dynamic_cast<Selection*>(this))
+ {
+ tmp.push_back(AtspiDbusInterfaceSelection);
+ }
return tmp;
}
#include <dali/internal/accessibility/bridge/bridge-component.h>
#include <dali/internal/accessibility/bridge/bridge-editable-text.h>
#include <dali/internal/accessibility/bridge/bridge-object.h>
+#include <dali/internal/accessibility/bridge/bridge-selection.h>
#include <dali/internal/accessibility/bridge/bridge-text.h>
#include <dali/internal/accessibility/bridge/bridge-value.h>
#include <dali/internal/accessibility/bridge/dummy-atspi.h>
public BridgeAction,
public BridgeValue,
public BridgeText,
- public BridgeEditableText
+ public BridgeEditableText,
+ public BridgeSelection
{
DBus::DBusClient listenOnAtspiEnabledSignalClient;
DBus::DBusClient registryClient, directReadingClient;
BridgeValue::RegisterInterfaces();
BridgeText::RegisterInterfaces();
BridgeEditableText::RegisterInterfaces();
+ BridgeSelection::RegisterInterfaces();
RegisterOnBridge(&application);
--- /dev/null
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/accessibility/bridge/bridge-selection.h>
+
+using namespace Dali::Accessibility;
+
+void BridgeSelection::RegisterInterfaces()
+{
+ DBus::DBusInterfaceDescription desc{AtspiDbusInterfaceSelection};
+ AddGetPropertyToInterface(desc, "NSelectedChildren", &BridgeSelection::GetSelectedChildrenCount);
+ AddFunctionToInterface(desc, "GetSelectedChild", &BridgeSelection::GetSelectedChild);
+ AddFunctionToInterface(desc, "SelectChild", &BridgeSelection::SelectChild);
+ AddFunctionToInterface(desc, "DeselectSelectedChild", &BridgeSelection::DeselectSelectedChild);
+ AddFunctionToInterface(desc, "IsChildSelected", &BridgeSelection::IsChildSelected);
+ AddFunctionToInterface(desc, "SelectAll", &BridgeSelection::SelectAll);
+ AddFunctionToInterface(desc, "ClearSelection", &BridgeSelection::ClearSelection);
+ AddFunctionToInterface(desc, "DeselectChild", &BridgeSelection::DeselectChild);
+ dbusServer.addInterface("/", desc, true);
+}
+
+Selection* BridgeSelection::FindSelf() const
+{
+ auto s = BridgeBase::FindSelf();
+ assert(s);
+ auto s2 = dynamic_cast<Selection*>(s);
+ if(!s2)
+ throw std::domain_error{"object " + s->GetAddress().ToString() + " doesn't have Selection interface"};
+ return s2;
+}
+
+DBus::ValueOrError<int32_t> BridgeSelection::GetSelectedChildrenCount()
+{
+ return FindSelf()->GetSelectedChildrenCount();
+}
+
+DBus::ValueOrError<Dali::Accessibility::Accessible*> BridgeSelection::GetSelectedChild(int32_t selectedChildIndex)
+{
+ return FindSelf()->GetSelectedChild(selectedChildIndex);
+}
+
+DBus::ValueOrError<bool> BridgeSelection::SelectChild(int32_t childIndex)
+{
+ return FindSelf()->SelectChild(childIndex);
+}
+
+DBus::ValueOrError<bool> BridgeSelection::DeselectSelectedChild(int32_t selectedChildIndex)
+{
+ return FindSelf()->DeselectSelectedChild(selectedChildIndex);
+}
+
+DBus::ValueOrError<bool> BridgeSelection::IsChildSelected(int32_t childIndex)
+{
+ return FindSelf()->IsChildSelected(childIndex);
+}
+
+DBus::ValueOrError<bool> BridgeSelection::SelectAll()
+{
+ return FindSelf()->SelectAll();
+}
+
+DBus::ValueOrError<bool> BridgeSelection::ClearSelection()
+{
+ return FindSelf()->ClearSelection();
+}
+
+DBus::ValueOrError<bool> BridgeSelection::DeselectChild(int32_t childIndex)
+{
+ return FindSelf()->DeselectChild(childIndex);
+}
--- /dev/null
+#ifndef DALI_INTERNAL_ACCESSIBILITY_BRIDGE_SELECTION_H
+#define DALI_INTERNAL_ACCESSIBILITY_BRIDGE_SELECTION_H
+
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/internal/accessibility/bridge/bridge-base.h>
+
+class BridgeSelection : public virtual BridgeBase
+{
+protected:
+ BridgeSelection() = default;
+
+ void RegisterInterfaces();
+
+ Dali::Accessibility::Selection* FindSelf() const;
+
+public:
+ DBus::ValueOrError<int32_t> GetSelectedChildrenCount();
+ DBus::ValueOrError<Dali::Accessibility::Accessible*> GetSelectedChild(int32_t selectedChildIndex);
+ DBus::ValueOrError<bool> SelectChild(int32_t childIndex);
+ DBus::ValueOrError<bool> DeselectSelectedChild(int32_t selectedChildIndex);
+ DBus::ValueOrError<bool> IsChildSelected(int32_t childIndex);
+ DBus::ValueOrError<bool> SelectAll();
+ DBus::ValueOrError<bool> ClearSelection();
+ DBus::ValueOrError<bool> DeselectChild(int32_t childIndex);
+};
+
+#endif // DALI_INTERNAL_ACCESSIBILITY_BRIDGE_SELECTION_H
${adaptor_accessibility_dir}/bridge/bridge-editable-text.cpp
${adaptor_accessibility_dir}/bridge/bridge-impl.cpp
${adaptor_accessibility_dir}/bridge/bridge-object.cpp
+ ${adaptor_accessibility_dir}/bridge/bridge-selection.cpp
${adaptor_accessibility_dir}/bridge/bridge-text.cpp
${adaptor_accessibility_dir}/bridge/bridge-value.cpp
${adaptor_accessibility_dir}/bridge/component.cpp