diff options
author | Igor Nazarov <i.nazarov@samsung.com> | 2017-08-28 12:50:21 +0300 |
---|---|---|
committer | Igor Nazarov <i.nazarov@samsung.com> | 2017-08-28 12:50:21 +0300 |
commit | 2ec1cc848d28df7ca379b066888257887497a01e (patch) | |
tree | 56c002fe6fcff24251e18669bfb3ef3b792fd85c | |
parent | b4aaa0e9cbf910cf5bc0b56f288680b0503e799f (diff) | |
download | gallery-2ec1cc848d28df7ca379b066888257887497a01e.tar.gz gallery-2ec1cc848d28df7ca379b066888257887497a01e.tar.bz2 gallery-2ec1cc848d28df7ca379b066888257887497a01e.zip |
[Gallery] Remove Genlist and List(Item)Presenter classes from UCL
Change-Id: Ie1daecc4f9f72b0aaeb81fe1bd678f3612614abc
-rw-r--r-- | Build/makefile | 2 | ||||
-rw-r--r-- | Build/makefile.mk | 40 | ||||
-rw-r--r-- | Build/platform.mk | 9 | ||||
-rw-r--r-- | project_def.prop | 4 | ||||
-rw-r--r-- | ucl/include/ucl/gui/Genlist.h | 92 | ||||
-rw-r--r-- | ucl/include/ucl/gui/Genlist.hpp | 132 | ||||
-rw-r--r-- | ucl/include/ucl/gui/GenlistItem.h | 63 | ||||
-rw-r--r-- | ucl/include/ucl/gui/GenlistItem.hpp | 58 | ||||
-rw-r--r-- | ucl/include/ucl/mvp/ListItemPresenter.h | 131 | ||||
-rw-r--r-- | ucl/include/ucl/mvp/ListPresenter.h | 113 | ||||
-rw-r--r-- | ucl/source/gui/Genlist.cpp | 48 | ||||
-rw-r--r-- | ucl/source/mvp/ListItemPresenter.cpp | 294 | ||||
-rw-r--r-- | ucl/source/mvp/ListPresenter.cpp | 328 |
13 files changed, 33 insertions, 1281 deletions
diff --git a/Build/makefile b/Build/makefile index f491b50..117b240 100644 --- a/Build/makefile +++ b/Build/makefile @@ -14,7 +14,7 @@ clean : app_clean version : build_version #PROJ_ROOT = . -BUILD_ROOT := $(PROJ_PATH)/Build# +#BUILD_ROOT := $(PROJ_PATH)/Build# ifeq ($(MAKE_NAME),mingw32-make) ifneq ($(SHELL),) diff --git a/Build/makefile.mk b/Build/makefile.mk index 205a3ad..53c0428 100644 --- a/Build/makefile.mk +++ b/Build/makefile.mk @@ -13,10 +13,18 @@ clean : app_clean version : build_version +_BLANK :=# +_SPACE := $(_BLANK) $(_BLANK)# +_SPACE_4MAKE := \$(_SPACE)# + +NULL_CHAR :=# +SPACE := $(NULL_CHAR) $(NULL_CHAR)# -#PROJ_ROOT := $(call BSLASH2SLASH,$(PROJ_PATH)) PROJ_ROOT := . -BUILD_ROOT := $(PROJ_ROOT)/Build +_PROJ_ROOT_4MAKE := $(subst $(_SPACE),$(_SPACE_4MAKE),$(PROJ_ROOT))# +PROJ_ROOT=$(_PROJ_ROOT_4MAKE) +_BUILD_ROOT_4MAKE := $(subst $(_SPACE),$(_SPACE_4MAKE),$(BUILD_ROOT))# +BUILD_ROOT=$(_BUILD_ROOT_4MAKE) include $(BUILD_ROOT)/basedef.mk @@ -109,7 +117,7 @@ $(APPFILE) : $(OBJS) $(UOBJS) @echo ' Building target: $@' @echo ' Invoking: C/C++ Linker' $(call MAKEDIRS,$(@D)) - $(CXX) -o $(APPFILE) $(OBJS) $(UOBJS) $(LIBPATHS) -Xlinker --as-needed $(LIBS) $(LINK_FLAGS) $(TC_LINKER_MISC) $(RS_LINKER_MISC) -pie -lpthread --sysroot="$(SYSROOT)" -Xlinker --version-script="$(PROJ_ROOT)/.exportMap" $(RS_LIB_PATHS) $(RS_LIBRARIES) -Xlinker -rpath="/opt/usr/apps/$(APPID)/lib" -Werror-implicit-function-declaration $(USER_LINK_OPTS) + $(CXX) -o $(APPFILE) $(OBJS) $(UOBJS) $(LIBPATHS) -Xlinker --as-needed $(LIBS) $(LINK_FLAGS) $(TC_LINKER_MISC) $(RS_LINKER_MISC) -pie -lpthread --sysroot="$(SYSROOT)" -Xlinker --version-script="$(PROJ_ROOT)/.exportMap" $(RS_LIB_PATHS) $(RS_LIBRARIES) -Xlinker -rpath='$$ORIGIN/../lib' -Werror-implicit-function-declaration $(USER_LINK_OPTS) @echo ' Finished building target: $@' endif ifeq ($(strip $(APPTYPE)),staticLib) @@ -137,19 +145,19 @@ $(OUTPUT_DIR) : $(call MAKEDIRS,$@) -ifneq ($(strip $(PLATFORM_INCS)),) -$(PLATFORM_INCS_FILE) : $(OBJ_OUTPUT) - @echo ' Building inc file: $@' -ifneq ($(findstring Windows,$(OS)),) -ifneq ($(findstring 3.82,$(MAKE_VERSION)),) - $(file > $@,$(PLATFORM_INCS)) -else - @echo $(PLATFORM_INCS) > $@ -endif -else - @echo $(PLATFORM_INCS) > $@ -endif -endif +#ifneq ($(strip $(PLATFORM_INCS)),) +#$(PLATFORM_INCS_FILE) : $(OBJ_OUTPUT) +# @echo ' Building inc file: $@' +#ifneq ($(findstring Windows,$(OS)),) +#ifneq ($(findstring 3.82,$(MAKE_VERSION)),) +# $(file > $@,$(PLATFORM_INCS)) +#else +# @echo $(PLATFORM_INCS) > $@ +#endif +#else +# @echo '$(PLATFORM_INCS)' > $@ +#endif +#endif include $(BUILD_ROOT)/build_edc.mk diff --git a/Build/platform.mk b/Build/platform.mk index 294a38a..3895d90 100644 --- a/Build/platform.mk +++ b/Build/platform.mk @@ -2,14 +2,17 @@ SYSROOT = $(SBI_SYSROOT) -USR_INCS := $(addprefix -I $(SYSROOT),$(PLATFORM_INCS_EX)) +#USR_INCS := $(addprefix -I "$(SYSROOT),$(PLATFORM_INCS_EX)) +USR_INCS1 := $(addsuffix ",$(PLATFORM_INCS_EX)) +USR_INCS := $(addprefix -I "$(SYSROOT),$(USR_INCS1)) ifeq ($(strip $(PLATFORM_LIB_PATHS)),) RS_LIB_PATHS := "$(SYSROOT)/usr/lib" else -RS_LIB_PATHS := $(addprefix -L$(SYSROOT),$(PLATFORM_LIB_PATHS)) +RS_LIB_PATHS1 := $(addsuffix ",$(PLATFORM_LIB_PATHS)) +RS_LIB_PATHS := $(addprefix -L "$(SYSROOT),$(RS_LIB_PATHS1)) endif RS_LIBRARIES := $(addprefix -l,$(RS_LIBRARIES_EX)) -PLATFORM_INCS = $(USR_INCS) -I"$(SDK_PATH)/library" +PLATFORM_INCS = $(USR_INCS) -I "$(SDK_PATH)/library" diff --git a/project_def.prop b/project_def.prop index 2842064..2b88e48 100644 --- a/project_def.prop +++ b/project_def.prop @@ -9,13 +9,13 @@ type = app profile = wearable-4.0
# C/CPP Sources
-USER_SRCS = gallery/presenters/Instance.cpp ucl/source/mvp/GuiPresenter.cpp gallery/model/CustomMediaAlbum.cpp gallery/presenters/pages/ThumbnailPage.cpp ucl/source/appfw/InstanceManagerBase.cpp gallery/presenters/InstanceManager.cpp gallery/presenters/misc/SelectModePresenter.cpp ucl/source/util/logging.cpp gallery/resources.cpp gallery/presenters/pages/ViewerPage.cpp gallery/presenters/misc/MoreOptionsPresenter.cpp gallery/presenters/misc/AtspiHighlightHelper.cpp ucl/source/mvp/ListPresenter.cpp gallery/model/SoundManager.cpp ucl/source/misc/Variant.cpp gallery/presenters/base/Dialog.cpp ucl/source/misc/Timeout.cpp gallery/presenters/misc/ProcessingPresenter.cpp gallery/model/helpers.cpp ucl/source/util/types/Result.cpp gallery/model/impl/GalleryAlbum.cpp gallery/presenters/misc/helpers.cpp ucl/source/gui/Genlist.cpp gallery/presenters/pages/NoContentPage.cpp gallery/view/ImageViewer.cpp gallery/presenters/pages/PreviewPage.cpp gallery/view/PageContent.cpp gallery/helpers.cpp gallery/view/TouchParser.cpp ucl/source/gui/WidgetItem.cpp gallery/presenters/dialogs/AlertDialog.cpp gallery/model/Gallery.cpp gallery/model/impl/helpers.cpp ucl/source/gui/Naviframe.cpp ucl/source/appfw/UIApp.cpp ucl/source/appfw/SysEventProvider.cpp gallery/presenters/pages/VideoPlayerPage.cpp gallery/main.cpp ucl/source/gui/Layout.cpp gallery/presenters/base/Page.cpp gallery/model/MediaItem.cpp gallery/view/helpers.cpp ucl/source/gui/Window.cpp ucl/source/gui/Widget.cpp gallery/model/impl/BaseJob.cpp ucl/source/mvp/ListItemPresenter.cpp ucl/source/gui/NaviItem.cpp ucl/source/gui/ElmWidget.cpp gallery/view/ImageGrid.cpp ucl/source/appfw/helpers.cpp ucl/source/gui/EdjeWidget.cpp
+USER_SRCS = gallery/model/CustomMediaAlbum.cpp gallery/presenters/pages/ThumbnailPage.cpp gallery/presenters/InstanceManager.cpp gallery/presenters/misc/SelectModePresenter.cpp gallery/resources.cpp gallery/presenters/misc/MoreOptionsPresenter.cpp ucl/source/misc/Variant.cpp gallery/presenters/misc/ProcessingPresenter.cpp gallery/model/helpers.cpp ucl/source/util/types/Result.cpp gallery/model/impl/GalleryAlbum.cpp gallery/presenters/misc/helpers.cpp gallery/view/ImageViewer.cpp gallery/helpers.cpp ucl/source/gui/WidgetItem.cpp gallery/model/Gallery.cpp ucl/source/gui/Naviframe.cpp ucl/source/appfw/UIApp.cpp gallery/presenters/pages/VideoPlayerPage.cpp gallery/main.cpp ucl/source/gui/Layout.cpp gallery/model/MediaItem.cpp ucl/source/gui/Window.cpp ucl/source/gui/Widget.cpp gallery/model/impl/BaseJob.cpp ucl/source/gui/NaviItem.cpp ucl/source/appfw/helpers.cpp gallery/presenters/Instance.cpp ucl/source/mvp/GuiPresenter.cpp ucl/source/appfw/InstanceManagerBase.cpp ucl/source/util/logging.cpp gallery/presenters/pages/ViewerPage.cpp gallery/presenters/misc/AtspiHighlightHelper.cpp gallery/model/SoundManager.cpp gallery/presenters/base/Dialog.cpp ucl/source/misc/Timeout.cpp gallery/presenters/pages/NoContentPage.cpp gallery/presenters/pages/PreviewPage.cpp gallery/view/PageContent.cpp gallery/view/TouchParser.cpp gallery/presenters/dialogs/AlertDialog.cpp gallery/model/impl/helpers.cpp ucl/source/appfw/SysEventProvider.cpp gallery/presenters/base/Page.cpp gallery/view/helpers.cpp ucl/source/gui/ElmWidget.cpp gallery/view/ImageGrid.cpp ucl/source/gui/EdjeWidget.cpp
# EDC Sources
USER_EDCS =
# PO Sources
-USER_POS =
+USER_POS = res/po/es_ES.po res/po/ga.po res/po/gl.po res/po/hy.po res/po/lv.po res/po/es_US.po res/po/zh_HK.po res/po/et.po res/po/zh_TW.po res/po/de.po res/po/it_IT.po res/po/lt.po res/po/nb.po res/po/ru_RU.po res/po/el_GR.po res/po/ca.po res/po/fr.po res/po/nl.po res/po/pt_BR.po res/po/uz.po res/po/eu.po res/po/kk.po res/po/tr_TR.po res/po/hr.po res/po/pt_PT.po res/po/hu.po res/po/is.po res/po/ko_KR.po res/po/mk.po res/po/bg.po res/po/fr_CA.po res/po/en_US.po res/po/da.po res/po/en.po res/po/hi.po res/po/az.po res/po/cs.po res/po/pl.po res/po/ja_JP.po res/po/sk.po res/po/sv.po res/po/ro.po res/po/sl.po res/po/sr.po res/po/uk.po res/po/zh_CN.po res/po/ar.po res/po/ka.po res/po/fi.po res/po/en_PH.po
# User Defines
USER_DEFS =
diff --git a/ucl/include/ucl/gui/Genlist.h b/ucl/include/ucl/gui/Genlist.h deleted file mode 100644 index 366eccf..0000000 --- a/ucl/include/ucl/gui/Genlist.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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 __UCL_GUI_GENLIST_H__ -#define __UCL_GUI_GENLIST_H__ - -#include "StyledWidget.h" -#include "GenlistItem.h" - -namespace ucl { - - UCL_DECLARE_REF_ALIASES(Genlist); - - class Genlist final : public StyledWidget { - public: - enum class Mode { - COMPRESS = ELM_LIST_COMPRESS, - SCROLL = ELM_LIST_SCROLL, - LIMIT = ELM_LIST_LIMIT, - EXPAND = ELM_LIST_EXPAND - }; - - class Builder final { - public: - Builder(); - Builder &setStyle(ElmStyle style); - Builder &setMode(Mode mode); - Builder &setHomogeneous(bool value); - Builder &setIsOwner(bool value); - Builder &setNeedBindToEo(bool value); - GenlistSRef build(ElmWidget &parent) const; - private: - ElmStyle m_style; - Mode m_mode; - bool m_isHomogeneous; - bool m_isOwner; - bool m_needBindToEo; - }; - - public: - friend class ReffedObj<Genlist>; - using StyledWidget::StyledWidget; - - void setMode(Mode mode); - Mode getMode() const; - - void setHomogeneous(bool isHomogeneous); - bool isHomogeneous() const; - - void updateRealizedItems(); - void clear(); - - GenlistItem append(const Elm_Genlist_Item_Class *itc, - const void *data, SmartCbHandler onSelect = nullptr, - GenlistItem::Type type = GenlistItem::Type::SIMPLE, - GenlistItem parent = nullptr); - - GenlistItem prepend(const Elm_Genlist_Item_Class *itc, - const void *data, SmartCbHandler onSelect = nullptr, - GenlistItem::Type type = GenlistItem::Type::SIMPLE, - GenlistItem parent = nullptr); - - GenlistItem insertAfter(GenlistItem after, - const Elm_Genlist_Item_Class *itc, const void *data, - SmartCbHandler onSelect = nullptr, - GenlistItem::Type type = GenlistItem::Type::SIMPLE, - GenlistItem parent = nullptr); - - GenlistItem insertBefore(GenlistItem before, - const Elm_Genlist_Item_Class *itc, const void *data, - SmartCbHandler onSelect = nullptr, - GenlistItem::Type type = GenlistItem::Type::SIMPLE, - GenlistItem parent = nullptr); - }; -} - -#include "Genlist.hpp" - -#endif // __UCL_GUI_GENLIST_H__ diff --git a/ucl/include/ucl/gui/Genlist.hpp b/ucl/include/ucl/gui/Genlist.hpp deleted file mode 100644 index 3c93031..0000000 --- a/ucl/include/ucl/gui/Genlist.hpp +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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. - */ - -namespace ucl { - - // Genlist::Builder // - - inline Genlist::Builder::Builder() : - m_mode(Mode::COMPRESS), - m_isHomogeneous(true), - m_isOwner(true), - m_needBindToEo(false) - { - } - - inline Genlist::Builder &Genlist::Builder::setStyle(const ElmStyle style) - { - m_style = style; - return *this; - } - - inline Genlist::Builder &Genlist::Builder::setMode(const Mode mode) - { - m_mode = mode; - return *this; - } - - inline Genlist::Builder &Genlist::Builder::setHomogeneous(const bool value) - { - m_isHomogeneous = value; - return *this; - } - - inline Genlist::Builder &Genlist::Builder::setIsOwner(const bool value) - { - m_isOwner = value; - return *this; - } - - inline Genlist::Builder &Genlist::Builder::setNeedBindToEo(const bool value) - { - m_needBindToEo = value; - return *this; - } - - // Genlist // - - inline void Genlist::setMode(const Mode mode) - { - elm_genlist_mode_set(getEo(), static_cast<Elm_List_Mode>(mode)); - } - - inline Genlist::Mode Genlist::getMode() const - { - return static_cast<Mode>(elm_genlist_mode_get(getEo())); - } - - inline void Genlist::setHomogeneous(const bool isHomogeneous) - { - elm_genlist_homogeneous_set(getEo(), toEina(isHomogeneous)); - } - - inline bool Genlist::isHomogeneous() const - { - return elm_genlist_homogeneous_get(getEo()); - } - - inline void Genlist::updateRealizedItems() - { - elm_genlist_realized_items_update(getEo()); - } - - inline void Genlist::clear() - { - elm_genlist_clear(getEo()); - } - - inline GenlistItem Genlist::append(const Elm_Genlist_Item_Class *const itc, - const void *const data, const SmartCbHandler onSelect, - const GenlistItem::Type type, const GenlistItem parent) - { - return GenlistItem(elm_genlist_item_append( - getEo(), itc, data, parent, - static_cast<Elm_Genlist_Item_Type>(type), - onSelect.getStubA(), onSelect.getData())); - } - - inline GenlistItem Genlist::prepend(const Elm_Genlist_Item_Class *const itc, - const void *const data, SmartCbHandler onSelect, - const GenlistItem::Type type, const GenlistItem parent) - { - return GenlistItem(elm_genlist_item_prepend( - getEo(), itc, data, parent, - static_cast<Elm_Genlist_Item_Type>(type), - onSelect.getStubA(), onSelect.getData())); - } - - inline GenlistItem Genlist::insertAfter(const GenlistItem after, - const Elm_Genlist_Item_Class *const itc, const void *const data, - const SmartCbHandler onSelect, const GenlistItem::Type type, - const GenlistItem parent) - { - return GenlistItem(elm_genlist_item_insert_after( - getEo(), itc, data, parent, after, - static_cast<Elm_Genlist_Item_Type>(type), - onSelect.getStubA(), onSelect.getData())); - } - - inline GenlistItem Genlist::insertBefore(const GenlistItem before, - const Elm_Genlist_Item_Class *itc, const void *data, - const SmartCbHandler onSelect, const GenlistItem::Type type, - const GenlistItem parent) - { - return GenlistItem(elm_genlist_item_insert_before( - getEo(), itc, data, parent, before, - static_cast<Elm_Genlist_Item_Type>(type), - onSelect.getStubA(), onSelect.getData())); - } -} diff --git a/ucl/include/ucl/gui/GenlistItem.h b/ucl/include/ucl/gui/GenlistItem.h deleted file mode 100644 index 2c96b9c..0000000 --- a/ucl/include/ucl/gui/GenlistItem.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 __UCL_GUI_GENLIST_ITEM_H__ -#define __UCL_GUI_GENLIST_ITEM_H__ - -#include "WidgetItem.h" - -namespace ucl { - - class GenlistItem final : public WidgetItem { - public: - enum class Type { - SIMPLE = ELM_GENLIST_ITEM_NONE, - TREE = ELM_GENLIST_ITEM_TREE, - GROUP = ELM_GENLIST_ITEM_GROUP - }; - - enum class SelectMode { - DEFAULT = ELM_OBJECT_SELECT_MODE_DEFAULT, - ALWAYS = ELM_OBJECT_SELECT_MODE_ALWAYS, - NONE = ELM_OBJECT_SELECT_MODE_NONE, - DISPLAY_ONLY = ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY - }; - - enum { - FIELD_ALL = ELM_GENLIST_ITEM_FIELD_ALL, - FIELD_TEXT = ELM_GENLIST_ITEM_FIELD_TEXT, - FIELD_CONTENT = ELM_GENLIST_ITEM_FIELD_CONTENT, - FIELD_STATE = ELM_GENLIST_ITEM_FIELD_STATE, - }; - - public: - using WidgetItem::WidgetItem; - - void setSelectMode(SelectMode mode) const; - SelectMode getSelectMode() const; - - void setSelected(bool isSelected) const; - bool isSelected() const; - - void update() const; - void update(const Elm_Genlist_Item_Class *newItc) const; - void update(const char *parts, int fields = FIELD_ALL) const; - }; -} - -#include "GenlistItem.hpp" - -#endif // __UCL_GUI_GENLIST_ITEM_H__ diff --git a/ucl/include/ucl/gui/GenlistItem.hpp b/ucl/include/ucl/gui/GenlistItem.hpp deleted file mode 100644 index 6920a88..0000000 --- a/ucl/include/ucl/gui/GenlistItem.hpp +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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. - */ - -namespace ucl { - - inline void GenlistItem::setSelectMode(const SelectMode mode) const - { - elm_genlist_item_select_mode_set(getIt(), - static_cast<Elm_Object_Select_Mode>(mode)); - } - - inline GenlistItem::SelectMode GenlistItem::getSelectMode() const - { - return static_cast<GenlistItem::SelectMode>( - elm_genlist_item_select_mode_get(getIt())); - } - - inline void GenlistItem::setSelected(const bool isSelected) const - { - elm_genlist_item_selected_set(getIt(), toEina(isSelected)); - } - - inline bool GenlistItem::isSelected() const - { - return elm_genlist_item_selected_get(getIt()); - } - - inline void GenlistItem::update() const - { - elm_genlist_item_update(getIt()); - } - - inline void GenlistItem::update( - const Elm_Genlist_Item_Class *const newItc) const - { - elm_genlist_item_item_class_update(getIt(), newItc); - } - - inline void GenlistItem::update( - const char *const parts, const int fields) const - { - elm_genlist_item_fields_update(getIt(), parts, - static_cast<Elm_Genlist_Item_Field_Type>(fields)); - } -} diff --git a/ucl/include/ucl/mvp/ListItemPresenter.h b/ucl/include/ucl/mvp/ListItemPresenter.h deleted file mode 100644 index 46d2fb4..0000000 --- a/ucl/include/ucl/mvp/ListItemPresenter.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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 __UCL_MVP_LIST_ITEM_PRESENTER_H__ -#define __UCL_MVP_LIST_ITEM_PRESENTER_H__ - -#include "ucl/gui/GenlistItem.h" -#include "ucl/gui/ElmWidget.h" - -#include "ucl/misc/HashMap.h" - -#include "types.h" - -namespace ucl { - - UCL_DECLARE_REF_ALIASES(ListItemPresenter); - - class ListItemPresenter : public RefCountAware, - public IDisposable { - public: - // IDisposable // - - virtual void dispose() final override; - virtual bool isDisposed() const final override; - - protected: - friend class ListPresenter; - - UCL_DECLARE_REF_ALIASES(ItemClass); - UCL_DECLARE_REF_ALIASES(ItemClassCache); - - // Flags - enum { - PF_AUTO_UNSELECT = 1 - }; - - struct ItemInsertionParams { - ElmStyle itemStyle; - GenlistItem::Type itemType; - - ItemInsertionParams(ElmStyle itemStyle, - GenlistItem::Type itemType = GenlistItem::Type::SIMPLE) : - itemStyle(itemStyle), itemType(itemType) {} - }; - - class ItemClass final : public NonCopyable { - public: - static ItemClassSRef newInstance(ElmStyle itemStyle); - public: - Elm_Genlist_Item_Class *get(); - private: - friend class ReffedObj<ItemClass>; - ItemClass(ElmStyle itemStyle); - ~ItemClass(); - private: - Elm_Genlist_Item_Class *const m_itc; - }; - - class ItemClassCache final : public NonCopyable { - public: - ItemClassSRef getItemClass(ElmStyle itemStyle); - void purge(); - private: - HashMap<ElmStyle, ItemClassSRef> m_itcMap; - }; - - protected: - ListItemPresenter(IRefCountObj &rc); - virtual ~ListItemPresenter(); - - void setFlags(int flags); - int getFlags() const; - - bool isActive() const; - - GenlistItem getItem(); - ItemClassCache *getItemClassCache(); - - Result updateItemStyle(ElmStyle newItemStyle); - - virtual ItemInsertionParams getItemInsertionParams() = 0; - - virtual void onItemAttached(); - virtual void onItemDetached(); - - virtual CString getItemPartText(EdjePart part); - virtual WidgetSRef getItemPartContent(EdjePart part, ElmWidget &parent); - virtual bool getItemPartState(EdjePart part); - - virtual void onItemSelected(); - virtual void onItemRealized(); - virtual void onItemUnrealized(); - virtual void onItemHighlighted(); - virtual void onItemUnhighlighted(); - - private: - void attachItem(GenlistItem item, - ElmWidgetSRef &&parent, - const ItemClassCacheSRef &itcCache, - const SharedRef<bool> &isActiveRef); - - void deleteDetachedItem(bool silent = false); - void detachItem(bool silent = false); - - void onItemSelectedHook(); - void onItemDel(Evas_Object *obj, void *eventInfo); - - private: - ListItemPresenterSRef m_selfRef; - GenlistItem m_item; - ItemClassCacheSRef m_itcCache; - SharedRef<bool> m_isActiveRef; - ElmWidgetSRef m_parent; - int m_flags; - }; -} - -#endif // __UCL_MVP_LIST_ITEM_PRESENTER_H__ diff --git a/ucl/include/ucl/mvp/ListPresenter.h b/ucl/include/ucl/mvp/ListPresenter.h deleted file mode 100644 index 1d62e41..0000000 --- a/ucl/include/ucl/mvp/ListPresenter.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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 __UCL_MVP_LIST_PRESENTER_H__ -#define __UCL_MVP_LIST_PRESENTER_H__ - -#include "ucl/gui/Genlist.h" - -#include "GuiPresenter.h" -#include "ListItemPresenter.h" - -namespace ucl { - - UCL_DECLARE_REF_ALIASES(ListPresenter); - - class ListPresenter final : public GuiPresenter { - public: - enum { - FLAG_HOMOGENEOUS = (1 << 0), - FLAG_CALC_X_MIN = (1 << 1), - FLAG_CALC_Y_MIN = (1 << 2), - - FLAG_NOTIFY_REALIZED = (1 << 8), - FLAG_NOTIFY_UNREALIZED = (1 << 9), - FLAG_NOTIFY_HIGHLIGHTED = (1 << 10), - FLAG_NOTIFY_UNHIGHLIGHTED = (1 << 11), - }; - - class Builder final { - public: - Builder(); - Builder &setStyle(ElmStyle style); - Builder &setFlags(int flags); - Builder &setParentWidget(const ElmWidgetSRef &parentWidget); - ListPresenterSRef build(GuiPresenter &parent) const; - private: - ucl::ElmWidgetSRef m_parentWidget; - ElmStyle m_style; - int m_flags; - }; - - public: - Genlist &getWidget(); - - void clear(); - - Result append(ListItemPresenter &itemPresenter, - ListItemPresenter *parent = nullptr); - - Result prepend(ListItemPresenter &itemPresenter, - ListItemPresenter *parent = nullptr); - - Result insertAfter(const ListItemPresenter &after, - ListItemPresenter &itemPresenter, - ListItemPresenter *parent = nullptr); - - Result insertBefore(const ListItemPresenter &before, - ListItemPresenter &itemPresenter, - ListItemPresenter *parent = nullptr); - - private: - friend class ReffedObj<ListPresenter>; - ListPresenter(IRefCountObj &rc); - virtual ~ListPresenter(); - - Result prepare(GuiPresenter &parent, ElmWidget &parentWidget, - ElmStyle style, int flags); - - template <class INSERT_FUNC> - Result insert(ListItemPresenter &itemPresenter, - ListItemPresenter *parent, - INSERT_FUNC &&insertFunc); - - template <class INSERT_FUNC> - Result insertRelative(const ListItemPresenter &relative, - ListItemPresenter &itemPresenter, - ListItemPresenter *parent, INSERT_FUNC &&insertFunc); - - void setIsActiveRef(bool value); - - void onItemSelected(Widget &widget, void *eventInfo); - - void onItemRealized(Widget &widget, void *eventInfo); - void onItemUnrealized(Widget &widget, void *eventInfo); - void onItemHighlighted(Widget &widget, void *eventInfo); - void onItemUnhighlighted(Widget &widget, void *eventInfo); - - // GuiPresenter // - - virtual void onActivate() final override; - virtual void onDeactivate() final override; - - private: - GenlistSRef m_genlist; - ListItemPresenter::ItemClassCacheSRef m_itcCache; - SharedRef<bool> m_isActiveRef; - }; -} - -#endif // __UCL_MVP_LIST_PRESENTER_H__ diff --git a/ucl/source/gui/Genlist.cpp b/ucl/source/gui/Genlist.cpp deleted file mode 100644 index b0e31a5..0000000 --- a/ucl/source/gui/Genlist.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 "ucl/gui/Genlist.h" - -#include "common.h" - -namespace ucl { - - // Genlist::Builder // - - GenlistSRef Genlist::Builder::build(ElmWidget &parent) const - { - Evas_Object *const eo = elm_genlist_add(parent); - if (!eo) { - LOG_RETURN_VALUE(RES_FAIL, {}, "elm_genlist_add() failed!"); - } - - auto result = makeShared<Genlist>(eo, m_isOwner); - - if (m_needBindToEo) { - result->bindToEo(); - } - - if (isValid(m_style)) { - result->setStyle(m_style); - } - - result->setMode(m_mode); - result->setHomogeneous(m_isHomogeneous); - - show(*result); - - return result; - } -} diff --git a/ucl/source/mvp/ListItemPresenter.cpp b/ucl/source/mvp/ListItemPresenter.cpp deleted file mode 100644 index 2d32159..0000000 --- a/ucl/source/mvp/ListItemPresenter.cpp +++ /dev/null @@ -1,294 +0,0 @@ -/* - * 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 "ucl/mvp/ListItemPresenter.h" - -#include "common.h" - -namespace ucl { - - // ListItemPresenter::ItemClass // - - ListItemPresenter::ItemClassSRef ListItemPresenter::ItemClass:: - newInstance(const ElmStyle itemStyle) - { - auto result = makeShared<ItemClass>(itemStyle); - if (!result->get()) { - LOG_RETURN_VALUE(RES_FAIL, {}, "Failed to create ItemClass()!"); - } - return result; - } - - ListItemPresenter::ItemClass::ItemClass(const ElmStyle itemStyle) : - m_itc(elm_genlist_item_class_new()) - { - if (!m_itc) { - return; - } - - m_itc->item_style = itemStyle.name; - - m_itc->func.text_get = - [](void *data, Evas_Object *obj, const char *part) -> char * - { - if (!data) { - LOG_RETURN_VALUE(RES_FATAL, nullptr, "data is NULL"); - } - return static_cast<ListItemPresenter *>(data)-> - getItemPartText(EdjePart(part)).release(); - }; - - m_itc->func.content_get = - [](void *data, Evas_Object *obj, const char *part) -> Evas_Object * - { - if (!data) { - LOG_RETURN_VALUE(RES_FATAL, nullptr, "data is NULL"); - } - auto &&item = *static_cast<ListItemPresenter *>(data); - if (const auto widget = item.getItemPartContent( - EdjePart(part), *item.m_parent)) { - widget->setIsOwner(false); - return widget->getEo(); - } - return nullptr; - }; - - m_itc->func.state_get = - [](void *data, Evas_Object *obj, const char *part) -> Eina_Bool - { - if (!data) { - LOG_RETURN_VALUE(RES_FATAL, false, "data is NULL"); - } - return static_cast<ListItemPresenter *>(data)-> - getItemPartState(EdjePart(part)); - }; - } - - ListItemPresenter::ItemClass::~ItemClass() - { - if (m_itc) { - elm_genlist_item_class_free(m_itc); - } - } - - Elm_Genlist_Item_Class *ListItemPresenter::ItemClass::get() - { - return m_itc; - } - - // ListItemPresenter::ItemClassCache // - - ListItemPresenter::ItemClassSRef ListItemPresenter::ItemClassCache:: - getItemClass(const ElmStyle itemStyle) - { - ItemClassSRef result; - - if (!m_itcMap.get(itemStyle, result)) { - result = ItemClass::newInstance(itemStyle); - if (result) { - m_itcMap.set(itemStyle, result); - } else { - ELOG("ItemClass::newInstance() failed!"); - } - } - - return result; - } - - void ListItemPresenter::ItemClassCache::purge() - { - m_itcMap.clear(); - } - - // ListItemPresenter // - - ListItemPresenter::ListItemPresenter(IRefCountObj &rc) : - RefCountAware(&rc), - m_flags(PF_AUTO_UNSELECT) - { - } - - ListItemPresenter::~ListItemPresenter() - { - if (m_item) { - FLOG("m_item is still alive!"); - deleteDetachedItem(true); - } - } - - void ListItemPresenter::attachItem(GenlistItem item, ElmWidgetSRef &&parent, - const ItemClassCacheSRef &itcCache, - const SharedRef<bool> &isActiveRef) - { - if (m_item) { - deleteDetachedItem(); - } - - m_item = item; - m_item.setData(this); - m_item.setDelCallback(CALLBACK_A(ListItemPresenter::onItemDel)); - - m_parent = std::move(parent); - - m_itcCache = itcCache; - m_isActiveRef = isActiveRef; - - if (!m_selfRef) { - m_selfRef = asShared(*this); - } - - onItemAttached(); - } - - void ListItemPresenter::deleteDetachedItem(const bool silent) - { - auto item = m_item; - detachItem(silent); - item.del(); - } - - void ListItemPresenter::detachItem(const bool silent) - { - m_item.setData(nullptr); - m_item.setDelCallback(nullptr); - m_item = nullptr; - - m_parent.reset(); - m_itcCache.reset(); - m_isActiveRef.reset(); - - if (!silent) { - onItemDetached(); - } - } - - void ListItemPresenter::onItemDel(Evas_Object *obj, void *eventInfo) - { - if (m_item) { - detachItem(); - } - m_selfRef.reset(); - } - - void ListItemPresenter::setFlags(const int flags) - { - m_flags = flags; - } - - int ListItemPresenter::getFlags() const - { - return m_flags; - } - - bool ListItemPresenter::isActive() const - { - return (m_isActiveRef ? *m_isActiveRef : false); - } - - GenlistItem ListItemPresenter::getItem() - { - return m_item; - } - - ListItemPresenter::ItemClassCache *ListItemPresenter::getItemClassCache() - { - return m_itcCache.get(); - } - - Result ListItemPresenter::updateItemStyle(const ElmStyle newItemStyle) - { - if (!m_item) { - LOG_RETURN(RES_INVALID_OPERATION, "m_item is NULL!"); - } - if (!m_itcCache) { - LOG_RETURN(RES_FATAL, "m_itcCache is NULL!"); - } - - const auto itc = m_itcCache->getItemClass(newItemStyle); - if (!itc) { - LOG_RETURN(RES_FAIL, "m_itcCache->getItemClass() failed!"); - } - - m_item.update(itc->get()); - - return RES_OK; - } - - void ListItemPresenter::dispose() - { - if (m_item) { - deleteDetachedItem(); - m_selfRef.reset(); - } - } - - bool ListItemPresenter::isDisposed() const - { - return !m_item; - } - - void ListItemPresenter::onItemAttached() - { - } - - void ListItemPresenter::onItemDetached() - { - } - - WidgetSRef ListItemPresenter::getItemPartContent(const EdjePart part, - ElmWidget &parent) - { - return nullptr; - } - - CString ListItemPresenter::getItemPartText(const EdjePart part) - { - return nullptr; - } - - bool ListItemPresenter::getItemPartState(const EdjePart part) - { - return false; - } - - void ListItemPresenter::onItemSelectedHook() - { - if (m_flags & PF_AUTO_UNSELECT) { - m_item.setSelected(false); - } - onItemSelected(); - } - - void ListItemPresenter::onItemSelected() - { - } - - void ListItemPresenter::onItemRealized() - { - } - - void ListItemPresenter::onItemUnrealized() - { - } - - void ListItemPresenter::onItemHighlighted() - { - } - - void ListItemPresenter::onItemUnhighlighted() - { - } -} diff --git a/ucl/source/mvp/ListPresenter.cpp b/ucl/source/mvp/ListPresenter.cpp deleted file mode 100644 index 2835697..0000000 --- a/ucl/source/mvp/ListPresenter.cpp +++ /dev/null @@ -1,328 +0,0 @@ -/* - * 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 "ucl/mvp/ListPresenter.h" - -#include "common.h" - -namespace ucl { namespace { namespace impl { - - constexpr SmartEvent ITEM_SELECTED {"selected"}; - - constexpr SmartEvent ITEM_REALIZED {"realized"}; - constexpr SmartEvent ITEM_UNREALIZED {"unrealized"}; - constexpr SmartEvent ITEM_HIGHLIGHTED {"highlighted"}; - constexpr SmartEvent ITEM_UNHIGHLIGHTED {"unhighlighted"}; - - ListItemPresenter *toItemPresenter(void *eventInfo) - { - if (!eventInfo) { - LOG_RETURN_VALUE(RES_FATAL, nullptr, "eventInfo is NULL"); - } - - const GenlistItem item{static_cast<Elm_Object_Item *>(eventInfo)}; - const auto data = item.getData(); - if (!data) { - LOG_RETURN_VALUE(RES_FATAL, nullptr, "data is NULL"); - } - - return static_cast<ListItemPresenter *>(data); - } -}}} - -namespace ucl { - - // ListPresenter::Builder // - - ListPresenter::Builder::Builder() : - m_flags(FLAG_HOMOGENEOUS) - { - } - - ListPresenter::Builder &ListPresenter::Builder::setStyle( - const ElmStyle style) - { - m_style = style; - return *this; - } - - ListPresenter::Builder &ListPresenter::Builder::setFlags(const int flags) - { - m_flags = flags; - return *this; - } - - ListPresenter::Builder &ListPresenter::Builder::setParentWidget( - const ElmWidgetSRef &parentWidget) - { - m_parentWidget = parentWidget; - return *this; - } - - ListPresenterSRef ListPresenter::Builder::build(GuiPresenter &parent) const - { - if (!m_parentWidget) { - LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, - "m_parentWidget is NULL!"); - } - - auto result = makeShared<ListPresenter>(); - - FAIL_RETURN_VALUE(result->prepare( - parent, *m_parentWidget, m_style, m_flags), - {}, "result->prepare() failed!"); - - return result; - } - - // ListPresenter // - - ListPresenter::ListPresenter(IRefCountObj &rc) : - GuiPresenter(rc) - { - } - - ListPresenter::~ListPresenter() - { - if (m_genlist) { - m_genlist->clear(); - } - } - - Result ListPresenter::prepare( - GuiPresenter &parent, ElmWidget &parentWidget, - const ElmStyle style, const int flags) - { - FAIL_RETURN(GuiPresenter::prepare(parent, PF_DEACTIVATOR), - "GuiPresenter::prepare() failed!"); - - m_genlist = Genlist::Builder(). - setStyle(style). - setMode(Genlist::Mode::COMPRESS). - setHomogeneous(flags & FLAG_HOMOGENEOUS). - setNeedBindToEo(true). - build(parentWidget); - if (!m_genlist) { - LOG_RETURN(RES_FAIL, "Genlist::build() failed!"); - } - - expandAndFill(*m_genlist); - - // TODO Add Scroller widget. - elm_scroller_content_min_limit(*m_genlist, - toEina((flags & FLAG_CALC_X_MIN) != 0), - toEina((flags & FLAG_CALC_Y_MIN) != 0)); - - m_itcCache = makeShared<ListItemPresenter::ItemClassCache>(); - - m_isActiveRef = makeShared<bool>(); - *m_isActiveRef = isActive(); - - m_genlist->addEventHandler(impl::ITEM_SELECTED, WEAK_DELEGATE( - ListPresenter::onItemSelected, asWeak(*this))); - - if (flags & FLAG_NOTIFY_REALIZED) { - m_genlist->addEventHandler(impl::ITEM_REALIZED, WEAK_DELEGATE( - ListPresenter::onItemRealized, asWeak(*this))); - } - if (flags & FLAG_NOTIFY_UNREALIZED) { - m_genlist->addEventHandler(impl::ITEM_UNREALIZED, WEAK_DELEGATE( - ListPresenter::onItemUnrealized, asWeak(*this))); - } - if (flags & FLAG_NOTIFY_HIGHLIGHTED) { - m_genlist->addEventHandler(impl::ITEM_HIGHLIGHTED, WEAK_DELEGATE( - ListPresenter::onItemHighlighted, asWeak(*this))); - } - if (flags & FLAG_NOTIFY_UNHIGHLIGHTED) { - m_genlist->addEventHandler(impl::ITEM_UNHIGHLIGHTED, WEAK_DELEGATE( - ListPresenter::onItemUnhighlighted, asWeak(*this))); - } - - return RES_OK; - } - - Genlist &ListPresenter::getWidget() - { - return *m_genlist; - } - - void ListPresenter::clear() - { - m_genlist->clear(); - m_itcCache->purge(); - } - - Result ListPresenter::append(ListItemPresenter &itemPresenter, - ListItemPresenter *parent) - { - return insert(itemPresenter, parent, - [this](const Elm_Genlist_Item_Class *itc, const void *data, - GenlistItem parent, GenlistItem::Type type) - { - return m_genlist->append(itc, data, nullptr, type, parent); - }); - } - - Result ListPresenter::prepend(ListItemPresenter &itemPresenter, - ListItemPresenter *parent) - { - return insert(itemPresenter, parent, - [this](const Elm_Genlist_Item_Class *itc, const void *data, - GenlistItem parent, GenlistItem::Type type) - { - return m_genlist->prepend(itc, data, nullptr, type, parent); - }); - } - - Result ListPresenter::insertAfter(const ListItemPresenter &after, - ListItemPresenter &itemPresenter, - ListItemPresenter *parent) - { - return insertRelative(after, itemPresenter, parent, - [this](GenlistItem rel, const Elm_Genlist_Item_Class *itc, - const void *data, GenlistItem parent, GenlistItem::Type type) - { - return m_genlist->insertAfter( - rel, itc, data, nullptr, type, parent); - }); - } - - Result ListPresenter::insertBefore(const ListItemPresenter &before, - ListItemPresenter &itemPresenter, - ListItemPresenter *parent) - { - return insertRelative(before, itemPresenter, parent, - [this](GenlistItem rel, const Elm_Genlist_Item_Class *itc, - const void *data, GenlistItem parent, GenlistItem::Type type) - { - return m_genlist->insertBefore( - rel, itc, data, nullptr, type, parent); - }); - } - - template <class INSERT_FUNC> - Result ListPresenter::insert(ListItemPresenter &itemPresenter, - ListItemPresenter *parent, INSERT_FUNC &&insertFunc) - { - const auto params = itemPresenter.getItemInsertionParams(); - - const auto itc = m_itcCache->getItemClass(params.itemStyle); - if (!itc) { - LOG_RETURN(RES_FAIL, "m_itcCache.getItemClass() failed!"); - } - - GenlistItem parentItem; - if (parent) { - parentItem = parent->m_item; - if (!parentItem) { - ELOG("parentItem is NULL"); - } - } - - const auto item = insertFunc(itc->get(), - &itemPresenter, parentItem, params.itemType); - if (!item) { - LOG_RETURN(RES_FAIL, "insertFunc() failed!"); - } - - itemPresenter.attachItem(item, m_genlist, m_itcCache, m_isActiveRef); - - return RES_OK; - } - - template <class INSERT_FUNC> - Result ListPresenter::insertRelative(const ListItemPresenter &relative, - ListItemPresenter &itemPresenter, ListItemPresenter *parent, - INSERT_FUNC &&insertFunc) - { - const auto relItem = relative.m_item; - if (!relItem) { - LOG_RETURN(RES_FAIL, "relItem is NULL!"); - } - if (relItem.getWidget() != m_genlist->getEo()) { - LOG_RETURN(RES_FAIL, "relItem has wrong genlist!"); - } - return insert(itemPresenter, parent, - [relItem, &insertFunc](const Elm_Genlist_Item_Class *itc, - const void *data, GenlistItem parent, GenlistItem::Type type) - { - return insertFunc(relItem, itc, data, parent, type); - }); - } - - void ListPresenter::setIsActiveRef(const bool value) - { - if (!m_isActiveRef) { - LOG_RETURN_VOID(RES_FATAL, "m_isActiveRef is NULL"); - } - *m_isActiveRef = value; - } - - void ListPresenter::onItemSelected(Widget &widget, void *eventInfo) - { - const auto itemPresenter = impl::toItemPresenter(eventInfo); - if (!itemPresenter) { - LOG_RETURN_VOID(RES_FATAL, "itemPresenter is NULL"); - } - itemPresenter->onItemSelectedHook(); - } - - void ListPresenter::onItemRealized(Widget &widget, void *eventInfo) - { - const auto itemPresenter = impl::toItemPresenter(eventInfo); - if (!itemPresenter) { - LOG_RETURN_VOID(RES_FATAL, "itemPresenter is NULL"); - } - itemPresenter->onItemRealized(); - } - - void ListPresenter::onItemUnrealized(Widget &widget, void *eventInfo) - { - const auto itemPresenter = impl::toItemPresenter(eventInfo); - if (!itemPresenter) { - LOG_RETURN_VOID(RES_FATAL, "itemPresenter is NULL"); - } - itemPresenter->onItemUnrealized(); - } - - void ListPresenter::onItemHighlighted(Widget &widget, void *eventInfo) - { - const auto itemPresenter = impl::toItemPresenter(eventInfo); - if (!itemPresenter) { - LOG_RETURN_VOID(RES_FATAL, "itemPresenter is NULL"); - } - itemPresenter->onItemHighlighted(); - } - - void ListPresenter::onItemUnhighlighted(Widget &widget, void *eventInfo) - { - const auto itemPresenter = impl::toItemPresenter(eventInfo); - if (!itemPresenter) { - LOG_RETURN_VOID(RES_FATAL, "itemPresenter is NULL"); - } - itemPresenter->onItemUnhighlighted(); - } - - void ListPresenter::onActivate() - { - setIsActiveRef(true); - } - - void ListPresenter::onDeactivate() - { - setIsActiveRef(false); - } -} |