TizenRefApp-8857 [Call UI] Update application with ucl::GuiPresenter 75/138775/2
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Tue, 11 Jul 2017 04:45:57 +0000 (07:45 +0300)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Mon, 17 Jul 2017 05:57:47 +0000 (08:57 +0300)
Change-Id: I7cd78c0224417cdcc3d889fd160b0fece100b89a

78 files changed:
.cproject
edc/call_info.edc
inc/presenters/AcceptDialog.h
inc/presenters/AcceptRejectPresenter.h
inc/presenters/AccessoryPresenter.h
inc/presenters/CallInfoPresenter.h
inc/presenters/CallStatusPresenter.h
inc/presenters/IndicatorPresenter.h
inc/presenters/MainPage.h
inc/presenters/MoreOptionsPresenter.h
inc/presenters/MotionSensorPresenter.h
inc/presenters/Page.h
inc/presenters/Page.hpp
inc/presenters/Presenter.h [deleted file]
inc/presenters/RejectMsgPresenter.h
inc/presenters/types.h
inc/view/helpers.h
src/presenters/AcceptDialog.cpp
src/presenters/AcceptRejectPresenter.cpp
src/presenters/AccessoryPresenter.cpp
src/presenters/CallInfoPresenter.cpp
src/presenters/CallStatusPresenter.cpp
src/presenters/IndicatorPresenter.cpp
src/presenters/MoreOptionsPresenter.cpp
src/presenters/Page.cpp
src/presenters/Presenter.cpp [deleted file]
src/presenters/RejectMsgPresenter.cpp
src/view/helpers.cpp
ucl/inc/ucl/appfw/SysEventProvider.h
ucl/inc/ucl/appfw/UIApp.h
ucl/inc/ucl/gui/Genlist.h [new file with mode: 0644]
ucl/inc/ucl/gui/Genlist.hpp [new file with mode: 0644]
ucl/inc/ucl/gui/GenlistItem.h [new file with mode: 0644]
ucl/inc/ucl/gui/GenlistItem.hpp [new file with mode: 0644]
ucl/inc/ucl/gui/Layout.h
ucl/inc/ucl/gui/Naviframe.h
ucl/inc/ucl/gui/Widget.h
ucl/inc/ucl/gui/Window.h
ucl/inc/ucl/gui/helpers.h
ucl/inc/ucl/gui/types.h
ucl/inc/ucl/misc/Aspect.h
ucl/inc/ucl/misc/Aspect.hpp
ucl/inc/ucl/misc/CString.h [new file with mode: 0644]
ucl/inc/ucl/misc/CString.hpp [new file with mode: 0644]
ucl/inc/ucl/misc/ConstCString.h [new file with mode: 0644]
ucl/inc/ucl/misc/ConstCString.hpp [new file with mode: 0644]
ucl/inc/ucl/misc/Event.h
ucl/inc/ucl/misc/HashMap.h
ucl/inc/ucl/misc/HashMap.hpp
ucl/inc/ucl/misc/RefCountAware.h
ucl/inc/ucl/misc/RefCountAware.hpp
ucl/inc/ucl/misc/TString.h
ucl/inc/ucl/misc/Variant.h
ucl/inc/ucl/misc/Variant.hpp
ucl/inc/ucl/mvp/GuiPresenter.h [new file with mode: 0644]
ucl/inc/ucl/mvp/ListItemPresenter.h [new file with mode: 0644]
ucl/inc/ucl/mvp/ListPresenter.h [new file with mode: 0644]
ucl/inc/ucl/mvp/types.h [new file with mode: 0644]
ucl/inc/ucl/util/memory/BaseRef.h
ucl/inc/ucl/util/memory/BaseRef.hpp
ucl/inc/ucl/util/memory/IRefCountObj.h
ucl/inc/ucl/util/memory/RefCountObj.h
ucl/inc/ucl/util/memory/RefCountObj.hpp
ucl/inc/ucl/util/threading/CondVar.h
ucl/inc/ucl/util/threading/Mutex.h
ucl/inc/ucl/util/threading/MutexLock.h
ucl/inc/ucl/util/types/Result.h
ucl/inc/ucl/util/types/classTypes.h
ucl/src/appfw/UIApp.cpp
ucl/src/gui/ElmWidget.cpp
ucl/src/gui/Genlist.cpp [new file with mode: 0644]
ucl/src/gui/NaviItem.cpp
ucl/src/gui/Widget.cpp
ucl/src/misc/Variant.cpp
ucl/src/mvp/GuiPresenter.cpp [new file with mode: 0644]
ucl/src/mvp/ListItemPresenter.cpp [new file with mode: 0644]
ucl/src/mvp/ListPresenter.cpp [new file with mode: 0644]
ucl/src/mvp/common.h [new file with mode: 0644]

index c8bc4cf69153776f2fd68237f7531e397c19ebd0..c3ed9e8e42a9d723a6dfbe910daaa1abc9bb2755 100644 (file)
--- a/.cproject
+++ b/.cproject
                                                        <targetPlatform binaryParser="org.eclipse.cdt.core.ELF" id="org.tizen.nativeide.target.sbi.gnu.platform.base.299151930" osList="linux,win32" superClass="org.tizen.nativeide.target.sbi.gnu.platform.base"/>
                                                        <builder autoBuildTarget="all" buildPath="${workspace_loc:/call-ui}/Debug" enableAutoBuild="true" id="org.tizen.nativecore.target.sbi.gnu.builder.287909858" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Tizen Application Builder" superClass="org.tizen.nativecore.target.sbi.gnu.builder"/>
                                                        <tool id="org.tizen.nativecore.tool.sbi.gnu.archiver.850939844" name="Archiver" superClass="org.tizen.nativecore.tool.sbi.gnu.archiver"/>
-                                                       <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.66050065" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler">
+                                                       <tool command="i386-linux-gnueabi-g++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler.66050065" name="C++ Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.compiler">
                                                                <option id="gnu.cpp.compiler.option.optimization.level.1977572256" name="Optimization Level" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
                                                                <option defaultValue="gnu.cpp.compiler.debugging.level.max" id="sbi.gnu.cpp.compiler.option.debugging.level.core.1003532466" name="Debug level" superClass="sbi.gnu.cpp.compiler.option.debugging.level.core" valueType="enumerated"/>
                                                                <option defaultValue="false" id="sbi.gnu.cpp.compiler.option.misc.pic.core.58197076" name="-fPIC option" superClass="sbi.gnu.cpp.compiler.option.misc.pic.core" valueType="boolean"/>
                                                                <option id="sbi.gnu.cpp.compiler.option.1780411914" name="Tizen-Target" superClass="sbi.gnu.cpp.compiler.option" valueType="userObjs">
-                                                                       <listOptionValue builtIn="false" value="wearable-4.0-emulator.core.private_llvm40.i386.core.app"/>
+                                                                       <listOptionValue builtIn="false" value="wearable-4.0-emulator.core.private_gcc49.i386.core.app"/>
                                                                </option>
                                                                <option id="sbi.gnu.cpp.compiler.option.frameworks_inc.core.2060575755" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.cpp.compiler.option.frameworks_inc.core" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
                                                                </option>
                                                                <inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.27127097" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
                                                        </tool>
-                                                       <tool command="clang" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.1049599195" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
+                                                       <tool command="i386-linux-gnueabi-gcc" id="org.tizen.nativecore.tool.sbi.gnu.c.compiler.1049599195" name="C Compiler" superClass="org.tizen.nativecore.tool.sbi.gnu.c.compiler">
                                                                <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.1400861396" name="Optimization Level" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
                                                                <option defaultValue="gnu.c.debugging.level.max" id="sbi.gnu.c.compiler.option.debugging.level.core.1157370620" name="Debug level" superClass="sbi.gnu.c.compiler.option.debugging.level.core" valueType="enumerated"/>
                                                                <option defaultValue="false" id="sbi.gnu.c.compiler.option.misc.pic.core.1654013693" name="-fPIC option" superClass="sbi.gnu.c.compiler.option.misc.pic.core" valueType="boolean"/>
                                                                <option id="sbi.gnu.c.compiler.option.551225658" name="Tizen-Target" superClass="sbi.gnu.c.compiler.option" valueType="userObjs">
-                                                                       <listOptionValue builtIn="false" value="wearable-4.0-emulator.core.private_llvm40.i386.core.app"/>
+                                                                       <listOptionValue builtIn="false" value="wearable-4.0-emulator.core.private_gcc49.i386.core.app"/>
                                                                </option>
                                                                <option id="sbi.gnu.c.compiler.option.frameworks_inc.core.1481628386" name="Tizen-Frameworks-Include-Path" superClass="sbi.gnu.c.compiler.option.frameworks_inc.core" valueType="includePath">
                                                                        <listOptionValue builtIn="false" value="&quot;${SBI_SYSROOT}/usr/include/libxml2&quot;"/>
                                                                <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.890993403" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
                                                        </tool>
                                                        <tool id="org.tizen.nativeide.tool.sbi.gnu.c.linker.base.1743186514" name="C Linker" superClass="org.tizen.nativeide.tool.sbi.gnu.c.linker.base"/>
-                                                       <tool command="clang++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.linker.1743878166" name="C++ Linker" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.linker">
+                                                       <tool command="i386-linux-gnueabi-g++" id="org.tizen.nativecore.tool.sbi.gnu.cpp.linker.1743878166" name="C++ Linker" superClass="org.tizen.nativecore.tool.sbi.gnu.cpp.linker">
                                                                <option defaultValue="false" id="sbi.gnu.cpp.linker.option.shared_flag.core.1017885244" name="Linker.Shared" superClass="sbi.gnu.cpp.linker.option.shared_flag.core" valueType="boolean"/>
                                                                <option defaultValue="false" id="sbi.gnu.cpp.linker.option.noundefined.core.219138009" name="Report unresolved symbol references (-Wl,--no-undefined)" superClass="sbi.gnu.cpp.linker.option.noundefined.core" valueType="boolean"/>
                                                                <option id="sbi.gnu.cpp.linker.option.frameworks_lflags.core.588492684" name="Tizen-Frameworks-Other-Lflags" superClass="sbi.gnu.cpp.linker.option.frameworks_lflags.core" valueType="stringList">
index 2186773896b1f0027a9b908749d05ed1c890a705..f6d586287d2730eb3ad671912f4db599604c7da4 100644 (file)
@@ -345,6 +345,21 @@ group { "elm/layout/callui/call_info";
                                color: 0 0 0 0;
                        }
                }
+
+               rect { "event";
+                       mouse;
+                       scale;
+                       desc { "default";
+                               rel1.to: "bg";
+                               rel2.to: "bg";
+                               color: 0 0 0 0;
+                               hid;
+                       }
+                       desc { "enable";
+                               inherit: "default";
+                               vis;
+                       }
+               }
        }
        programs {
                script {
index cdbd4d1f413a666eefc598d1a338188f4b653d8d..e10dc023bb70968e4d23e1e7ed075bd6160a58ca 100644 (file)
 #ifndef __CALLUI_VIEW_ACCEPT_DIALOG_H__
 #define __CALLUI_VIEW_ACCEPT_DIALOG_H__
 
-#include "Presenter.h"
+#include "ucl/mvp/GuiPresenter.h"
 
 #include "ucl/gui/StyledWidget.h"
 #include "ucl/gui/ElmWidget.h"
+#include "ucl/gui/ElmWidget.h"
 
 #include "types.h"
 
 namespace callui {
 
-       class AcceptDialog final :
-                       public Presenter,
+       class AcceptDialog final : public ucl::GuiPresenter,
                        public ucl::IDisposable {
        public:
                class Builder {
@@ -76,6 +76,7 @@ namespace callui {
                ucl::StyledWidgetSRef m_popup;
                ucl::StyledWidgetSRef m_genlist;
                AcceptDialogHandler m_handler;
+               AcceptDialogSRef m_selfRef;
                bool m_isDismissed;
        };
 
index 41f426e5b44a45840f575060ee97fc3ba58e3cb0..cd449977610d87ba22512f4f0d1dc210892b149e 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef __CALLUI_PRESENTERS_ACCEPT_REJECT_PRESENTER_H__
 #define __CALLUI_PRESENTERS_ACCEPT_REJECT_PRESENTER_H__
 
-#include "Presenter.h"
+#include "ucl/mvp/GuiPresenter.h"
 
 #include "ucl/gui/Layout.h"
 #include "ucl/gui/StyledWidget.h"
@@ -26,7 +26,7 @@
 
 namespace callui {
 
-       class AcceptRejectPresenter final : public Presenter {
+       class AcceptRejectPresenter final : public ucl::GuiPresenter {
        public:
                class Builder {
                public:
@@ -35,7 +35,7 @@ namespace callui {
                        Builder &setIncomingCall(const IIncomingCallSRef &call);
                        Builder &setAvailableCallsFlag(CallMask calls);
                        Builder &setParentWidget(const ucl::ElmWidgetSRef &parentWidget);
-                       AcceptRejectPresenterSRef build(Presenter &parent) const;
+                       AcceptRejectPresenterSRef build(ucl::GuiPresenter &parent) const;
 
                private:
                        IIncomingCallSRef m_call;
@@ -56,7 +56,7 @@ namespace callui {
                                const IIncomingCallSRef &call,
                                CallMask calls);
 
-               ucl::Result prepare(Presenter &parent,
+               ucl::Result prepare(ucl::GuiPresenter &parent,
                                ucl::ElmWidget &parentWidget);
 
                ucl::Result createWidget(ucl::ElmWidget &parent);
index 31bc625d3472702a51ab23f6251313da2d604ebe..c4c9f38a239ed407af2d5b8453409d1d8f1da4bb 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef __CALLUI_PRESENTERS_ACCESSORY_PRESENTER_H__
 #define __CALLUI_PRESENTERS_ACCESSORY_PRESENTER_H__
 
-#include "Presenter.h"
+#include "ucl/mvp/GuiPresenter.h"
 
 #include "ucl/gui/Layout.h"
 #include "ucl/gui/StyledWidget.h"
@@ -26,7 +26,7 @@
 
 namespace callui {
 
-       class AccessoryPresenter final : public Presenter {
+       class AccessoryPresenter final : public ucl::GuiPresenter {
        public:
                class Builder {
                public:
@@ -34,7 +34,7 @@ namespace callui {
                        Builder &setSoundManager(const ISoundManagerSRef &sm);
                        Builder &setMuteControlDisabled(bool isDisabled);
                        Builder &setParentWidget(const ucl::ElmWidgetSRef &parentWidget);
-                       AccessoryPresenterSRef build(Presenter &parent) const;
+                       AccessoryPresenterSRef build(ucl::GuiPresenter &parent) const;
 
                private:
                        ISoundManagerSRef m_sm;
@@ -54,7 +54,7 @@ namespace callui {
                AccessoryPresenter(ucl::IRefCountObj &rc,
                                const ISoundManagerSRef &sm);
 
-               ucl::Result prepare(Presenter &parent,
+               ucl::Result prepare(ucl::GuiPresenter &parent,
                                ucl::ElmWidget &parentWidget,
                                bool isMuteControlDisabled = false);
 
index 6a836b138bfa2fa08be4bdef98bcc67a20974e00..6502152b8d6f0c7932ac8e4fec5b719bcb39bb75 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef __CALLUI_PRESENTERS_CALL_INFO_PRESENTER_H__
 #define __CALLUI_PRESENTERS_CALL_INFO_PRESENTER_H__
 
-#include "Presenter.h"
+#include "ucl/mvp/GuiPresenter.h"
 
 #include "ucl/gui/Layout.h"
 #include "ucl/gui/StyledWidget.h"
@@ -26,7 +26,7 @@
 
 namespace callui {
 
-       class CallInfoPresenter final : public Presenter {
+       class CallInfoPresenter final : public ucl::GuiPresenter {
        public:
                class Builder {
                public:
@@ -35,7 +35,7 @@ namespace callui {
                        Builder &setCallManager(const ICallManagerSRef &cm);
                        Builder &setMode(CallMode mode);
                        Builder &setParentWidget(const ucl::ElmWidgetSRef &parentWidget);
-                       CallInfoPresenterSRef build(Presenter &parent) const;
+                       CallInfoPresenterSRef build(ucl::GuiPresenter &parent) const;
                private:
                        ICallManagerSRef m_cm;
                        CallMode m_mode;
@@ -55,7 +55,7 @@ namespace callui {
                                const ICallManagerSRef &cm,
                                CallMode mode);
 
-               ucl::Result prepare(Presenter &parent,
+               ucl::Result prepare(ucl::GuiPresenter &parent,
                                ucl::ElmWidget &parentWidget);
 
                void initCallInfos(const ICallManagerSRef &cm);
@@ -63,7 +63,7 @@ namespace callui {
                ucl::Result createWidget(ucl::ElmWidget &parent);
                ucl::Result createLabel(const std::string &text);
                ucl::Result createCallerIdImage(const std::string &imagePath);
-               ucl::Result createCallStatus(Presenter &parent);
+               ucl::Result createCallStatus(ucl::GuiPresenter &parent);
 
                ucl::Result update();
                ucl::Result updateCallerId();
@@ -84,7 +84,7 @@ namespace callui {
                ucl::LayoutSRef m_widget;
                ucl::StyledWidgetSRef m_callerId;
                ucl::StyledWidgetSRef m_label;
-               PresenterWRef m_parent;
+               ucl::GuiPresenterWRef m_parent;
                CallMode m_mode;
                ICallInfoSCRef m_incomCallInfo;
                ICallInfoSCRef m_activeCallInfo;
index e4c7b4af7243bef4e86e014830a16a3b2dfc52d9..0f788b3aafd0696842b6fae442c88d3283d3ec00 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef __CALLUI_PRESENTERS_CALL_STATUS_PRESENTER_H__
 #define __CALLUI_PRESENTERS_CALL_STATUS_PRESENTER_H__
 
-#include "Presenter.h"
+#include "ucl/mvp/GuiPresenter.h"
 
 #include <time.h>
 
@@ -27,7 +27,7 @@
 
 namespace callui {
 
-       class CallStatusPresenter final : public Presenter {
+       class CallStatusPresenter final : public ucl::GuiPresenter {
        public:
                class Builder {
                public:
@@ -37,7 +37,7 @@ namespace callui {
                        Builder &setCallInfo(const ICallInfoWCRef &info);
                        Builder &setCallHoldState(bool isOnHold);
                        Builder &setLayout(const ucl::LayoutSRef &layout);
-                       CallStatusPresenterSRef build(Presenter &parent) const;
+                       CallStatusPresenterSRef build(ucl::GuiPresenter &parent) const;
                private:
                        ucl::LayoutSRef m_ly;
                        CallMode m_mode;
@@ -55,7 +55,7 @@ namespace callui {
                                const ICallInfoWCRef &info,
                                bool isOnHold);
 
-               ucl::Result prepare(Presenter &parent);
+               ucl::Result prepare(ucl::GuiPresenter &parent);
 
                ucl::Result processIncomingMode();
                ucl::Result processOutgoingMode();
index b0ac5dd95d135c370c812f080d3ad7aadd57cc9b..47a098e0a0fd4de92e1b58c9b5ac088bee77e8e3 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef __CALLUI_PRESENTERS_INDICATOR_PRESENTER_H__
 #define __CALLUI_PRESENTERS_INDICATOR_PRESENTER_H__
 
-#include "Presenter.h"
+#include "ucl/mvp/GuiPresenter.h"
 #include "model/IIndicatorStateListener.h"
 
 #include "ucl/gui/Layout.h"
@@ -27,9 +27,8 @@
 
 namespace callui {
 
-       class IndicatorPresenter final :
-                       public IIndicatorStateListener,
-                       public Presenter {
+       class IndicatorPresenter final : public ucl::GuiPresenter,
+                       public IIndicatorStateListener {
        public:
                class Builder {
                public:
@@ -39,7 +38,7 @@ namespace callui {
                                        const IIndicatorStateProviderSRef &provider);
                        Builder &setParentWidget(const ucl::ElmWidgetSRef
                                        &parentWidget);
-                       IndicatorPresenterSRef build(Presenter &parent) const;
+                       IndicatorPresenterSRef build(ucl::GuiPresenter &parent) const;
                private:
                        IIndicatorStateProviderSRef m_provider;
                        ucl::ElmWidgetSRef m_parentWidget;
@@ -57,7 +56,7 @@ namespace callui {
                IndicatorPresenter(ucl::IRefCountObj &rc,
                                const IIndicatorStateProviderSRef &provider);
 
-               ucl::Result prepare(Presenter &parent, ucl::ElmWidget &parentWidget);
+               ucl::Result prepare(ucl::GuiPresenter &parent, ucl::ElmWidget &parentWidget);
 
                ucl::Result createWidget(ucl::ElmWidget &parent);
                ucl::Result createConnectionLayout();
index 1d3ae89d9906b0e4293821b3a72dbddf5cc89d80..ce28028bfc6073a07325abef49f56a90384c7570 100644 (file)
@@ -28,8 +28,7 @@
 
 namespace callui {
 
-       class MainPage final :
-                       public Page,
+       class MainPage final : public Page,
                        public ICallListener {
        public:
                class Builder {
index f6ab91a36ecc70d35535ce6f6eecdb027d0e08cd..2b994b1f522f2a7e148b24384ff12c1d0d592f2f 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef __CALLUI_PRESENTERS_MORE_OPTIONS_PRESENTER_H__
 #define __CALLUI_PRESENTERS_MORE_OPTIONS_PRESENTER_H__
 
-#include "Presenter.h"
+#include "ucl/mvp/GuiPresenter.h"
 
 #include "ucl/gui/Layout.h"
 #include "ucl/gui/StyledWidget.h"
@@ -29,7 +29,7 @@
 
 namespace callui {
 
-       class MoreOptionsPresenter final : public Presenter {
+       class MoreOptionsPresenter final : public ucl::GuiPresenter {
        public:
                class Builder {
                public:
@@ -38,7 +38,7 @@ namespace callui {
                        Builder &setSoundManager(const ISoundManagerSRef &sm);
                        Builder &setNaviframe(const ucl::NaviframeSRef &navi);
                        Builder &setParentWidget(const ucl::ElmWidgetSRef &parentWidget);
-                       MoreOptionsPresenterSRef build(Presenter &parent) const;
+                       MoreOptionsPresenterSRef build(ucl::GuiPresenter &parent) const;
                private:
                        ICallManagerSRef m_cm;
                        ISoundManagerSRef m_sm;
@@ -58,7 +58,7 @@ namespace callui {
                                const ucl::NaviframeSRef &navi);
                virtual ~MoreOptionsPresenter();
 
-               ucl::Result prepare(Presenter &parent,
+               ucl::Result prepare(ucl::GuiPresenter &parent,
                                ucl::ElmWidget &parentWidget);
 
                ucl::Result createWidget(ucl::ElmWidget &parent);
index 4e6041f1606392a6839130e147a3810ee3725195..0805c38275b6f420ea8b154fb0ef5609a3b3bb29 100644 (file)
@@ -23,8 +23,7 @@
 
 namespace callui {
 
-       class MotionSensorPresenter final
-       {
+       class MotionSensorPresenter final {
        public:
                class Builder {
                public:
index 8c63c6eee87f0df8d53a41412031758f5950223a..b25fc3a468562a8d78a7d9a3108f57b0193cb975 100644 (file)
 
 #include "ucl/gui/Naviframe.h"
 
-#include "Presenter.h"
-
-#include "types.h"
+#include "ucl/mvp/GuiPresenter.h"
 
 namespace callui {
 
-       class Page : public Presenter {
+       UCL_DECLARE_REF_ALIASES(Page);
+
+       class Page : public ucl::GuiPresenter {
        public:
                using ExitRequestHandler = ucl::WeakDelegate<void(Page &page)>;
 
@@ -80,9 +80,10 @@ namespace callui {
                const ucl::NaviframeSRef m_navi;
                const ExitRequestHandler m_onExitRequest;
                ucl::NaviItem m_item;
+               PageSRef m_selfRef;
        };
 
-       // Non-member functions //
+       // Non-member functions
 
        bool isLast(const Page &page);
 }
index 886f114067b8f0ab2b301f238eb91085a032e13b..2ef28d23e00a60476a6fb86adfbc0ed60f4f0827 100644 (file)
@@ -21,8 +21,8 @@ namespace callui {
        template <class ON_PREPARE>
        inline ucl::Result Page::prepare(ON_PREPARE &&onPrepare)
        {
-               UCL_FAIL_RETURN(Presenter::prepare(*m_navi),
-                               "Presenter::prepare() failed!");
+               UCL_FAIL_RETURN(GuiPresenter::prepare(*m_navi),
+                               "GuiPresenter::prepare() failed!");
 
                UCL_FAIL_RETURN(onPrepare(m_item), "onPrepare() failed!");
 
@@ -57,7 +57,7 @@ namespace callui {
                return (m_navi->getBottomItem() == m_item);
        }
 
-       // Non-member functions //
+       // Non-member functions
 
        inline bool isLast(const Page &page)
        {
diff --git a/inc/presenters/Presenter.h b/inc/presenters/Presenter.h
deleted file mode 100644 (file)
index 5bf2b3b..0000000
+++ /dev/null
@@ -1,108 +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 __CALLUI_PRESENTERS_PRESENTER_H__
-#define __CALLUI_PRESENTERS_PRESENTER_H__
-
-#include <unordered_set>
-
-#include "ucl/gui/Window.h"
-
-#include "types.h"
-
-namespace callui {
-
-       UCL_DECLARE_REF_ALIASES(Presenter);
-
-       class Presenter : public ucl::RefCountAware {
-       public:
-               struct DeactivatorInfo {
-                       const void *deactivator;
-                       bool isBroadcast;
-               };
-
-       public:
-               bool isActive() const;
-               bool isDeactivatedBy(const void *deactivator) const;
-
-               void activateBy(const void *deactivator);
-               void deactivateBy(const void *deactivator);
-
-               void addDeactivatorSource(ucl::Widget &source);
-               void delDeactivatorSource(ucl::Widget &source);
-
-       protected:
-               enum {
-                       PF_ADD_DEACTIVATOR_SOURCES = 1,
-                       PF_ADD_SELF_EXCEPT = 2,
-
-                       PF_PASSIVE = 0,
-                       PF_DEACTIVATOR = (PF_ADD_DEACTIVATOR_SOURCES | PF_ADD_SELF_EXCEPT),
-                       PF_DEFAULT = PF_ADD_DEACTIVATOR_SOURCES
-               };
-
-       protected:
-               Presenter(ucl::IRefCountObj &rc);
-               virtual ~Presenter();
-
-               ucl::Result prepare(ucl::ElmWidget &widget, int flags = PF_DEFAULT);
-               ucl::Result prepare(Presenter &parent, int flags = PF_DEFAULT);
-
-               ucl::Window &getWindow();
-               bool isWindowReady() const;
-
-               void addDeactivatorException(const void *deactivator);
-               void setDeactivatorSink(const ucl::WidgetSRef &sink);
-
-               void sendActivate(ucl::Widget &sender);
-               void sendDeactivate(ucl::Widget &sender);
-
-               void broadcastActivate();
-               void broadcastDeactivate();
-
-               virtual void onActivate();
-               virtual void onDeactivate();
-               virtual void onActivateBy(const DeactivatorInfo &info);
-               virtual void onDeactivateBy(const DeactivatorInfo &info);
-
-       private:
-               void sendDeactivator(ucl::Widget &sender,
-                               ucl::SmartEvent event, const void *deactivator);
-               void broadcastDeactivator(ucl::SmartEvent event,
-                               const void *deactivator);
-
-               void sendDeactivatorInfo(ucl::Widget &sender, ucl::SmartEvent event,
-                               const DeactivatorInfo &info);
-
-               void activateByImpl(const DeactivatorInfo &info);
-               void deactivateByImpl(const DeactivatorInfo &info);
-
-               void onActivateBySmart(ucl::Widget &widget, void *eventInfo);
-               void onDeactivateBySmart(ucl::Widget &widget, void *eventInfo);
-
-       private:
-               std::unordered_set<const void *> m_deactivatorExceptions;
-               std::unordered_set<const void *> m_deactivators;
-               ucl::WindowSRef m_window;
-               ucl::WidgetSRef m_sink;
-               ucl::WidgetWRef m_parentSink;
-               bool m_hasBuildInSources;
-               bool m_isChild;
-               bool m_isPrepared;
-       };
-}
-
-#endif // __CALLUI_PRESENTERS_PRESENTER_H__
index 40cb2ae5d0da465a1efca5f8e2bfc7c5ee92c72b..31740fbc05011fc5c602b2193b2c9f20ff54fa92 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef __CALLUI_PRESENTERS_REJECT_MESSAGE_PRESENTER_H__
 #define __CALLUI_PRESENTERS_REJECT_MESSAGE_PRESENTER_H__
 
-#include "Presenter.h"
+#include "ucl/mvp/GuiPresenter.h"
 
 #include "ucl/gui/Layout.h"
 #include "ucl/gui/StyledWidget.h"
@@ -26,7 +26,7 @@
 
 namespace callui {
 
-       class RejectMsgPresenter final : public Presenter {
+       class RejectMsgPresenter final : public ucl::GuiPresenter {
        public:
                class Builder {
                public:
@@ -36,7 +36,7 @@ namespace callui {
                        Builder &setStateHandler(const RejectMsgStateHandler &handler);
                        Builder &setSelectHandler(const RejectMsgSelectHandler &handler);
                        Builder &setParentWidget(const ucl::ElmWidgetSRef &parentWidget);
-                       RejectMsgPresenterSRef build(Presenter &parent) const;
+                       RejectMsgPresenterSRef build(ucl::GuiPresenter &parent) const;
 
                private:
                        IRejectMsgProviderSRef m_provider;
@@ -67,7 +67,7 @@ namespace callui {
                                const RejectMsgStateHandler &stateHandler,
                                const RejectMsgSelectHandler &selectHandler);
 
-               ucl::Result prepare(Presenter &parent,
+               ucl::Result prepare(ucl::GuiPresenter &parent,
                                ucl::ElmWidget &parentWidget);
 
                ucl::Result createWidget(ucl::ElmWidget &parent);
index 516fc8748ebad692b1062ecfd851a8c3c3e79b1c..7139437458d548824c967d5b31242815061e0847 100644 (file)
@@ -77,6 +77,8 @@ namespace callui {
        UCL_DECLARE_REF_ALIASES(DeviceStatePresenter);
        UCL_DECLARE_REF_ALIASES(MotionSensorPresenter);
 
+       UCL_DECLARE_REF_ALIASES(AlertBaseViewController);
+
        using AcceptDialogHandler = ucl::WeakDelegate<bool(AcceptDialog &, AcceptDialogEvent)>;
        using RejectMsgStateHandler = ucl::WeakDelegate<void(RejectMsgState)>;
        using RejectMsgSelectHandler = ucl::WeakDelegate<void(const IRejectMsgSRef &rm)>;
index e830901c7ddda269d1f2979bd3e70da1842abf85..d0d3395e82fc76de910ab16afcb8599f37800f6a 100644 (file)
@@ -42,6 +42,8 @@ namespace callui {
                        Elm_Gen_Item_Content_Get_Cb contentCb = nullptr,
                        Elm_Gen_Item_State_Get_Cb stateCb = nullptr,
                        Elm_Gen_Item_Del_Cb delCb = nullptr);
+
+       ucl::LayoutTheme getImageTheme(const char *fileName);
 }
 
 #endif // __CALLUI_VIEW_HELPERS_H__
index 79df6822423d5deefd5321e9f2d03a4cdfe91e6b..df1efbfec6e374335b5c658f35b11637fece3f0d 100644 (file)
@@ -75,7 +75,7 @@ namespace callui {
 
        AcceptDialog::AcceptDialog(IRefCountObj &rc,
                        const AcceptDialogHandler &handler):
-                                       Presenter(rc),
+                                       GuiPresenter(rc),
                                        m_handler(handler),
                                        m_isDismissed(false)
        {
@@ -87,7 +87,7 @@ namespace callui {
 
        Result AcceptDialog::prepare(ElmWidget &parent)
        {
-               FAIL_RETURN(Presenter::prepare(parent, PF_DEACTIVATOR),
+               FAIL_RETURN(GuiPresenter::prepare(parent, PF_DEACTIVATOR),
                                "Presenter::prepare() failed!");
 
                FAIL_RETURN(createPopup(parent, impl::POPUP_STYLE),
@@ -96,7 +96,7 @@ namespace callui {
                FAIL_RETURN(createGenlist(),
                                "createGenlist() failed!");
 
-               m_rc->ref();
+               m_selfRef = asShared(*this);
 
                addDeactivatorException(this);
                broadcastDeactivate();
@@ -286,7 +286,7 @@ namespace callui {
 
                        m_popup.reset();
 
-                       m_rc->unref();
+                       m_selfRef.reset();
                }
        }
 
index 33ba40c6bc8c0032f46c9de404f2d5ef87fb8f11..90bb88f81cfa79240f1cfce2b5e2e37396453454 100644 (file)
@@ -90,7 +90,7 @@ namespace callui {
        }
 
        AcceptRejectPresenterSRef
-       AcceptRejectPresenter::Builder::build(Presenter &parent) const
+       AcceptRejectPresenter::Builder::build(GuiPresenter &parent) const
        {
                if (!m_parentWidget) {
                        LOG_RETURN_VALUE(RES_FAIL, {}, "m_parentWidget is NULL");
@@ -107,7 +107,7 @@ namespace callui {
        AcceptRejectPresenter::AcceptRejectPresenter(IRefCountObj &rc,
                        const IIncomingCallSRef &call,
                        CallMask calls):
-                       Presenter(rc),
+                       GuiPresenter(rc),
                        m_call(call),
                        m_callMask(calls)
        {
@@ -123,10 +123,10 @@ namespace callui {
                                CALLBACK_A(AcceptRejectPresenter::onRotaryEvent), this);
        }
 
-       Result AcceptRejectPresenter::prepare(Presenter &parent,
+       Result AcceptRejectPresenter::prepare(GuiPresenter &parent,
                        ElmWidget &parentWidget)
        {
-               FAIL_RETURN(Presenter::prepare(parent),
+               FAIL_RETURN(GuiPresenter::prepare(parent),
                                "Presenter::prepare() failed!");
 
                FAIL_RETURN(createWidget(parentWidget),
index e0ea5c53bd02ecb36cfce6ad86d5fc4db5f5ccd0..90c39f73fa2e267c0b130bc12514b71258d5d032 100644 (file)
@@ -72,7 +72,7 @@ namespace callui {
        }
 
        AccessoryPresenterSRef
-       AccessoryPresenter::Builder::build(Presenter &parent) const
+       AccessoryPresenter::Builder::build(GuiPresenter &parent) const
        {
                if (!m_sm || !m_parentWidget) {
                        LOG_RETURN_VALUE(RES_FAIL, {}, "Main params are not set");
@@ -86,7 +86,7 @@ namespace callui {
 
        AccessoryPresenter::AccessoryPresenter(IRefCountObj &rc,
                        const ISoundManagerSRef &sm):
-                       Presenter(rc),
+                       GuiPresenter(rc),
                        m_sm(sm),
                        m_vcTimer(nullptr),
                        m_audioState(m_sm->getAudioState())
@@ -99,11 +99,11 @@ namespace callui {
                unregisterCallbacks();
        }
 
-       Result AccessoryPresenter::prepare(Presenter &parent,
+       Result AccessoryPresenter::prepare(GuiPresenter &parent,
                        ElmWidget &parentWidget,
                        bool isMuteControlDisabled)
        {
-               FAIL_RETURN(Presenter::prepare(parent), "Presenter::prepare() failed");
+               FAIL_RETURN(GuiPresenter::prepare(parent), "Presenter::prepare() failed");
 
                FAIL_RETURN(createWidget(parentWidget), "createWidget() failed");
 
index cfccf527619edbbb4a875de860c3583e6849dea6..ab1932bb41970b42e9e4b357c6885b12c57eb3dc 100644 (file)
@@ -122,7 +122,7 @@ namespace callui {
        }
 
        CallInfoPresenterSRef
-       CallInfoPresenter::Builder::build(Presenter &parent) const
+       CallInfoPresenter::Builder::build(GuiPresenter &parent) const
        {
                if (m_mode == CallMode::UNDEFINED || !m_cm || !m_parentWidget) {
                        LOG_RETURN_VALUE(RES_FAIL, {}, "Main params are are set");
@@ -138,7 +138,7 @@ namespace callui {
        CallInfoPresenter::CallInfoPresenter(IRefCountObj &rc,
                        const ICallManagerSRef &cm,
                        CallMode mode):
-                       Presenter(rc),
+                       GuiPresenter(rc),
                        m_mode(mode),
                        m_isSubTxtEnable(false),
                        m_needModifyCallStatus(false)
@@ -150,10 +150,10 @@ namespace callui {
        {
        }
 
-       Result CallInfoPresenter::prepare(Presenter &parent,
+       Result CallInfoPresenter::prepare(GuiPresenter &parent,
                        ElmWidget &parentWidget)
        {
-               FAIL_RETURN(Presenter::prepare(parent, PF_PASSIVE),
+               FAIL_RETURN(GuiPresenter::prepare(parent, PF_PASSIVE),
                                "Presenter::prepare() failed!");
 
                m_parent = asWeak(parent);
@@ -576,7 +576,7 @@ namespace callui {
                return RES_OK;
        }
 
-       Result CallInfoPresenter::createCallStatus(Presenter &parent)
+       Result CallInfoPresenter::createCallStatus(GuiPresenter &parent)
        {
                ICallInfoWCRef callInfo;
                bool isOnHold = false;
index 6274d89420755893ab1eb21948aec7e9311d55b3..61e6d6e01cce0760ce26fa8e1aef5c8a36bcc566 100644 (file)
@@ -82,7 +82,7 @@ namespace callui {
        }
 
        CallStatusPresenterSRef
-       CallStatusPresenter::Builder::build(Presenter &parent) const
+       CallStatusPresenter::Builder::build(GuiPresenter &parent) const
        {
                if (m_mode == CallMode::UNDEFINED || !m_ly) {
                        LOG_RETURN_VALUE(RES_FAIL, {}, "Not all params are set");
@@ -102,7 +102,7 @@ namespace callui {
                        CallMode mode,
                        const ICallInfoWCRef &info,
                        bool isHeld):
-               Presenter(rc),
+               GuiPresenter(rc),
                m_ly(layout),
                m_mode(mode),
                m_info(info),
@@ -122,9 +122,9 @@ namespace callui {
                }
        }
 
-       Result CallStatusPresenter::prepare(Presenter &parent)
+       Result CallStatusPresenter::prepare(GuiPresenter &parent)
        {
-               FAIL_RETURN(Presenter::prepare(parent, PF_PASSIVE),
+               FAIL_RETURN(GuiPresenter::prepare(parent, PF_PASSIVE),
                                "Presenter::prepare() failed!");
 
                m_ly->emit(impl::SIGN_RESET, impl::SIGN_SRC_DOT);
index 3ef7cb85e55b86e516f760aff3776cad8f8a5843..531afe8261392745d899753d2dcb26aee6e70341 100644 (file)
@@ -188,7 +188,7 @@ namespace callui {
        }
 
        IndicatorPresenterSRef
-       IndicatorPresenter::Builder::build(Presenter &parent) const
+       IndicatorPresenter::Builder::build(GuiPresenter &parent) const
        {
                if (!m_provider || !m_parentWidget) {
                        LOG_RETURN_VALUE(RES_FAIL, {}, "Main params are not set");
@@ -202,7 +202,7 @@ namespace callui {
 
        IndicatorPresenter::IndicatorPresenter(IRefCountObj &rc,
                        const IIndicatorStateProviderSRef &provider):
-                                       Presenter(rc),
+                                       GuiPresenter(rc),
                                        m_provider(provider),
                                        m_isIncomingCallMode(false)
        {
@@ -212,10 +212,10 @@ namespace callui {
        {
        }
 
-       Result IndicatorPresenter::prepare(Presenter &parent,
+       Result IndicatorPresenter::prepare(GuiPresenter &parent,
                        ElmWidget &parentWidget)
        {
-               FAIL_RETURN(Presenter::prepare(parent, PF_PASSIVE),
+               FAIL_RETURN(GuiPresenter::prepare(parent, PF_PASSIVE),
                                "Presenter::prepare() failed!");
                FAIL_RETURN(createWidget(parentWidget),
                                "createWidget() failed!");
index 60ce2014cada07931e271771a775b1a523088a1e..bbb0e1c8512d3716b875d2f442cf3aeb4bfbdcfc 100644 (file)
@@ -105,7 +105,7 @@ namespace callui {
        }
 
        MoreOptionsPresenterSRef
-       MoreOptionsPresenter::Builder::build(Presenter &parent) const
+       MoreOptionsPresenter::Builder::build(GuiPresenter &parent) const
        {
                if (!m_cm || !m_sm || !m_navi || !m_parentWidget) {
                        LOG_RETURN_VALUE(RES_FAIL, {}, "Main params are not set");
@@ -124,7 +124,7 @@ namespace callui {
                        const ICallManagerSRef &cm,
                        const ISoundManagerSRef &sm,
                        const NaviframeSRef &navi):
-                       Presenter(rc),
+                       GuiPresenter(rc),
                        m_cm(cm),
                        m_sm(sm),
                        m_navi(navi),
@@ -151,10 +151,10 @@ namespace callui {
                }
        }
 
-       Result MoreOptionsPresenter::prepare(Presenter &parent,
+       Result MoreOptionsPresenter::prepare(GuiPresenter &parent,
                        ElmWidget &parentWidget)
        {
-               FAIL_RETURN(Presenter::prepare(parent, PF_DEACTIVATOR),
+               FAIL_RETURN(GuiPresenter::prepare(parent, PF_DEACTIVATOR),
                                "Presenter::prepare() failed!");
 
                FAIL_RETURN(createWidget(parentWidget), "createWidget() failed!");
index 8695f630a7b6c40870ad21f0d5c94823ad6038a5..1f5e85d0ed039d8e8f407bf7478601b34375c7b6 100644 (file)
@@ -29,7 +29,7 @@ namespace callui {
 
        Page::Page(IRefCountObj &rc, const NaviframeSRef &navi,
                        const ExitRequestHandler &onExitRequest) :
-               Presenter(rc),
+               GuiPresenter(rc),
                m_navi(navi),
                m_onExitRequest(onExitRequest)
        {
@@ -69,7 +69,7 @@ namespace callui {
                m_item.setData(this);
                m_item.setDelCallback(CALLBACK_A(Page::onItemDel));
 
-               m_rc->ref();
+               m_selfRef = asShared(*this);
 
                if (!m_navi->isInTransition() && isAtTop()) {
                        dispatchTopPageChanged();
@@ -91,7 +91,7 @@ namespace callui {
        void Page::onItemDel(Evas_Object *obj, void *eventInfo)
        {
                m_item = nullptr;
-               m_rc->unref();
+               m_selfRef.reset();
        }
 
        void Page::exit()
diff --git a/src/presenters/Presenter.cpp b/src/presenters/Presenter.cpp
deleted file mode 100644 (file)
index b17f5cd..0000000
+++ /dev/null
@@ -1,258 +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 "presenters/Presenter.h"
-
-#include "common.h"
-
-namespace callui { namespace { namespace impl {
-
-       constexpr SmartEvent ACTIVATE_BY {"callui,activate,by"};
-       constexpr SmartEvent DEACTIVATE_BY {"callui,deactivate,by"};
-}}}
-
-namespace callui {
-
-       using namespace ucl;
-
-       Presenter::Presenter(IRefCountObj &rc) :
-               RefCountAware(&rc),
-               m_hasBuildInSources(false),
-               m_isChild(false),
-               m_isPrepared(false)
-       {
-       }
-
-       Presenter::~Presenter()
-       {
-               if (m_hasBuildInSources) {
-                       if (m_isChild) {
-                               if (const auto parentSink = m_parentSink.lock()) {
-                                       delDeactivatorSource(*parentSink);
-                               }
-                       } else if (m_window) {
-                               delDeactivatorSource(*m_window);
-                       }
-               }
-       }
-
-       Result Presenter::prepare(ElmWidget &widget, const int flags)
-       {
-               m_window = asShared(widget.getWindow());
-               if (!m_window) {
-                       LOG_RETURN(RES_FAIL, "m_window is NULL!");
-               }
-
-               if (flags & PF_ADD_DEACTIVATOR_SOURCES) {
-                       addDeactivatorSource(*m_window);
-                       m_hasBuildInSources = true;
-               }
-
-               if (flags & PF_ADD_SELF_EXCEPT) {
-                       addDeactivatorException(m_rc->getObjPtr());
-               }
-
-               m_isPrepared = true;
-
-               return RES_OK;
-       }
-
-       Result Presenter::prepare(Presenter &parent, const int flags)
-       {
-               if (!parent.m_sink) {
-                       LOG_RETURN(RES_FAIL, "parent.m_sink is NULL!");
-               }
-
-               for (auto deactivator: parent.m_deactivators) {
-                       if (m_deactivatorExceptions.find(deactivator) ==
-                                       m_deactivatorExceptions.end()) {
-                               m_deactivators.insert(deactivator);
-                       }
-               }
-
-               if (flags & PF_ADD_DEACTIVATOR_SOURCES) {
-                       addDeactivatorSource(*parent.m_sink);
-                       m_hasBuildInSources = true;
-               }
-
-               if (flags & PF_ADD_SELF_EXCEPT) {
-                       addDeactivatorException(m_rc->getObjPtr());
-               }
-
-               m_window = parent.m_window;
-               m_parentSink = parent.m_sink;
-               m_isChild = true;
-               m_isPrepared = true;
-
-               return RES_OK;
-       }
-
-       Window &Presenter::getWindow()
-       {
-               UCL_ASSERT(isWindowReady(), "m_window is NULL!");
-               return *m_window;
-       }
-
-       bool Presenter::isWindowReady() const
-       {
-               return !!m_window;
-       }
-
-       void Presenter::addDeactivatorException(const void *const deactivator)
-       {
-               const auto pair = m_deactivatorExceptions.insert(deactivator);
-               if (pair.second) {
-                       activateBy(deactivator);
-               }
-       }
-
-       void Presenter::setDeactivatorSink(const WidgetSRef &sink)
-       {
-               m_sink = sink;
-       }
-
-       void Presenter::sendActivate(Widget &sender)
-       {
-               sendDeactivator(sender, impl::ACTIVATE_BY, m_rc->getObjPtr());
-       }
-
-       void Presenter::sendDeactivate(Widget &sender)
-       {
-               sendDeactivator(sender, impl::DEACTIVATE_BY, m_rc->getObjPtr());
-       }
-
-       void Presenter::broadcastActivate()
-       {
-               broadcastDeactivator(impl::ACTIVATE_BY, m_rc->getObjPtr());
-       }
-
-       void Presenter::broadcastDeactivate()
-       {
-               broadcastDeactivator(impl::DEACTIVATE_BY, m_rc->getObjPtr());
-       }
-
-       void Presenter::sendDeactivator(Widget &sender,
-                       SmartEvent event, const void *deactivator)
-       {
-               sendDeactivatorInfo(sender, event, {deactivator, false});
-       }
-
-       void Presenter::broadcastDeactivator(const SmartEvent event,
-                       const void *const deactivator)
-       {
-               sendDeactivatorInfo(*m_window, event, {deactivator, true});
-       }
-
-       void Presenter::sendDeactivatorInfo(Widget &sender,
-                       const SmartEvent event, const DeactivatorInfo &info)
-       {
-               sender.callEvent(event, const_cast<DeactivatorInfo *>(&info));
-       }
-
-       bool Presenter::isActive() const
-       {
-               return isEmpty(m_deactivators);
-       }
-
-       bool Presenter::isDeactivatedBy(const void *const deactivator) const
-       {
-               return (m_deactivators.find(deactivator) != m_deactivators.end());
-       }
-
-       void Presenter::activateBy(const void *const deactivator)
-       {
-               activateByImpl({deactivator, false});
-       }
-
-       void Presenter::deactivateBy(const void *const deactivator)
-       {
-               deactivateByImpl({deactivator, false});
-       }
-
-       void Presenter::addDeactivatorSource(Widget &source)
-       {
-               source.addEventHandler(impl::ACTIVATE_BY,
-                               WEAK_DELEGATE(Presenter::onActivateBySmart, asWeak(*this)));
-               source.addEventHandler(impl::DEACTIVATE_BY,
-                               WEAK_DELEGATE(Presenter::onDeactivateBySmart, asWeak(*this)));
-       }
-
-       void Presenter::delDeactivatorSource(Widget &source)
-       {
-               source.delEventHandler(impl::ACTIVATE_BY,
-                               WEAK_DELEGATE(Presenter::onActivateBySmart, asWeak(*this)));
-               source.delEventHandler(impl::DEACTIVATE_BY,
-                               WEAK_DELEGATE(Presenter::onDeactivateBySmart, asWeak(*this)));
-       }
-
-       void Presenter::activateByImpl(const DeactivatorInfo &info)
-       {
-               const auto count = m_deactivators.erase(info.deactivator);
-               if (m_isPrepared && (count > 0)) {
-                       if (m_sink) {
-                               sendDeactivatorInfo(*m_sink, impl::ACTIVATE_BY, info);
-                       }
-                       onActivateBy(info);
-                       if (m_deactivators.size() == 0) {
-                               onActivate();
-                       }
-               }
-       }
-
-       void Presenter::deactivateByImpl(const DeactivatorInfo &info)
-       {
-               if (m_deactivatorExceptions.find(info.deactivator) !=
-                               m_deactivatorExceptions.end()) {
-                       return;
-               }
-               const auto pair = m_deactivators.insert(info.deactivator);
-               if (m_isPrepared && pair.second) {
-                       if (m_sink) {
-                               sendDeactivatorInfo(*m_sink, impl::DEACTIVATE_BY, info);
-                       }
-                       onDeactivateBy(info);
-                       if (m_deactivators.size() == 1) {
-                               onDeactivate();
-                       }
-               }
-       }
-
-       void Presenter::onActivateBySmart(Widget &widget, void *eventInfo)
-       {
-               activateByImpl(*static_cast<DeactivatorInfo *>(eventInfo));
-       }
-
-       void Presenter::onDeactivateBySmart(Widget &widget, void *eventInfo)
-       {
-               deactivateByImpl(*static_cast<DeactivatorInfo *>(eventInfo));
-       }
-
-       void Presenter::onActivate()
-       {
-       }
-
-       void Presenter::onDeactivate()
-       {
-       }
-
-       void Presenter::onActivateBy(const DeactivatorInfo &info)
-       {
-       }
-
-       void Presenter::onDeactivateBy(const DeactivatorInfo &info)
-       {
-       }
-}
index ec041ff79fff4312a940b0c422cfe4016de5e7ba..ee3cd8bd53f5028a282c7fffe852afd0423f6537 100644 (file)
@@ -121,7 +121,7 @@ namespace callui {
        }
 
        RejectMsgPresenterSRef
-       RejectMsgPresenter::Builder::build(Presenter &parent) const
+       RejectMsgPresenter::Builder::build(GuiPresenter &parent) const
        {
                if (!m_provider || !m_parentWidget) {
                        LOG_RETURN_VALUE(RES_FAIL, {}, "Main params are not set");
@@ -140,7 +140,7 @@ namespace callui {
                        const IRejectMsgProviderSRef &provider,
                        const RejectMsgStateHandler &stateHandler,
                        const RejectMsgSelectHandler &selectHandler):
-                       Presenter(rc),
+                       GuiPresenter(rc),
                        m_circleEo(nullptr),
                        m_provider(provider),
                        m_stateHandler(stateHandler),
@@ -156,10 +156,10 @@ namespace callui {
                }
        }
 
-       Result RejectMsgPresenter::prepare(Presenter &parent,
+       Result RejectMsgPresenter::prepare(GuiPresenter &parent,
                        ElmWidget &parentWidget)
        {
-               FAIL_RETURN(Presenter::prepare(parent, PF_DEACTIVATOR),
+               FAIL_RETURN(GuiPresenter::prepare(parent, PF_DEACTIVATOR),
                                "Presenter::prepare() failed!");
 
                FAIL_RETURN(createWidget(parentWidget),
index 03fb991e339e47eecc595542fcd791e739fc4348..e4f85954e0117afdfd3b06e5544d416cfb1fa609 100644 (file)
@@ -108,5 +108,10 @@ namespace callui {
                return itc;
        }
 
+       LayoutTheme getImageTheme(const char *const fileName)
+       {
+               return {"layout", "callui_image", fileName};
+       }
+
 }
 
index 64c6f5ff66cc5e6693bd4247f26799822f0b4e18..8a72758ef9bf6a71fcbe179378714012c63f337e 100644 (file)
@@ -26,7 +26,7 @@ namespace ucl {
        class SysEventProvider;
        using SysEventProviderUPtr = std::unique_ptr<SysEventProvider>;
 
-       class SysEventProvider : public NonCopyable {
+       class SysEventProvider final : public NonCopyable {
        public:
                using EventHandlerAddFunc = int (*)(app_event_handler_h *,
                                app_event_type_e, app_event_cb, void *);
index f482ce43c11ee72e82a9afb703854bd57ace1965..a8b4dbc7fa6d48cdf81f6e71d81fadbb9a368ef6 100644 (file)
@@ -23,7 +23,7 @@
 
 namespace ucl {
 
-       class UIApp : private IInstanceContext {
+       class UIApp final : private IInstanceContext {
        public:
                UIApp(InstanceManagerBase &instanceMgr);
                virtual ~UIApp();
diff --git a/ucl/inc/ucl/gui/Genlist.h b/ucl/inc/ucl/gui/Genlist.h
new file mode 100644 (file)
index 0000000..ebbb43e
--- /dev/null
@@ -0,0 +1,92 @@
+/*
+ * 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 : 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/inc/ucl/gui/Genlist.hpp b/ucl/inc/ucl/gui/Genlist.hpp
new file mode 100644 (file)
index 0000000..d3cfed0
--- /dev/null
@@ -0,0 +1,132 @@
+/*
+ * 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(false),
+               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/inc/ucl/gui/GenlistItem.h b/ucl/inc/ucl/gui/GenlistItem.h
new file mode 100644 (file)
index 0000000..2c96b9c
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * 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/inc/ucl/gui/GenlistItem.hpp b/ucl/inc/ucl/gui/GenlistItem.hpp
new file mode 100644 (file)
index 0000000..6920a88
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * 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));
+       }
+}
index 37732ce7ef3991b8a8135ed436dbe337e2f7de40..9eb108e7cfacb66545e4880102ac126b25e8d506 100644 (file)
@@ -25,7 +25,7 @@ namespace ucl {
 
        class Layout : public EdjeWidget {
        public:
-               class Builder {
+               class Builder final {
                public:
                        Builder();
                        Builder &setTheme(const LayoutTheme &value);
index 4e4336c792c3cb628d86b98c46ed37c6444559a5..66693f23e97c153a036b9d116ad4c9b5a181a1c5 100644 (file)
@@ -31,7 +31,7 @@ namespace ucl {
 
        class Naviframe final : public StyledWidget {
        public:
-               class Builder {
+               class Builder final {
                public:
                        Builder();
                        Builder &setStyle(ElmStyle value);
index 2048a7d6521e5087667d325604808bdf8586205b..e60c5ec74451012407751e35bdaa677338d27535 100644 (file)
@@ -135,11 +135,11 @@ namespace ucl {
        private:
                Evas_Object *m_eo;
                EventProxies m_eventProxies;
-               bool m_isOwner: 1;
-               bool m_isBoundToEo: 1;
-               bool m_isEoRefKept: 1;
-               bool m_isSelfRefKept: 1;
-               bool m_isSelfRefUnique: 1;
+               WidgetSRef m_selfRef;
+               bool m_isOwner;
+               bool m_isBoundToEo;
+               bool m_isEoRefKept;
+               bool m_isSelfRefUnique;
        };
 
        // Non-member functions //
index b611b2569ebc411cdd1e5d43cd02812b628c0c6c..9aa598d7e55fa7bc799d3a76c31b2dfeba5e2133 100644 (file)
@@ -33,7 +33,7 @@ namespace ucl {
                        BASIC = ELM_WIN_BASIC
                };
 
-               class Builder {
+               class Builder final {
                public:
                        Builder();
 
index f598c17ff19c6c7f9eabb8dcc9b28100c998a248..d42eccb613d1d77a0da3dc28920123c486755276 100644 (file)
@@ -29,59 +29,59 @@ namespace ucl {
        // Widget casting functions from Evas_Object //
 
        template <class WIDGET_TYPE>
-       inline auto staticCast(Evas_Object *eo) ->
+       inline auto staticWidgetCast(Evas_Object *eo) ->
                        decltype(static_cast<WIDGET_TYPE *>(asWidget(eo)))
        {
                return static_cast<WIDGET_TYPE *>(asWidget(eo));
        }
 
        template <class WIDGET_TYPE>
-       inline auto staticCast(const Evas_Object *eo) ->
+       inline auto staticWidgetCast(const Evas_Object *eo) ->
                        decltype(static_cast<WIDGET_TYPE *>(asWidget(eo)))
        {
                return static_cast<WIDGET_TYPE *>(asWidget(eo));
        }
 
        template <class WIDGET_TYPE>
-       inline auto dynamicCast(Evas_Object *eo) ->
+       inline auto dynamicWidgetCast(Evas_Object *eo) ->
                        decltype(dynamic_cast<WIDGET_TYPE *>(asWidget(eo)))
        {
                return dynamic_cast<WIDGET_TYPE *>(asWidget(eo));
        }
 
        template <class WIDGET_TYPE>
-       inline auto dynamicCast(const Evas_Object *eo) ->
+       inline auto dynamicWidgetCast(const Evas_Object *eo) ->
                        decltype(dynamic_cast<WIDGET_TYPE *>(asWidget(eo)))
        {
                return dynamic_cast<WIDGET_TYPE *>(asWidget(eo));
        }
 
        template <class WIDGET_TYPE>
-       inline auto staticRefCast(Evas_Object *eo) ->
-                       decltype(asShared(staticCast<WIDGET_TYPE>(eo)))
+       inline auto staticWidgetRefCast(Evas_Object *eo) ->
+                       decltype(asShared(staticWidgetCast<WIDGET_TYPE>(eo)))
        {
-               return asShared(staticCast<WIDGET_TYPE>(eo));
+               return asShared(staticWidgetCast<WIDGET_TYPE>(eo));
        }
 
        template <class WIDGET_TYPE>
-       inline auto staticRefCast(const Evas_Object *eo) ->
-                       decltype(asShared(staticCast<WIDGET_TYPE>(eo)))
+       inline auto staticWidgetRefCast(const Evas_Object *eo) ->
+                       decltype(asShared(staticWidgetCast<WIDGET_TYPE>(eo)))
        {
-               return asShared(staticCast<WIDGET_TYPE>(eo));
+               return asShared(staticWidgetCast<WIDGET_TYPE>(eo));
        }
 
        template <class WIDGET_TYPE>
-       inline auto dynamicRefCast(Evas_Object *eo) ->
-                       decltype(asShared(dynamicCast<WIDGET_TYPE>(eo)))
+       inline auto dynamicWidgetRefCast(Evas_Object *eo) ->
+                       decltype(asShared(dynamicWidgetCast<WIDGET_TYPE>(eo)))
        {
-               return asShared(dynamicCast<WIDGET_TYPE>(eo));
+               return asShared(dynamicWidgetCast<WIDGET_TYPE>(eo));
        }
 
        template <class WIDGET_TYPE>
-       inline auto dynamicRefCast(const Evas_Object *eo) ->
-                       decltype(asShared(dynamicCast<WIDGET_TYPE>(eo)))
+       inline auto dynamicWidgetRefCast(const Evas_Object *eo) ->
+                       decltype(asShared(dynamicWidgetCast<WIDGET_TYPE>(eo)))
        {
-               return asShared(dynamicCast<WIDGET_TYPE>(eo));
+               return asShared(dynamicWidgetCast<WIDGET_TYPE>(eo));
        }
 }
 
index 454b6bc8cfbd7d96838399a49959f41e36eee569..6d43d766b9039ca6b267603c34073b061e52c531 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "ucl/misc/Aspect.h"
 #include "ucl/misc/TString.h"
+#include "ucl/misc/ConstCString.h"
 #include "ucl/misc/Variant.h"
 
 namespace ucl {
@@ -45,6 +46,10 @@ namespace ucl {
 
        struct EoDataKey : Aspect<EoDataKey> { using Aspect::Aspect; };
 
+       // Delegates //
+
+       using SmartCbHandler = Delegate<void(Evas_Object *obj, void *eventInfo)>;
+
        // WidgetEventHandler //
 
        class Widget;
@@ -89,7 +94,7 @@ namespace ucl {
 
        // AtspiGestureEventInfo //
 
-       struct AtspiGestureEventInfo {
+       struct AtspiGestureEventInfo final {
                Elm_Atspi_Gesture_Info gestureInfo;
                bool preventDefault;
                bool stopPropagation;
@@ -107,7 +112,7 @@ namespace ucl {
 
        // LayoutTheme //
 
-       struct LayoutTheme {
+       struct LayoutTheme final {
                const char *klass;
                const char *group;
                const char *style;
index 082cd91164b46123776f9c1b4193de8c855a1028..0c55bf63db2a70452ba68ce5b2f45e2b82783673 100644 (file)
@@ -30,6 +30,10 @@ namespace ucl {
                explicit constexpr Aspect(const char *name);
 
                constexpr operator const char *() const;
+
+               struct Hash final {
+                       size_t operator()(const Aspect &key) const;
+               };
        };
 
        // Non-member functions //
index aac7ddb05b17d5c1363eedf3d95ad4a8fce4460f..989468171e820ff899debd3c8c4427ce9a283845 100644 (file)
 
 namespace ucl {
 
+       // Aspect<CHILD>::Hash //
+
+       template <class CHILD>
+       size_t Aspect<CHILD>::Hash::operator()(const Aspect<CHILD> &key) const
+       {
+               constexpr size_t PRIME = 31;
+               size_t result = 0;
+               for (size_t i = 0; (key.name[i] != '\0'); ++i) {
+                       result *= PRIME;
+                       result += key.name[i];
+               }
+               return result;
+       }
+
+       // Aspect<CHILD> //
+
        template <class CHILD>
        constexpr Aspect<CHILD>::Aspect() :
                name(nullptr)
diff --git a/ucl/inc/ucl/misc/CString.h b/ucl/inc/ucl/misc/CString.h
new file mode 100644 (file)
index 0000000..396f37d
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * 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_MISC_CSTRING_H__
+#define __UCL_MISC_CSTRING_H__
+
+#include "ucl/util/types.h"
+
+namespace ucl {
+
+       class CString final : public NonCopyable {
+       public:
+               friend void swap(CString &x, CString &y) noexcept;
+
+               static CString dup(const char *ptr);
+               static CString takeover(char *ptr) noexcept;
+
+               CString() noexcept;
+               CString(std::nullptr_t) noexcept;
+               CString(CString &&s) noexcept;
+               CString(const std::string &s);
+               ~CString() noexcept;
+
+               CString &operator=(CString s) noexcept;
+
+               bool isEmpty() const;
+
+               char *release() noexcept;
+
+               char *get() const noexcept;
+
+       private:
+               explicit CString(char *ptr) noexcept;
+
+       private:
+               char *m_ptr;
+       };
+}
+
+#include "CString.hpp"
+
+#endif // __UCL_MISC_CSTRING_H__
diff --git a/ucl/inc/ucl/misc/CString.hpp b/ucl/inc/ucl/misc/CString.hpp
new file mode 100644 (file)
index 0000000..086b3c2
--- /dev/null
@@ -0,0 +1,93 @@
+/*
+ * 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/util/helpers.h"
+
+namespace ucl {
+
+       // CString //
+
+       inline CString CString::dup(const char *const ptr)
+       {
+               return CString(strDupSafe(ptr));
+       }
+
+       inline CString CString::takeover(char *const ptr) noexcept
+       {
+               return CString(ptr);
+       }
+
+       inline CString::CString(char *const ptr) noexcept :
+               m_ptr(ptr)
+       {
+       }
+
+       inline CString::CString() noexcept :
+               m_ptr(nullptr)
+       {
+       }
+
+       inline CString::CString(std::nullptr_t) noexcept :
+               CString()
+       {
+       }
+
+       inline CString::CString(CString &&s) noexcept :
+               m_ptr(s.m_ptr)
+       {
+               s.m_ptr = nullptr;
+       }
+
+       inline CString::CString(const std::string &s) :
+               m_ptr(s.empty() ? nullptr : strdup(s.c_str()))
+       {
+       }
+
+       inline CString::~CString() noexcept
+       {
+               free(m_ptr);
+       }
+
+       inline CString &CString::operator=(CString s) noexcept
+       {
+               swap(*this, s);
+               return *this;
+       }
+
+       inline bool CString::isEmpty() const
+       {
+               return !m_ptr;
+       }
+
+       inline char *CString::release() noexcept
+       {
+               char *const result = m_ptr;
+               m_ptr = nullptr;
+               return result;
+       }
+
+       inline char *CString::get() const noexcept
+       {
+               return m_ptr;
+       }
+
+       // Non-member functions //
+
+       inline void swap(CString &x, CString &y) noexcept
+       {
+               std::swap(x.m_ptr, y.m_ptr);
+       }
+}
diff --git a/ucl/inc/ucl/misc/ConstCString.h b/ucl/inc/ucl/misc/ConstCString.h
new file mode 100644 (file)
index 0000000..7f600f0
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * 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_MISC_CONST_CSTRING_H__
+#define __UCL_MISC_CONST_CSTRING_H__
+
+#include "CString.h"
+
+namespace ucl {
+
+       class ConstCString final : public NonCopyable {
+       public:
+               friend void swap(ConstCString &x, ConstCString &y) noexcept;
+
+               static ConstCString wrap(const char *ptr) noexcept;
+
+               ConstCString() noexcept;
+               ConstCString(std::nullptr_t) noexcept;
+               ConstCString(ConstCString &&s) noexcept;
+               ConstCString(CString &&s) noexcept;
+               ~ConstCString() noexcept;
+
+               ConstCString &operator=(ConstCString s) noexcept;
+
+               bool isEmpty() const;
+
+               const char *get() const noexcept;
+
+       private:
+               explicit ConstCString(const char *ptr) noexcept;
+
+       private:
+               const char *m_ptr;
+               bool m_isOwner;
+       };
+}
+
+#include "ConstCString.hpp"
+
+#endif // __UCL_MISC_CONST_CSTRING_H__
diff --git a/ucl/inc/ucl/misc/ConstCString.hpp b/ucl/inc/ucl/misc/ConstCString.hpp
new file mode 100644 (file)
index 0000000..50df605
--- /dev/null
@@ -0,0 +1,86 @@
+/*
+ * 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 {
+
+       // ConstCString //
+
+       inline ConstCString ConstCString::wrap(const char *ptr) noexcept
+       {
+               return ConstCString(ptr);
+       }
+
+       inline ConstCString::ConstCString(const char *ptr) noexcept :
+               m_ptr(ptr),
+               m_isOwner(false)
+       {
+       }
+
+       inline ConstCString::ConstCString() noexcept :
+               m_ptr(nullptr),
+               m_isOwner(false)
+       {
+       }
+
+       inline ConstCString::ConstCString(std::nullptr_t) noexcept :
+               ConstCString()
+       {
+       }
+
+       inline ConstCString::ConstCString(ConstCString &&s) noexcept :
+               m_ptr(s.m_ptr),
+               m_isOwner(s.m_isOwner)
+       {
+               s.m_isOwner = false;
+       }
+
+       inline ConstCString::ConstCString(CString &&s) noexcept :
+               m_ptr(s.release()),
+               m_isOwner(true)
+       {
+       }
+
+       inline ConstCString::~ConstCString() noexcept
+       {
+               if (m_isOwner) {
+                       free(const_cast<char *>(m_ptr));
+               }
+       }
+
+       inline ConstCString &ConstCString::operator=(ConstCString s) noexcept
+       {
+               swap(*this, s);
+               return *this;
+       }
+
+       inline bool ConstCString::isEmpty() const
+       {
+               return !m_ptr;
+       }
+
+       inline const char *ConstCString::get() const noexcept
+       {
+               return m_ptr;
+       }
+
+       // Non-member functions //
+
+       inline void swap(ConstCString &x, ConstCString &y) noexcept
+       {
+               std::swap(x.m_ptr, y.m_ptr);
+               std::swap(x.m_isOwner, y.m_isOwner);
+       }
+}
index 420954ae25494eb4c4daee96c7b783d341f860c2..cd27f298bef42c3c9453249077076888520a5168 100644 (file)
@@ -24,7 +24,7 @@
 namespace ucl {
 
        template <class DELEGATE>
-       class Event {
+       class Event final {
        public:
                Event();
 
index e8c078c1ffae453a783e9dd99fb2e1affa91e6bb..8470fed6ebdd33e23a2597c9afb54ae9f1a77570 100644 (file)
@@ -32,7 +32,7 @@ namespace ucl {
        using VarDict = Dict<Variant>;
 
        template <class KEY, class VALUE>
-       class HashMap {
+       class HashMap final {
        public:
                template <class VALUE2>
                HashMap &set(const KEY &key, VALUE2 &&value);
@@ -42,16 +42,34 @@ namespace ucl {
                bool get(const KEY &key, VALUE2 &value) const;
                VALUE get(const KEY &key) const;
 
+               void clear();
+
        private:
                template <class ENUM_CLASS>
-               struct EnumClassHash {
+               struct EnumClassHash final {
                        size_t operator()(ENUM_CLASS key) const {
                                return static_cast<size_t>(key);
                        }
                };
 
-               using Hash = typename std::conditional<std::is_enum<KEY>::value,
-                               EnumClassHash<KEY>, std::hash<KEY>>::type;
+               template <class KEY2, class = void>
+               struct GetHash final {
+                       using Type = std::hash<KEY2>;
+               };
+
+               template <class KEY2>
+               struct GetHash<KEY2, typename std::enable_if<
+                               std::is_enum<KEY2>::value>::type> {
+                       using Type = EnumClassHash<KEY2>;
+               };
+
+               template <class KEY2>
+               struct GetHash<KEY2, typename std::enable_if<
+                               std::is_class<typename KEY2::Hash>::value>::type> {
+                       using Type = typename KEY2::Hash;
+               };
+
+               using Hash = typename GetHash<KEY>::Type;
 
        private:
                std::unordered_map<KEY, VALUE, Hash> m_map;
index 05a0652c6b0f8d0df2d3e9c2d10bd20751fea53c..2ba4ffdb581e8a7ed85c92b12a514374b51f878e 100644 (file)
@@ -18,7 +18,7 @@ namespace ucl {
 
        template <class KEY, class VALUE>
        template <class VALUE2>
-       HashMap<KEY, VALUE> &HashMap<KEY, VALUE>::
+       inline HashMap<KEY, VALUE> &HashMap<KEY, VALUE>::
                        set(const KEY &key, VALUE2 &&value)
        {
                m_map.emplace(key, std::forward<VALUE2>(value));
@@ -26,7 +26,7 @@ namespace ucl {
        }
 
        template <class KEY, class VALUE>
-       HashMap<KEY, VALUE> &HashMap<KEY, VALUE>::
+       inline HashMap<KEY, VALUE> &HashMap<KEY, VALUE>::
                        unset(const KEY &key)
        {
                m_map.erase(key);
@@ -35,7 +35,7 @@ namespace ucl {
 
        template <class KEY, class VALUE>
        template <class VALUE2>
-       bool HashMap<KEY, VALUE>::
+       inline bool HashMap<KEY, VALUE>::
                        get(const KEY &key, VALUE2 &value) const
        {
                const auto it = m_map.find(key);
@@ -47,7 +47,7 @@ namespace ucl {
        }
 
        template <class KEY, class VALUE>
-       VALUE HashMap<KEY, VALUE>::
+       inline VALUE HashMap<KEY, VALUE>::
                        get(const KEY &key) const
        {
                const auto it = m_map.find(key);
@@ -56,4 +56,10 @@ namespace ucl {
                }
                return it->second;
        }
+
+       template <class KEY, class VALUE>
+       inline void HashMap<KEY, VALUE>::clear()
+       {
+               m_map.clear();
+       }
 }
index e75ecb9e384978bd39dbdef27687fbf8f773b72c..6ea5ee9cbf72e90c28f0e1729fdf0760a972f380 100644 (file)
@@ -27,6 +27,8 @@ namespace ucl {
        class RefCountAware : public Polymorphic {
        public:
                bool isShared() const;
+               UInt getUseCount() const;
+               const void *getObjPtr() const;
 
                template <class T>
                SharedRef<T> asSharedThis(T *thisAlias) const;
@@ -43,7 +45,7 @@ namespace ucl {
                // Signal to RefCountObj<T, C> to pass IRefCountObj to constructor
                enum { _IS_REF_COUNT_AWARE };
 
-       protected:
+       private:
                IRefCountObj *const m_rc;
        };
 
index 3906d0eba6e42a5d4922dc80917d7fce477a76bc..8fb38122d82e58ae5a8ae320478c5169825c5dc5 100644 (file)
@@ -28,6 +28,24 @@ namespace ucl {
                return !!m_rc;
        }
 
+       inline UInt RefCountAware::getUseCount() const
+       {
+               if (!isShared()) {
+                       UCL_ELOG("NOT SHARED: %s", typeid(*this).name());
+                       return 0;
+               }
+               return m_rc->getUseCount();
+       }
+
+       inline const void *RefCountAware::getObjPtr() const
+       {
+               if (!isShared()) {
+                       UCL_ELOG("NOT SHARED: %s", typeid(*this).name());
+                       return nullptr;
+               }
+               return m_rc->getObjPtr();
+       }
+
        template <class T>
        inline SharedRef<T> RefCountAware::asSharedThis(T *const thisAlias) const
        {
index 5ad240d85f0df33878dfab11c11bb19d670e22d5..71ca2d994c5a9643a69d6de86abc9c6fff4e3090 100644 (file)
@@ -21,7 +21,7 @@
 
 namespace ucl {
 
-       class TString {
+       class TString final {
        public:
                TString();
 
index 3bfa6d6ccb3abf23d19d37f7736938bd9714184c..654235880c6b719bb842f13a412c36d54f9a4c60 100644 (file)
@@ -21,7 +21,7 @@
 #include <vector>
 #include <initializer_list>
 
-#include "ucl/util/types.h"
+#include "ConstCString.h"
 
 namespace ucl {
 
@@ -32,12 +32,12 @@ namespace ucl {
        template <size_t N>
        using VarArray = std::array<Variant, N>;
 
-       struct VarInitList {
+       struct VarInitList final {
                VarInitList(const std::initializer_list<Variant> &il) : il(il) {}
                const std::initializer_list<Variant> &il;
        };
 
-       class Variant {
+       class Variant final {
        public:
                enum Type {
                        TYPE_NIL,
@@ -49,21 +49,6 @@ namespace ucl {
                        TYPE_ARRAY
                };
 
-       private:
-               // Helper to wrap "const char *" and manage its lifetime
-               class CStr : NonCopyable {
-               public:
-                       CStr(const char *ptr);
-                       CStr(const char *ptr, bool isOwner) noexcept;
-                       CStr(CStr &&s);
-                       ~CStr() noexcept;
-                       const char *get() const noexcept;
-                       operator const char *() const noexcept;
-               private:
-                       const char *const m_ptr;
-                       bool m_isOwner;
-               };
-
        public:
                friend void swap(Variant &x, Variant &y) noexcept;
 
@@ -106,7 +91,7 @@ namespace ucl {
                float asFloat() const noexcept;
                double asDouble() const noexcept;
 
-               CStr asString() const noexcept;
+               ConstCString asString() const noexcept;
 
                Variant *asArray() noexcept;
                const Variant *asArray() const noexcept;
index 04c66504eb7e98ab2dccc70769476c4188c460c7..fe6d977196075082acde71093ee9529bc36c0f12 100644 (file)
@@ -28,45 +28,6 @@ namespace ucl { namespace { namespace impl {
 
 namespace ucl {
 
-       // Variant::CStr //
-
-       inline Variant::CStr::CStr(const char *const ptr) :
-               m_ptr(strdup(ptr)),
-               m_isOwner(true)
-       {
-       }
-
-       inline Variant::CStr::CStr(const char *const ptr,
-                       const bool isOwner) noexcept :
-               m_ptr(ptr),
-               m_isOwner(isOwner)
-       {
-       }
-
-       inline Variant::CStr::CStr(CStr &&s) :
-               m_ptr(s.m_ptr),
-               m_isOwner(s.m_isOwner)
-       {
-               s.m_isOwner = false;
-       }
-
-       inline Variant::CStr::~CStr() noexcept
-       {
-               if (m_isOwner) {
-                       free(const_cast<char *>(m_ptr));
-               }
-       }
-
-       inline const char *Variant::CStr::get() const noexcept
-       {
-               return m_ptr;
-       }
-
-       inline Variant::CStr::operator const char *() const noexcept
-       {
-               return m_ptr;
-       }
-
        // Variant //
 
        inline Variant::Variant() noexcept :
diff --git a/ucl/inc/ucl/mvp/GuiPresenter.h b/ucl/inc/ucl/mvp/GuiPresenter.h
new file mode 100644 (file)
index 0000000..5a94af4
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * 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_GUI_PRESENTER_H__
+#define __UCL_MVP_GUI_PRESENTER_H__
+
+#include <unordered_set>
+
+#include "ucl/gui/Window.h"
+
+#include "types.h"
+
+namespace ucl {
+
+       UCL_DECLARE_REF_ALIASES(GuiPresenter);
+
+       class GuiPresenter : public RefCountAware {
+       public:
+               struct DeactivatorInfo final {
+                       const void *deactivator;
+                       bool isBroadcast;
+               };
+
+       public:
+               bool isActive() const;
+               bool isDeactivatedBy(const void *deactivator) const;
+
+               void activateBy(const void *deactivator);
+               void deactivateBy(const void *deactivator);
+
+               void addDeactivatorSource(Widget &source);
+               void delDeactivatorSource(Widget &source);
+
+       protected:
+               enum {
+                       PF_ADD_DEACTIVATOR_SOURCES = 1,
+                       PF_ADD_SELF_EXCEPT = 2,
+
+                       PF_PASSIVE = 0,
+                       PF_DEACTIVATOR = (PF_ADD_DEACTIVATOR_SOURCES | PF_ADD_SELF_EXCEPT),
+                       PF_DEFAULT = PF_ADD_DEACTIVATOR_SOURCES
+               };
+
+       protected:
+               GuiPresenter(IRefCountObj &rc);
+               virtual ~GuiPresenter();
+
+               Result prepare(ElmWidget &widget, int flags = PF_DEFAULT);
+               Result prepare(GuiPresenter &parent, int flags = PF_DEFAULT);
+
+               Window &getWindow();
+               bool isWindowReady() const;
+
+               void addDeactivatorException(const void *deactivator);
+               void setDeactivatorSink(const WidgetSRef &sink);
+
+               void sendActivate(Widget &sender);
+               void sendDeactivate(Widget &sender);
+
+               void broadcastActivate();
+               void broadcastDeactivate();
+
+               virtual void onActivate();
+               virtual void onDeactivate();
+               virtual void onActivateBy(const DeactivatorInfo &info);
+               virtual void onDeactivateBy(const DeactivatorInfo &info);
+
+       private:
+               void sendDeactivator(Widget &sender,
+                               SmartEvent event, const void *deactivator);
+               void broadcastDeactivator(SmartEvent event,
+                               const void *deactivator);
+
+               void sendDeactivatorInfo(Widget &sender, SmartEvent event,
+                               const DeactivatorInfo &info);
+
+               void activateByImpl(const DeactivatorInfo &info);
+               void deactivateByImpl(const DeactivatorInfo &info);
+
+               void onActivateBySmart(Widget &widget, void *eventInfo);
+               void onDeactivateBySmart(Widget &widget, void *eventInfo);
+
+       private:
+               std::unordered_set<const void *> m_deactivatorExceptions;
+               std::unordered_set<const void *> m_deactivators;
+               WindowSRef m_window;
+               WidgetSRef m_sink;
+               WidgetWRef m_parentSink;
+               bool m_hasBuildInSources;
+               bool m_isChild;
+               bool m_isPrepared;
+       };
+}
+
+#endif // __UCL_MVP_GUI_PRESENTER_H__
diff --git a/ucl/inc/ucl/mvp/ListItemPresenter.h b/ucl/inc/ucl/mvp/ListItemPresenter.h
new file mode 100644 (file)
index 0000000..2c90f42
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ * 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/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();
+               ItemClassCacheSRef 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);
+               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,
+                               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;
+               ItemClassCacheWRef m_itcCache;
+               SharedRef<bool> m_isActiveRef;
+               int m_flags;
+       };
+}
+
+#endif // __UCL_MVP_LIST_ITEM_PRESENTER_H__
diff --git a/ucl/inc/ucl/mvp/ListPresenter.h b/ucl/inc/ucl/mvp/ListPresenter.h
new file mode 100644 (file)
index 0000000..1d62e41
--- /dev/null
@@ -0,0 +1,113 @@
+/*
+ * 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/inc/ucl/mvp/types.h b/ucl/inc/ucl/mvp/types.h
new file mode 100644 (file)
index 0000000..6c263e2
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * 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_TYPES_H__
+#define __UCL_MVP_TYPES_H__
+
+#include "ucl/gui/types.h"
+
+#endif // __UCL_MVP_TYPES_H__
index f82a2c918dc7ef9c730b8c789a6e432c0bcaf2d8..8146eae89db30cbd0f7e6d3cae3bffe70319f234 100644 (file)
@@ -34,7 +34,7 @@ namespace ucl {
                friend class WeakRef;
 
        public:
-               int getUseCount() const noexcept;
+               UInt getUseCount() const noexcept;
 
        protected:
                constexpr BaseRef() noexcept;
index adde1c9a8afc2306be405b013d85e3d05c2d6b72..312c38ed0de68479a2ed943cdde5084f66c178a9 100644 (file)
@@ -51,7 +51,7 @@ namespace ucl {
        }
 
        template <class T>
-       inline int BaseRef<T>::getUseCount() const noexcept
+       inline UInt BaseRef<T>::getUseCount() const noexcept
        {
                return (m_rc ? m_rc->getUseCount() : 0);
        }
index c2397d44a9a0ce7547dd107018f58630df9d45f0..69d6a1c6f66ca002817a2b46de1f8a90ee6997ce 100644 (file)
@@ -28,7 +28,7 @@ namespace ucl {
                virtual bool refNz() noexcept = 0;
                virtual void refWeak() noexcept = 0;
                virtual void unrefWeak() noexcept = 0;
-               virtual unsigned getUseCount() const noexcept = 0;
+               virtual UInt getUseCount() const noexcept = 0;
                virtual const void *getObjPtr() const noexcept = 0;
        protected:
                virtual ~IRefCountObj() = default;
index 9832ff6797419ffc363468ff18ea6911b9a3b7bb..7237aa48beb67b2b6744cc2d55fb2cefe7d990e2 100644 (file)
@@ -37,7 +37,7 @@ namespace ucl {
                virtual bool refNz() noexcept final override;
                virtual void refWeak() noexcept final override;
                virtual void unrefWeak() noexcept final override;
-               virtual unsigned getUseCount() const noexcept final override;
+               virtual UInt getUseCount() const noexcept final override;
                virtual const void *getObjPtr() const noexcept final override;
 
        private:
index d3b4e97eb2253ddee01668c268904f144037f2b2..8a2c065d5513ba19d2b78a44cd9a36de14329cf6 100644 (file)
@@ -79,7 +79,7 @@ namespace ucl {
        }
 
        template <class T, class C>
-       inline unsigned RefCountObj<T, C>::getUseCount() const noexcept
+       inline UInt RefCountObj<T, C>::getUseCount() const noexcept
        {
                return m_useCounter.get();
        }
index 58d16d3027c662c84f2202fbf37ea07edd821759..e73a7639c64f00568887420512e16ffb4b2df30d 100644 (file)
@@ -21,7 +21,7 @@
 
 namespace ucl {
 
-       class CondVar : public NonCopyable {
+       class CondVar final : public NonCopyable {
        public:
                CondVar();
                ~CondVar();
index e1951bc49a26386ee9701ded03a560ef9a5dd75b..eda90ff217460ca454f352ec95105de71cb722ac 100644 (file)
@@ -25,7 +25,7 @@
 
 namespace ucl {
 
-       class Mutex : public NonCopyable {
+       class Mutex final : public NonCopyable {
        public:
                Mutex(bool recursive = false);
                ~Mutex();
index 854d0b34fd2d0ba15b5bf9a2ffe16cab40445af5..062837f6c2b71db3450f88980c0d4590af1a305c 100644 (file)
@@ -21,7 +21,7 @@
 
 namespace ucl {
 
-       class MutexLock : public NonCopyable {
+       class MutexLock final : public NonCopyable {
        public:
                MutexLock(Mutex &mutex);
                ~MutexLock();
index 69815a77e918a0ea52c6357311fd59884bb333cc..099223f6bb4a3ea86223f3bfe76b0c933b6f2e70 100644 (file)
@@ -23,14 +23,14 @@ namespace ucl {
 
        // ResultData declaration //
 
-       struct ResultData {
+       struct ResultData final {
                const char *name;
                int logPrio;
        };
 
        // Result declaration //
 
-       struct Result {
+       struct Result final {
                int value;
 
                Result() = default;
index 1b1402da4b33a842f83d62104780e8ef6d14cf71..5c708d21f3718da2b5e6b05f2d14fe60ede932d5 100644 (file)
@@ -55,7 +55,7 @@ namespace ucl {
        };
 
        template <class PRODUCT, class IPRODUCT>
-       class Factory : public IFactory<IPRODUCT> {
+       class Factory final : public IFactory<IPRODUCT> {
        public:
                using Product = PRODUCT;
        public:
index 4012ecac3be2ceee8ee60ddbe705816a31d59abf..4e1a4deca3be6e2c3af7ceefdae809180cd9d033 100644 (file)
@@ -123,13 +123,13 @@ namespace ucl {
                }
 
                if (appParams.get(AppParam::ACCELERATION_PREFERENECE, paramValue)) {
-                       const char *const accelPreference = paramValue.asString();
+                       const auto accelPreference = paramValue.asString();
                        if (isEmpty(accelPreference)) {
                                LOG_RETURN(RES_INVALID_DATA,
                                                "Invalid parameter ACCELERATION_PREFERENECE: %s",
-                                               accelPreference);
+                                               accelPreference.get());
                        }
-                       elm_config_accel_preference_set(accelPreference);
+                       elm_config_accel_preference_set(accelPreference.get());
                }
 
                return RES_OK;
@@ -157,7 +157,7 @@ namespace ucl {
 
                m_window = Window::Builder().
                                setType(winType).
-                               setName({paramValue.asString()}).
+                               setName(paramValue.asString().get()).
                                setIsOwner(true).
                                build();
                if (!m_window) {
index 7c39f813db65f58685e6300b5edf95e376a7f146..b7d227ef0d570118b62b8d238841e523b4c15934 100644 (file)
@@ -70,6 +70,6 @@ namespace ucl {
 
        Window *ElmWidget::getWindow() const
        {
-               return dynamicCast<Window>(getTopWidget());
+               return dynamicWidgetCast<Window>(getTopWidget());
        }
 }
diff --git a/ucl/src/gui/Genlist.cpp b/ucl/src/gui/Genlist.cpp
new file mode 100644 (file)
index 0000000..b0e31a5
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * 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;
+       }
+}
index dd212bfa9add22473914a287485f9c349d5b1641..02f5da2deeb2961363390e470ce95d6ac309b9b0 100644 (file)
@@ -23,7 +23,7 @@ namespace ucl {
 
        void NaviItem::popTo() const
        {
-               const auto navi = dynamicCast<Naviframe>(getWidget());
+               const auto navi = dynamicWidgetCast<Naviframe>(getWidget());
                const bool needStartTransition =
                                (navi && (navi->getTopItem() != *this));
 
@@ -36,7 +36,7 @@ namespace ucl {
 
        void NaviItem::promote() const
        {
-               const auto navi = dynamicCast<Naviframe>(getWidget());
+               const auto navi = dynamicWidgetCast<Naviframe>(getWidget());
                const bool needStartTransition =
                                (navi && (navi->getTopItem() != *this));
 
index d2c0dd65a3e9eeb4ade1d7a2294dc018fb49ebf0..096c6e1b7c1bbeadfec36552341100290cfaca86 100644 (file)
@@ -117,12 +117,11 @@ namespace ucl {
                m_isOwner(isOwner),
                m_isBoundToEo(false),
                m_isEoRefKept(false),
-               m_isSelfRefKept(false),
                m_isSelfRefUnique(false)
        {
                UCL_ASSERT(m_eo, "m_eo is NULL!");
 
-               if (m_rc) {
+               if (isShared()) {
                        evas_object_event_callback_priority_add(m_eo, EVAS_CALLBACK_DEL,
                                        EO_CALLBACK_PRIORITY_AFTER,
                                        CALLBACK_A(Widget::onEoDel), this);
@@ -139,7 +138,7 @@ namespace ucl {
                        unbindFromEo();
                }
 
-               if (m_rc) {
+               if (isShared()) {
                        evas_object_event_callback_del_full(m_eo, EVAS_CALLBACK_DEL,
                                        CALLBACK_A(Widget::onEoDel), this);
                }
@@ -177,7 +176,7 @@ namespace ucl {
        {
                updateEoRef();
 
-               if (m_rc) {
+               if (isShared()) {
                        updateSelfRef();
                }
        }
@@ -202,14 +201,10 @@ namespace ucl {
 
        void Widget::updateSelfRef()
        {
-               if (needKeepSelfRef()) {
-                       if (!m_isSelfRefKept) {
-                               m_isSelfRefKept = true;
-                               m_rc->ref();
-                       }
-               } else if (m_isSelfRefKept) {
-                       m_isSelfRefKept = false;
-                       m_rc->unref();
+               if (!needKeepSelfRef()) {
+                       m_selfRef.reset();
+               } else if (!m_selfRef) {
+                       m_selfRef = asShared(*this);
                }
        }
 
@@ -228,8 +223,8 @@ namespace ucl {
 
        void Widget::onEoDel(Evas *e, Evas_Object *obj, void *event_info)
        {
-               if (!m_isSelfRefKept) {
-                       FLOG("UNEXPECTED! m_isSelfRefKept: %d;", m_isSelfRefKept);
+               if (!m_selfRef) {
+                       FLOG("UNEXPECTED! m_selfRef is NULL!");
                        m_eo = nullptr;
                        return;
                }
@@ -239,8 +234,7 @@ namespace ucl {
                                        m_isOwner, m_isEoRefKept, m_isSelfRefUnique);
                        m_eo = nullptr;
                }
-               m_isSelfRefKept = false;
-               m_rc->unref();
+               m_selfRef.reset();
        }
 
        void Widget::onUniqueChanged(bool isUnique)
index 4509118fd27c2387c981d566215d4975fe3847f2..f723f34b5c627195c57132faf942af1aae4768c7 100644 (file)
@@ -27,9 +27,9 @@ namespace ucl {
        {
                if (aString) {
                        const int realLength = ((length < 0) ? strlen(aString) : length);
-                       const UInt size = (realLength + 1);
-                       if (size <= sizeof(m_aSmallStr.buffer)) {
-                               strncpy(m_aSmallStr.buffer, aString, size);
+                       if (realLength < sizeof(m_aSmallStr.buffer)) {
+                               strncpy(m_aSmallStr.buffer, aString, realLength);
+                               m_aSmallStr.buffer[realLength] = '\0';
                                m_type |= impl::FLAG_SMALL_STR;
                        } else {
                                m_aString.data = strndup(aString, realLength);
@@ -164,14 +164,14 @@ namespace ucl {
                return 0.0;
        }
 
-       Variant::CStr Variant::asString() const noexcept
+       ConstCString Variant::asString() const noexcept
        {
                char strBuff[impl::TMP_STR_BUFF_SIZE] = {};
                switch (m_type) {
                case TYPE_NIL:
-                       return {"", false};
+                       return ConstCString::wrap("");
                case TYPE_BOOLEAN:
-                       return {(m_aBool.value ? "true" : "false"), false};
+                       return ConstCString::wrap(m_aBool.value ? "true" : "false");
                case TYPE_INTEGER:
                        snprintf(strBuff, sizeof(strBuff), "%d", m_anInt.value);
                        break;
@@ -183,14 +183,14 @@ namespace ucl {
                        snprintf(strBuff, sizeof(strBuff), "%f", m_aDouble.value);
                        break;
                case impl::TYPE_SMALL_STR:
-                       return m_aSmallStr.buffer;
+                       return ConstCString::wrap(m_aSmallStr.buffer);
                case TYPE_STRING:
-                       return {m_aString.data, false};
+                       return ConstCString::wrap(m_aString.data);
                case TYPE_ARRAY:
                        snprintf(strBuff, sizeof(strBuff), "%d", m_anArray.length);
                        break;
                }
-               return strBuff;
+               return CString::dup(strBuff);
        }
 
        // Non-member functions //
diff --git a/ucl/src/mvp/GuiPresenter.cpp b/ucl/src/mvp/GuiPresenter.cpp
new file mode 100644 (file)
index 0000000..e23bc02
--- /dev/null
@@ -0,0 +1,257 @@
+/*
+ * 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/GuiPresenter.h"
+
+#include "common.h"
+
+namespace ucl { namespace { namespace impl {
+
+       constexpr SmartEvent ACTIVATE_BY {"ucl,activate,by"};
+       constexpr SmartEvent DEACTIVATE_BY {"ucl,deactivate,by"};
+}}}
+
+namespace ucl {
+
+       GuiPresenter::GuiPresenter(IRefCountObj &rc) :
+               RefCountAware(&rc),
+               m_hasBuildInSources(false),
+               m_isChild(false),
+               m_isPrepared(false)
+       {
+       }
+
+       GuiPresenter::~GuiPresenter()
+       {
+               if (m_hasBuildInSources) {
+                       if (m_isChild) {
+                               if (const auto parentSink = m_parentSink.lock()) {
+                                       delDeactivatorSource(*parentSink);
+                               }
+                       } else if (m_window) {
+                               delDeactivatorSource(*m_window);
+                       }
+               }
+       }
+
+       Result GuiPresenter::prepare(ElmWidget &widget, const int flags)
+       {
+               m_window = asShared(widget.getWindow());
+               if (!m_window) {
+                       LOG_RETURN(RES_FAIL, "m_window is NULL!");
+               }
+
+               if (flags & PF_ADD_DEACTIVATOR_SOURCES) {
+                       addDeactivatorSource(*m_window);
+                       m_hasBuildInSources = true;
+               }
+
+               if (flags & PF_ADD_SELF_EXCEPT) {
+                       addDeactivatorException(getObjPtr());
+               }
+
+               m_isPrepared = true;
+
+               return RES_OK;
+       }
+
+       Result GuiPresenter::prepare(GuiPresenter &parent, const int flags)
+       {
+               if (flags & PF_ADD_DEACTIVATOR_SOURCES) {
+
+                       if (!parent.m_sink) {
+                               LOG_RETURN(RES_FAIL, "parent.m_sink is NULL!");
+                       }
+
+                       for (auto deactivator: parent.m_deactivators) {
+                               if (m_deactivatorExceptions.find(deactivator) ==
+                                               m_deactivatorExceptions.end()) {
+                                       m_deactivators.insert(deactivator);
+                               }
+                       }
+
+                       addDeactivatorSource(*parent.m_sink);
+                       m_parentSink = parent.m_sink;
+                       m_hasBuildInSources = true;
+               }
+
+               if (flags & PF_ADD_SELF_EXCEPT) {
+                       addDeactivatorException(getObjPtr());
+               }
+
+               m_window = parent.m_window;
+               m_isChild = true;
+               m_isPrepared = true;
+
+               return RES_OK;
+       }
+
+       Window &GuiPresenter::getWindow()
+       {
+               UCL_ASSERT(isWindowReady(), "m_window is NULL!");
+               return *m_window;
+       }
+
+       bool GuiPresenter::isWindowReady() const
+       {
+               return !!m_window;
+       }
+
+       void GuiPresenter::addDeactivatorException(const void *const deactivator)
+       {
+               const auto pair = m_deactivatorExceptions.insert(deactivator);
+               if (pair.second) {
+                       activateBy(deactivator);
+               }
+       }
+
+       void GuiPresenter::setDeactivatorSink(const WidgetSRef &sink)
+       {
+               m_sink = sink;
+       }
+
+       void GuiPresenter::sendActivate(Widget &sender)
+       {
+               sendDeactivator(sender, impl::ACTIVATE_BY, getObjPtr());
+       }
+
+       void GuiPresenter::sendDeactivate(Widget &sender)
+       {
+               sendDeactivator(sender, impl::DEACTIVATE_BY, getObjPtr());
+       }
+
+       void GuiPresenter::broadcastActivate()
+       {
+               broadcastDeactivator(impl::ACTIVATE_BY, getObjPtr());
+       }
+
+       void GuiPresenter::broadcastDeactivate()
+       {
+               broadcastDeactivator(impl::DEACTIVATE_BY, getObjPtr());
+       }
+
+       void GuiPresenter::sendDeactivator(Widget &sender,
+                       SmartEvent event, const void *deactivator)
+       {
+               sendDeactivatorInfo(sender, event, {deactivator, false});
+       }
+
+       void GuiPresenter::broadcastDeactivator(const SmartEvent event,
+                       const void *const deactivator)
+       {
+               sendDeactivatorInfo(*m_window, event, {deactivator, true});
+       }
+
+       void GuiPresenter::sendDeactivatorInfo(Widget &sender,
+                       const SmartEvent event, const DeactivatorInfo &info)
+       {
+               sender.callEvent(event, const_cast<DeactivatorInfo *>(&info));
+       }
+
+       bool GuiPresenter::isActive() const
+       {
+               return isEmpty(m_deactivators);
+       }
+
+       bool GuiPresenter::isDeactivatedBy(const void *const deactivator) const
+       {
+               return (m_deactivators.find(deactivator) != m_deactivators.end());
+       }
+
+       void GuiPresenter::activateBy(const void *const deactivator)
+       {
+               activateByImpl({deactivator, false});
+       }
+
+       void GuiPresenter::deactivateBy(const void *const deactivator)
+       {
+               deactivateByImpl({deactivator, false});
+       }
+
+       void GuiPresenter::addDeactivatorSource(Widget &source)
+       {
+               source.addEventHandler(impl::ACTIVATE_BY, WEAK_DELEGATE(
+                               GuiPresenter::onActivateBySmart, asWeak(*this)));
+               source.addEventHandler(impl::DEACTIVATE_BY, WEAK_DELEGATE(
+                               GuiPresenter::onDeactivateBySmart, asWeak(*this)));
+       }
+
+       void GuiPresenter::delDeactivatorSource(Widget &source)
+       {
+               source.delEventHandler(impl::ACTIVATE_BY, WEAK_DELEGATE(
+                               GuiPresenter::onActivateBySmart, asWeak(*this)));
+               source.delEventHandler(impl::DEACTIVATE_BY, WEAK_DELEGATE(
+                               GuiPresenter::onDeactivateBySmart, asWeak(*this)));
+       }
+
+       void GuiPresenter::activateByImpl(const DeactivatorInfo &info)
+       {
+               const auto count = m_deactivators.erase(info.deactivator);
+               if (m_isPrepared && (count > 0)) {
+                       if (m_sink) {
+                               sendDeactivatorInfo(*m_sink, impl::ACTIVATE_BY, info);
+                       }
+                       onActivateBy(info);
+                       if (m_deactivators.size() == 0) {
+                               onActivate();
+                       }
+               }
+       }
+
+       void GuiPresenter::deactivateByImpl(const DeactivatorInfo &info)
+       {
+               if (m_deactivatorExceptions.find(info.deactivator) !=
+                               m_deactivatorExceptions.end()) {
+                       return;
+               }
+               const auto pair = m_deactivators.insert(info.deactivator);
+               if (m_isPrepared && pair.second) {
+                       if (m_sink) {
+                               sendDeactivatorInfo(*m_sink, impl::DEACTIVATE_BY, info);
+                       }
+                       onDeactivateBy(info);
+                       if (m_deactivators.size() == 1) {
+                               onDeactivate();
+                       }
+               }
+       }
+
+       void GuiPresenter::onActivateBySmart(Widget &widget, void *eventInfo)
+       {
+               activateByImpl(*static_cast<DeactivatorInfo *>(eventInfo));
+       }
+
+       void GuiPresenter::onDeactivateBySmart(Widget &widget, void *eventInfo)
+       {
+               deactivateByImpl(*static_cast<DeactivatorInfo *>(eventInfo));
+       }
+
+       void GuiPresenter::onActivate()
+       {
+       }
+
+       void GuiPresenter::onDeactivate()
+       {
+       }
+
+       void GuiPresenter::onActivateBy(const DeactivatorInfo &info)
+       {
+       }
+
+       void GuiPresenter::onDeactivateBy(const DeactivatorInfo &info)
+       {
+       }
+}
diff --git a/ucl/src/mvp/ListItemPresenter.cpp b/ucl/src/mvp/ListItemPresenter.cpp
new file mode 100644 (file)
index 0000000..e2ad69a
--- /dev/null
@@ -0,0 +1,292 @@
+/*
+ * 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");
+                               }
+                               if (const auto widget = static_cast<ListItemPresenter *>(data)->
+                                               getItemPartContent(EdjePart(part))) {
+                                       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,
+                       const ItemClassCacheSRef &itcCache,
+                       const SharedRef<bool> &isActiveRef)
+       {
+               if (!item) {
+                       LOG_RETURN_VOID(RES_FAIL, "item is NULL!");
+               }
+
+               if (m_item) {
+                       deleteDetachedItem();
+               }
+
+               m_item = item;
+               m_item.setData(this);
+               m_item.setDelCallback(CALLBACK_A(ListItemPresenter::onItemDel));
+
+               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;
+               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::ItemClassCacheSRef
+                       ListItemPresenter::getItemClassCache()
+       {
+               return m_itcCache.lock();
+       }
+
+       Result ListItemPresenter::updateItemStyle(const ElmStyle newItemStyle)
+       {
+               if (!m_item) {
+                       LOG_RETURN(RES_ILLEGAL_STATE, "m_item is NULL!");
+               }
+
+               const auto itcCache = getItemClassCache();
+               if (!itcCache) {
+                       LOG_RETURN(RES_FATAL, "itcCache is NULL!");
+               }
+
+               const auto itc = itcCache->getItemClass(newItemStyle);
+               if (!itc) {
+                       LOG_RETURN(RES_FAIL, "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)
+       {
+               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/src/mvp/ListPresenter.cpp b/ucl/src/mvp/ListPresenter.cpp
new file mode 100644 (file)
index 0000000..220b10e
--- /dev/null
@@ -0,0 +1,326 @@
+/*
+ * 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()
+       {
+       }
+
+       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).
+                               setIsOwner(true).
+                               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_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);
+       }
+}
diff --git a/ucl/src/mvp/common.h b/ucl/src/mvp/common.h
new file mode 100644 (file)
index 0000000..2894a14
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * 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_COMMON_H__
+#define __UCL_MVP_COMMON_H__
+
+#include "../common.h"
+
+#endif // __UCL_MVP_COMMON_H__