<tool id="org.tizen.nativecore.tool.ast.cpp.1628035309" name="C++ Static Analyzer" superClass="org.tizen.nativecore.tool.ast.cpp"/>
<tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib.1095043535" name="Archive Generator" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib"/>
<tool id="org.tizen.nativecore.tool.sbi.po.compiler.430660379" name="PO Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.po.compiler"/>
- <tool id="org.tizen.nativecore.tool.sbi.edc.compiler.635130541" name="EDC Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.edc.compiler"/>
+ <tool id="org.tizen.nativecore.tool.sbi.edc.compiler.635130541" name="EDC Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.edc.compiler">
+ <option id="sbi.gnu.edc.compiler.option.misc.id.1943645302" superClass="sbi.gnu.edc.compiler.option.misc.id" valueType="stringList">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/edc/images""/>
+ </option>
+ <option id="sbi.gnu.edc.compiler.option.misc.sd.577011069" superClass="sbi.gnu.edc.compiler.option.misc.sd" valueType="stringList">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/edc/sounds""/>
+ </option>
+ <option id="sbi.gnu.edc.compiler.option.misc.fd.977212597" superClass="sbi.gnu.edc.compiler.option.misc.fd" valueType="stringList">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/edc/fonts""/>
+ </option>
+ </tool>
</toolChain>
</folderInfo>
<sourceEntries>
<tool id="org.tizen.nativecore.tool.ast.cpp.1219639105" name="C++ Static Analyzer" superClass="org.tizen.nativecore.tool.ast.cpp"/>
<tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib.2124683293" name="Archive Generator" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver.mergelib"/>
<tool id="org.tizen.nativecore.tool.sbi.po.compiler.2050571850" name="PO Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.po.compiler"/>
- <tool id="org.tizen.nativecore.tool.sbi.edc.compiler.941988681" name="EDC Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.edc.compiler"/>
+ <tool id="org.tizen.nativecore.tool.sbi.edc.compiler.941988681" name="EDC Resource Compiler" superClass="org.tizen.nativecore.tool.sbi.edc.compiler">
+ <option id="sbi.gnu.edc.compiler.option.misc.id.1573672197" superClass="sbi.gnu.edc.compiler.option.misc.id" valueType="stringList">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/edc/images""/>
+ </option>
+ <option id="sbi.gnu.edc.compiler.option.misc.sd.1909604650" superClass="sbi.gnu.edc.compiler.option.misc.sd" valueType="stringList">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/edc/sounds""/>
+ </option>
+ <option id="sbi.gnu.edc.compiler.option.misc.fd.2078769259" superClass="sbi.gnu.edc.compiler.option.misc.fd" valueType="stringList">
+ <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}}/edc/fonts""/>
+ </option>
+ </tool>
</toolChain>
</folderInfo>
<sourceEntries>
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+images {
+ image: "gallery_thumbnail_circle_04.png" COMP;
+}
+group { "elm/layout/gallery_image_grid/hcomb_3x3_even";
+ parts {
+ spacer { "spacer_t";
+ scale: 1;
+ desc { "default";
+ align: 0.5 0.0;
+ fixed: 0 1;
+ min: 0 124;
+ rel1.relative: 0.00 0.00;
+ rel2.relative: 1.00 0.00;
+ }
+ }
+ spacer { "spacer_b";
+ scale: 1;
+ desc { "default";
+ align: 0.5 1.0;
+ fixed: 0 1;
+ min: 0 120;
+ rel1.relative: 0.00 1.00;
+ rel2.relative: 1.00 1.00;
+ }
+ }
+ image { "image_mask_0";
+ scale: 1;
+ desc { "default";
+ image.normal: "gallery_thumbnail_circle_04.png";
+ align: 0.5 0.5;
+ fixed: 0 1;
+ min: 114 116;
+ max: 114 116;
+ rel1.to_y: "spacer_t";
+ rel2.to_y: "spacer_b";
+ rel1.relative: 0.00 1.00;
+ rel2.relative: 1.00 0.00;
+ }
+ }
+ swallow { "swallow.cell_0";
+ desc { "default";
+ fixed: 1 1;
+ 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;
+ }
+ }
+ }
+}
+group { "elm/layout/gallery_image_grid/hcomb_3x3_odd";
+ parts {
+ spacer { "spacer_t";
+ scale: 1;
+ desc { "default";
+ align: 0.5 0.0;
+ fixed: 0 1;
+ min: 0 23;
+ rel1.relative: 0.00 0.00;
+ rel2.relative: 1.00 0.00;
+ }
+ }
+ spacer { "spacer_b";
+ scale: 1;
+ desc { "default";
+ align: 0.5 1.0;
+ fixed: 0 1;
+ min: 0 19;
+ rel1.relative: 0.00 1.00;
+ rel2.relative: 1.00 1.00;
+ }
+ }
+ spacer { "spacer_m";
+ scale: 1;
+ desc { "default";
+ fixed: 0 1;
+ min: 0 86;
+ max: -1 86;
+ rel1.to_y: "spacer_t";
+ rel2.to_y: "spacer_b";
+ rel1.relative: 0.00 1.00;
+ rel2.relative: 1.00 0.00;
+ }
+ }
+ image { "image_mask_0";
+ scale: 1;
+ desc { "default";
+ image.normal: "gallery_thumbnail_circle_04.png";
+ align: 0.5 1.0;
+ fixed: 1 1;
+ min: 114 116;
+ max: 114 116;
+ rel1.to_y: "spacer_m";
+ rel2.to_y: "spacer_m";
+ rel1.relative: 0.50 0.00;
+ rel2.relative: 0.50 0.00;
+ }
+ }
+ image { "image_mask_1";
+ scale: 1;
+ desc { "default";
+ image.normal: "gallery_thumbnail_circle_04.png";
+ align: 0.5 0.0;
+ fixed: 1 1;
+ min: 114 116;
+ max: 114 116;
+ rel1.to_y: "spacer_m";
+ rel2.to_y: "spacer_m";
+ rel1.relative: 0.50 1.00;
+ rel2.relative: 0.50 1.00;
+ }
+ }
+ swallow { "swallow.cell_0";
+ desc { "default";
+ fixed: 1 1;
+ 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";
+ desc { "default";
+ fixed: 1 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;
+ }
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+#ifndef __GALLERY_VIEW_IMAGE_GRID_H__
+#define __GALLERY_VIEW_IMAGE_GRID_H__
+
+#include <deque>
+
+#include "ucl/gui/StyledWidget.h"
+
+namespace gallery {
+
+ UCL_DECLARE_REF_ALIASES(ImageGrid);
+
+ class ImageGrid : public ucl::Widget {
+ public:
+ enum class Type {
+ HCOMB_3X3
+ };
+
+ class IListener : public ucl::Polymorphic {
+ public:
+ virtual void onItemRealized(int itemIndex) = 0;
+ virtual void onItemUnrealized(int itemIndex) = 0;
+ };
+
+ class Builder {
+ public:
+ Builder();
+ Builder &setType(Type value);
+ Builder &setListener(IListener *value);
+ ImageGridSRef build(Widget &parent) const;
+ private:
+ Type m_type;
+ IListener *m_listener;
+ };
+
+ struct ItemParams {
+ std::string imagePath;
+ };
+
+ public:
+ void setListener(IListener *listener);
+
+ void setItemCount(int count);
+
+ void update();
+
+ ucl::Result updateItem(int itemIndex, const ItemParams ¶ms);
+
+ ucl::Result isItemRealized(int itemIndex);
+
+ private:
+ class Slot;
+ using SlotUPtr = std::unique_ptr<Slot>;
+
+ struct Info;
+ struct HcombInfo;
+
+ private:
+ friend class ucl::RefCountObj<ImageGrid>;
+ ImageGrid(ucl::RefCountObjBase *rc, Type type, Evas_Object *scroller);
+
+ static const Info &getInfo(Type type);
+
+ template <class FUNC>
+ ucl::Result doWithItem(int itemIndex, FUNC &&func);
+
+ // Initialization
+ void prepare();
+
+ // Actual slots count
+ bool updateSlotCount();
+ int calcSlotCount();
+ void setSlotCount(int newSlotCount);
+
+ // Optimal slots count
+ bool updateOptimalSlotCount();
+ int calcOptimalSlotCount();
+
+ // Maximum slots count
+ bool updateMaxSlotCount();
+ int calcMaxSlotCount();
+
+ // Actual begin slot index
+ bool updateBeginSlotIndex();
+ int calcBeginSlotIndex();
+ void setBeginSlotIndex(int newBeginSlotIndex);
+
+ // Maximum begin slot index
+ bool updateMaxBeginSlotIndex();
+ int calcMaxBeginSlotIndex();
+
+ // Misc
+ void updatePadSizes();
+ void updateScrollBias();
+ void updateRectMins();
+
+ // Scroller size
+ bool updateScrollerSize();
+ int calcScrollerSize();
+
+ // Scroller scroll offset
+ bool updateScrollOffset();
+ int calcScrollOffset();
+
+ // Slots rotations
+ void rotateSlotsRight(int count);
+ void rotateSlotsLeft(int count);
+
+ // Slots realization/unrealization
+ void realizeSlots();
+ void unrealizeSlots(int beginSlotOffset, int endSlotOffset);
+
+ // Event handling
+ void handleScrolling();
+ void handleResize();
+
+ // Events
+ void onScrollerResize(Widget &sender, void *eventInfo);
+ void onScrollerMove(Widget &sender, void *eventInfo);
+ void onBoxMove(Widget &sender, void *eventInfo);
+
+ private:
+ const Info &m_info;
+
+ ucl::StyledWidget m_scroller;
+ ucl::ElmWidget m_box;
+ ucl::Widget m_rect1;
+ ucl::Widget m_rect2;
+
+ IListener *m_listener;
+ int m_itemCount;
+
+ std::deque<SlotUPtr> m_slots;
+
+ int m_slotCount;
+ int m_optimalSlotCount;
+ int m_maxSlotCount;
+
+ int m_beginSlotIndex;
+ int m_maxBeginSlotIndex;
+
+ int m_scrollBias;
+ int m_padSize1;
+ int m_padSize2;
+
+ int m_slotSize;
+ int m_scrollerSize;
+ int m_scrollOffset;
+ };
+}
+
+#endif // __GALLERY_VIEW_IMAGE_GRID_H__
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+collections {
+ base_scale: 1.3;
+
+ #include "../../edc/image-grid.edc"
+}
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * 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.
+ */
+
+#include "view/ImageGrid.h"
+
+#include <array>
+#include <vector>
+
+#include "ucl/gui/Layout.h"
+
+#include "../common.h"
+
+namespace gallery { namespace { namespace impl {
+
+ using namespace ucl;
+
+ const TString SLOT_PART_FMT = {"swallow.cell_%d"};
+}}}
+
+namespace gallery {
+
+ using namespace ucl;
+
+ // ImageGrid::Builder //
+
+ ImageGrid::Builder::Builder() :
+ m_type(Type::HCOMB_3X3),
+ m_listener(nullptr)
+ {
+ }
+
+ ImageGrid::Builder &ImageGrid::Builder::setType(const Type value)
+ {
+ m_type = value;
+ return *this;
+ }
+
+ ImageGrid::Builder &ImageGrid::Builder::setListener(IListener *const value)
+ {
+ m_listener = value;
+ return *this;
+ }
+
+ ImageGridSRef ImageGrid::Builder::build(Widget &parent) const
+ {
+ Evas_Object *const scrollerEo = elm_scroller_add(parent);
+ if (!scrollerEo) {
+ ELOG("elm_scroller_add() failed!");
+ return {};
+ }
+
+ auto result = makeShared<ImageGrid>(m_type, scrollerEo);
+
+ result->bindToEo();
+ result->setListener(m_listener);
+
+ return result;
+ }
+
+ // ImageGrid::Info //
+
+ struct ImageGrid::Info {
+ const std::array<LayoutTheme, 2> slotThemes;
+ const std::array<int, 2> slotLens;
+ const int scrollLimit;
+ const bool isHorizontal;
+
+ virtual int calcItemIndexFromCell(
+ 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;
+
+ Info(const std::array<LayoutTheme, 2> &slotThemes,
+ const std::array<int, 2> &slotLens,
+ const int scrollLimit, const bool isHorizontal) :
+ slotThemes(slotThemes),
+ slotLens(slotLens),
+ scrollLimit(scrollLimit),
+ isHorizontal(isHorizontal)
+ {
+ }
+ };
+
+ // ImageGrid::HcombInfo //
+
+ struct ImageGrid::HcombInfo : Info {
+ const int totalLength;
+
+ virtual int calcItemIndexFromCell(
+ const int slotIndex, const int itemOffset) const final override
+ {
+ return ((slotIndex / 2 * totalLength) +
+ (itemOffset * 2) + ((slotIndex ^ 1) & 1));
+ }
+
+ virtual void calcCellFromItemIndex(const int itemIndex,
+ int &slotIndex, int &itemOffset) const final override
+ {
+ slotIndex = (itemIndex / totalLength);
+ itemOffset = (itemIndex % totalLength);
+ slotIndex += (slotIndex + ((itemOffset ^ 1) & 1));
+ itemOffset /= 2;
+ }
+
+ virtual int calcMaxSlotCount(const int itemCount) const final override
+ {
+ return ((itemCount + (totalLength - 1)) / totalLength * 2);
+ }
+
+ HcombInfo(const int totalLength,
+ const std::array<LayoutTheme, 2> &slotThemes) :
+ Info(slotThemes, {(totalLength / 2), ceilDiv<2>(totalLength)},
+ (totalLength - 1), true),
+ totalLength(totalLength)
+ {
+ }
+ };
+
+ // ImageGrid::Slot //
+
+ class ImageGrid::Slot {
+ private:
+ class Item {
+ public:
+ Item(const ImageGrid &imageGrid, Widget &parent) :
+ m_imageGrid(imageGrid),
+ m_image(evas_object_image_filled_add(parent.getEvas())),
+ m_realizeIndex(-1),
+ m_wasUpdated(false)
+ {
+ show(m_image);
+ }
+
+ Widget &getWidget()
+ {
+ return m_image;
+ }
+
+ void setImageLoadSize(const int value)
+ {
+ evas_object_image_load_size_set(m_image, value, value);
+ }
+
+ bool isRealized() const
+ {
+ return (m_realizeIndex >= 0);
+ }
+
+ void realize(const int itemIndex)
+ {
+ if (isRealized()) {
+ return;
+ }
+
+ m_wasUpdated = false;
+
+ if (itemIndex < m_imageGrid.m_itemCount) {
+ m_realizeIndex = itemIndex;
+
+ if (m_imageGrid.m_listener) {
+ m_imageGrid.m_listener->onItemRealized(itemIndex);
+ }
+ }
+
+ if (!m_wasUpdated) {
+ makeTransparent(m_image);
+ }
+ }
+
+ void unrealize()
+ {
+ if (!isRealized()) {
+ return;
+ }
+
+ const int itemIndex = m_realizeIndex;
+ m_realizeIndex = -1;
+
+ if (m_imageGrid.m_listener) {
+ m_imageGrid.m_listener->onItemUnrealized(itemIndex);
+ }
+ }
+
+ bool update(const ItemParams ¶ms)
+ {
+ if (!isRealized()) {
+ return false;
+ }
+
+ m_wasUpdated = true;
+
+ if (isEmpty(params.imagePath)) {
+ makeTransparent(m_image);
+ return true;
+ }
+
+ evas_object_image_file_set(m_image,
+ params.imagePath.c_str(), NULL);
+
+ int w, h;
+ getSize(m_image, &w, &h);
+ m_image.setARHint(WidgetARHint::NEITHER, w, h);
+
+ makeWhite(m_image);
+
+ return true;
+ }
+
+ private:
+ const ImageGrid &m_imageGrid;
+ Widget m_image;
+ int m_realizeIndex;
+ bool m_wasUpdated;
+ };
+
+ public:
+ Slot(ImageGrid &imageGrid, const bool isOdd) :
+ m_info(imageGrid.m_info),
+ m_layout(elm_layout_add(imageGrid.m_box), true),
+ m_isRealized(false)
+ {
+ if (!m_layout.setTheme(m_info.slotThemes[isOdd])) {
+ ELOG("setTheme() failed!");
+ }
+ fill(m_layout);
+ show(m_layout);
+
+ const int length = m_info.slotLens[isOdd];
+ for (int i = 0; i < length; ++i) {
+ m_items.emplace_back(new Item(imageGrid, m_layout));
+
+ m_layout.setContent(
+ EdjePart(impl::SLOT_PART_FMT.format(i)),
+ m_items.back()->getWidget());
+ }
+ }
+
+ Widget &getWidget()
+ {
+ return m_layout;
+ }
+
+ int calcSize()
+ {
+ int w = 0;
+ int h = 0;
+ m_layout.calculate();
+ m_layout.getMin(&w, &h);
+ return (m_info.isHorizontal ? w : h);
+ }
+
+ void setImageLoadSize(const int value)
+ {
+ for (auto &item: m_items) {
+ item->setImageLoadSize(value);
+ }
+ }
+
+ void unrealize()
+ {
+ if (!m_isRealized) {
+ return;
+ }
+ m_isRealized = false;
+
+ for (auto &item: m_items) {
+ item->unrealize();
+ }
+ }
+
+ void realize(const int slotIndex)
+ {
+ if (m_isRealized) {
+ return;
+ }
+ m_isRealized = true;
+
+ for (UInt i = 0; i < m_items.size(); ++i) {
+ m_items[i]->realize(
+ m_info.calcItemIndexFromCell(slotIndex, i));
+ }
+ }
+
+ bool updateItem(const int itemOffset, const ItemParams ¶ms)
+ {
+ return m_items[itemOffset]->update(params);
+ }
+
+ bool isItemRealized(const int itemOffset) const
+ {
+ return m_items[itemOffset]->isRealized();
+ }
+
+ private:
+ const Info &m_info;
+ std::vector<std::unique_ptr<Item>> m_items;
+ Layout m_layout;
+ bool m_isRealized;
+ };
+
+ // ImageGrid //
+
+ ImageGrid::ImageGrid(RefCountObjBase *const rc, const Type type,
+ Evas_Object *const scroller) :
+ Widget(rc, scroller, true),
+ m_info(getInfo(type)),
+
+ m_scroller(scroller),
+ m_box(elm_box_add(m_scroller)),
+ m_rect1(evas_object_rectangle_add(m_box.getEvas())),
+ m_rect2(evas_object_rectangle_add(m_box.getEvas())),
+
+ m_listener(nullptr),
+ m_itemCount(0),
+
+ m_slotCount(0), // Must be even >= 2
+ m_optimalSlotCount(2), // Must be even >= 2
+ m_maxSlotCount(2), // Must be even >= 2
+
+ m_beginSlotIndex(0),
+ m_maxBeginSlotIndex(0),
+
+ m_scrollBias(0),
+ m_padSize1(0),
+ m_padSize2(0),
+
+ m_slotSize(0), // Must not be 0
+ m_scrollerSize(1), // Must not be 0
+ m_scrollOffset(0)
+ {
+ prepare();
+
+ updateSlotCount();
+
+ updatePadSizes();
+ updateScrollBias();
+ updateRectMins();
+ }
+
+ const ImageGrid::Info &ImageGrid::getInfo(const Type type)
+ {
+ switch (type) {
+ case Type::HCOMB_3X3:
+ default: {
+ static HcombInfo info{3, {
+ LayoutTheme(
+ "layout", "gallery_image_grid", "hcomb_3x3_even"),
+ LayoutTheme(
+ "layout", "gallery_image_grid", "hcomb_3x3_odd")}};
+ return info;
+ }
+ }
+ }
+
+ void ImageGrid::prepare()
+ {
+ fill(m_rect1);
+ elm_box_pack_end(m_box, m_rect1);
+ makeTransparent(m_rect1);
+ show(m_rect1);
+
+ expandAndFill(m_rect2);
+ elm_box_pack_end(m_box, m_rect2);
+ makeTransparent(m_rect2);
+ show(m_rect2);
+
+ expandAndFill(m_box);
+ m_scroller.setContent(m_box);
+ elm_box_horizontal_set(m_box, toEina(m_info.isHorizontal));
+ show(m_box);
+
+ expandAndFill(m_scroller);
+ if (m_info.isHorizontal) {
+ elm_scroller_page_scroll_limit_set(
+ m_scroller, m_info.scrollLimit, 0);
+ } else {
+ elm_scroller_page_scroll_limit_set(
+ m_scroller, 0, m_info.scrollLimit);
+ }
+ show(m_scroller);
+
+ m_scroller.addEventHandler(WidgetEvent::RESIZE,
+ WEAK_DELEGATE(ImageGrid::onScrollerResize, asWeak(this)));
+
+ m_scroller.addEventHandler(WidgetEvent::MOVE,
+ WEAK_DELEGATE(ImageGrid::onScrollerMove, asWeak(this)));
+
+ m_box.addEventHandler(WidgetEvent::MOVE,
+ WEAK_DELEGATE(ImageGrid::onBoxMove, asWeak(this)));
+ }
+
+ void ImageGrid::setListener(IListener *const listener)
+ {
+ m_listener = listener;
+ }
+
+ void ImageGrid::setItemCount(const int count)
+ {
+ if (m_itemCount == count) {
+ return;
+ }
+
+ unrealizeSlots(0, m_slotCount);
+
+ m_itemCount = count;
+
+ if (updateMaxSlotCount()) {
+ updateSlotCount();
+ if (updateMaxBeginSlotIndex()) {
+ updateBeginSlotIndex();
+ }
+ }
+
+ realizeSlots();
+ updateRectMins();
+ }
+
+ void ImageGrid::update()
+ {
+ unrealizeSlots(0, m_slotCount);
+ realizeSlots();
+ }
+
+ Result ImageGrid::updateItem(const int itemIndex, const ItemParams ¶ms)
+ {
+ return doWithItem(itemIndex,
+ [¶ms](Slot &slot, const int itemOffset)
+ {
+ return (slot.updateItem(itemOffset, params) ?
+ RES_OK : RES_FALSE);
+ });
+ }
+
+ Result ImageGrid::isItemRealized(const int itemIndex)
+ {
+ return doWithItem(itemIndex,
+ [](Slot &slot, const int itemOffset)
+ {
+ return (slot.isItemRealized(itemOffset) ? RES_OK : RES_FALSE);
+ });
+ }
+
+ template <class FUNC>
+ Result ImageGrid::doWithItem(const int itemIndex, FUNC &&func)
+ {
+ if ((itemIndex < 0) || (itemIndex >= m_itemCount)) {
+ LOG_RETURN(RES_INVALID_ARGUMENTS,
+ "Item index out of range: %d", itemIndex);
+ }
+
+ int slotIndex = 0;
+ 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(*m_slots[slotOffset], itemOffset);
+ }
+
+ bool ImageGrid::updateSlotCount()
+ {
+ const int newSlotCount = calcSlotCount();
+
+ if (newSlotCount != m_slotCount) {
+ DLOG("newSlotCount: %d; m_slotCount: %d;",
+ newSlotCount, m_slotCount);
+ setSlotCount(newSlotCount);
+ return true;
+ }
+
+ return false;
+ }
+
+ int ImageGrid::calcSlotCount()
+ {
+ return std::min(m_optimalSlotCount, m_maxSlotCount);
+ }
+
+ void ImageGrid::setSlotCount(const int newSlotCount)
+ {
+ for (int i = m_slotCount; i < newSlotCount; ++i) {
+ const bool isOdd = ((m_beginSlotIndex + i) & 1);
+
+ auto slot = util::makeUnique(new Slot(*this, isOdd));
+
+ if (m_slotSize == 0) {
+ UCL_ASSERT(!isOdd, "Must be even!");
+ m_slotSize = std::max(slot->calcSize(), 1);
+ if (m_info.isHorizontal) {
+ elm_scroller_page_size_set(m_scroller, m_slotSize, 0);
+ } else {
+ elm_scroller_page_size_set(m_scroller, 0, m_slotSize);
+ }
+ }
+
+ slot->setImageLoadSize(m_slotSize);
+
+ elm_box_pack_before(m_box, slot->getWidget(), m_rect2);
+
+ m_slots.emplace_back(std::move(slot));
+ }
+
+ unrealizeSlots(newSlotCount, m_slotCount);
+
+ m_slots.resize(newSlotCount);
+ m_slotCount = newSlotCount;
+ }
+
+ bool ImageGrid::updateOptimalSlotCount()
+ {
+ const int newOptimalSlotCount = calcOptimalSlotCount();
+
+ if (newOptimalSlotCount != m_optimalSlotCount) {
+ DLOG("newOptimalSlotCount: %d; m_optimalSlotCount: %d;",
+ newOptimalSlotCount, m_optimalSlotCount);
+ m_optimalSlotCount = newOptimalSlotCount;
+ return true;
+ }
+
+ return false;
+ }
+
+ int ImageGrid::calcOptimalSlotCount()
+ {
+ return ((((m_scrollerSize - 1) + (m_slotSize - 1)) /
+ m_slotSize + 1) * 2);
+ }
+
+ bool ImageGrid::updateMaxSlotCount()
+ {
+ const int newMaxSlotCount = calcMaxSlotCount();
+
+ if (newMaxSlotCount != m_maxSlotCount) {
+ DLOG("newMaxSlotCount: %d; m_maxSlotCount: %d;",
+ newMaxSlotCount, m_maxSlotCount);
+ m_maxSlotCount = newMaxSlotCount;
+ return true;
+ }
+
+ return false;
+ }
+
+ int ImageGrid::calcMaxSlotCount()
+ {
+ return std::max(m_info.calcMaxSlotCount(m_itemCount), 2);
+ }
+
+ bool ImageGrid::updateBeginSlotIndex()
+ {
+ const int newBeginSlotIndex = calcBeginSlotIndex();
+
+ if (newBeginSlotIndex != m_beginSlotIndex) {
+ DLOG("newBeginSlotIndex: %d; m_beginSlotIndex: %d;",
+ newBeginSlotIndex, m_beginSlotIndex);
+ setBeginSlotIndex(newBeginSlotIndex);
+ return true;
+ }
+
+ return false;
+ }
+
+ int ImageGrid::calcBeginSlotIndex()
+ {
+ const int evenScrolledSize = (m_scrollOffset - m_scrollBias);
+ const int oddScrolledSize = (evenScrolledSize - m_slotSize / 2);
+
+ const int beginEvenSlotIndex = (evenScrolledSize / m_slotSize);
+ const int beginOddSlotIndex = (oddScrolledSize / m_slotSize);
+
+ int beginSlotIndex = ((beginEvenSlotIndex <= beginOddSlotIndex) ?
+ (beginEvenSlotIndex * 2) : (beginOddSlotIndex * 2 + 1));
+
+ if (beginSlotIndex < 0) {
+ beginSlotIndex = 0;
+ } else if (beginSlotIndex > m_maxBeginSlotIndex) {
+ beginSlotIndex = m_maxBeginSlotIndex;
+ }
+
+ return beginSlotIndex;
+ }
+
+ void ImageGrid::setBeginSlotIndex(const int newBeginSlotIndex)
+ {
+ const int beginSlotIndex = m_beginSlotIndex;
+ const int endSlotIndex = (beginSlotIndex + m_slotCount);
+ const int newEndSlotIndex = (newBeginSlotIndex + m_slotCount);
+
+ if ((newEndSlotIndex <= beginSlotIndex) ||
+ (endSlotIndex <= newBeginSlotIndex)) {
+
+ unrealizeSlots(0, m_slotCount);
+
+ if ((beginSlotIndex ^ newBeginSlotIndex) & 1) {
+ rotateSlotsRight(1);
+ }
+
+ } else if (newBeginSlotIndex < beginSlotIndex) {
+ const int goodSlots = (newEndSlotIndex - beginSlotIndex);
+ const int badSlots = (m_slotCount - goodSlots);
+
+ unrealizeSlots(goodSlots, m_slotCount);
+
+ if (goodSlots > badSlots) {
+ rotateSlotsRight(badSlots);
+ } else {
+ rotateSlotsLeft(goodSlots);
+ }
+ } else {
+ const int goodSlots = (endSlotIndex - newBeginSlotIndex);
+ const int badSlots = (m_slotCount - goodSlots);
+
+ unrealizeSlots(0, badSlots);
+
+ if (goodSlots > badSlots) {
+ rotateSlotsLeft(badSlots);
+ } else {
+ rotateSlotsRight(goodSlots);
+ }
+ }
+
+ m_beginSlotIndex = newBeginSlotIndex;
+ }
+
+ bool ImageGrid::updateMaxBeginSlotIndex()
+ {
+ const int newMaxBeginSlotIndex = calcMaxBeginSlotIndex();
+
+ if (newMaxBeginSlotIndex != m_maxBeginSlotIndex) {
+ DLOG("newMaxBeginSlotIndex: %d; m_maxBeginSlotIndex: %d;",
+ newMaxBeginSlotIndex, m_maxBeginSlotIndex);
+ m_maxBeginSlotIndex = newMaxBeginSlotIndex;
+ return true;
+ }
+
+ return false;
+ }
+
+ int ImageGrid::calcMaxBeginSlotIndex()
+ {
+ return (m_maxSlotCount - m_slotCount);
+ }
+
+ void ImageGrid::updatePadSizes()
+ {
+ const int spaceSize = (m_scrollerSize -
+ ((m_scrollerSize / m_slotSize) * m_slotSize));
+
+ m_padSize1 = (spaceSize / 2);
+ m_padSize2 = (spaceSize - m_padSize1 + m_slotSize);
+ }
+
+ void ImageGrid::updateScrollBias()
+ {
+ m_scrollBias = (((m_optimalSlotCount / 2 - 1) * m_slotSize -
+ m_scrollerSize) / 2 + m_padSize1);
+ }
+
+ void ImageGrid::updateRectMins()
+ {
+ const int beginEvenCols = ((m_beginSlotIndex + 1) / 2);
+ const int sideEvenCols = ((m_maxSlotCount - m_slotCount) / 2);
+ const int endEvenCols = (sideEvenCols - beginEvenCols);
+
+ const int rectMin1 = (m_padSize1 + (beginEvenCols * m_slotSize));
+ const int rectMin2 = (m_padSize2 + (endEvenCols * m_slotSize));
+
+ if (m_info.isHorizontal) {
+ m_rect1.setMin(rectMin1, 0);
+ m_rect2.setMin(rectMin2, 0);
+ } else {
+ m_rect1.setMin(0, rectMin1);
+ m_rect2.setMin(0, rectMin2);
+ }
+ }
+
+ int ImageGrid::calcScrollerSize()
+ {
+ int scrollerW = 0;
+ int scrollerH = 0;
+ getSize(m_scroller, &scrollerW, &scrollerH);
+
+ return std::max((m_info.isHorizontal ? scrollerW : scrollerH), 1);
+ }
+
+ bool ImageGrid::updateScrollerSize()
+ {
+ const int newScrollerSize = calcScrollerSize();
+
+ if (newScrollerSize != m_scrollerSize) {
+ DLOG("newScrollerSize: %d; m_scrollerSize: %d;",
+ newScrollerSize, m_scrollerSize);
+ m_scrollerSize = newScrollerSize;
+ return true;
+ }
+
+ return false;
+ }
+
+ int ImageGrid::calcScrollOffset()
+ {
+ int scrollerX = 0;
+ int scrollerY = 0;
+ getPosition(m_scroller, &scrollerX, &scrollerY);
+
+ int boxX = 0;
+ int boxY = 0;
+ getPosition(m_box, &boxX, &boxY);
+
+ int scrollOffset = (m_info.isHorizontal ?
+ (scrollerX - boxX) : (scrollerY - boxY));
+ if (scrollOffset < 0) {
+ scrollOffset = 0;
+ }
+
+ return scrollOffset;
+ }
+
+ bool ImageGrid::updateScrollOffset()
+ {
+ const int newScrollOffset = calcScrollOffset();
+
+ if (newScrollOffset != m_scrollOffset) {
+ DLOG("newScrollOffset: %d; m_scrollOffset: %d;",
+ newScrollOffset, m_scrollOffset);
+ m_scrollOffset= newScrollOffset;
+ return true;
+ }
+
+ return false;
+ }
+
+ void ImageGrid::rotateSlotsRight(const int count)
+ {
+ DLOG("count: %d", count);
+ for (int i = 0; i < count; ++i) {
+ SlotUPtr slot = std::move(m_slots.back());
+ m_slots.pop_back();
+ elm_box_unpack(m_box, slot->getWidget());
+ elm_box_pack_after(m_box, slot->getWidget(), m_rect1);
+ m_slots.emplace_front(std::move(slot));
+ }
+ }
+
+ void ImageGrid::rotateSlotsLeft(const int count)
+ {
+ DLOG("count: %d", count);
+ for (int i = 0; i < count; ++i) {
+ SlotUPtr slot = std::move(m_slots.front());
+ m_slots.pop_front();
+ elm_box_unpack(m_box, slot->getWidget());
+ elm_box_pack_before(m_box, slot->getWidget(), m_rect2);
+ m_slots.emplace_back(std::move(slot));
+ }
+ }
+
+ void ImageGrid::realizeSlots()
+ {
+ for (int i = 0; i < m_slotCount; ++i) {
+ m_slots[i]->realize(m_beginSlotIndex + i);
+ }
+ }
+
+ void ImageGrid::unrealizeSlots(
+ const int beginSlotOffset, const int endSlotOffset)
+ {
+ for (int i = beginSlotOffset; i < endSlotOffset; ++i) {
+ m_slots[i]->unrealize();
+ }
+ }
+
+ void ImageGrid::handleScrolling()
+ {
+ if (updateScrollOffset() && updateBeginSlotIndex()) {
+ realizeSlots();
+ updateRectMins();
+ }
+ }
+
+ void ImageGrid::handleResize()
+ {
+ if (updateScrollerSize()) {
+ bool needRealize = false;
+
+ updatePadSizes();
+
+ if (updateOptimalSlotCount() && updateSlotCount()) {
+ updateMaxBeginSlotIndex();
+ needRealize = true;
+ }
+
+ updateScrollBias();
+
+ if (updateBeginSlotIndex()) {
+ needRealize = true;
+ }
+
+ if (needRealize) {
+ realizeSlots();
+ }
+ updateRectMins();
+ }
+ }
+
+ void ImageGrid::onScrollerResize(Widget &sender, void *eventInfo)
+ {
+ handleResize();
+ }
+
+ void ImageGrid::onScrollerMove(Widget &sender, void *eventInfo)
+ {
+ handleScrolling();
+ }
+
+ void ImageGrid::onBoxMove(Widget &sender, void *eventInfo)
+ {
+ handleScrolling();
+ }
+}
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<manifest xmlns="http://tizen.org/ns/packages" api-version="3.0" package="org.tizen.gallery" version="1.0.0">
<profile name="wearable"/>
- <ui-application appid="org.tizen.gallery" exec="gallery" multiple="false" nodisplay="false" taskmanage="true" type="capp">
+ <ui-application appid="org.tizen.gallery" exec="gallery" hw-acceleration="on" multiple="false" nodisplay="false" splash-screen-display="false" taskmanage="true" type="capp">
<label>gallery</label>
<icon>org.tizen.gallery.png</icon>
</ui-application>
class EdjeWidget : public ElmWidget {
public:
void setText(const TString &value);
- void setPartText(EdjePart part, const TString &value);
+ void setText(EdjePart part, const TString &value);
TString getText() const;
- TString getPartText(EdjePart part) const;
+ TString getText(EdjePart part) const;
void setContent(Evas_Object *content);
- void setPartContent(EdjePart part, Evas_Object *content);
+ void setContent(EdjePart part, Evas_Object *content);
Evas_Object *unsetContent();
- Evas_Object *unsetPartContent(EdjePart part);
+ Evas_Object *unsetContent(EdjePart part);
Evas_Object *getContent() const;
- Evas_Object *getPartContent(EdjePart part) const;
+ Evas_Object *getContent(EdjePart part) const;
void emitSignal(EdjeSignal signal, EdjeSignalSrc source);
return elm_object_text_get(getEo());
}
- inline TString EdjeWidget::getPartText(const EdjePart part) const
+ inline TString EdjeWidget::getText(const EdjePart part) const
{
return elm_object_part_text_get(getEo(), part.name);
}
elm_object_content_set(getEo(), content);
}
- inline void EdjeWidget::setPartContent(const EdjePart part,
+ inline void EdjeWidget::setContent(const EdjePart part,
Evas_Object *const content)
{
elm_object_part_content_set(getEo(), part.name, content);
return elm_object_content_unset(getEo());
}
- inline Evas_Object *EdjeWidget::unsetPartContent(const EdjePart part)
+ inline Evas_Object *EdjeWidget::unsetContent(const EdjePart part)
{
return elm_object_part_content_unset(getEo(), part.name);
}
return elm_object_content_get(getEo());
}
- inline Evas_Object *EdjeWidget::getPartContent(const EdjePart part) const
+ inline Evas_Object *EdjeWidget::getContent(const EdjePart part) const
{
return elm_object_part_content_get(getEo(), part.name);
}
using EdjeWidget::EdjeWidget;
explicit Layout(Evas_Object *eo, bool isOwner = false);
- void setTheme(const LayoutTheme &theme);
- void setEdjeFile(const std::string &filePath, EdjeGroup group);
+ bool setTheme(const LayoutTheme &theme);
+ bool setEdjeFile(const std::string &filePath, EdjeGroup group);
+
+ Variant getEdjeData(EdjeDataKey key);
};
}
{
}
- inline void Layout::setTheme(const LayoutTheme &theme)
+ inline bool Layout::setTheme(const LayoutTheme &theme)
{
- elm_layout_theme_set(getEo(), theme.klass, theme.group, theme.style);
+ return elm_layout_theme_set(getEo(),
+ theme.klass, theme.group, theme.style);
}
- inline void Layout::setEdjeFile(const std::string &filePath,
+ inline bool Layout::setEdjeFile(const std::string &filePath,
const EdjeGroup group)
{
- elm_layout_file_set(getEo(), filePath.c_str(), group.name);
+ return elm_layout_file_set(getEo(), filePath.c_str(), group.name);
+ }
+
+ inline Variant Layout::getEdjeData(EdjeDataKey key)
+ {
+ return elm_layout_data_get(getEo(), key);
}
}
void setVisible(bool value);
bool isVisible() const;
+ void setColor(int r, int g, int b, int a = 255);
+ void setColor(int l, int a = 255);
+ void getColor(int &r, int &g, int &b, int &a) const;
+
+ void calculate();
+
void setGeometry(int x, int y, int w, int h);
void move(int x, int y);
void resize(int w, int h);
void getMin(int *w, int *h) const;
void getMax(int *w, int *h) const;
+ void setARHint(WidgetARHint arControl, int w, int h);
+ void getARHint(WidgetARHint &arControl, int &w, int &h);
+
void setFocused(bool value);
bool isFocused() const;
void setSelfRefUnique(const bool value);
- void onEoFree(Evas *e, Evas_Object *obj, void *event_info);
+ void onEoDel(Evas *e, Evas_Object *obj, void *event_info);
void delEventProxy(const EventProxiesIt it);
// Non-member functions //
- void getPosition(const Widget &widget, int &x, int &y);
- void getSize(const Widget &widget, int &w, int &h);
+ void getPosition(const Widget &widget, int *x, int *y);
+ void getSize(const Widget &widget, int *w, int *h);
void show(Widget &widget);
void hide(Widget &widget);
+ void makeTransparent(Widget &widget);
+ void makeWhite(Widget &widget);
+
void focus(Widget &widget);
void unfocus(Widget &widget);
return evas_object_visible_get(getEo());
}
+ inline void Widget::setColor(const int r, const int g,
+ const int b, const int a)
+ {
+ evas_object_color_set(getEo(), r, g, b, a);
+ }
+
+ inline void Widget::setColor(const int l, const int a)
+ {
+ evas_object_color_set(getEo(), l, l, l, a);
+ }
+
+ inline void Widget::getColor(int &r, int &g, int &b, int &a) const
+ {
+ evas_object_color_get(getEo(), &r, &g, &b, &a);
+ }
+
+ inline void Widget::calculate()
+ {
+ evas_object_smart_calculate(getEo());
+ }
+
inline void Widget::setGeometry(const int x, const int y,
const int w, const int h)
{
evas_object_size_hint_max_get(getEo(), w, h);
}
+ inline void Widget::setARHint(WidgetARHint arControl, int w, int h)
+ {
+ evas_object_size_hint_aspect_set(getEo(),
+ static_cast<Evas_Aspect_Control>(arControl), w, h);
+ }
+
+ inline void Widget::getARHint(WidgetARHint &arControl, int &w, int &h)
+ {
+ Evas_Aspect_Control tmp = EVAS_ASPECT_CONTROL_NEITHER;
+ evas_object_size_hint_aspect_get(getEo(), &tmp, &w, &h);
+ arControl = static_cast<WidgetARHint>(tmp);
+ }
+
inline void Widget::setFocused(const bool value)
{
setFocusedImpl(value);
// Non-member functions //
- inline void getPosition(const Widget &widget, int &x, int &y)
+ inline void getPosition(const Widget &widget, int *x, int *y)
{
- widget.getGeometry(&x, &y, nullptr, nullptr);
+ widget.getGeometry(x, y, nullptr, nullptr);
}
- inline void getSize(const Widget &widget, int &w, int &h)
+ inline void getSize(const Widget &widget, int *w, int *h)
{
- widget.getGeometry(nullptr, nullptr, &w, &h);
+ widget.getGeometry(nullptr, nullptr, w, h);
}
inline void show(Widget &widget)
widget.setVisible(false);
}
+ inline void makeTransparent(Widget &widget)
+ {
+ widget.setColor(0, 0);
+ }
+
+ inline void makeWhite(Widget &widget)
+ {
+ widget.setColor(255);
+ }
+
inline void focus(Widget &widget)
{
widget.setFocused(true);
bool isEnabled() const;
void setText(const TString &value) const;
- void setPartText(EdjePart part, const TString &value) const;
+ void setText(EdjePart part, const TString &value) const;
TString getText() const;
- TString getPartText(EdjePart part) const;
+ TString getText(EdjePart part) const;
void setContent(Evas_Object *content) const;
- void setPartContent(EdjePart part, Evas_Object *content) const;
+ void setContent(EdjePart part, Evas_Object *content) const;
Evas_Object *unsetContent() const;
- Evas_Object *unsetPartContent(EdjePart part) const;
+ Evas_Object *unsetContent(EdjePart part) const;
Evas_Object *getContent() const;
- Evas_Object *getPartContent(EdjePart part) const;
+ Evas_Object *getContent(EdjePart part) const;
void emitSignal(EdjeSignal signal, EdjeSignalSrc source) const;
return elm_object_item_text_get(getIt());
}
- inline TString WidgetItem::getPartText(const EdjePart part) const
+ inline TString WidgetItem::getText(const EdjePart part) const
{
return elm_object_item_part_text_get(getIt(), part.name);
}
elm_object_item_content_set(getIt(), content);
}
- inline void WidgetItem::setPartContent(const EdjePart part,
+ inline void WidgetItem::setContent(const EdjePart part,
Evas_Object *const content) const
{
elm_object_item_part_content_set(getIt(), part.name, content);
return elm_object_item_content_unset(getIt());
}
- inline Evas_Object *WidgetItem::unsetPartContent(const EdjePart part) const
+ inline Evas_Object *WidgetItem::unsetContent(const EdjePart part) const
{
return elm_object_item_part_content_unset(getIt(), part.name);
}
return elm_object_item_content_get(getIt());
}
- inline Evas_Object *WidgetItem::getPartContent(const EdjePart part) const
+ inline Evas_Object *WidgetItem::getContent(const EdjePart part) const
{
return elm_object_item_part_content_get(getIt(), part.name);
}
#include "ucl/misc/smartDelegation.h"
#include "ucl/misc/Aspect.h"
#include "ucl/misc/TString.h"
+#include "ucl/misc/Variant.h"
namespace ucl {
struct EdjePart : Aspect<EdjePart> { using Aspect::Aspect; };
struct EdjeGroup : Aspect<EdjeGroup> { using Aspect::Aspect; };
+ struct EdjeDataKey : Aspect<EdjeDataKey> { using Aspect::Aspect; };
struct EdjeSignal : Aspect<EdjeSignal> { using Aspect::Aspect; };
struct EdjeSignalSrc : Aspect<EdjeSignalSrc> { using Aspect::Aspect; };
enum class WidgetEvent {
DEL = EVAS_CALLBACK_DEL,
- FREE = EVAS_CALLBACK_FREE,
MOUSE_IN = EVAS_CALLBACK_MOUSE_IN,
MOUSE_OUT = EVAS_CALLBACK_MOUSE_OUT,
IMAGE_PRELOADED = EVAS_CALLBACK_IMAGE_PRELOADED
};
+ // WidgetARHint //
+
+ enum class WidgetARHint
+ {
+ NEITHER = EVAS_ASPECT_CONTROL_NEITHER,
+ HORIZONTAL = EVAS_ASPECT_CONTROL_HORIZONTAL,
+ VERTICAL = EVAS_ASPECT_CONTROL_VERTICAL,
+ BOTH = EVAS_ASPECT_CONTROL_BOTH
+ };
+
// LayoutTheme //
struct LayoutTheme {
class SharedObject : public NonCopyable {
public:
+ template <class T>
+ static SharedRef<T> asShared(T *obj);
+ template <class T>
+ static WeakRef<T> asWeak(T *obj);
+
+ template <class T>
+ static SharedRef<T> asShared(T &obj);
+ template <class T>
+ static WeakRef<T> asWeak(T &obj);
+
template <class T>
SharedRef<T> asShared();
template <class T>
SharedRef<T> asShared(T *obj);
template <class T>
WeakRef<T> asWeak(T *obj);
+
+ template <class T>
+ SharedRef<T> asShared(T &obj);
+ template <class T>
+ WeakRef<T> asWeak(T &obj);
}
#include "SharedObject.hpp"
{
}
+ template <class T>
+ inline SharedRef<T> SharedObject::asShared(T *obj)
+ {
+ return (obj ? asShared(*obj) : SharedRef<T>());
+ }
+
+ template <class T>
+ inline WeakRef<T> SharedObject::asWeak(T *obj)
+ {
+ return (obj ? asWeak(*obj) : WeakRef<T>());
+ }
+
+ template <class T>
+ inline SharedRef<T> SharedObject::asShared(T &obj)
+ {
+ return obj.asShared<typename std::remove_cv<T>::type>();
+ }
+
+ template <class T>
+ inline WeakRef<T> SharedObject::asWeak(T &obj)
+ {
+ return obj.asWeak<typename std::remove_cv<T>::type>();
+ }
+
template <class T>
inline SharedRef<T> SharedObject::asShared()
{
template <class T>
inline SharedRef<T> asShared(T *obj)
{
- return (obj ?
- obj->asShared<typename std::remove_cv<T>::type>() :
- SharedRef<T>());
+ return SharedObject::asShared(obj);
}
template <class T>
inline WeakRef<T> asWeak(T *obj)
{
- return (obj ?
- obj->asWeak<typename std::remove_cv<T>::type>() :
- WeakRef<T>());
+ return SharedObject::asWeak(obj);
+ }
+
+ template <class T>
+ inline SharedRef<T> asShared(T &obj)
+ {
+ return SharedObject::asShared(obj);
+ }
+
+ template <class T>
+ inline WeakRef<T> asWeak(T &obj)
+ {
+ return SharedObject::asWeak(obj);
}
}
}
}
- void EdjeWidget::setPartText(const EdjePart part, const TString &value)
+ void EdjeWidget::setText(const EdjePart part, const TString &value)
{
if (value.isTranslatable()) {
if (value.hasDomain()) {
UCL_ASSERT(m_eo, "m_eo is NULL!");
if (m_rc) {
- evas_object_event_callback_priority_add(m_eo, EVAS_CALLBACK_FREE,
+ evas_object_event_callback_priority_add(m_eo, EVAS_CALLBACK_DEL,
EO_CALLBACK_PRIORITY_AFTER,
- CALLBACK_A(Widget::onEoFree), this);
+ CALLBACK_A(Widget::onEoDel), this);
}
updateRefs();
}
if (m_rc) {
- evas_object_event_callback_del_full(m_eo, EVAS_CALLBACK_FREE,
- CALLBACK_A(Widget::onEoFree), this);
+ evas_object_event_callback_del_full(m_eo, EVAS_CALLBACK_DEL,
+ CALLBACK_A(Widget::onEoDel), this);
}
if (m_isOwner) {
}
}
- void Widget::onEoFree(Evas *e, Evas_Object *obj, void *event_info)
+ void Widget::onEoDel(Evas *e, Evas_Object *obj, void *event_info)
{
if (!m_isSelfRefKept) {
FLOG("UNEXPECTED! m_isSelfRefKept: %d;", m_isSelfRefKept);
}
}
- void WidgetItem::setPartText(
+ void WidgetItem::setText(
const EdjePart part, const TString &value) const
{
if (value.isTranslatable()) {