virtual int calcMaxSlotCount(const int itemCount) const = 0;
- virtual int calcExtraPaddingSize(const int slotSize,
- const int itemCount) const
+ virtual int calcExtraPaddingSize(const int slotSize) const
{
return 0;
}
return ((itemCount + (totalLength - 1)) / totalLength * 2);
}
- virtual int calcExtraPaddingSize(const int slotSize,
- const int itemCount) const final override
+ virtual int calcExtraPaddingSize(
+ const int slotSize) const final override
{
return slotSize;
}
(m_realizeIndex + 1) :
(m_realizeIndex - 1));
- auto relationObject = m_imageGrid.getItemAtspi(relationIndex);
+ auto relationObject = m_imageGrid.requestAtspi(relationIndex);
if (!relationObject) {
relationObject = m_btn.getEo();
}
Elm_Interface_Atspi_Accessible *ImageGrid::getAccessObject(
const bool isFlowsTo)
{
- const int itemIndex = (isFlowsTo ? 0 : (m_itemCount - 1));
- scrollToItem(itemIndex);
- return getItemAtspi(itemIndex);
+ return getItemAtspi(isFlowsTo ? 0 : (m_itemCount - 1));
}
template <class FUNC>
return doWithCell(itemIndex,
[this, &showFunc](const int slotIndex, const int itemOffset)
{
- const int scrollOffset = ((slotIndex / 2) * m_slotSize);
+ const int extraPadding = ((slotIndex & 1) ?
+ m_info.calcExtraPaddingSize(m_slotSize) : 0);
+
+ const int maxOffest = ((slotIndex / 2) * m_slotSize);
+ const int minOffset = (maxOffest + extraPadding -
+ ((m_scrollerSize / m_slotSize) - 1) * m_slotSize);
+ if ((m_scrollOffset >= minOffset) &&
+ (m_scrollOffset <= maxOffest)) {
+ return RES_OK;
+ }
+
+ const int scrollOffset = ((m_scrollOffset > maxOffest) ?
+ maxOffest : minOffset);
if (m_info.isHorizontal) {
showFunc(*m_scroller, scrollOffset, 0, m_scrollerSize, 1);
} else {
showFunc(*m_scroller, 0, scrollOffset, 1, m_scrollerSize);
}
+
return RES_OK;
});
}
}
}
- Elm_Interface_Atspi_Accessible *ImageGrid::getItemAtspi(const int itemIndex)
+ Elm_Interface_Atspi_Accessible *ImageGrid::requestAtspi(const int itemIndex)
{
if ((itemIndex < 0) || (itemIndex >= m_itemCount)) {
if (m_listener) {
}
return nullptr;
}
+ return getItemAtspi(itemIndex);
+ }
+
+ Elm_Interface_Atspi_Accessible *ImageGrid::getItemAtspi(
+ const int itemIndex)
+ {
+ FAIL_RETURN_VALUE(scrollToItem(itemIndex), nullptr,
+ "scrollToItem() failed!");
Elm_Interface_Atspi_Accessible *result = nullptr;
m_padSize1 = std::lround(spaceSize / 2.0);
m_padSize2 = (spaceSize - m_padSize1 +
- m_info.calcExtraPaddingSize(m_slotSize, m_itemCount));
+ m_info.calcExtraPaddingSize(m_slotSize));
}
void ImageGrid::updateScrollBias()