ucl::Result isItemRealized(int itemIndex) const;
+ ucl::Result scrollToItem(int itemIndex);
+ ucl::Result bringInItem(int itemIndex);
+
void activateRotary();
void deactivateRotary();
template <class FUNC>
ucl::Result doWithItem(int itemIndex, FUNC &&func) const;
+ template <class FUNC>
+ ucl::Result doWithCell(int itemIndex, FUNC &&func) const;
+
+ template <class SHOW_FUNC>
+ ucl::Result showItem(int itemIndex, SHOW_FUNC &&showFunc);
void addUnrealizeLock();
void removeUnrealizeLock();
template <class FUNC>
Result ImageGrid::doWithItem(const int itemIndex, FUNC &&func) const
+ {
+ return doWithCell(itemIndex,
+ [this, &func](const int slotIndex, const int itemOffset)
+ {
+ const int slotOffset = (slotIndex - m_beginSlotIndex);
+ if ((slotOffset < 0) || (slotOffset >= m_slotCount)) {
+ return RES_FALSE;
+ }
+ return func(*m_slots[slotOffset], itemOffset);
+ });
+ }
+
+ template <class FUNC>
+ Result ImageGrid::doWithCell(const int itemIndex, FUNC &&func) const
{
if ((itemIndex < 0) || (itemIndex >= m_itemCount)) {
LOG_RETURN(RES_INVALID_ARGUMENTS,
int itemOffset = 0;
m_info.calcCellFromItemIndex(itemIndex, slotIndex, itemOffset);
- const int slotOffset = (slotIndex - m_beginSlotIndex);
- if ((slotOffset < 0) || (slotOffset >= m_slotCount)) {
- return RES_FALSE;
- }
+ return func(slotIndex, itemOffset);
+ }
- return func(*m_slots[slotOffset], itemOffset);
+ Result ImageGrid::scrollToItem(const int itemIndex)
+ {
+ return showItem(itemIndex, elm_scroller_region_show);
+ }
+
+ Result ImageGrid::bringInItem(int itemIndex)
+ {
+ return showItem(itemIndex, elm_scroller_region_bring_in);
+ }
+
+ template <class SHOW_FUNC>
+ Result ImageGrid::showItem(const int itemIndex, SHOW_FUNC &&showFunc)
+ {
+ return doWithCell(itemIndex,
+ [this, &showFunc](const int slotIndex, const int itemOffset)
+ {
+ const int scrollOffset = ((slotIndex / 2) * m_slotSize);
+ if (m_info.isHorizontal) {
+ showFunc(*m_scroller, scrollOffset, 0, m_scrollerSize, 1);
+ } else {
+ showFunc(*m_scroller, 0, scrollOffset, 1, m_scrollerSize);
+ }
+ return RES_OK;
+ });
}
void ImageGrid::activateRotary()