diff options
author | Eugene Kurzberg <i.kurtsberg@samsung.com> | 2017-07-24 09:39:30 +0300 |
---|---|---|
committer | Eugene Kurzberg <i.kurtsberg@samsung.com> | 2017-07-24 09:39:30 +0300 |
commit | af883c7ad9c56ac47cdb782bf63f806bdd9b6881 (patch) | |
tree | f969eeb52ca3d56657f5069cc74d887134e5386d | |
parent | b60c88a69cf21443bbb404ff40dfe31217c855ac (diff) | |
download | alarm-af883c7ad9c56ac47cdb782bf63f806bdd9b6881.tar.gz alarm-af883c7ad9c56ac47cdb782bf63f806bdd9b6881.tar.bz2 alarm-af883c7ad9c56ac47cdb782bf63f806bdd9b6881.zip |
Update apps-common UI components.
Change-Id: I214bb9c301133d238ae152eb59a6c2ba12e9c8a4
Signed-off-by: Eugene Kurzberg <i.kurtsberg@samsung.com>
39 files changed, 1255 insertions, 78 deletions
diff --git a/lib-apps-common/.cproject b/lib-apps-common/.cproject index 6f4facb..4c6e991 100644 --- a/lib-apps-common/.cproject +++ b/lib-apps-common/.cproject @@ -207,8 +207,9 @@ <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/yaca""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/dbus-1.0/include""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/lib/glib-2.0/include""/> - <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/> <listOptionValue builtIn="false" value=""${SBI_SYSROOT}/usr/include/asp/""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/inc}""/> + <listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/res/apps-common/edje}""/> </option> <option id="sbi.gnu.cpp.compiler.option.frameworks.core.1298366398" name="Tizen-Frameworks" superClass="sbi.gnu.cpp.compiler.option.frameworks.core" valueType="userObjs"> <listOptionValue builtIn="false" value="Native_API"/> @@ -361,7 +362,8 @@ </folderInfo> <sourceEntries> <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="inc"/> - <entry flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name="src"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="res"/> + <entry flags="VALUE_WORKSPACE_PATH" kind="sourcePath" name="src"/> </sourceEntries> </configuration> </storageModule> diff --git a/lib-apps-common/edje/apps-common/images/b_ic_press_full_circle_bg.png b/lib-apps-common/edje/apps-common/images/b_ic_press_full_circle_bg.png Binary files differnew file mode 100644 index 0000000..5b9f7e4 --- /dev/null +++ b/lib-apps-common/edje/apps-common/images/b_ic_press_full_circle_bg.png diff --git a/lib-apps-common/edje/apps-common/images/check_18.png b/lib-apps-common/edje/apps-common/images/check_18.png Binary files differnew file mode 100644 index 0000000..0f149f4 --- /dev/null +++ b/lib-apps-common/edje/apps-common/images/check_18.png diff --git a/lib-apps-common/edje/apps-common/images/circle_button_bg.png b/lib-apps-common/edje/apps-common/images/circle_button_bg.png Binary files differnew file mode 100644 index 0000000..520e25a --- /dev/null +++ b/lib-apps-common/edje/apps-common/images/circle_button_bg.png diff --git a/lib-apps-common/edje/apps-common/images/tw_no_item_bg.png b/lib-apps-common/edje/apps-common/images/tw_no_item_bg.png Binary files differnew file mode 100644 index 0000000..de5ac92 --- /dev/null +++ b/lib-apps-common/edje/apps-common/images/tw_no_item_bg.png diff --git a/lib-apps-common/inc/Ui/Accessibility.h b/lib-apps-common/inc/Ui/Accessibility.h index af6e0c3..01b85bb 100644 --- a/lib-apps-common/inc/Ui/Accessibility.h +++ b/lib-apps-common/inc/Ui/Accessibility.h @@ -40,6 +40,11 @@ namespace Ui */ void append(Evas_Object *obj); + /** + * @brief Add relationship to self and finish chain + */ + void end(); + private: Evas_Object *m_Object; }; @@ -54,11 +59,12 @@ namespace Ui /** * @brief Create accessible object for text part using text as its name. - * @param[in] layout Layout containing the part - * @param[in] part Text part to create accessible object for + * @param[in] layout Layout containing the part + * @param[in] part Text part to create accessible object forfor + * @param[in] textPart Part to get text from or nullptr to use the same part * @return Accessible object. */ - EXPORT_API Evas_Object *createTextAccessObject(Evas_Object *layout, const char *part); + EXPORT_API Evas_Object *createTextAccessObject(Evas_Object *layout, const char *part, const char *textPart = nullptr); /** * @brief ATSPI reading information callback @ref Elm_Atspi_Reading_Info_Cb. diff --git a/lib-apps-common/inc/Ui/GenContainer.h b/lib-apps-common/inc/Ui/GenContainer.h index 0348fc8..0a08b7c 100644 --- a/lib-apps-common/inc/Ui/GenContainer.h +++ b/lib-apps-common/inc/Ui/GenContainer.h @@ -22,6 +22,7 @@ namespace Ui { + class GenGroupItem; class EXPORT_API GenContainer : public Control { public: @@ -56,6 +57,11 @@ namespace Ui GenItem *getLastItem() const; /** + * @return Middle Item. + */ + GenItem *getMiddleItem() const; + + /** * @return Begin iterator. */ GenIterator begin() const; @@ -77,7 +83,7 @@ namespace Ui * This might seem like a counter-intuitive behavior but it supports * commonly used pattern. */ - void insert(GenItem *item, GenItem *parent = nullptr, GenItem *sibling = nullptr, + void insert(GenItem *item, GenGroupItem *parent = nullptr, GenItem *sibling = nullptr, Position position = Before); /** diff --git a/lib-apps-common/inc/Ui/GenItem.h b/lib-apps-common/inc/Ui/GenItem.h index 241a637..a44ee54 100644 --- a/lib-apps-common/inc/Ui/GenItem.h +++ b/lib-apps-common/inc/Ui/GenItem.h @@ -127,17 +127,27 @@ namespace Ui * @param[in] isAnimated Whether scrolling is animated or immediate * @see Elm_Genlist_Item_Scrollto_Type or Elm_Gengrid_Item_Scrollto_Type */ - void scrollTo(int position = ELM_GENLIST_ITEM_SCROLLTO_IN, + void scrollTo(int position = ELM_GENLIST_ITEM_SCROLLTO_MIDDLE, bool isAnimated = false); /** * @brief Scroll to the item and give it focus. * @see GenItem::scrollTo() */ - void focus(Elm_Genlist_Item_Scrollto_Type position = ELM_GENLIST_ITEM_SCROLLTO_IN, + void focus(Elm_Genlist_Item_Scrollto_Type position = ELM_GENLIST_ITEM_SCROLLTO_MIDDLE, bool isAnimated = false); /** + * @brief Select item as if by user interaction. + */ + void select(); + + /** + * @brief Update all item parts. + */ + void update(); + + /** * @brief Update item part. * @see elm_gelist_item_fields_update or elm_gengrid_item_fields_update */ diff --git a/lib-apps-common/inc/Ui/Naviframe.h b/lib-apps-common/inc/Ui/Naviframe.h index dcefccb..d522ffa 100644 --- a/lib-apps-common/inc/Ui/Naviframe.h +++ b/lib-apps-common/inc/Ui/Naviframe.h @@ -58,6 +58,8 @@ namespace Ui Ecore_Job *m_Job; bool m_IsFirstPagePrevButtonVisible; + + NaviframePage *m_PageInTransition; std::vector<NavigatorPage *> m_PagesToRemove; }; } diff --git a/lib-apps-common/inc/Ui/PersistentItem.h b/lib-apps-common/inc/Ui/PersistentItem.h new file mode 100644 index 0000000..9e98616 --- /dev/null +++ b/lib-apps-common/inc/Ui/PersistentItem.h @@ -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. + */ + +#ifndef UI_PERSISTENT_ITEM_H +#define UI_PERSISTENT_ITEM_H + +#include "Ui/GenItem.h" + +namespace Ui +{ + /** + * @brief GenItem whose content is not destroyed when item is unrealized. + */ + class EXPORT_API PersistentItem : public GenItem + { + public: + /** + * @brief Create item. + * @param[in] persistentPart Part whose content should be preserved + * @see GenItem::GenItem() + */ + explicit PersistentItem(const char *persistentPart = "elm.swallow.content", + GenContainer::Type type = GenContainer::TypeGenlist); + virtual ~PersistentItem() override; + + /** + * @return Content of persistent part. + */ + Evas_Object *getContent() const; + + protected: + /** + * @brief Create persistent content. + * @param[in] parent Parent object + * @return Content for persistent part. + */ + virtual Evas_Object *createContent(Evas_Object *parent) = 0; + + /** + * @brief Provides preserved content to persistent part. + * @see GenItem::getContent() + */ + virtual Evas_Object *getContent(Evas_Object *parent, const char *part) override; + + /** + * @brief Calls createContent() using item's container as a parent. + * @see GenItem::onInserted() + */ + virtual void onInserted() override; + + /** + * @brief Shows persistent content. + * @see GenItem::onRealized() + */ + virtual void onRealized() override; + + /** + * @brief Hides persistent content so it wouldn't be displayed while item is unrealized. + * @see GenItem::onUnrealized() + */ + virtual void onUnrealized() override; + + private: + const char *m_Part; + Evas_Object *m_Content; + }; +} + +#endif /* UI_PERSISTENT_ITEM_H */ diff --git a/lib-apps-common/inc/Ui/Popup.h b/lib-apps-common/inc/Ui/Popup.h index 7769296..cc26744 100644 --- a/lib-apps-common/inc/Ui/Popup.h +++ b/lib-apps-common/inc/Ui/Popup.h @@ -101,6 +101,14 @@ namespace Ui */ virtual Evas_Object *onCreate(Evas_Object *parent) override; + /** + * @brief Create button. + * @param[in] style Button style + * @param[in] callback Button click callback + * @return Created button on success, otherwise nullptr. + */ + Evas_Object *createButton(const char *style, ButtonCallback callback = nullptr); + private: void onCanceled(); @@ -118,6 +126,7 @@ namespace Ui View *m_View; Window *m_Window; + Evas_Object *m_Layout; }; } diff --git a/lib-apps-common/inc/Ui/Toast.h b/lib-apps-common/inc/Ui/Toast.h index 50d6991..c60c23b 100644 --- a/lib-apps-common/inc/Ui/Toast.h +++ b/lib-apps-common/inc/Ui/Toast.h @@ -35,6 +35,12 @@ namespace Ui */ void setIcon(Evas_Object *icon); + /** + * @brief Set toast popup icon. + * @param[in] path Icon resource path + */ + void setIcon(const char *path); + protected: /** * @see Control::onCreate() diff --git a/lib-apps-common/inc/Utils/Callback.h b/lib-apps-common/inc/Utils/Callback.h index b7b70bd..8a2f525 100644 --- a/lib-apps-common/inc/Utils/Callback.h +++ b/lib-apps-common/inc/Utils/Callback.h @@ -44,13 +44,13 @@ * @endcode */ #define makeCallback(method) \ - ::Utils::Callback<decltype(method)>::makeWithFirstParam<method>() + ::Utils::Callback<decltype(method)>::stubWithFirstParam<method> /** * @brief Make C-style callback from non-static class method with object as last parameter. * @see makeCallback() */ #define makeCallbackWithLastParam(method) \ - ::Utils::Callback<decltype(method)>::makeWithLastParam<method>() + ::Utils::Callback<decltype(method)>::stubWithLastParam<method> #endif /* UTILS_CALLBACK_H */ diff --git a/lib-apps-common/inc/Utils/CallbackImpl.h b/lib-apps-common/inc/Utils/CallbackImpl.h index ce961a0..ac5d66f 100644 --- a/lib-apps-common/inc/Utils/CallbackImpl.h +++ b/lib-apps-common/inc/Utils/CallbackImpl.h @@ -22,40 +22,20 @@ namespace Utils template <typename F> class Callback; - template <typename R, typename... A> - class Callback<R(A...)> - { - public: - template <class C, R(C::*Method)(A...)> - static R stubWithFirstParam(void *object, A... args) - { - return (static_cast<C*>(object)->*Method)(args...); - } - - template <class C, R(C::*Method)(A...)> - static R stubWithLastParam(A... args, void *object) - { - return (static_cast<C*>(object)->*Method)(args...); - } - }; - template <typename R, typename C, typename... A> class Callback<R(C::*)(A...)> { public: - typedef R(*WithFirstParam)(void*, A...); - typedef R(*WithLastParam)(A..., void*); - template <R(C::*Method)(A...)> - static WithFirstParam makeWithFirstParam() + static R stubWithFirstParam(void *object, A... args) { - return &Callback<R(A...)>::template stubWithFirstParam<C, Method>; + return (static_cast<C*>(object)->*Method)(args...); } template <R(C::*Method)(A...)> - static WithLastParam makeWithLastParam() + static R stubWithLastParam(A... args, void *object) { - return &Callback<R(A...)>::template stubWithLastParam<C, Method>; + return (static_cast<C*>(object)->*Method)(args...); } }; } diff --git a/lib-apps-common/inc/Ux/ActionButtons.h b/lib-apps-common/inc/Ux/ActionButtons.h new file mode 100644 index 0000000..7bc2183 --- /dev/null +++ b/lib-apps-common/inc/Ux/ActionButtons.h @@ -0,0 +1,61 @@ +/* + * 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 UX_ACTION_BUTTONS_H +#define UX_ACTION_BUTTONS_H + +#include "Ui/Control.h" + +namespace Ux +{ + /** + * @brief Provides a set of shortcut action buttons. + */ + class EXPORT_API ActionButtons : public Ui::Control + { + public: + /** + * @brief Action button press callback. + */ + typedef std::function<void()> ButtonCallback; + + /** + * @brief Add action button. + * @param[in] text Button text + * @param[in] iconPath Button icon path relative to resource directory + * @param[in] callback Callback to be called when button is pressed + */ + Evas_Object *addButton(const char *text, const char *iconPath, ButtonCallback callback); + + /** + * @brief Set enabled state for action buttons. + * @param[in] isEnabled Whether buttons are enabled + */ + void setEnabled(bool isEnabled); + + protected: + /** + * @see Control::onCreate() + */ + virtual Evas_Object *onCreate(Evas_Object *parent) override; + + private: + static void onButtonPressed(ButtonCallback *callback, Evas_Object *button, void *eventInfo); + static void onButtonDestroy(ButtonCallback *callback, Evas *e, Evas_Object *button, void *eventInfo); + }; +} + +#endif /* UX_ACTION_BUTTONS_H */ diff --git a/lib-apps-common/inc/Ux/ActionButtonsItem.h b/lib-apps-common/inc/Ux/ActionButtonsItem.h new file mode 100644 index 0000000..75df92c --- /dev/null +++ b/lib-apps-common/inc/Ux/ActionButtonsItem.h @@ -0,0 +1,51 @@ +/* + * 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 UX_ACTION_BUTTONS_ITEM_H +#define UX_ACTION_BUTTONS_ITEM_H + +#include "Ui/PersistentItem.h" +#include "Ux/ActionButtons.h" + +namespace Ux +{ + class EXPORT_API ActionButtonsItem : public Ui::PersistentItem + { + public: + /** + * @return Contained ActionButtons control. + */ + ActionButtons *getControl() const; + + protected: + /** + * @see GenItem::getItemClass() + */ + virtual Elm_Gen_Item_Class *getItemClass() const override; + + /** + * @see PersistentItem::createContent() + */ + virtual Evas_Object *createContent(Evas_Object *parent) override; + + /** + * @see GenItem::onInserted() + */ + virtual void onInserted() override; + }; +} + +#endif /* UX_ACTION_BUTTONS_ITEM_H */ diff --git a/lib-apps-common/inc/Ux/SuccessPopup.h b/lib-apps-common/inc/Ux/SuccessPopup.h new file mode 100644 index 0000000..4b3e524 --- /dev/null +++ b/lib-apps-common/inc/Ux/SuccessPopup.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 UX_SUCCESS_POPUP_H +#define UX_SUCCESS_POPUP_H + +#include "Ui/Toast.h" + +namespace Ux +{ + /** + * @brief Toast popup notifying about the success of some operation. + */ + class EXPORT_API SuccessPopup : public Ui::Toast + { + private: + virtual void onCreated() override; + }; +} + +#endif /* UX_SUCCESS_POPUP_H */ diff --git a/lib-apps-common/project_def.prop b/lib-apps-common/project_def.prop index 478352e..e88f47d 100644 --- a/lib-apps-common/project_def.prop +++ b/lib-apps-common/project_def.prop @@ -9,50 +9,54 @@ type = sharedLib profile = wearable-4.0 # C/CPP Sources -USER_SRCS = src/*/*.cpp +USER_SRCS = src/*/*.cpp # EDC Sources -USER_EDCS = +USER_EDCS = # PO Sources -USER_POS = +USER_POS = # User Defines -USER_DEFS = -USER_CPP_DEFS = TIZEN_DEPRECATION DEPRECATION_WARNING +USER_DEFS = +USER_CPP_DEFS = # User Undefines -USER_UNDEFS = -USER_CPP_UNDEFS = +USER_UNDEFS = +USER_CPP_UNDEFS = # User Libraries -USER_LIBS = +USER_LIBS = # User Objects -USER_OBJS = +USER_OBJS = # User Includes ## C Compiler -USER_C_INC_DIRS = -USER_INC_FILES = +USER_C_INC_DIRS = +USER_INC_FILES = ## C++ Compiler -USER_CPP_INC_DIRS = inc -USER_CPP_INC_FILES = +USER_CPP_INC_DIRS = inc res/apps-common/edje +USER_CPP_INC_FILES = USER_INC_DIRS = $(USER_C_INC_DIRS) $(USER_CPP_INC_DIRS) # User Library Path -USER_LIB_DIRS = +USER_LIB_DIRS = # EDC Resource Path -USER_EDCS_IMAGE_DIRS = ${OUTPUT_DIR} -USER_EDCS_SOUND_DIRS = ${OUTPUT_DIR} -USER_EDCS_FONT_DIRS = ${OUTPUT_DIR} +USER_EDCS_IMAGE_DIRS = edje +USER_EDCS_SOUND_DIRS = edje +USER_EDCS_FONT_DIRS = edje # EDC Flags -USER_EXT_EDC_KEYS = +USER_EXT_EDC_KEYS = EDC0 -# Resource Filter -USER_RES_INCLUDE = -USER_RES_EXCLUDE = +USER_EXT_EDC0_EDCS = res/*/edje/*.edc +USER_EXT_EDC0_EDCS_IMAGE_DIRS = edje +USER_EXT_EDC0_EDCS_SOUND_DIRS = edje +USER_EXT_EDC0_EDCS_FONT_DIRS = edje +# Resource Filter +USER_RES_INCLUDE = +USER_RES_EXCLUDE = diff --git a/lib-apps-common/res/apps-common/edje/AppsCommonButtons.h b/lib-apps-common/res/apps-common/edje/AppsCommonButtons.h new file mode 100644 index 0000000..65778fc --- /dev/null +++ b/lib-apps-common/res/apps-common/edje/AppsCommonButtons.h @@ -0,0 +1,25 @@ +/* + * 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 APPS_COMMON_BUTTONS_H +#define APPS_COMMON_BUTTONS_H + +#include "AppsCommonPath.h" + +#define PATH_APPS_COMMON_BUTTONS APPS_COMMON_EDJ_DIR"apps-common-buttons.edj" +#define PATH_BUTTON_CIRCLE_BG APPS_COMMON_IMG_DIR"circle_button_bg.png" + +#endif /* APPS_COMMON_BUTTONS_H */ diff --git a/lib-apps-common/res/apps-common/edje/AppsCommonList.h b/lib-apps-common/res/apps-common/edje/AppsCommonList.h new file mode 100644 index 0000000..daa6d88 --- /dev/null +++ b/lib-apps-common/res/apps-common/edje/AppsCommonList.h @@ -0,0 +1,28 @@ +/* + * 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 APPS_COMMON_LIST_H +#define APPS_COMMON_LIST_H + +#include "AppsCommonPath.h" + +#define PATH_APPS_COMMON_LIST APPS_COMMON_EDJ_DIR"apps-common-list.edj" +#define PATH_NO_CONTENTS_BG APPS_COMMON_IMG_DIR"tw_no_item_bg.png" +#define PATH_NO_CONTENTS_PRESS_BG APPS_COMMON_IMG_DIR"b_ic_press_full_circle_bg.png" + +#define SIGNAL_CLICKED "action,click" + +#endif /* APPS_COMMON_LIST_H */ diff --git a/lib-apps-common/res/apps-common/edje/AppsCommonPath.h b/lib-apps-common/res/apps-common/edje/AppsCommonPath.h new file mode 100644 index 0000000..25ec6ce --- /dev/null +++ b/lib-apps-common/res/apps-common/edje/AppsCommonPath.h @@ -0,0 +1,23 @@ +/* + * 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 APPS_COMMON_PATH_H +#define APPS_COMMON_PATH_H + +#define APPS_COMMON_IMG_DIR "apps-common/images/" +#define APPS_COMMON_EDJ_DIR "apps-common/edje/" + +#endif /* APPS_COMMON_PATH_H */ diff --git a/lib-apps-common/res/apps-common/edje/AppsCommonPopup.h b/lib-apps-common/res/apps-common/edje/AppsCommonPopup.h new file mode 100644 index 0000000..263fe30 --- /dev/null +++ b/lib-apps-common/res/apps-common/edje/AppsCommonPopup.h @@ -0,0 +1,28 @@ +/* + * 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 APPS_COMMON_POPUP_H +#define APPS_COMMON_POPUP_H + +#include "AppsCommonPath.h" + +#define PATH_APPS_COMMON_POPUP APPS_COMMON_EDJ_DIR"apps-common-popup.edj" + +#define PATH_ICON_SUCCESS APPS_COMMON_IMG_DIR"check_18.png" + +#define LAYOUT_ICON_SUCCESS "icon_success" + +#endif /* APPS_COMMON_POPUP_H */ diff --git a/lib-apps-common/res/apps-common/edje/apps-common-buttons.edc b/lib-apps-common/res/apps-common/edje/apps-common-buttons.edc new file mode 100644 index 0000000..922e665 --- /dev/null +++ b/lib-apps-common/res/apps-common/edje/apps-common-buttons.edc @@ -0,0 +1,244 @@ +/* + * 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 "AppsCommonButtons.h" + +#define ICON_SMALL_WH 76 +#define ICON_LARGE_WH 100 +#define TEXT_L 24 + +#define ITEM_H 115 + +color_classes { + color_class { "button/circle/bg"; + color: 156 156 156 255; + } + color_class { "button/circle/bg_pressed"; + color: 156 156 156 128; + } + color_class { "button/circle/bg_disabled"; + color: 156 156 156 102; + } + color_class { "button/circle/icon"; + color: 0 0 0 255; + } + color_class { "button/circle/icon_pressed"; + color: 0 0 0 128; + } + color_class { "button/circle/icon_disabled"; + color: 0 0 0 102; + } + color_class { "button/circle/text"; + color: 255 255 255 255; + } + color_class { "button/circle/text_pressed"; + color: 255 255 255 255; + } + color_class { "button/circle/text_disabled"; + color: 77 77 77 255; + } +} + +styles { + style { + name: "button_circle"; + base: "font=Tizen:style=Regular font_size=36 text_class=tizen align=left color=#fff color_class=button/circle/text"; + } + style { + name: "button_circle_pressed"; + base: "font=Tizen:style=Regular font_size=36 text_class=tizen align=left color=#fff color_class=button/circle/text_pressed"; + } + style { + name: "button_circle_disabled"; + base: "font=Tizen:style=Regular font_size=36 text_class=tizen align=left color=#fff color_class=button/circle/text_disabled"; + } +} + +collections { + base_scale: 1.3; + + group { "elm/button/base/circle"; + script { + public is_disabled; + } + parts { + image { "image.bg"; scale; + images.image: PATH_BUTTON_CIRCLE_BG COMP; + clip: "clipper.bg"; + desc { "default"; + fixed: 1 1; + min: ICON_LARGE_WH ICON_LARGE_WH; + align: 0.0 0.5; + rel1.relative: 0.0 0.5; + rel2.relative: 0.0 0.5; + image.normal: PATH_BUTTON_CIRCLE_BG; + } + desc { "text_visible"; + inherit: "default"; + min: ICON_SMALL_WH ICON_SMALL_WH; + } + } + rect { "clipper.bg"; scale; + desc { "default"; + rel.to: "image.bg"; + color_class: "button/circle/bg"; + } + desc { "pressed"; + inherit: "default"; + color_class: "button/circle/bg_pressed"; + } + desc { "disabled"; + inherit: "default"; + color_class: "button/circle/bg_disabled"; + } + } + swallow { "elm.swallow.content"; nomouse; + clip: "clipper.icon"; + desc { "default"; + rel.to: "image.bg"; + } + } + rect { "clipper.icon"; + desc { "default"; + rel.to: "elm.swallow.content"; + color_class: "button/circle/icon"; + } + desc { "pressed"; + inherit: "default"; + color_class: "button/circle/icon_pressed"; + } + desc { "disabled"; + inherit: "default"; + color_class: "button/circle/icon_disabled"; + } + } + spacer { "spacer.text.left"; scale; + desc { "default"; + fixed: 1 0; + align: 0.0 0.5; + rel1 { relative: 1.0 0.0; to_x: "image.bg"; } + rel2 { relative: 1.0 1.0; to_x: "image.bg"; } + } + desc { "text_visible"; + inherit: "default"; + min: TEXT_L 0; + } + } + textblock { "elm.text"; scale; + desc { "default"; + align: 0.0 0.5; + rel1 { relative: 1.0 0.0; to_x: "spacer.text.left"; to_y: "image.bg"; } + rel2 { relative: 1.0 1.0; to_y: "image.bg"; } + text { + min: 1 0; + ellipsis: -1; + style: "button_circle"; + } + } + desc { "pressed"; + inherit: "default"; + text.style: "button_circle_pressed"; + } + desc { "disabled"; + inherit: "default"; + text.style: "button_circle_disabled"; + } + } + } + programs { + program { + signal: "mouse,down,*"; + source: "*"; + script { + if (get_int(is_disabled) == 0) { + set_state(PART:"clipper.bg", "pressed", 0.0); + set_state(PART:"clipper.icon", "pressed", 0.0); + set_state(PART:"elm.text", "pressed", 0.0); + } + } + } + program { + signal: "mouse,up,*"; + source: "*"; + script { + if (get_int(is_disabled) == 0) { + set_state(PART:"clipper.bg", "default", 0.0); + set_state(PART:"clipper.icon", "default", 0.0); + set_state(PART:"elm.text", "default", 0.0); + } + } + } + program { + signal: "elm,state,enabled"; + source: "elm"; + script { + set_int(is_disabled, 0); + set_state(PART:"clipper.bg", "default", 0.0); + set_state(PART:"clipper.icon", "default", 0.0); + set_state(PART:"elm.text", "default", 0.0); + } + } + program { + signal: "elm,state,disabled"; + source: "elm"; + script { + set_int(is_disabled, 1); + set_state(PART:"clipper.bg", "disabled", 0.0); + set_state(PART:"clipper.icon", "disabled", 0.0); + set_state(PART:"elm.text", "disabled", 0.0); + } + } + program { + signal: "elm,state,text,visible"; + source: "elm"; + action: STATE_SET "text_visible"; + targets: "image.bg" "spacer.text.left"; + } + program { + signal: "elm,state,text,hidden"; + source: "elm"; + action: STATE_SET "default"; + targets: "image.bg" "spacer.text.left"; + } + program { + signal: "mouse,clicked,*"; + source: "*"; + script { + if (get_int(is_disabled) == 0) { + emit("elm,action,click", ""); + } + } + } + } + } + + group { "elm/genlist/item/buttons/default"; + data.item: "contents" "elm.swallow.content"; + data.item: "vi_effect" "on"; + data.item: "dim" "off"; + + parts { + swallow { "elm.swallow.content"; + desc { "default"; + fixed: 1 0; + min: 0 ITEM_H; + rel1.relative: 0.5 0.0; + rel2.relative: 0.5 1.0; + } + } + } + } +} diff --git a/lib-apps-common/res/apps-common/edje/apps-common-list.edc b/lib-apps-common/res/apps-common/edje/apps-common-list.edc new file mode 100644 index 0000000..64eaeb0 --- /dev/null +++ b/lib-apps-common/res/apps-common/edje/apps-common-list.edc @@ -0,0 +1,242 @@ +/* + * 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 "AppsCommonList.h" + +#define TRANSITION_GLIDE(duration) CUBIC_BEZIER (duration) 0.25 0.46 0.45 1.0 + +#define SELECTOR_T 22 + +#define TITLE_T 51 +#define TITLE_W 232 +#define TITLE_H 39 + +#define ICON_WH 98 +#define BUTTON_W 130 +#define BUTTON_H 110 + +#define TEXT_B 49 +#define TEXT_W 240 +#define TEXT_H 37 + +color_classes { + color_class { "layout/nocontents/title"; + color: 77 207 255 255; + } + color_class { "layout/nocontents/text"; + color: 255 255 255 255; + } +} + +styles { + style { + name: "no_contents_title"; + base: "font=Tizen:weight=Bold font_size=30 text_class=tizen align=center color=#fff color_class=layout/nocontents/title"; + } + style { + name: "no_contents_text"; + base: "font=Tizen:style=Regular font_size=28 text_class=tizen align=center color=#fff color_class=layout/nocontents/text"; + } +} + +collections { + base_scale: 1.3; + + group { "elm/layout/list/default"; + parts { + swallow { "elm.swallow.content"; } + swallow { "elm.swallow.more_option"; } + } + } + + group { "elm/layout/select_mode/default"; + inherit: "elm/layout/list/default"; + parts { + spacer { "spacer.top"; scale; + desc { "default"; + fixed: 0 1; + min: 0 SELECTOR_T; + align: 0.5 0.0; + rel2.relative: 1.0 0.0; + } + } + swallow { "elm.swallow.icon"; + clip: "clipper.icon"; + desc { "default"; hid; + fixed: 1 1; + align: 0.5 0.0; + rel1 { relative: 0.5 1.0; to_y: "spacer.top"; } + rel2 { relative: 0.5 1.0; to_y: "spacer.top"; } + map { on: 1; zoom.x: 0.0; zoom.y: 0.0; } + } + desc { "visible"; inherit; vis; + map { zoom.x: 1.0; zoom.y: 1.0; } + } + } + rect { "clipper.icon"; + desc { "default"; + rel.to: "elm.swallow.icon"; + color: 255 255 255 0; + } + desc { "visible"; inherit; + color: 255 255 255 255; + } + } + swallow { "elm.swallow.button"; + desc { "default"; hid; + fixed: 0 1; + align: 0.5 0.0; + rel1.relative: 0.0 1.0; + } + desc { "visible"; inherit; vis; + align: 0.5 1.0; + } + } + } + programs { + program { + signal: "select_mode,button,show"; + source: "*"; + action: STATE_SET "visible"; + targets: "elm.swallow.button" "elm.swallow.icon" "clipper.icon"; + transition: CUBIC_BEZIER 0.3 0.33 0 0.5 1.1; + } + program { + signal: "select_mode,button,hide"; + source: "*"; + action: STATE_SET "default"; + targets: "elm.swallow.button" "elm.swallow.icon" "clipper.icon"; + transition: CUBIC_BEZIER 0.3 0.33 0 0.5 1.1; + } + } + } + + group { "elm/layout/nocontents/default"; + parts { + image { "image.bg"; + images.image: PATH_NO_CONTENTS_BG COMP; + desc { "default"; + image.normal: PATH_NO_CONTENTS_BG; + color: 94 94 94 76; + } + } + spacer { "spacer.title.top"; scale; + desc { "default"; + fixed: 0 1; + min: 0 TITLE_T; + align: 0.5 0.0; + rel2.relative: 1.0 0.0; + } + } + textblock { "elm.text.title"; scale; + desc { "default"; + fixed: 1 1; + min: TITLE_W TITLE_H; + align: 0.5 0.0; + rel1 { relative: 0.5 1.0; to_y: "spacer.title.top"; } + rel2 { relative: 0.5 1.0; to_y: "spacer.title.top"; } + text.style: "no_contents_title"; + } + } + swallow { "elm.swallow.icon"; nomouse; scale; + desc { "default"; + fixed: 1 1; + min: ICON_WH ICON_WH; + rel1.relative: 0.5 0.5; + rel2.relative: 0.5 0.5; + } + } + textblock { "elm.text"; scale; + desc { "default"; + fixed: 1 1; + min: TEXT_W TEXT_H; + align: 0.5 1.0; + rel1 { relative: 0.5 0.0; to_y: "spacer.text.bottom"; } + rel2 { relative: 0.5 0.0; to_y: "spacer.text.bottom"; } + text.style: "no_contents_text"; + } + } + rect { "access.icon"; + desc { "default"; + rel1 { to_x: "elm.text"; to_y: "elm.swallow.icon"; } + rel2 { to: "elm.text"; } + color: 0 0 0 0; + } + } + spacer { "spacer.text.bottom"; scale; + desc { "default"; + fixed: 0 1; + min: 0 TEXT_B; + align: 0.5 1.0; + rel1.relative: 0.0 1.0; + } + } + } + } + + group { "elm/layout/nocontents_button/default"; + inherit: "elm/layout/nocontents/default"; + parts { + image { "image.press_bg"; + after: "image.bg"; + images.image: PATH_NO_CONTENTS_PRESS_BG COMP; + desc { "default"; + image.normal: PATH_NO_CONTENTS_PRESS_BG; + color: 255 255 255 0; + } + desc { "pressed_effect"; inherit; + rel1.relative: 0.05 0.05; + rel2.relative: 0.95 0.95; + color: 255 255 255 33; + } + desc { "pressed"; inherit; + color: 255 255 255 33; + } + } + swallow { "elm.swallow.icon"; + desc { "default"; + min: BUTTON_W BUTTON_H; + } + } + } + programs { + program { + signal: "mouse,down,*"; + source: "*"; + sequence { + action: STATE_SET "pressed_effect"; + target: "image.press_bg"; + + action: STATE_SET "pressed"; + target: "image.press_bg"; + transition: TRANSITION_GLIDE(0.3); + } + } + program { + signal: "mouse,up,*"; + source: "*"; + action: STATE_SET "default"; + target: "image.press_bg"; + transition: LINEAR 0.2; + } + program { + signal: "mouse,clicked,*"; + source: "*"; + action: SIGNAL_EMIT SIGNAL_CLICKED ""; + } + } + } +} diff --git a/lib-apps-common/res/apps-common/edje/apps-common-popup.edc b/lib-apps-common/res/apps-common/edje/apps-common-popup.edc new file mode 100644 index 0000000..248716f --- /dev/null +++ b/lib-apps-common/res/apps-common/edje/apps-common-popup.edc @@ -0,0 +1,58 @@ +/* + * Copyright 2017 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "AppsCommonPopup.h" + +collections { + base_scale: 1.3; + + group { LAYOUT_ICON_SUCCESS; + parts { + image { "image.icon"; + images.image: PATH_ICON_SUCCESS COMP; + clip: "clipper.icon"; + desc { "default"; + aspect: 1 1; + aspect_preference: VERTICAL; + image.normal: PATH_ICON_SUCCESS; + } + } + rect { "clipper.icon"; + desc { "default"; + fixed: 1 0; + rel.to: "image.icon"; + rel2.relative: 0.0 1.0; + } + desc { "full"; + inherit: "default"; + rel2.relative: 1.0 1.0; + } + } + } + programs { + program { + signal: "load"; + source: "*"; + sequence { + action: STATE_SET "full"; + target: "clipper.icon"; + in: 0.3 0; + transition: LINEAR 0.3; + } + } + } + } +} diff --git a/lib-apps-common/src/Ui/Accessibility.cpp b/lib-apps-common/src/Ui/Accessibility.cpp index 59a0629..8b15952 100644 --- a/lib-apps-common/src/Ui/Accessibility.cpp +++ b/lib-apps-common/src/Ui/Accessibility.cpp @@ -22,6 +22,8 @@ using namespace Ui; AccessChain::AccessChain(Evas_Object *obj) : m_Object(obj) { + elm_atspi_accessible_relationship_append(m_Object, + ELM_ATSPI_RELATION_FLOWS_FROM, m_Object); } void AccessChain::append(Evas_Object *obj) @@ -34,6 +36,12 @@ void AccessChain::append(Evas_Object *obj) m_Object = obj; } +void AccessChain::end() +{ + elm_atspi_accessible_relationship_append(m_Object, + ELM_ATSPI_RELATION_FLOWS_TO, m_Object); +} + Evas_Object *Ui::createPartAccessObject(Evas_Object *layout, const char *part) { Evas_Object *edje = elm_layout_edje_get(layout); @@ -41,19 +49,19 @@ Evas_Object *Ui::createPartAccessObject(Evas_Object *layout, const char *part) return elm_access_object_register(obj, layout); } -Evas_Object *Ui::createTextAccessObject(Evas_Object *layout, const char *part) +Evas_Object *Ui::createTextAccessObject(Evas_Object *layout, const char *part, const char *textPart) { Evas_Object *obj = createPartAccessObject(layout, part); elm_atspi_accessible_name_cb_set(obj, [](void *part, Evas_Object *obj) { Evas_Object *layout = elm_object_parent_widget_get(obj); const char *text = elm_object_part_text_get(layout, (const char *) part); return elm_entry_markup_to_utf8(text); - }, part); + }, textPart ? textPart : part); elm_atspi_accessible_reading_info_type_set(obj, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME); return obj; } char *Ui::getTranslatableAccessText(void *text, Evas_Object *obj) { - return strdup(_((const char *)text)); + return text ? strdup(_((const char *)text)) : nullptr; } diff --git a/lib-apps-common/src/Ui/Control.cpp b/lib-apps-common/src/Ui/Control.cpp index 9445173..ff9e73a 100644 --- a/lib-apps-common/src/Ui/Control.cpp +++ b/lib-apps-common/src/Ui/Control.cpp @@ -112,7 +112,7 @@ Control *Control::findParent(Evas_Object *object, const std::type_info &type) if (auto control = getControl(object, type)) { return control; } - object = elm_object_parent_widget_get(object); + eo_do(object, object = eo_parent_get()); } return nullptr; diff --git a/lib-apps-common/src/Ui/GenContainer.cpp b/lib-apps-common/src/Ui/GenContainer.cpp index 1957d26..623e9de 100644 --- a/lib-apps-common/src/Ui/GenContainer.cpp +++ b/lib-apps-common/src/Ui/GenContainer.cpp @@ -16,6 +16,7 @@ #include "Ui/GenContainer.h" #include "Ui/GenItem.h" +#include "Ui/GenGroupItem.h" using namespace Ui; @@ -31,6 +32,7 @@ struct Ui::GenContainerApi Evas_Object *(*create)(Evas_Object *parent); Elm_Object_Item *(*getFirstItem)(const Evas_Object *obj); Elm_Object_Item *(*getLastItem)(const Evas_Object *obj); + Elm_Object_Item *(*getItemAt)(const Elm_Genlist *obj, Evas_Coord x, Evas_Coord y); Eina_List *(*getRealizedItems)(const Evas_Object *obj); Updater updateItemFields; @@ -47,6 +49,7 @@ namespace elm_genlist_add, elm_genlist_first_item_get, elm_genlist_last_item_get, + [](const Elm_Genlist *obj, Evas_Coord x, Evas_Coord y) { return elm_genlist_at_xy_item_get(obj, x, y, nullptr); }, elm_genlist_realized_items_get, (Updater) elm_genlist_item_fields_update, @@ -59,6 +62,7 @@ namespace elm_gengrid_add, elm_gengrid_first_item_get, elm_gengrid_last_item_get, + [](const Elm_Genlist *obj, Evas_Coord x, Evas_Coord y) { return elm_gengrid_at_xy_item_get(obj, x, y, nullptr, nullptr); }, elm_gengrid_realized_items_get, (Updater) elm_gengrid_item_fields_update, @@ -102,6 +106,17 @@ GenItem *GenContainer::getLastItem() const return (GenItem *) elm_object_item_data_get(item); } +GenItem *GenContainer::getMiddleItem() const +{ + int x = 0, y = 0, w = 0, h = 0; + evas_object_geometry_get(getEvasObject(), &x, &y, &w, &h); + x += w / 2; + y += h / 2; + + Elm_Object_Item *item = m_Api->getItemAt(getEvasObject(), x, y); + return (GenItem *) elm_object_item_data_get(item); +} + GenIterator GenContainer::begin() const { return getFirstItem(); @@ -112,7 +127,7 @@ GenIterator GenContainer::end() const return nullptr; } -void GenContainer::insert(GenItem *item, GenItem *parent, GenItem *sibling, Position position) +void GenContainer::insert(GenItem *item, GenGroupItem *parent, GenItem *sibling, Position position) { if (!item) { return; diff --git a/lib-apps-common/src/Ui/GenGroupItem.cpp b/lib-apps-common/src/Ui/GenGroupItem.cpp index b7ac7c6..aaccb9e 100644 --- a/lib-apps-common/src/Ui/GenGroupItem.cpp +++ b/lib-apps-common/src/Ui/GenGroupItem.cpp @@ -164,7 +164,7 @@ void GenGroupItem::insertSubItem(GenItem *item, GenItem *sibling, Elm_Gen_Item_Class *GenGroupItem::getItemClass() const { - static Elm_Gen_Item_Class itc = createItemClass("group_index"); + static Elm_Gen_Item_Class itc = createItemClass("groupindex"); return &itc; } diff --git a/lib-apps-common/src/Ui/GenItem.cpp b/lib-apps-common/src/Ui/GenItem.cpp index ffc48e9..efa1d18 100644 --- a/lib-apps-common/src/Ui/GenItem.cpp +++ b/lib-apps-common/src/Ui/GenItem.cpp @@ -32,6 +32,7 @@ struct Ui::GenItemApi ScrollFunc bringIn; ScrollFunc show; void(*setSelected)(Elm_Object_Item *item, Eina_Bool selected); + void(*update)(Elm_Object_Item *item); UpdateFieldsFunc updateFields; }; @@ -44,6 +45,7 @@ namespace (ScrollFunc) elm_genlist_item_bring_in, (ScrollFunc) elm_genlist_item_show, elm_genlist_item_selected_set, + elm_genlist_item_update, (UpdateFieldsFunc) elm_genlist_item_fields_update }, { [](const Elm_Object_Item *item) -> Elm_Object_Item * { return nullptr; }, @@ -52,6 +54,7 @@ namespace (ScrollFunc) elm_gengrid_item_bring_in, (ScrollFunc) elm_gengrid_item_show, elm_gengrid_item_selected_set, + elm_gengrid_item_update, (UpdateFieldsFunc) elm_gengrid_item_fields_update } }; } @@ -155,6 +158,16 @@ void GenItem::focus(Elm_Genlist_Item_Scrollto_Type position, bool isAnimated) } } +void GenItem::select() +{ + m_Api->setSelected(m_Item, EINA_TRUE); +} + +void GenItem::update() +{ + m_Api->update(m_Item); +} + void GenItem::update(const char *parts, int partType) { m_Api->updateFields(m_Item, parts, partType); diff --git a/lib-apps-common/src/Ui/Genlist.cpp b/lib-apps-common/src/Ui/Genlist.cpp index b559321..e91dab3 100644 --- a/lib-apps-common/src/Ui/Genlist.cpp +++ b/lib-apps-common/src/Ui/Genlist.cpp @@ -16,6 +16,7 @@ #include "Ui/Genlist.h" #include "Ui/GenGroupItem.h" +#include "Ui/Window.h" using namespace Ui; @@ -30,6 +31,9 @@ void Genlist::onCreated() elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); elm_genlist_homogeneous_set(genlist, EINA_TRUE); + auto surface = findParent<Ui::Window>()->getCircleConformant(); + eext_circle_object_genlist_add(genlist, surface); + evas_object_smart_callback_add(genlist, "expanded", (Evas_Smart_Cb) &Genlist::onItemExpanded, this); evas_object_smart_callback_add(genlist, "contracted", diff --git a/lib-apps-common/src/Ui/Naviframe.cpp b/lib-apps-common/src/Ui/Naviframe.cpp index 4d1ae38..7cf7de5 100644 --- a/lib-apps-common/src/Ui/Naviframe.cpp +++ b/lib-apps-common/src/Ui/Naviframe.cpp @@ -30,7 +30,8 @@ namespace Ui Naviframe::Naviframe() : m_Job(nullptr), - m_IsFirstPagePrevButtonVisible(false) + m_IsFirstPagePrevButtonVisible(false), + m_PageInTransition(nullptr) { } @@ -72,7 +73,7 @@ bool Naviframe::onBackPressed() NaviframePage *Naviframe::addPage(View *view) { Elm_Object_Item *naviItem = elm_naviframe_item_push(getEvasObject(), nullptr, - nullptr, nullptr, view->create(getEvasObject()), nullptr); + nullptr, nullptr, view->create(getEvasObject()), "empty"); elm_naviframe_item_pop_cb_set(naviItem, makeCallback(&Naviframe::onItemPop), this); NaviframePage *page = new NaviframePage(naviItem); @@ -92,8 +93,10 @@ NaviframePage *Naviframe::addPage(View *view) bool Naviframe::removePage(NavigatorPage *page) { /* Postpone removal if transition in progress */ - if (getCurrentPage() == nullptr) { - m_PagesToRemove.push_back(page); + if (m_PageInTransition) { + if (m_PageInTransition != page) { + m_PagesToRemove.push_back(page); + } return true; } @@ -134,13 +137,16 @@ NaviframePage *Naviframe::getLastPage() const Eina_Bool Naviframe::onItemPop(Elm_Object_Item *item) { + m_PageInTransition = (NaviframePage *) elm_object_item_data_get(item); setCurrentPage(nullptr); return EINA_TRUE; } void Naviframe::onTransition(Evas_Object *obj, void *eventInfo) { + m_PageInTransition = nullptr; updateCurrentPage(); + for (auto &&page : m_PagesToRemove) { removeView(page->getView()); } diff --git a/lib-apps-common/src/Ui/NavigatorPage.cpp b/lib-apps-common/src/Ui/NavigatorPage.cpp index e720a48..da249eb 100644 --- a/lib-apps-common/src/Ui/NavigatorPage.cpp +++ b/lib-apps-common/src/Ui/NavigatorPage.cpp @@ -65,7 +65,9 @@ void NavigatorPage::setExpanded(bool isExpanded) void NavigatorPage::close() { - m_Navigator->removeView(m_View); + if (m_Navigator) { + m_Navigator->removeView(m_View); + } } void NavigatorPage::onNavigatorAttached(Navigator *navigator, View *view) diff --git a/lib-apps-common/src/Ui/PersistentItem.cpp b/lib-apps-common/src/Ui/PersistentItem.cpp new file mode 100644 index 0000000..b70f414 --- /dev/null +++ b/lib-apps-common/src/Ui/PersistentItem.cpp @@ -0,0 +1,62 @@ +/* + * 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 "Ui/PersistentItem.h" + +using namespace Ui; + +PersistentItem::PersistentItem(const char *persistentPart, GenContainer::Type type) + : GenItem(type), + m_Part(persistentPart), m_Content(nullptr) +{ +} + +PersistentItem::~PersistentItem() +{ + evas_object_unref(m_Content); +} + +Evas_Object *PersistentItem::getContent() const +{ + return m_Content; +} + +Evas_Object *PersistentItem::getContent(Evas_Object *parent, const char *part) +{ + if (strcmp(part, m_Part) == 0) { + return m_Content; + } + + return nullptr; +} + +void PersistentItem::onInserted() +{ + if (!m_Content) { + m_Content = createContent(getParent()->getEvasObject()); + evas_object_ref(m_Content); + } +} + +void PersistentItem::onRealized() +{ + evas_object_show(m_Content); +} + +void PersistentItem::onUnrealized() +{ + evas_object_hide(m_Content); +} diff --git a/lib-apps-common/src/Ui/Popup.cpp b/lib-apps-common/src/Ui/Popup.cpp index e369863..bea2a24 100644 --- a/lib-apps-common/src/Ui/Popup.cpp +++ b/lib-apps-common/src/Ui/Popup.cpp @@ -27,7 +27,7 @@ using namespace Ui; Popup::Popup() - : m_ButtonCount(0), m_View(nullptr), m_Window(nullptr) + : m_ButtonCount(0), m_View(nullptr), m_Window(nullptr), m_Layout(nullptr) { } @@ -54,17 +54,17 @@ Popup *Popup::create(Evas_Object *parent, const char *title, void Popup::setTitle(const char *title) { - elm_object_translatable_part_text_set(getEvasObject(), "title,text", title); + elm_object_translatable_part_text_set(m_Layout, "elm.text.title", title); } void Popup::setText(const char *text) { - elm_object_translatable_part_text_set(getEvasObject(), "elm.text", text); + elm_object_translatable_part_text_set(m_Layout, "elm.text", text); } void Popup::setContent(Evas_Object *content) { - elm_object_part_content_set(getEvasObject(), "elm.swallow.content", content); + elm_object_part_content_set(m_Layout, "elm.swallow.content", content); } void Popup::setCancelCallback(ButtonCallback callback) @@ -80,17 +80,10 @@ Evas_Object *Popup::addButton(const char *text, ButtonCallback callback) return nullptr; } - Evas_Object *button = elm_button_add(getEvasObject()); - elm_object_style_set(button, "bottom"); + Evas_Object *button = createButton("bottom", std::move(callback)); elm_object_translatable_text_set(button, text); elm_object_part_content_set(getEvasObject(), part, button); - evas_object_data_set(button, BUTTON_DATA_KEY, new ButtonCallback(std::move(callback))); - evas_object_event_callback_add(button, EVAS_CALLBACK_DEL, - makeCallback(&Popup::onButtonDestroy), this); - evas_object_smart_callback_add(button, "clicked", - makeCallback(&Popup::onButtonPressed), this); - ++m_ButtonCount; return button; } @@ -121,6 +114,7 @@ Evas_Object *Popup::onCreate(Evas_Object *parent) } Evas_Object *popup = elm_popup_add(parent); + elm_object_style_set(popup, "circle"); elm_popup_align_set(popup, ELM_NOTIFY_ALIGN_FILL, 1.0); evas_object_smart_callback_add(popup, "dismissed", makeCallback(&Popup::onDismissed), this); @@ -129,9 +123,27 @@ Evas_Object *Popup::onCreate(Evas_Object *parent) eext_object_event_callback_add(popup, EEXT_CALLBACK_BACK, makeCallback(&Popup::onBackPressed), this); + m_Layout = elm_layout_add(popup); + elm_layout_theme_set(m_Layout, "layout", "popup", "content/circle/buttons1"); + elm_object_content_set(popup, m_Layout); + return popup; } +Evas_Object *Popup::createButton(const char *style, ButtonCallback callback) +{ + Evas_Object *button = elm_button_add(getEvasObject()); + elm_object_style_set(button, style); + + evas_object_data_set(button, BUTTON_DATA_KEY, new ButtonCallback(std::move(callback))); + evas_object_event_callback_add(button, EVAS_CALLBACK_DEL, + makeCallback(&Popup::onButtonDestroy), this); + evas_object_smart_callback_add(button, "clicked", + makeCallback(&Popup::onButtonPressed), this); + + return button; +} + void Popup::onCanceled() { if (!m_OnCanceled || m_OnCanceled()) { diff --git a/lib-apps-common/src/Ui/Toast.cpp b/lib-apps-common/src/Ui/Toast.cpp index c193c8b..188b01a 100644 --- a/lib-apps-common/src/Ui/Toast.cpp +++ b/lib-apps-common/src/Ui/Toast.cpp @@ -30,6 +30,13 @@ void Toast::setIcon(Evas_Object *icon) elm_layout_signal_emit(getEvasObject(), "elm,state,tizen,toast,icon,show", "elm"); } +void Toast::setIcon(const char *path) +{ + Evas_Object *image = elm_image_add(getEvasObject()); + elm_image_file_set(image, path, nullptr); + setIcon(image); +} + Evas_Object *Toast::onCreate(Evas_Object *parent) { Evas_Object *popup = Popup::onCreate(findParent<Window>(parent)->getEvasObject()); diff --git a/lib-apps-common/src/Ux/ActionButtons.cpp b/lib-apps-common/src/Ux/ActionButtons.cpp new file mode 100644 index 0000000..35796ee --- /dev/null +++ b/lib-apps-common/src/Ux/ActionButtons.cpp @@ -0,0 +1,76 @@ +/* + * 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 "Ux/ActionButtons.h" +#include "App/Path.h" + +#define BUTTON_LR 24 + +using namespace Ux; + +Evas_Object *ActionButtons::addButton(const char *text, const char *iconPath, ButtonCallback callback) +{ + Evas_Object *button = elm_button_add(getEvasObject()); + elm_object_style_set(button, "circle"); + elm_object_translatable_text_set(button, text); + + auto buttonCallback = new ButtonCallback(std::move(callback)); + evas_object_event_callback_add(button, EVAS_CALLBACK_DEL, + (Evas_Object_Event_Cb) &ActionButtons::onButtonDestroy, buttonCallback); + evas_object_smart_callback_add(button, "clicked", + (Evas_Smart_Cb) &ActionButtons::onButtonPressed, buttonCallback); + + Evas_Object *icon = elm_image_add(button); + elm_image_file_set(icon, App::getResourcePath(iconPath).c_str(), nullptr); + elm_object_content_set(button, icon); + + evas_object_size_hint_align_set(button, 0.0, EVAS_HINT_FILL); + elm_box_pack_end(getEvasObject(), button); + evas_object_show(button); + return button; +} + +void ActionButtons::setEnabled(bool isEnabled) +{ + Eina_List *list = elm_box_children_get(getEvasObject()); + Eina_List *node = nullptr; + void *button = nullptr; + + EINA_LIST_FOREACH(list, node, button) { + elm_object_disabled_set((Evas_Object *) button, !isEnabled); + } + eina_list_free(list); +} + +Evas_Object *ActionButtons::onCreate(Evas_Object *parent) +{ + Evas_Object *box = elm_box_add(parent); + elm_box_horizontal_set(box, EINA_TRUE); + elm_box_padding_set(box, BUTTON_LR, 0); + return box; +} + +void ActionButtons::onButtonPressed(ButtonCallback *callback, Evas_Object *button, void *eventInfo) +{ + if (*callback) { + (*callback)(); + } +} + +void ActionButtons::onButtonDestroy(ButtonCallback *callback, Evas *e, Evas_Object *button, void *eventInfo) +{ + delete callback; +} diff --git a/lib-apps-common/src/Ux/ActionButtonsItem.cpp b/lib-apps-common/src/Ux/ActionButtonsItem.cpp new file mode 100644 index 0000000..8fcd90c --- /dev/null +++ b/lib-apps-common/src/Ux/ActionButtonsItem.cpp @@ -0,0 +1,43 @@ +/* + * 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 "Ux/ActionButtonsItem.h" + +using namespace Ux; + +ActionButtons *ActionButtonsItem::getControl() const +{ + return Ui::Control::getControl<ActionButtons>(getContent()); +} + +Elm_Gen_Item_Class *ActionButtonsItem::getItemClass() const +{ + static Elm_Gen_Item_Class itc = createItemClass("buttons"); + return &itc; +} + +Evas_Object *ActionButtonsItem::createContent(Evas_Object *parent) +{ + auto buttons = new ActionButtons(); + return buttons->create(parent); +} + +void ActionButtonsItem::onInserted() +{ + PersistentItem::onInserted(); + elm_genlist_item_select_mode_set(getObjectItem(), ELM_OBJECT_SELECT_MODE_NONE); + elm_atspi_accessible_can_highlight_set(getObjectItem(), EINA_FALSE); +} diff --git a/lib-apps-common/src/Ux/SuccessPopup.cpp b/lib-apps-common/src/Ux/SuccessPopup.cpp new file mode 100644 index 0000000..9448c8b --- /dev/null +++ b/lib-apps-common/src/Ux/SuccessPopup.cpp @@ -0,0 +1,28 @@ +/* + * 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 "Ux/SuccessPopup.h" +#include "App/Path.h" +#include "AppsCommonPopup.h" + +using namespace Ux; + +void SuccessPopup::onCreated() +{ + Evas_Object *icon = elm_layout_add(getEvasObject()); + elm_layout_file_set(icon, App::getResourcePath(PATH_APPS_COMMON_POPUP).c_str(), LAYOUT_ICON_SUCCESS); + setIcon(icon); +} |