TizenRefApp-9372 [Call UI] Update UCL library 86/151186/2
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Wed, 20 Sep 2017 07:23:47 +0000 (10:23 +0300)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Wed, 20 Sep 2017 07:27:43 +0000 (10:27 +0300)
Change-Id: I4a029f86a66cec2f2440feb9348c62aa5c63bfbe

86 files changed:
call-ui/model/IActiveCall.h
call-ui/model/IBaseCallInfo.h
call-ui/model/ICallListener.h
call-ui/model/ICallManager.h
call-ui/model/ICallUI.h
call-ui/model/IContactInfo.h
call-ui/model/IEndCall.h
call-ui/model/IHeldCall.h
call-ui/model/IIncomingCall.h
call-ui/model/IIndicatorStateListener.h
call-ui/model/IIndicatorStateProvider.h
call-ui/model/IRejectMsg.h
call-ui/model/IRejectMsgProvider.h
call-ui/model/ISoundManager.h
call-ui/model/impl/ICallManagerListener.h
call-ui/model/impl/IIndicatorStateSource.h
call-ui/model/impl/SoundManager.cpp
call-ui/presenters/misc/AccessoryPresenter.cpp
call-ui/view/helpers.cpp
ucl/include/ucl/appfw/IInstance.h
ucl/include/ucl/appfw/IInstanceAppControlExt.h
ucl/include/ucl/appfw/IInstanceContext.h
ucl/include/ucl/appfw/InstanceManagerBase.h
ucl/include/ucl/appfw/SysEventProvider.h
ucl/include/ucl/appfw/UIApp.h
ucl/include/ucl/appfw/types.h
ucl/include/ucl/gui/ElmWidget.h
ucl/include/ucl/gui/Genlist.h
ucl/include/ucl/gui/Layout.h
ucl/include/ucl/gui/Naviframe.h
ucl/include/ucl/gui/RadioBox.h [new file with mode: 0644]
ucl/include/ucl/gui/RadioBox.hpp [new file with mode: 0644]
ucl/include/ucl/gui/StyledWidget.h
ucl/include/ucl/gui/Widget.h
ucl/include/ucl/gui/WidgetItem.h
ucl/include/ucl/gui/Window.h
ucl/include/ucl/gui/Window.hpp
ucl/include/ucl/misc/AutoHandle.h [deleted file]
ucl/include/ucl/misc/AutoObject.h [new file with mode: 0644]
ucl/include/ucl/misc/CArray.h [new file with mode: 0644]
ucl/include/ucl/misc/CArray.hpp [new file with mode: 0644]
ucl/include/ucl/misc/CString.h
ucl/include/ucl/misc/ConstCString.h
ucl/include/ucl/misc/MonoObservable.h [new file with mode: 0644]
ucl/include/ucl/misc/MonoObservable.hpp [new file with mode: 0644]
ucl/include/ucl/misc/Observable.h [new file with mode: 0644]
ucl/include/ucl/misc/Observable.hpp [new file with mode: 0644]
ucl/include/ucl/misc/RefCountAware.h
ucl/include/ucl/misc/Timeout.h
ucl/include/ucl/misc/Variant.h
ucl/include/ucl/misc/Variant.hpp
ucl/include/ucl/misc/types.h [new file with mode: 0644]
ucl/include/ucl/mvp/GuiPresenter.h
ucl/include/ucl/mvp/IPickable.h [new file with mode: 0644]
ucl/include/ucl/mvp/IPicker.h [new file with mode: 0644]
ucl/include/ucl/mvp/IPickerHost.h [new file with mode: 0644]
ucl/include/ucl/mvp/ListItemPresenter.h
ucl/include/ucl/mvp/ListPresenter.h
ucl/include/ucl/util/delegation/BaseDelegate.h
ucl/include/ucl/util/delegation/macro.h
ucl/include/ucl/util/helpers.h
ucl/include/ucl/util/memory/BaseRef.h
ucl/include/ucl/util/memory/IRefCountObj.h
ucl/include/ucl/util/memory/RefCountObj.h
ucl/include/ucl/util/memory/ReffedObj.h
ucl/include/ucl/util/memory/SharedRef.h
ucl/include/ucl/util/memory/WeakRef.h
ucl/include/ucl/util/memory/macro.h
ucl/include/ucl/util/threading/CondVar.h
ucl/include/ucl/util/threading/Mutex.h
ucl/include/ucl/util/threading/MutexLock.h
ucl/include/ucl/util/threading/Thread.h
ucl/include/ucl/util/types/Result.h
ucl/include/ucl/util/types/classTypes.h
ucl/source/appfw/SysEventProvider.cpp
ucl/source/gui/ElmWidget.cpp
ucl/source/gui/Genlist.cpp
ucl/source/gui/Naviframe.cpp
ucl/source/gui/RadioBox.cpp [new file with mode: 0644]
ucl/source/gui/Widget.cpp
ucl/source/gui/Window.cpp
ucl/source/misc/Timeout.cpp
ucl/source/mvp/ListItemPresenter.cpp
ucl/source/mvp/ListPresenter.cpp
ucl/source/util/types/Result.cpp
ucl/source/util/types/classTypes.cpp [new file with mode: 0644]

index 1e1db180d1a1df573b04aae10c931faeb706911d..0252b726875588992ffde9f1c65bf1bee1c1980d 100644 (file)
@@ -26,13 +26,16 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(IActiveCall);
 
-       class IActiveCall : public ucl::Polymorphic {
+       class IActiveCall : protected ucl::NonCopyable {
        public:
                virtual ICallInfoSCRef getInfo() const = 0;
                virtual bool isDialingMode() const = 0;
                virtual ucl::Result hold() = 0;
                virtual ucl::Result end() = 0;
                virtual ucl::Result split(const IConferenceCallInfoSCRef &confCallInfo) = 0;
+
+       protected:
+               ~IActiveCall() = default;
        };
 
 }
index 4987d998df07b163dccf329480a5fa6320717171..2902be3883075f46d7e128944d651f2f12980173 100644 (file)
 
 namespace callui {
 
-       class IBaseCallInfo : public ucl::Polymorphic {
+       class IBaseCallInfo : protected ucl::NonCopyable {
        public:
                virtual unsigned int getCallId() const = 0;
                virtual const std::string &getPhoneNumber() const = 0;
                virtual IContactInfoSCRef getContactInfo() const = 0;
+
+       protected:
+               ~IBaseCallInfo() = default;
        };
 
 }
index a1e59316ec2c50276c688e7e694fd6b46c091059..071fdd5e082822357cb0320bdbf2a8cfc45f47be 100644 (file)
@@ -23,10 +23,13 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(ICallListener);
 
-       class ICallListener : public ucl::Polymorphic {
+       class ICallListener : protected ucl::NonCopyable {
        public:
                virtual void onCallEvent(CallEventType type) = 0;
                virtual void onError(CallErr err) = 0;
+
+       protected:
+               ~ICallListener() = default;
        };
 
 }
index bbd1a06c7dc6f3d77564ea9e1b92d18aaed8cab4..9049b0b35fd5caf2fd81d78feaca2908cfcae5e9 100644 (file)
@@ -30,13 +30,16 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(ICallManager);
 
-       class ICallManager : public ucl::Polymorphic {
+       class ICallManager : protected ucl::NonCopyable {
        public:
                virtual IIncomingCallSRef getIncomingCall() = 0;
                virtual IActiveCallSRef getActiveCall() = 0;
                virtual IHeldCallSRef getHeldCall() = 0;
                virtual IEndCallSRef getEndCall() = 0;
                virtual CallMask getAvailableCalls() const = 0;
+
+       protected:
+               ~ICallManager() = default;
        };
 }
 
index e94cb113f1d630bc8d8ee69a3bb7d053200839bd..41f735e674646bec70f4b48b156967e0955dd561 100644 (file)
@@ -30,13 +30,16 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(ICallUI);
 
-       class ICallUI : public ucl::Polymorphic {
+       class ICallUI : protected ucl::NonCopyable {
        public:
                virtual void setListener(const ICallListenerWRef &listener) = 0;
                virtual ucl::Result processAppControl(app_control_h appControl) = 0;
                virtual ISoundManagerSRef getSoundManager() = 0;
                virtual ICallManagerSRef getCallManager() = 0;
                virtual IIndicatorStateProviderSRef getIndicatorStateProvider() = 0;
+
+       protected:
+               ~ICallUI() = default;
        };
 }
 
index 0af6b74c352521bb7e12067664d66c8acbea4ede..e220555458fba8076fd625c56d1df59ac7071b1e 100644 (file)
@@ -23,11 +23,14 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(IContactInfo);
 
-       class IContactInfo : public ucl::Polymorphic {
+       class IContactInfo : protected ucl::NonCopyable {
        public:
                virtual const std::string &getName() const = 0;
                virtual const std::string &getImagePath() const = 0;
                virtual ContactNameSourceType getNameSourceType() const = 0;
+
+       protected:
+               ~IContactInfo() = default;
        };
 }
 
index 39d2b660efaf673ff1af77a64c1c82aba1d89f31..4d8414456a3ad18e721e4337f389633d6b6a0890 100644 (file)
@@ -25,11 +25,14 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(IEndCall);
 
-       class IEndCall : public ucl::Polymorphic {
+       class IEndCall : protected ucl::NonCopyable {
        public:
                virtual ICallInfoSCRef getInfo() const = 0;
                virtual ucl::Result callBack() = 0;
                virtual ucl::Result writeMessage() = 0;
+
+       protected:
+               ~IEndCall() = default;
        };
 }
 
index 5a7d1a06fef60be083c1cc0ee7eb414b2bca734d..3fbe90d93037b277ed3a93e3bc6816ae6c8ca75a 100644 (file)
@@ -26,7 +26,7 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(IHeldCall);
 
-       class IHeldCall : public ucl::Polymorphic {
+       class IHeldCall : protected ucl::NonCopyable {
        public:
                virtual ICallInfoSCRef getInfo() const = 0;
                virtual ucl::Result unhold() = 0;
@@ -34,6 +34,9 @@ namespace callui {
                virtual ucl::Result swapWithActive() = 0;
                virtual ucl::Result end() = 0;
                virtual ucl::Result split(const IConferenceCallInfoSCRef &confCallInfo) = 0;
+
+       protected:
+               ~IHeldCall() = default;
        };
 }
 
index b90cfed581878be9ad111608d4987c923e174661..48bfee5b93e453d3770919cdb36abb9c25b73f5a 100644 (file)
@@ -27,7 +27,7 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(IIncomingCall);
 
-       class IIncomingCall : public ucl::Polymorphic {
+       class IIncomingCall : protected ucl::NonCopyable {
        public:
                virtual ICallInfoSCRef getInfo() const = 0;
                virtual IRejectMsgProviderSRef getRejectMsgProvider() const = 0;
@@ -35,6 +35,9 @@ namespace callui {
                virtual ucl::Result reject() = 0;
                virtual ucl::Result rejectWithMessage(IRejectMsgSRef message) = 0;
                virtual ucl::Result stopAlert() = 0;
+
+       protected:
+               ~IIncomingCall() = default;
        };
 }
 
index cf45cbd562d1129f018a8adbfbe7edba593a8b34..7d42c31f3c9d1e34259e0ddd346ff0411c7fb1da 100644 (file)
@@ -23,9 +23,12 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(IIndicatorStateListener);
 
-       class IIndicatorStateListener: public ucl::Polymorphic {
+       class IIndicatorStateListener: protected ucl::NonCopyable {
        public:
                virtual void onStateChanged(IndicatorProperty property) = 0;
+
+       protected:
+               ~IIndicatorStateListener() = default;
        };
 
 }
index 391c0ecc2d8b53207af779d030fd5807f789ab66..c2271e6d938e363080514ed799e315183ea5a181 100644 (file)
@@ -26,10 +26,13 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(IIndicatorStateProvider);
 
-       class IIndicatorStateProvider : public ucl::Polymorphic {
+       class IIndicatorStateProvider : protected ucl::NonCopyable {
        public:
                virtual IndicatorState getState(IndicatorProperty property) const = 0;
                virtual void setListener(IIndicatorStateListenerWRef listener) = 0;
+
+       protected:
+               ~IIndicatorStateProvider() = default;
        };
 
 }
index a250e442fc22e49541d345211b3ff9172cf6d6e4..a8b8ec7d87229d9965d78e91a7641ab588806ad9 100644 (file)
@@ -23,10 +23,12 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(IRejectMsg);
 
-       class IRejectMsg : public ucl::Polymorphic {
+       class IRejectMsg : protected ucl::NonCopyable {
        public:
                virtual std::string getText() const = 0;
 
+       protected:
+               ~IRejectMsg() = default;
        };
 
 }
index 6e7ffd0c215a12e84797618ebf329dad0a379754..20b395cd6fcef8f3f66906fd013c89ea64f4584c 100644 (file)
@@ -25,13 +25,16 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(IRejectMsgProvider);
 
-       class IRejectMsgProvider : public ucl::Polymorphic {
+       class IRejectMsgProvider : protected ucl::NonCopyable {
        public:
                using RejectMsgList = std::vector<IRejectMsgSRef>;
 
        public:
                virtual RejectMsgList getMsgList() const = 0;
                virtual int getMsgCount() const = 0;
+
+       protected:
+               ~IRejectMsgProvider() = default;
        };
 
 }
index 7f42c3996d58882076777d911c656230f84a5f75..fb728963445b77c6d0432d8477c188640cf78ea2 100644 (file)
@@ -23,7 +23,7 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(ISoundManager);
 
-       class ISoundManager: public ucl::Polymorphic {
+       class ISoundManager: protected ucl::NonCopyable {
        public:
                virtual ucl::Result setSpeakerState(bool isEnable) = 0;
                virtual ucl::Result setBluetoothState(bool isEnable) = 0;
@@ -53,6 +53,9 @@ namespace callui {
                                NotiHandler handler) = 0;
                virtual void delBTHeadsetConnectionChangeHandler(
                                const NotiHandler &handler) = 0;
+
+       protected:
+               ~ISoundManager() = default;
        };
 }
 
index 82a7609ad540afbc434c6a91d30e3609748292cf..892e6509ff93adc7c7f08e4d96a107eaa805b105 100644 (file)
@@ -23,10 +23,13 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(ICallManagerListener);
 
-       class ICallManagerListener : public ucl::Polymorphic {
+       class ICallManagerListener : protected ucl::NonCopyable {
        public:
                virtual void onCallEvent(CallEventType type) = 0;
                virtual void onError(CallManagerErr err) = 0;
+
+       protected:
+               ~ICallManagerListener() = default;
        };
 
 }
index 7752035b3757f2411fe01f429842dff7f8c5f78d..1aa894c2a6a9e0a4aa7eba4d6f3febabc5c971a8 100644 (file)
@@ -25,10 +25,13 @@ namespace callui {
 
        UCL_DECLARE_REF_ALIASES(IIndicatorStateSource);
 
-       class IIndicatorStateSource : public ucl::Polymorphic {
+       class IIndicatorStateSource : protected ucl::NonCopyable {
        public:
                virtual IndicatorState getState() const = 0;
                virtual void setStateChangeHandler(const NotiHandler &handler) = 0;
+
+       protected:
+               ~IIndicatorStateSource() = default;
        };
 }
 
index 852c8572e131cd99315119a83cc1e6ba1fe64f8f..8b39ac9338453d2275d3a16b0acf557f8b2715c0 100644 (file)
@@ -262,7 +262,7 @@ namespace callui {
 
        bool SoundManager::isBTSupported() const
        {
-               return (m_btManager != nullptr);
+               return (m_btManager.get() != nullptr);
        }
 
        bool SoundManager::isBTHeadsetConnected() const
index c27a3c6a02bc706f95b3f54fec276044c687d69e..cc72a8bca463a3893bf085b9e1f5246e694a4815 100644 (file)
@@ -463,7 +463,7 @@ namespace callui {
 
        Result AccessoryPresenter::launchBluetoothSettings()
        {
-               AutoAppCtrl appCtrl;
+               AppCtrlAuto appCtrl;
 
                FAIL_RETURN(util::getNz(app_control_create, appCtrl),
                                "app_control_create() failed!");
@@ -485,7 +485,7 @@ namespace callui {
 
        Result AccessoryPresenter::launchContacts()
        {
-               AutoAppCtrl appCtrl;
+               AppCtrlAuto appCtrl;
 
                FAIL_RETURN(util::getNz(app_control_create, appCtrl),
                                "app_control_create() failed!");
index dcc89516ac472af4f2f878fc8fe5995f22b4b2b0..ca3e7d38f2fe275e81483d3c73d148c62233592e 100644 (file)
@@ -44,7 +44,7 @@ namespace callui { namespace utils {
                }
 
                if (win->getData(impl::CIRCLE_SURFACE)) {
-                       LOG_RETURN(RES_ILLEGAL_STATE, "Circle Surface data already set!");
+                       LOG_RETURN(RES_INVALID_OPERATION, "Circle Surface data already set!");
                }
 
                const auto sfc = eext_circle_surface_conformant_add(win->getConformant());
index bf0920538fee9b3e3a0c3db737e26051b7c76b21..fd9dfe428d6a9826e6c25fa2969914557419b34d 100644 (file)
@@ -23,11 +23,13 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(IInstance);
 
-       class IInstance : public Polymorphic {
+       class IInstance : protected NonCopyable {
        public:
                virtual Result onCreate(IInstanceContext *context) = 0;
                virtual void onPause() = 0;
                virtual void onResume() = 0;
+       protected:
+               ~IInstance() = default;
        };
 }
 
index 6799a84c865ee816e0db27b5f6fd02e2bbb3053b..9720dc76b29fdc17082659776de039e44f30594a 100644 (file)
 
 namespace ucl {
 
-       class IInstanceAppControlExt : public Polymorphic {
+       class IInstanceAppControlExt : protected NonCopyable {
        public:
                virtual void onAppControl(app_control_h appControl) = 0;
+       protected:
+               ~IInstanceAppControlExt() = default;
        };
 }
 
index b06c1774d24a97cb74ba2f4da6aba47647aa0b99..bab6a5bf01d48225ca6e324bf4681f62355f97e0 100644 (file)
 
 namespace ucl {
 
-       class IInstanceContext : public Polymorphic {
+       class IInstanceContext : protected NonCopyable {
        public:
                virtual AppType getAppType() const = 0;
                virtual WindowSRef getWindow() = 0;
                virtual void exitApp() = 0;
+       protected:
+               ~IInstanceContext() = default;
        };
 }
 
index 0fdde8ca7d37512d7b308d7ef4654bc447ba8cee..04482442adaa3f269dee8a0d51310fb208d80d4b 100644 (file)
 
 namespace ucl {
 
-       class InstanceManagerBase : public Polymorphic {
+       class InstanceManagerBase : protected NonCopyable {
        public:
-               InstanceManagerBase(AppParams appParams);
-               virtual ~InstanceManagerBase();
-
                const AppParams &getAppParams() const;
 
                void setSysEventProvider(SysEventProviderUPtr provider);
@@ -34,6 +31,9 @@ namespace ucl {
                virtual IInstanceSRef newInstance() const = 0;
 
        protected:
+               InstanceManagerBase(AppParams appParams);
+               ~InstanceManagerBase();
+
                SysEventProvider &getSysEventProvider() const;
 
        private:
index 8a72758ef9bf6a71fcbe179378714012c63f337e..c2050bfc1c7ad74513afb7db36509faeb9ed971a 100644 (file)
@@ -26,7 +26,7 @@ namespace ucl {
        class SysEventProvider;
        using SysEventProviderUPtr = std::unique_ptr<SysEventProvider>;
 
-       class SysEventProvider final : public NonCopyable {
+       class SysEventProvider final : protected NonCopyable {
        public:
                using EventHandlerAddFunc = int (*)(app_event_handler_h *,
                                app_event_type_e, app_event_cb, void *);
index a8b4dbc7fa6d48cdf81f6e71d81fadbb9a368ef6..2e2b4359edced1a0c89486631f979d9d53f39ad9 100644 (file)
@@ -26,7 +26,7 @@ namespace ucl {
        class UIApp final : private IInstanceContext {
        public:
                UIApp(InstanceManagerBase &instanceMgr);
-               virtual ~UIApp();
+               ~UIApp();
 
                int run(int argc, char *argv[]);
 
index 48f8adc0233ee4e8138d3ce6d696c8301acda3e9..d8455eb82f250c3f5a618c871df96402db348a9e 100644 (file)
@@ -26,7 +26,7 @@
 
 #include "ucl/misc/HashMap.h"
 #include "ucl/misc/Event.h"
-#include "ucl/misc/AutoHandle.h"
+#include "ucl/misc/AutoObject.h"
 
 namespace ucl {
 
@@ -57,7 +57,7 @@ namespace ucl {
 
        using SysEventHandler = WeakDelegate<void(SysEvent)>;
 
-       using AutoAppCtrl = AutoHandle<app_control_h, int, app_control_destroy>;
+       using AppCtrlAuto = AutoObject<app_control_h, int, app_control_destroy>;
 }
 
 #endif // __UCL_APPFW_TYPES_H__
index f967cc3d6ff9e70465c16b6cb662d682025da0df..795cf2b9472b91d7576037608609ea0cf88c5b0a 100644 (file)
@@ -32,6 +32,7 @@ namespace ucl {
        class ElmWidget : public Widget {
        public:
                explicit ElmWidget(Evas_Object *eo, bool isOwner = true);
+               ElmWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = true);
                virtual ~ElmWidget();
 
                void setEnabled(bool value);
@@ -47,9 +48,6 @@ namespace ucl {
                Window *getWindow() const;
 
        protected:
-               friend class ReffedObj<ElmWidget>;
-               ElmWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = true);
-
                virtual void setFocusedImpl(bool value) final override;
                virtual bool isFocusedImpl() const final override;
                virtual bool ensureFwdEvent(SmartEvent fwdEvent) override;
@@ -60,6 +58,8 @@ namespace ucl {
 
        private:
                bool m_isAtspiGestureCbSet;
+
+               friend class ReffedObj<ElmWidget>;
        };
 
        // Non-member functions //
index 366eccf2c2bf245201495a8d90fa522c9e447872..7c80ab455004c8bf333a64b8de753f184296d13a 100644 (file)
@@ -51,7 +51,6 @@ namespace ucl {
                };
 
        public:
-               friend class ReffedObj<Genlist>;
                using StyledWidget::StyledWidget;
 
                void setMode(Mode mode);
@@ -84,6 +83,9 @@ namespace ucl {
                                SmartCbHandler onSelect = nullptr,
                                GenlistItem::Type type = GenlistItem::Type::SIMPLE,
                                GenlistItem parent = nullptr);
+
+       private:
+               friend class ReffedObj<Genlist>;
        };
 }
 
index d349f9234906aaeaf1224db70245de47e5b2fb69..dbfc163bc4cec3ccfc46f2d95a0f18607acb6156 100644 (file)
@@ -42,7 +42,6 @@ namespace ucl {
                };
 
        public:
-               friend class ReffedObj<Layout>;
                using EdjeWidget::EdjeWidget;
                explicit Layout(Evas_Object *eo, bool isOwner = true);
 
@@ -50,6 +49,9 @@ namespace ucl {
                bool setEdjeFile(const std::string &filePath, EdjeGroup group);
 
                Variant getData(EdjeDataKey key);
+
+       private:
+               friend class ReffedObj<Layout>;
        };
 }
 
index 66693f23e97c153a036b9d116ad4c9b5a181a1c5..7333e11594bc476ecb97146694b3384c00b69cec 100644 (file)
@@ -85,13 +85,14 @@ namespace ucl {
                std::vector<NaviItem> getItems() const;
 
        private:
-               friend class ReffedObj<Naviframe>;
-               Naviframe(IRefCountObj &rc, Evas_Object *eo);
+               Naviframe(IRefCountObj &rc, Evas_Object *eo, Private);
 
                void onTransitionFinished(Widget &widget, void *eventInfo);
 
        private:
                bool m_isInTransition;
+
+               friend class ReffedObj<Naviframe>;
        };
 }
 
diff --git a/ucl/include/ucl/gui/RadioBox.h b/ucl/include/ucl/gui/RadioBox.h
new file mode 100644 (file)
index 0000000..7737852
--- /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_RADIO_BOX_H__
+#define __UCL_GUI_RADIO_BOX_H__
+
+#include "StyledWidget.h"
+
+namespace ucl {
+
+       UCL_DECLARE_REF_ALIASES(RadioBox);
+
+       class RadioBox final : public StyledWidget {
+       public:
+               class Builder final {
+               public:
+                       Builder();
+                       Builder &setStyle(ElmStyle style);
+                       Builder &setIsOwner(bool value);
+                       Builder &setNeedBindToEo(bool value);
+                       RadioBoxSRef build(ElmWidget &parent) const;
+               private:
+                       ElmStyle m_style;
+                       bool m_isOwner;
+                       bool m_needBindToEo;
+               };
+
+       public:
+               using StyledWidget::StyledWidget;
+
+               void setItemValue(int value);
+               int getItemValue() const;
+
+               void addToGroup(Elm_Radio *group);
+
+               void setGroupValue(int value);
+               int getGroupValue() const;
+
+               void setGroupValuePointer(int *valuePtr);
+
+               Elm_Radio *getSelectedObject() const;
+
+       private:
+               friend class ReffedObj<RadioBox>;
+       };
+}
+
+#include "RadioBox.hpp"
+
+#endif // __UCL_GUI_RADIO_BOX_H__
diff --git a/ucl/include/ucl/gui/RadioBox.hpp b/ucl/include/ucl/gui/RadioBox.hpp
new file mode 100644 (file)
index 0000000..8943278
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * 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 {
+
+       // RadioBox::Builder //
+
+       inline RadioBox::Builder::Builder() :
+               m_isOwner(true),
+               m_needBindToEo(true)
+       {
+       }
+
+       inline RadioBox::Builder &RadioBox::Builder::setStyle(const ElmStyle style)
+       {
+               m_style = style;
+               return *this;
+       }
+
+       inline RadioBox::Builder &RadioBox::Builder::setIsOwner(const bool value)
+       {
+               m_isOwner = value;
+               return *this;
+       }
+
+       inline RadioBox::Builder &
+                       RadioBox::Builder::setNeedBindToEo(const bool value)
+       {
+               m_needBindToEo = value;
+               return *this;
+       }
+
+       // RadioBox //
+
+       inline void RadioBox::setItemValue(const int value)
+       {
+               elm_radio_state_value_set(getEo(), value);
+       }
+
+       inline int RadioBox::getItemValue() const
+       {
+               return elm_radio_state_value_get(getEo());
+       }
+
+       inline void RadioBox::addToGroup(Elm_Radio *const group)
+       {
+               elm_radio_group_add(getEo(), group);
+       }
+
+       inline void RadioBox::setGroupValue(const int value)
+       {
+               elm_radio_value_set(getEo(), value);
+       }
+
+       inline int RadioBox::getGroupValue() const
+       {
+               return elm_radio_value_get(getEo());
+       }
+
+       inline void RadioBox::setGroupValuePointer(int *const valuePtr)
+       {
+               elm_radio_value_pointer_set(getEo(), valuePtr);
+       }
+
+       inline Elm_Radio *RadioBox::getSelectedObject() const
+       {
+               return elm_radio_selected_object_get(getEo());
+       }
+}
index 223a2933887a20a8bd1e78b4b6ebbc80ef2d9b7c..5401d2a8eefd58c54ce40bb88e9d4c12532330ee 100644 (file)
@@ -25,11 +25,13 @@ namespace ucl {
 
        class StyledWidget : public EdjeWidget {
        public:
-               friend class ReffedObj<StyledWidget>;
                using EdjeWidget::EdjeWidget;
                explicit StyledWidget(Evas_Object *eo, bool isOwner = true);
 
                void setStyle(ElmStyle style);
+
+       private:
+               friend class ReffedObj<StyledWidget>;
        };
 }
 
index ac47866615a4b8091847e1fe09f26ba5aec795e8..49942b4a0b7e5906a7f7722ace8fea0a09b7c91d 100644 (file)
@@ -36,6 +36,7 @@ namespace ucl {
 
        public:
                explicit Widget(Evas_Object *eo, bool isOwner = true);
+               Widget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = true);
                virtual ~Widget();
 
                void bindToEo();
@@ -97,9 +98,6 @@ namespace ucl {
                bool isFocused() const;
 
        protected:
-               friend class ReffedObj<Widget>;
-               Widget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = true);
-
                virtual void setFocusedImpl(bool value);
                virtual bool isFocusedImpl() const;
                virtual bool ensureFwdEvent(SmartEvent fwdEvent);
@@ -140,6 +138,8 @@ namespace ucl {
                bool m_isBoundToEo;
                bool m_isEoRefKept;
                bool m_isSelfRefUnique;
+
+               friend class ReffedObj<Widget>;
        };
 
        // Non-member functions //
index 7794444163953b75751a1e35251b3039e759ee47..f57487beed235554351b1a0ca278637ffa8a3659 100644 (file)
@@ -30,7 +30,7 @@ namespace ucl {
                Elm_Object_Item *getIt() const;
 
                operator Elm_Object_Item *() const;
-               operator bool() const;
+               explicit operator bool() const;
 
                Evas_Object *getWidget() const;
 
index 9aa598d7e55fa7bc799d3a76c31b2dfeba5e2133..dba64f07bf3c8dfa1e8e0b41311131704b4ac63b 100644 (file)
@@ -80,12 +80,13 @@ namespace ucl {
                void lower();
 
        private:
-               friend class ReffedObj<Window>;
                Window(IRefCountObj *rc, Evas_Object *eo,
-                               bool isOwner, Evas_Object *conform);
+                               bool isOwner, Evas_Object *conform, Private);
 
        private:
                StyledWidget m_conform;
+
+               friend class ReffedObj<Window>;
        };
 
        // Non-member functions //
index d5b18286a1456a830d10987008ecb67fb8ff9e5b..9273b67d239e415dfb37a0ee82f79e2e2cc050fe 100644 (file)
@@ -85,7 +85,7 @@ namespace ucl {
        // Window //
 
        inline Window::Window(IRefCountObj *const rc, Evas_Object *const eo,
-                       const bool isOwner, Evas_Object *const conform) :
+                       const bool isOwner, Evas_Object *const conform, Private) :
                ElmWidget(rc, eo, isOwner),
                m_conform(conform)
        {
diff --git a/ucl/include/ucl/misc/AutoHandle.h b/ucl/include/ucl/misc/AutoHandle.h
deleted file mode 100644 (file)
index 27c19f4..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __UCL_MISC_AUTO_HANDLE_H__
-#define __UCL_MISC_AUTO_HANDLE_H__
-
-#include "ucl/util/types.h"
-
-namespace ucl {
-
-       template <class HANDLE, class DEL_RET, DEL_RET(*DEL_FUNC)(HANDLE)>
-       struct AutoHandle final : ucl::NonCopyable {
-               using Handle = HANDLE;
-
-               HANDLE value;
-
-               AutoHandle() :
-                       value()
-               {
-               }
-
-               AutoHandle(std::nullptr_t) :
-                       AutoHandle()
-               {
-               }
-
-               AutoHandle(HANDLE value) :
-                       value(value)
-               {
-               }
-
-               ~AutoHandle()
-               {
-                       if (value) {
-                               DEL_FUNC(value);
-                       }
-               }
-
-               AutoHandle(AutoHandle &&src) :
-                       value(src.value)
-               {
-                       src.value = nullptr;
-               }
-
-               AutoHandle &operator=(AutoHandle src)
-               {
-                       swap(*this, src);
-                       return *this;
-               }
-
-               AutoHandle &operator=(HANDLE value)
-               {
-                       AutoHandle src{value};
-                       swap(*this, src);
-                       return *this;
-               }
-
-               HANDLE *operator&()
-               {
-                       return &value;
-               }
-
-               operator HANDLE()
-               {
-                       return value;
-               }
-       };
-
-       // Non-member functions //
-
-       template <class HANDLE, class DEL_RET, DEL_RET(*DEL_FUNC)(HANDLE)>
-       inline void swap(AutoHandle<HANDLE, DEL_RET, DEL_FUNC> &x,
-                       AutoHandle<HANDLE, DEL_RET, DEL_FUNC> &y) noexcept
-       {
-               std::swap(x.value, y.value);
-       }
-}
-
-#endif // __UCL_MISC_AUTO_HANDLE_H__
diff --git a/ucl/include/ucl/misc/AutoObject.h b/ucl/include/ucl/misc/AutoObject.h
new file mode 100644 (file)
index 0000000..e2d06a1
--- /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.
+ */
+
+#ifndef __UCL_MISC_AUTO_OBJECT_H__
+#define __UCL_MISC_AUTO_OBJECT_H__
+
+#include "ucl/util/types.h"
+
+namespace ucl {
+
+       template <class OBJ_TYPE, class DEL_RET, DEL_RET(*DEL_FUNC)(OBJ_TYPE)>
+       struct AutoObject final : ucl::NonCopyable {
+               using Handle = OBJ_TYPE;
+
+               OBJ_TYPE obj;
+
+               AutoObject() :
+                       obj{}
+               {
+               }
+
+               AutoObject(std::nullptr_t) :
+                       AutoObject()
+               {
+               }
+
+               AutoObject(const OBJ_TYPE &obj) :
+                       obj{obj}
+               {
+               }
+
+               ~AutoObject()
+               {
+                       if (obj) {
+                               DEL_FUNC(obj);
+                       }
+               }
+
+               AutoObject(AutoObject &&src) :
+                       obj{src.obj}
+               {
+                       src.obj = {};
+               }
+
+               AutoObject &operator=(AutoObject src)
+               {
+                       swap(*this, src);
+                       return *this;
+               }
+
+               OBJ_TYPE *operator&()
+               {
+                       return &obj;
+               }
+
+               operator const OBJ_TYPE &() const
+               {
+                       return obj;
+               }
+       };
+
+       // Non-member functions //
+
+       template <class OBJ_TYPE, class DEL_RET, DEL_RET(*DEL_FUNC)(OBJ_TYPE)>
+       inline void swap(AutoObject<OBJ_TYPE, DEL_RET, DEL_FUNC> &x,
+                       AutoObject<OBJ_TYPE, DEL_RET, DEL_FUNC> &y) noexcept
+       {
+               using std::swap;
+               swap(x.obj, y.obj);
+       }
+}
+
+#endif // __UCL_MISC_AUTO_HANDLE_H__
diff --git a/ucl/include/ucl/misc/CArray.h b/ucl/include/ucl/misc/CArray.h
new file mode 100644 (file)
index 0000000..1318735
--- /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_CARRAY_H__
+#define __UCL_MISC_CARRAY_H__
+
+#include "ucl/util/types.h"
+
+namespace ucl {
+
+       template <class T>
+       struct CArray {
+               T *data;
+               int length;
+
+               CArray() noexcept;
+               CArray(std::nullptr_t) noexcept;
+
+               explicit operator bool() const noexcept;
+       };
+
+       // Non-member functions //
+
+       template <class T>
+       bool isValid(const CArray<T> &array);
+
+       template <class T>
+       bool isEmpty(const CArray<T> &array);
+
+       template <class T, class ITEM_DEL_CB>
+       void performDestroy(const CArray<T> &array, ITEM_DEL_CB &&itemDelCb);
+}
+
+namespace ucl { namespace aux {
+
+       template <class T>
+       void destroyUsingFree(CArray<T> array);
+}}
+
+#include "CArray.hpp"
+
+#endif // __UCL_MISC_CARRAY_H__
diff --git a/ucl/include/ucl/misc/CArray.hpp b/ucl/include/ucl/misc/CArray.hpp
new file mode 100644 (file)
index 0000000..28e9974
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * 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 {
+
+       template <class T>
+       inline CArray<T>::CArray() noexcept :
+               data{nullptr},
+               length{0}
+       {
+       }
+
+       template <class T>
+       inline CArray<T>::CArray(std::nullptr_t) noexcept :
+               CArray()
+       {
+       }
+
+       template <class T>
+       inline CArray<T>::operator bool() const noexcept
+       {
+               return !!data;
+       }
+
+       // Non-member functions //
+
+       template <class T>
+       inline bool isValid(const CArray<T> &array)
+       {
+               return (isEmpty(array) || (array.data && (array.length > 0)));
+       }
+
+       template <class T>
+       inline bool isEmpty(const CArray<T> &array)
+       {
+               return (array.length == 0);
+       }
+
+       template <class T, class ITEM_DEL_CB>
+       inline void performDestroy(const CArray<T> &array, ITEM_DEL_CB &&itemDelCb)
+       {
+               if (array.data) {
+                       for (int i = 0; i < array.length; ++i) {
+                               itemDelCb(array.data[i]);
+                       }
+                       free(array.data);
+               }
+       }
+}
+
+namespace ucl { namespace aux {
+
+       template <class T>
+       inline void destroyUsingFree(CArray<T> array)
+       {
+               performDestroy(array, ::free);
+       }
+}}
index 396f37d2c875178692805fc768964ae006d6c75a..5496cdaedfcea3a5f57767584e1bd0415670dd44 100644 (file)
@@ -21,7 +21,7 @@
 
 namespace ucl {
 
-       class CString final : public NonCopyable {
+       class CString final : protected NonCopyable {
        public:
                friend void swap(CString &x, CString &y) noexcept;
 
index 7f600f0e759045cce7439099729a13fa910aca1b..e31967621c84fb87fa2bcbab024d0392253294e1 100644 (file)
@@ -21,7 +21,7 @@
 
 namespace ucl {
 
-       class ConstCString final : public NonCopyable {
+       class ConstCString final : protected NonCopyable {
        public:
                friend void swap(ConstCString &x, ConstCString &y) noexcept;
 
diff --git a/ucl/include/ucl/misc/MonoObservable.h b/ucl/include/ucl/misc/MonoObservable.h
new file mode 100644 (file)
index 0000000..16604b2
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * 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_MONO_OBSERVABLE_H__
+#define __UCL_MISC_MONO_OBSERVABLE_H__
+
+#include "ucl/util/types.h"
+
+#include "types.h"
+
+namespace ucl {
+
+       template <class T>
+       class MonoObservable final : protected NonCopyable {
+       public:
+               template <class U>
+               friend void swap(MonoObservable<U> &x, MonoObservable<U> &y) noexcept;
+
+       public:
+               MonoObservable() noexcept;
+               explicit MonoObservable(T value) noexcept;
+               MonoObservable(T value, NotiHandler handler) noexcept;
+               MonoObservable(MonoObservable &&rv) noexcept;
+
+               MonoObservable &operator=(MonoObservable v) noexcept;
+
+               void setObserver(NotiHandler handler) noexcept;
+
+               const T &getValue() const noexcept;
+
+               operator const T &() const noexcept;
+
+               MonoObservable &operator=(const T &value);
+               MonoObservable &operator=(T &&value);
+
+       public:
+               T m_value;
+               NotiHandler m_onValueChanged;
+       };
+}
+
+#include "MonoObservable.hpp"
+
+#endif // __UCL_MISC_MONO_OBSERVABLE_H__
diff --git a/ucl/include/ucl/misc/MonoObservable.hpp b/ucl/include/ucl/misc/MonoObservable.hpp
new file mode 100644 (file)
index 0000000..a0fad4b
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * 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 {
+
+       template <class T>
+       inline MonoObservable<T>::MonoObservable() noexcept :
+               m_value{}
+       {
+       }
+
+       template <class T>
+       inline MonoObservable<T>::MonoObservable(T value) noexcept :
+               m_value{std::move(value)}
+       {
+       }
+
+       template <class T>
+       inline MonoObservable<T>::MonoObservable(
+                       T value, NotiHandler handler) noexcept :
+               m_value{std::move(value)},
+               m_onValueChanged{std::move(handler)}
+       {
+       }
+
+       template <class T>
+       inline MonoObservable<T>::MonoObservable(MonoObservable &&rv) noexcept :
+               m_value{std::move(rv.m_value)},
+               m_onValueChanged{std::move(rv.m_onValueChanged)}
+       {
+               rv.m_onValueChanged = {};
+       }
+
+       template <class T>
+       inline MonoObservable<T> &
+                       MonoObservable<T>::operator=(MonoObservable v) noexcept
+       {
+               swap(*this, v);
+       }
+
+       template <class T>
+       inline void MonoObservable<T>::setObserver(NotiHandler handler) noexcept
+       {
+               m_onValueChanged = std::move(handler);
+       }
+
+       template <class T>
+       inline const T &MonoObservable<T>::getValue() const noexcept
+       {
+               return m_value;
+       }
+
+       template <class T>
+       inline MonoObservable<T>::operator const T &() const noexcept
+       {
+               return getValue();
+       }
+
+       template <class T>
+       inline MonoObservable<T> &MonoObservable<T>::operator=(const T &value)
+       {
+               if (!(value == m_value)) {
+                       m_value = value;
+                       if (m_onValueChanged) {
+                               m_onValueChanged();
+                       }
+               }
+               return *this;
+       }
+
+       template <class T>
+       inline MonoObservable<T> &MonoObservable<T>::operator=(T &&value)
+       {
+               if (!(value == m_value)) {
+                       m_value = std::move(value);
+                       if (m_onValueChanged) {
+                               m_onValueChanged();
+                       }
+               }
+               return *this;
+       }
+
+       // Non-member functions //
+
+       template <class T>
+       inline void swap(MonoObservable<T> &x, MonoObservable<T> &y) noexcept
+       {
+               using std::swap;
+               swap(x.m_value, y.m_value);
+               swap(x.m_onValueChanged, y.m_onValueChanged);
+       }
+}
diff --git a/ucl/include/ucl/misc/Observable.h b/ucl/include/ucl/misc/Observable.h
new file mode 100644 (file)
index 0000000..dcc8063
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * 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_OBSERVABLE_H__
+#define __UCL_MISC_OBSERVABLE_H__
+
+#include "types.h"
+#include "Event.h"
+
+namespace ucl {
+
+       template <class T>
+       class Observable final : protected NonCopyable {
+       public:
+               template <class U>
+               friend void swap(Observable<U> &x, Observable<U> &y) noexcept;
+
+       public:
+               Observable() noexcept;
+               explicit Observable(T value) noexcept;
+               Observable(Observable &&rv) noexcept;
+
+               Observable &operator=(Observable v) noexcept;
+
+               void addObserver(NotiHandler handler);
+               void removeObserver(const NotiHandler &handler);
+
+               const T &getValue() const noexcept;
+
+               operator const T &() const noexcept;
+
+               Observable &operator=(const T &value);
+               Observable &operator=(T &&value);
+
+       public:
+               T m_value;
+               Event<NotiHandler> m_onValueChanged;
+       };
+}
+
+#include "Observable.hpp"
+
+#endif // __UCL_MISC_OBSERVABLE_H__
diff --git a/ucl/include/ucl/misc/Observable.hpp b/ucl/include/ucl/misc/Observable.hpp
new file mode 100644 (file)
index 0000000..01b92f3
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * 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 {
+
+       template <class T>
+       inline Observable<T>::Observable() noexcept :
+               m_value{}
+       {
+       }
+
+       template <class T>
+       inline Observable<T>::Observable(T value) noexcept :
+               m_value{std::move(value)}
+       {
+       }
+
+       template <class T>
+       inline Observable<T>::Observable(Observable &&rv) noexcept :
+               m_value{std::move(rv.m_value)},
+               m_onValueChanged{std::move(rv.m_onValueChanged)}
+       {
+               rv.m_onValueChanged = {};
+       }
+
+       template <class T>
+       inline Observable<T> &Observable<T>::operator=(Observable v) noexcept
+       {
+               swap(*this, v);
+       }
+
+       template <class T>
+       inline void Observable<T>::addObserver(NotiHandler handler)
+       {
+               m_onValueChanged += std::move(handler);
+       }
+
+       template <class T>
+       inline void Observable<T>::removeObserver(const NotiHandler &handler)
+       {
+               m_onValueChanged -= handler;
+       }
+
+       template <class T>
+       inline const T &Observable<T>::getValue() const noexcept
+       {
+               return m_value;
+       }
+
+       template <class T>
+       inline Observable<T>::operator const T &() const noexcept
+       {
+               return getValue();
+       }
+
+       template <class T>
+       inline Observable<T> &Observable<T>::operator=(const T &value)
+       {
+               if (!(value == m_value)) {
+                       m_value = value;
+                       m_onValueChanged.dispatch();
+               }
+               return *this;
+       }
+
+       template <class T>
+       inline Observable<T> &Observable<T>::operator=(T &&value)
+       {
+               if (!(value == m_value)) {
+                       m_value = std::move(value);
+                       m_onValueChanged.dispatch();
+               }
+               return *this;
+       }
+
+       // Non-member functions //
+
+       template <class T>
+       inline void swap(Observable<T> &x, Observable<T> &y) noexcept
+       {
+               using std::swap;
+               swap(x.m_value, y.m_value);
+               swap(x.m_onValueChanged, y.m_onValueChanged);
+       }
+}
index 6ea5ee9cbf72e90c28f0e1729fdf0760a972f380..2f4d4a2bf877f3066442a77030b99d0d42f808fd 100644 (file)
@@ -24,7 +24,7 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(RefCountAware);
 
-       class RefCountAware : public Polymorphic {
+       class RefCountAware : protected NonCopyable {
        public:
                bool isShared() const;
                UInt getUseCount() const;
@@ -38,7 +38,10 @@ namespace ucl {
 
        protected:
                RefCountAware(IRefCountObj *rc);
-               virtual ~RefCountAware() = default;
+               ~RefCountAware() = default;
+
+       private:
+               virtual void polymorphismEnabler() final {}
 
        public:
                // This section MUST be public!
index 165265c10512894202683e8ed297e8d0abba15a7..5ca3ae251763b9066942df13743286742c4bf594 100644 (file)
@@ -26,7 +26,7 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(Timeout);
 
-       class Timeout final : public NonCopyable {
+       class Timeout final : protected NonCopyable {
        public:
                using TimeoutHandler = WeakDelegate<void(Timeout *sender)>;
 
@@ -37,8 +37,7 @@ namespace ucl {
                bool isExpired() const;
 
        private:
-               friend class ReffedObj<Timeout>;
-               Timeout(const TimeoutHandler &handler);
+               Timeout(const TimeoutHandler &handler, Private);
                ~Timeout();
 
                Result prepare(double timeoutSec);
@@ -48,6 +47,8 @@ namespace ucl {
        private:
                Ecore_Timer *m_timer;
                TimeoutHandler m_handler;
+
+               friend class ReffedObj<Timeout>;
        };
 }
 
index 654235880c6b719bb842f13a412c36d54f9a4c60..a07e10b693991adc324dfedccd52854ed1ec26d6 100644 (file)
@@ -32,11 +32,6 @@ namespace ucl {
        template <size_t N>
        using VarArray = std::array<Variant, N>;
 
-       struct VarInitList final {
-               VarInitList(const std::initializer_list<Variant> &il) : il(il) {}
-               const std::initializer_list<Variant> &il;
-       };
-
        class Variant final {
        public:
                enum Type {
@@ -73,7 +68,7 @@ namespace ucl {
                Variant(const VarVector &anArray);
                template <size_t N>
                Variant(const VarArray<N> &anArray);
-               Variant(const VarInitList &anArray);
+               Variant(std::initializer_list<Variant> anArray);
 
                ~Variant();
 
index fe6d977196075082acde71093ee9529bc36c0f12..a648e29a630909d00773a78ae073a2b7ec974859 100644 (file)
@@ -85,8 +85,8 @@ namespace ucl {
        {
        }
 
-       inline Variant::Variant(const VarInitList &anArray) :
-               Variant(anArray.il.begin(), anArray.il.size())
+       inline Variant::Variant(std::initializer_list<Variant> anArray) :
+               Variant(anArray.begin(), anArray.size())
        {
        }
 
diff --git a/ucl/include/ucl/misc/types.h b/ucl/include/ucl/misc/types.h
new file mode 100644 (file)
index 0000000..c56004c
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * 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_TYPES_H__
+#define __UCL_MISC_TYPES_H__
+
+#include "ucl/util/smartDelegation.h"
+
+namespace ucl {
+
+       using NotiHandler = WeakDelegate<void()>;
+}
+
+#endif // __UCL_MISC_TYPES_H__
index 5a94af45ddaa1edad092dcaf8aea01b924f39c11..6b737e9a07c8c9db13ae558cdaeaf0f815d1bc69 100644 (file)
@@ -56,7 +56,7 @@ namespace ucl {
 
        protected:
                GuiPresenter(IRefCountObj &rc);
-               virtual ~GuiPresenter();
+               ~GuiPresenter();
 
                Result prepare(ElmWidget &widget, int flags = PF_DEFAULT);
                Result prepare(GuiPresenter &parent, int flags = PF_DEFAULT);
diff --git a/ucl/include/ucl/mvp/IPickable.h b/ucl/include/ucl/mvp/IPickable.h
new file mode 100644 (file)
index 0000000..c0b221d
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * 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_I_PICKABLE_H__
+#define __UCL_MVP_I_PICKABLE_H__
+
+#include "IPicker.h"
+
+namespace ucl {
+
+       UCL_DECLARE_REF_ALIASES(IPickable);
+
+       class IPickable : protected NonCopyable {
+       public:
+               virtual IPicker &getPicker() = 0;
+       protected:
+               ~IPickable() = default;
+       };
+}
+
+#endif // __UCL_MVP_I_PICKABLE_H__
diff --git a/ucl/include/ucl/mvp/IPicker.h b/ucl/include/ucl/mvp/IPicker.h
new file mode 100644 (file)
index 0000000..c071a87
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * 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_I_PICKER_H__
+#define __UCL_MVP_I_PICKER_H__
+
+#include "IPickerHost.h"
+
+namespace ucl {
+
+       class IPicker : protected NonCopyable {
+       public:
+               virtual void setPickerHost(IPickerHostWRef host) = 0;
+               virtual void setPicked(bool isPicked) = 0;
+               virtual void updatePicked(bool isPicked) = 0;
+               virtual bool isPicked() const = 0;
+       protected:
+               ~IPicker() = default;
+       };
+}
+
+#endif // __UCL_MVP_I_PICKER_H__
diff --git a/ucl/include/ucl/mvp/IPickerHost.h b/ucl/include/ucl/mvp/IPickerHost.h
new file mode 100644 (file)
index 0000000..7ea04e2
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * 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_I_PICKER_HOST_H__
+#define __UCL_MVP_I_PICKER_HOST_H__
+
+#include "types.h"
+
+namespace ucl {
+
+       UCL_DECLARE_REF_ALIASES(IPickerHost);
+
+       class IPickerHost : protected NonCopyable {
+       public:
+               virtual void incrementPickCounter() = 0;
+               virtual void decrementPickCounter() = 0;
+               virtual bool isPickModeActive() const = 0;
+       protected:
+               ~IPickerHost() = default;
+       };
+}
+
+#endif // __UCL_MVP_I_PICKER_HOST_H__
index 46d2fb41cfd45eb2efafd6ebf802fcdb8b3bc1e4..4b7d13d872be9b2ba46c62a1cc27be7bd0b27fdd 100644 (file)
 
 #include "ucl/misc/HashMap.h"
 
-#include "types.h"
+#include "IPicker.h"
 
 namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(ListItemPresenter);
 
        class ListItemPresenter : public RefCountAware,
-                       public IDisposable {
+                       public IDisposable,
+                       protected IPicker {
        public:
+               Result updateItem();
+
                // 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);
 
@@ -56,20 +57,27 @@ namespace ucl {
                                itemStyle(itemStyle), itemType(itemType) {}
                };
 
-               class ItemClass final : public NonCopyable {
+               struct ItemPickModeParams {
+                       EdjePart checkPart;
+                       ElmStyle checkStyle;
+
+                       bool isValid() const;
+               };
+
+               class ItemClass final : protected NonCopyable {
                public:
                        static ItemClassSRef newInstance(ElmStyle itemStyle);
                public:
                        Elm_Genlist_Item_Class *get();
                private:
-                       friend class ReffedObj<ItemClass>;
-                       ItemClass(ElmStyle itemStyle);
+                       ItemClass(ElmStyle itemStyle, Private);
                        ~ItemClass();
                private:
                        Elm_Genlist_Item_Class *const m_itc;
+                       friend class ReffedObj<ItemClass>;
                };
 
-               class ItemClassCache final : public NonCopyable {
+               class ItemClassCache final : protected NonCopyable {
                public:
                        ItemClassSRef getItemClass(ElmStyle itemStyle);
                        void purge();
@@ -79,18 +87,25 @@ namespace ucl {
 
        protected:
                ListItemPresenter(IRefCountObj &rc);
-               virtual ~ListItemPresenter();
+               ~ListItemPresenter();
 
                void setFlags(int flags);
                int getFlags() const;
 
                bool isActive() const;
 
+               bool isPickModeActive() const;
+               void handleItemPick(bool isPicked);
+
                GenlistItem getItem();
                ItemClassCache *getItemClassCache();
 
                Result updateItemStyle(ElmStyle newItemStyle);
 
+               WidgetSRef tryCreatePickModeItemPartContent(
+                               EdjePart part, ElmWidget &parent,
+                               const ItemPickModeParams &params);
+
                virtual ItemInsertionParams getItemInsertionParams() = 0;
 
                virtual void onItemAttached();
@@ -105,6 +120,14 @@ namespace ucl {
                virtual void onItemUnrealized();
                virtual void onItemHighlighted();
                virtual void onItemUnhighlighted();
+               virtual void onItemLongpressed();
+
+               // IPicker //
+
+               virtual void setPickerHost(IPickerHostWRef host) final override;
+               virtual void setPicked(bool isPicked) final override;
+               virtual void updatePicked(bool isPicked) final override;
+               virtual bool isPicked() const final override;
 
        private:
                void attachItem(GenlistItem item,
@@ -115,16 +138,21 @@ namespace ucl {
                void deleteDetachedItem(bool silent = false);
                void detachItem(bool silent = false);
 
+               void onPickCheckChanged(Widget &widget, void *eventInfo);
                void onItemSelectedHook();
                void onItemDel(Evas_Object *obj, void *eventInfo);
 
        private:
                ListItemPresenterSRef m_selfRef;
+               IPickerHostWRef m_pickerHost;
                GenlistItem m_item;
                ItemClassCacheSRef m_itcCache;
                SharedRef<bool> m_isActiveRef;
                ElmWidgetSRef m_parent;
                int m_flags;
+               bool m_isItemPicked;
+
+               friend class ListPresenter;
        };
 }
 
index 1d62e412ff2a7fd2bf9a55ae8fe16dc3e5566048..7f39899373ac537b8aa6cd238251d7dad6fc732e 100644 (file)
@@ -37,6 +37,7 @@ namespace ucl {
                        FLAG_NOTIFY_UNREALIZED = (1 << 9),
                        FLAG_NOTIFY_HIGHLIGHTED = (1 << 10),
                        FLAG_NOTIFY_UNHIGHLIGHTED = (1 << 11),
+                       FLAG_NOTIFY_LONGPRESSED = (1 << 12),
                };
 
                class Builder final {
@@ -72,12 +73,12 @@ namespace ucl {
                                ListItemPresenter *parent = nullptr);
 
        private:
-               friend class ReffedObj<ListPresenter>;
-               ListPresenter(IRefCountObj &rc);
-               virtual ~ListPresenter();
+               ListPresenter(IRefCountObj &rc, Private);
+               ~ListPresenter();
 
                Result prepare(GuiPresenter &parent, ElmWidget &parentWidget,
                                ElmStyle style, int flags);
+               void registerItemEvents(int flags);
 
                template <class INSERT_FUNC>
                Result insert(ListItemPresenter &itemPresenter,
@@ -97,6 +98,7 @@ namespace ucl {
                void onItemUnrealized(Widget &widget, void *eventInfo);
                void onItemHighlighted(Widget &widget, void *eventInfo);
                void onItemUnhighlighted(Widget &widget, void *eventInfo);
+               void onItemLongpressed(Widget &widget, void *eventInfo);
 
                // GuiPresenter //
 
@@ -107,6 +109,8 @@ namespace ucl {
                GenlistSRef m_genlist;
                ListItemPresenter::ItemClassCacheSRef m_itcCache;
                SharedRef<bool> m_isActiveRef;
+
+               friend class ReffedObj<ListPresenter>;
        };
 }
 
index 62b92ffbcbfe4b015926ea57f3704a27e0bba1d2..aab211737fb71974d0a736847db8add0c73a0cf0 100644 (file)
@@ -46,7 +46,7 @@ namespace ucl {
 
                const DATA &getData() const noexcept;
                StubA getStubA() const noexcept;
-               operator bool() const noexcept;
+               explicit operator bool() const noexcept;
 
        protected:
                BaseDelegate(const DATA &data, StubA stubA) noexcept;
index 62bf88ff44f7cc6d853d1c4e4cd0a3552cd4883b..89f2d2dc28129e47963e92cc8b4d37ad5733b6c8 100644 (file)
 
 #define _UCL_AFS(DELEGATE, FUNC) \
                ::ucl::AutoFuncSig<DELEGATE, void *, decltype(&FUNC)>
+#define _UCL_AFS_V(DELEGATE, FUNC) \
+               ::ucl::AutoFuncSig<DELEGATE, void, decltype(&FUNC)>
 
 // Helper macro to automatically generate different delegate objects //
 
-#define _UCL_DELEGATE(DELEGATE, FUNC, DATA) (_UCL_AFS(DELEGATE, FUNC):: \
-               Type::make<_UCL_AFS(DELEGATE, FUNC)::Data, &FUNC>(DATA))
+#define _UCL_DELEGATE(DELEGATE, FUNC, DATA) _UCL_AFS(DELEGATE, FUNC)::Type:: \
+               template make<typename _UCL_AFS(DELEGATE, FUNC)::Data, &FUNC>(DATA)
 
-#define _UCL_DELEGATE_A(DELEGATE, FUNC, DATA) (_UCL_AFS(DELEGATE, FUNC):: \
-               Type::makeA<_UCL_AFS(DELEGATE, FUNC)::Data, &FUNC>(DATA))
+#define _UCL_DELEGATE_A(DELEGATE, FUNC, DATA) _UCL_AFS(DELEGATE, FUNC)::Type:: \
+               template makeA<typename _UCL_AFS(DELEGATE, FUNC)::Data, &FUNC>(DATA)
 
-#define _UCL_DELEGATE_V(DELEGATE, FUNC) \
-               (::ucl::AutoFuncSig<DELEGATE, void, decltype(&FUNC)>::\
-                       Type::make<&FUNC>())
+#define _UCL_DELEGATE_V(DELEGATE, FUNC) _UCL_AFS_V(DELEGATE, FUNC)::Type:: \
+               template make<&FUNC>()
 
 // Helper macro to automatically generate Delegate objects //
 
 
 // Helper macro to automatically generate Callback stubs //
 
-#define UCL_CALLBACK_A(FUNC) (&_UCL_AFS(::ucl::Callback, FUNC):: \
-               Type::stubA<_UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>)
-#define UCL_CALLBACK_B(FUNC) (&_UCL_AFS(::ucl::Callback, FUNC):: \
-               Type::stubB<_UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>)
+#define UCL_CALLBACK_A(FUNC) &_UCL_AFS(::ucl::Callback, FUNC)::Type:: \
+               template stubA<typename _UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>
+#define UCL_CALLBACK_B(FUNC) &_UCL_AFS(::ucl::Callback, FUNC)::Type:: \
+               template stubB<typename _UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>
 
-#define UCL_CALLBACK_A2A(FUNC) (&_UCL_AFS(::ucl::Callback, FUNC)::Type:: \
-               stubA2A<_UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>)
-#define UCL_CALLBACK_B2A(FUNC) (&_UCL_AFS(::ucl::Callback, FUNC)::Type:: \
-               stubB2A<_UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>)
+#define UCL_CALLBACK_A2A(FUNC) &_UCL_AFS(::ucl::Callback, FUNC)::Type:: \
+               template stubA2A<typename _UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>
+#define UCL_CALLBACK_B2A(FUNC) &_UCL_AFS(::ucl::Callback, FUNC)::Type:: \
+               template stubB2A<typename _UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>
 
-#define UCL_CALLBACK_A2V(FUNC) (&::ucl::AutoFuncSig<::ucl::Callback, void, \
-               decltype(&FUNC)>::Type::stubA2V<&FUNC>)
-#define UCL_CALLBACK_B2V(FUNC) (&::ucl::AutoFuncSig<::ucl::Callback, void, \
-               decltype(&FUNC)>::Type::stubB2V<&FUNC>)
+#define UCL_CALLBACK_A2V(FUNC) &_UCL_AFS_V(::ucl::Callback, FUNC)::Type:: \
+               template stubA2V<&FUNC>
+#define UCL_CALLBACK_B2V(FUNC) &_UCL_AFS_V(::ucl::Callback, FUNC)::Type:: \
+               template stubB2V<&FUNC>
 
 #endif // __UCL_UTIL_DELEGATION_MACRO_H__
index 117d3de461eabd27f94c898c50c3a412a939a56b..5abf690809116ce60a93caa14e664670b7e4aad7 100644 (file)
@@ -52,6 +52,24 @@ namespace ucl {
                return (!value || isEmpty(*value));
        }
 
+       template <class T>
+       constexpr auto isValid(const T &value) -> decltype(value.valid())
+       {
+               return value.valid();
+       }
+
+       template <class T>
+       constexpr auto isValid(const T &value) -> decltype(value.isValid())
+       {
+               return value.isValid();
+       }
+
+       template <class T>
+       constexpr auto isValid(const T &value) -> decltype(isValid(*value))
+       {
+               return (value && isValid(*value));
+       }
+
        template <class T>
        constexpr bool isNotEmpty(T &&value);
 
index 8146eae89db30cbd0f7e6d3cae3bffe70319f234..25970000af290470457e18f3d30c0ace5c361402 100644 (file)
@@ -26,13 +26,6 @@ namespace ucl {
        public:
                using Type = T;
 
-               template <class U>
-               friend class BaseRef;
-               template <class U>
-               friend class SharedRef;
-               template <class U>
-               friend class WeakRef;
-
        public:
                UInt getUseCount() const noexcept;
 
@@ -46,6 +39,13 @@ namespace ucl {
        protected:
                IRefCountObj *m_rc;
                T *m_ptr;
+
+               template <class U>
+               friend class BaseRef;
+               template <class U>
+               friend class SharedRef;
+               template <class U>
+               friend class WeakRef;
        };
 }
 
index 69d6a1c6f66ca002817a2b46de1f8a90ee6997ce..760e61197cb856fc8caab7ed85a7fb0656642c3e 100644 (file)
@@ -21,7 +21,7 @@
 
 namespace ucl {
 
-       class IRefCountObj : public Polymorphic {
+       class IRefCountObj : protected NonCopyable {
        public:
                virtual void ref() noexcept = 0;
                virtual void unref() noexcept = 0;
@@ -31,7 +31,7 @@ namespace ucl {
                virtual UInt getUseCount() const noexcept = 0;
                virtual const void *getObjPtr() const noexcept = 0;
        protected:
-               virtual ~IRefCountObj() = default;
+               ~IRefCountObj() = default;
        };
 }
 
index 7237aa48beb67b2b6744cc2d55fb2cefe7d990e2..24c1323238b8e9cb6a4b65ddf3063d08ca442d56 100644 (file)
@@ -55,8 +55,6 @@ namespace ucl {
                                std::true_type {};
 
        private:
-               virtual ~RefCountObj() = default;
-
                template <class T2, class ...ARGS, class =
                                typename std::enable_if<!IsRefCountAware<T2>::value>::type>
                void createObj(const P<0> &, ARGS &&...args)
index c52154455705d69dd9b20925eeb518d045fb8edc..ab253bcf0ac1c330276014289ad15428a2edc173 100644 (file)
@@ -28,9 +28,6 @@ namespace ucl {
        template <class T>
        class ReffedObj final {
        private:
-               friend class RefCountObj<T, RefCounterST>;
-               friend class RefCountObj<T, RefCounterMT>;
-
                template <class ...ARGS>
                void create(ARGS &&...args);
                void destroy() noexcept;
@@ -51,6 +48,9 @@ namespace ucl {
 
        private:
                typename std::aligned_storage<sizeof(T), alignof(T)>::type m_obj;
+
+               friend class RefCountObj<T, RefCounterST>;
+               friend class RefCountObj<T, RefCounterMT>;
        };
 }
 
index 396d176b67dd0b8dc4fa8b43d24bd8d74d6dee8a..45db0c5b667d869e80a4504106f5d93136e2a3b2 100644 (file)
@@ -54,7 +54,7 @@ namespace ucl {
                void reset() noexcept;
 
                T *get() const noexcept;
-               operator bool() const noexcept;
+               explicit operator bool() const noexcept;
 
                T *operator->() const noexcept;
                typename std::add_lvalue_reference<T>::type operator*() const noexcept;
index 4cccbe6e8aa2564f7f6a311139f7fa860b781e0a..eb9605198560b3ffd9e5078d983d1591e193bf15 100644 (file)
@@ -55,7 +55,7 @@ namespace ucl {
                SharedRef<T> lock() const noexcept;
 
                T *getUnsafePtr() const noexcept;
-               operator bool() const noexcept;
+               explicit operator bool() const noexcept;
 
                template <class U, class = typename std::enable_if<
                        std::is_convertible<T *, U *>::value && (
index b97175a1886e6eba3903c05162608f3ffa63d8ae..c55adac8fcd209bf80904e73c35a8850dd8b11bb 100644 (file)
 #ifndef __UCL_UTIL_MEMORY_MACRO_H__
 #define __UCL_UTIL_MEMORY_MACRO_H__
 
+#define UCL_DECLARE_REF_ALIASES_NOFW(TYPE_NAME) \
+               using TYPE_NAME##SRef = ::ucl::SharedRef<TYPE_NAME>; \
+               using TYPE_NAME##WRef = ::ucl::WeakRef<TYPE_NAME>; \
+               using TYPE_NAME##SCRef = ::ucl::SharedRef<const TYPE_NAME>; \
+               using TYPE_NAME##WCRef = ::ucl::WeakRef<const TYPE_NAME>
+
 #define UCL_DECLARE_REF_ALIASES(CLASS_NAME) \
                class CLASS_NAME; \
-               using CLASS_NAME##SRef = ::ucl::SharedRef<CLASS_NAME>; \
-               using CLASS_NAME##WRef = ::ucl::WeakRef<CLASS_NAME>; \
-               using CLASS_NAME##SCRef = ::ucl::SharedRef<const CLASS_NAME>; \
-               using CLASS_NAME##WCRef = ::ucl::WeakRef<const CLASS_NAME>
+               UCL_DECLARE_REF_ALIASES_NOFW(CLASS_NAME)
 
 #define UCL_USING_REF_ALIASES(CLASS_NAME) \
                using CLASS_NAME; \
index e73a7639c64f00568887420512e16ffb4b2df30d..ed11c79a0cf558ed99038e2a6aef7ba0a15f5ff6 100644 (file)
@@ -21,7 +21,7 @@
 
 namespace ucl {
 
-       class CondVar final : public NonCopyable {
+       class CondVar final : protected NonCopyable {
        public:
                CondVar();
                ~CondVar();
index eda90ff217460ca454f352ec95105de71cb722ac..aa7233c973d53b1e23a0c6b1771561cb52265959 100644 (file)
@@ -25,7 +25,7 @@
 
 namespace ucl {
 
-       class Mutex final : public NonCopyable {
+       class Mutex final : protected NonCopyable {
        public:
                Mutex(bool recursive = false);
                ~Mutex();
index 062837f6c2b71db3450f88980c0d4590af1a305c..cf3eb7522b3846e37f6921871c93d0c95c0426cc 100644 (file)
@@ -21,7 +21,7 @@
 
 namespace ucl {
 
-       class MutexLock final : public NonCopyable {
+       class MutexLock final : protected NonCopyable {
        public:
                MutexLock(Mutex &mutex);
                ~MutexLock();
index 08399217281c80d25c0d0c3d1ff4137e34d4a276..66a732d738ce51536c3018d85d1d82d282efe388 100644 (file)
@@ -25,7 +25,7 @@
 
 namespace ucl {
 
-       class Thread final : public NonCopyable {
+       class Thread final : protected NonCopyable {
        public:
                Thread();
                template <class FUNC>
index 099223f6bb4a3ea86223f3bfe76b0c933b6f2e70..93bbdce8329ec287e430d46b4f182a3611d6f2b0 100644 (file)
@@ -60,7 +60,7 @@ namespace ucl {
 
                RES_FAIL              = -1,
                RES_INVALID_ARGUMENTS = -2,
-               RES_ILLEGAL_STATE     = -3,
+               RES_INVALID_OPERATION = -3,
                RES_OUT_OF_MEMORY     = -4,
                RES_IO_ERROR          = -5,
                RES_NOT_SUPPORTED     = -6,
index 5c708d21f3718da2b5e6b05f2d14fe60ede932d5..6c928ef1d4cef53a19a4aadb2760b3175ca1ae89 100644 (file)
@@ -25,33 +25,32 @@ namespace ucl {
        public:
                NonCopyable(const NonCopyable &) = delete;
                NonCopyable &operator=(const NonCopyable &) = delete;
+       private:
+               struct PrivateType {};
+       protected:
+               using Private = const PrivateType &;
+               static const PrivateType PRIVATE;
        protected:
                NonCopyable() = default;
                ~NonCopyable() = default;
        };
 
-       class Polymorphic : public NonCopyable {
-       protected:
-               Polymorphic() = default;
-               virtual ~Polymorphic() = default;
-       };
-
-       class IDisposable : public Polymorphic {
+       class IDisposable : protected NonCopyable {
        public:
                virtual void dispose() = 0;
                virtual bool isDisposed() const = 0;
        protected:
-               virtual ~IDisposable() = default;
+               ~IDisposable() = default;
        };
 
        template <class IPRODUCT>
-       class IFactory : public Polymorphic {
+       class IFactory : protected NonCopyable {
        public:
                using IProduct = IPRODUCT;
        public:
                virtual IPRODUCT *newInstance() const = 0;
        protected:
-               virtual ~IFactory() = default;
+               ~IFactory() = default;
        };
 
        template <class PRODUCT, class IPRODUCT>
index 8958aaf401d5300888b2ff80aab12aa7a10c1960..b2b6afe74b5f4a3f09b88549714b7da84a51892d 100644 (file)
@@ -22,7 +22,7 @@ namespace ucl {
 
        // SysEventProvider::EventProxy //
 
-       class SysEventProvider::EventProxy : public NonCopyable {
+       class SysEventProvider::EventProxy : protected NonCopyable {
        public:
                EventProxy(SysEventProvider &provider,
                                const SysEvent sysEvent,
index b7d227ef0d570118b62b8d238841e523b4c15934..278407bd36ac78682416f8f04eb3d20a5f75d480 100644 (file)
@@ -19,6 +19,8 @@
 #include "ucl/gui/Window.h"
 #include "ucl/gui/helpers.h"
 
+#include "common.h"
+
 namespace ucl {
 
        ElmWidget::ElmWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner) :
index b0e31a520e1cf4ecee2475059488232978ef79a9..6195bde45f4c3f1d5a30e73d4822c1f26230ed44 100644 (file)
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 #include "ucl/gui/Genlist.h"
 
 #include "common.h"
index 717940b8f7774ed8eca1d6d2820c1364ac3f9581..7beac118a6b8ca70f38febcd49cd7e13661ae2f2 100644 (file)
@@ -30,7 +30,7 @@ namespace ucl {
                        return {};
                }
 
-               auto result = makeShared<Naviframe>(eo);
+               auto result = makeShared<Naviframe>(eo, PRIVATE);
 
                if (m_needBindToEo) {
                        result->bindToEo();
@@ -47,7 +47,7 @@ namespace ucl {
 
        // Naviframe //
 
-       Naviframe::Naviframe(IRefCountObj &rc, Evas_Object *eo) :
+       Naviframe::Naviframe(IRefCountObj &rc, Evas_Object *eo, Private) :
                StyledWidget(&rc, eo),
                m_isInTransition(false)
        {
diff --git a/ucl/source/gui/RadioBox.cpp b/ucl/source/gui/RadioBox.cpp
new file mode 100644 (file)
index 0000000..3065e0a
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * 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/RadioBox.h"
+
+#include "common.h"
+
+namespace ucl {
+
+       // RadioBox::Builder //
+
+       RadioBoxSRef RadioBox::Builder::build(ElmWidget &parent) const
+       {
+               Evas_Object *const eo = elm_radio_add(parent);
+               if (!eo) {
+                       LOG_RETURN_VALUE(RES_FAIL, {}, "elm_genlist_add() failed!");
+               }
+
+               auto result = makeShared<RadioBox>(eo, m_isOwner);
+
+               if (m_needBindToEo) {
+                       result->bindToEo();
+               }
+
+               if (isValid(m_style)) {
+                       result->setStyle(m_style);
+               }
+
+               show(*result);
+
+               return result;
+       }
+}
index 096c6e1b7c1bbeadfec36552341100290cfaca86..724e54accde174dffb745cb8e6bd76157d2cdf22 100644 (file)
@@ -27,7 +27,7 @@ namespace ucl {
 
        // Widget::EventProxy //
 
-       class Widget::EventProxy : public NonCopyable {
+       class Widget::EventProxy : protected NonCopyable {
        public:
                EventProxy(Widget &widget, const WidgetEvent event,
                                const WidgetEventHandler handler) :
index 3f74e9ec29b8526e734ba698a000b2820a670e6e..166fb1fdf81b8471319fb7c942332daca1f112ea 100644 (file)
@@ -59,7 +59,7 @@ namespace ucl {
                elm_win_indicator_opacity_set(winEo, ELM_WIN_INDICATOR_OPAQUE);
                elm_win_conformant_set(winEo, EINA_TRUE);
 
-               auto result = makeShared<Window>(winEo, isOwner, conform);
+               auto result = makeShared<Window>(winEo, isOwner, conform, PRIVATE);
 
                if (m_needBindToEo) {
                        result->bindToEo();
index 41a3d3f0397790e3341452a0b0de4b5599668e7b..78638859736c56a33e2d9e81609a0bd71346f3a3 100644 (file)
@@ -23,7 +23,7 @@ namespace ucl {
        TimeoutSRef Timeout::create(double timeoutSec,
                        const TimeoutHandler &handler)
        {
-               auto result = makeShared<Timeout>(handler);
+               auto result = makeShared<Timeout>(handler, PRIVATE);
 
                FAIL_RETURN_VALUE(result->prepare(timeoutSec), {},
                                "result->prepare() failed!");
@@ -31,7 +31,7 @@ namespace ucl {
                return result;
        }
 
-       Timeout::Timeout(const TimeoutHandler &handler) :
+       Timeout::Timeout(const TimeoutHandler &handler, Private) :
                m_timer(nullptr),
                m_handler(handler)
        {
index d27568b63a72a97b09ecbf3fb107390fe025ca13..b3f8ac309d35b1c181afc40c51bf44d617f7b885 100644 (file)
 
 #include "ucl/mvp/ListItemPresenter.h"
 
+#include "ucl/gui/StyledWidget.h"
+#include "ucl/gui/helpers.h"
+
 #include "common.h"
 
+namespace ucl { namespace { namespace impl {
+
+       constexpr SmartEvent CHECK_CHANGED {"changed"};
+}}}
+
 namespace ucl {
 
        // ListItemPresenter::ItemClass //
@@ -25,14 +33,14 @@ namespace ucl {
        ListItemPresenter::ItemClassSRef ListItemPresenter::ItemClass::
                        newInstance(const ElmStyle itemStyle)
        {
-               auto result = makeShared<ItemClass>(itemStyle);
+               auto result = makeShared<ItemClass>(itemStyle, PRIVATE);
                if (!result->get()) {
                        LOG_RETURN_VALUE(RES_FAIL, {}, "Failed to create ItemClass()!");
                }
                return result;
        }
 
-       ListItemPresenter::ItemClass::ItemClass(const ElmStyle itemStyle) :
+       ListItemPresenter::ItemClass::ItemClass(const ElmStyle itemStyle, Private) :
                m_itc(elm_genlist_item_class_new())
        {
                if (!m_itc) {
@@ -113,11 +121,20 @@ namespace ucl {
                m_itcMap.clear();
        }
 
+       // ListItemPresenter::ItemPickModeParams //
+
+       bool ListItemPresenter::ItemPickModeParams::isValid() const
+       {
+               using ucl::isValid;
+               return (isValid(checkPart) && isValid(checkStyle));
+       }
+
        // ListItemPresenter //
 
        ListItemPresenter::ListItemPresenter(IRefCountObj &rc) :
                RefCountAware(&rc),
-               m_flags(PF_AUTO_UNSELECT)
+               m_flags(PF_AUTO_UNSELECT),
+               m_isItemPicked(false)
        {
        }
 
@@ -198,6 +215,103 @@ namespace ucl {
                return (m_isActiveRef ? *m_isActiveRef : false);
        }
 
+       bool ListItemPresenter::isPickModeActive() const
+       {
+               if (const auto host = m_pickerHost.lock()) {
+                       return host->isPickModeActive();
+               }
+               return false;
+       }
+
+       void ListItemPresenter::handleItemPick(const bool isPicked)
+       {
+               if (const auto host = m_pickerHost.lock()) {
+
+                       if (!host->isPickModeActive()) {
+                               WLOG("Pick mode is not active!");
+                               return;
+                       }
+
+                       if (isPicked != m_isItemPicked) {
+                               m_isItemPicked = isPicked;
+                               if (isPicked) {
+                                       host->incrementPickCounter();
+                               } else {
+                                       host->decrementPickCounter();
+                               }
+                       }
+
+               } else {
+                       WLOG("m_pickerHost is NULL");
+               }
+       }
+
+       void ListItemPresenter::setPickerHost(IPickerHostWRef host)
+       {
+               m_pickerHost = std::move(host);
+       }
+
+       void ListItemPresenter::setPicked(const bool isPicked)
+       {
+               m_isItemPicked = isPicked;
+       }
+
+       void ListItemPresenter::updatePicked(const bool isPicked)
+       {
+               if (isPicked != m_isItemPicked) {
+                       m_isItemPicked = isPicked;
+                       updateItem();
+               }
+       }
+
+       bool ListItemPresenter::isPicked() const
+       {
+               return m_isItemPicked;
+       }
+
+       WidgetSRef ListItemPresenter::tryCreatePickModeItemPartContent(
+                       EdjePart part, ElmWidget &parent,
+                       const ItemPickModeParams &params)
+       {
+               if (isNotValid(params)) {
+                       LOG_RETURN_VALUE(RES_INVALID_ARGUMENTS, {}, "params is not Valid!");
+               }
+               if (!isPickModeActive()) {
+                       return nullptr;
+               }
+               if (part != params.checkPart) {
+                       return nullptr;
+               }
+
+               auto check = makeShared<StyledWidget>(elm_check_add(parent));
+               check->setStyle(params.checkStyle);
+
+               elm_check_state_set(*check, toEina(m_isItemPicked));
+               evas_object_repeat_events_set(*check, EINA_FALSE);
+               evas_object_propagate_events_set(*check, EINA_FALSE);
+
+               check->addEventHandler(impl::CHECK_CHANGED, WEAK_DELEGATE(
+                               ListItemPresenter::onPickCheckChanged, asWeak(*this)));
+
+               return check;
+       }
+
+       void ListItemPresenter::onPickCheckChanged(Widget &widget, void *eventInfo)
+       {
+               if (!isActive()) {
+                       elm_check_state_set(widget, toEina(m_isItemPicked));
+                       return;
+               }
+
+               handleItemPick(elm_check_state_get(widget));
+
+               if (m_item) {
+                       elm_genlist_item_bring_in(m_item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
+               } else {
+                       WLOG("m_item is NULL");
+               }
+       }
+
        GenlistItem ListItemPresenter::getItem()
        {
                return m_item;
@@ -208,10 +322,21 @@ namespace ucl {
                return m_itcCache.get();
        }
 
+       Result ListItemPresenter::updateItem()
+       {
+               if (!m_item) {
+                       LOG_RETURN(RES_INVALID_OPERATION, "m_item is NULL!");
+               }
+
+               m_item.update();
+
+               return RES_OK;
+       }
+
        Result ListItemPresenter::updateItemStyle(const ElmStyle newItemStyle)
        {
                if (!m_item) {
-                       LOG_RETURN(RES_ILLEGAL_STATE, "m_item is NULL!");
+                       LOG_RETURN(RES_INVALID_OPERATION, "m_item is NULL!");
                }
                if (!m_itcCache) {
                        LOG_RETURN(RES_FATAL, "m_itcCache is NULL!");
@@ -291,4 +416,8 @@ namespace ucl {
        void ListItemPresenter::onItemUnhighlighted()
        {
        }
+
+       void ListItemPresenter::onItemLongpressed()
+       {
+       }
 }
index 28356976d58cd21035bfb070261138cf90352141..2e05ecafd32c447f3ad34f3b848f88c25b624803 100644 (file)
@@ -26,6 +26,7 @@ namespace ucl { namespace { namespace impl {
        constexpr SmartEvent ITEM_UNREALIZED {"unrealized"};
        constexpr SmartEvent ITEM_HIGHLIGHTED {"highlighted"};
        constexpr SmartEvent ITEM_UNHIGHLIGHTED {"unhighlighted"};
+       constexpr SmartEvent ITEM_LONGPRESSED {"longpressed"};
 
        ListItemPresenter *toItemPresenter(void *eventInfo)
        {
@@ -79,7 +80,7 @@ namespace ucl {
                                        "m_parentWidget is NULL!");
                }
 
-               auto result = makeShared<ListPresenter>();
+               auto result = makeShared<ListPresenter>(PRIVATE);
 
                FAIL_RETURN_VALUE(result->prepare(
                                parent, *m_parentWidget, m_style, m_flags),
@@ -90,7 +91,7 @@ namespace ucl {
 
        // ListPresenter //
 
-       ListPresenter::ListPresenter(IRefCountObj &rc) :
+       ListPresenter::ListPresenter(IRefCountObj &rc, Private) :
                        GuiPresenter(rc)
        {
        }
@@ -131,6 +132,13 @@ namespace ucl {
                m_isActiveRef = makeShared<bool>();
                *m_isActiveRef = isActive();
 
+               registerItemEvents(flags);
+
+               return RES_OK;
+       }
+
+       void ListPresenter::registerItemEvents(int flags)
+       {
                m_genlist->addEventHandler(impl::ITEM_SELECTED, WEAK_DELEGATE(
                                ListPresenter::onItemSelected, asWeak(*this)));
 
@@ -150,8 +158,10 @@ namespace ucl {
                        m_genlist->addEventHandler(impl::ITEM_UNHIGHLIGHTED, WEAK_DELEGATE(
                                        ListPresenter::onItemUnhighlighted, asWeak(*this)));
                }
-
-               return RES_OK;
+               if (flags & FLAG_NOTIFY_LONGPRESSED) {
+                       m_genlist->addEventHandler(impl::ITEM_LONGPRESSED, WEAK_DELEGATE(
+                                       ListPresenter::onItemLongpressed, asWeak(*this)));
+               }
        }
 
        Genlist &ListPresenter::getWidget()
@@ -316,6 +326,15 @@ namespace ucl {
                itemPresenter->onItemUnhighlighted();
        }
 
+       void ListPresenter::onItemLongpressed(Widget &widget, void *eventInfo)
+       {
+               const auto itemPresenter = impl::toItemPresenter(eventInfo);
+               if (!itemPresenter) {
+                       LOG_RETURN_VOID(RES_FATAL, "itemPresenter is NULL");
+               }
+               itemPresenter->onItemLongpressed();
+       }
+
        void ListPresenter::onActivate()
        {
                setIsActiveRef(true);
index b42875ed58ed7e65e93b21a30cf17abe47cf4387..9ba6c17dc6ed2085b32e063f280400ebc9bf8d5d 100644 (file)
@@ -26,7 +26,7 @@ namespace ucl { namespace { namespace impl {
                {"RES_NOT_SUPPORTED",     DLOG_ERROR},
                {"RES_IO_ERROR",          DLOG_ERROR},
                {"RES_OUT_OF_MEMORY",     DLOG_ERROR},
-               {"RES_ILLEGAL_STATE",     DLOG_ERROR},
+               {"RES_INVALID_OPERATION", DLOG_ERROR},
                {"RES_INVALID_ARGUMENTS", DLOG_ERROR},
                {"RES_FAIL",              DLOG_ERROR},
                {"RES_OK",                DLOG_INFO},
diff --git a/ucl/source/util/types/classTypes.cpp b/ucl/source/util/types/classTypes.cpp
new file mode 100644 (file)
index 0000000..d3eabaf
--- /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.
+ */
+
+#include "ucl/util/types/classTypes.h"
+
+namespace ucl {
+
+       const NonCopyable::PrivateType NonCopyable::PRIVATE;
+}