images {
image: "gallery_thumbnail_circle_04.png" COMP;
+ image: "gallery_circle_basic.png" COMP;
}
group { "elm/layout/gallery_image_grid/hcomb_3x3_even";
parts {
clip_to: "image_mask_0";
rel1.to: "image_mask_0";
rel2.to: "image_mask_0";
- rel1.relative: 0.00 0.00;
- rel2.relative: 1.00 1.00;
}
}
}
clip_to: "image_mask_0";
rel1.to: "image_mask_0";
rel2.to: "image_mask_0";
- rel1.relative: 0.00 0.00;
- rel2.relative: 1.00 1.00;
}
}
swallow { "swallow.cell_1";
clip_to: "image_mask_1";
rel1.to: "image_mask_1";
rel2.to: "image_mask_1";
- rel1.relative: 0.00 0.00;
- rel2.relative: 1.00 1.00;
+ }
+ }
+ }
+}
+group { "elm/layout/gallery_image_grid/linear";
+ parts {
+ image { "image_mask_0";
+ scale: 1;
+ desc { "default";
+ image.normal: "gallery_circle_basic.png";
+ fixed: 0 1;
+ min: 360 360;
+ max: 360 360;
+ }
+ }
+ swallow { "swallow.cell_0";
+ desc { "default";
+ fixed: 1 1;
+ clip_to: "image_mask_0";
+ rel1.to: "image_mask_0";
+ rel2.to: "image_mask_0";
+ }
+ }
+ rect { "blocker";
+ norepeat;
+ desc { "default";
+ fixed: 1 1;
+ color: 0 0 0 0;
+ rel1.to: "image_mask_0";
+ rel2.to: "image_mask_0";
}
}
}
const int slotIndex, const int itemOffset) const = 0;
virtual void calcCellFromItemIndex(const int itemIndex,
int &slotIndex, int &itemOffset) const = 0;
+
virtual int calcMaxSlotCount(const int itemCount) const = 0;
+ virtual int calcExtraPaddingSize(const int slotSize,
+ const int itemCount) const
+ {
+ return 0;
+ }
+
Info(const std::array<LayoutTheme, 2> &slotThemes,
const std::array<int, 2> &slotLens,
const int scrollLimit, const bool isHorizontal) :
return ((itemCount + (totalLength - 1)) / totalLength * 2);
}
+ virtual int calcExtraPaddingSize(const int slotSize,
+ const int itemCount) const final override
+ {
+ return slotSize;
+ }
+
HcombInfo(const int totalLength,
const std::array<LayoutTheme, 2> &slotThemes) :
Info(slotThemes, {{(totalLength / 2), ceilDiv<2>(totalLength)}},
}
};
+ // ImageGrid::LinearInfo //
+
+ struct ImageGrid::LinearInfo : Info {
+ virtual int calcItemIndexFromCell(
+ const int slotIndex, const int itemOffset) const final override
+ {
+ return (slotIndex / 2);
+ }
+
+ virtual void calcCellFromItemIndex(const int itemIndex,
+ int &slotIndex, int &itemOffset) const final override
+ {
+ slotIndex = (itemIndex * 2);
+ itemOffset = 0;
+ }
+
+ virtual int calcMaxSlotCount(const int itemCount) const final override
+ {
+ return (itemCount * 2);
+ }
+
+ LinearInfo(const LayoutTheme &slotTheme, const bool isHorizontal) :
+ Info({{slotTheme}}, {{1, 0}}, 1, isHorizontal)
+ {
+ }
+ };
+
// ImageGrid::Slot //
class ImageGrid::Slot {
m_layout(elm_layout_add(imageGrid.m_box), true),
m_isRealized(false)
{
- if (!m_layout.setTheme(m_info.slotThemes[isOdd])) {
+ if (isValid(m_info.slotThemes[isOdd]) &&
+ !m_layout.setTheme(m_info.slotThemes[isOdd])) {
ELOG("setTheme() failed!");
}
fill(m_layout);
const ImageGrid::Info &ImageGrid::getInfo(const Type type)
{
switch (type) {
- case Type::HCOMB_3X3:
- default: {
+ case Type::HCOMB_3X3: {
static HcombInfo info{3, {{
{"layout", "gallery_image_grid", "hcomb_3x3_even"},
{"layout", "gallery_image_grid", "hcomb_3x3_odd"}}}};
return info;
}
+ case Type::LINEAR:
+ default: {
+ static LinearInfo info{
+ {"layout", "gallery_image_grid", "linear"}, true};
+ return info;
+ }
}
}
void ImageGrid::updatePadSizes()
{
const int spaceSize = (m_scrollerSize -
- ((m_scrollerSize / m_slotSize) * m_slotSize));
+ (std::max((m_scrollerSize / m_slotSize), 1) * m_slotSize));
m_padSize1 = (spaceSize / 2);
- m_padSize2 = (spaceSize - m_padSize1 + m_slotSize);
+ m_padSize2 = (spaceSize - m_padSize1 +
+ m_info.calcExtraPaddingSize(m_slotSize, m_itemCount));
}
void ImageGrid::updateScrollBias()