public:
friend class RefCountObj<Item>;
Item(RefCountObjBase &rc,
- const ImageGrid &imageGrid, ElmWidget &parent) :
+ ImageGrid &imageGrid, ElmWidget &parent) :
RefCountAware(&rc),
m_imageGrid(imageGrid),
m_btn(elm_button_add(parent)),
m_btn.addEventHandler(BTN_CLICKED, WEAK_DELEGATE(
Item::onClicked, asWeak(*this)));
+ elm_atspi_accessible_gesture_cb_set(m_btn,
+ CALLBACK_A(Item::onAtspiGesture), this);
+
m_touchParser = makeShared<TouchParser>(m_btn);
m_touchParser->setDoubleTapHandler(
DELEGATE(Item::onDoubleTap, this));
DELEGATE(Item::onTapAndHold, this));
}
+ ~Item()
+ {
+ elm_atspi_accessible_gesture_cb_set(m_btn, nullptr, nullptr);
+ }
+
Widget &getWidget()
{
return m_btn;
}
}
+ Eina_Bool onAtspiGesture(Elm_Atspi_Gesture_Info gestureInfo,
+ Evas_Object *obj)
+ {
+ if (m_realizeIndex == -1) {
+ LOG_RETURN_VALUE(RES_ILLEGAL_STATE, EINA_FALSE,
+ "Item is not realized!");
+ }
+
+ const Elm_Atspi_Relation_Type relation =
+ getFlowRelation(gestureInfo);
+ if (relation == ELM_ATSPI_RELATION_NULL) {
+ return EINA_FALSE;
+ }
+
+ const int relationIndex =
+ ((relation == ELM_ATSPI_RELATION_FLOWS_TO) ?
+ (m_realizeIndex + 1) :
+ (m_realizeIndex - 1));
+
+ auto relationObject = m_imageGrid.getItemAtspi(relationIndex);
+ if (!relationObject) {
+ relationObject = m_btn.getEo();
+ }
+
+ elm_atspi_accessible_relationships_clear(m_btn);
+ elm_atspi_accessible_relationship_append(m_btn,
+ relation, relationObject);
+
+ return EINA_FALSE;
+ }
+
private:
- const ImageGrid &m_imageGrid;
+ ImageGrid &m_imageGrid;
StyledWidget m_btn;
StyledWidget m_image;
WidgetSRef m_bgImage;
m_items[itemOffset]->getInfo(info);
}
+ Elm_Interface_Atspi_Accessible *getItemAtspi(const int itemOffset)
+ {
+ return m_items[itemOffset]->getWidget().getEo();
+ }
+
private:
void setSelected(const int itemOffset, const bool selected)
{
});
}
+ Elm_Interface_Atspi_Accessible *ImageGrid::getAccessObject(
+ const bool isFlowsTo)
+ {
+ const int itemIndex = (isFlowsTo ? 0 : (m_itemCount - 1));
+ scrollToItem(itemIndex);
+ return getItemAtspi(itemIndex);
+ }
+
template <class FUNC>
Result ImageGrid::doWithItem(const int itemIndex, FUNC &&func) const
{
}
}
+ Elm_Interface_Atspi_Accessible *ImageGrid::getItemAtspi(const int itemIndex)
+ {
+ if ((itemIndex < 0) || (itemIndex >= m_itemCount)) {
+ if (m_listener) {
+ return m_listener->onAccessObjectRequest(
+ (itemIndex >= m_itemCount));
+ }
+ return nullptr;
+ }
+
+ Elm_Interface_Atspi_Accessible *result = nullptr;
+
+ FAIL_RETURN_VALUE(doWithItem(itemIndex,
+ [&result](Slot &slot, const int itemOffset)
+ {
+ result = slot.getItemAtspi(itemOffset);
+ return RES_OK;
+ }), nullptr, "Failed to get item Atspi!");
+
+ return result;
+ }
+
bool ImageGrid::updateSlotCount()
{
const int newSlotCount = calcSlotCount();