#ifndef __CALLUI_VIEW_ACCEPT_DIALOG_H__
#define __CALLUI_VIEW_ACCEPT_DIALOG_H__
+#include "Presenter.h"
+
#include "ucl/gui/StyledWidget.h"
#include "ucl/gui/ElmWidget.h"
namespace callui {
class AcceptDialog final :
- public ucl::RefCountAware,
+ public Presenter,
public ucl::IDisposable {
public:
class Builder {
#ifndef __CALLUI_PRESENTERS_ACCEPT_REJECT_PRESENTER_H__
#define __CALLUI_PRESENTERS_ACCEPT_REJECT_PRESENTER_H__
+#include "Presenter.h"
+
#include "ucl/gui/Layout.h"
#include "ucl/gui/StyledWidget.h"
namespace callui {
- class AcceptRejectPresenter final : public ucl::RefCountAware {
+ class AcceptRejectPresenter final : public Presenter {
public:
class Builder {
public:
const IIncomingCallSRef &call,
CallMask calls);
- ucl::Result prepare(ucl::Widget &parent);
+ ucl::Result prepare(ucl::ElmWidget &parent);
- ucl::Result createWidget(ucl::Widget &parent);
+ ucl::Result createWidget(ucl::ElmWidget &parent);
ucl::Result createAcceptBtn();
ucl::Result createRejectBtn();
#ifndef __CALLUI_PRESENTERS_CALL_INFO_PRESENTER_H__
#define __CALLUI_PRESENTERS_CALL_INFO_PRESENTER_H__
+#include "Presenter.h"
+
#include "ucl/gui/Layout.h"
#include "ucl/gui/StyledWidget.h"
namespace callui {
- class CallInfoPresenter final : public ucl::RefCountAware {
+ class CallInfoPresenter final : public Presenter {
public:
class Builder {
public:
const ICallManagerSRef &cm,
CallInfoMode mode);
- ucl::Result prepare(ucl::Widget &parent);
+ ucl::Result prepare(ucl::ElmWidget &parent);
void initCallInfos(const ICallManagerSRef &cm);
- ucl::Result createWidget(ucl::Widget &parent);
+ ucl::Result createWidget(ucl::ElmWidget &parent);
ucl::Result createLabel(const std::string &text);
ucl::Result createCallStatus();
#ifndef __CALLUI_PRESENTERS_INDICATOR_H__
#define __CALLUI_PRESENTERS_INDICATOR_H__
+#include "Presenter.h"
#include "model/IIndicatorStateListener.h"
#include "ucl/gui/Layout.h"
class Indicator final :
public IIndicatorStateListener,
- public ucl::RefCountAware {
+ public Presenter {
public:
class Builder {
public:
Indicator(ucl::RefCountObjBase &rc,
const IIndicatorStateProviderSRef &provider);
- ucl::Result prepare(ucl::Widget &parent);
+ ucl::Result prepare(ucl::ElmWidget &parent);
- ucl::Result createWidget(ucl::Widget &parent);
+ ucl::Result createWidget(ucl::ElmWidget &parent);
ucl::Result createConnectionLayout();
ucl::Result createRssiLayout();
ucl::Result createBatteryLayout();
#include "ucl/gui/Naviframe.h"
-#include "types.h"
+#include "Presenter.h"
namespace callui {
- class Page : public ucl::RefCountAware {
+ class Page : public Presenter {
public:
using ExitRequestHandler = ucl::Delegate<void(Page &page)>;
public:
ucl::Naviframe &getNaviframe();
- bool isActive() const;
-
bool isAtTop() const;
bool isAtBottom() const;
void requestExit();
- virtual void onActivate();
- virtual void onDeactivate();
virtual void onBackKey();
private:
void dispatchTopPageChanged();
- void activate();
- void deactivate();
void updateActiveState();
void onTransitionStarted(ucl::Widget &widget, void *eventInfo);
const ucl::NaviframeSRef m_navi;
const ExitRequestHandler m_onExitRequest;
ucl::NaviItem m_item;
- bool m_isActive;
};
- // Non-member functions
+ // Non-member functions //
bool isLast(const Page &page);
}
return *m_navi;
}
- inline bool Page::isActive() const
- {
- return m_isActive;
- }
-
inline bool Page::isAtTop() const
{
return (m_navi->getTopItem() == m_item);
return (m_navi->getBottomItem() == m_item);
}
- // Non-member functions
+ // Non-member functions //
inline bool isLast(const Page &page)
{
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CALLUI_PRESENTERS_PRESENTER_H__
+#define __CALLUI_PRESENTERS_PRESENTER_H__
+
+#include <unordered_set>
+
+#include "ucl/gui/ElmWidget.h"
+
+#include "types.h"
+
+namespace callui {
+
+ class Presenter : public ucl::RefCountAware {
+ public:
+ struct DeactivatorInfo {
+ void *deactivator;
+ bool isBroadcast;
+ };
+
+ public:
+ bool isActive() const;
+ bool isDeactivatedBy(void *deactivator) const;
+
+ void activateBy(void *deactivator);
+ void deactivateBy(void *deactivator);
+
+ protected:
+ Presenter(ucl::RefCountObjBase &rc);
+ virtual ~Presenter();
+
+ ucl::Result prepare(ucl::ElmWidget &widget);
+
+ void addDeactivatorSource(ucl::Widget &source);
+ void addDeactivatorException(void *deactivator);
+
+ void sendActivateBy(ucl::Widget &sender, void *deactivator);
+ void sendDeactivateBy(ucl::Widget &sender, void *deactivator);
+
+ void broadcastActivateBy(void *deactivator);
+ void broadcastDeactivateBy(void *deactivator);
+
+ virtual void onActivate();
+ virtual void onDeactivate();
+ virtual void onActivateBy(const DeactivatorInfo &info);
+ virtual void onDeactivateBy(const DeactivatorInfo &info);
+
+ private:
+ void sendDeactivator(ucl::Widget &sender,
+ ucl::SmartEvent event, void *deactivator);
+ void broadcastDeactivator(ucl::SmartEvent event, void *deactivator);
+
+ void sendDeactivatorInfo(ucl::Widget &sender, ucl::SmartEvent event,
+ const DeactivatorInfo &info);
+
+ void activateByImpl(const DeactivatorInfo &info);
+ void deactivateByImpl(const DeactivatorInfo &info);
+
+ void onActivateBySmart(ucl::Widget &widget, void *eventInfo);
+ void onDeactivateBySmart(ucl::Widget &widget, void *eventInfo);
+
+ private:
+ std::unordered_set<void *> m_deactivatorExceptions;
+ std::unordered_set<void *> m_deactivators;
+ ucl::WidgetWRef m_topWidget;
+ bool m_isPrepared;
+ };
+}
+
+#endif // __CALLUI_PRESENTERS_PRESENTER_H__
return;
}
- m_audioStateEvent.invoke(convertCMAudioState(state));
+ m_audioStateEvent.dispatch(convertCMAudioState(state));
}
void SoundManager::muteStateChangedCb(cm_mute_status_e status)
{
- m_muteStateEvent.invoke(status == CM_MUTE_STATUS_ON);
+ m_muteStateEvent.dispatch(status == CM_MUTE_STATUS_ON);
}
Result SoundManager::prepare()
AcceptDialog::AcceptDialog(RefCountObjBase &rc,
const AcceptDialogHandler &handler):
- RefCountAware(&rc),
+ Presenter(rc),
m_handler(handler),
m_isDismissed(false)
{
Result AcceptDialog::prepare(ElmWidget &parent)
{
+ FAIL_RETURN(Presenter::prepare(parent),
+ "Presenter::prepare() failed!");
+
FAIL_RETURN(createPopup(parent, impl::POPUP_STYLE),
"createPopup() failed!");
AcceptRejectPresenter::AcceptRejectPresenter(RefCountObjBase &rc,
const IIncomingCallSRef &call,
CallMask calls):
- RefCountAware(&rc),
+ Presenter(rc),
m_call(call),
m_callMask(calls)
{
m_popup->dispose();
}
- eext_rotary_object_event_activated_set(m_widget->getEo(), EINA_FALSE);
-
delRotaryEventHandler(CALLBACK_A(
AcceptRejectPresenter::onRotaryEvent), this);
}
- Result AcceptRejectPresenter::prepare(Widget &parent)
+ Result AcceptRejectPresenter::prepare(ElmWidget &parent)
{
+ FAIL_RETURN(Presenter::prepare(parent), "Presenter::prepare() failed!");
+
FAIL_RETURN(createWidget(parent), "createWidget() failed!");
FAIL_RETURN(createAcceptBtn(), "createAcceptBtn() failed!");
addRotaryEventHandler(CALLBACK_A(
AcceptRejectPresenter::onRotaryEvent), this);
- eext_rotary_object_event_activated_set(m_widget->getEo(), EINA_TRUE);
-
return RES_OK;
}
}
}
- Result AcceptRejectPresenter::createWidget(Widget &parent)
+ Result AcceptRejectPresenter::createWidget(ElmWidget &parent)
{
m_widget = Layout::Builder().
setTheme(impl::LAYOUT_ACCEPT_REJECT_WIDGET).
CallInfoPresenter::CallInfoPresenter(RefCountObjBase &rc,
const ICallManagerSRef &cm,
CallInfoMode mode):
- RefCountAware(&rc),
+ Presenter(rc),
m_mode(mode),
m_isCallerIdEnable(false),
m_isEmergency(false),
{
}
- Result CallInfoPresenter::prepare(Widget &parent)
+ Result CallInfoPresenter::prepare(ElmWidget &parent)
{
+ FAIL_RETURN(Presenter::prepare(parent), "Presenter::prepare() failed!");
+
FAIL_RETURN(createWidget(parent), "createWidget() failed!");
FAIL_RETURN(createCallStatus(), "createCallStatus() failed!");
return RES_OK;
}
- Result CallInfoPresenter::createWidget(Widget &parent)
+ Result CallInfoPresenter::createWidget(ElmWidget &parent)
{
m_widget = Layout::Builder().
setTheme(impl::LAYOUT_CALLER_INFO_WIDGET).
Indicator::Indicator(RefCountObjBase &rc,
const IIndicatorStateProviderSRef &provider):
- RefCountAware(&rc),
+ Presenter(rc),
m_provider(provider)
{
}
{
}
- Result Indicator::prepare(Widget &parent)
+ Result Indicator::prepare(ElmWidget &parent)
{
+ FAIL_RETURN(Presenter::prepare(parent),
+ "Presenter::prepare() failed!");
+
FAIL_RETURN(createWidget(parent),
"createWidget() failed!");
return RES_OK;
}
- Result Indicator::createWidget(Widget &parent)
+ Result Indicator::createWidget(ElmWidget &parent)
{
m_widget = Layout::Builder().
setTheme(impl::LAYOUT_INDICATOR_WIDGET).
Page::Page(RefCountObjBase &rc, const NaviframeSRef &navi,
const ExitRequestHandler onExitRequest) :
- RefCountAware(&rc),
+ Presenter(rc),
m_navi(navi),
- m_onExitRequest(onExitRequest),
- m_isActive(false)
+ m_onExitRequest(onExitRequest)
{
UCL_ASSERT(navi, "navi is NULL!");
UCL_ASSERT(onExitRequest, "onExitRequest is NULL!");
+
+ deactivateBy(m_navi.get());
}
Page::~Page()
Result Page::preparePart2()
{
+ FAIL_RETURN(Presenter::prepare(*m_navi),
+ "Presenter::prepare() failed!");
+
Evas_Object *content = m_item.getContent();
if (!content) {
LOG_RETURN(RES_FAIL, "content is NULL");
void Page::dispatchTopPageChanged()
{
- m_navi->callEvent(impl::TOP_PAGE_CHANGED, nullptr);
+ if (!m_navi->isInTransition()) {
+ m_navi->callEvent(impl::TOP_PAGE_CHANGED, nullptr);
+ } else {
+ WLOG("Forcig Transition Finished!");
+ m_navi->setInTransition(false);
+ }
}
void Page::onItemDel(Evas_Object *obj, void *eventInfo)
m_onExitRequest(*this);
}
- void Page::activate()
- {
- if (!m_isActive) {
- m_isActive = true;
- onActivate();
- }
- }
-
- void Page::deactivate()
- {
- if (m_isActive) {
- m_isActive = false;
- onDeactivate();
- }
- }
-
void Page::updateActiveState()
{
if (isAtTop()) {
- activate();
+ activateBy(m_navi.get());
} else {
- deactivate();
+ deactivateBy(m_navi.get());
}
}
void Page::onTransitionStarted(Widget &widget, void *eventInfo)
{
- deactivate();
+ deactivateBy(m_navi.get());
}
void Page::onTransitionFinished(Widget &widget, void *eventInfo)
void Page::onHWBackKey(Evas_Object *obj, void *eventInfo)
{
- if (m_isActive) {
+ if (isActive()) {
onBackKey();
}
}
- void Page::onActivate()
- {
- }
-
- void Page::onDeactivate()
- {
- }
-
void Page::onBackKey()
{
requestExit();
--- /dev/null
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "presenters/Presenter.h"
+
+#include "common.h"
+
+namespace callui { namespace { namespace impl {
+
+ using namespace ucl;
+
+ constexpr SmartEvent ACTIVATE_BY {"callui,activate,by"};
+ constexpr SmartEvent DEACTIVATE_BY {"callui,deactivate,by"};
+}}}
+
+namespace callui {
+
+ using namespace ucl;
+
+ Presenter::Presenter(RefCountObjBase &rc) :
+ RefCountAware(&rc),
+ m_isPrepared(false)
+ {
+ }
+
+ Presenter::~Presenter()
+ {
+ }
+
+ Result Presenter::prepare(ElmWidget &widget)
+ {
+ m_topWidget = asWeak(asWidget(widget.getTopWidget()));
+ if (!m_topWidget) {
+ LOG_RETURN(RES_FAIL, "m_topWidget is NULL!");
+ }
+
+ addDeactivatorSource(*m_topWidget);
+
+ m_isPrepared = true;
+
+ return RES_OK;
+ }
+
+ void Presenter::addDeactivatorSource(Widget &source)
+ {
+ source.addEventHandler(impl::ACTIVATE_BY,
+ WEAK_DELEGATE(Presenter::onActivateBySmart, asWeak(*this)));
+ source.addEventHandler(impl::DEACTIVATE_BY,
+ WEAK_DELEGATE(Presenter::onDeactivateBySmart, asWeak(*this)));
+ }
+
+ void Presenter::addDeactivatorException(void *const deactivator)
+ {
+ const auto pair = m_deactivatorExceptions.insert(deactivator);
+ if (pair.second) {
+ activateBy(deactivator);
+ }
+ }
+
+ void Presenter::sendActivateBy(Widget &sender, void *const deactivator)
+ {
+ sendDeactivator(sender, impl::ACTIVATE_BY, deactivator);
+ }
+
+ void Presenter::sendDeactivateBy(Widget &sender, void *const deactivator)
+ {
+ sendDeactivator(sender, impl::DEACTIVATE_BY, deactivator);
+ }
+
+ void Presenter::broadcastActivateBy(void *const deactivator)
+ {
+ broadcastDeactivator(impl::ACTIVATE_BY, deactivator);
+ }
+
+ void Presenter::broadcastDeactivateBy(void *const deactivator)
+ {
+ broadcastDeactivator(impl::DEACTIVATE_BY, deactivator);
+ }
+
+ void Presenter::sendDeactivator(Widget &sender,
+ SmartEvent event, void *deactivator)
+ {
+ sendDeactivatorInfo(sender, event, {deactivator, false});
+ }
+
+ void Presenter::broadcastDeactivator(const SmartEvent event,
+ void *const deactivator)
+ {
+ if (m_topWidget) {
+ sendDeactivatorInfo(*m_topWidget, event, {deactivator, true});
+ } else {
+ ELOG("m_topWidget is NULL!");
+ }
+ }
+
+ void Presenter::sendDeactivatorInfo(Widget &sender,
+ const SmartEvent event, const DeactivatorInfo &info)
+ {
+ sender.callEvent(event, const_cast<DeactivatorInfo *>(&info));
+ }
+
+ bool Presenter::isActive() const
+ {
+ return isEmpty(m_deactivators);
+ }
+
+ bool Presenter::isDeactivatedBy(void *const deactivator) const
+ {
+ return (m_deactivators.find(deactivator) != m_deactivators.end());
+ }
+
+ void Presenter::activateBy(void *const deactivator)
+ {
+ activateByImpl({deactivator, false});
+ }
+
+ void Presenter::deactivateBy(void *const deactivator)
+ {
+ deactivateByImpl({deactivator, false});
+ }
+
+ void Presenter::activateByImpl(const DeactivatorInfo &info)
+ {
+ const auto count = m_deactivators.erase(info.deactivator);
+ if (m_isPrepared && (count > 0)) {
+ onActivateBy(info);
+ if (m_deactivators.size() == 0) {
+ onActivate();
+ }
+ }
+ }
+
+ void Presenter::deactivateByImpl(const DeactivatorInfo &info)
+ {
+ if (m_deactivatorExceptions.find(info.deactivator) !=
+ m_deactivatorExceptions.end()) {
+ return;
+ }
+ const auto pair = m_deactivators.insert(info.deactivator);
+ if (m_isPrepared && pair.second) {
+ onDeactivateBy(info);
+ if (m_deactivators.size() == 1) {
+ onDeactivate();
+ }
+ }
+ }
+
+ void Presenter::onActivateBySmart(Widget &widget, void *eventInfo)
+ {
+ activateByImpl(*static_cast<DeactivatorInfo *>(eventInfo));
+ }
+
+ void Presenter::onDeactivateBySmart(Widget &widget, void *eventInfo)
+ {
+ deactivateByImpl(*static_cast<DeactivatorInfo *>(eventInfo));
+ }
+
+ void Presenter::onActivate()
+ {
+ }
+
+ void Presenter::onDeactivate()
+ {
+ }
+
+ void Presenter::onActivateBy(const DeactivatorInfo &info)
+ {
+ }
+
+ void Presenter::onDeactivateBy(const DeactivatorInfo &info)
+ {
+ }
+}
Builder &setEdjeFile(std::string filePath, EdjeGroup group);
Builder &setIsOwner(bool value);
Builder &setNeedBindToEo(bool value);
- LayoutSRef build(Widget &parent) const;
+ LayoutSRef build(ElmWidget &parent) const;
private:
LayoutTheme m_theme;
std::string m_edjeFilePath;
Builder();
Builder &setStyle(ElmStyle value);
Builder &setNeedBindToEo(bool value);
- NaviframeSRef build(Widget &parent) const;
+ NaviframeSRef build(ElmWidget &parent) const;
private:
ElmStyle m_style;
bool m_needBindToEo;
};
public:
+ void setInTransition(bool inTransition);
bool isInTransition() const;
void setAutoBackBtn(bool value);
private:
friend class RefCountObj<Naviframe>;
- friend class NaviItem;
Naviframe(RefCountObjBase &rc, Evas_Object *eo);
- void startTransition();
-
void onTransitionFinished(Widget &widget, void *eventInfo);
private:
{
auto result = elm_naviframe_item_pop(getEo());
if (getBottomItem()) {
- startTransition();
+ setInTransition(true);
}
return result;
}
nullptr, backBtn, moreBtn, content, style.name));
result.setTitle(title);
if (result != getBottomItem()) {
- startTransition();
+ setInTransition(true);
}
return result;
}
bool isEmpty() const;
template <class ...ARGS>
- void invoke(ARGS &&...args);
+ void dispatch(ARGS &&...args);
template <class PREDICATE, class ...ARGS>
- void invokePred(PREDICATE &&pred, ARGS &&...args);
+ void dispatchPred(PREDICATE &&pred, ARGS &&...args);
private:
template <class DO_INVOKE, class ...ARGS>
- void invokeImpl(const DO_INVOKE &doInvoke, ARGS &&...args);
+ void dispatchImpl(const DO_INVOKE &doInvoke, ARGS &&...args);
void lock();
void unlock();
template <class DELEGATE>
template <class ...ARGS>
- void Event<DELEGATE>::invoke(ARGS &&...args)
+ void Event<DELEGATE>::dispatch(ARGS &&...args)
{
- invokeImpl(
+ dispatchImpl(
[](const DELEGATE &delegate, ARGS &&...args)
{
delegate(std::forward<ARGS>(args)...);
template <class DELEGATE>
template <class PREDICATE, class ...ARGS>
- void Event<DELEGATE>::invokePred(PREDICATE &&pred, ARGS &&...args)
+ void Event<DELEGATE>::dispatchPred(PREDICATE &&pred, ARGS &&...args)
{
- invokeImpl(
+ dispatchImpl(
[&pred](const DELEGATE &delegate, ARGS &&...args)
{
return impl::doInvokePred(std::forward<PREDICATE>(pred),
template <class DELEGATE>
template <class DO_INVOKE, class ...ARGS>
- void Event<DELEGATE>::invokeImpl(const DO_INVOKE &doInvoke, ARGS &&...args)
+ void Event<DELEGATE>::dispatchImpl(const DO_INVOKE &doInvoke, ARGS &&...args)
{
lock();
- for (size_t i = 0; i < m_delegates.size(); ++i) {
+ const auto size = m_delegates.size();
+ for (size_t i = 0; i < size; ++i) {
const auto &delegate = m_delegates[i];
if (delegate) {
if (!doInvoke(delegate, std::forward<ARGS>(args)...)) {
+++ /dev/null
-#ifndef __UCL_MISC_SHARED_OBJECT_H__
-#define __UCL_MISC_SHARED_OBJECT_H__
-
-#include "ucl/util/types.h"
-#include "ucl/util/memory.h"
-
-namespace ucl {
-
- UCL_DECLARE_REF_ALIASES(SharedObject);
-
- class SharedObject : public NonCopyable {
- public:
- template <class T>
- SharedRef<T> asShared();
- template <class T>
- WeakRef<T> asWeak();
-
- template <class T>
- SharedRef<const T> asShared() const;
- template <class T>
- WeakRef<const T> asWeak() const;
-
- SharedObjectSRef asShared();
- SharedObjectWRef asWeak();
-
- SharedObjectSCRef asShared() const;
- SharedObjectWCRef asWeak() const;
-
- protected:
- SharedObject(RefCountObjBase *rc);
- ~SharedObject() = default;
-
- protected:
- RefCountObjBase *const m_rc;
- };
-
- // Non-member functions //
-
- template <class T>
- SharedRef<T> asShared(T *obj);
- template <class T>
- WeakRef<T> asWeak(T *obj);
-}
-
-#include "SharedObject.hpp"
-
-#endif // __UCL_MISC_SHARED_OBJECT_H__
+++ /dev/null
-namespace ucl {
-
- inline SharedObject::SharedObject(RefCountObjBase *const rc) :
- m_rc(rc)
- {
- }
-
- template <class T>
- inline SharedRef<T> SharedObject::asShared()
- {
- if (!m_rc) {
- return {};
- }
- return {m_rc, static_cast<T *>(this)};
- }
-
- template <class T>
- inline WeakRef<T> SharedObject::asWeak()
- {
- if (!m_rc) {
- return {};
- }
- return {m_rc, static_cast<T *>(this)};
- }
-
- template <class T>
- inline SharedRef<const T> SharedObject::asShared() const
- {
- if (!m_rc) {
- return {};
- }
- return {m_rc, static_cast<const T *>(this)};
- }
-
- template <class T>
- inline WeakRef<const T> SharedObject::asWeak() const
- {
- if (!m_rc) {
- return {};
- }
- return {m_rc, static_cast<const T *>(this)};
- }
-
- inline SharedObjectSRef SharedObject::asShared()
- {
- return asShared<SharedObject>();
- }
-
- inline SharedObjectWRef SharedObject::asWeak()
- {
- return asWeak<SharedObject>();
- }
-
- inline SharedObjectSCRef SharedObject::asShared() const
- {
- return asShared<SharedObject>();
- }
-
- inline SharedObjectWCRef SharedObject::asWeak() const
- {
- return asWeak<SharedObject>();
- }
-
- // Non-member functions //
-
- template <class T>
- inline SharedRef<T> asShared(T *obj)
- {
- return (obj ?
- obj->asShared<typename std::remove_cv<T>::type>() :
- SharedRef<T>());
- }
-
- template <class T>
- inline WeakRef<T> asWeak(T *obj)
- {
- return (obj ?
- obj->asWeak<typename std::remove_cv<T>::type>() :
- WeakRef<T>());
- }
-}
class Mutex : public NonCopyable {
public:
- Mutex();
+ Mutex(bool recursive = false);
~Mutex();
void lock();
void unlock();
namespace ucl {
- inline Mutex::Mutex() :
+ inline Mutex::Mutex(const bool recursive) :
m_mutex()
{
- pthread_mutex_init(&m_mutex, NULL);
+ if (recursive) {
+ pthread_mutexattr_t attr = {};
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(&m_mutex, &attr);
+ pthread_mutexattr_destroy(&attr);
+ } else {
+ pthread_mutex_init(&m_mutex, nullptr);
+ }
}
inline Mutex::~Mutex()
#include "ucl/appfw/InstanceManagerBase.h"
-#include "../common.h"
+#include "common.h"
namespace ucl {
#include "ucl/appfw/SysEventProvider.h"
-#include "../common.h"
+#include "common.h"
namespace ucl {
void SysEventProvider::dispatch(SysEvent sysEvent)
{
- m_event.invoke(sysEvent);
+ m_event.dispatch(sysEvent);
}
}
#include <app.h>
#include "ucl/appfw/IInstanceAppControlExt.h"
-#include "../common.h"
+#include "common.h"
namespace ucl {
--- /dev/null
+/*
+ * 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_APPFW_COMMON_H__
+#define __UCL_APPFW_COMMON_H__
+
+#include "../common.h"
+
+#endif // __UCL_APPFW_COMMON_H__
#include "ucl/appfw/helpers.h"
-#include "../common.h"
+#include "common.h"
namespace ucl {
#include "ucl/gui/stdTheme/layout.h"
-#include "../common.h"
+#include "common.h"
namespace ucl {
// Layout::Builder //
- LayoutSRef Layout::Builder::build(Widget &parent) const
+ LayoutSRef Layout::Builder::build(ElmWidget &parent) const
{
Evas_Object *const eo = elm_layout_add(parent);
if (!eo) {
elm_naviframe_item_pop_to(getIt());
if (needStartTransition) {
- navi->startTransition();
+ navi->setInTransition(true);
}
}
elm_naviframe_item_promote(getIt());
if (needStartTransition) {
- navi->startTransition();
+ navi->setInTransition(true);
}
}
}
#include "ucl/gui/Naviframe.h"
-#include "../common.h"
+#include "common.h"
namespace ucl {
// Naviframe::Builder //
- NaviframeSRef Naviframe::Builder::build(Widget &parent) const
+ NaviframeSRef Naviframe::Builder::build(ElmWidget &parent) const
{
Evas_Object *const eo = elm_naviframe_add(parent);
if (!eo) {
Naviframe::onTransitionFinished, asWeak(*this)));
}
- void Naviframe::startTransition()
+ void Naviframe::setInTransition(const bool inTransition)
{
- if (!m_isInTransition) {
- m_isInTransition = true;
- callEvent(NAVI_TRANSITION_STARTED);
+ if (inTransition != m_isInTransition) {
+ m_isInTransition = inTransition;
+ if (inTransition) {
+ callEvent(NAVI_TRANSITION_STARTED);
+ } else {
+ callEvent(NAVI_TRANSITION_FINISHED);
+ }
}
}
#include "ucl/gui/Widget.h"
-#include "../common.h"
+#include "common.h"
namespace ucl { namespace { namespace impl {
#include "ucl/gui/Window.h"
-#include "../common.h"
+#include "common.h"
namespace ucl {
--- /dev/null
+/*
+ * 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_COMMON_H__
+#define __UCL_GUI_COMMON_H__
+
+#include "../common.h"
+
+#endif // __UCL_GUI_COMMON_H__
#include "ucl/misc/Variant.h"
-#include "../common.h"
+#include "common.h"
namespace ucl {
--- /dev/null
+/*
+ * 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_COMMON_H__
+#define __UCL_MISC_COMMON_H__
+
+#include "../common.h"
+
+#endif // __UCL_MISC_COMMON_H__