Update ucl 44/121944/2
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Wed, 29 Mar 2017 11:05:42 +0000 (14:05 +0300)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Thu, 30 Mar 2017 07:49:19 +0000 (00:49 -0700)
Change-Id: I183f38fca5eb0a0c04ee922df61c7d3301983903
Signed-off-by: Igor Olshevskyi <i.olshevskyi@samsung.com>
49 files changed:
inc/main/InstanceManager.h
src/main/InstanceManager.cpp
ucl/inc/ucl/appfw/IInstance.h
ucl/inc/ucl/appfw/InstanceManagerBase.h
ucl/inc/ucl/appfw/UIApp.h
ucl/inc/ucl/appfw/helpers.h [new file with mode: 0644]
ucl/inc/ucl/config.h
ucl/inc/ucl/gui/EdjeWidget.h
ucl/inc/ucl/gui/EdjeWidget.hpp
ucl/inc/ucl/gui/ElmWidget.h
ucl/inc/ucl/gui/ElmWidget.hpp
ucl/inc/ucl/gui/Layout.h
ucl/inc/ucl/gui/Layout.hpp
ucl/inc/ucl/gui/NaviItem.h
ucl/inc/ucl/gui/NaviItem.hpp
ucl/inc/ucl/gui/Naviframe.h
ucl/inc/ucl/gui/Naviframe.hpp
ucl/inc/ucl/gui/Theme.h [new file with mode: 0644]
ucl/inc/ucl/gui/Theme.hpp [new file with mode: 0644]
ucl/inc/ucl/gui/Widget.h
ucl/inc/ucl/gui/Widget.hpp
ucl/inc/ucl/gui/WidgetItem.h
ucl/inc/ucl/gui/WidgetItem.hpp
ucl/inc/ucl/gui/Window.h
ucl/inc/ucl/gui/types.h
ucl/inc/ucl/misc/RefCountAware.h [new file with mode: 0644]
ucl/inc/ucl/misc/RefCountAware.hpp [new file with mode: 0644]
ucl/inc/ucl/util/delegation/Delegate.h
ucl/inc/ucl/util/delegation/Delegate.hpp
ucl/inc/ucl/util/delegation/Delegate2.h
ucl/inc/ucl/util/delegation/Delegate2.hpp
ucl/inc/ucl/util/delegation/macro.h
ucl/inc/ucl/util/delegation/shortMacro.h
ucl/inc/ucl/util/helpers.h
ucl/inc/ucl/util/helpers.hpp
ucl/inc/ucl/util/logging.h
ucl/inc/ucl/util/threading/Thread.h
ucl/inc/ucl/util/threading/Thread.hpp
ucl/inc/ucl/util/types/Result.h
ucl/inc/ucl/util/types/baseTypes.h
ucl/src/appfw/UIApp.cpp
ucl/src/appfw/helpers.cpp [new file with mode: 0644]
ucl/src/gui/EdjeWidget.cpp
ucl/src/gui/ElmWidget.cpp
ucl/src/gui/NaviItem.cpp [new file with mode: 0644]
ucl/src/gui/Naviframe.cpp
ucl/src/gui/Widget.cpp
ucl/src/gui/WidgetItem.cpp
ucl/src/util/types/Result.cpp

index 7154dff642986f63aa965ae6993b5362ebd9d950..9bca1da11f814b1e8bc122051cf9b583abd836d0 100644 (file)
@@ -29,7 +29,7 @@ namespace callui {
 
                // ucl::InstanceManagerBase //
 
-               virtual ucl::IInstance *newInstance() const final override;
+               virtual ucl::IInstanceSRef newInstance() const final override;
        };
 }
 
index a42e593d3ef19549a022e59365d610e6207b07b6..92e6dfa5d85ecfa1b362cfd714714697747d4c04 100644 (file)
@@ -29,8 +29,8 @@ namespace callui {
        {
        }
 
-       IInstance *InstanceManager::newInstance() const
+       IInstanceSRef InstanceManager::newInstance() const
        {
-               return new Instance(getSysEventProvider());
+               return makeShared<Instance>(getSysEventProvider());
        }
 }
index 7d69f333840bc1173aebd668cb0a92e1dd320e0a..dc94d906e1f8e0c7053f90a4d226bb41d752a13c 100644 (file)
@@ -5,8 +5,7 @@
 
 namespace ucl {
 
-       class IInstance;
-       using IInstanceUPtr = std::unique_ptr<IInstance>;
+       UCL_DECLARE_REF_ALIASES(IInstance);
 
        class IInstance : public Polymorphic {
        public:
index 27decbdd557540bf8bac6bfa67554cc880dae87c..af161bdf6242d7152e363d5d24bfea7b5cd7256c 100644 (file)
@@ -15,7 +15,7 @@ namespace ucl {
 
                void setSysEventProvider(SysEventProviderUPtr provider);
 
-               virtual IInstance *newInstance() const = 0;
+               virtual IInstanceSRef newInstance() const = 0;
 
        protected:
                SysEventProvider &getSysEventProvider() const;
index ccd628ae0b1150f7d3c13e6240d6a9229f2d890e..417fc3521396fe12cd2564a0a7a2c7d9fe3472e9 100644 (file)
@@ -36,7 +36,7 @@ namespace ucl {
        private:
                InstanceManagerBase &m_instanceMgr;
                WindowSRef m_window;
-               IInstanceUPtr m_instance;
+               IInstanceSRef m_instance;
        };
 }
 
diff --git a/ucl/inc/ucl/appfw/helpers.h b/ucl/inc/ucl/appfw/helpers.h
new file mode 100644 (file)
index 0000000..fe598d9
--- /dev/null
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __UCL_APPFW_HELPERS_H__
+#define __UCL_APPFW_HELPERS_H__
+
+#include "types.h"
+
+namespace ucl {
+
+       std::string getResPath(const char *relativePath);
+}
+
+#endif // __UCL_APPFW_HELPERS_H__
index ba0a30c8aade3c477b67a6b0add80bf2a9a56bfb..d012c6b34e9bc031ede0c556c59b0c34f74f1fd5 100644 (file)
@@ -20,7 +20,7 @@
 #define UCL_MAX_LOG_LEVEL UCL_LOG_LEVEL_INFO
 #endif
 
-#define UCL_DEFAULT_LOG_TAG "UCL"
+#define UCL_DEFAULT_LOG_TAG "CALLUI_UCL"
 
 #define UCL_INCLUDE_DELEGATION_SHORT_MACRO_H 1
 #define UCL_INCLUDE_SMART_DELEGATION_SHORT_MACRO_H 1
index 4724e86443bc5a9fffec90c19fc73610cb16a1a4..d89747dc216f9014d1a8348a300a0e4045486570 100644 (file)
@@ -10,18 +10,18 @@ namespace ucl {
        class EdjeWidget : public ElmWidget {
        public:
                void setText(const TString &value);
-               void setPartText(EdjePart part, const TString &value);
+               void setText(EdjePart part, const TString &value);
 
                TString getText() const;
-               TString getPartText(EdjePart part) const;
+               TString getText(EdjePart part) const;
 
                void setContent(Evas_Object *content);
-               void setPartContent(EdjePart part, Evas_Object *content);
+               void setContent(EdjePart part, Evas_Object *content);
                Evas_Object *unsetContent();
-               Evas_Object *unsetPartContent(EdjePart part);
+               Evas_Object *unsetContent(EdjePart part);
 
                Evas_Object *getContent() const;
-               Evas_Object *getPartContent(EdjePart part) const;
+               Evas_Object *getContent(EdjePart part) const;
 
                void emitSignal(EdjeSignal signal, EdjeSignalSrc source);
 
index ee750450ff333519595ad21288c88fd333c7a50b..7105fcce9cad1c69bbb91178719214f1a496c71c 100644 (file)
@@ -11,7 +11,7 @@ namespace ucl {
                return elm_object_text_get(getEo());
        }
 
-       inline TString EdjeWidget::getPartText(const EdjePart part) const
+       inline TString EdjeWidget::getText(const EdjePart part) const
        {
                return elm_object_part_text_get(getEo(), part.name);
        }
@@ -21,7 +21,7 @@ namespace ucl {
                elm_object_content_set(getEo(), content);
        }
 
-       inline void EdjeWidget::setPartContent(const EdjePart part,
+       inline void EdjeWidget::setContent(const EdjePart part,
                        Evas_Object *const content)
        {
                elm_object_part_content_set(getEo(), part.name, content);
@@ -32,7 +32,7 @@ namespace ucl {
                return elm_object_content_unset(getEo());
        }
 
-       inline Evas_Object *EdjeWidget::unsetPartContent(const EdjePart part)
+       inline Evas_Object *EdjeWidget::unsetContent(const EdjePart part)
        {
                return elm_object_part_content_unset(getEo(), part.name);
        }
@@ -42,7 +42,7 @@ namespace ucl {
                return elm_object_content_get(getEo());
        }
 
-       inline Evas_Object *EdjeWidget::getPartContent(const EdjePart part) const
+       inline Evas_Object *EdjeWidget::getContent(const EdjePart part) const
        {
                return elm_object_part_content_get(getEo(), part.name);
        }
index 108bbd590efb298e62a9be822f94abeec8b1a6d9..b0df1ad6d4cd5b44e68d0673672b8fb0a04b0ab4 100644 (file)
@@ -5,6 +5,8 @@
 
 namespace ucl {
 
+       class Window;
+
        UCL_DECLARE_REF_ALIASES(ElmWidget);
 
        class ElmWidget : public Widget {
@@ -15,6 +17,15 @@ namespace ucl {
                void setEnabled(bool value);
                bool isEnabled() const;
 
+               void setFocusAlowed(bool value);
+               bool isFocusAlowed() const;
+
+               void setTheme(Elm_Theme *th);
+               Elm_Theme *getTheme();
+
+               Evas_Object *getTopWidget() const;
+               Window *getWindow() const;
+
        protected:
                virtual void setFocusedImpl(bool value) final override;
                virtual bool isFocusedImpl() const final override;
index 3febf5ff7dc1329feb0898f9e1c145a7872badae..814b2587fa6e13d332e4c6d40fe277776dcd84d9 100644 (file)
@@ -10,6 +10,31 @@ namespace ucl {
                return !elm_object_disabled_get(getEo());
        }
 
+       inline void ElmWidget::setFocusAlowed(const bool value)
+       {
+               elm_object_focus_allow_set(getEo(), toEina(value));
+       }
+
+       inline bool ElmWidget::isFocusAlowed() const
+       {
+               return elm_object_focus_allow_get(getEo());
+       }
+
+       inline void ElmWidget::setTheme(Elm_Theme *th)
+       {
+               elm_object_theme_set(getEo(), th);
+       }
+
+       inline Elm_Theme *ElmWidget::getTheme()
+       {
+               return elm_object_theme_get(getEo());
+       }
+
+       inline Evas_Object *ElmWidget::getTopWidget() const
+       {
+               return elm_object_top_widget_get(getEo());
+       }
+
        // Non-member functions //
 
        inline void enable(ElmWidget &widget)
index a068416c97f87ffc86f9d46194c9f1cfbccb7836..80f3f2656734f43503f47417a6e96a41963cddf6 100644 (file)
@@ -30,8 +30,10 @@ namespace ucl {
                using EdjeWidget::EdjeWidget;
                explicit Layout(Evas_Object *eo, bool isOwner = false);
 
-               void setTheme(const LayoutTheme &theme);
-               void setEdjeFile(const std::string &filePath, EdjeGroup group);
+               bool setTheme(const LayoutTheme &theme);
+               bool setEdjeFile(const std::string &filePath, EdjeGroup group);
+
+               Variant getEdjeData(EdjeDataKey key);
        };
 }
 
index bfad60c9c047f62beea8c5534fc3abb91c7ddd7c..3516b4a987503d3a00f6a216ac5576cea3074612 100644 (file)
@@ -41,14 +41,20 @@ namespace ucl {
        {
        }
 
-       inline void Layout::setTheme(const LayoutTheme &theme)
+       inline bool Layout::setTheme(const LayoutTheme &theme)
        {
-               elm_layout_theme_set(getEo(), theme.klass, theme.group, theme.style);
+               return elm_layout_theme_set(getEo(),
+                               theme.klass, theme.group, theme.style);
        }
 
-       inline void Layout::setEdjeFile(const std::string &filePath,
+       inline bool Layout::setEdjeFile(const std::string &filePath,
                        const EdjeGroup group)
        {
-               elm_layout_file_set(getEo(), filePath.c_str(), group.name);
+               return elm_layout_file_set(getEo(), filePath.c_str(), group.name);
+       }
+
+       inline Variant Layout::getEdjeData(EdjeDataKey key)
+       {
+               return elm_layout_data_get(getEo(), key);
        }
 }
index 941d510df99face317e625c4acbfea3cba95807c..6b3bd6a6ed6f35fcb04b06e4756b9a3ac23c5206 100644 (file)
@@ -5,7 +5,7 @@
 
 namespace ucl {
 
-       class NaviItem : public WidgetItem {
+       class NaviItem final : public WidgetItem {
        public:
                using PopHandler = Delegate<Eina_Bool(Elm_Object_Item *)>;
 
index db2705bbe3836d9593a076f62f0a60a3e55d4bed..ef60d29d48f26d2c1778da7c1825cc4dfba213ce 100644 (file)
@@ -6,16 +6,6 @@ namespace ucl {
                                handler.getStubA(), handler.getData());
        }
 
-       inline void NaviItem::popTo() const
-       {
-               elm_naviframe_item_pop_to(getIt());
-       }
-
-       inline void NaviItem::promote() const
-       {
-               elm_naviframe_item_promote(getIt());
-       }
-
        inline void NaviItem::setTitleEnabled(
                        const bool value, const bool useTransition) const
        {
index 0f2aa2a4998b929b19c2037bcdb7ec197af35e12..b516813794ddac8c3e1a65b17d007341b41b1b8f 100644 (file)
@@ -8,12 +8,13 @@
 
 namespace ucl {
 
+       constexpr SmartEvent NAVI_TRANSITION_STARTED {"ucl,transition,started"};
+       constexpr SmartEvent NAVI_TRANSITION_FINISHED {"transition,finished"};
+
        UCL_DECLARE_REF_ALIASES(Naviframe);
 
-       class Naviframe : public StyledWidget {
+       class Naviframe final : public StyledWidget {
        public:
-               static constexpr SmartEvent TRANSITION_FINISHED {"transition,finished"};
-
                class Builder {
                public:
                        Builder();
@@ -28,9 +29,10 @@ namespace ucl {
                };
 
        public:
-               friend class RefCountObj<Naviframe>;
                using StyledWidget::StyledWidget;
 
+               bool isInTransition() const;
+
                void setAutoBackBtn(bool value);
                bool isAutoBackBtn() const;
 
@@ -47,18 +49,18 @@ namespace ucl {
                NaviItem push(const TString &title, Evas_Object *content);
                NaviItem push(Evas_Object *content);
 
-               NaviItem insertAfter(const TString &title, NaviItem after,
+               NaviItem insertAfter(NaviItem after, const TString &title,
                                Evas_Object *backBtn, Evas_Object *moreBtn,
                                Evas_Object *content, ElmStyle style);
-               NaviItem insertAfter(const TString &title, NaviItem after,
+               NaviItem insertAfter(NaviItem after, const TString &title,
                                Evas_Object *content);
                NaviItem insertAfter(NaviItem after,
                                Evas_Object *content);
 
-               NaviItem insertBefore(const TString &title, NaviItem before,
+               NaviItem insertBefore(NaviItem before, const TString &title,
                                Evas_Object *backBtn, Evas_Object *moreBtn,
                                Evas_Object *content, ElmStyle style);
-               NaviItem insertBefore(const TString &title, NaviItem before,
+               NaviItem insertBefore(NaviItem before, const TString &title,
                                Evas_Object *content);
                NaviItem insertBefore(NaviItem before,
                                Evas_Object *content);
@@ -66,6 +68,18 @@ namespace ucl {
                NaviItem getTopItem()const;
                NaviItem getBottomItem() const;
                std::vector<NaviItem> getItems() const;
+
+       private:
+               friend class RefCountObj<Naviframe>;
+               friend class NaviItem;
+               Naviframe(RefCountObjBase &rc, Evas_Object *eo);
+
+               void startTransition();
+
+               void onTransitionFinished(Widget &widget, void *eventInfo);
+
+       private:
+               bool m_isInTransition;
        };
 }
 
index 71413775e7f2028826e6c08b2666a6a751b81698..e6d68bf52d4b4d9a29e47974904517e7b6923392 100644 (file)
@@ -30,6 +30,11 @@ namespace ucl {
 
        // Naviframe //
 
+       inline bool Naviframe::isInTransition() const
+       {
+               return m_isInTransition;
+       }
+
        inline void Naviframe::setAutoBackBtn(const bool value)
        {
                elm_naviframe_prev_btn_auto_pushed_set(getEo(), toEina(value));
@@ -62,7 +67,11 @@ namespace ucl {
 
        inline Evas_Object *Naviframe::pop()
        {
-               return elm_naviframe_item_pop(getEo());
+               auto result = elm_naviframe_item_pop(getEo());
+               if (isValid(getBottomItem())) {
+                       startTransition();
+               }
+               return result;
        }
 
        inline NaviItem Naviframe::push(const TString &title,
@@ -72,6 +81,9 @@ namespace ucl {
                auto result = NaviItem(elm_naviframe_item_push(getEo(),
                                nullptr, backBtn, moreBtn, content, style.name));
                result.setTitle(title);
+               if (result != getBottomItem()) {
+                       startTransition();
+               }
                return result;
        }
 
@@ -86,8 +98,8 @@ namespace ucl {
                return push(nullptr, nullptr, nullptr, content, nullptr);
        }
 
-       inline NaviItem Naviframe::insertAfter(const TString &title,
-                       NaviItem after,
+       inline NaviItem Naviframe::insertAfter(NaviItem after,
+                       const TString &title,
                        Evas_Object *const backBtn, Evas_Object *const moreBtn,
                        Evas_Object *const content, const ElmStyle style)
        {
@@ -97,20 +109,20 @@ namespace ucl {
                return result;
        }
 
-       inline NaviItem Naviframe::insertAfter(const TString &title,
-                       NaviItem after, Evas_Object *const content)
+       inline NaviItem Naviframe::insertAfter(NaviItem after,
+                       const TString &title, Evas_Object *const content)
        {
-               return insertAfter(title, after, nullptr, nullptr, content, nullptr);
+               return insertAfter(after, title, nullptr, nullptr, content, nullptr);
        }
 
        inline NaviItem Naviframe::insertAfter(NaviItem after,
                        Evas_Object *const content)
        {
-               return insertAfter(nullptr, after, nullptr, nullptr, content, nullptr);
+               return insertAfter(after, nullptr, nullptr, nullptr, content, nullptr);
        }
 
-       inline NaviItem Naviframe::insertBefore(const TString &title,
-                       NaviItem before,
+       inline NaviItem Naviframe::insertBefore(NaviItem before,
+                       const TString &title,
                        Evas_Object *const backBtn, Evas_Object *const moreBtn,
                        Evas_Object *const content, const ElmStyle style)
        {
@@ -120,16 +132,16 @@ namespace ucl {
                return result;
        }
 
-       inline NaviItem Naviframe::insertBefore(const TString &title,
-                       NaviItem before, Evas_Object *const content)
+       inline NaviItem Naviframe::insertBefore(NaviItem before,
+                       const TString &title, Evas_Object *const content)
        {
-               return insertAfter(title, before, nullptr, nullptr, content, nullptr);
+               return insertAfter(before, title, nullptr, nullptr, content, nullptr);
        }
 
        inline NaviItem Naviframe::insertBefore(NaviItem before,
                        Evas_Object *const content)
        {
-               return insertAfter(nullptr, before, nullptr, nullptr, content, nullptr);
+               return insertAfter(before, nullptr, nullptr, nullptr, content, nullptr);
        }
 
        inline NaviItem Naviframe::getTopItem()const
diff --git a/ucl/inc/ucl/gui/Theme.h b/ucl/inc/ucl/gui/Theme.h
new file mode 100644 (file)
index 0000000..f82d675
--- /dev/null
@@ -0,0 +1,59 @@
+/*
+ * 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_THEME_H__
+#define __UCL_GUI_THEME_H__
+
+#include "types.h"
+
+namespace ucl {
+
+       class Theme final : NonCopyable {
+       public:
+               static Theme create();
+
+               friend void swap(Theme &x, Theme &y);
+
+       public:
+               Theme();
+               Theme(nullptr_t);
+               explicit Theme(Elm_Theme *th, bool isOwner = false);
+               Theme(Theme &&tmp);
+               Theme &operator=(Theme &&tmp);
+               ~Theme();
+
+               Elm_Theme *getTh();
+               const Elm_Theme *getTh() const;
+
+               operator Elm_Theme *();
+               operator const Elm_Theme *() const;
+
+               void addExtension(const std::string edjePath);
+               void addOverlay(const std::string edjePath);
+
+       private:
+               Elm_Theme *m_th;
+               bool m_isOwner;
+       };
+
+       // Non-member functions //
+
+       bool isValid(const Theme &item);
+}
+
+#include "Theme.hpp"
+
+#endif // __UCL_GUI_THEME_H__
diff --git a/ucl/inc/ucl/gui/Theme.hpp b/ucl/inc/ucl/gui/Theme.hpp
new file mode 100644 (file)
index 0000000..dac1d57
--- /dev/null
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+namespace ucl {
+
+       inline Theme Theme::create()
+       {
+               Elm_Theme *const th = elm_theme_new();
+               if (th) {
+                       elm_theme_ref_set(th, nullptr);
+               }
+               return Theme(th, true);
+       }
+
+       inline Theme::Theme() :
+               m_th(nullptr),
+               m_isOwner(false)
+       {
+       }
+
+       inline Theme::Theme(nullptr_t) :
+               Theme()
+       {
+       }
+
+       inline Theme::Theme(Elm_Theme *const th, const bool isOwner) :
+               m_th(th),
+               m_isOwner(isOwner)
+       {
+       }
+
+       inline Theme::Theme(Theme &&tmp)
+       {
+               m_th = tmp.m_th;
+               tmp.m_th = nullptr;
+       }
+
+       inline Theme &Theme::operator=(Theme &&tmp)
+       {
+               swap(*this, tmp);
+               return *this;
+       }
+
+       inline Theme::~Theme()
+       {
+               if (m_isOwner && m_th) {
+                       elm_theme_free(m_th);
+               }
+       }
+
+       inline Elm_Theme *Theme::getTh()
+       {
+               return m_th;
+       }
+
+       inline const Elm_Theme *Theme::getTh() const
+       {
+               return m_th;
+       }
+
+       inline Theme::operator Elm_Theme *()
+       {
+               return getTh();
+       }
+
+       inline Theme::operator const Elm_Theme *() const
+       {
+               return getTh();
+       }
+
+       inline void Theme::addExtension(const std::string edjePath)
+       {
+               elm_theme_extension_add(getTh(), edjePath.c_str());
+       }
+
+       inline void Theme::addOverlay(const std::string edjePath)
+       {
+               elm_theme_overlay_add(getTh(), edjePath.c_str());
+       }
+
+       // Non-member functions //
+
+       inline bool isValid(const Theme &item)
+       {
+               return !!item.getTh();
+       }
+
+       inline void swap(Theme &x, Theme &y)
+       {
+               std::swap(x.m_th, y.m_th);
+               std::swap(x.m_isOwner, y.m_isOwner);
+       }
+}
index 6003ba92ddf7ce02841d55325aaa1e76c29ab8b5..d197f80ea7dc8724b2691e502c198dce12c2ea55 100644 (file)
@@ -5,13 +5,13 @@
 
 #include "types.h"
 
-#include "ucl/misc/SharedObject.h"
+#include "ucl/misc/RefCountAware.h"
 
 namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(Widget);
 
-       class Widget : public SharedObject {
+       class Widget : public RefCountAware {
        public:
                static constexpr auto EXPAND = EVAS_HINT_EXPAND;
                static constexpr auto FILL = EVAS_HINT_FILL;
@@ -33,17 +33,29 @@ namespace ucl {
 
                Evas *getEvas() const;
 
+               void setData(EoDataKey key, void *data);
+               void delData(EoDataKey key);
+               void *getData(EoDataKey key) const;
+
                void addEventHandler(WidgetEvent event, WidgetEventHandler handler);
                void addEventHandler(SmartEvent event, WidgetEventHandler handler);
 
                void delEventHandler(WidgetEvent event, WidgetEventHandler handler);
                void delEventHandler(SmartEvent event, WidgetEventHandler handler);
 
+               void callSmartEvent(SmartEvent event, void *eventInfo = nullptr);
+
                void markForDeletion();
 
                void setVisible(bool value);
                bool isVisible() const;
 
+               void setColor(int r, int g, int b, int a = 255);
+               void setColor(int l, int a = 255);
+               void getColor(int &r, int &g, int &b, int &a) const;
+
+               void calculate();
+
                void setGeometry(int x, int y, int w, int h);
                void move(int x, int y);
                void resize(int w, int h);
@@ -60,6 +72,9 @@ namespace ucl {
                void getMin(int *w, int *h) const;
                void getMax(int *w, int *h) const;
 
+               void setARHint(WidgetARHint arControl, int w, int h);
+               void getARHint(WidgetARHint &arControl, int &w, int &h);
+
                void setFocused(bool value);
                bool isFocused() const;
 
@@ -85,7 +100,7 @@ namespace ucl {
 
                void setSelfRefUnique(const bool value);
 
-               void onEoFree(Evas *e, Evas_Object *obj, void *event_info);
+               void onEoDel(Evas *e, Evas_Object *obj, void *event_info);
 
                void delEventProxy(const EventProxiesIt it);
 
@@ -107,12 +122,15 @@ namespace ucl {
 
        // Non-member functions //
 
-       void getPosition(const Widget &widget, int &x, int &y);
-       void getSize(const Widget &widget, int &w, int &h);
+       void getPosition(const Widget &widget, int *x, int *y);
+       void getSize(const Widget &widget, int *w, int *h);
 
        void show(Widget &widget);
        void hide(Widget &widget);
 
+       void makeTransparent(Widget &widget);
+       void makeWhite(Widget &widget);
+
        void focus(Widget &widget);
        void unfocus(Widget &widget);
 
index 9ab4692585c22a827190c896b353552abab8435d..301dbf9610a620ee37b9d9299bfd564df6a3e832 100644 (file)
@@ -43,6 +43,26 @@ namespace ucl {
                return evas_object_evas_get(getEo());
        }
 
+       inline void Widget::setData(const EoDataKey key, void *const data)
+       {
+               evas_object_data_set(getEo(), key.name, data);
+       }
+
+       inline void Widget::delData(const EoDataKey key)
+       {
+               evas_object_data_del(getEo(), key.name);
+       }
+
+       inline void *Widget::getData(const EoDataKey key) const
+       {
+               return evas_object_data_get(getEo(), key.name);
+       }
+
+       inline void Widget::callSmartEvent(SmartEvent event, void *eventInfo)
+       {
+               evas_object_smart_callback_call(getEo(), event, eventInfo);
+       }
+
        inline void Widget::markForDeletion()
        {
                evas_object_del(getEo());
@@ -62,6 +82,27 @@ namespace ucl {
                return evas_object_visible_get(getEo());
        }
 
+       inline void Widget::setColor(const int r, const int g,
+                       const int b, const int a)
+       {
+               evas_object_color_set(getEo(), r, g, b, a);
+       }
+
+       inline void Widget::setColor(const int l, const int a)
+       {
+               evas_object_color_set(getEo(), l, l, l, a);
+       }
+
+       inline void Widget::getColor(int &r, int &g, int &b, int &a) const
+       {
+               evas_object_color_get(getEo(), &r, &g, &b, &a);
+       }
+
+       inline void Widget::calculate()
+       {
+               evas_object_smart_calculate(getEo());
+       }
+
        inline void Widget::setGeometry(const int x, const int y,
                        const int w, const int h)
        {
@@ -124,6 +165,19 @@ namespace ucl {
                evas_object_size_hint_max_get(getEo(), w, h);
        }
 
+       inline void Widget::setARHint(WidgetARHint arControl, int w, int h)
+       {
+               evas_object_size_hint_aspect_set(getEo(),
+                               static_cast<Evas_Aspect_Control>(arControl), w, h);
+       }
+
+       inline void Widget::getARHint(WidgetARHint &arControl, int &w, int &h)
+       {
+               Evas_Aspect_Control tmp = EVAS_ASPECT_CONTROL_NEITHER;
+               evas_object_size_hint_aspect_get(getEo(), &tmp, &w, &h);
+               arControl = static_cast<WidgetARHint>(tmp);
+       }
+
        inline void Widget::setFocused(const bool value)
        {
                setFocusedImpl(value);
@@ -136,14 +190,14 @@ namespace ucl {
 
        // Non-member functions //
 
-       inline void getPosition(const Widget &widget, int &x, int &y)
+       inline void getPosition(const Widget &widget, int *x, int *y)
        {
-               widget.getGeometry(&x, &y, nullptr, nullptr);
+               widget.getGeometry(x, y, nullptr, nullptr);
        }
 
-       inline void getSize(const Widget &widget, int &w, int &h)
+       inline void getSize(const Widget &widget, int *w, int *h)
        {
-               widget.getGeometry(nullptr, nullptr, &w, &h);
+               widget.getGeometry(nullptr, nullptr, w, h);
        }
 
        inline void show(Widget &widget)
@@ -156,6 +210,16 @@ namespace ucl {
                widget.setVisible(false);
        }
 
+       inline void makeTransparent(Widget &widget)
+       {
+               widget.setColor(0, 0);
+       }
+
+       inline void makeWhite(Widget &widget)
+       {
+               widget.setColor(255);
+       }
+
        inline void focus(Widget &widget)
        {
                widget.setFocused(true);
index 859f3246050fc383fe51e90c75ea667eafb3d846..16a27516e28f6908d904acf95dc63561c4594749 100644 (file)
@@ -15,6 +15,8 @@ namespace ucl {
 
                operator Elm_Object_Item *() const;
 
+               Evas_Object *getWidget() const;
+
                void setDelCallback(Evas_Smart_Cb cb) const;
 
                void del();
@@ -26,18 +28,18 @@ namespace ucl {
                bool isEnabled() const;
 
                void setText(const TString &value) const;
-               void setPartText(EdjePart part, const TString &value) const;
+               void setText(EdjePart part, const TString &value) const;
 
                TString getText() const;
-               TString getPartText(EdjePart part) const;
+               TString getText(EdjePart part) const;
 
                void setContent(Evas_Object *content) const;
-               void setPartContent(EdjePart part, Evas_Object *content) const;
+               void setContent(EdjePart part, Evas_Object *content) const;
                Evas_Object *unsetContent() const;
-               Evas_Object *unsetPartContent(EdjePart part) const;
+               Evas_Object *unsetContent(EdjePart part) const;
 
                Evas_Object *getContent() const;
-               Evas_Object *getPartContent(EdjePart part) const;
+               Evas_Object *getContent(EdjePart part) const;
 
                void emitSignal(EdjeSignal signal, EdjeSignalSrc source) const;
 
@@ -51,6 +53,9 @@ namespace ucl {
        void disable(WidgetItem item);
 
        bool isValid(WidgetItem item);
+
+       bool operator==(WidgetItem lhs, WidgetItem rhs);
+       bool operator!=(WidgetItem lhs, WidgetItem rhs);
 }
 
 #include "WidgetItem.hpp"
index 95c42adff585a1e4389a20b8fe9bfeeec338afdd..ef2badc6bd13f39888395c8e618ed862bc0f935e 100644 (file)
@@ -25,6 +25,11 @@ namespace ucl {
                return m_it;
        }
 
+       inline Evas_Object *WidgetItem::getWidget() const
+       {
+               return elm_object_item_widget_get(getIt());
+       }
+
        inline void WidgetItem::setDelCallback(const Evas_Smart_Cb cb) const
        {
                elm_object_item_del_cb_set(getIt(), cb);
@@ -61,7 +66,7 @@ namespace ucl {
                return elm_object_item_text_get(getIt());
        }
 
-       inline TString WidgetItem::getPartText(const EdjePart part) const
+       inline TString WidgetItem::getText(const EdjePart part) const
        {
                return elm_object_item_part_text_get(getIt(), part.name);
        }
@@ -71,7 +76,7 @@ namespace ucl {
                elm_object_item_content_set(getIt(), content);
        }
 
-       inline void WidgetItem::setPartContent(const EdjePart part,
+       inline void WidgetItem::setContent(const EdjePart part,
                        Evas_Object *const content) const
        {
                elm_object_item_part_content_set(getIt(), part.name, content);
@@ -82,7 +87,7 @@ namespace ucl {
                return elm_object_item_content_unset(getIt());
        }
 
-       inline Evas_Object *WidgetItem::unsetPartContent(const EdjePart part) const
+       inline Evas_Object *WidgetItem::unsetContent(const EdjePart part) const
        {
                return elm_object_item_part_content_unset(getIt(), part.name);
        }
@@ -92,7 +97,7 @@ namespace ucl {
                return elm_object_item_content_get(getIt());
        }
 
-       inline Evas_Object *WidgetItem::getPartContent(const EdjePart part) const
+       inline Evas_Object *WidgetItem::getContent(const EdjePart part) const
        {
                return elm_object_item_part_content_get(getIt(), part.name);
        }
@@ -105,18 +110,28 @@ namespace ucl {
 
        // Non-member functions //
 
-       inline void enable(WidgetItem item)
+       inline void enable(const WidgetItem item)
        {
                item.setEnabled(true);
        }
 
-       inline void disable(WidgetItem item)
+       inline void disable(const WidgetItem item)
        {
                item.setEnabled(false);
        }
 
-       inline bool isValid(WidgetItem item)
+       inline bool isValid(const WidgetItem item)
        {
                return !!item.getIt();
        }
+
+       inline bool operator==(const WidgetItem lhs, const WidgetItem rhs)
+       {
+               return (lhs.getIt() == rhs.getIt());
+       }
+
+       inline bool operator!=(const WidgetItem lhs, const WidgetItem rhs)
+       {
+               return (lhs.getIt() != rhs.getIt());
+       }
 }
index e0d49ed17e9cb2c883685e5f078efdf59b6cf3b5..d26dfaf21d46c3b4eaae46234886924b0964585d 100644 (file)
@@ -7,12 +7,12 @@
 
 namespace ucl {
 
+       constexpr SmartEvent WIN_ROTATION_CHANGED {"wm,rotation,changed"};
+
        UCL_DECLARE_REF_ALIASES(Window);
 
-       class Window : public ElmWidget {
+       class Window final : public ElmWidget {
        public:
-               static constexpr SmartEvent ROTATION_CHANGED {"wm,rotation,changed"};
-
                enum class Type {
                        BASIC = ELM_WIN_BASIC
                };
index f14ea3dffa68b46ad2de02ece54040189e108df7..697e39ae91412d376f6928bacc99f54e2dacfe72 100644 (file)
@@ -10,6 +10,7 @@
 #include "ucl/misc/smartDelegation.h"
 #include "ucl/misc/Aspect.h"
 #include "ucl/misc/TString.h"
+#include "ucl/misc/Variant.h"
 
 namespace ucl {
 
@@ -17,6 +18,7 @@ namespace ucl {
 
        struct EdjePart : Aspect<EdjePart> { using Aspect::Aspect; };
        struct EdjeGroup : Aspect<EdjeGroup> { using Aspect::Aspect; };
+       struct EdjeDataKey : Aspect<EdjeDataKey> { using Aspect::Aspect; };
 
        struct EdjeSignal : Aspect<EdjeSignal> { using Aspect::Aspect; };
        struct EdjeSignalSrc : Aspect<EdjeSignalSrc> { using Aspect::Aspect; };
@@ -25,6 +27,8 @@ namespace ucl {
 
        struct SmartEvent : Aspect<SmartEvent> { using Aspect::Aspect; };
 
+       struct EoDataKey : Aspect<EoDataKey> { using Aspect::Aspect; };
+
        // WidgetEventHandler //
 
        class Widget;
@@ -36,7 +40,6 @@ namespace ucl {
 
        enum class WidgetEvent {
                DEL  = EVAS_CALLBACK_DEL,
-               FREE = EVAS_CALLBACK_FREE,
 
                MOUSE_IN    = EVAS_CALLBACK_MOUSE_IN,
                MOUSE_OUT   = EVAS_CALLBACK_MOUSE_OUT,
@@ -68,6 +71,16 @@ namespace ucl {
                IMAGE_PRELOADED = EVAS_CALLBACK_IMAGE_PRELOADED
        };
 
+       // WidgetARHint //
+
+       enum class WidgetARHint
+       {
+               NEITHER = EVAS_ASPECT_CONTROL_NEITHER,
+               HORIZONTAL = EVAS_ASPECT_CONTROL_HORIZONTAL,
+               VERTICAL = EVAS_ASPECT_CONTROL_VERTICAL,
+               BOTH = EVAS_ASPECT_CONTROL_BOTH
+       };
+
        // LayoutTheme //
 
        struct LayoutTheme {
diff --git a/ucl/inc/ucl/misc/RefCountAware.h b/ucl/inc/ucl/misc/RefCountAware.h
new file mode 100644 (file)
index 0000000..f037baa
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * 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_REF_COUNT_AWARE_H__
+#define __UCL_MISC_REF_COUNT_AWARE_H__
+
+#include "ucl/util/types.h"
+#include "ucl/util/memory.h"
+
+namespace ucl {
+
+       UCL_DECLARE_REF_ALIASES(RefCountAware);
+
+       class RefCountAware : public Polymorphic {
+       public:
+               template <class T>
+               static SharedRef<T> asShared(T *obj);
+               template <class T>
+               static WeakRef<T> asWeak(T *obj);
+
+               template <class T>
+               static SharedRef<T> asShared(T &obj);
+               template <class T>
+               static WeakRef<T> asWeak(T &obj);
+
+               bool isShared() const;
+
+               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;
+
+               RefCountAwareSRef asShared();
+               RefCountAwareWRef asWeak();
+
+               RefCountAwareSCRef asShared() const;
+               RefCountAwareWCRef asWeak() const;
+
+       protected:
+               RefCountAware(RefCountObjBase *rc);
+               virtual ~RefCountAware() = 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);
+
+       template <class T>
+       SharedRef<T> asShared(T &obj);
+       template <class T>
+       WeakRef<T> asWeak(T &obj);
+}
+
+#include "RefCountAware.hpp"
+
+#endif // __UCL_MISC_REF_COUNT_AWARE_H__
diff --git a/ucl/inc/ucl/misc/RefCountAware.hpp b/ucl/inc/ucl/misc/RefCountAware.hpp
new file mode 100644 (file)
index 0000000..7969289
--- /dev/null
@@ -0,0 +1,140 @@
+/*
+ * 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/logging.h"
+
+namespace ucl {
+
+       inline RefCountAware::RefCountAware(RefCountObjBase *const rc) :
+               m_rc(rc)
+       {
+       }
+
+       template <class T>
+       inline SharedRef<T> RefCountAware::asShared(T *obj)
+       {
+               return (obj ? asShared(*obj) : SharedRef<T>());
+       }
+
+       template <class T>
+       inline WeakRef<T> RefCountAware::asWeak(T *obj)
+       {
+               return (obj ? asWeak(*obj) : WeakRef<T>());
+       }
+
+       template <class T>
+       inline SharedRef<T> RefCountAware::asShared(T &obj)
+       {
+               return obj.template asShared<typename std::remove_cv<T>::type>();
+       }
+
+       template <class T>
+       inline WeakRef<T> RefCountAware::asWeak(T &obj)
+       {
+               return obj.template asWeak<typename std::remove_cv<T>::type>();
+       }
+
+       inline bool RefCountAware::isShared() const
+       {
+               return !!m_rc;
+       }
+
+       template <class T>
+       inline SharedRef<T> RefCountAware::asShared()
+       {
+               if (!isShared()) {
+                       UCL_ELOG("NOT SHARED: %s", typeid(*this).name());
+                       return {};
+               }
+               return {m_rc, static_cast<T *>(this)};
+       }
+
+       template <class T>
+       inline WeakRef<T> RefCountAware::asWeak()
+       {
+               if (!isShared()) {
+                       UCL_ELOG("NOT SHARED: %s", typeid(*this).name());
+                       return {};
+               }
+               return {m_rc, static_cast<T *>(this)};
+       }
+
+       template <class T>
+       inline SharedRef<const T> RefCountAware::asShared() const
+       {
+               if (!isShared()) {
+                       UCL_ELOG("NOT SHARED: %s", typeid(*this).name());
+                       return {};
+               }
+               return {m_rc, static_cast<const T *>(this)};
+       }
+
+       template <class T>
+       inline WeakRef<const T> RefCountAware::asWeak() const
+       {
+               if (!isShared()) {
+                       UCL_ELOG("NOT SHARED: %s", typeid(*this).name());
+                       return {};
+               }
+               return {m_rc, static_cast<const T *>(this)};
+       }
+
+       inline RefCountAwareSRef RefCountAware::asShared()
+       {
+               return asShared<RefCountAware>();
+       }
+
+       inline RefCountAwareWRef RefCountAware::asWeak()
+       {
+               return asWeak<RefCountAware>();
+       }
+
+       inline RefCountAwareSCRef RefCountAware::asShared() const
+       {
+               return asShared<RefCountAware>();
+       }
+
+       inline RefCountAwareWCRef RefCountAware::asWeak() const
+       {
+               return asWeak<RefCountAware>();
+       }
+
+       // Non-member functions //
+
+       template <class T>
+       inline SharedRef<T> asShared(T *obj)
+       {
+               return RefCountAware::asShared(obj);
+       }
+
+       template <class T>
+       inline WeakRef<T> asWeak(T *obj)
+       {
+               return RefCountAware::asWeak(obj);
+       }
+
+       template <class T>
+       inline SharedRef<T> asShared(T &obj)
+       {
+               return RefCountAware::asShared(obj);
+       }
+
+       template <class T>
+       inline WeakRef<T> asWeak(T &obj)
+       {
+               return RefCountAware::asWeak(obj);
+       }
+}
index 214482c4ec873ab21d28f96aa6f5d71492b7c41f..ad9a1fd5797b95fd51a1fe91ced9ac91ab25bb47 100644 (file)
@@ -19,14 +19,14 @@ namespace ucl {
                static Delegate make(const CLASS *data) noexcept;
 
                template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
-               static Delegate make(CLASS &data) noexcept;
+               static Delegate makeA(CLASS &data) noexcept;
                template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
-               static Delegate make(CLASS &data) noexcept;
+               static Delegate makeB(CLASS &data) noexcept;
 
                template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
-               static Delegate make(HANDLE data) noexcept;
+               static Delegate makeA(HANDLE data) noexcept;
                template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
-               static Delegate make(HANDLE data) noexcept;
+               static Delegate makeB(HANDLE data) noexcept;
 
                template <R(*FUNC)(ARGS...)>
                static Delegate make() noexcept;
index adb595b58d4ef788c79c8d1af5b85bd7938fe536..680745df0a503555c318b18498c0771b2fe9dd77 100644 (file)
@@ -21,7 +21,7 @@ namespace ucl {
        template <class R, class ...ARGS>
        template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
        inline Delegate<R(ARGS...)>
-                       Delegate<R(ARGS...)>::make(CLASS &data) noexcept
+                       Delegate<R(ARGS...)>::makeA(CLASS &data) noexcept
        {
                return {const_cast<void *>(static_cast<const void *>(&data)),
                                Delegate::Cb::template stubA2A<CLASS, FUNC>};
@@ -30,7 +30,7 @@ namespace ucl {
        template <class R, class ...ARGS>
        template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
        inline Delegate<R(ARGS...)>
-                       Delegate<R(ARGS...)>::make(CLASS &data) noexcept
+                       Delegate<R(ARGS...)>::makeB(CLASS &data) noexcept
        {
                return {const_cast<void *>(static_cast<const void *>(&data)),
                                Delegate::Cb::template stubA2B<CLASS, FUNC>};
@@ -39,7 +39,7 @@ namespace ucl {
        template <class R, class ...ARGS>
        template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
        inline Delegate<R(ARGS...)>
-                       Delegate<R(ARGS...)>::make(const HANDLE data) noexcept
+                       Delegate<R(ARGS...)>::makeA(const HANDLE data) noexcept
        {
                return {const_cast<void *>(static_cast<const void *>(data)),
                                Delegate::Cb::template stubA2A<HANDLE, FUNC>};
@@ -48,7 +48,7 @@ namespace ucl {
        template <class R, class ...ARGS>
        template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
        inline Delegate<R(ARGS...)>
-                       Delegate<R(ARGS...)>::make(const HANDLE data) noexcept
+                       Delegate<R(ARGS...)>::makeB(const HANDLE data) noexcept
        {
                return {const_cast<void *>(static_cast<const void *>(data)),
                                Delegate::Cb::template stubA2B<HANDLE, FUNC>};
index b780af7a320509727aeed066f03208116986828f..766985702cfcaf381a58aeb0623714b2e02e1e94 100644 (file)
@@ -19,14 +19,14 @@ namespace ucl {
                static Delegate2 make(const CLASS *data) noexcept;
 
                template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
-               static Delegate2 make(CLASS &data) noexcept;
+               static Delegate2 makeA(CLASS &data) noexcept;
                template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
-               static Delegate2 make(CLASS &data) noexcept;
+               static Delegate2 makeB(CLASS &data) noexcept;
 
                template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
-               static Delegate2 make(HANDLE data) noexcept;
+               static Delegate2 makeA(HANDLE data) noexcept;
                template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
-               static Delegate2 make(HANDLE data) noexcept;
+               static Delegate2 makeB(HANDLE data) noexcept;
 
                template <R(*FUNC)(ARGS...)>
                static Delegate2 make() noexcept;
index 88246a3b5c283b8681ef41d613454446458fba81..412840671b0ae09d7768e34a7dd7c5465f2f9d50 100644 (file)
@@ -23,7 +23,7 @@ namespace ucl {
        template <class R, class ...ARGS>
        template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
        inline Delegate2<R(ARGS...)>
-                       Delegate2<R(ARGS...)>::make(CLASS &data) noexcept
+                       Delegate2<R(ARGS...)>::makeA(CLASS &data) noexcept
        {
                return {const_cast<void *>(static_cast<const void *>(&data)),
                                Delegate2::Cb::template stubA2A<CLASS, FUNC>,
@@ -33,7 +33,7 @@ namespace ucl {
        template <class R, class ...ARGS>
        template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
        inline Delegate2<R(ARGS...)>
-                       Delegate2<R(ARGS...)>::make(CLASS &data) noexcept
+                       Delegate2<R(ARGS...)>::makeB(CLASS &data) noexcept
        {
                return {const_cast<void *>(static_cast<const void *>(&data)),
                                Delegate2::Cb::template stubA2B<CLASS, FUNC>,
@@ -43,7 +43,7 @@ namespace ucl {
        template <class R, class ...ARGS>
        template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
        inline Delegate2<R(ARGS...)>
-                       Delegate2<R(ARGS...)>::make(const HANDLE data) noexcept
+                       Delegate2<R(ARGS...)>::makeA(const HANDLE data) noexcept
        {
                return {const_cast<void *>(static_cast<const void *>(data)),
                                Delegate2::Cb::template stubA2A<HANDLE, FUNC>,
@@ -53,7 +53,7 @@ namespace ucl {
        template <class R, class ...ARGS>
        template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
        inline Delegate2<R(ARGS...)>
-                       Delegate2<R(ARGS...)>::make(const HANDLE data) noexcept
+                       Delegate2<R(ARGS...)>::makeB(const HANDLE data) noexcept
        {
                return {const_cast<void *>(static_cast<const void *>(data)),
                                Delegate2::Cb::template stubA2B<HANDLE, FUNC>,
index d58bd57d578d47f521fac9dc9edb19658119eead..4b1640fa76660db697c594ca2bd45f5c5055a752 100644 (file)
@@ -11,6 +11,9 @@
 #define _UCL_DELEGATE(DELEGATE, FUNC, DATA) (_UCL_AFS(DELEGATE, FUNC):: \
                Type::make<_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_V(DELEGATE, FUNC) \
                (::ucl::AutoFuncSig<DELEGATE, void, decltype(&FUNC)>::\
                        Type::make<&FUNC>())
 // Helper macro to automatically generate Delegate objects //
 
 #define UCL_DELEGATE(FUNC, DATA) _UCL_DELEGATE(::ucl::Delegate, FUNC, DATA)
+#define UCL_DELEGATE_A(FUNC, DATA) _UCL_DELEGATE_A(::ucl::Delegate, FUNC, DATA)
 #define UCL_DELEGATE_V(FUNC) _UCL_DELEGATE_V(::ucl::Delegate, FUNC)
 
 // Helper macro to automatically generate Delegate2 objects //
 
 #define UCL_DELEGATE2(FUNC, DATA) _UCL_DELEGATE(::ucl::Delegate2, FUNC, DATA)
+#define UCL_DELEGATE2_A(FUNC, DATA) \
+               _UCL_DELEGATE_A(::ucl::Delegate2, FUNC, DATA)
 #define UCL_DELEGATE2_V(FUNC) _UCL_DELEGATE_V(::ucl::Delegate2, FUNC)
 
 // Helper macro to automatically generate Callback stubs //
index ed0c8066ac042ccd593495ab983e2eef1180e725..f9b6c065396d71104dc0fc332550e34e93f47d35 100644 (file)
@@ -3,13 +3,15 @@
 
 // Helper macro to automatically generate Delegate objects //
 
-#define DELEGATE(FUNC, DATA)  UCL_DELEGATE(FUNC, DATA)
-#define DELEGATE_V(FUNC)      UCL_DELEGATE_V(FUNC)
+#define DELEGATE(FUNC, DATA)    UCL_DELEGATE(FUNC, DATA)
+#define DELEGATE_A(FUNC, DATA)  UCL_DELEGATE_A(FUNC, DATA)
+#define DELEGATE_V(FUNC)        UCL_DELEGATE_V(FUNC)
 
 // Helper macro to automatically generate Delegate2 objects //
 
-#define DELEGATE2(FUNC, DATA)  UCL_DELEGATE2(FUNC, DATA)
-#define DELEGATE2_V(FUNC)      UCL_DELEGATE2_V(FUNC)
+#define DELEGATE2(FUNC, DATA)    UCL_DELEGATE2(FUNC, DATA)
+#define DELEGATE2_A(FUNC, DATA)  UCL_DELEGATE2_A(FUNC, DATA)
+#define DELEGATE2_V(FUNC)        UCL_DELEGATE2_V(FUNC)
 
 // Helper macro to automatically generate Callback stubs //
 
index c0ddccb46418135bb6a22eed4c8bfd64e3362b70..7c19f2abe8cdaf3e0d2a116dbbf8d6944bb1bd05 100644 (file)
@@ -59,7 +59,10 @@ namespace ucl {
        constexpr const T &max(const T &a, const T &b);
 
        template <class T>
-       constexpr bool isPot(T value);
+       constexpr bool isPot(T value)
+       {
+               return (((value - 1) & value) == 0);
+       }
 
        template <uint MULTIPLE, class T>
        constexpr T ceilDiv(T value);
index bafaff2c34cc4ee885baa8cdd71fcc94bbfaa36e..7c45c5fd9b7d1c08359c60439da162ed892191b5 100644 (file)
@@ -10,6 +10,12 @@ namespace ucl {
                return (value ? value : zValue);
        }
 
+       template <class T>
+       constexpr bool isNotEmpty(T &&value)
+       {
+               return !isEmpty(std::forward<T>(value));
+       }
+
        constexpr const char *ne(const char *const value, const char *const eValue)
        {
                return (isNotEmpty(value) ? value : eValue);
@@ -20,12 +26,6 @@ namespace ucl {
                return (!value || (value[0] == '\0'));
        }
 
-       template <class T>
-       constexpr bool isNotEmpty(T &&value)
-       {
-               return !isEmpty(std::forward<T>(value));
-       }
-
        template <class T>
        constexpr bool isNotValid(T &&value)
        {
@@ -54,12 +54,6 @@ namespace ucl {
                return ((a > b) ? a : b);
        }
 
-       template <class T>
-       constexpr bool isPot(const T value)
-       {
-               return (((value - 1) & value) == 0);
-       }
-
        template <uint MULTIPLE, class T>
        constexpr T ceilDiv(T value)
        {
index 6fb60f57692759a227f6cb4f1c7e388af5a37e4b..c957f19fa9c7769d112f5a239841e4792b38cb8b 100644 (file)
                const ::ucl::Result __RESULT__ = (result); \
                if (isBad(__RESULT__)) { \
                        UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
-                       return (value); \
+                       return value; \
                } \
        } while (false)
 
        do { \
                const ::ucl::Result __RESULT__ = (result); \
                UCL_RESLOG(__RESULT__, msg, ##__VA_ARGS__); \
-               return (value); \
+               return value; \
        } while (false)
 
 #define UCL_LOG_RETURN_VOID(result, msg, ...) \
index 52bef4bb8ffcd1aa6b908bf50a66f562d76dead6..aa2cfba1719b66839e4dde1f24b2286065b54ffd 100644 (file)
@@ -9,18 +9,24 @@
 
 namespace ucl {
 
-       class Thread : public NonCopyable {
+       class Thread final : public NonCopyable {
        public:
-               explicit Thread(bool createSuspended = false);
-               virtual ~Thread();
+               Thread();
+               template <class FUNC>
+               explicit Thread(FUNC &&func);
+               ~Thread();
+
                bool wasStarted() const;
                bool wasJoinded() const;
-               bool start();
+
+               template <class FUNC>
+               bool start(FUNC &&func);
                void join();
+
                pthread_t *getHandle();
-       protected:
-               virtual void execute() = 0;
+
        private:
+               std::function<void()> m_func;
                pthread_t m_thread;
                bool m_wasStarted;
                bool m_wasJoined;
index 2027f4406db6c3f80d766609c88dbdce26d249e1..4e5255beb3ec4d04682fa600ab62ff817502dffe 100644 (file)
@@ -2,14 +2,18 @@
 
 namespace ucl {
 
-       inline Thread::Thread(bool createSuspended) :
+       inline Thread::Thread() :
                m_thread(),
                m_wasStarted(false),
                m_wasJoined(false)
        {
-               if (!createSuspended) {
-                       start();
-               }
+       }
+
+       template <class FUNC>
+       inline Thread::Thread(FUNC &&func) :
+               Thread()
+       {
+               start(func);
        }
 
        inline Thread::~Thread()
@@ -29,21 +33,24 @@ namespace ucl {
                return m_wasJoined;
        }
 
-       inline bool Thread::start()
+       template <class FUNC>
+       inline bool Thread::start(FUNC &&func)
        {
                if (m_wasStarted) {
                        UCL_WLOG("Already started!");
                        return false;
                }
+               m_func = std::forward<FUNC>(func);
                const int res = pthread_create(&m_thread, NULL,
                        [](void *data) -> void *
                        {
-                               static_cast<Thread *>(data)->execute();
+                               static_cast<Thread *>(data)->m_func();
                                return nullptr;
                        },
                        this);
                if (res != 0) {
                        UCL_ELOG("pthread_create() failed: %d", res);
+                       m_func = {};
                        return false;
                }
                m_wasStarted = true;
@@ -62,6 +69,7 @@ namespace ucl {
                }
                m_wasJoined = true;
                pthread_join(m_thread, NULL);
+               m_func = {};
        }
 
        inline pthread_t *Thread::getHandle()
index 8f833015dce59e2ebe6a7ae05ac84712fc388621..83ac56d87ae9a6f32d18de0ca6184013ada11b58 100644 (file)
@@ -49,8 +49,9 @@ namespace ucl {
                RES_IO_ERROR          = -5,
                RES_NOT_SUPPORTED     = -6,
                RES_INVALID_DATA      = -7,
+               RES_FATAL             = -8,
                // TODO MUST match previous item!
-               _RES_BEGIN            = RES_INVALID_DATA
+               _RES_BEGIN            = RES_FATAL
        };
 }
 
index 50bcfbad89f6c0523b4856c8608405e87baf1013..f118bf4113bf2596624aff790a1c2b669a16cfe5 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <string>
 #include <memory>
+#include <functional>
 #include <type_traits>
 #include <utility>
 
index c33a34e0d5f22978ffc9574e1001451f845f4354..61b1e47c6cea0f4f1b10c5b900fcec2dcf013b33 100644 (file)
@@ -161,7 +161,7 @@ namespace ucl {
 
        Result UIApp::createInstance()
        {
-               auto instance = util::makeUnique(m_instanceMgr.newInstance());
+               auto instance = m_instanceMgr.newInstance();
                if (!instance) {
                        LOG_RETURN(RES_FAIL, "m_instanceMgr.newInstance() failed!");
                }
diff --git a/ucl/src/appfw/helpers.cpp b/ucl/src/appfw/helpers.cpp
new file mode 100644 (file)
index 0000000..a87e4ac
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ucl/appfw/helpers.h"
+
+#include "../common.h"
+
+namespace ucl {
+
+       std::string getResPath(const char *const relativePath)
+       {
+               std::string result;
+               char *const resDir = app_get_resource_path();
+               if (resDir) {
+                       result = resDir;
+                       free(resDir);
+               } else {
+                       ELOG("app_get_resource_path() failed!");
+               }
+               result += relativePath;
+               return result;
+       }
+}
index 0ca9c0cf2b764b403a1e2e5031f3e4d99d517104..57293dba0e27b07c3497a3b2547b3f3779132d08 100644 (file)
@@ -18,7 +18,7 @@ namespace ucl {
                }
        }
 
-       void EdjeWidget::setPartText(const EdjePart part, const TString &value)
+       void EdjeWidget::setText(const EdjePart part, const TString &value)
        {
                if (value.isTranslatable()) {
                        if (value.hasDomain()) {
index 68ee5af304d0f803c0f1ce331197545758d755af..4451c160ae38a7738efe0c2eee0011e70fe63a25 100644 (file)
@@ -1,5 +1,8 @@
 #include "ucl/gui/ElmWidget.h"
 
+#include "ucl/gui/Window.h"
+#include "ucl/gui/helpers.h"
+
 namespace ucl {
 
        void ElmWidget::setFocusedImpl(const bool value)
@@ -11,4 +14,9 @@ namespace ucl {
        {
                return elm_object_focus_get(getEo());
        }
+
+       Window *ElmWidget::getWindow() const
+       {
+               return dynamicCast<Window>(getTopWidget());
+       }
 }
diff --git a/ucl/src/gui/NaviItem.cpp b/ucl/src/gui/NaviItem.cpp
new file mode 100644 (file)
index 0000000..052a8ea
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * 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/NaviItem.h"
+
+#include "ucl/gui/Naviframe.h"
+#include "ucl/gui/helpers.h"
+
+namespace ucl {
+
+       void NaviItem::popTo() const
+       {
+               const auto navi = dynamicCast<Naviframe>(getWidget());
+               const bool needStartTransition =
+                               (navi && (navi->getTopItem() != *this));
+
+               elm_naviframe_item_pop_to(getIt());
+
+               if (needStartTransition) {
+                       navi->startTransition();
+               }
+       }
+
+       void NaviItem::promote() const
+       {
+               const auto navi = dynamicCast<Naviframe>(getWidget());
+               const bool needStartTransition =
+                               (navi && (navi->getTopItem() != *this));
+
+               elm_naviframe_item_promote(getIt());
+
+               if (needStartTransition) {
+                       navi->startTransition();
+               }
+       }
+}
index d7d277641f224d22edc8e3f5eec7ab1d4998f44c..0814cb517002dff7f6fa4ef8ba549e8c3cd77bd4 100644 (file)
@@ -28,4 +28,27 @@ namespace ucl {
 
                return result;
        }
+
+       // Naviframe //
+
+       Naviframe::Naviframe(RefCountObjBase &rc, Evas_Object *eo) :
+               StyledWidget(&rc, eo, true),
+               m_isInTransition(false)
+       {
+               addEventHandler(NAVI_TRANSITION_FINISHED, WEAK_DELEGATE(
+                               Naviframe::onTransitionFinished, asWeak(*this)));
+       }
+
+       void Naviframe::startTransition()
+       {
+               if (!m_isInTransition) {
+                       m_isInTransition = true;
+                       callSmartEvent(NAVI_TRANSITION_STARTED);
+               }
+       }
+
+       void Naviframe::onTransitionFinished(Widget &widget, void *eventInfo)
+       {
+               m_isInTransition = false;
+       }
 }
index d8f519f8073a8fa7c004901c79c0ed84e9373f0c..6f4b631808ba614efe14ff711603e0b32ec98d02 100644 (file)
@@ -96,7 +96,7 @@ namespace ucl {
 
        Widget::Widget(RefCountObjBase *const rc, Evas_Object *const eo,
                        const bool isOwner) :
-               SharedObject(rc),
+               RefCountAware(rc),
                m_eo(eo),
                m_isOwner(isOwner),
                m_isBoundToEo(false),
@@ -107,9 +107,9 @@ namespace ucl {
                UCL_ASSERT(m_eo, "m_eo is NULL!");
 
                if (m_rc) {
-                       evas_object_event_callback_priority_add(m_eo, EVAS_CALLBACK_FREE,
+                       evas_object_event_callback_priority_add(m_eo, EVAS_CALLBACK_DEL,
                                        EO_CALLBACK_PRIORITY_AFTER,
-                                       CALLBACK_A(Widget::onEoFree), this);
+                                       CALLBACK_A(Widget::onEoDel), this);
                }
 
                updateRefs();
@@ -124,8 +124,8 @@ namespace ucl {
                }
 
                if (m_rc) {
-                       evas_object_event_callback_del_full(m_eo, EVAS_CALLBACK_FREE,
-                                       CALLBACK_A(Widget::onEoFree), this);
+                       evas_object_event_callback_del_full(m_eo, EVAS_CALLBACK_DEL,
+                                       CALLBACK_A(Widget::onEoDel), this);
                }
 
                if (m_isOwner) {
@@ -212,7 +212,7 @@ namespace ucl {
                }
        }
 
-       void Widget::onEoFree(Evas *e, Evas_Object *obj, void *event_info)
+       void Widget::onEoDel(Evas *e, Evas_Object *obj, void *event_info)
        {
                if (!m_isSelfRefKept) {
                        FLOG("UNEXPECTED! m_isSelfRefKept: %d;", m_isSelfRefKept);
index 3bc242ab1d2bafca3ba8827b4e32445bb90c57a2..05ab85acf0a725ea8c0feaec17719af30e9eb97d 100644 (file)
@@ -17,7 +17,7 @@ namespace ucl {
                }
        }
 
-       void WidgetItem::setPartText(
+       void WidgetItem::setText(
                        const EdjePart part, const TString &value) const
        {
                if (value.isTranslatable()) {
index dee8d6c7ce8375a09309cbe9e832a3a27cee4597..7e0464f1ee044ca3aaba40bb1f3515291ee4d08e 100644 (file)
@@ -5,6 +5,7 @@
 namespace ucl { namespace { namespace impl {
 
        constexpr ResultData RESUT_DATA[] = {
+               {"RES_FATAL",             DLOG_FATAL},
                {"RES_INVALID_DATA",      DLOG_ERROR},
                {"RES_NOT_SUPPORTED",     DLOG_ERROR},
                {"RES_IO_ERROR",          DLOG_ERROR},