summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Olshevskyi <i.olshevskyi@samsung.com>2017-09-20 10:23:47 +0300
committerIgor Olshevskyi <i.olshevskyi@samsung.com>2017-09-20 10:27:43 +0300
commitd3235b3bf67dfe50310e10d6931b8f9f0c8a28f3 (patch)
treee2e54fb4965356b2910f391b50b3ce31f83f0d46
parent7beb1e26871e5fa740f5580f33b8cbc3bab94513 (diff)
downloadcall-ui-d3235b3bf67dfe50310e10d6931b8f9f0c8a28f3.tar.gz
call-ui-d3235b3bf67dfe50310e10d6931b8f9f0c8a28f3.tar.bz2
call-ui-d3235b3bf67dfe50310e10d6931b8f9f0c8a28f3.zip
TizenRefApp-9372 [Call UI] Update UCL library
Change-Id: I4a029f86a66cec2f2440feb9348c62aa5c63bfbe
-rw-r--r--call-ui/model/IActiveCall.h5
-rw-r--r--call-ui/model/IBaseCallInfo.h5
-rw-r--r--call-ui/model/ICallListener.h5
-rw-r--r--call-ui/model/ICallManager.h5
-rw-r--r--call-ui/model/ICallUI.h5
-rw-r--r--call-ui/model/IContactInfo.h5
-rw-r--r--call-ui/model/IEndCall.h5
-rw-r--r--call-ui/model/IHeldCall.h5
-rw-r--r--call-ui/model/IIncomingCall.h5
-rw-r--r--call-ui/model/IIndicatorStateListener.h5
-rw-r--r--call-ui/model/IIndicatorStateProvider.h5
-rw-r--r--call-ui/model/IRejectMsg.h4
-rw-r--r--call-ui/model/IRejectMsgProvider.h5
-rw-r--r--call-ui/model/ISoundManager.h5
-rw-r--r--call-ui/model/impl/ICallManagerListener.h5
-rw-r--r--call-ui/model/impl/IIndicatorStateSource.h5
-rw-r--r--call-ui/model/impl/SoundManager.cpp2
-rw-r--r--call-ui/presenters/misc/AccessoryPresenter.cpp4
-rw-r--r--call-ui/view/helpers.cpp2
-rw-r--r--ucl/include/ucl/appfw/IInstance.h4
-rw-r--r--ucl/include/ucl/appfw/IInstanceAppControlExt.h4
-rw-r--r--ucl/include/ucl/appfw/IInstanceContext.h4
-rw-r--r--ucl/include/ucl/appfw/InstanceManagerBase.h8
-rw-r--r--ucl/include/ucl/appfw/SysEventProvider.h2
-rw-r--r--ucl/include/ucl/appfw/UIApp.h2
-rw-r--r--ucl/include/ucl/appfw/types.h4
-rw-r--r--ucl/include/ucl/gui/ElmWidget.h6
-rw-r--r--ucl/include/ucl/gui/Genlist.h4
-rw-r--r--ucl/include/ucl/gui/Layout.h4
-rw-r--r--ucl/include/ucl/gui/Naviframe.h5
-rw-r--r--ucl/include/ucl/gui/RadioBox.h63
-rw-r--r--ucl/include/ucl/gui/RadioBox.hpp82
-rw-r--r--ucl/include/ucl/gui/StyledWidget.h4
-rw-r--r--ucl/include/ucl/gui/Widget.h6
-rw-r--r--ucl/include/ucl/gui/WidgetItem.h2
-rw-r--r--ucl/include/ucl/gui/Window.h5
-rw-r--r--ucl/include/ucl/gui/Window.hpp2
-rw-r--r--ucl/include/ucl/misc/AutoHandle.h92
-rw-r--r--ucl/include/ucl/misc/AutoObject.h86
-rw-r--r--ucl/include/ucl/misc/CArray.h55
-rw-r--r--ucl/include/ucl/misc/CArray.hpp71
-rw-r--r--ucl/include/ucl/misc/CString.h2
-rw-r--r--ucl/include/ucl/misc/ConstCString.h2
-rw-r--r--ucl/include/ucl/misc/MonoObservable.h57
-rw-r--r--ucl/include/ucl/misc/MonoObservable.hpp105
-rw-r--r--ucl/include/ucl/misc/Observable.h56
-rw-r--r--ucl/include/ucl/misc/Observable.hpp98
-rw-r--r--ucl/include/ucl/misc/RefCountAware.h7
-rw-r--r--ucl/include/ucl/misc/Timeout.h7
-rw-r--r--ucl/include/ucl/misc/Variant.h7
-rw-r--r--ucl/include/ucl/misc/Variant.hpp4
-rw-r--r--ucl/include/ucl/misc/types.h27
-rw-r--r--ucl/include/ucl/mvp/GuiPresenter.h2
-rw-r--r--ucl/include/ucl/mvp/IPickable.h34
-rw-r--r--ucl/include/ucl/mvp/IPicker.h35
-rw-r--r--ucl/include/ucl/mvp/IPickerHost.h36
-rw-r--r--ucl/include/ucl/mvp/ListItemPresenter.h46
-rw-r--r--ucl/include/ucl/mvp/ListPresenter.h10
-rw-r--r--ucl/include/ucl/util/delegation/BaseDelegate.h2
-rw-r--r--ucl/include/ucl/util/delegation/macro.h39
-rw-r--r--ucl/include/ucl/util/helpers.h18
-rw-r--r--ucl/include/ucl/util/memory/BaseRef.h14
-rw-r--r--ucl/include/ucl/util/memory/IRefCountObj.h4
-rw-r--r--ucl/include/ucl/util/memory/RefCountObj.h2
-rw-r--r--ucl/include/ucl/util/memory/ReffedObj.h6
-rw-r--r--ucl/include/ucl/util/memory/SharedRef.h2
-rw-r--r--ucl/include/ucl/util/memory/WeakRef.h2
-rw-r--r--ucl/include/ucl/util/memory/macro.h11
-rw-r--r--ucl/include/ucl/util/threading/CondVar.h2
-rw-r--r--ucl/include/ucl/util/threading/Mutex.h2
-rw-r--r--ucl/include/ucl/util/threading/MutexLock.h2
-rw-r--r--ucl/include/ucl/util/threading/Thread.h2
-rw-r--r--ucl/include/ucl/util/types/Result.h2
-rw-r--r--ucl/include/ucl/util/types/classTypes.h19
-rw-r--r--ucl/source/appfw/SysEventProvider.cpp2
-rw-r--r--ucl/source/gui/ElmWidget.cpp2
-rw-r--r--ucl/source/gui/Genlist.cpp1
-rw-r--r--ucl/source/gui/Naviframe.cpp4
-rw-r--r--ucl/source/gui/RadioBox.cpp46
-rw-r--r--ucl/source/gui/Widget.cpp2
-rw-r--r--ucl/source/gui/Window.cpp2
-rw-r--r--ucl/source/misc/Timeout.cpp4
-rw-r--r--ucl/source/mvp/ListItemPresenter.cpp137
-rw-r--r--ucl/source/mvp/ListPresenter.cpp27
-rw-r--r--ucl/source/util/types/Result.cpp2
-rw-r--r--ucl/source/util/types/classTypes.cpp22
86 files changed, 1280 insertions, 237 deletions
diff --git a/call-ui/model/IActiveCall.h b/call-ui/model/IActiveCall.h
index 1e1db18..0252b72 100644
--- a/call-ui/model/IActiveCall.h
+++ b/call-ui/model/IActiveCall.h
@@ -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;
};
}
diff --git a/call-ui/model/IBaseCallInfo.h b/call-ui/model/IBaseCallInfo.h
index 4987d99..2902be3 100644
--- a/call-ui/model/IBaseCallInfo.h
+++ b/call-ui/model/IBaseCallInfo.h
@@ -23,11 +23,14 @@
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;
};
}
diff --git a/call-ui/model/ICallListener.h b/call-ui/model/ICallListener.h
index a1e5931..071fdd5 100644
--- a/call-ui/model/ICallListener.h
+++ b/call-ui/model/ICallListener.h
@@ -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;
};
}
diff --git a/call-ui/model/ICallManager.h b/call-ui/model/ICallManager.h
index bbd1a06..9049b0b 100644
--- a/call-ui/model/ICallManager.h
+++ b/call-ui/model/ICallManager.h
@@ -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;
};
}
diff --git a/call-ui/model/ICallUI.h b/call-ui/model/ICallUI.h
index e94cb11..41f735e 100644
--- a/call-ui/model/ICallUI.h
+++ b/call-ui/model/ICallUI.h
@@ -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;
};
}
diff --git a/call-ui/model/IContactInfo.h b/call-ui/model/IContactInfo.h
index 0af6b74..e220555 100644
--- a/call-ui/model/IContactInfo.h
+++ b/call-ui/model/IContactInfo.h
@@ -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;
};
}
diff --git a/call-ui/model/IEndCall.h b/call-ui/model/IEndCall.h
index 39d2b66..4d84144 100644
--- a/call-ui/model/IEndCall.h
+++ b/call-ui/model/IEndCall.h
@@ -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;
};
}
diff --git a/call-ui/model/IHeldCall.h b/call-ui/model/IHeldCall.h
index 5a7d1a0..3fbe90d 100644
--- a/call-ui/model/IHeldCall.h
+++ b/call-ui/model/IHeldCall.h
@@ -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;
};
}
diff --git a/call-ui/model/IIncomingCall.h b/call-ui/model/IIncomingCall.h
index b90cfed..48bfee5 100644
--- a/call-ui/model/IIncomingCall.h
+++ b/call-ui/model/IIncomingCall.h
@@ -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;
};
}
diff --git a/call-ui/model/IIndicatorStateListener.h b/call-ui/model/IIndicatorStateListener.h
index cf45cbd..7d42c31 100644
--- a/call-ui/model/IIndicatorStateListener.h
+++ b/call-ui/model/IIndicatorStateListener.h
@@ -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;
};
}
diff --git a/call-ui/model/IIndicatorStateProvider.h b/call-ui/model/IIndicatorStateProvider.h
index 391c0ec..c2271e6 100644
--- a/call-ui/model/IIndicatorStateProvider.h
+++ b/call-ui/model/IIndicatorStateProvider.h
@@ -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;
};
}
diff --git a/call-ui/model/IRejectMsg.h b/call-ui/model/IRejectMsg.h
index a250e44..a8b8ec7 100644
--- a/call-ui/model/IRejectMsg.h
+++ b/call-ui/model/IRejectMsg.h
@@ -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;
};
}
diff --git a/call-ui/model/IRejectMsgProvider.h b/call-ui/model/IRejectMsgProvider.h
index 6e7ffd0..20b395c 100644
--- a/call-ui/model/IRejectMsgProvider.h
+++ b/call-ui/model/IRejectMsgProvider.h
@@ -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;
};
}
diff --git a/call-ui/model/ISoundManager.h b/call-ui/model/ISoundManager.h
index 7f42c39..fb72896 100644
--- a/call-ui/model/ISoundManager.h
+++ b/call-ui/model/ISoundManager.h
@@ -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;
};
}
diff --git a/call-ui/model/impl/ICallManagerListener.h b/call-ui/model/impl/ICallManagerListener.h
index 82a7609..892e650 100644
--- a/call-ui/model/impl/ICallManagerListener.h
+++ b/call-ui/model/impl/ICallManagerListener.h
@@ -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;
};
}
diff --git a/call-ui/model/impl/IIndicatorStateSource.h b/call-ui/model/impl/IIndicatorStateSource.h
index 7752035..1aa894c 100644
--- a/call-ui/model/impl/IIndicatorStateSource.h
+++ b/call-ui/model/impl/IIndicatorStateSource.h
@@ -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;
};
}
diff --git a/call-ui/model/impl/SoundManager.cpp b/call-ui/model/impl/SoundManager.cpp
index 852c857..8b39ac9 100644
--- a/call-ui/model/impl/SoundManager.cpp
+++ b/call-ui/model/impl/SoundManager.cpp
@@ -262,7 +262,7 @@ namespace callui {
bool SoundManager::isBTSupported() const
{
- return (m_btManager != nullptr);
+ return (m_btManager.get() != nullptr);
}
bool SoundManager::isBTHeadsetConnected() const
diff --git a/call-ui/presenters/misc/AccessoryPresenter.cpp b/call-ui/presenters/misc/AccessoryPresenter.cpp
index c27a3c6..cc72a8b 100644
--- a/call-ui/presenters/misc/AccessoryPresenter.cpp
+++ b/call-ui/presenters/misc/AccessoryPresenter.cpp
@@ -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!");
diff --git a/call-ui/view/helpers.cpp b/call-ui/view/helpers.cpp
index dcc8951..ca3e7d3 100644
--- a/call-ui/view/helpers.cpp
+++ b/call-ui/view/helpers.cpp
@@ -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());
diff --git a/ucl/include/ucl/appfw/IInstance.h b/ucl/include/ucl/appfw/IInstance.h
index bf09205..fd9dfe4 100644
--- a/ucl/include/ucl/appfw/IInstance.h
+++ b/ucl/include/ucl/appfw/IInstance.h
@@ -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;
};
}
diff --git a/ucl/include/ucl/appfw/IInstanceAppControlExt.h b/ucl/include/ucl/appfw/IInstanceAppControlExt.h
index 6799a84..9720dc7 100644
--- a/ucl/include/ucl/appfw/IInstanceAppControlExt.h
+++ b/ucl/include/ucl/appfw/IInstanceAppControlExt.h
@@ -21,9 +21,11 @@
namespace ucl {
- class IInstanceAppControlExt : public Polymorphic {
+ class IInstanceAppControlExt : protected NonCopyable {
public:
virtual void onAppControl(app_control_h appControl) = 0;
+ protected:
+ ~IInstanceAppControlExt() = default;
};
}
diff --git a/ucl/include/ucl/appfw/IInstanceContext.h b/ucl/include/ucl/appfw/IInstanceContext.h
index b06c177..bab6a5b 100644
--- a/ucl/include/ucl/appfw/IInstanceContext.h
+++ b/ucl/include/ucl/appfw/IInstanceContext.h
@@ -23,11 +23,13 @@
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;
};
}
diff --git a/ucl/include/ucl/appfw/InstanceManagerBase.h b/ucl/include/ucl/appfw/InstanceManagerBase.h
index 0fdde8c..0448244 100644
--- a/ucl/include/ucl/appfw/InstanceManagerBase.h
+++ b/ucl/include/ucl/appfw/InstanceManagerBase.h
@@ -22,11 +22,8 @@
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:
diff --git a/ucl/include/ucl/appfw/SysEventProvider.h b/ucl/include/ucl/appfw/SysEventProvider.h
index 8a72758..c2050bf 100644
--- a/ucl/include/ucl/appfw/SysEventProvider.h
+++ b/ucl/include/ucl/appfw/SysEventProvider.h
@@ -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 *);
diff --git a/ucl/include/ucl/appfw/UIApp.h b/ucl/include/ucl/appfw/UIApp.h
index a8b4dbc..2e2b435 100644
--- a/ucl/include/ucl/appfw/UIApp.h
+++ b/ucl/include/ucl/appfw/UIApp.h
@@ -26,7 +26,7 @@ namespace ucl {
class UIApp final : private IInstanceContext {
public:
UIApp(InstanceManagerBase &instanceMgr);
- virtual ~UIApp();
+ ~UIApp();
int run(int argc, char *argv[]);
diff --git a/ucl/include/ucl/appfw/types.h b/ucl/include/ucl/appfw/types.h
index 48f8adc..d8455eb 100644
--- a/ucl/include/ucl/appfw/types.h
+++ b/ucl/include/ucl/appfw/types.h
@@ -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__
diff --git a/ucl/include/ucl/gui/ElmWidget.h b/ucl/include/ucl/gui/ElmWidget.h
index f967cc3..795cf2b 100644
--- a/ucl/include/ucl/gui/ElmWidget.h
+++ b/ucl/include/ucl/gui/ElmWidget.h
@@ -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 //
diff --git a/ucl/include/ucl/gui/Genlist.h b/ucl/include/ucl/gui/Genlist.h
index 366eccf..7c80ab4 100644
--- a/ucl/include/ucl/gui/Genlist.h
+++ b/ucl/include/ucl/gui/Genlist.h
@@ -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>;
};
}
diff --git a/ucl/include/ucl/gui/Layout.h b/ucl/include/ucl/gui/Layout.h
index d349f92..dbfc163 100644
--- a/ucl/include/ucl/gui/Layout.h
+++ b/ucl/include/ucl/gui/Layout.h
@@ -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>;
};
}
diff --git a/ucl/include/ucl/gui/Naviframe.h b/ucl/include/ucl/gui/Naviframe.h
index 66693f2..7333e11 100644
--- a/ucl/include/ucl/gui/Naviframe.h
+++ b/ucl/include/ucl/gui/Naviframe.h
@@ -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
index 0000000..7737852
--- /dev/null
+++ b/ucl/include/ucl/gui/RadioBox.h
@@ -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
index 0000000..8943278
--- /dev/null
+++ b/ucl/include/ucl/gui/RadioBox.hpp
@@ -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());
+ }
+}
diff --git a/ucl/include/ucl/gui/StyledWidget.h b/ucl/include/ucl/gui/StyledWidget.h
index 223a293..5401d2a 100644
--- a/ucl/include/ucl/gui/StyledWidget.h
+++ b/ucl/include/ucl/gui/StyledWidget.h
@@ -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>;
};
}
diff --git a/ucl/include/ucl/gui/Widget.h b/ucl/include/ucl/gui/Widget.h
index ac47866..49942b4 100644
--- a/ucl/include/ucl/gui/Widget.h
+++ b/ucl/include/ucl/gui/Widget.h
@@ -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 //
diff --git a/ucl/include/ucl/gui/WidgetItem.h b/ucl/include/ucl/gui/WidgetItem.h
index 7794444..f57487b 100644
--- a/ucl/include/ucl/gui/WidgetItem.h
+++ b/ucl/include/ucl/gui/WidgetItem.h
@@ -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;
diff --git a/ucl/include/ucl/gui/Window.h b/ucl/include/ucl/gui/Window.h
index 9aa598d..dba64f0 100644
--- a/ucl/include/ucl/gui/Window.h
+++ b/ucl/include/ucl/gui/Window.h
@@ -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 //
diff --git a/ucl/include/ucl/gui/Window.hpp b/ucl/include/ucl/gui/Window.hpp
index d5b1828..9273b67 100644
--- a/ucl/include/ucl/gui/Window.hpp
+++ b/ucl/include/ucl/gui/Window.hpp
@@ -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
index 27c19f4..0000000
--- a/ucl/include/ucl/misc/AutoHandle.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2017 Samsung Electronics Co., Ltd
- *
- * Licensed under the Flora License, Version 1.1 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://floralicense.org/license/
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __UCL_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
index 0000000..e2d06a1
--- /dev/null
+++ b/ucl/include/ucl/misc/AutoObject.h
@@ -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
index 0000000..1318735
--- /dev/null
+++ b/ucl/include/ucl/misc/CArray.h
@@ -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
index 0000000..28e9974
--- /dev/null
+++ b/ucl/include/ucl/misc/CArray.hpp
@@ -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);
+ }
+}}
diff --git a/ucl/include/ucl/misc/CString.h b/ucl/include/ucl/misc/CString.h
index 396f37d..5496cda 100644
--- a/ucl/include/ucl/misc/CString.h
+++ b/ucl/include/ucl/misc/CString.h
@@ -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;
diff --git a/ucl/include/ucl/misc/ConstCString.h b/ucl/include/ucl/misc/ConstCString.h
index 7f600f0..e319676 100644
--- a/ucl/include/ucl/misc/ConstCString.h
+++ b/ucl/include/ucl/misc/ConstCString.h
@@ -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
index 0000000..16604b2
--- /dev/null
+++ b/ucl/include/ucl/misc/MonoObservable.h
@@ -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
index 0000000..a0fad4b
--- /dev/null
+++ b/ucl/include/ucl/misc/MonoObservable.hpp
@@ -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
index 0000000..dcc8063
--- /dev/null
+++ b/ucl/include/ucl/misc/Observable.h
@@ -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
index 0000000..01b92f3
--- /dev/null
+++ b/ucl/include/ucl/misc/Observable.hpp
@@ -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);
+ }
+}
diff --git a/ucl/include/ucl/misc/RefCountAware.h b/ucl/include/ucl/misc/RefCountAware.h
index 6ea5ee9..2f4d4a2 100644
--- a/ucl/include/ucl/misc/RefCountAware.h
+++ b/ucl/include/ucl/misc/RefCountAware.h
@@ -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!
diff --git a/ucl/include/ucl/misc/Timeout.h b/ucl/include/ucl/misc/Timeout.h
index 165265c..5ca3ae2 100644
--- a/ucl/include/ucl/misc/Timeout.h
+++ b/ucl/include/ucl/misc/Timeout.h
@@ -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>;
};
}
diff --git a/ucl/include/ucl/misc/Variant.h b/ucl/include/ucl/misc/Variant.h
index 6542358..a07e10b 100644
--- a/ucl/include/ucl/misc/Variant.h
+++ b/ucl/include/ucl/misc/Variant.h
@@ -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();
diff --git a/ucl/include/ucl/misc/Variant.hpp b/ucl/include/ucl/misc/Variant.hpp
index fe6d977..a648e29 100644
--- a/ucl/include/ucl/misc/Variant.hpp
+++ b/ucl/include/ucl/misc/Variant.hpp
@@ -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
index 0000000..c56004c
--- /dev/null
+++ b/ucl/include/ucl/misc/types.h
@@ -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__
diff --git a/ucl/include/ucl/mvp/GuiPresenter.h b/ucl/include/ucl/mvp/GuiPresenter.h
index 5a94af4..6b737e9 100644
--- a/ucl/include/ucl/mvp/GuiPresenter.h
+++ b/ucl/include/ucl/mvp/GuiPresenter.h
@@ -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
index 0000000..c0b221d
--- /dev/null
+++ b/ucl/include/ucl/mvp/IPickable.h
@@ -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
index 0000000..c071a87
--- /dev/null
+++ b/ucl/include/ucl/mvp/IPicker.h
@@ -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
index 0000000..7ea04e2
--- /dev/null
+++ b/ucl/include/ucl/mvp/IPickerHost.h
@@ -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__
diff --git a/ucl/include/ucl/mvp/ListItemPresenter.h b/ucl/include/ucl/mvp/ListItemPresenter.h
index 46d2fb4..4b7d13d 100644
--- a/ucl/include/ucl/mvp/ListItemPresenter.h
+++ b/ucl/include/ucl/mvp/ListItemPresenter.h
@@ -22,23 +22,24 @@
#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;
};
}
diff --git a/ucl/include/ucl/mvp/ListPresenter.h b/ucl/include/ucl/mvp/ListPresenter.h
index 1d62e41..7f39899 100644
--- a/ucl/include/ucl/mvp/ListPresenter.h
+++ b/ucl/include/ucl/mvp/ListPresenter.h
@@ -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>;
};
}
diff --git a/ucl/include/ucl/util/delegation/BaseDelegate.h b/ucl/include/ucl/util/delegation/BaseDelegate.h
index 62b92ff..aab2117 100644
--- a/ucl/include/ucl/util/delegation/BaseDelegate.h
+++ b/ucl/include/ucl/util/delegation/BaseDelegate.h
@@ -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;
diff --git a/ucl/include/ucl/util/delegation/macro.h b/ucl/include/ucl/util/delegation/macro.h
index 62bf88f..89f2d2d 100644
--- a/ucl/include/ucl/util/delegation/macro.h
+++ b/ucl/include/ucl/util/delegation/macro.h
@@ -21,18 +21,19 @@
#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 //
@@ -49,19 +50,19 @@
// 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__
diff --git a/ucl/include/ucl/util/helpers.h b/ucl/include/ucl/util/helpers.h
index 117d3de..5abf690 100644
--- a/ucl/include/ucl/util/helpers.h
+++ b/ucl/include/ucl/util/helpers.h
@@ -53,6 +53,24 @@ namespace ucl {
}
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);
template <class T>
diff --git a/ucl/include/ucl/util/memory/BaseRef.h b/ucl/include/ucl/util/memory/BaseRef.h
index 8146eae..2597000 100644
--- a/ucl/include/ucl/util/memory/BaseRef.h
+++ b/ucl/include/ucl/util/memory/BaseRef.h
@@ -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;
};
}
diff --git a/ucl/include/ucl/util/memory/IRefCountObj.h b/ucl/include/ucl/util/memory/IRefCountObj.h
index 69d6a1c..760e611 100644
--- a/ucl/include/ucl/util/memory/IRefCountObj.h
+++ b/ucl/include/ucl/util/memory/IRefCountObj.h
@@ -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;
};
}
diff --git a/ucl/include/ucl/util/memory/RefCountObj.h b/ucl/include/ucl/util/memory/RefCountObj.h
index 7237aa4..24c1323 100644
--- a/ucl/include/ucl/util/memory/RefCountObj.h
+++ b/ucl/include/ucl/util/memory/RefCountObj.h
@@ -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)
diff --git a/ucl/include/ucl/util/memory/ReffedObj.h b/ucl/include/ucl/util/memory/ReffedObj.h
index c521544..ab253bc 100644
--- a/ucl/include/ucl/util/memory/ReffedObj.h
+++ b/ucl/include/ucl/util/memory/ReffedObj.h
@@ -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>;
};
}
diff --git a/ucl/include/ucl/util/memory/SharedRef.h b/ucl/include/ucl/util/memory/SharedRef.h
index 396d176..45db0c5 100644
--- a/ucl/include/ucl/util/memory/SharedRef.h
+++ b/ucl/include/ucl/util/memory/SharedRef.h
@@ -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;
diff --git a/ucl/include/ucl/util/memory/WeakRef.h b/ucl/include/ucl/util/memory/WeakRef.h
index 4cccbe6..eb96051 100644
--- a/ucl/include/ucl/util/memory/WeakRef.h
+++ b/ucl/include/ucl/util/memory/WeakRef.h
@@ -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 && (
diff --git a/ucl/include/ucl/util/memory/macro.h b/ucl/include/ucl/util/memory/macro.h
index b97175a..c55adac 100644
--- a/ucl/include/ucl/util/memory/macro.h
+++ b/ucl/include/ucl/util/memory/macro.h
@@ -17,12 +17,15 @@
#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; \
diff --git a/ucl/include/ucl/util/threading/CondVar.h b/ucl/include/ucl/util/threading/CondVar.h
index e73a763..ed11c79 100644
--- a/ucl/include/ucl/util/threading/CondVar.h
+++ b/ucl/include/ucl/util/threading/CondVar.h
@@ -21,7 +21,7 @@
namespace ucl {
- class CondVar final : public NonCopyable {
+ class CondVar final : protected NonCopyable {
public:
CondVar();
~CondVar();
diff --git a/ucl/include/ucl/util/threading/Mutex.h b/ucl/include/ucl/util/threading/Mutex.h
index eda90ff..aa7233c 100644
--- a/ucl/include/ucl/util/threading/Mutex.h
+++ b/ucl/include/ucl/util/threading/Mutex.h
@@ -25,7 +25,7 @@
namespace ucl {
- class Mutex final : public NonCopyable {
+ class Mutex final : protected NonCopyable {
public:
Mutex(bool recursive = false);
~Mutex();
diff --git a/ucl/include/ucl/util/threading/MutexLock.h b/ucl/include/ucl/util/threading/MutexLock.h
index 062837f..cf3eb75 100644
--- a/ucl/include/ucl/util/threading/MutexLock.h
+++ b/ucl/include/ucl/util/threading/MutexLock.h
@@ -21,7 +21,7 @@
namespace ucl {
- class MutexLock final : public NonCopyable {
+ class MutexLock final : protected NonCopyable {
public:
MutexLock(Mutex &mutex);
~MutexLock();
diff --git a/ucl/include/ucl/util/threading/Thread.h b/ucl/include/ucl/util/threading/Thread.h
index 0839921..66a732d 100644
--- a/ucl/include/ucl/util/threading/Thread.h
+++ b/ucl/include/ucl/util/threading/Thread.h
@@ -25,7 +25,7 @@
namespace ucl {
- class Thread final : public NonCopyable {
+ class Thread final : protected NonCopyable {
public:
Thread();
template <class FUNC>
diff --git a/ucl/include/ucl/util/types/Result.h b/ucl/include/ucl/util/types/Result.h
index 099223f..93bbdce 100644
--- a/ucl/include/ucl/util/types/Result.h
+++ b/ucl/include/ucl/util/types/Result.h
@@ -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,
diff --git a/ucl/include/ucl/util/types/classTypes.h b/ucl/include/ucl/util/types/classTypes.h
index 5c708d2..6c928ef 100644
--- a/ucl/include/ucl/util/types/classTypes.h
+++ b/ucl/include/ucl/util/types/classTypes.h
@@ -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>
diff --git a/ucl/source/appfw/SysEventProvider.cpp b/ucl/source/appfw/SysEventProvider.cpp
index 8958aaf..b2b6afe 100644
--- a/ucl/source/appfw/SysEventProvider.cpp
+++ b/ucl/source/appfw/SysEventProvider.cpp
@@ -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,
diff --git a/ucl/source/gui/ElmWidget.cpp b/ucl/source/gui/ElmWidget.cpp
index b7d227e..278407b 100644
--- a/ucl/source/gui/ElmWidget.cpp
+++ b/ucl/source/gui/ElmWidget.cpp
@@ -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) :
diff --git a/ucl/source/gui/Genlist.cpp b/ucl/source/gui/Genlist.cpp
index b0e31a5..6195bde 100644
--- a/ucl/source/gui/Genlist.cpp
+++ b/ucl/source/gui/Genlist.cpp
@@ -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"
diff --git a/ucl/source/gui/Naviframe.cpp b/ucl/source/gui/Naviframe.cpp
index 717940b..7beac11 100644
--- a/ucl/source/gui/Naviframe.cpp
+++ b/ucl/source/gui/Naviframe.cpp
@@ -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
index 0000000..3065e0a
--- /dev/null
+++ b/ucl/source/gui/RadioBox.cpp
@@ -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;
+ }
+}
diff --git a/ucl/source/gui/Widget.cpp b/ucl/source/gui/Widget.cpp
index 096c6e1..724e54a 100644
--- a/ucl/source/gui/Widget.cpp
+++ b/ucl/source/gui/Widget.cpp
@@ -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) :
diff --git a/ucl/source/gui/Window.cpp b/ucl/source/gui/Window.cpp
index 3f74e9e..166fb1f 100644
--- a/ucl/source/gui/Window.cpp
+++ b/ucl/source/gui/Window.cpp
@@ -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();
diff --git a/ucl/source/misc/Timeout.cpp b/ucl/source/misc/Timeout.cpp
index 41a3d3f..7863885 100644
--- a/ucl/source/misc/Timeout.cpp
+++ b/ucl/source/misc/Timeout.cpp
@@ -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)
{
diff --git a/ucl/source/mvp/ListItemPresenter.cpp b/ucl/source/mvp/ListItemPresenter.cpp
index d27568b..b3f8ac3 100644
--- a/ucl/source/mvp/ListItemPresenter.cpp
+++ b/ucl/source/mvp/ListItemPresenter.cpp
@@ -16,8 +16,16 @@
#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()
+ {
+ }
}
diff --git a/ucl/source/mvp/ListPresenter.cpp b/ucl/source/mvp/ListPresenter.cpp
index 2835697..2e05eca 100644
--- a/ucl/source/mvp/ListPresenter.cpp
+++ b/ucl/source/mvp/ListPresenter.cpp
@@ -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);
diff --git a/ucl/source/util/types/Result.cpp b/ucl/source/util/types/Result.cpp
index b42875e..9ba6c17 100644
--- a/ucl/source/util/types/Result.cpp
+++ b/ucl/source/util/types/Result.cpp
@@ -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
index 0000000..d3eabaf
--- /dev/null
+++ b/ucl/source/util/types/classTypes.cpp
@@ -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;
+}