From: Igor Nazarov Date: Wed, 15 Mar 2017 20:12:50 +0000 (+0200) Subject: TizenRefApp-8153 [Gallery] Implement ImageGrid with 3x3 style X-Git-Tag: submit/tizen/20170531.142232~57 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=31d756b565005c44a37ad451569eba64a94b6ea4;p=profile%2Fwearable%2Fapps%2Fnative%2Fgallery.git TizenRefApp-8153 [Gallery] Implement ImageGrid with 3x3 style - Added ImageGrid class implementation with HCOMB_3X3 type; - Enabled hardware acceleration; - UCL updated. Change-Id: Ifc4670ee233e2037d15db6ab46d316ac614d7541 --- diff --git a/.cproject b/.cproject index ebee3a1..ab8f8d1 100644 --- a/.cproject +++ b/.cproject @@ -286,7 +286,17 @@ - + + + + + @@ -575,7 +585,17 @@ - + + + + + diff --git a/edc/image-grid.edc b/edc/image-grid.edc new file mode 100644 index 0000000..a15e3b2 --- /dev/null +++ b/edc/image-grid.edc @@ -0,0 +1,151 @@ +/* + * 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; + } + } + } +} diff --git a/edc/images/gallery_thumbnail_circle_04.png b/edc/images/gallery_thumbnail_circle_04.png new file mode 100644 index 0000000..b2debe7 Binary files /dev/null and b/edc/images/gallery_thumbnail_circle_04.png differ diff --git a/inc/view/ImageGrid.h b/inc/view/ImageGrid.h new file mode 100644 index 0000000..083a920 --- /dev/null +++ b/inc/view/ImageGrid.h @@ -0,0 +1,167 @@ +/* + * 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 + +#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; + + struct Info; + struct HcombInfo; + + private: + friend class ucl::RefCountObj; + ImageGrid(ucl::RefCountObjBase *rc, Type type, Evas_Object *scroller); + + static const Info &getInfo(Type type); + + template + 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 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__ diff --git a/res/edje/theme.edc b/res/edje/theme.edc new file mode 100644 index 0000000..b31271b --- /dev/null +++ b/res/edje/theme.edc @@ -0,0 +1,21 @@ +/* + * 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" +} diff --git a/src/view/ImageGrid.cpp b/src/view/ImageGrid.cpp new file mode 100644 index 0000000..5ed2def --- /dev/null +++ b/src/view/ImageGrid.cpp @@ -0,0 +1,835 @@ +/* + * 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 +#include + +#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(m_type, scrollerEo); + + result->bindToEo(); + result->setListener(m_listener); + + return result; + } + + // ImageGrid::Info // + + struct ImageGrid::Info { + const std::array slotThemes; + const std::array 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 &slotThemes, + const std::array &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 &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> 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 + 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(); + } +} diff --git a/tizen-manifest.xml b/tizen-manifest.xml index aa3cf03..22bd3cb 100644 --- a/tizen-manifest.xml +++ b/tizen-manifest.xml @@ -1,7 +1,7 @@ - + org.tizen.gallery.png diff --git a/ucl/inc/ucl/gui/EdjeWidget.h b/ucl/inc/ucl/gui/EdjeWidget.h index b494b74..5700187 100644 --- a/ucl/inc/ucl/gui/EdjeWidget.h +++ b/ucl/inc/ucl/gui/EdjeWidget.h @@ -26,18 +26,18 @@ namespace ucl { 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); diff --git a/ucl/inc/ucl/gui/EdjeWidget.hpp b/ucl/inc/ucl/gui/EdjeWidget.hpp index dbb0670..bb53961 100644 --- a/ucl/inc/ucl/gui/EdjeWidget.hpp +++ b/ucl/inc/ucl/gui/EdjeWidget.hpp @@ -27,7 +27,7 @@ namespace ucl { 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); } @@ -37,7 +37,7 @@ namespace ucl { 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); @@ -48,7 +48,7 @@ namespace ucl { 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); } @@ -58,7 +58,7 @@ namespace ucl { 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); } diff --git a/ucl/inc/ucl/gui/Layout.h b/ucl/inc/ucl/gui/Layout.h index 1a2dd98..dfe8aad 100644 --- a/ucl/inc/ucl/gui/Layout.h +++ b/ucl/inc/ucl/gui/Layout.h @@ -46,8 +46,10 @@ namespace ucl { 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); }; } diff --git a/ucl/inc/ucl/gui/Layout.hpp b/ucl/inc/ucl/gui/Layout.hpp index 31f1d79..b4bc8a8 100644 --- a/ucl/inc/ucl/gui/Layout.hpp +++ b/ucl/inc/ucl/gui/Layout.hpp @@ -57,14 +57,20 @@ namespace ucl { { } - 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); } } diff --git a/ucl/inc/ucl/gui/Widget.h b/ucl/inc/ucl/gui/Widget.h index 655df0f..1dd2a38 100644 --- a/ucl/inc/ucl/gui/Widget.h +++ b/ucl/inc/ucl/gui/Widget.h @@ -60,6 +60,12 @@ namespace ucl { 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); @@ -76,6 +82,9 @@ namespace ucl { 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; @@ -101,7 +110,7 @@ namespace ucl { 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); @@ -123,12 +132,15 @@ namespace ucl { // 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); diff --git a/ucl/inc/ucl/gui/Widget.hpp b/ucl/inc/ucl/gui/Widget.hpp index 3584590..3bd2f4f 100644 --- a/ucl/inc/ucl/gui/Widget.hpp +++ b/ucl/inc/ucl/gui/Widget.hpp @@ -78,6 +78,27 @@ namespace ucl { 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) { @@ -140,6 +161,19 @@ namespace ucl { 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(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(tmp); + } + inline void Widget::setFocused(const bool value) { setFocusedImpl(value); @@ -152,14 +186,14 @@ namespace ucl { // 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) @@ -172,6 +206,16 @@ namespace ucl { 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); diff --git a/ucl/inc/ucl/gui/WidgetItem.h b/ucl/inc/ucl/gui/WidgetItem.h index b4e8ace..914ce4c 100644 --- a/ucl/inc/ucl/gui/WidgetItem.h +++ b/ucl/inc/ucl/gui/WidgetItem.h @@ -42,18 +42,18 @@ namespace ucl { 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; diff --git a/ucl/inc/ucl/gui/WidgetItem.hpp b/ucl/inc/ucl/gui/WidgetItem.hpp index 48cafcb..577a02f 100644 --- a/ucl/inc/ucl/gui/WidgetItem.hpp +++ b/ucl/inc/ucl/gui/WidgetItem.hpp @@ -77,7 +77,7 @@ namespace ucl { 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); } @@ -87,7 +87,7 @@ namespace ucl { 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); @@ -98,7 +98,7 @@ namespace ucl { 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); } @@ -108,7 +108,7 @@ namespace ucl { 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); } diff --git a/ucl/inc/ucl/gui/types.h b/ucl/inc/ucl/gui/types.h index 6ba7020..bb6badb 100644 --- a/ucl/inc/ucl/gui/types.h +++ b/ucl/inc/ucl/gui/types.h @@ -26,6 +26,7 @@ #include "ucl/misc/smartDelegation.h" #include "ucl/misc/Aspect.h" #include "ucl/misc/TString.h" +#include "ucl/misc/Variant.h" namespace ucl { @@ -33,6 +34,7 @@ namespace ucl { struct EdjePart : Aspect { using Aspect::Aspect; }; struct EdjeGroup : Aspect { using Aspect::Aspect; }; + struct EdjeDataKey : Aspect { using Aspect::Aspect; }; struct EdjeSignal : Aspect { using Aspect::Aspect; }; struct EdjeSignalSrc : Aspect { using Aspect::Aspect; }; @@ -52,7 +54,6 @@ namespace ucl { enum class WidgetEvent { DEL = EVAS_CALLBACK_DEL, - FREE = EVAS_CALLBACK_FREE, MOUSE_IN = EVAS_CALLBACK_MOUSE_IN, MOUSE_OUT = EVAS_CALLBACK_MOUSE_OUT, @@ -84,6 +85,16 @@ namespace ucl { 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 { diff --git a/ucl/inc/ucl/misc/SharedObject.h b/ucl/inc/ucl/misc/SharedObject.h index 37d726c..80654e4 100644 --- a/ucl/inc/ucl/misc/SharedObject.h +++ b/ucl/inc/ucl/misc/SharedObject.h @@ -26,6 +26,16 @@ namespace ucl { class SharedObject : public NonCopyable { public: + template + static SharedRef asShared(T *obj); + template + static WeakRef asWeak(T *obj); + + template + static SharedRef asShared(T &obj); + template + static WeakRef asWeak(T &obj); + template SharedRef asShared(); template @@ -56,6 +66,11 @@ namespace ucl { SharedRef asShared(T *obj); template WeakRef asWeak(T *obj); + + template + SharedRef asShared(T &obj); + template + WeakRef asWeak(T &obj); } #include "SharedObject.hpp" diff --git a/ucl/inc/ucl/misc/SharedObject.hpp b/ucl/inc/ucl/misc/SharedObject.hpp index 1c9bf8e..f1fbaed 100644 --- a/ucl/inc/ucl/misc/SharedObject.hpp +++ b/ucl/inc/ucl/misc/SharedObject.hpp @@ -21,6 +21,30 @@ namespace ucl { { } + template + inline SharedRef SharedObject::asShared(T *obj) + { + return (obj ? asShared(*obj) : SharedRef()); + } + + template + inline WeakRef SharedObject::asWeak(T *obj) + { + return (obj ? asWeak(*obj) : WeakRef()); + } + + template + inline SharedRef SharedObject::asShared(T &obj) + { + return obj.asShared::type>(); + } + + template + inline WeakRef SharedObject::asWeak(T &obj) + { + return obj.asWeak::type>(); + } + template inline SharedRef SharedObject::asShared() { @@ -82,16 +106,24 @@ namespace ucl { template inline SharedRef asShared(T *obj) { - return (obj ? - obj->asShared::type>() : - SharedRef()); + return SharedObject::asShared(obj); } template inline WeakRef asWeak(T *obj) { - return (obj ? - obj->asWeak::type>() : - WeakRef()); + return SharedObject::asWeak(obj); + } + + template + inline SharedRef asShared(T &obj) + { + return SharedObject::asShared(obj); + } + + template + inline WeakRef asWeak(T &obj) + { + return SharedObject::asWeak(obj); } } diff --git a/ucl/src/gui/EdjeWidget.cpp b/ucl/src/gui/EdjeWidget.cpp index b91c1d2..f9f4210 100644 --- a/ucl/src/gui/EdjeWidget.cpp +++ b/ucl/src/gui/EdjeWidget.cpp @@ -34,7 +34,7 @@ namespace ucl { } } - void EdjeWidget::setPartText(const EdjePart part, const TString &value) + void EdjeWidget::setText(const EdjePart part, const TString &value) { if (value.isTranslatable()) { if (value.hasDomain()) { diff --git a/ucl/src/gui/Widget.cpp b/ucl/src/gui/Widget.cpp index 895816f..472b1eb 100644 --- a/ucl/src/gui/Widget.cpp +++ b/ucl/src/gui/Widget.cpp @@ -123,9 +123,9 @@ namespace ucl { 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(); @@ -140,8 +140,8 @@ namespace ucl { } 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) { @@ -228,7 +228,7 @@ namespace ucl { } } - 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); diff --git a/ucl/src/gui/WidgetItem.cpp b/ucl/src/gui/WidgetItem.cpp index aaf9992..8cf5bc1 100644 --- a/ucl/src/gui/WidgetItem.cpp +++ b/ucl/src/gui/WidgetItem.cpp @@ -33,7 +33,7 @@ namespace ucl { } } - void WidgetItem::setPartText( + void WidgetItem::setText( const EdjePart part, const TString &value) const { if (value.isTranslatable()) {