From b5cd516dea99f322542ff3c49c4ebb25aa0358e9 Mon Sep 17 00:00:00 2001 From: Igor Nazarov Date: Mon, 23 Oct 2017 14:06:24 +0300 Subject: TizenRefApp-9663 [Call Setting] Implement as_eo() and as_ao() functions in ucl Change-Id: Ib29aab2b8567ebb84b355bdc40e588677d77f423 --- .../presenters/misc/SelectModePresenter.cpp | 4 +- ucl/include/ucl/gui/Atspi.h | 51 +++++++++-------- ucl/include/ucl/gui/Atspi.hpp | 8 +-- ucl/include/ucl/gui/ElmWidget.h | 14 +++++ ucl/include/ucl/gui/ElmWidget.hpp | 10 ++++ ucl/include/ucl/gui/Widget.h | 66 +++++++++++++--------- ucl/include/ucl/gui/Widget.hpp | 20 +++---- ucl/source/gui/Widget.cpp | 8 +-- ucl/source/mvp/ListItemPresenter.cpp | 7 +-- ucl/source/mvp/ListPresenter.cpp | 2 +- 10 files changed, 111 insertions(+), 79 deletions(-) diff --git a/call-setting/presenters/misc/SelectModePresenter.cpp b/call-setting/presenters/misc/SelectModePresenter.cpp index 00320a1..10d0835 100644 --- a/call-setting/presenters/misc/SelectModePresenter.cpp +++ b/call-setting/presenters/misc/SelectModePresenter.cpp @@ -349,7 +349,7 @@ namespace call_setting { void SelectModePresenter::onSelectAll( Evas_Object *obj, void *eventInfo) { - if (m_popup && (m_popup->getEo() == obj)) { + if (as_eo(m_popup) == obj) { dismissPopup(); dispatchEvent(Event::SELECT_ALL); } @@ -358,7 +358,7 @@ namespace call_setting { void SelectModePresenter::onDeselectAll( Evas_Object *obj, void *eventInfo) { - if (m_popup && (m_popup->getEo() == obj)) { + if (as_eo(m_popup) == obj) { dismissPopup(); dispatchEvent(Event::DESELECT_ALL); } diff --git a/ucl/include/ucl/gui/Atspi.h b/ucl/include/ucl/gui/Atspi.h index 2657806..252a990 100644 --- a/ucl/include/ucl/gui/Atspi.h +++ b/ucl/include/ucl/gui/Atspi.h @@ -31,28 +31,31 @@ namespace ucl { class Atspi final : private NonCopyable { public: /** - * @brief Constructor - * @param[in] eo Underlying Access object of the Atspi + * @brief Gets the underlying Access object + * @param[in] atspi Reference to target atspi + * @return Pointer to the underlying Access object */ - explicit Atspi(Elm_Interface_Atspi_Accessible *ao); + friend Elm_Interface_Atspi_Accessible *as_ao(Atspi &atspi); /** - * @brief Destructor - * @details Unregisters all Access object callbacks + * @brief Gets the underlying constant Access object + * @param[in] atspi Constant reference to target atspi + * @return Pointer to the underlying constant Access object */ - ~Atspi(); + friend const Elm_Interface_Atspi_Accessible *as_ao(const Atspi &atspi); + public: /** - * @brief Gets Access object pointer - * @return Pointer to the Access object + * @brief Constructor + * @param[in] eo Underlying Access object of the Atspi */ - Elm_Interface_Atspi_Accessible *getAo(); + explicit Atspi(Elm_Interface_Atspi_Accessible *ao); /** - * @brief Gets pointer to constant Access object - * @return Pointer to the constant Access object + * @brief Destructor + * @details Unregisters all Access object callbacks */ - const Elm_Interface_Atspi_Accessible *getAo() const; + ~Atspi(); /** * @brief Implicitly casts to the underlying Access object @@ -196,6 +199,9 @@ namespace ucl { void delGestureHandler(const AtspiGestureHandler &handler); private: + Elm_Interface_Atspi_Accessible *getAo(); + const Elm_Interface_Atspi_Accessible *getAo() const; + void registerGestureCb(); void registerNameCb(); void registerDescriptionCb(); @@ -225,20 +231,15 @@ namespace ucl { // Non-member functions // /** - * @brief Compares equals underlying Access objects of target objects - * @param[in] lhs Left hand side operand - * @param[in] rhs Right hand side operand - * @return true - if equal, false - not equal - */ - bool operator==(const Atspi &lhs, const Atspi &rhs); - - /** - * @brief Compares unequals underlying Access objects of target objects - * @param[in] lhs Left hand side operand - * @param[in] rhs Right hand side operand - * @return true - if not equal, false - equal + * @brief Gets Access object from pointed object + * @param[in] ptr Target object pointer + * @return Pointer to Access object or NULL */ - bool operator!=(const Atspi &lhs, const Atspi &rhs); + template + inline auto as_ao(const T &ptr) -> decltype(as_ao(*ptr)) + { + return (ptr ? as_ao(*ptr) : nullptr); + } } #include "Atspi.hpp" diff --git a/ucl/include/ucl/gui/Atspi.hpp b/ucl/include/ucl/gui/Atspi.hpp index fcf1004..3d535fa 100644 --- a/ucl/include/ucl/gui/Atspi.hpp +++ b/ucl/include/ucl/gui/Atspi.hpp @@ -240,13 +240,13 @@ namespace ucl { // Non-member functions // - inline bool operator==(const Atspi &lhs, const Atspi &rhs) + inline Elm_Interface_Atspi_Accessible *as_ao(Atspi &atspi) { - return (lhs.getAo() == rhs.getAo()); + return atspi.m_ao; } - inline bool operator!=(const Atspi &lhs, const Atspi &rhs) + inline const Elm_Interface_Atspi_Accessible *as_ao(const Atspi &atspi) { - return (lhs.getAo() != rhs.getAo()); + return atspi.m_ao; } } diff --git a/ucl/include/ucl/gui/ElmWidget.h b/ucl/include/ucl/gui/ElmWidget.h index 4c4b547..a0e2d60 100644 --- a/ucl/include/ucl/gui/ElmWidget.h +++ b/ucl/include/ucl/gui/ElmWidget.h @@ -114,6 +114,20 @@ namespace ucl { // Non-member functions // + /** + * @brief Gets corresponding Access object + * @param[in] widget Reference to target widget + * @return Pointer to the corresponding Access object + */ + Elm_Interface_Atspi_Accessible *as_ao(ElmWidget &widget); + + /** + * @brief Gets corresponding constant Access object + * @param[in] widget Constant reference to target widget + * @return Pointer to the corresponding constant Access object + */ + const Elm_Interface_Atspi_Accessible *as_ao(const ElmWidget &widget); + /** * @brief Sets widget to enabled state * @details This is equivalent to: widget.setEnabled(true); diff --git a/ucl/include/ucl/gui/ElmWidget.hpp b/ucl/include/ucl/gui/ElmWidget.hpp index 2151cfd..6fe586d 100644 --- a/ucl/include/ucl/gui/ElmWidget.hpp +++ b/ucl/include/ucl/gui/ElmWidget.hpp @@ -73,6 +73,16 @@ namespace ucl { // Non-member functions // + inline Elm_Interface_Atspi_Accessible *as_ao(ElmWidget &widget) + { + return as_ao(widget.getAtspi()); + } + + inline const Elm_Interface_Atspi_Accessible *as_ao(const ElmWidget &widget) + { + return as_ao(widget.getAtspi()); + } + inline void enable(ElmWidget &widget) { widget.setEnabled(true); diff --git a/ucl/include/ucl/gui/Widget.h b/ucl/include/ucl/gui/Widget.h index 0232e36..f2f9620 100644 --- a/ucl/include/ucl/gui/Widget.h +++ b/ucl/include/ucl/gui/Widget.h @@ -45,6 +45,21 @@ namespace ucl { */ static constexpr auto FILL = EVAS_HINT_FILL; + public: + /** + * @brief Gets the underlying Evas object + * @param[in] widget Reference to target widget + * @return Pointer to the underlying Evas object + */ + friend Evas_Object *as_eo(Widget &widget); + + /** + * @brief Gets the underlying constant Evas object + * @param[in] widget Constant reference to target widget + * @return Pointer to the underlying constant Evas object + */ + friend const Evas_Object *as_eo(const Widget &widget); + public: /** * @brief Constructor @@ -106,18 +121,6 @@ namespace ucl { */ void setIsOwner(bool value); - /** - * @brief Gets the underlying Evas object - * @return Pointer to the underlying Evas object - */ - Evas_Object *getEo(); - - /** - * @brief Gets the underlying Evas object (constant version) - * @return Pointer to the constant underlying Evas object - */ - const Evas_Object *getEo() const; - /** * @brief Implicitly casts to the underlying Evas object * @return Pointer to the underlying Evas object @@ -367,6 +370,18 @@ namespace ucl { bool isFocused() const; protected: + /** + * @brief Gets the underlying Evas object + * @return Pointer to the underlying Evas object + */ + Evas_Object *getEo(); + + /** + * @brief Gets the underlying Evas object (constant version) + * @return Pointer to the constant underlying Evas object + */ + const Evas_Object *getEo() const; + /** * @brief Actually sets key-input focus state to the widget * @details May be overriden in subclasses to change behaviour @@ -432,6 +447,17 @@ namespace ucl { // Non-member functions // + /** + * @brief Gets Evas object from pointed object + * @param[in] ptr Target object pointer + * @return Pointer to Evas object or NULL + */ + template + inline auto as_eo(const T &ptr) -> decltype(as_eo(*ptr)) + { + return (ptr ? as_eo(*ptr) : nullptr); + } + /** * @brief Gets position of the widget * @param[in] widget Reference to target widget @@ -512,22 +538,6 @@ namespace ucl { * @param[in] widget Reference to target widget */ void expandAndFill(Widget &widget); - - /** - * @brief Compares equals underlying Evas objects of target widgets - * @param[in] lhs Left hand side operand - * @param[in] rhs Right hand side operand - * @return true - if equal, false - not equal - */ - bool operator==(const Widget &lhs, const Widget &rhs); - - /** - * @brief Compares unequals underlying Evas objects of target widgets - * @param[in] lhs Left hand side operand - * @param[in] rhs Right hand side operand - * @return true - if not equal, false - equal - */ - bool operator!=(const Widget &lhs, const Widget &rhs); } #include "Widget.hpp" diff --git a/ucl/include/ucl/gui/Widget.hpp b/ucl/include/ucl/gui/Widget.hpp index d8c35c5..9ff8cd6 100644 --- a/ucl/include/ucl/gui/Widget.hpp +++ b/ucl/include/ucl/gui/Widget.hpp @@ -206,6 +206,16 @@ namespace ucl { // Non-member functions // + inline Evas_Object *as_eo(Widget &widget) + { + return widget.m_eo; + } + + inline const Evas_Object *as_eo(const Widget &widget) + { + return widget.m_eo; + } + inline void getPosition(const Widget &widget, int *x, int *y) { widget.getGeometry(x, y, nullptr, nullptr); @@ -261,14 +271,4 @@ namespace ucl { expand(widget); fill(widget); } - - inline bool operator==(const Widget &lhs, const Widget &rhs) - { - return (lhs.getEo() == rhs.getEo()); - } - - inline bool operator!=(const Widget &lhs, const Widget &rhs) - { - return (lhs.getEo() != rhs.getEo()); - } } diff --git a/ucl/source/gui/Widget.cpp b/ucl/source/gui/Widget.cpp index bc7d6e8..7da5d29 100644 --- a/ucl/source/gui/Widget.cpp +++ b/ucl/source/gui/Widget.cpp @@ -35,7 +35,7 @@ namespace ucl { m_handler(std::move(handler)), m_type(static_cast(event)) { - evas_object_event_callback_add(m_widget.getEo(), + evas_object_event_callback_add(as_eo(m_widget), m_type, event_cb, this); } @@ -46,17 +46,17 @@ namespace ucl { m_handler(std::move(handler)), m_type(impl::WIDGET_EVENT_SMART) { - evas_object_smart_callback_add(m_widget.getEo(), + evas_object_smart_callback_add(as_eo(m_widget), m_smartEvent.c_str(), smart_cb, this); } ~EventProxy() { if (m_type == impl::WIDGET_EVENT_SMART) { - evas_object_smart_callback_del_full(m_widget.getEo(), + evas_object_smart_callback_del_full(as_eo(m_widget), m_smartEvent.c_str(), smart_cb, this); } else { - evas_object_event_callback_del_full(m_widget.getEo(), + evas_object_event_callback_del_full(as_eo(m_widget), m_type, event_cb, this); } } diff --git a/ucl/source/mvp/ListItemPresenter.cpp b/ucl/source/mvp/ListItemPresenter.cpp index a2087d7..42ded4f 100644 --- a/ucl/source/mvp/ListItemPresenter.cpp +++ b/ucl/source/mvp/ListItemPresenter.cpp @@ -69,7 +69,7 @@ namespace ucl { if (const auto widget = item.getItemPartContent( EdjePart(part), *item.m_parent)) { widget->setIsOwner(false); - return widget->getEo(); + return as_eo(*widget); } return nullptr; }; @@ -410,10 +410,7 @@ namespace ucl { Elm_Interface_Atspi_Accessible *ListItemPresenter::getItemAo() { - if (const auto atspi = getItemAtspi()) { - return atspi->getAo(); - } - return nullptr; + return as_ao(getItemAtspi()); } Result ListItemPresenter::updateItemStyle(const ElmStyle newItemStyle) diff --git a/ucl/source/mvp/ListPresenter.cpp b/ucl/source/mvp/ListPresenter.cpp index 407cb5c..0f41987 100644 --- a/ucl/source/mvp/ListPresenter.cpp +++ b/ucl/source/mvp/ListPresenter.cpp @@ -262,7 +262,7 @@ namespace ucl { if (!relItem) { LOG_RETURN(RES_FAIL, "relItem is NULL!"); } - if (relItem.getWidget() != m_genlist->getEo()) { + if (relItem.getWidget() != as_eo(*m_genlist)) { LOG_RETURN(RES_FAIL, "relItem has wrong genlist!"); } return insert(itemPresenter, parent, -- cgit v1.2.3 From 15b57ec63e501e2b583b4e05ffcfbda1dd2db9f0 Mon Sep 17 00:00:00 2001 From: Igor Nazarov Date: Mon, 23 Oct 2017 16:05:32 +0300 Subject: TizenRefApp-9664 [Call Setting] Replace Evas_Object with Widget for function parameters Change-Id: Icb52dc57e7f8aebc0beef9c869837ac74cc3b730 --- call-setting/presenters/pages/base/Page.cpp | 7 +- call-setting/presenters/pages/base/Page.h | 2 +- call-setting/view/PageContent.cpp | 6 +- call-setting/view/PageContent.h | 2 +- ucl/include/ucl/gui/EdjeWidget.h | 8 +- ucl/include/ucl/gui/EdjeWidget.hpp | 8 +- ucl/include/ucl/gui/Naviframe.h | 93 +++++++++++++++-------- ucl/include/ucl/gui/Naviframe.hpp | 110 +++++++++++++++++++--------- ucl/include/ucl/gui/WidgetItem.h | 8 +- ucl/include/ucl/gui/WidgetItem.hpp | 8 +- ucl/source/gui/Window.cpp | 4 +- 11 files changed, 167 insertions(+), 89 deletions(-) diff --git a/call-setting/presenters/pages/base/Page.cpp b/call-setting/presenters/pages/base/Page.cpp index a914426..135b8f9 100644 --- a/call-setting/presenters/pages/base/Page.cpp +++ b/call-setting/presenters/pages/base/Page.cpp @@ -172,7 +172,7 @@ namespace call_setting { } } - void Page::createCircleObject(Evas_Object *const owner, + void Page::createCircleObject(ElmWidget &owner, const Elm_Scroller_Policy hPolicy, const Elm_Scroller_Policy vPolicy) { @@ -186,10 +186,11 @@ namespace call_setting { auto surface = eext_circle_surface_layout_add(*layout); - const auto type = evas_object_type_get(owner); + const auto type = evas_object_type_get(as_eo(owner)); if (ucl::strCmpSafe(type, impl::GENLIST_TYPE) == 0) { - m_circleObject = eext_circle_object_genlist_add(owner, surface); + m_circleObject = eext_circle_object_genlist_add(as_eo(owner), + surface); eext_circle_object_genlist_scroller_policy_set( m_circleObject, hPolicy, vPolicy); } else { diff --git a/call-setting/presenters/pages/base/Page.h b/call-setting/presenters/pages/base/Page.h index 521a86d..b694a33 100644 --- a/call-setting/presenters/pages/base/Page.h +++ b/call-setting/presenters/pages/base/Page.h @@ -68,7 +68,7 @@ namespace call_setting { ucl::NaviItem getItem(); PageContent &getContent(); - void createCircleObject(Evas_Object *owner, + void createCircleObject(ucl::ElmWidget &owner, Elm_Scroller_Policy hPolicy = ELM_SCROLLER_POLICY_OFF, Elm_Scroller_Policy vPolicy = ELM_SCROLLER_POLICY_AUTO); void updateRotaryActiveState(); diff --git a/call-setting/view/PageContent.cpp b/call-setting/view/PageContent.cpp index 19b90bb..c1d3007 100644 --- a/call-setting/view/PageContent.cpp +++ b/call-setting/view/PageContent.cpp @@ -129,12 +129,12 @@ namespace call_setting { } } - Result PageContent::set(Evas_Object *const eo, const Part part) + Result PageContent::set(Widget &widget, const Part part) { return doWithPart(part, - [eo](Layout &layout, const EdjePart part) + [&widget](Layout &layout, const EdjePart part) { - layout.setContent(eo, part); + layout.setContent(widget, part); }); } diff --git a/call-setting/view/PageContent.h b/call-setting/view/PageContent.h index cf3b518..274e1e2 100644 --- a/call-setting/view/PageContent.h +++ b/call-setting/view/PageContent.h @@ -53,7 +53,7 @@ namespace call_setting { }; public: - ucl::Result set(Evas_Object *eo, Part part = Part::DEFAULT); + ucl::Result set(ucl::Widget &widget, Part part = Part::DEFAULT); Evas_Object *unset(Part part = Part::DEFAULT); Evas_Object *get(Part part = Part::DEFAULT) const; diff --git a/ucl/include/ucl/gui/EdjeWidget.h b/ucl/include/ucl/gui/EdjeWidget.h index d195a07..da32501 100644 --- a/ucl/include/ucl/gui/EdjeWidget.h +++ b/ucl/include/ucl/gui/EdjeWidget.h @@ -56,16 +56,16 @@ namespace ucl { /** * @brief Sets content to default part - * @param[in] content Content Evas object + * @param[in] content Content widget */ - void setContent(Evas_Object *content); + void setContent(Widget &content); /** * @brief Sets content to specific part - * @param[in] content Content Evas object + * @param[in] content Content widget * @param[in] part Destination Edje part */ - void setContent(Evas_Object *content, EdjePart part); + void setContent(Widget &content, EdjePart part); /** * @brief Unsets content from default part diff --git a/ucl/include/ucl/gui/EdjeWidget.hpp b/ucl/include/ucl/gui/EdjeWidget.hpp index e08841f..763808e 100644 --- a/ucl/include/ucl/gui/EdjeWidget.hpp +++ b/ucl/include/ucl/gui/EdjeWidget.hpp @@ -32,15 +32,15 @@ namespace ucl { return elm_object_part_text_get(getEo(), part.name); } - inline void EdjeWidget::setContent(Evas_Object *const content) + inline void EdjeWidget::setContent(Widget &content) { - elm_object_content_set(getEo(), content); + elm_object_content_set(getEo(), as_eo(content)); } - inline void EdjeWidget::setContent(Evas_Object *const content, + inline void EdjeWidget::setContent(Widget &content, const EdjePart part) { - elm_object_part_content_set(getEo(), part.name, content); + elm_object_part_content_set(getEo(), part.name, as_eo(content)); } inline Evas_Object *EdjeWidget::unsetContent() diff --git a/ucl/include/ucl/gui/Naviframe.h b/ucl/include/ucl/gui/Naviframe.h index 4699474..cc7a94f 100644 --- a/ucl/include/ucl/gui/Naviframe.h +++ b/ucl/include/ucl/gui/Naviframe.h @@ -136,103 +136,126 @@ namespace ucl { /** * @brief Pushes new item to the naviframe stack * @param[in] title Translatable item title (may be empty) - * @param[in] backBtn Back button Evas object (may be NULL) - * @param[in] moreBtn More button Evas object (may be NULL) - * @param[in] content Content of the item (may be NULL) + * @param[in] content Content of the item + * @param[in] backBtn Back button widget pointer (may be NULL) + * @param[in] moreBtn More button widget pointer (may be NULL) * @param[in] style Elm style of the item (optional) * @return New item */ - NaviItem push(const TString &title, - Evas_Object *backBtn, Evas_Object *moreBtn, - Evas_Object *content, ElmStyle style = nullptr); + NaviItem push(const TString &title, Widget &content, + Widget *backBtn, Widget *moreBtn, + ElmStyle style = nullptr); /** * @brief Pushes new item to the naviframe stack * @param[in] title Translatable item title (may be empty) - * @param[in] content Content of the item (may be NULL) + * @param[in] content Content of the item * @param[in] style Elm style of the item (optional) * @return New item */ - NaviItem push(const TString &title, - Evas_Object *content, ElmStyle style = nullptr); + NaviItem push(const TString &title, Widget &content, + ElmStyle style = nullptr); + + /** + * @brief Pushes new item to the naviframe stack + * @param[in] content Content of the item + * @param[in] style Elm style of the item (optional) + * @return New item + */ + NaviItem push(Widget &content, ElmStyle style = nullptr); /** * @brief Pushes new item to the naviframe stack - * @param[in] content Content of the item (may be NULL) * @param[in] style Elm style of the item (optional) * @return New item */ - NaviItem push(Evas_Object *content, ElmStyle style = nullptr); + NaviItem push(ElmStyle style = nullptr); /** * @brief Inserts new item to the naviframe stack after specific item * @param[in] after Item after which future item will be inserted * @param[in] title Translatable item title (may be empty) - * @param[in] backBtn Back button Evas object (may be NULL) - * @param[in] moreBtn More button Evas object (may be NULL) - * @param[in] content Content of the item (may be NULL) + * @param[in] content Content of the item + * @param[in] backBtn Back button widget pointer (may be NULL) + * @param[in] moreBtn More button widget pointer (may be NULL) * @param[in] style Elm style of the item (optional) * @return New item */ NaviItem insertAfter(NaviItem after, const TString &title, - Evas_Object *backBtn, Evas_Object *moreBtn, - Evas_Object *content, ElmStyle style = nullptr); + Widget &content, Widget *backBtn, Widget *moreBtn, + ElmStyle style = nullptr); /** * @brief Inserts new item to the naviframe stack after specific item * @param[in] after Item after which future item will be inserted * @param[in] title Translatable item title (may be empty) - * @param[in] content Content of the item (may be NULL) + * @param[in] content Content of the item * @param[in] style Elm style of the item (optional) * @return New item */ NaviItem insertAfter(NaviItem after, const TString &title, - Evas_Object *content, ElmStyle style = nullptr); + Widget &content, ElmStyle style = nullptr); /** * @brief Inserts new item to the naviframe stack after specific item * @param[in] after Item after which future item will be inserted - * @param[in] content Content of the item (may be NULL) + * @param[in] content Content of the item * @param[in] style Elm style of the item (optional) * @return New item */ NaviItem insertAfter(NaviItem after, - Evas_Object *content, ElmStyle style = nullptr); + Widget &content, ElmStyle style = nullptr); + + /** + * @brief Inserts new item to the naviframe stack after specific item + * @param[in] after Item after which future item will be inserted + * @param[in] style Elm style of the item (optional) + * @return New item + */ + NaviItem insertAfter(NaviItem after, ElmStyle style = nullptr); /** * @brief Inserts new item to the naviframe stack before specific item * @param[in] before Item before which future item will be inserted * @param[in] title Translatable item title (may be empty) - * @param[in] backBtn Back button Evas object (may be NULL) - * @param[in] moreBtn More button Evas object (may be NULL) - * @param[in] content Content of the item (may be NULL) + * @param[in] content Content of the item + * @param[in] backBtn Back button widget pointer (may be NULL) + * @param[in] moreBtn More button widget pointer (may be NULL) * @param[in] style Elm style of the item (optional) * @return New item */ NaviItem insertBefore(NaviItem before, const TString &title, - Evas_Object *backBtn, Evas_Object *moreBtn, - Evas_Object *content, ElmStyle style = nullptr); + Widget &content, Widget *backBtn, Widget *moreBtn, + ElmStyle style = nullptr); /** * @brief Inserts new item to the naviframe stack before specific item * @param[in] before Item before which future item will be inserted * @param[in] title Translatable item title (may be empty) - * @param[in] content Content of the item (may be NULL) + * @param[in] content Content of the item * @param[in] style Elm style of the item (optional) * @return New item */ NaviItem insertBefore(NaviItem before, const TString &title, - Evas_Object *content, ElmStyle style = nullptr); + Widget &content, ElmStyle style = nullptr); /** * @brief Inserts new item to the naviframe stack before specific item * @param[in] before Item before which future item will be inserted - * @param[in] content Content of the item (may be NULL) + * @param[in] content Content of the item * @param[in] style Elm style of the item (optional) * @return New item */ NaviItem insertBefore(NaviItem before, - Evas_Object *content, ElmStyle style = nullptr); + Widget &content, ElmStyle style = nullptr); + + /** + * @brief Inserts new item to the naviframe stack before specific item + * @param[in] before Item before which future item will be inserted + * @param[in] style Elm style of the item (optional) + * @return New item + */ + NaviItem insertBefore(NaviItem before, ElmStyle style = nullptr); /** * @brief Gets top item of the naviframe stack @@ -255,6 +278,18 @@ namespace ucl { private: Naviframe(IRefCountObj &rc, Evas_Object *eo, Private); + NaviItem push(const TString &title, + Widget *content, Widget *backBtn, Widget *moreBtn, + ElmStyle style); + + NaviItem insertAfter(NaviItem after, const TString &title, + Widget *content, Widget *backBtn, Widget *moreBtn, + ElmStyle style); + + NaviItem insertBefore(NaviItem before, const TString &title, + Widget *content, Widget *backBtn, Widget *moreBtn, + ElmStyle style); + void onTransitionFinished(Widget &widget, void *eventInfo); private: diff --git a/ucl/include/ucl/gui/Naviframe.hpp b/ucl/include/ucl/gui/Naviframe.hpp index e8fdc19..a95ab56 100644 --- a/ucl/include/ucl/gui/Naviframe.hpp +++ b/ucl/include/ucl/gui/Naviframe.hpp @@ -83,12 +83,13 @@ namespace ucl { return result; } - inline NaviItem Naviframe::push(const TString &title, - Evas_Object *const backBtn, Evas_Object *const moreBtn, - Evas_Object *const content, const ElmStyle style) + inline NaviItem Naviframe::push(const TString &title, Widget *const content, + Widget *const backBtn, Widget *const moreBtn, + const ElmStyle style) { auto result = NaviItem(elm_naviframe_item_push(getEo(), - nullptr, backBtn, moreBtn, content, style.name)); + nullptr, as_eo(backBtn), as_eo(moreBtn), + as_eo(content), style.name)); result.setTitle(title); if (result != getBottomItem()) { setInTransition(true); @@ -96,64 +97,105 @@ namespace ucl { return result; } - inline NaviItem Naviframe::push(const TString &title, - Evas_Object *const content, const ElmStyle style) + inline NaviItem Naviframe::push(const TString &title, Widget &content, + Widget *const backBtn, Widget *const moreBtn, + const ElmStyle style) { - return push(title, nullptr, nullptr, content, style); + return push(title, &content, backBtn, moreBtn, style); } - inline NaviItem Naviframe::push( - Evas_Object *const content, const ElmStyle style) + inline NaviItem Naviframe::push(const TString &title, Widget &content, + const ElmStyle style) { - return push(nullptr, nullptr, nullptr, content, style); + return push(title, &content, nullptr, nullptr, style); } - inline NaviItem Naviframe::insertAfter(NaviItem after, - const TString &title, - Evas_Object *const backBtn, Evas_Object *const moreBtn, - Evas_Object *const content, const ElmStyle style) + inline NaviItem Naviframe::push(Widget &content, const ElmStyle style) + { + return push(nullptr, &content, nullptr, nullptr, style); + } + + inline NaviItem Naviframe::push(const ElmStyle style) + { + return push(nullptr, nullptr, nullptr, nullptr, style); + } + + inline NaviItem Naviframe::insertAfter(const NaviItem after, + const TString &title, Widget *const content, + Widget *const backBtn, Widget *const moreBtn, + const ElmStyle style) { auto result = NaviItem(elm_naviframe_item_insert_after(getEo(), - after, nullptr, backBtn, moreBtn, content, style.name)); + after, nullptr, as_eo(backBtn), as_eo(moreBtn), + as_eo(content), style.name)); result.setTitle(title); return result; } - inline NaviItem Naviframe::insertAfter(NaviItem after, - const TString &title, - Evas_Object *const content, const ElmStyle style) + inline NaviItem Naviframe::insertAfter(const NaviItem after, + const TString &title, Widget &content, + Widget *const backBtn, Widget *const moreBtn, + const ElmStyle style) + { + return insertAfter(after, title, &content, backBtn, moreBtn, style); + } + + inline NaviItem Naviframe::insertAfter(const NaviItem after, + const TString &title, Widget &content, + const ElmStyle style) { - return insertAfter(after, title, nullptr, nullptr, content, style); + return insertAfter(after, title, &content, nullptr, nullptr, style); } - inline NaviItem Naviframe::insertAfter(NaviItem after, - Evas_Object *const content, const ElmStyle style) + inline NaviItem Naviframe::insertAfter(const NaviItem after, + Widget &content, const ElmStyle style) { - return insertAfter(after, nullptr, nullptr, nullptr, content, style); + return insertAfter(after, nullptr, &content, nullptr, nullptr, style); } - inline NaviItem Naviframe::insertBefore(NaviItem before, - const TString &title, - Evas_Object *const backBtn, Evas_Object *const moreBtn, - Evas_Object *const content, const ElmStyle style) + inline NaviItem Naviframe::insertAfter(const NaviItem after, + const ElmStyle style) + { + return insertAfter(after, nullptr, nullptr, nullptr, nullptr, style); + } + + inline NaviItem Naviframe::insertBefore(const NaviItem before, + const TString &title, Widget *const content, + Widget *const backBtn, Widget *const moreBtn, + const ElmStyle style) { auto result = NaviItem(elm_naviframe_item_insert_before(getEo(), - before, nullptr, backBtn, moreBtn, content, style.name)); + before, nullptr, as_eo(backBtn), as_eo(moreBtn), + as_eo(content), style.name)); result.setTitle(title); return result; } - inline NaviItem Naviframe::insertBefore(NaviItem before, - const TString &title, - Evas_Object *const content, const ElmStyle style) + inline NaviItem Naviframe::insertBefore(const NaviItem before, + const TString &title, Widget &content, + Widget *const backBtn, Widget *const moreBtn, + const ElmStyle style) + { + return insertAfter(before, title, &content, backBtn, moreBtn, style); + } + + inline NaviItem Naviframe::insertBefore(const NaviItem before, + const TString &title, Widget &content, + const ElmStyle style) + { + return insertAfter(before, title, &content, nullptr, nullptr, style); + } + + inline NaviItem Naviframe::insertBefore(const NaviItem before, + Widget &content, const ElmStyle style) { - return insertAfter(before, title, nullptr, nullptr, content, style); + return insertAfter(before, nullptr, &content, nullptr, nullptr, style); } - inline NaviItem Naviframe::insertBefore(NaviItem before, - Evas_Object *const content, const ElmStyle style) + inline NaviItem Naviframe::insertBefore(const NaviItem before, + const ElmStyle style) { - return insertAfter(before, nullptr, nullptr, nullptr, content, style); + return insertAfter(before, nullptr, nullptr, nullptr, nullptr, style); } inline NaviItem Naviframe::getTopItem()const diff --git a/ucl/include/ucl/gui/WidgetItem.h b/ucl/include/ucl/gui/WidgetItem.h index c272bc8..3ef57d4 100644 --- a/ucl/include/ucl/gui/WidgetItem.h +++ b/ucl/include/ucl/gui/WidgetItem.h @@ -145,16 +145,16 @@ namespace ucl { /** * @brief Sets content to default part of the widget item - * @param[in] content Content Evas object + * @param[in] content Content widget */ - void setContent(Evas_Object *content) const; + void setContent(Widget &content) const; /** * @brief Sets content to specific part of the widget item - * @param[in] content Content Evas object + * @param[in] content Content widget * @param[in] part Destination Edje part */ - void setContent(Evas_Object *content, EdjePart part) const; + void setContent(Widget &content, EdjePart part) const; /** * @brief Unsets content from default part of the widget item diff --git a/ucl/include/ucl/gui/WidgetItem.hpp b/ucl/include/ucl/gui/WidgetItem.hpp index 2d53577..b36cfa4 100644 --- a/ucl/include/ucl/gui/WidgetItem.hpp +++ b/ucl/include/ucl/gui/WidgetItem.hpp @@ -97,15 +97,15 @@ namespace ucl { return elm_object_item_part_text_get(getIt(), part.name); } - inline void WidgetItem::setContent(Evas_Object *const content) const + inline void WidgetItem::setContent(Widget &content) const { - elm_object_item_content_set(getIt(), content); + elm_object_item_content_set(getIt(), as_eo(content)); } - inline void WidgetItem::setContent(Evas_Object *const content, + inline void WidgetItem::setContent(Widget &content, const EdjePart part) const { - elm_object_item_part_content_set(getIt(), part.name, content); + elm_object_item_part_content_set(getIt(), part.name, as_eo(content)); } inline Evas_Object *WidgetItem::unsetContent() const diff --git a/ucl/source/gui/Window.cpp b/ucl/source/gui/Window.cpp index 9235513..9434665 100644 --- a/ucl/source/gui/Window.cpp +++ b/ucl/source/gui/Window.cpp @@ -45,11 +45,11 @@ namespace ucl { } } - StyledWidget bg(elm_bg_add(winEo)); + StyledWidget bg(elm_bg_add(winEo), false); expand(bg); show(bg); - StyledWidget conform(elm_conformant_add(winEo)); + StyledWidget conform(elm_conformant_add(winEo), false); expand(conform); show(conform); -- cgit v1.2.3 From cc4ee185a7636d239dd3dd7e2ab73fa991579d7c Mon Sep 17 00:00:00 2001 From: Igor Nazarov Date: Mon, 23 Oct 2017 16:50:04 +0300 Subject: TizenRefApp-9665 [Call Setting] Remove Evas_Object and Elm_Interface_Atspi_Accessible cast operators Change-Id: I7859199913cd770b907b02cde4ee082b99e213f0 --- .../presenters/dialogs/ListOptionDialog.cpp | 10 +++--- call-setting/presenters/dialogs/base/Dialog.cpp | 8 ++--- .../presenters/items/base/CheckOptionItem.cpp | 14 ++++----- call-setting/presenters/misc/KeypadPresenter.cpp | 2 +- .../presenters/misc/MoreOptionsPresenter.cpp | 10 +++--- .../presenters/misc/ProcessingPresenter.cpp | 8 ++--- .../presenters/misc/SelectModePresenter.cpp | 19 ++++++------ .../presenters/pages/BlockedNumbersPage.cpp | 2 +- call-setting/presenters/pages/base/Page.cpp | 4 +-- call-setting/view/KeypadBackspaceBtn.cpp | 2 +- call-setting/view/KeypadEntry.cpp | 36 +++++++++++----------- call-setting/view/KeypadNumberBtn.cpp | 2 +- call-setting/view/PageContent.cpp | 2 +- call-setting/view/helpers.cpp | 6 ++-- ucl/include/ucl/gui/Atspi.h | 13 -------- ucl/include/ucl/gui/Atspi.hpp | 10 ------ ucl/include/ucl/gui/RadioBox.h | 2 +- ucl/include/ucl/gui/RadioBox.hpp | 4 +-- ucl/include/ucl/gui/Widget.h | 13 -------- ucl/include/ucl/gui/Widget.hpp | 10 ------ ucl/source/gui/Genlist.cpp | 2 +- ucl/source/gui/Layout.cpp | 2 +- ucl/source/gui/Naviframe.cpp | 2 +- ucl/source/gui/RadioBox.cpp | 2 +- ucl/source/gui/Window.cpp | 7 +++-- ucl/source/mvp/ListItemPresenter.cpp | 12 ++++---- ucl/source/mvp/ListPresenter.cpp | 2 +- 27 files changed, 81 insertions(+), 125 deletions(-) diff --git a/call-setting/presenters/dialogs/ListOptionDialog.cpp b/call-setting/presenters/dialogs/ListOptionDialog.cpp index 2dffbba..15f1d71 100644 --- a/call-setting/presenters/dialogs/ListOptionDialog.cpp +++ b/call-setting/presenters/dialogs/ListOptionDialog.cpp @@ -215,10 +215,10 @@ namespace call_setting { } m_popup->setContent(*layout, impl::PART_CIRCLE_SFC); - auto surface = eext_circle_surface_layout_add(*layout); + auto surface = eext_circle_surface_layout_add(as_eo(*layout)); - m_circleObject = eext_circle_object_genlist_add(m_list->getWidget(), - surface); + m_circleObject = eext_circle_object_genlist_add( + as_eo(m_list->getWidget()), surface); eext_circle_object_genlist_scroller_policy_set(m_circleObject, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); @@ -232,8 +232,8 @@ namespace call_setting { { using ucl::show; - const auto button = makeShared(elm_button_add(*m_popup), - false); + const auto button = makeShared( + elm_button_add(as_eo(*m_popup)), false); button->setStyle(btnStyle); m_popup->setContent(*button, part); diff --git a/call-setting/presenters/dialogs/base/Dialog.cpp b/call-setting/presenters/dialogs/base/Dialog.cpp index 04fde3c..d757397 100644 --- a/call-setting/presenters/dialogs/base/Dialog.cpp +++ b/call-setting/presenters/dialogs/base/Dialog.cpp @@ -38,7 +38,7 @@ namespace call_setting { Result Dialog::createPopup(ElmWidget &parent, const PopupType popupType) { Evas_Object *const popupEo = ((popupType == PopupType::NORMAL) ? - elm_popup_add(parent) : elm_ctxpopup_add(parent)); + elm_popup_add(as_eo(parent)) : elm_ctxpopup_add(as_eo(parent))); if (!popupEo) { LOG_RETURN(RES_FAIL, "elm_popup_add() failed!"); } @@ -48,7 +48,7 @@ namespace call_setting { m_popup->addEventHandler( POPUP_DISMISSED, WEAK_DELEGATE_THIS(onPopupDismissed)); - eext_object_event_callback_add(*m_popup, EEXT_CALLBACK_BACK, + eext_object_event_callback_add(popupEo, EEXT_CALLBACK_BACK, CALLBACK_A(Dialog::onPopupHWBackKey), this); getWindow().addEventHandler( @@ -73,7 +73,7 @@ namespace call_setting { if (m_popup && !m_isDismissed && m_popup->isVisible()) { m_isDismissed = true; deactivateSelf(); - elm_popup_dismiss(*m_popup); + elm_popup_dismiss(as_eo(*m_popup)); onDismiss(); } } @@ -81,7 +81,7 @@ namespace call_setting { void Dialog::dispose() { if (m_popup) { - eext_object_event_callback_del(*m_popup, EEXT_CALLBACK_BACK, + eext_object_event_callback_del(as_eo(*m_popup), EEXT_CALLBACK_BACK, CALLBACK_A(Dialog::onPopupHWBackKey)); deactivateSelf(); diff --git a/call-setting/presenters/items/base/CheckOptionItem.cpp b/call-setting/presenters/items/base/CheckOptionItem.cpp index 9450a3b..b318806 100644 --- a/call-setting/presenters/items/base/CheckOptionItem.cpp +++ b/call-setting/presenters/items/base/CheckOptionItem.cpp @@ -64,13 +64,13 @@ namespace call_setting { return nullptr; } - auto check = makeShared(elm_check_add(parent)); + auto check = makeShared(elm_check_add(as_eo(parent))); check->bindToEo(); check->setStyle(impl::CHECK_STYLE); - elm_check_state_set(*check, toEina(m_checkValue)); - evas_object_repeat_events_set(*check, EINA_FALSE); - evas_object_propagate_events_set(*check, EINA_FALSE); + elm_check_state_set(as_eo(*check), toEina(m_checkValue)); + evas_object_repeat_events_set(as_eo(*check), EINA_FALSE); + evas_object_propagate_events_set(as_eo(*check), EINA_FALSE); check->addEventHandler( impl::CHECK_CHANGED, WEAK_DELEGATE_THIS(onCheckChanged)); @@ -113,10 +113,10 @@ namespace call_setting { void CheckOptionItem::onCheckChanged(Widget &widget, void *eventInfo) { if (!isActive()) { - elm_check_state_set(widget, toEina(m_checkValue)); + elm_check_state_set(as_eo(widget), toEina(m_checkValue)); return; } - m_checkValue = elm_check_state_get(widget); + m_checkValue = elm_check_state_get(as_eo(widget)); syncOptionValue(); } @@ -179,7 +179,7 @@ namespace call_setting { if (const auto item = getItem()) { if (const auto check = dynamicWidgetCast( item.getContent(impl::ITEM_PART_CHECK))) { - elm_check_state_set(*check, toEina(m_checkValue)); + elm_check_state_set(as_eo(*check), toEina(m_checkValue)); } } } diff --git a/call-setting/presenters/misc/KeypadPresenter.cpp b/call-setting/presenters/misc/KeypadPresenter.cpp index ebca959..c38b3e6 100644 --- a/call-setting/presenters/misc/KeypadPresenter.cpp +++ b/call-setting/presenters/misc/KeypadPresenter.cpp @@ -203,7 +203,7 @@ namespace call_setting { Result KeypadPresenter::createConfirmButton() { - auto eo = elm_button_add(*m_widget); + auto eo = elm_button_add(as_eo(*m_widget)); if (!eo) { LOG_RETURN(RES_FAIL, "eo is NULL"); } diff --git a/call-setting/presenters/misc/MoreOptionsPresenter.cpp b/call-setting/presenters/misc/MoreOptionsPresenter.cpp index 7a5fe69..f04c304 100644 --- a/call-setting/presenters/misc/MoreOptionsPresenter.cpp +++ b/call-setting/presenters/misc/MoreOptionsPresenter.cpp @@ -123,7 +123,7 @@ namespace call_setting { FAIL_RETURN(GuiPresenter::prepare(parent, PF_DEACTIVATOR), "GuiPresenter::prepare() failed!"); - Evas_Object *const more = eext_more_option_add(parentWidget); + Evas_Object *const more = eext_more_option_add(as_eo(parentWidget)); if (!more) { LOG_RETURN(RES_FAIL, "eext_more_option_add() failed!"); } @@ -154,7 +154,7 @@ namespace call_setting { Result MoreOptionsPresenter::addItem(const Option &option) { - const auto item = eext_more_option_item_append(*m_widget); + const auto item = eext_more_option_item_append(as_eo(*m_widget)); if (!item) { LOG_RETURN(RES_FAIL, "eext_more_option_item_append() failed!"); } @@ -168,7 +168,7 @@ namespace call_setting { LOG_RETURN(RES_FAIL, "Layout::build() failed!"); } eext_more_option_item_part_content_set(item, - impl::PART_ICON.name, *icon); + impl::PART_ICON.name, as_eo(*icon)); } impl::setText(item, option.text, impl::PART_MAIN_TEXT); @@ -258,12 +258,12 @@ namespace call_setting { void MoreOptionsPresenter::setOpened(const bool isOpened) { m_timeout.reset(); - eext_more_option_opened_set(*m_widget, toEina(isOpened)); + eext_more_option_opened_set(as_eo(*m_widget), toEina(isOpened)); } bool MoreOptionsPresenter::isOpened() const { - return eext_more_option_opened_get(*m_widget); + return eext_more_option_opened_get(as_eo(*m_widget)); } void MoreOptionsPresenter::setOpenedDelayed( diff --git a/call-setting/presenters/misc/ProcessingPresenter.cpp b/call-setting/presenters/misc/ProcessingPresenter.cpp index 0dbe9e8..c9898df 100644 --- a/call-setting/presenters/misc/ProcessingPresenter.cpp +++ b/call-setting/presenters/misc/ProcessingPresenter.cpp @@ -113,7 +113,7 @@ namespace call_setting { ProcessingPresenter::~ProcessingPresenter() { if (m_widget) { - eext_object_event_callback_del(*m_widget, EEXT_CALLBACK_BACK, + eext_object_event_callback_del(as_eo(*m_widget), EEXT_CALLBACK_BACK, CALLBACK_A(ProcessingPresenter::onHWBackKey)); } if (const auto window = getWindowRef()) { @@ -146,7 +146,7 @@ namespace call_setting { LOG_RETURN(RES_FAIL, "resetTimer() failed!"); } } - eext_object_event_callback_add(*m_widget, EEXT_CALLBACK_BACK, + eext_object_event_callback_add(as_eo(*m_widget), EEXT_CALLBACK_BACK, CALLBACK_A(ProcessingPresenter::onHWBackKey), this); getWindow().addEventHandler( @@ -190,7 +190,7 @@ namespace call_setting { Result ProcessingPresenter::createProgress() { - Evas_Object *const progressEo = elm_progressbar_add(*m_widget); + Evas_Object *const progressEo = elm_progressbar_add(as_eo(*m_widget)); if (!progressEo) { LOG_RETURN(RES_FAIL, "elm_progressbar_add() failed!"); } @@ -198,7 +198,7 @@ namespace call_setting { StyledWidget progress{progressEo}; progress.setStyle(impl::PROGRESS_STYLE); m_widget->setContent(progress, impl::PART_PROGRESS); - elm_progressbar_pulse(progress, EINA_TRUE); + elm_progressbar_pulse(progressEo, EINA_TRUE); show(progress); return RES_OK; diff --git a/call-setting/presenters/misc/SelectModePresenter.cpp b/call-setting/presenters/misc/SelectModePresenter.cpp index 10d0835..45a405f 100644 --- a/call-setting/presenters/misc/SelectModePresenter.cpp +++ b/call-setting/presenters/misc/SelectModePresenter.cpp @@ -103,7 +103,8 @@ namespace call_setting { FAIL_RETURN(GuiPresenter::prepare(parent, PF_DEACTIVATOR), "GuiPresenter::prepare() failed!"); - m_selectButton = makeShared(elm_button_add(*m_content)); + m_selectButton = makeShared( + elm_button_add(as_eo(*m_content))); m_selectButton->setStyle(impl::SELECT_BTN_STYLE); m_content->set(*m_selectButton, PageContent::Part::SELECT_BUTTON); m_content->setSelectButtonVisible(false); @@ -114,7 +115,7 @@ namespace call_setting { if ((m_flags & FLAG_NO_BOTTOM_BUTTON) == 0) { m_bottomButton = makeShared( - elm_button_add(*m_content)); + elm_button_add(as_eo(*m_content))); m_bottomButton->setStyle(impl::BOTTOM_BTN_STYLE); hide(*m_bottomButton); @@ -251,10 +252,10 @@ namespace call_setting { { m_isPopupDismissed = false; - m_popup = makeShared(elm_ctxpopup_add(*m_content)); + m_popup = makeShared(elm_ctxpopup_add(as_eo(*m_content))); m_popup->setStyle(impl::SELECT_POPUP_STYLE); - elm_ctxpopup_direction_priority_set(*m_popup, + elm_ctxpopup_direction_priority_set(as_eo(*m_popup), ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UP, ELM_CTXPOPUP_DIRECTION_UP); @@ -262,13 +263,13 @@ namespace call_setting { WidgetItem deselectItem; if (m_selectCount < m_totalCount) { - selectItem = WidgetItem{elm_ctxpopup_item_append(*m_popup, + selectItem = WidgetItem{elm_ctxpopup_item_append(as_eo(*m_popup), STR_SELECT_ALL.translate(), nullptr, CALLBACK_A( SelectModePresenter::onSelectAll), this)}; } if (m_selectCount > 0) { - deselectItem = WidgetItem{elm_ctxpopup_item_append(*m_popup, + deselectItem = WidgetItem{elm_ctxpopup_item_append(as_eo(*m_popup), STR_DESELECT_ALL.translate(), nullptr, CALLBACK_A( SelectModePresenter::onDeselectAll), this)}; } @@ -285,7 +286,7 @@ namespace call_setting { m_popup->addEventHandler( POPUP_DISMISSED, WEAK_DELEGATE_THIS(onPopupDismissed)); - eext_object_event_callback_add(*m_popup, EEXT_CALLBACK_BACK, + eext_object_event_callback_add(as_eo(*m_popup), EEXT_CALLBACK_BACK, CALLBACK_A(SelectModePresenter::onPopupHWBackKey), this); broadcastDeactivate(); @@ -309,14 +310,14 @@ namespace call_setting { { if (m_popup && !m_isPopupDismissed) { m_isPopupDismissed = true; - elm_ctxpopup_dismiss(*m_popup); + elm_ctxpopup_dismiss(as_eo(*m_popup)); } } void SelectModePresenter::deletePopup() { if (m_popup) { - eext_object_event_callback_del(*m_popup, EEXT_CALLBACK_BACK, + eext_object_event_callback_del(as_eo(*m_popup), EEXT_CALLBACK_BACK, CALLBACK_A(SelectModePresenter::onPopupHWBackKey)); m_popup.reset(); diff --git a/call-setting/presenters/pages/BlockedNumbersPage.cpp b/call-setting/presenters/pages/BlockedNumbersPage.cpp index e7ed4ae..abf7141 100644 --- a/call-setting/presenters/pages/BlockedNumbersPage.cpp +++ b/call-setting/presenters/pages/BlockedNumbersPage.cpp @@ -240,7 +240,7 @@ namespace call_setting { void BlockedNumbersPage::updateListItems() { - elm_genlist_realized_items_update(m_list->getWidget()); + m_list->getWidget().updateRealizedItems(); } void BlockedNumbersPage::switchToSelectMode() diff --git a/call-setting/presenters/pages/base/Page.cpp b/call-setting/presenters/pages/base/Page.cpp index 135b8f9..9c4362c 100644 --- a/call-setting/presenters/pages/base/Page.cpp +++ b/call-setting/presenters/pages/base/Page.cpp @@ -76,7 +76,7 @@ namespace call_setting { } Evas_Object *content = m_item.getContent(); - if (content != *m_content) { + if (content != as_eo(*m_content)) { dispose(); LOG_RETURN(RES_FAIL, "content is not m_content"); } @@ -184,7 +184,7 @@ namespace call_setting { } m_content->set(*layout, PageContent::Part::CIRCLE_OBJECT); - auto surface = eext_circle_surface_layout_add(*layout); + auto surface = eext_circle_surface_layout_add(as_eo(*layout)); const auto type = evas_object_type_get(as_eo(owner)); diff --git a/call-setting/view/KeypadBackspaceBtn.cpp b/call-setting/view/KeypadBackspaceBtn.cpp index 064a240..ade2747 100644 --- a/call-setting/view/KeypadBackspaceBtn.cpp +++ b/call-setting/view/KeypadBackspaceBtn.cpp @@ -31,7 +31,7 @@ namespace call_setting { KeypadBackspaceBtnSRef KeypadBackspaceBtn::newInstance(ElmWidget &parent) { - Evas_Object *eo = elm_button_add(parent); + Evas_Object *eo = elm_button_add(as_eo(parent)); if (!eo) { LOG_RETURN_VALUE(RES_FAIL, {}, "eo is NULL"); } diff --git a/call-setting/view/KeypadEntry.cpp b/call-setting/view/KeypadEntry.cpp index 60acdb1..a425e1e 100644 --- a/call-setting/view/KeypadEntry.cpp +++ b/call-setting/view/KeypadEntry.cpp @@ -32,7 +32,7 @@ namespace call_setting { KeypadEntrySRef KeypadEntry::newInstance(ucl::ElmWidget &parent) { - auto eo = elm_entry_add(parent); + auto eo = elm_entry_add(as_eo(parent)); if (!eo) { LOG_RETURN_VALUE(RES_FAIL, {}, "eo is NULL"); } @@ -59,10 +59,10 @@ namespace call_setting { digitsFilterData.accepted = "0123456789*#+"; digitsFilterData.rejected = nullptr; - elm_entry_single_line_set(*m_entry, EINA_TRUE); - elm_entry_editable_set(*m_entry, EINA_FALSE); - elm_entry_scrollable_set(*m_entry, EINA_TRUE); - elm_entry_markup_filter_append(*m_entry, + elm_entry_single_line_set(as_eo(*m_entry), EINA_TRUE); + elm_entry_editable_set(as_eo(*m_entry), EINA_FALSE); + elm_entry_scrollable_set(as_eo(*m_entry), EINA_TRUE); + elm_entry_markup_filter_append(as_eo(*m_entry), elm_entry_filter_accept_set, &digitsFilterData); m_entry->addEventHandler(ENTRY_CHANGED, @@ -76,41 +76,41 @@ namespace call_setting { std::string KeypadEntry::getNumber() const { - return nz(elm_entry_entry_get(*m_entry)); + return nz(elm_entry_entry_get(as_eo(*m_entry))); } void KeypadEntry::setNumber(const std::string &number) { - elm_entry_entry_set(*m_entry, number.c_str()); - elm_entry_cursor_line_end_set(*m_entry); + elm_entry_entry_set(as_eo(*m_entry), number.c_str()); + elm_entry_cursor_line_end_set(as_eo(*m_entry)); } void KeypadEntry::insert(const char *c) { - elm_entry_entry_insert(*m_entry, c); + elm_entry_entry_insert(as_eo(*m_entry), c); } void KeypadEntry::erase() { - if (!elm_entry_selection_get(*m_entry)) { - int pos = elm_entry_cursor_pos_get(*m_entry); + if (!elm_entry_selection_get(as_eo(*m_entry))) { + int pos = elm_entry_cursor_pos_get(as_eo(*m_entry)); if (pos > 0) { - elm_entry_select_region_set(*m_entry, pos - 1, pos); + elm_entry_select_region_set(as_eo(*m_entry), pos - 1, pos); } } - elm_entry_entry_insert(*m_entry, ""); + elm_entry_entry_insert(as_eo(*m_entry), ""); } void KeypadEntry::clear() { - elm_entry_entry_set(*m_entry, ""); + elm_entry_entry_set(as_eo(*m_entry), ""); } int KeypadEntry::calcFontSize() const { int entryWidth = 0; int textWidth = 0; - auto textblock = elm_entry_textblock_get(*m_entry); + auto textblock = elm_entry_textblock_get(as_eo(*m_entry)); m_entry->getGeometry(nullptr, nullptr, &entryWidth, nullptr); evas_object_textblock_size_native_get(textblock, &textWidth, nullptr); @@ -133,13 +133,13 @@ namespace call_setting { snprintf(buffer, sizeof(buffer), "DEFAULT='font=Tizen:style=Regular" " font_size=%d color=#ffffff align=center'", m_fontSize); - elm_entry_text_style_user_pop(*m_entry); - elm_entry_text_style_user_push(*m_entry, buffer); + elm_entry_text_style_user_pop(as_eo(*m_entry)); + elm_entry_text_style_user_push(as_eo(*m_entry), buffer); } void KeypadEntry::onChanged(Widget &widget, void *eventInfo) { - std::string newText = nz(elm_entry_entry_get(*m_entry)); + std::string newText = nz(elm_entry_entry_get(as_eo(*m_entry))); // XXX This check is used to avoid recursive font // size recalculation when entry text does not changed diff --git a/call-setting/view/KeypadNumberBtn.cpp b/call-setting/view/KeypadNumberBtn.cpp index f82f6db..6b16314 100644 --- a/call-setting/view/KeypadNumberBtn.cpp +++ b/call-setting/view/KeypadNumberBtn.cpp @@ -35,7 +35,7 @@ namespace call_setting { KeypadNumberBtnSRef KeypadNumberBtn::newInstance(ucl::ElmWidget &parent, const Info &info) { - Evas_Object *eo = elm_button_add(parent); + Evas_Object *eo = elm_button_add(as_eo(parent)); if (!eo) { LOG_RETURN_VALUE(RES_FAIL, {}, "eo is NULL"); } diff --git a/call-setting/view/PageContent.cpp b/call-setting/view/PageContent.cpp index c1d3007..92ffa43 100644 --- a/call-setting/view/PageContent.cpp +++ b/call-setting/view/PageContent.cpp @@ -92,7 +92,7 @@ namespace call_setting { PageContent::PageContent(IRefCountObj &rc, Layout *const layout, const int flags, Private) : - ElmWidget(&rc, *layout), + ElmWidget(&rc, as_eo(*layout)), m_mainLayout(layout) { prepare(flags); diff --git a/call-setting/view/helpers.cpp b/call-setting/view/helpers.cpp index 78a8d12..1c6c0f4 100644 --- a/call-setting/view/helpers.cpp +++ b/call-setting/view/helpers.cpp @@ -48,7 +48,7 @@ namespace call_setting { namespace util { "Circle Surface data already set!"); } - const auto sfc = eext_circle_surface_naviframe_add(navi); + const auto sfc = eext_circle_surface_naviframe_add(as_eo(navi)); if (!sfc) { LOG_RETURN(RES_FAIL, "eext_circle_surface_conformant_add() failed!"); @@ -90,9 +90,9 @@ namespace call_setting { namespace util { result->setGeometry(0, 0, 1, 1); show(*result); - elm_atspi_accessible_reading_info_type_set(*result, 0); + elm_atspi_accessible_reading_info_type_set(as_ao(*result), 0); - elm_atspi_accessible_gesture_cb_set(*result, + elm_atspi_accessible_gesture_cb_set(as_ao(*result), [](void *, Elm_Atspi_Gesture_Info, Evas_Object *) -> Eina_Bool { return EINA_TRUE; diff --git a/ucl/include/ucl/gui/Atspi.h b/ucl/include/ucl/gui/Atspi.h index 252a990..56a8b07 100644 --- a/ucl/include/ucl/gui/Atspi.h +++ b/ucl/include/ucl/gui/Atspi.h @@ -57,19 +57,6 @@ namespace ucl { */ ~Atspi(); - /** - * @brief Implicitly casts to the underlying Access object - * @return Pointer to the underlying Access object - */ - operator Elm_Interface_Atspi_Accessible *(); - - /** - * @brief Implicitly casts to the underlying - * Access object (constant version) - * @return Pointer to the constant underlying Access object - */ - operator const Elm_Interface_Atspi_Accessible *() const; - /** * @brief Sets name * @param[in] name New name diff --git a/ucl/include/ucl/gui/Atspi.hpp b/ucl/include/ucl/gui/Atspi.hpp index 3d535fa..e9b1309 100644 --- a/ucl/include/ucl/gui/Atspi.hpp +++ b/ucl/include/ucl/gui/Atspi.hpp @@ -27,16 +27,6 @@ namespace ucl { return m_ao; } - inline Atspi::operator Elm_Interface_Atspi_Accessible *() - { - return m_ao; - } - - inline Atspi::operator const Elm_Interface_Atspi_Accessible *() const - { - return m_ao; - } - inline void Atspi::setName(const std::string &name) { elm_atspi_accessible_name_set(getAo(), name.c_str()); diff --git a/ucl/include/ucl/gui/RadioBox.h b/ucl/include/ucl/gui/RadioBox.h index a0e4b83..715b0bd 100644 --- a/ucl/include/ucl/gui/RadioBox.h +++ b/ucl/include/ucl/gui/RadioBox.h @@ -92,7 +92,7 @@ namespace ucl { * @param[in] group Radio box to which group this radio box * should be added */ - void addToGroup(Elm_Radio *group); + void addToGroup(RadioBox &group); /** * @brief Sets a value of the group in which this radio box is member diff --git a/ucl/include/ucl/gui/RadioBox.hpp b/ucl/include/ucl/gui/RadioBox.hpp index 8943278..3efe0e0 100644 --- a/ucl/include/ucl/gui/RadioBox.hpp +++ b/ucl/include/ucl/gui/RadioBox.hpp @@ -55,9 +55,9 @@ namespace ucl { return elm_radio_state_value_get(getEo()); } - inline void RadioBox::addToGroup(Elm_Radio *const group) + inline void RadioBox::addToGroup(RadioBox &group) { - elm_radio_group_add(getEo(), group); + elm_radio_group_add(getEo(), as_eo(group)); } inline void RadioBox::setGroupValue(const int value) diff --git a/ucl/include/ucl/gui/Widget.h b/ucl/include/ucl/gui/Widget.h index f2f9620..e6506ab 100644 --- a/ucl/include/ucl/gui/Widget.h +++ b/ucl/include/ucl/gui/Widget.h @@ -121,19 +121,6 @@ namespace ucl { */ void setIsOwner(bool value); - /** - * @brief Implicitly casts to the underlying Evas object - * @return Pointer to the underlying Evas object - */ - operator Evas_Object *(); - - /** - * @brief Implicitly casts to the underlying - * Evas object (constant version) - * @return Pointer to the constant underlying Evas object - */ - operator const Evas_Object *() const; - /** * @brief Gets Evas canvas on which underlying Evas object resides * @return Pointer to the Evas canvas diff --git a/ucl/include/ucl/gui/Widget.hpp b/ucl/include/ucl/gui/Widget.hpp index 9ff8cd6..9e98bfd 100644 --- a/ucl/include/ucl/gui/Widget.hpp +++ b/ucl/include/ucl/gui/Widget.hpp @@ -44,16 +44,6 @@ namespace ucl { return m_eo; } - inline Widget::operator Evas_Object *() - { - return getEo(); - } - - inline Widget::operator const Evas_Object *() const - { - return getEo(); - } - inline Evas *Widget::getEvas() const { return evas_object_evas_get(getEo()); diff --git a/ucl/source/gui/Genlist.cpp b/ucl/source/gui/Genlist.cpp index 6195bde..2b20d48 100644 --- a/ucl/source/gui/Genlist.cpp +++ b/ucl/source/gui/Genlist.cpp @@ -24,7 +24,7 @@ namespace ucl { GenlistSRef Genlist::Builder::build(ElmWidget &parent) const { - Evas_Object *const eo = elm_genlist_add(parent); + Evas_Object *const eo = elm_genlist_add(as_eo(parent)); if (!eo) { LOG_RETURN_VALUE(RES_FAIL, {}, "elm_genlist_add() failed!"); } diff --git a/ucl/source/gui/Layout.cpp b/ucl/source/gui/Layout.cpp index 1509fc5..f5fb2fd 100644 --- a/ucl/source/gui/Layout.cpp +++ b/ucl/source/gui/Layout.cpp @@ -26,7 +26,7 @@ namespace ucl { LayoutSRef Layout::Builder::build(ElmWidget &parent) const { - Evas_Object *const eo = elm_layout_add(parent); + Evas_Object *const eo = elm_layout_add(as_eo(parent)); if (!eo) { LOG_RETURN_VALUE(RES_FAIL, {}, "elm_layout_add() failed!"); } diff --git a/ucl/source/gui/Naviframe.cpp b/ucl/source/gui/Naviframe.cpp index 4cee1f8..7943607 100644 --- a/ucl/source/gui/Naviframe.cpp +++ b/ucl/source/gui/Naviframe.cpp @@ -24,7 +24,7 @@ namespace ucl { NaviframeSRef Naviframe::Builder::build(ElmWidget &parent) const { - Evas_Object *const eo = elm_naviframe_add(parent); + Evas_Object *const eo = elm_naviframe_add(as_eo(parent)); if (!eo) { ELOG("elm_naviframe_add() failed!"); return {}; diff --git a/ucl/source/gui/RadioBox.cpp b/ucl/source/gui/RadioBox.cpp index 3065e0a..ce8ecc7 100644 --- a/ucl/source/gui/RadioBox.cpp +++ b/ucl/source/gui/RadioBox.cpp @@ -24,7 +24,7 @@ namespace ucl { RadioBoxSRef RadioBox::Builder::build(ElmWidget &parent) const { - Evas_Object *const eo = elm_radio_add(parent); + Evas_Object *const eo = elm_radio_add(as_eo(parent)); if (!eo) { LOG_RETURN_VALUE(RES_FAIL, {}, "elm_genlist_add() failed!"); } diff --git a/ucl/source/gui/Window.cpp b/ucl/source/gui/Window.cpp index 9434665..78addf3 100644 --- a/ucl/source/gui/Window.cpp +++ b/ucl/source/gui/Window.cpp @@ -53,13 +53,14 @@ namespace ucl { expand(conform); show(conform); - elm_win_resize_object_add(winEo, bg); - elm_win_resize_object_add(winEo, conform); + elm_win_resize_object_add(winEo, as_eo(bg)); + elm_win_resize_object_add(winEo, as_eo(conform)); elm_win_indicator_opacity_set(winEo, ELM_WIN_INDICATOR_OPAQUE); elm_win_conformant_set(winEo, EINA_TRUE); - auto result = makeShared(winEo, isOwner, conform, PRIVATE); + auto result = makeShared(winEo, isOwner, + as_eo(conform), PRIVATE); if (m_needBindToEo) { result->bindToEo(); diff --git a/ucl/source/mvp/ListItemPresenter.cpp b/ucl/source/mvp/ListItemPresenter.cpp index 42ded4f..3fff862 100644 --- a/ucl/source/mvp/ListItemPresenter.cpp +++ b/ucl/source/mvp/ListItemPresenter.cpp @@ -314,12 +314,12 @@ namespace ucl { return nullptr; } - auto check = makeShared(elm_check_add(parent)); + auto check = makeShared(elm_check_add(as_eo(parent))); check->setStyle(params.checkStyle); - elm_check_state_set(*check, toEina(m_isItemPicked)); - evas_object_repeat_events_set(*check, EINA_FALSE); - evas_object_propagate_events_set(*check, EINA_FALSE); + elm_check_state_set(as_eo(*check), toEina(m_isItemPicked)); + evas_object_repeat_events_set(as_eo(*check), EINA_FALSE); + evas_object_propagate_events_set(as_eo(*check), EINA_FALSE); check->addEventHandler( impl::CHECK_CHANGED, WEAK_DELEGATE_THIS(onPickCheckChanged)); @@ -330,11 +330,11 @@ namespace ucl { void ListItemPresenter::onPickCheckChanged(Widget &widget, void *eventInfo) { if (!isActive()) { - elm_check_state_set(widget, toEina(m_isItemPicked)); + elm_check_state_set(as_eo(widget), toEina(m_isItemPicked)); return; } - handleItemPick(elm_check_state_get(widget)); + handleItemPick(elm_check_state_get(as_eo(widget))); if (m_item) { elm_genlist_item_bring_in(m_item, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE); diff --git a/ucl/source/mvp/ListPresenter.cpp b/ucl/source/mvp/ListPresenter.cpp index 0f41987..242928e 100644 --- a/ucl/source/mvp/ListPresenter.cpp +++ b/ucl/source/mvp/ListPresenter.cpp @@ -123,7 +123,7 @@ namespace ucl { expandAndFill(*m_genlist); // TODO Add Scroller widget. - elm_scroller_content_min_limit(*m_genlist, + elm_scroller_content_min_limit(as_eo(*m_genlist), toEina((flags & FLAG_CALC_X_MIN) != 0), toEina((flags & FLAG_CALC_Y_MIN) != 0)); -- cgit v1.2.3 From 6ce38b651228801ce3d45384fd26c19e8885943f Mon Sep 17 00:00:00 2001 From: Igor Olshevskyi Date: Thu, 12 Oct 2017 17:13:30 +0300 Subject: TizenRefApp-9602 [Call Setting] Reimplement styles for Keypad number buttons Change-Id: I28987f93cab65bb680a46b291a86344282be0262 --- call-setting/view/TouchParser.cpp | 32 ++++++++++++++++++++++---------- call-setting/view/TouchParser.h | 34 ++++++++++++++++++++++++++++++++-- edc/buttons.edc | 32 ++++++++++++++++---------------- edc/images/keypad_0.png | Bin 19126 -> 1986 bytes edc/images/keypad_1.png | Bin 19678 -> 2302 bytes edc/images/keypad_2.png | Bin 19028 -> 1890 bytes edc/images/keypad_3.png | Bin 19072 -> 1903 bytes edc/images/keypad_4.png | Bin 19703 -> 2308 bytes edc/images/keypad_5.png | Bin 19156 -> 2073 bytes edc/images/keypad_6.png | Bin 19690 -> 2298 bytes edc/images/keypad_7.png | Bin 19091 -> 1907 bytes edc/images/keypad_8.png | Bin 19078 -> 1908 bytes edc/images/keypad_9.png | Bin 19699 -> 2313 bytes edc/layouts.edc | 24 +++++++++++++----------- 14 files changed, 83 insertions(+), 39 deletions(-) diff --git a/call-setting/view/TouchParser.cpp b/call-setting/view/TouchParser.cpp index 68b8aad..6501e3c 100644 --- a/call-setting/view/TouchParser.cpp +++ b/call-setting/view/TouchParser.cpp @@ -32,11 +32,12 @@ namespace call_setting { RefCountAware(&rc), m_holdTimer(nullptr), m_downTime(0), - m_downX(0), - m_downY(0), + m_baseX(0), + m_baseY(0), m_tapCounter(0), m_isMouseDown(false), - m_isTapPossible(false) + m_isTapPossible(false), + m_isBaseCoordinatesSet(false) { eventSource.addEventHandler(WidgetEvent::MOUSE_DOWN, WEAK_DELEGATE_THIS(onMouseDown)); @@ -82,16 +83,24 @@ namespace call_setting { restartHoldTimer(); } else if (m_tapCounter == 1) { if (const auto handler = m_doubleTapHandler.lock()) { - handler(m_downX, m_downY); + handler(m_baseX, m_baseY); } } m_downTime = e->timestamp; - m_downX = e->canvas.x; - m_downY = e->canvas.y; + m_isBaseCoordinatesSet = false; m_isTapPossible = true; } + void TouchParser::tryUpdateBaseCoordinates(int x, int y) + { + if (!m_isBaseCoordinatesSet) { + m_isBaseCoordinatesSet = true; + m_baseX = x; + m_baseY = y; + } + } + void TouchParser::onMouseUp(Widget &widget, void *eventInfo) { if (!m_isMouseDown) { @@ -99,9 +108,11 @@ namespace call_setting { } m_isMouseDown = false; + stopHoldTimer(); + const auto e = static_cast(eventInfo); + tryUpdateBaseCoordinates(e->canvas.x, e->canvas.y); - stopHoldTimer(); updateIsTapPossible(e->event_flags, e->canvas.x, e->canvas.y); if (!m_isTapPossible) { @@ -123,6 +134,7 @@ namespace call_setting { } const auto e = static_cast(eventInfo); + tryUpdateBaseCoordinates(e->cur.canvas.x, e->cur.canvas.y); updateIsTapPossible(e->event_flags, e->cur.canvas.x, e->cur.canvas.y); @@ -153,8 +165,8 @@ namespace call_setting { double TouchParser::calcDownDistance(int curX, int curY) const { - const auto dx = (curX - m_downX); - const auto dy = (curY - m_downY); + const auto dx = (curX - m_baseX); + const auto dy = (curY - m_baseY); return sqrt(1.0 * dx * dx + 1.0 * dy * dy); } @@ -178,7 +190,7 @@ namespace call_setting { { m_holdTimer = nullptr; if (const auto handler = m_tapAndHoldHandler.lock()) { - handler(m_downX, m_downY); + handler(m_baseX, m_baseY); } return ECORE_CALLBACK_CANCEL; } diff --git a/call-setting/view/TouchParser.h b/call-setting/view/TouchParser.h index 4904aeb..fd96a6b 100644 --- a/call-setting/view/TouchParser.h +++ b/call-setting/view/TouchParser.h @@ -25,15 +25,42 @@ namespace call_setting { UCL_DECLARE_REF_ALIASES(TouchParser); + /** + * @brief Provides set of instruments to handle Tap events on widgets + */ class TouchParser final : public ucl::RefCountAware { public: + + /** + * @brief Tap event handler + */ using TapHandler = ucl::WeakDelegate; public: + + /** + * @brief Constructor + * @param[in] rc Pointer to IRefCountObj (passed automatically) + * @param[in] eventSource Source widget for handling Tap events + */ TouchParser(ucl::IRefCountObj &rc, ucl::Widget &eventSource); + /** + * @brief Sets single Tap event handler + * @param[in] handler Tap event handler + */ void setTapHandler(TapHandler handler); + + /** + * @brief Sets double Tap event handler + * @param[in] handler Double Tap event handler + */ void setDoubleTapHandler(TapHandler handler); + + /** + * @brief Sets 'Tap and Hold' event handler + * @param[in] handler 'Tap and hold' event handler + */ void setTapAndHoldHandler(TapHandler handler); private: @@ -51,17 +78,20 @@ namespace call_setting { void stopHoldTimer(); Eina_Bool onHoldTimer(); + void tryUpdateBaseCoordinates(int x, int y); + private: TapHandler m_tapHandler; TapHandler m_doubleTapHandler; TapHandler m_tapAndHoldHandler; Ecore_Timer *m_holdTimer; ucl::UInt m_downTime; - int m_downX; - int m_downY; + int m_baseX; + int m_baseY; int m_tapCounter; bool m_isMouseDown; bool m_isTapPossible; + bool m_isBaseCoordinatesSet; friend class ucl::ReffedObj; }; diff --git a/edc/buttons.edc b/edc/buttons.edc index 120c054..a7c31d6 100644 --- a/edc/buttons.edc +++ b/edc/buttons.edc @@ -339,7 +339,7 @@ group { "elm/button/base/callsetting/backspace"; } } -#define CS_BTN_KEYPAD_NUMBER_IMPL(_name, _icon, _digit_x, _digit_y, _effect_x, _effect_y) \ +#define CS_BTN_KEYPAD_NUMBER_IMPL(_name, _icon, _width, _height, _digit_x, _digit_y, _effect_x, _effect_y) \ group { "elm/button/base/callsetting/"_name; \ data.item: "access_highlight" "on"; \ images { \ @@ -353,8 +353,8 @@ group { "elm/button/base/callsetting/"_name; \ scale; \ desc { "default"; \ fixed: 1 1; \ - rel1.relative: CS_REL_X(_effect_x) CS_REL_Y(_effect_y); \ - rel2.relative: CS_REL_X(_effect_x) CS_REL_Y(_effect_y); \ + rel1.relative: (_effect_x/_width) (_effect_y/_height); \ + rel2.relative: (_effect_x/_width) (_effect_y/_height); \ } \ } \ image { "image.effect"; \ @@ -382,9 +382,9 @@ group { "elm/button/base/callsetting/"_name; \ scale; \ desc { "default"; \ fixed: 1 1; \ - rel1.relative: CS_REL_X(_digit_x) CS_REL_Y(_digit_y); \ - rel2.relative: CS_REL_X((_digit_x+CS_KEYPAD_NUMBER_BTN_DIGIT_W)) \ - CS_REL_Y((_digit_y+CS_KEYPAD_NUMBER_BTN_DIGIT_H)); \ + rel1.relative: (_digit_x/_width) (_digit_y/_height); \ + rel2.relative: ((_digit_x+CS_KEYPAD_NUMBER_BTN_DIGIT_W)/_width) \ + ((_digit_y+CS_KEYPAD_NUMBER_BTN_DIGIT_H)/_height); \ text.style: "keypad_btn_digit"; \ } \ } \ @@ -594,13 +594,13 @@ group { "elm/button/base/callsetting/"_name; \ } \ } -CS_BTN_KEYPAD_NUMBER_IMPL("keypad_00", "keypad_0.png", 155, 12, 180, 35) -CS_BTN_KEYPAD_NUMBER_IMPL("keypad_01", "keypad_1.png", 240, 41, 265, 63) -CS_BTN_KEYPAD_NUMBER_IMPL("keypad_02", "keypad_2.png", 292, 106, 318, 135) -CS_BTN_KEYPAD_NUMBER_IMPL("keypad_03", "keypad_3.png", 292, 196, 318, 225) -CS_BTN_KEYPAD_NUMBER_IMPL("keypad_04", "keypad_4.png", 240, 265, 265, 297) -CS_BTN_KEYPAD_NUMBER_IMPL("keypad_05", "keypad_5.png", 155, 292, 180, 325) -CS_BTN_KEYPAD_NUMBER_IMPL("keypad_06", "keypad_6.png", 70, 264, 95, 297) -CS_BTN_KEYPAD_NUMBER_IMPL("keypad_07", "keypad_7.png", 18, 194, 42, 225) -CS_BTN_KEYPAD_NUMBER_IMPL("keypad_08", "keypad_8.png", 18, 104, 42, 135) -CS_BTN_KEYPAD_NUMBER_IMPL("keypad_09", "keypad_9.png", 70, 30, 95, 63) +CS_BTN_KEYPAD_NUMBER_IMPL("keypad_00", "keypad_0.png", 110, 102, 30, 12, 55, 35) +CS_BTN_KEYPAD_NUMBER_IMPL("keypad_01", "keypad_1.png", 119, 122, 34, 32, 59, 54) +CS_BTN_KEYPAD_NUMBER_IMPL("keypad_02", "keypad_2.png", 113, 104, 45, 31, 71, 60) +CS_BTN_KEYPAD_NUMBER_IMPL("keypad_03", "keypad_3.png", 113, 104, 45, 15, 71, 44) +CS_BTN_KEYPAD_NUMBER_IMPL("keypad_04", "keypad_4.png", 119, 122, 34, 36, 59, 68) +CS_BTN_KEYPAD_NUMBER_IMPL("keypad_05", "keypad_5.png", 110, 102, 30, 34, 55, 67) +CS_BTN_KEYPAD_NUMBER_IMPL("keypad_06", "keypad_6.png", 119, 122, 35, 35, 60, 68) +CS_BTN_KEYPAD_NUMBER_IMPL("keypad_07", "keypad_7.png", 113, 104, 18, 13, 42, 44) +CS_BTN_KEYPAD_NUMBER_IMPL("keypad_08", "keypad_8.png", 113, 104, 18, 29, 42, 60) +CS_BTN_KEYPAD_NUMBER_IMPL("keypad_09", "keypad_9.png", 119, 122, 35, 21, 60, 54) diff --git a/edc/images/keypad_0.png b/edc/images/keypad_0.png index 606ce7b..eba3ff1 100644 Binary files a/edc/images/keypad_0.png and b/edc/images/keypad_0.png differ diff --git a/edc/images/keypad_1.png b/edc/images/keypad_1.png index d1f352d..3e6ae74 100644 Binary files a/edc/images/keypad_1.png and b/edc/images/keypad_1.png differ diff --git a/edc/images/keypad_2.png b/edc/images/keypad_2.png index 9ab8699..a9f7b70 100644 Binary files a/edc/images/keypad_2.png and b/edc/images/keypad_2.png differ diff --git a/edc/images/keypad_3.png b/edc/images/keypad_3.png index 76116d8..4f7dd05 100644 Binary files a/edc/images/keypad_3.png and b/edc/images/keypad_3.png differ diff --git a/edc/images/keypad_4.png b/edc/images/keypad_4.png index c2f26a6..66183d2 100644 Binary files a/edc/images/keypad_4.png and b/edc/images/keypad_4.png differ diff --git a/edc/images/keypad_5.png b/edc/images/keypad_5.png index 2aa1b78..e832f0c 100644 Binary files a/edc/images/keypad_5.png and b/edc/images/keypad_5.png differ diff --git a/edc/images/keypad_6.png b/edc/images/keypad_6.png index 8afe43e..2046d27 100644 Binary files a/edc/images/keypad_6.png and b/edc/images/keypad_6.png differ diff --git a/edc/images/keypad_7.png b/edc/images/keypad_7.png index 7820b5e..4c2dd29 100644 Binary files a/edc/images/keypad_7.png and b/edc/images/keypad_7.png differ diff --git a/edc/images/keypad_8.png b/edc/images/keypad_8.png index d7edefe..b124bff 100644 Binary files a/edc/images/keypad_8.png and b/edc/images/keypad_8.png differ diff --git a/edc/images/keypad_9.png b/edc/images/keypad_9.png index 06e0c05..e6f8401 100644 Binary files a/edc/images/keypad_9.png and b/edc/images/keypad_9.png differ diff --git a/edc/layouts.edc b/edc/layouts.edc index dd0b47e..2220d33 100644 --- a/edc/layouts.edc +++ b/edc/layouts.edc @@ -14,10 +14,12 @@ * limitations under the License. */ -#define CS_SWL_NUMBER_BUTTON(_name) \ +#define CS_SWL_NUMBER_BUTTON(_name, _x1, _y1, _x2, _y2) \ swallow { _name; \ scale; \ desc { "default"; \ + rel1 { relative: CS_REL_X(_x1) CS_REL_Y(_y1); } \ + rel2 { relative: CS_REL_X(_x2) CS_REL_Y(_y2); } \ } \ } \ @@ -270,16 +272,16 @@ group { "elm/layout/callsetting/keypad"; hid; } } - CS_SWL_NUMBER_BUTTON("swl.btn.0") - CS_SWL_NUMBER_BUTTON("swl.btn.1") - CS_SWL_NUMBER_BUTTON("swl.btn.2") - CS_SWL_NUMBER_BUTTON("swl.btn.3") - CS_SWL_NUMBER_BUTTON("swl.btn.4") - CS_SWL_NUMBER_BUTTON("swl.btn.5") - CS_SWL_NUMBER_BUTTON("swl.btn.6") - CS_SWL_NUMBER_BUTTON("swl.btn.7") - CS_SWL_NUMBER_BUTTON("swl.btn.8") - CS_SWL_NUMBER_BUTTON("swl.btn.9") + CS_SWL_NUMBER_BUTTON("swl.btn.0", 125, 0, 235, 102) + CS_SWL_NUMBER_BUTTON("swl.btn.1", 206, 9, 325, 131) + CS_SWL_NUMBER_BUTTON("swl.btn.2", 247, 75, 360, 179) + CS_SWL_NUMBER_BUTTON("swl.btn.3", 247, 181, 360, 285) + CS_SWL_NUMBER_BUTTON("swl.btn.4", 206, 229, 325, 351) + CS_SWL_NUMBER_BUTTON("swl.btn.5", 125, 258, 235, 360) + CS_SWL_NUMBER_BUTTON("swl.btn.6", 35, 229, 154, 351) + CS_SWL_NUMBER_BUTTON("swl.btn.7", 0, 181, 113, 285) + CS_SWL_NUMBER_BUTTON("swl.btn.8", 0, 75, 113, 179) + CS_SWL_NUMBER_BUTTON("swl.btn.9", 35, 9, 154, 131) swallow { "swl.confirm"; scale; desc { "default"; -- cgit v1.2.3 From 591cd594db7cbcfc2123dad8e76c966898f1fd33 Mon Sep 17 00:00:00 2001 From: Igor Nazarov Date: Tue, 24 Oct 2017 18:23:39 +0300 Subject: TizenRefApp-9675 [Call Setting] Implement AoSequencer Change-Id: I21dec973eacf03eab56c35a416c92a206e72766a --- call-setting/view/AoSequencer.cpp | 82 ++++++++++++++++++++++++++++++ call-setting/view/AoSequencer.h | 103 ++++++++++++++++++++++++++++++++++++++ call-setting/view/AoSequencer.hpp | 78 +++++++++++++++++++++++++++++ ucl/include/ucl/gui/Atspi.h | 36 +++++++++++-- ucl/include/ucl/gui/Atspi.hpp | 16 +++++- 5 files changed, 309 insertions(+), 6 deletions(-) create mode 100644 call-setting/view/AoSequencer.cpp create mode 100644 call-setting/view/AoSequencer.h create mode 100644 call-setting/view/AoSequencer.hpp diff --git a/call-setting/view/AoSequencer.cpp b/call-setting/view/AoSequencer.cpp new file mode 100644 index 0000000..dfdca2f --- /dev/null +++ b/call-setting/view/AoSequencer.cpp @@ -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. + */ + +#include "AoSequencer.h" + +#include "common.h" + +namespace call_setting { + + AoSequencer::AoSequencer( + const Elm_Interface_Atspi_Accessible *const current, + const Elm_Atspi_Relation_Type flowRelation) : + m_current(current), + m_flowRelation(flowRelation), + + m_last(nullptr), + m_next(nullptr), + + m_isNextSet(false), + m_isCurrentFound(false), + m_isComplete(false) + { + } + + void AoSequencer::doProcessAo( + const Elm_Interface_Atspi_Accessible *const itemAo) + { + switch (m_flowRelation) { + case ELM_ATSPI_RELATION_FLOWS_TO: + + if (itemAo == m_current) { + setNext(itemAo); + m_isCurrentFound = true; + return; + } + if (m_isCurrentFound) { + setNext(itemAo); + m_isComplete = true; + return; + } + break; + + case ELM_ATSPI_RELATION_FLOWS_FROM: + + if (itemAo == m_current) { + setNext(m_isNextSet ? m_last : itemAo); + m_isComplete = true; + return; + } + m_last = itemAo; + break; + + default: + WLOG("Unknown: %d;", m_flowRelation); + break; + } + + if (!m_isNextSet) { + setNext(itemAo); + } + } + + void AoSequencer::setNext( + const Elm_Interface_Atspi_Accessible *const itemAo) + { + m_next = itemAo; + m_isNextSet = true; + } +} diff --git a/call-setting/view/AoSequencer.h b/call-setting/view/AoSequencer.h new file mode 100644 index 0000000..149096f --- /dev/null +++ b/call-setting/view/AoSequencer.h @@ -0,0 +1,103 @@ +/* + * 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 __CALL_SETTING_VIEW_AO_SEQUENCER_H__ +#define __CALL_SETTING_VIEW_AO_SEQUENCER_H__ + +#include "ucl/gui/Atspi.h" + +#include "types.h" + +namespace call_setting { + + UCL_DECLARE_REF_ALIASES(KeypadNumberBtn); + + /** + * @brief Finds next object in the Access objects highlight flow sequence + */ + class AoSequencer final : private ucl::NonCopyable { + public: + /** + * @brief Constructor + * @param[in] current Currently focused Access object + * @param[in] flowRelation Flow relation for finding next Access object + */ + AoSequencer(const Elm_Interface_Atspi_Accessible *current, + Elm_Atspi_Relation_Type flowRelation); + + /** + * @brief Denotes break in sequence for allowing system default flow + */ + AoSequencer &processDefault(); + + /** + * @brief Passes next object in flow sequence + * @param[in] item Item in highlight flow sequence. Any object for which + * as_ao() function may be called. NULL is ignored. + */ + template + AoSequencer &process(const ITEM &item); + + /** + * @brief Passes next object list in flow sequence + * @param[in] items Item list in highlight flow sequence. + */ + template + AoSequencer &processEach(const ITEMS &items); + + /** + * @brief Passes next object range in flow sequence + * @param[in] begin Begin iterator of the range + * @param[in] end End iterator of the range + */ + template + AoSequencer &processEach(ITERATOR begin, ITERATOR end); + + /** + * @brief Gets next Acces object in highlight flow sequence + * @details Result is base on constructor parameters and processed + * sequence. Result may change during processing. + * If current object was not found in the processed sequence + * first object from the sequence is returned. If it is not + * possible to get next object (current is already last) then + * current object is returned. NULL is returned for default + * processing. + * @return Next access object in highlight flow sequence + */ + const Elm_Interface_Atspi_Accessible *getNext(); + + private: + template + void doProcess(const ITEM &item); + void doProcessAo(const Elm_Interface_Atspi_Accessible *itemAo); + void setNext(const Elm_Interface_Atspi_Accessible *itemAo); + + private: + const Elm_Interface_Atspi_Accessible *const m_current; + const Elm_Atspi_Relation_Type m_flowRelation; + + const Elm_Interface_Atspi_Accessible *m_last; + const Elm_Interface_Atspi_Accessible *m_next; + + bool m_isNextSet; + bool m_isCurrentFound; + bool m_isComplete; + }; +} + +#include "AoSequencer.hpp" + +#endif // __CALL_SETTING_VIEW_AO_SEQUENCER_H__ diff --git a/call-setting/view/AoSequencer.hpp b/call-setting/view/AoSequencer.hpp new file mode 100644 index 0000000..eb6c0e3 --- /dev/null +++ b/call-setting/view/AoSequencer.hpp @@ -0,0 +1,78 @@ +/* + * 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 call_setting { + + inline AoSequencer &AoSequencer::processDefault() + { + if (!m_isComplete) { + doProcessAo(nullptr); + } + return *this; + } + + template + inline AoSequencer &AoSequencer::process(const ITEM &item) + { + if (!m_isComplete) { + doProcess(item); + } + return *this; + } + + template + inline AoSequencer &AoSequencer::processEach(const ITEMS &items) + { + if (!m_isComplete) { + for (const auto &item: items) { + doProcess(item); + if (m_isComplete) { + break; + } + } + } + return *this; + } + + template + inline AoSequencer &AoSequencer::processEach( + const ITERATOR begin, const ITERATOR end) + { + if (!m_isComplete) { + for (auto it = begin; it != end; ++it) { + doProcess(*it); + if (m_isComplete) { + break; + } + } + } + return *this; + } + + inline const Elm_Interface_Atspi_Accessible *AoSequencer::getNext() + { + return m_next; + } + + template + inline void AoSequencer::doProcess(const ITEM &item) + { + using ucl::as_ao; + if (const auto itemAo = as_ao(item)) { + doProcessAo(itemAo); + } + } +} diff --git a/ucl/include/ucl/gui/Atspi.h b/ucl/include/ucl/gui/Atspi.h index 56a8b07..16db2b6 100644 --- a/ucl/include/ucl/gui/Atspi.h +++ b/ucl/include/ucl/gui/Atspi.h @@ -157,16 +157,16 @@ namespace ucl { * @param[in] relation Pointer to relation Access object */ void addRelationship(Elm_Atspi_Relation_Type type, - Elm_Interface_Atspi_Accessible *relation); + const Elm_Interface_Atspi_Accessible *relation); /** * @brief Deletes exiting relationship * @param[in] type Type of the exiting relationship * @param[in] relation Pointer to relation Access object, - * or NULL for all relations of the type + * or NULL for all relations of the type (optional) */ void delRelationship(Elm_Atspi_Relation_Type type, - Elm_Interface_Atspi_Accessible *relation); + const Elm_Interface_Atspi_Accessible *relation = nullptr); /** * @brief Deletes all exiting relationships @@ -223,10 +223,38 @@ namespace ucl { * @return Pointer to Access object or NULL */ template - inline auto as_ao(const T &ptr) -> decltype(as_ao(*ptr)) + inline auto as_ao(const T &ptr) -> typename std::enable_if< + std::is_convertible::value, decltype(as_ao(*ptr))>::type { return (ptr ? as_ao(*ptr) : nullptr); } + + /** + * @brief Gets Access object from iterator + * @param[in] ptr Target object iterator + * @return Pointer to Access object or NULL + */ + template + inline auto as_ao(const T &iter) -> typename std::enable_if< + !std::is_convertible::value, decltype(as_ao(*iter))>::type + { + return as_ao(*iter); + } + + /** + * @brief Passes through original Access object pointer + * @param[in] ao Access object pointer + * @return Access object pointer + */ + Elm_Interface_Atspi_Accessible *as_ao(Elm_Interface_Atspi_Accessible *ao); + + /** + * @brief Passes through original constant Access object pointer + * @param[in] ao Constant Access object pointer + * @return Constant acces object pointer + */ + const Elm_Interface_Atspi_Accessible *as_ao( + const Elm_Interface_Atspi_Accessible *ao); } #include "Atspi.hpp" diff --git a/ucl/include/ucl/gui/Atspi.hpp b/ucl/include/ucl/gui/Atspi.hpp index e9b1309..0a3e267 100644 --- a/ucl/include/ucl/gui/Atspi.hpp +++ b/ucl/include/ucl/gui/Atspi.hpp @@ -115,13 +115,13 @@ namespace ucl { } inline void Atspi::addRelationship(const Elm_Atspi_Relation_Type type, - Elm_Interface_Atspi_Accessible *const relation) + const Elm_Interface_Atspi_Accessible *const relation) { elm_atspi_accessible_relationship_append(getAo(), type, relation); } inline void Atspi::delRelationship(const Elm_Atspi_Relation_Type type, - Elm_Interface_Atspi_Accessible *const relation) + const Elm_Interface_Atspi_Accessible *const relation) { elm_atspi_accessible_relationship_remove(getAo(), type, relation); } @@ -239,4 +239,16 @@ namespace ucl { { return atspi.m_ao; } + + inline Elm_Interface_Atspi_Accessible *as_ao( + Elm_Interface_Atspi_Accessible *const ao) + { + return ao; + } + + inline const Elm_Interface_Atspi_Accessible *as_ao( + const Elm_Interface_Atspi_Accessible *const ao) + { + return ao; + } } -- cgit v1.2.3 From 4fa2eb57251d57581d95e241a8d6aed2ac60b119 Mon Sep 17 00:00:00 2001 From: Igor Olshevskyi Date: Fri, 13 Oct 2017 13:34:50 +0300 Subject: TizenRefApp-9612 [Call Setting] Implement Screen Reader support in Voicemail Keypad Change-Id: I1c1c87899f7f9cec44299da6c810dac85d82998f --- .../presenters/misc/AtspiHighlightHelper.cpp | 147 +++++++++++++++++ .../presenters/misc/AtspiHighlightHelper.h | 93 +++++++++++ call-setting/presenters/misc/KeypadPresenter.cpp | 182 +++++++++++++++++---- call-setting/presenters/misc/KeypadPresenter.h | 33 +++- .../presenters/misc/ProcessingPresenter.cpp | 2 - call-setting/presenters/pages/KeypadPage.cpp | 41 ++++- call-setting/presenters/pages/KeypadPage.h | 9 + call-setting/resources.cpp | 13 ++ call-setting/resources.h | 9 + call-setting/view/helpers.cpp | 52 +++++- call-setting/view/helpers.h | 2 + edc/layouts.edc | 51 +++++- project_def.prop | 2 +- 13 files changed, 584 insertions(+), 52 deletions(-) create mode 100644 call-setting/presenters/misc/AtspiHighlightHelper.cpp create mode 100644 call-setting/presenters/misc/AtspiHighlightHelper.h diff --git a/call-setting/presenters/misc/AtspiHighlightHelper.cpp b/call-setting/presenters/misc/AtspiHighlightHelper.cpp new file mode 100644 index 0000000..5b9dc75 --- /dev/null +++ b/call-setting/presenters/misc/AtspiHighlightHelper.cpp @@ -0,0 +1,147 @@ +/* + * 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 "AtspiHighlightHelper.h" + +#include "call-setting/presenters/common.h" + +namespace call_setting { namespace { namespace impl { + + constexpr EoDataKey ATSPI_HELPER_DATA {"callui,atspi,highlight,helper"}; +}}} + +namespace call_setting { + + using ucl::AtspiGestureEventInfo; + using ucl::Atspi; + using ucl::ListItemPresenter; + + AtspiHighlightHelperSRef AtspiHighlightHelper::newInstance( + GuiPresenter &parent) + { + auto result = makeShared(); + + FAIL_RETURN_VALUE(result->prepare(parent), {}, + "result->prepare() failed!"); + + return result; + } + + AtspiHighlightHelper::AtspiHighlightHelper(IRefCountObj &rc) : + GuiPresenter(rc) + { + } + + Result AtspiHighlightHelper::prepare(GuiPresenter &parent) + { + FAIL_RETURN(GuiPresenter::prepare(parent), + "GuiPresenter::prepare() failed!"); + + return RES_OK; + } + + void AtspiHighlightHelper::setEventHandler( + EventHandler handler) + { + m_eventHandler = handler; + } + + void AtspiHighlightHelper::registerObject(ElmWidget &widget) + { + widget.getAtspi().addGestureHandler( + WEAK_DELEGATE_THIS(onAtspiGesture)); + } + + void AtspiHighlightHelper::registerObject(ListItemPresenter &listItemPrs) + { + listItemPrs.setItemAtspiGestureHandler( + WEAK_DELEGATE_THIS(onAtspiGesture)); + } + + void AtspiHighlightHelper::handleAtspiGesture(Atspi &atspi, + AtspiGestureEventInfo &e) + { + Elm_Interface_Atspi_Accessible *currentAo = as_ao(atspi); + DLOG("Access object [%p]", currentAo); + + if (!isActive()) { + DLOG("Ignored. Presenter is not active"); + if (e.gestureInfo.type != ELM_ATSPI_GESTURE_ONE_FINGER_SINGLE_TAP) { + DLOG("Prevent default handler"); + e.preventDefault = true; + } + return; + } + + e.stopPropagation = true; + e.preventDefault = false; + + const Elm_Atspi_Relation_Type relation = getFlowRelation(e.gestureInfo); + if (relation == ELM_ATSPI_RELATION_NULL) { + DLOG("Not supported gesture type for processing"); + return; + } + + const Elm_Interface_Atspi_Accessible *relationAo = nullptr; + if (const auto handler = m_eventHandler.lock()) { + relationAo = handler(currentAo, relation); + } + if (!relationAo) { + DLOG("Relation object is NULL"); + return; + } + DLOG("Relation object [%p]", relationAo); + + if (currentAo == as_ao(getWindow())) { + const auto fakeAtspi = getFakeAtspi(); + if (!fakeAtspi) { + LOG_RETURN_VOID(RES_FAIL, "fakeAtspi is NULL!"); + } + currentAo = as_ao(*fakeAtspi); + fakeAtspi->highlight(); + } + + Atspi currentAtspi {currentAo}; + currentAtspi.delRelationship(relation, nullptr); + currentAtspi.addRelationship(relation, relationAo); + } + + Atspi *AtspiHighlightHelper::getFakeAtspi() + { + auto &win = getWindow(); + auto widget = static_cast(win.getData( + impl::ATSPI_HELPER_DATA)); + + if (!widget) { + const ElmWidgetSRef obj = util::createFakeAccessObject(win); + if (!obj) { + LOG_RETURN_VALUE(RES_FAIL, nullptr, + "createFakeAccessObject() failed!"); + } + obj->setIsOwner(false); + widget = obj.get(); + win.setData(impl::ATSPI_HELPER_DATA, widget); + } + + return &widget->getAtspi(); + } + + void AtspiHighlightHelper::onAtspiGesture(Atspi &atspi, + AtspiGestureEventInfo &eventInfo) + { + handleAtspiGesture(atspi, eventInfo); + } +} diff --git a/call-setting/presenters/misc/AtspiHighlightHelper.h b/call-setting/presenters/misc/AtspiHighlightHelper.h new file mode 100644 index 0000000..146c2ff --- /dev/null +++ b/call-setting/presenters/misc/AtspiHighlightHelper.h @@ -0,0 +1,93 @@ +/* + * 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 __CALL_SETTING_PRESENTERS_MISC_ATSPI_HIGHLIGHT_HELPER_H__ +#define __CALL_SETTING_PRESENTERS_MISC_ATSPI_HIGHLIGHT_HELPER_H__ + +#include "ucl/mvp/GuiPresenter.h" +#include "ucl/mvp/ListItemPresenter.h" + +#include "call-setting/presenters/types.h" + +namespace call_setting { + + UCL_DECLARE_REF_ALIASES(AtspiHighlightHelper); + + /** + * @brief Represents helper presenter for Screen Reader feature + */ + class AtspiHighlightHelper final : public ucl::GuiPresenter { + public: + + /** + * @brief Event handler definition + */ + using EventHandler = ucl::WeakDelegate< + const Elm_Interface_Atspi_Accessible *( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation)>; + + public: + + /** + * @brief Creates new instance of AtspiHighlightHelper + * @param[in] parent Parent presenter + * @return Shared reference to AtspiHighlightHelper instance + * on success or NULL otherwise + */ + static AtspiHighlightHelperSRef newInstance(GuiPresenter &parent); + + /** + * @brief Sets event handler + * @param[in] handler Event handler + */ + void setEventHandler(EventHandler handler); + + /** + * @brief Registers widget for handling Atspi gesture events + * @param[in] widget Widget to register + */ + void registerObject(ucl::ElmWidget &widget); + + /** + * @brief Registers List Item presenter for handling Atspi + * gesture events + * @param[in] listItemPrs List item presenter to register + */ + void registerObject(ucl::ListItemPresenter &listItemPrs); + + private: + AtspiHighlightHelper(ucl::IRefCountObj &rc); + ~AtspiHighlightHelper() = default; + + ucl::Result prepare(GuiPresenter &parent); + + void handleAtspiGesture(ucl::Atspi &atspi, + ucl::AtspiGestureEventInfo &e); + + void onAtspiGesture(ucl::Atspi &atspi, + ucl::AtspiGestureEventInfo &eventInfo); + + ucl::Atspi *getFakeAtspi(); + + private: + EventHandler m_eventHandler; + + friend class ucl::ReffedObj; + }; +} + +#endif // __CALL_SETTING_PRESENTERS_MISC_ATSPI_HIGHLIGHT_HELPER_H__ diff --git a/call-setting/presenters/misc/KeypadPresenter.cpp b/call-setting/presenters/misc/KeypadPresenter.cpp index c38b3e6..686914d 100644 --- a/call-setting/presenters/misc/KeypadPresenter.cpp +++ b/call-setting/presenters/misc/KeypadPresenter.cpp @@ -18,7 +18,10 @@ #include +#include "ucl/gui/helpers.h" + #include "call-setting/view/KeypadNumberBtn.h" +#include "call-setting/view/AoSequencer.h" #include "call-setting/resources.h" @@ -36,41 +39,65 @@ namespace call_setting { namespace { namespace impl { constexpr EdjePart PART_ENTRY {"swl.entry"}; constexpr EdjePart PART_GUIDE_TXT {"txt.guide"}; + constexpr EdjePart PART_AO_ENTRY {"ao.entry"}; + constexpr EoDataKey BTN_DATA_KEY {"__btn_data__"}; constexpr EdjeSignal SIGNAL_SHOW_GUIDE_TXT {"guide.txt.show"}; constexpr EdjeSignal SIGNAL_HIDE_GUIDE_TXT {"guide.txt.hide"}; constexpr EdjeSignalSrc SIGNAL_SRC_KEYPAD {"keypad"}; + const TString STR_EMPTY; + struct BtnInfo { - KeypadNumberBtn::Info info; + KeypadNumberBtn::Info baseInfo; EdjePart part; + const TString &srDesc; }; const BtnInfo BtnInfoList[] = { {{ElmStyle {"callsetting/keypad_00"}, "0", nullptr, nullptr, - KeypadNumberBtn::SymbolState::HIDDEN}, EdjePart {"swl.btn.0"}}, + KeypadNumberBtn::SymbolState::HIDDEN}, EdjePart {"swl.btn.0"}, + STR_EMPTY}, + {{ElmStyle {"callsetting/keypad_01"}, "1", nullptr, nullptr, - KeypadNumberBtn::SymbolState::HIDDEN}, EdjePart {"swl.btn.1"}}, + KeypadNumberBtn::SymbolState::HIDDEN}, EdjePart {"swl.btn.1"}, + STR_EMPTY}, + {{ElmStyle {"callsetting/keypad_02"}, "2", "ABC", nullptr, - KeypadNumberBtn::SymbolState::HIDDEN}, EdjePart {"swl.btn.2"}}, + KeypadNumberBtn::SymbolState::HIDDEN}, EdjePart {"swl.btn.2"}, + STR_EMPTY}, + {{ElmStyle {"callsetting/keypad_03"}, "3", "DFE", "#", - KeypadNumberBtn::SymbolState::BELOW}, EdjePart {"swl.btn.3"}}, + KeypadNumberBtn::SymbolState::BELOW}, EdjePart {"swl.btn.3"}, + STR_SR_DOUBLE_TAP_AND_HOLD_TO_ENTER_NUMBER_SYMBOL}, + {{ElmStyle {"callsetting/keypad_04"}, "4", "GHI", nullptr, - KeypadNumberBtn::SymbolState::HIDDEN}, EdjePart {"swl.btn.4"}}, + KeypadNumberBtn::SymbolState::HIDDEN}, EdjePart {"swl.btn.4"}, + STR_EMPTY}, + {{ElmStyle {"callsetting/keypad_05"}, "5", "JKL", "+", - KeypadNumberBtn::SymbolState::RIGHT}, EdjePart {"swl.btn.5"}}, + KeypadNumberBtn::SymbolState::RIGHT}, EdjePart {"swl.btn.5"}, + STR_SR_DOUBLE_TAP_AND_HOLD_TO_ENTER_PLUS_SYMBOL}, + {{ElmStyle {"callsetting/keypad_06"}, "6", "MNO", nullptr, - KeypadNumberBtn::SymbolState::HIDDEN}, EdjePart {"swl.btn.6"}}, + KeypadNumberBtn::SymbolState::HIDDEN}, EdjePart {"swl.btn.6"}, + STR_EMPTY}, + {{ElmStyle {"callsetting/keypad_07"}, "7", "PQRS", "*", - KeypadNumberBtn::SymbolState::BELOW}, EdjePart {"swl.btn.7"}}, + KeypadNumberBtn::SymbolState::BELOW}, EdjePart {"swl.btn.7"}, + STR_SR_DOUBLE_TAP_AND_HOLD_TO_ENTER_STAR_SYMBOL}, + {{ElmStyle {"callsetting/keypad_08"}, "8", "TUV", nullptr, - KeypadNumberBtn::SymbolState::HIDDEN}, EdjePart {"swl.btn.8"}}, + KeypadNumberBtn::SymbolState::HIDDEN}, EdjePart {"swl.btn.8"}, + STR_EMPTY}, + {{ElmStyle {"callsetting/keypad_09"}, "9", "WXYZ", nullptr, - KeypadNumberBtn::SymbolState::HIDDEN}, EdjePart {"swl.btn.9"}} + KeypadNumberBtn::SymbolState::HIDDEN}, EdjePart {"swl.btn.9"}, + STR_EMPTY}, }; - constexpr int BTNS_COUNT = sizeof(BtnInfoList) / sizeof(BtnInfoList[0]); + constexpr auto ENTRY_NAME_BUFFER_SIZE = 256; void *asData(const int index) { @@ -93,6 +120,7 @@ namespace call_setting { namespace { namespace impl { namespace call_setting { using ucl::Layout; + using ucl::Atspi; // KeypadPresenter::Builder // @@ -167,12 +195,18 @@ namespace call_setting { FAIL_RETURN(createEntry(number), "createEntry() failed!"); + FAIL_RETURN(createEntryAo(), + "createEntryAo() failed!"); + FAIL_RETURN(createBackspaceButton(), "createBackspaceButton() failed!"); FAIL_RETURN(createNumberButtons(), "createNumberButtons() failed!"); + FAIL_RETURN(createAtspiHighlightHelper(), + "createAtspiHighlightHelper() failed!"); + return RES_OK; } @@ -195,6 +229,8 @@ namespace call_setting { LOG_RETURN(RES_FAIL, "Layout::build() failed!"); } + setDeactivatorSink(m_widget); + m_widget->setText(STR_KEYPAD_GUIDE_TEXT, impl::PART_GUIDE_TXT); @@ -207,13 +243,15 @@ namespace call_setting { if (!eo) { LOG_RETURN(RES_FAIL, "eo is NULL"); } - auto confirmBtn = makeShared(eo, false); - m_widget->setContent(*confirmBtn, impl::PART_CONFIRM_BTN); + m_confirmBtn = makeShared(eo, false); + m_widget->setContent(*m_confirmBtn, impl::PART_CONFIRM_BTN); - confirmBtn->setStyle(impl::STYLE_BTN_CONFIRM); - confirmBtn->addEventHandler(BTN_CLICKED, + m_confirmBtn->setStyle(impl::STYLE_BTN_CONFIRM); + m_confirmBtn->addEventHandler(BTN_CLICKED, WEAK_DELEGATE_THIS(onConfirmBtnClicked)); + m_confirmBtn->getAtspi().setName(STR_SR_CONFIRM.getCStr()); + return RES_OK; } @@ -227,19 +265,21 @@ namespace call_setting { Result KeypadPresenter::createBackspaceButton() { - auto backspaceBtn = KeypadBackspaceBtn::newInstance(*m_widget); - if (!backspaceBtn) { + m_backspaceBtn = KeypadBackspaceBtn::newInstance(*m_widget); + if (!m_backspaceBtn) { LOG_RETURN(RES_FAIL, "m_backspaceBtn is NULL"); } - m_widget->setContent(*backspaceBtn, impl::PART_BACKSPACE_BTN); - backspaceBtn->setIsOwner(false); + m_widget->setContent(*m_backspaceBtn, impl::PART_BACKSPACE_BTN); + m_backspaceBtn->setIsOwner(false); - backspaceBtn->addEventHandler(BTN_CLICKED, + m_backspaceBtn->addEventHandler(BTN_CLICKED, WEAK_DELEGATE_THIS(onBackspaceBtnClicked)); - backspaceBtn->addEventHandler(CS_BTN_LONGPRESSED, + m_backspaceBtn->addEventHandler(CS_BTN_LONGPRESSED, WEAK_DELEGATE_THIS(onBackspaceLongPressed)); + m_backspaceBtn->getAtspi().setName(STR_SR_BACKSPACE.getCStr()); + return RES_OK; } @@ -270,6 +310,41 @@ namespace call_setting { if (!number.empty()) { m_entry->setNumber(number); } + m_entry->getAtspi().setHighlightable(false); + + return RES_OK; + } + + CString KeypadPresenter::onAtspiEntryNameCb(Atspi &atspi) + { + char buffer[impl::ENTRY_NAME_BUFFER_SIZE] = { 0 }; + snprintf(buffer, sizeof(buffer), "%s, %s", + STR_SR_EDIT_BOX.translate(), + STR_SR_KEYPAD.translate()); + + return CString::dup(buffer); + } + + CString KeypadPresenter::onAtspiEntryDescriptionCb(Atspi &atspi) + { + auto number = m_entry->getNumber(); + if (number.empty()) { + return CString::dup(STR_SR_EMPTY.translate()); + } + return CString::dup(number.c_str()); + } + + Result KeypadPresenter::createEntryAo() + { + m_aoEntry = util::createAccessObject(*m_widget, impl::PART_AO_ENTRY); + + auto &atspi = m_aoEntry->getAtspi(); + + atspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME | + ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION); + + atspi.setNameCb(WEAK_DELEGATE_THIS(onAtspiEntryNameCb)); + atspi.setDescriptionCb(WEAK_DELEGATE_THIS(onAtspiEntryDescriptionCb)); return RES_OK; } @@ -287,21 +362,32 @@ namespace call_setting { Result KeypadPresenter::createNumberButtons() { - for (int i = 0; i < impl::BTNS_COUNT; i++) { + const auto btnsCount = sizeof(impl::BtnInfoList) / + sizeof(impl::BtnInfoList[0]); + for (int i = 0; i < btnsCount; i++) { + const auto &btnInfo = impl::BtnInfoList[i]; + auto btn = KeypadNumberBtn::newInstance(*m_widget, - impl::BtnInfoList[i].info); + btnInfo.baseInfo); if (!btn) { LOG_RETURN(RES_FAIL, "btn is NULL"); } - btn->setData(impl::BTN_DATA_KEY, impl::asData(i)); - m_widget->setContent(*btn, impl::BtnInfoList[i].part); + m_widget->setContent(*btn, btnInfo.part); btn->addEventHandler(BTN_CLICKED, WEAK_DELEGATE_THIS(onNumberBtnClicked)); btn->addEventHandler(CS_BTN_LONGPRESSED, WEAK_DELEGATE_THIS(onNumberBtnLongPressed)); + + auto &atspi = btn->getAtspi(); + atspi.setName(btnInfo.baseInfo.digit); + + if (isNotEmpty(btnInfo.srDesc)) { + atspi.setDescription(btnInfo.srDesc.getCStr()); + } + m_numberBtns.emplace_back(std::move(btn)); } return RES_OK; @@ -310,13 +396,53 @@ namespace call_setting { void KeypadPresenter::onNumberBtnClicked(Widget &widget, void *eventInfo) { - m_entry->insert(impl::BtnInfoList[impl::getIndex(widget)].info.digit); + m_entry->insert(impl::BtnInfoList[impl::getIndex(widget)]. + baseInfo.digit); } void KeypadPresenter::onNumberBtnLongPressed(Widget &widget, void *eventInfo) { - m_entry->insert(impl::BtnInfoList[impl::getIndex(widget)].info.symbol); + m_entry->insert(impl::BtnInfoList[impl::getIndex(widget)]. + baseInfo.symbol); + } + + Elm_Interface_Atspi_Accessible *KeypadPresenter::getAccessObject( + bool isFlowsTo) + { + return (isFlowsTo ? as_ao(*m_numberBtns[0]) : as_ao(*m_backspaceBtn)); + } + + Result KeypadPresenter::createAtspiHighlightHelper() + { + m_atspiHelper = AtspiHighlightHelper::newInstance(*this); + if (!m_atspiHelper) { + LOG_RETURN(RES_FAIL, + "AtspiHighlightHelper::newInstance() failed!"); + } + + for (auto &btn: m_numberBtns) { + m_atspiHelper->registerObject(*btn); + } + m_atspiHelper->registerObject(*m_confirmBtn); + m_atspiHelper->registerObject(*m_backspaceBtn); + m_atspiHelper->registerObject(*m_aoEntry); + + m_atspiHelper->setEventHandler(WEAK_DELEGATE_THIS(onAtspiHighlight)); + + return RES_OK; + } + + const Elm_Interface_Atspi_Accessible *KeypadPresenter::onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation) + { + return AoSequencer(ao, flowRelation) + .processEach(m_numberBtns) + .process(*m_confirmBtn) + .process(*m_aoEntry) + .process(*m_backspaceBtn) + .getNext(); } } diff --git a/call-setting/presenters/misc/KeypadPresenter.h b/call-setting/presenters/misc/KeypadPresenter.h index 75aae7b..d293cdc 100644 --- a/call-setting/presenters/misc/KeypadPresenter.h +++ b/call-setting/presenters/misc/KeypadPresenter.h @@ -23,8 +23,11 @@ #include "ucl/gui/StyledWidget.h" #include "ucl/misc/Timeout.h" -#include "call-setting/view/KeypadEntry.h" #include "call-setting/view/KeypadBackspaceBtn.h" +#include "call-setting/view/KeypadEntry.h" +#include "call-setting/view/KeypadNumberBtn.h" + +#include "AtspiHighlightHelper.h" #include "call-setting/presenters/types.h" @@ -94,10 +97,22 @@ namespace call_setting { /** * @brief Gets widget - * @return Widget object. @see ucl::Widget + * @return Reference to Widget object */ ucl::Widget &getWidget(); + /** + * @brief Gets access object by accessibility flow direction to/from + * current object + * @remark This function can be used for external object request when + * external object handles Atspi event on change + * Screen Reader highlight on next/previous object. + * @param[in] isFlowsTo Defines whether external object handles + * flows to or from highlight change event + * @return Access object on success, otherwise NULL + */ + Elm_Interface_Atspi_Accessible *getAccessObject(bool isFlowsTo); + private: KeypadPresenter(ucl::IRefCountObj &rc, NotiHandler handler, @@ -113,6 +128,8 @@ namespace call_setting { ucl::Result createBackspaceButton(); ucl::Result createNumberButtons(); ucl::Result createEntry(const std::string &number); + ucl::Result createEntryAo(); + ucl::Result createAtspiHighlightHelper(); void onNumberBtnClicked(ucl::Widget &widget, void *eventInfo); void onNumberBtnLongPressed(ucl::Widget &widget, void *eventInfo); @@ -121,11 +138,23 @@ namespace call_setting { void onEntryChanged(ucl::Widget &widget, void *eventInfo); void onConfirmBtnClicked(ucl::Widget &widget, void *eventInfo); + ucl::CString onAtspiEntryNameCb(ucl::Atspi &atspi); + ucl::CString onAtspiEntryDescriptionCb(ucl::Atspi &atspi); + + const Elm_Interface_Atspi_Accessible *onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *current, + Elm_Atspi_Relation_Type flowRelation); + private: const NotiHandler m_completeHandler; ucl::LayoutSRef m_widget; + AtspiHighlightHelperSRef m_atspiHelper; + std::vector m_numberBtns; + KeypadBackspaceBtnSRef m_backspaceBtn; + ucl::StyledWidgetSRef m_confirmBtn; KeypadEntrySRef m_entry; + ucl::ElmWidgetSRef m_aoEntry; friend class ucl::ReffedObj; }; diff --git a/call-setting/presenters/misc/ProcessingPresenter.cpp b/call-setting/presenters/misc/ProcessingPresenter.cpp index c9898df..cb92ec2 100644 --- a/call-setting/presenters/misc/ProcessingPresenter.cpp +++ b/call-setting/presenters/misc/ProcessingPresenter.cpp @@ -303,8 +303,6 @@ namespace call_setting { m_iconType = iconType; m_selfRef = asShared(*this); - - tryFinish(); } } diff --git a/call-setting/presenters/pages/KeypadPage.cpp b/call-setting/presenters/pages/KeypadPage.cpp index 459ece2..088e2f9 100644 --- a/call-setting/presenters/pages/KeypadPage.cpp +++ b/call-setting/presenters/pages/KeypadPage.cpp @@ -80,6 +80,22 @@ namespace call_setting { } Result KeypadPage::doPrepare(NaviItem &item) + { + FAIL_RETURN(createKeypadPresenter(), + "createKeypadPresenter() failed!"); + + FAIL_RETURN(createAtspiHighlightHelper(), + "createAtspiHighlightHelper() failed!"); + + item = getNaviframe().push(getContent()); + if (!item) { + LOG_RETURN(RES_FAIL, "Naviframe::push() failed!"); + } + + return RES_OK; + } + + Result KeypadPage::createKeypadPresenter() { m_keypadPrs = KeypadPresenter::Builder(). setNumber(m_model->getNumber()). @@ -92,11 +108,6 @@ namespace call_setting { } getContent().set(m_keypadPrs->getWidget()); - item = getNaviframe().push(getContent()); - if (!item) { - LOG_RETURN(RES_FAIL, "Naviframe::push() failed!"); - } - return RES_OK; } @@ -109,5 +120,25 @@ namespace call_setting { requestExit(); } + Result KeypadPage::createAtspiHighlightHelper() + { + m_atspiHelper = AtspiHighlightHelper::newInstance(*this); + if (!m_atspiHelper) { + LOG_RETURN(RES_FAIL, "AtspiHighlightHelper::newInstance() failed!"); + } + m_atspiHelper->registerObject(getWindow()); + + m_atspiHelper->setEventHandler(WEAK_DELEGATE_THIS(onAtspiHighlight)); + + return RES_OK; + } + + const Elm_Interface_Atspi_Accessible *KeypadPage::onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation) + { + return m_keypadPrs->getAccessObject(true); + } + } diff --git a/call-setting/presenters/pages/KeypadPage.h b/call-setting/presenters/pages/KeypadPage.h index 7c62581..b68cf0f 100644 --- a/call-setting/presenters/pages/KeypadPage.h +++ b/call-setting/presenters/pages/KeypadPage.h @@ -19,6 +19,7 @@ #include "base/Page.h" +#include "call-setting/presenters/misc/AtspiHighlightHelper.h" #include "call-setting/presenters/misc/KeypadPresenter.h" #include "call-setting/model/Voicemail.h" @@ -51,11 +52,19 @@ namespace call_setting { ~KeypadPage() = default; ucl::Result doPrepare(ucl::NaviItem &item); + + ucl::Result createKeypadPresenter(); void onKeypadComplete(); + ucl::Result createAtspiHighlightHelper(); + const Elm_Interface_Atspi_Accessible *onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation); + private: const VoicemailSRef m_model; KeypadPresenterSRef m_keypadPrs; + AtspiHighlightHelperSRef m_atspiHelper; friend class ucl::ReffedObj; }; diff --git a/call-setting/resources.cpp b/call-setting/resources.cpp index 76d5c85..1942af0 100644 --- a/call-setting/resources.cpp +++ b/call-setting/resources.cpp @@ -78,4 +78,17 @@ namespace call_setting { const TString STR_KEYPAD_GUIDE_TEXT { "WDS_CST_BODY_VOICEMAIL_NUMBER", TEXT_DOMAIN}; + + // TODO: Need to change on proper IDS strings + const TString STR_SR_DOUBLE_TAP_AND_HOLD_TO_ENTER_NUMBER_SYMBOL { + "Double tap and hold to enter # symbol"}; + const TString STR_SR_DOUBLE_TAP_AND_HOLD_TO_ENTER_PLUS_SYMBOL { + "Double tap and hold to enter plus symbol"}; + const TString STR_SR_DOUBLE_TAP_AND_HOLD_TO_ENTER_STAR_SYMBOL { + "Double tap and hold to enter star symbol"}; + const TString STR_SR_CONFIRM {"Confirm"}; + const TString STR_SR_BACKSPACE {"Backspace"}; + const TString STR_SR_EDIT_BOX {"Edit box"}; + const TString STR_SR_KEYPAD {"Keypad"}; + const TString STR_SR_EMPTY {"Empty"}; } diff --git a/call-setting/resources.h b/call-setting/resources.h index 359e7d9..e16f959 100644 --- a/call-setting/resources.h +++ b/call-setting/resources.h @@ -60,6 +60,15 @@ namespace call_setting { extern const ucl::TString STR_NUMBER_SETTING_ITEM_SUB_TEXT; extern const ucl::TString STR_KEYPAD_GUIDE_TEXT; + + extern const ucl::TString STR_SR_DOUBLE_TAP_AND_HOLD_TO_ENTER_NUMBER_SYMBOL; + extern const ucl::TString STR_SR_DOUBLE_TAP_AND_HOLD_TO_ENTER_PLUS_SYMBOL; + extern const ucl::TString STR_SR_DOUBLE_TAP_AND_HOLD_TO_ENTER_STAR_SYMBOL; + extern const ucl::TString STR_SR_CONFIRM; + extern const ucl::TString STR_SR_BACKSPACE; + extern const ucl::TString STR_SR_EDIT_BOX; + extern const ucl::TString STR_SR_KEYPAD; + extern const ucl::TString STR_SR_EMPTY; } #endif // __CALL_SETTING_RESOURCES_H__ diff --git a/call-setting/view/helpers.cpp b/call-setting/view/helpers.cpp index 1c6c0f4..11e5cc0 100644 --- a/call-setting/view/helpers.cpp +++ b/call-setting/view/helpers.cpp @@ -33,6 +33,8 @@ namespace call_setting { namespace { namespace impl { namespace call_setting { namespace util { + using ucl::Atspi; + using ucl::AtspiGestureEventInfo; using ucl::Layout; using ucl::Naviframe; @@ -90,17 +92,55 @@ namespace call_setting { namespace util { result->setGeometry(0, 0, 1, 1); show(*result); - elm_atspi_accessible_reading_info_type_set(as_ao(*result), 0); + struct FakeHandler { + SharedRef selfRef; - elm_atspi_accessible_gesture_cb_set(as_ao(*result), - [](void *, Elm_Atspi_Gesture_Info, Evas_Object *) -> Eina_Bool + void onGestureCb(Atspi &atspi, + AtspiGestureEventInfo &eventInfo) { - return EINA_TRUE; - }, - nullptr); + eventInfo.preventDefault = true; + } + }; + + auto fh = makeShared(); + fh->selfRef = fh; + + evas_object_event_callback_add(as_eo(*result), EVAS_CALLBACK_DEL, + [](void *data, Evas *e, Evas_Object *obj, void *event_info) + { + static_cast(data)->selfRef.reset(); + }, fh.get()); + + auto &atspi = result->getAtspi(); + atspi.setReadingInfo(0); + atspi.addGestureHandler(WEAK_DELEGATE(FakeHandler::onGestureCb, fh)); return result; } + + ElmWidgetSRef createAccessObject(EdjeWidget &widget, EdjePart part) + { + auto edjeLy = elm_layout_edje_get(as_eo(widget)); + if (!edjeLy) { + LOG_RETURN_VALUE(RES_FAIL, {}, + "elm_layout_edje_get() failed!"); + } + + auto edjeObj = const_cast( + edje_object_part_object_get(edjeLy, part.name)); + if (!edjeObj) { + LOG_RETURN_VALUE(RES_FAIL, {}, + "edje_object_part_object_get() failed!"); + } + + auto ao = elm_access_object_register(edjeObj, as_eo(widget)); + if (!ao) { + LOG_RETURN_VALUE(RES_FAIL, {}, + "elm_access_object_register() failed!"); + } + + return makeShared(ao); + } }} namespace call_setting { diff --git a/call-setting/view/helpers.h b/call-setting/view/helpers.h index 378abad..e5a8ec4 100644 --- a/call-setting/view/helpers.h +++ b/call-setting/view/helpers.h @@ -27,6 +27,8 @@ namespace call_setting { namespace util { Eext_Circle_Surface *getCircleSurface(const ucl::ElmWidget &widget); ucl::ElmWidgetSRef createFakeAccessObject(ucl::ElmWidget &parent); + ucl::ElmWidgetSRef createAccessObject(ucl::EdjeWidget &widget, + ucl::EdjePart part); }} namespace call_setting { diff --git a/edc/layouts.edc b/edc/layouts.edc index 2220d33..8a1755a 100644 --- a/edc/layouts.edc +++ b/edc/layouts.edc @@ -233,9 +233,8 @@ group { "elm/layout/callsetting/keypad"; clip: "clipper.number"; desc { "default"; fixed: 0 1; - min: 0 66; - rel1 { relative: 1.0 0.5; to_x: "spacer.number.left"; } - rel2 { relative: 0.0 0.5; to_x: "spacer.number.right"; } + min: 208 39; + max: 208 39; hid; } desc { "visible"; @@ -282,22 +281,54 @@ group { "elm/layout/callsetting/keypad"; CS_SWL_NUMBER_BUTTON("swl.btn.7", 0, 181, 113, 285) CS_SWL_NUMBER_BUTTON("swl.btn.8", 0, 75, 113, 179) CS_SWL_NUMBER_BUTTON("swl.btn.9", 35, 9, 154, 131) + spacer { "swl.confirm.pad.top"; + scale; + desc { "default"; + fixed: 0 1; + align: 0.5 0.0; + rel2 { relative: 1.0 0.0; } + min: 0 82; + } + } swallow { "swl.confirm"; scale; desc { "default"; fixed: 1 1; + align: 0.5 0.0; + rel1 { relative: 0.5 1.0; to_y: "swl.confirm.pad.top"; } + rel2 { relative: 0.5 1.0; to_y: "swl.confirm.pad.top"; } + } + } + spacer { "swl.backspace.pad.bottom"; + scale; + desc { "default"; + fixed: 0 1; align: 0.5 1.0; - rel1 { relative: 0.5 0.0; to_y: "swl.entry"; } - rel2 { relative: 0.5 0.0; to_y: "swl.entry"; } + rel1 { relative: 0.0 1.0; } + min: 0 83; } } swallow { "swl.backspace"; scale; desc { "default"; fixed: 1 1; - align: 0.5 0.0; - rel1 { relative: 0.5 1.0; to_y: "swl.entry"; } - rel2 { relative: 0.5 1.0; to_y: "swl.entry"; } + align: 0.5 1.0; + rel1 { relative: 0.5 0.0; to_y: "swl.backspace.pad.bottom"; } + rel2 { relative: 0.5 0.0; to_y: "swl.backspace.pad.bottom"; } + } + } + rect { "ao.entry"; + scale; + mouse; + desc { "default"; + fixed: 1 1; + rel.to: "txt.guide"; + color: CS_COLOR_TRANSPARENT; + } + desc { "entry_size"; + inherit: "default"; + rel.to: "swl.entry"; + color: CS_COLOR_TRANSPARENT; } } } @@ -310,6 +341,8 @@ group { "elm/layout/callsetting/keypad"; target: "txt.guide"; action: STATE_SET "default"; targets: "swl.entry" "clipper.number"; + action: STATE_SET "default"; + target: "ao.entry"; } } program { @@ -320,6 +353,8 @@ group { "elm/layout/callsetting/keypad"; target: "txt.guide"; action: STATE_SET "visible"; targets: "swl.entry" "clipper.number"; + action: STATE_SET "entry_size"; + target: "ao.entry"; } } } diff --git a/project_def.prop b/project_def.prop index be59953..11c90ef 100644 --- a/project_def.prop +++ b/project_def.prop @@ -9,7 +9,7 @@ type = app profile = wearable-4.0 # C/CPP Sources -USER_SRCS = ucl/source/gui/Genlist.cpp call-setting/model/impl/BlockedNumbersImpl.cpp call-setting/presenters/misc/KeypadPresenter.cpp ucl/source/gui/Window.cpp call-setting/model/impl/BlockUnknownCallersImpl.cpp call-setting/view/TouchParser.cpp call-setting/model/impl/telephony/BaseTelRequestListener.cpp ucl/source/gui/Layout.cpp call-setting/resources.cpp call-setting/presenters/misc/ProcessingPresenter.cpp call-setting/presenters/misc/helpers.cpp ucl/source/appfw/UIApp.cpp call-setting/model/impl/CallWaitingImpl.cpp ucl/source/gui/WidgetItem.cpp call-setting/presenters/pages/NoContentPage.cpp call-setting/presenters/pages/VoicemailPage.cpp call-setting/presenters/pages/BlockedNumbersPage.cpp call-setting/model/BlockUnknownCallers.cpp ucl/source/util/types/Result.cpp call-setting/model/CallSetting.cpp call-setting/presenters/pages/KeypadPage.cpp call-setting/presenters/pages/MainPage.cpp call-setting/view/KeypadEntry.cpp call-setting/presenters/misc/SelectModePresenter.cpp call-setting/model/impl/misc/ContactNameProvider.cpp call-setting/presenters/items/BlockUnknownCallersItem.cpp ucl/source/appfw/InstanceManagerBase.cpp call-setting/model/BlockedNumbers.cpp call-setting/model/impl/misc/BlockListManager.cpp ucl/source/gui/NaviItem.cpp ucl/source/appfw/helpers.cpp call-setting/presenters/dialogs/ListOptionDialog.cpp call-setting/model/impl/settings/SettingsManager.cpp call-setting/presenters/items/CallWaitingItem.cpp call-setting/presenters/InstanceManager.cpp ucl/source/gui/Widget.cpp call-setting/model/impl/telephony/TelRequestListener.cpp call-setting/model/Voicemail.cpp call-setting/presenters/items/SimpleListItem.cpp ucl/source/misc/Timeout.cpp call-setting/presenters/pages/BlockListPage.cpp call-setting/presenters/items/base/ListOptionItem.cpp ucl/source/mvp/GuiPresenter.cpp call-setting/presenters/dialogs/base/Dialog.cpp call-setting/view/KeypadNumberBtn.cpp call-setting/view/helpers.cpp call-setting/model/StateManager.cpp ucl/source/util/logging.cpp ucl/source/gui/Naviframe.cpp ucl/source/gui/RadioBox.cpp ucl/source/util/types/classTypes.cpp call-setting/main.cpp call-setting/presenters/items/base/CheckOptionItem.cpp call-setting/model/CallWaiting.cpp call-setting/types.cpp ucl/source/appfw/SysEventProvider.cpp ucl/source/mvp/ListPresenter.cpp ucl/source/misc/Variant.cpp call-setting/presenters/items/RadioOptionItem.cpp call-setting/presenters/misc/MoreOptionsPresenter.cpp call-setting/model/impl/VoicemailImpl.cpp call-setting/presenters/items/CallerIdItem.cpp call-setting/model/CallerId.cpp call-setting/view/PageContent.cpp call-setting/model/impl/CallSettingImpl.cpp call-setting/presenters/pages/base/Page.cpp call-setting/model/impl/telephony/TelephonyManager.cpp call-setting/presenters/dialogs/ToastDialog.cpp ucl/source/mvp/ListItemPresenter.cpp ucl/source/gui/ElmWidget.cpp call-setting/model/impl/CallerIdImpl.cpp ucl/source/gui/EdjeWidget.cpp call-setting/view/KeypadBackspaceBtn.cpp call-setting/presenters/Instance.cpp call-setting/presenters/items/VoicemailNumberItem.cpp +USER_SRCS = ucl/source/gui/Genlist.cpp call-setting/model/impl/BlockedNumbersImpl.cpp call-setting/presenters/misc/KeypadPresenter.cpp ucl/source/gui/Window.cpp call-setting/model/impl/BlockUnknownCallersImpl.cpp call-setting/view/TouchParser.cpp call-setting/model/impl/telephony/BaseTelRequestListener.cpp ucl/source/gui/Layout.cpp call-setting/resources.cpp call-setting/presenters/misc/ProcessingPresenter.cpp call-setting/presenters/misc/helpers.cpp ucl/source/appfw/UIApp.cpp call-setting/model/impl/CallWaitingImpl.cpp ucl/source/gui/WidgetItem.cpp call-setting/presenters/pages/NoContentPage.cpp call-setting/presenters/pages/VoicemailPage.cpp call-setting/presenters/pages/BlockedNumbersPage.cpp call-setting/model/BlockUnknownCallers.cpp ucl/source/util/types/Result.cpp call-setting/model/CallSetting.cpp call-setting/presenters/pages/KeypadPage.cpp call-setting/presenters/pages/MainPage.cpp call-setting/view/KeypadEntry.cpp call-setting/presenters/misc/SelectModePresenter.cpp call-setting/model/impl/misc/ContactNameProvider.cpp call-setting/presenters/items/BlockUnknownCallersItem.cpp ucl/source/appfw/InstanceManagerBase.cpp call-setting/model/BlockedNumbers.cpp call-setting/model/impl/misc/BlockListManager.cpp ucl/source/gui/NaviItem.cpp ucl/source/appfw/helpers.cpp call-setting/presenters/dialogs/ListOptionDialog.cpp call-setting/model/impl/settings/SettingsManager.cpp call-setting/presenters/items/CallWaitingItem.cpp call-setting/presenters/InstanceManager.cpp ucl/source/gui/Widget.cpp call-setting/model/impl/telephony/TelRequestListener.cpp call-setting/model/Voicemail.cpp call-setting/presenters/items/SimpleListItem.cpp ucl/source/misc/Timeout.cpp call-setting/presenters/pages/BlockListPage.cpp call-setting/presenters/items/base/ListOptionItem.cpp ucl/source/mvp/GuiPresenter.cpp call-setting/presenters/dialogs/base/Dialog.cpp call-setting/view/KeypadNumberBtn.cpp call-setting/view/helpers.cpp call-setting/model/StateManager.cpp ucl/source/util/logging.cpp ucl/source/gui/Naviframe.cpp ucl/source/gui/RadioBox.cpp ucl/source/util/types/classTypes.cpp call-setting/main.cpp call-setting/presenters/items/base/CheckOptionItem.cpp call-setting/model/CallWaiting.cpp call-setting/types.cpp ucl/source/appfw/SysEventProvider.cpp ucl/source/mvp/ListPresenter.cpp ucl/source/misc/Variant.cpp call-setting/presenters/items/RadioOptionItem.cpp call-setting/presenters/misc/MoreOptionsPresenter.cpp call-setting/presenters/misc/AtspiHighlightHelper.cpp call-setting/model/impl/VoicemailImpl.cpp call-setting/presenters/items/CallerIdItem.cpp call-setting/model/CallerId.cpp call-setting/view/PageContent.cpp call-setting/model/impl/CallSettingImpl.cpp call-setting/presenters/pages/base/Page.cpp call-setting/model/impl/telephony/TelephonyManager.cpp call-setting/presenters/dialogs/ToastDialog.cpp ucl/source/mvp/ListItemPresenter.cpp ucl/source/gui/ElmWidget.cpp call-setting/model/impl/CallerIdImpl.cpp ucl/source/gui/EdjeWidget.cpp call-setting/view/KeypadBackspaceBtn.cpp call-setting/presenters/Instance.cpp call-setting/presenters/items/VoicemailNumberItem.cpp # EDC Sources USER_EDCS = -- cgit v1.2.3 From c2ac6f69df4c62b04fb43dfc3fe27b84f683142c Mon Sep 17 00:00:00 2001 From: Igor Olshevskyi Date: Wed, 18 Oct 2017 13:04:41 +0300 Subject: TizenRefApp-9641 [Call Setting] Implement Screen Reader support for BlockNumbersPage Change-Id: Icd7702091de3ddae4aa475e5619752aa9711b1f2 --- call-setting/model/impl/misc/BlockListManager.h | 2 +- call-setting/presenters/items/SimpleListItem.cpp | 26 +++++--- call-setting/presenters/items/SimpleListItem.h | 9 ++- .../presenters/pages/BlockedNumbersPage.cpp | 71 +++++++++++++++++++++- call-setting/presenters/pages/BlockedNumbersPage.h | 12 ++++ ucl/include/ucl/mvp/ListItemPresenter.h | 31 ++++++++-- ucl/source/mvp/ListItemPresenter.cpp | 27 ++++++-- 7 files changed, 155 insertions(+), 23 deletions(-) diff --git a/call-setting/model/impl/misc/BlockListManager.h b/call-setting/model/impl/misc/BlockListManager.h index 2fc93f8..6e82a9b 100644 --- a/call-setting/model/impl/misc/BlockListManager.h +++ b/call-setting/model/impl/misc/BlockListManager.h @@ -126,7 +126,7 @@ namespace call_setting { ucl::Result getRules(Rules &rules) const; /** - * @brief Adds rule with exanct matching type + * @brief Adds rule with exact matching type * @param[in] number Number * @param[in] rule Rule * @return RES_OK on success, otherwise an error code on failure diff --git a/call-setting/presenters/items/SimpleListItem.cpp b/call-setting/presenters/items/SimpleListItem.cpp index dd63a39..a0d6f51 100644 --- a/call-setting/presenters/items/SimpleListItem.cpp +++ b/call-setting/presenters/items/SimpleListItem.cpp @@ -26,19 +26,22 @@ namespace call_setting { namespace { namespace impl { namespace call_setting { - using ucl::HashMap; using ucl::ListItemPresenter; using ucl::IPicker; - SimpleListItem::SimpleListItem(IRefCountObj &rc, - ElmStyle style, PartTextMap parts) : + SimpleListItem::SimpleListItem(IRefCountObj &rc, ElmStyle style, + PartTextMap parts, bool useAtspiRedundant) : ListItemPresenter::ListItemPresenter(rc), m_listItemStyle(style), - m_listItemParts(std::move(parts)) + m_listItemParts(std::move(parts)), + m_useAtspiRedundant(useAtspiRedundant) { } - SimpleListItem::~SimpleListItem() + SimpleListItem::SimpleListItem(IRefCountObj &rc, ElmStyle style) : + ListItemPresenter::ListItemPresenter(rc), + m_listItemStyle(style), + m_useAtspiRedundant(true) { } @@ -57,7 +60,8 @@ namespace call_setting { return *this; } - ListItemPresenter::ItemInsertionParams SimpleListItem::getItemInsertionParams() + ListItemPresenter::ItemInsertionParams + SimpleListItem::getItemInsertionParams() { return m_listItemStyle; } @@ -75,7 +79,8 @@ namespace call_setting { EdjePart part, ElmWidget &parent) { return tryCreatePickModeItemPartContent(part, parent, - {impl::PICK_MODE_CHECK_PART, impl::PICK_MODE_CHECK_STYLE}); + {impl::PICK_MODE_CHECK_PART, impl::PICK_MODE_CHECK_STYLE, + true}); } void SimpleListItem::onItemSelected() @@ -95,4 +100,11 @@ namespace call_setting { } } } + + void SimpleListItem::onItemAttached() + { + if (m_useAtspiRedundant) { + getItemAtspi()->setRole(ELM_ATSPI_ROLE_REDUNDANT_OBJECT); + } + } } diff --git a/call-setting/presenters/items/SimpleListItem.h b/call-setting/presenters/items/SimpleListItem.h index b4a214b..b953a0f 100644 --- a/call-setting/presenters/items/SimpleListItem.h +++ b/call-setting/presenters/items/SimpleListItem.h @@ -30,12 +30,15 @@ namespace call_setting { public ucl::IPickable { public: SimpleListItem(ucl::IRefCountObj &rc, ucl::ElmStyle style, - PartTextMap parts = {}); + PartTextMap parts, bool useAtspiRedundant = false); + + SimpleListItem(ucl::IRefCountObj &rc, ucl::ElmStyle style); void setItemSelectHandler(NotiHandler handler); void setItemLongpressHandler(NotiHandler handler); // IPickable // + virtual ucl::IPicker &getPicker() final override; protected: @@ -49,9 +52,10 @@ namespace call_setting { virtual void onItemSelected() override; virtual void onItemLongpressed() override; + virtual void onItemAttached() override; private: - ~SimpleListItem(); + ~SimpleListItem() = default; private: ucl::ElmStyle m_listItemStyle; @@ -59,6 +63,7 @@ namespace call_setting { NotiHandler m_onItemSelected; NotiHandler m_onItemLongpressed; + bool m_useAtspiRedundant; friend class ucl::ReffedObj; }; diff --git a/call-setting/presenters/pages/BlockedNumbersPage.cpp b/call-setting/presenters/pages/BlockedNumbersPage.cpp index abf7141..c523686 100644 --- a/call-setting/presenters/pages/BlockedNumbersPage.cpp +++ b/call-setting/presenters/pages/BlockedNumbersPage.cpp @@ -16,6 +16,8 @@ #include "BlockedNumbersPage.h" +#include "call-setting/view/AoSequencer.h" + #include "call-setting/presenters/misc/ProcessingPresenter.h" #include "call-setting/resources.h" @@ -32,6 +34,7 @@ namespace call_setting { namespace { namespace impl { namespace call_setting { using ucl::ListPresenter; + using ucl::ListItemPresenter; using ucl::NaviItem; using ucl::NaviframeSRef; using ucl::IPickerHost; @@ -58,6 +61,11 @@ namespace call_setting { return *m_item; } + const SimpleListItem &getItem() const + { + return *m_item; + } + private: ~Item() = default; @@ -71,7 +79,7 @@ namespace call_setting { BlockedNumbers::Item m_model; SimpleListItemSRef m_item; - friend class ucl::ReffedObj; + friend class ReffedObj; }; // BlockedNumbersPage::Builder // @@ -150,9 +158,13 @@ namespace call_setting { FAIL_RETURN(makeList(), "makeList() failed!"); FAIL_RETURN(makeMoreOptions(), "makeMoreOptions() failed!"); FAIL_RETURN(makeSelectMode(), "makeSelectMode() failed!"); + FAIL_RETURN(makeAtspiHighlightHelper(), + "makeAtspiHighlightHelper() failed!"); makeListItems(); + registerAccessObjects(); + item = getNaviframe().push(getContent()); if (!item) { LOG_RETURN(RES_FAIL, "Naviframe::push() failed!"); @@ -189,6 +201,7 @@ namespace call_setting { STR_DELETE, nullptr, getImageTheme(ICON_MORE_OPT_DELETE)}). build(*this); + if (!m_more) { LOG_RETURN(RES_FAIL, "MoreOptionsPresenter::build() failed!"); } @@ -216,7 +229,8 @@ namespace call_setting { void BlockedNumbersPage::makeListItems() { - m_list->append(*makeTitleListItem(STR_BLOCKED_NUMBERS_PAGE_TITLE)); + m_titleItem = makeTitleListItem(STR_BLOCKED_NUMBERS_PAGE_TITLE); + m_list->append(*m_titleItem); m_model->forEachItem(DELEGATE_THIS(onEachItem)); @@ -232,6 +246,8 @@ namespace call_setting { void BlockedNumbersPage::remakeListItems() { + m_titleItem.reset(); + m_items.clear(); m_list->clear(); @@ -433,4 +449,55 @@ namespace call_setting { break; } } + + Result BlockedNumbersPage::makeAtspiHighlightHelper() + { + m_atspiHelper = AtspiHighlightHelper::newInstance(*this); + if (!m_atspiHelper) { + LOG_RETURN(RES_FAIL, + "AtspiHighlightHelper::newInstance() failed!"); + } + + m_atspiHelper->setEventHandler(WEAK_DELEGATE_THIS(onAtspiHighlight)); + + return RES_OK; + } + + const Elm_Interface_Atspi_Accessible *BlockedNumbersPage::onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation) + { + if (!m_isInSelectMode) { + return nullptr; + } + + return AoSequencer(ao, flowRelation) + .process(*m_titleItem) + .process(m_smp->getSelectButton()) + .process(*m_items.front()) + .processDefault() + .process(*m_items.back()) + .process(m_smp->getBottomButton()) + .getNext(); + } + + void BlockedNumbersPage::registerAccessObjects() + { + m_atspiHelper->registerObject(getWindow()); + + m_atspiHelper->registerObject(m_smp->getBottomButton()); + m_atspiHelper->registerObject(m_smp->getSelectButton()); + + m_atspiHelper->registerObject(*m_titleItem); + m_atspiHelper->registerObject(m_items.front()->getItem()); + m_atspiHelper->registerObject(m_items.back()->getItem()); + } + + // Non-member functions // + + const Elm_Interface_Atspi_Accessible *as_ao( + const BlockedNumbersPage::Item &item) + { + return as_ao(item.getItem()); + } } diff --git a/call-setting/presenters/pages/BlockedNumbersPage.h b/call-setting/presenters/pages/BlockedNumbersPage.h index bfccbef..5c8f166 100644 --- a/call-setting/presenters/pages/BlockedNumbersPage.h +++ b/call-setting/presenters/pages/BlockedNumbersPage.h @@ -23,6 +23,7 @@ #include "call-setting/model/BlockedNumbers.h" +#include "call-setting/presenters/misc/AtspiHighlightHelper.h" #include "call-setting/presenters/misc/MoreOptionsPresenter.h" #include "call-setting/presenters/misc/SelectModePresenter.h" @@ -64,6 +65,7 @@ namespace call_setting { ucl::Result makeList(); ucl::Result makeMoreOptions(); ucl::Result makeSelectMode(); + ucl::Result makeAtspiHighlightHelper(); void makeListItems(); bool onEachItem(BlockedNumbers::Item modelItem); @@ -83,6 +85,11 @@ namespace call_setting { void onModelItemsChanged(); void onInstanceResumed(ucl::Widget &sender, void *eventInfo); + void registerAccessObjects(); + const Elm_Interface_Atspi_Accessible *onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation); + // GuiPresenter // virtual void onActivateBy(const DeactivatorInfo &info) final override; @@ -116,12 +123,17 @@ namespace call_setting { MoreOptionsPresenterSRef m_more; SelectModePresenterSRef m_smp; + AtspiHighlightHelperSRef m_atspiHelper; + + ucl::ListItemPresenterSRef m_titleItem; std::vector m_items; int m_selectCount; bool m_isInSelectMode; friend class ucl::ReffedObj; + + friend const Elm_Interface_Atspi_Accessible *as_ao(const Item &item); }; } diff --git a/ucl/include/ucl/mvp/ListItemPresenter.h b/ucl/include/ucl/mvp/ListItemPresenter.h index 37175bd..bda4546 100644 --- a/ucl/include/ucl/mvp/ListItemPresenter.h +++ b/ucl/include/ucl/mvp/ListItemPresenter.h @@ -34,6 +34,15 @@ namespace ucl { class ListItemPresenter : public RefCountAware, public IDisposable, protected IPicker { + public: + /** + * @brief Gets GUI item Access object of the item presenter + * @param[in] item List item presenter + * @return Pointer to Access object or NULL + */ + friend const Elm_Interface_Atspi_Accessible *as_ao( + const ListItemPresenter &item); + public: /** * @brief Updates GUI item of this item @@ -62,12 +71,6 @@ namespace ucl { */ void setItemAtspiGestureHandler(AtspiGestureHandler handler); - /** - * @brief Gets GUI item Access object of this item - * @return Pointer to Access object or NULL - */ - Elm_Interface_Atspi_Accessible *getItemAo(); - // IDisposable // virtual void dispose() final override; @@ -127,6 +130,22 @@ namespace ucl { */ ElmStyle checkStyle; + /** + * @brief Enable/disable Atspi support state + */ + bool enableAtspi; + + /** + * @brief Constructor + * @param[in] checkPart Part in GUI item for check widget + * @param[in] checkStyle Style of the check widget + * @param[in] enableAtspi Enable/disable Atspi support state + */ + ItemPickModeParams(EdjePart checkPart, ElmStyle checkStyle, + bool enableAtspi = false) : + checkPart(checkPart), checkStyle(checkStyle), + enableAtspi(enableAtspi) {} + /** * @brief Checks validity of data in this structure * @return true - if valid, false - if not valid diff --git a/ucl/source/mvp/ListItemPresenter.cpp b/ucl/source/mvp/ListItemPresenter.cpp index 3fff862..bb8d719 100644 --- a/ucl/source/mvp/ListItemPresenter.cpp +++ b/ucl/source/mvp/ListItemPresenter.cpp @@ -324,6 +324,20 @@ namespace ucl { check->addEventHandler( impl::CHECK_CHANGED, WEAK_DELEGATE_THIS(onPickCheckChanged)); + if (params.enableAtspi) { + auto itemAtspi = getItemAtspi(); + if (itemAtspi) { + auto &checkAtspi = check->getAtspi(); + + checkAtspi.addRelationship(ELM_ATSPI_RELATION_CONTROLLED_BY, + as_ao(*itemAtspi)); + itemAtspi->addRelationship(ELM_ATSPI_RELATION_CONTROLLER_FOR, + as_ao(checkAtspi)); + itemAtspi->addRelationship(ELM_ATSPI_RELATION_DESCRIBED_BY, + as_ao(checkAtspi)); + } + } + return check; } @@ -408,11 +422,6 @@ namespace ucl { m_itemAtspiGestureHandler = std::move(handler); } - Elm_Interface_Atspi_Accessible *ListItemPresenter::getItemAo() - { - return as_ao(getItemAtspi()); - } - Result ListItemPresenter::updateItemStyle(const ElmStyle newItemStyle) { if (!m_item) { @@ -500,4 +509,12 @@ namespace ucl { void ListItemPresenter::onItemLongpressed() { } + + // Non-member functions // + + const Elm_Interface_Atspi_Accessible *as_ao( + const ListItemPresenter &item) + { + return as_ao(item.getItemAtspi()); + } } -- cgit v1.2.3 From 6d0ffa10f44233eb15f401e40d6e85a3e51e6ece Mon Sep 17 00:00:00 2001 From: Igor Olshevskyi Date: Wed, 11 Oct 2017 10:54:29 +0300 Subject: TizenRefApp-9640 [Call Setting] Implement Screen Reader support for ListOption and RadioOption items Change-Id: Ifbb46532832c96b039dcd814c0c77052fdb3ee89 --- .../presenters/dialogs/ListOptionDialog.cpp | 12 ++++--- call-setting/presenters/items/RadioOptionItem.cpp | 39 +++++++++++++++++++--- call-setting/presenters/items/RadioOptionItem.h | 5 ++- .../presenters/items/base/CheckOptionItem.cpp | 25 ++++++++++++-- .../presenters/items/base/CheckOptionItem.h | 1 + call-setting/resources.cpp | 4 +++ call-setting/resources.h | 4 +++ call-setting/view/KeypadBackspaceBtn.h | 2 +- call-setting/view/KeypadEntry.h | 2 +- call-setting/view/KeypadNumberBtn.h | 2 +- 10 files changed, 82 insertions(+), 14 deletions(-) diff --git a/call-setting/presenters/dialogs/ListOptionDialog.cpp b/call-setting/presenters/dialogs/ListOptionDialog.cpp index 15f1d71..7253921 100644 --- a/call-setting/presenters/dialogs/ListOptionDialog.cpp +++ b/call-setting/presenters/dialogs/ListOptionDialog.cpp @@ -68,25 +68,29 @@ namespace call_setting { return *this; } - ListOptionDialog::Builder &ListOptionDialog::Builder::addOption(Option option) + ListOptionDialog::Builder &ListOptionDialog::Builder::addOption( + Option option) { m_options.emplace_back(std::move(option)); return *this; } - ListOptionDialog::Builder &ListOptionDialog::Builder::setTitle(TString title) + ListOptionDialog::Builder &ListOptionDialog::Builder::setTitle( + TString title) { m_title = std::move(title); return *this; } - ListOptionDialog::Builder &ListOptionDialog::Builder::setInitialOptionId(int id) + ListOptionDialog::Builder &ListOptionDialog::Builder::setInitialOptionId( + int id) { m_initialOptionId = id; return *this; } - ListOptionDialog::Builder &ListOptionDialog::Builder::setHandler(EventHandler handler) + ListOptionDialog::Builder &ListOptionDialog::Builder::setHandler( + EventHandler handler) { m_handler = std::move(handler); return *this; diff --git a/call-setting/presenters/items/RadioOptionItem.cpp b/call-setting/presenters/items/RadioOptionItem.cpp index dbe94a9..7edacd5 100644 --- a/call-setting/presenters/items/RadioOptionItem.cpp +++ b/call-setting/presenters/items/RadioOptionItem.cpp @@ -16,6 +16,8 @@ #include "RadioOptionItem.h" +#include "call-setting/resources.h" + #include "call-setting/presenters/common.h" namespace call_setting { namespace { namespace impl { @@ -26,6 +28,8 @@ namespace call_setting { namespace { namespace impl { constexpr EdjeSignal SIGNAL_ENBALE_PASS_EVENTS {"elm,event,pass,enabled"}; constexpr EdjeSignalSrc SIGNAL_SRC_ELM {"elm"}; + + constexpr SmartEvent RADIO_CHANGED {"changed"}; }}} namespace call_setting { @@ -47,10 +51,6 @@ namespace call_setting { UCL_ASSERT(m_groupValue, "m_groupValue is NULL"); } - RadioOptionItem::~RadioOptionItem() - { - } - RadioOptionItem::ItemInsertionParams RadioOptionItem::getItemInsertionParams() { @@ -68,9 +68,31 @@ namespace call_setting { radio->addToGroup(*m_radioGroup); radio->emit(impl::SIGNAL_ENBALE_PASS_EVENTS, impl::SIGNAL_SRC_ELM); + radio->addEventHandler( + impl::RADIO_CHANGED, WEAK_DELEGATE_THIS(onRadioChanged)); + + setAtspiParams(*radio); + return radio; } + void RadioOptionItem::setAtspiParams(ElmWidget &widget) + { + auto &radioAtspi = widget.getAtspi(); + auto itemAtspi = getItemAtspi(); + + radioAtspi.setTDomain(TEXT_DOMAIN); + radioAtspi.setRole(ELM_ATSPI_ROLE_RADIO_BUTTON); + radioAtspi.setDescription(STR_SR_RADIO_BUTTON); + radioAtspi.addRelationship(ELM_ATSPI_RELATION_CONTROLLED_BY, + as_ao(*itemAtspi)); + + itemAtspi->addRelationship(ELM_ATSPI_RELATION_CONTROLLER_FOR, + as_ao(radioAtspi)); + itemAtspi->addRelationship(ELM_ATSPI_RELATION_DESCRIBED_BY, + as_ao(radioAtspi)); + } + CString RadioOptionItem::getItemPartText(EdjePart part) { if (part != impl::ITEM_PART_TITLE) { @@ -80,6 +102,14 @@ namespace call_setting { return CString::dup(m_textPart.translate()); } + void RadioOptionItem::onRadioChanged(Widget &widget, void *eventInfo) + { + if (!isActive()) { + return; + } + *m_groupValue = m_itemValue; + } + void RadioOptionItem::onItemSelected() { if (!isActive()) { @@ -88,4 +118,5 @@ namespace call_setting { m_radioGroup->setGroupValue(m_itemValue); *m_groupValue = m_itemValue; } + } diff --git a/call-setting/presenters/items/RadioOptionItem.h b/call-setting/presenters/items/RadioOptionItem.h index e855e10..7cc68e5 100644 --- a/call-setting/presenters/items/RadioOptionItem.h +++ b/call-setting/presenters/items/RadioOptionItem.h @@ -38,7 +38,10 @@ namespace call_setting { ucl::RadioBoxSRef rGroup); protected: - ~RadioOptionItem(); + ~RadioOptionItem() = default; + + void onRadioChanged(ucl::Widget &widget, void *eventInfo); + void setAtspiParams(ucl::ElmWidget &widget); // ListItemPresenter // diff --git a/call-setting/presenters/items/base/CheckOptionItem.cpp b/call-setting/presenters/items/base/CheckOptionItem.cpp index b318806..a456984 100644 --- a/call-setting/presenters/items/base/CheckOptionItem.cpp +++ b/call-setting/presenters/items/base/CheckOptionItem.cpp @@ -16,6 +16,8 @@ #include "CheckOptionItem.h" +#include "call-setting/resources.h" + #include "call-setting/presenters/common.h" namespace call_setting { namespace { namespace impl { @@ -72,12 +74,31 @@ namespace call_setting { evas_object_repeat_events_set(as_eo(*check), EINA_FALSE); evas_object_propagate_events_set(as_eo(*check), EINA_FALSE); - check->addEventHandler( - impl::CHECK_CHANGED, WEAK_DELEGATE_THIS(onCheckChanged)); + check->addEventHandler(impl::CHECK_CHANGED, + WEAK_DELEGATE_THIS(onCheckChanged)); + + setAtspiParams(*check); return check; } + void CheckOptionItem::setAtspiParams(ElmWidget &widget) + { + auto &checkAtspi = widget.getAtspi(); + auto itemAtspi = getItemAtspi(); + + checkAtspi.setTDomain(TEXT_DOMAIN); + checkAtspi.setRole(ELM_ATSPI_ROLE_TOGGLE_BUTTON); + checkAtspi.setDescription(STR_SR_SWITCH); + checkAtspi.addRelationship(ELM_ATSPI_RELATION_CONTROLLED_BY, + as_ao(*itemAtspi)); + + itemAtspi->addRelationship(ELM_ATSPI_RELATION_CONTROLLER_FOR, + as_ao(checkAtspi)); + itemAtspi->addRelationship(ELM_ATSPI_RELATION_DESCRIBED_BY, + as_ao(checkAtspi)); + } + CString CheckOptionItem::getItemPartText(const EdjePart part) { if (part == impl::ITEM_PART_TITLE) { diff --git a/call-setting/presenters/items/base/CheckOptionItem.h b/call-setting/presenters/items/base/CheckOptionItem.h index 1bb5bf5..9d6ece8 100644 --- a/call-setting/presenters/items/base/CheckOptionItem.h +++ b/call-setting/presenters/items/base/CheckOptionItem.h @@ -68,6 +68,7 @@ namespace call_setting { void syncCheckValue(); void syncCheckValueForce(); void setCheckValue(bool value); + void setAtspiParams(ucl::ElmWidget &check); void syncItemEnabled(); diff --git a/call-setting/resources.cpp b/call-setting/resources.cpp index 1942af0..d2a3165 100644 --- a/call-setting/resources.cpp +++ b/call-setting/resources.cpp @@ -91,4 +91,8 @@ namespace call_setting { const TString STR_SR_EDIT_BOX {"Edit box"}; const TString STR_SR_KEYPAD {"Keypad"}; const TString STR_SR_EMPTY {"Empty"}; + + const TString STR_SR_SWITCH {"Switch"}; + const TString STR_SR_RADIO_BUTTON {"Radio button"}; + } diff --git a/call-setting/resources.h b/call-setting/resources.h index e16f959..c56dae0 100644 --- a/call-setting/resources.h +++ b/call-setting/resources.h @@ -69,6 +69,10 @@ namespace call_setting { extern const ucl::TString STR_SR_EDIT_BOX; extern const ucl::TString STR_SR_KEYPAD; extern const ucl::TString STR_SR_EMPTY; + + extern const ucl::TString STR_SR_SWITCH; + extern const ucl::TString STR_SR_RADIO_BUTTON; + } #endif // __CALL_SETTING_RESOURCES_H__ diff --git a/call-setting/view/KeypadBackspaceBtn.h b/call-setting/view/KeypadBackspaceBtn.h index 7805420..829c0d5 100644 --- a/call-setting/view/KeypadBackspaceBtn.h +++ b/call-setting/view/KeypadBackspaceBtn.h @@ -25,7 +25,7 @@ namespace call_setting { UCL_DECLARE_REF_ALIASES(KeypadBackspaceBtn); - class KeypadBackspaceBtn final: public ucl::ElmWidget { + class KeypadBackspaceBtn final : public ucl::ElmWidget { public: static KeypadBackspaceBtnSRef newInstance(ucl::ElmWidget &parent); diff --git a/call-setting/view/KeypadEntry.h b/call-setting/view/KeypadEntry.h index ce362af..9730457 100644 --- a/call-setting/view/KeypadEntry.h +++ b/call-setting/view/KeypadEntry.h @@ -25,7 +25,7 @@ namespace call_setting { UCL_DECLARE_REF_ALIASES(KeypadEntry); - class KeypadEntry final: public ucl::ElmWidget { + class KeypadEntry final : public ucl::ElmWidget { public: static KeypadEntrySRef newInstance(ucl::ElmWidget &parent); diff --git a/call-setting/view/KeypadNumberBtn.h b/call-setting/view/KeypadNumberBtn.h index b585384..5d87fb7 100644 --- a/call-setting/view/KeypadNumberBtn.h +++ b/call-setting/view/KeypadNumberBtn.h @@ -25,7 +25,7 @@ namespace call_setting { UCL_DECLARE_REF_ALIASES(KeypadNumberBtn); - class KeypadNumberBtn final: public ucl::ElmWidget { + class KeypadNumberBtn final : public ucl::ElmWidget { public: enum class SymbolState { HIDDEN, -- cgit v1.2.3 From d1356de042f35186d777a5266fe0e1ff538951b7 Mon Sep 17 00:00:00 2001 From: Igor Olshevskyi Date: Wed, 18 Oct 2017 16:31:15 +0300 Subject: TizenRefApp-9642 [Call Setting] Implement Screen Reader support for NoContentPage Change-Id: I6c83aadcdf5e4f2e880a958de7d4762abb31e896 --- call-setting/presenters/pages/NoContentPage.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/call-setting/presenters/pages/NoContentPage.cpp b/call-setting/presenters/pages/NoContentPage.cpp index be9f9da..42cba65 100644 --- a/call-setting/presenters/pages/NoContentPage.cpp +++ b/call-setting/presenters/pages/NoContentPage.cpp @@ -124,6 +124,10 @@ namespace call_setting { layout->setText(title, PART_TITLE); layout->setText(text); + auto &atspi = layout->getAtspi(); + atspi.setRole(ELM_ATSPI_ROLE_TEXT); + atspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME); + item = getNaviframe().push(getContent()); if (!item) { LOG_RETURN(RES_FAIL, "Naviframe::push() failed!"); -- cgit v1.2.3 From 2a437b4378f0769b42ff83e4b464776fb3555691 Mon Sep 17 00:00:00 2001 From: Igor Olshevskyi Date: Mon, 23 Oct 2017 18:03:57 +0300 Subject: TizenRefApp-9670 [Call Setting] Reimplement ProcessingPresenter layout style Change-Id: Ia5c007f49280af1f13f90b8d2274c5e0737ec17b --- .../presenters/misc/ProcessingPresenter.cpp | 4 +- edc/layouts.edc | 43 ++++++++++++++++------ 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/call-setting/presenters/misc/ProcessingPresenter.cpp b/call-setting/presenters/misc/ProcessingPresenter.cpp index cb92ec2..ea6085b 100644 --- a/call-setting/presenters/misc/ProcessingPresenter.cpp +++ b/call-setting/presenters/misc/ProcessingPresenter.cpp @@ -39,7 +39,7 @@ namespace call_setting { namespace { namespace impl { constexpr EdjeSignal SIGNAL_ANIMATE_CHECK {"callsetting,animate,check"}; - constexpr ElmStyle PROGRESS_STYLE {"process"}; + constexpr ElmStyle PROGRESS_STYLE {"process/small"}; }}} namespace call_setting { @@ -195,7 +195,7 @@ namespace call_setting { LOG_RETURN(RES_FAIL, "elm_progressbar_add() failed!"); } - StyledWidget progress{progressEo}; + StyledWidget progress{progressEo, false}; progress.setStyle(impl::PROGRESS_STYLE); m_widget->setContent(progress, impl::PART_PROGRESS); elm_progressbar_pulse(progressEo, EINA_TRUE); diff --git a/edc/layouts.edc b/edc/layouts.edc index 8a1755a..8550e59 100644 --- a/edc/layouts.edc +++ b/edc/layouts.edc @@ -61,22 +61,46 @@ group { "elm/layout/callsetting/proccessing"; color: CS_COLOR_BLACK; } } - swallow { "callsetting.swallow.progress"; + spacer { "pad.bottom"; + scale; + desc { "default"; + align: 0.5 1.0; + min: 0 131; + rel1 { relative: 0.0 1.0; } + } + } + textblock { "elm.text"; + scale; desc { "default"; hid; + text.style: "popup_graphic_toast_style"; + text.min: 1 1; + max: 300 84; + rel1 { relative: 0.5 0.0; to_y: "pad.bottom"; } + rel2 { relative: 0.5 0.0; to_y: "pad.bottom"; } } desc { "visible"; inherit: "default"; vis; } } - textblock { name: "elm.text"; - scale: 1; + spacer { "elm.text.pad.top"; + scale; + desc { "default"; + min: 0 16; + align: 0.5 1.0; + rel1 { relative: 0.0 0.0; to: "elm.text"; } + rel2 { relative: 1.0 0.0; to: "elm.text"; } + } + } + swallow { "callsetting.swallow.progress"; desc { "default"; hid; - text.style: "popup_graphic_toast_style"; - text.min: 0 1; - text.max: 0 1; + min: 82 82; + max: 82 82; + align: 0.5 1.0; + rel1 { relative: 0.5 0.0; to_y: "elm.text.pad.top"; } + rel2 { relative: 0.5 0.0; to_y: "elm.text.pad.top"; } } desc { "visible"; inherit: "default"; @@ -89,9 +113,7 @@ group { "elm/layout/callsetting/proccessing"; signal: "callsetting,show"; source: ""; action: STATE_SET "visible"; - target: "bg"; - target: "callsetting.swallow.progress"; - target: "elm.text"; + targets: "bg" "callsetting.swallow.progress" "elm.text"; } program { "callsetting,show,bg"; signal: "callsetting,show,bg"; @@ -103,8 +125,7 @@ group { "elm/layout/callsetting/proccessing"; signal: "callsetting,hide,progress"; source: ""; action: STATE_SET "default"; - target: "callsetting.swallow.progress"; - target: "elm.text"; + targets: "callsetting.swallow.progress" "elm.text"; } } } -- cgit v1.2.3 From aec3b9f52d07e1b9b1ac16f4a955cd058a94ee2a Mon Sep 17 00:00:00 2001 From: Igor Olshevskyi Date: Tue, 24 Oct 2017 08:59:35 +0300 Subject: TizenRefApp-9674 [Call Setting] Implement Screen Reader support for switching Pages Change-Id: I497a65e170971f6d797d9a6f5e90203958c23f5c --- call-setting/presenters/items/RadioOptionItem.cpp | 8 +-- .../presenters/items/base/CheckOptionItem.cpp | 8 +-- .../presenters/misc/AtspiHighlightHelper.cpp | 3 +- call-setting/presenters/pages/BlockListPage.cpp | 3 +- .../presenters/pages/BlockedNumbersPage.cpp | 4 +- call-setting/presenters/pages/KeypadPage.cpp | 5 +- call-setting/presenters/pages/MainPage.cpp | 20 +++++++- call-setting/presenters/pages/MainPage.h | 3 ++ call-setting/presenters/pages/NoContentPage.cpp | 4 +- call-setting/presenters/pages/VoicemailPage.cpp | 3 +- call-setting/presenters/pages/base/Page.cpp | 14 ++++++ call-setting/presenters/pages/base/Page.h | 9 ++++ call-setting/view/helpers.cpp | 58 ++++++++++++++++++++++ call-setting/view/helpers.h | 7 +++ ucl/include/ucl/gui/NaviItem.h | 10 ++-- ucl/include/ucl/gui/NaviItem.hpp | 7 +-- ucl/include/ucl/gui/Naviframe.hpp | 19 +++++-- 17 files changed, 155 insertions(+), 30 deletions(-) diff --git a/call-setting/presenters/items/RadioOptionItem.cpp b/call-setting/presenters/items/RadioOptionItem.cpp index 7edacd5..f8afc55 100644 --- a/call-setting/presenters/items/RadioOptionItem.cpp +++ b/call-setting/presenters/items/RadioOptionItem.cpp @@ -79,17 +79,17 @@ namespace call_setting { void RadioOptionItem::setAtspiParams(ElmWidget &widget) { auto &radioAtspi = widget.getAtspi(); - auto itemAtspi = getItemAtspi(); + auto &itemAtspi = *getItemAtspi(); radioAtspi.setTDomain(TEXT_DOMAIN); radioAtspi.setRole(ELM_ATSPI_ROLE_RADIO_BUTTON); radioAtspi.setDescription(STR_SR_RADIO_BUTTON); radioAtspi.addRelationship(ELM_ATSPI_RELATION_CONTROLLED_BY, - as_ao(*itemAtspi)); + as_ao(itemAtspi)); - itemAtspi->addRelationship(ELM_ATSPI_RELATION_CONTROLLER_FOR, + itemAtspi.addRelationship(ELM_ATSPI_RELATION_CONTROLLER_FOR, as_ao(radioAtspi)); - itemAtspi->addRelationship(ELM_ATSPI_RELATION_DESCRIBED_BY, + itemAtspi.addRelationship(ELM_ATSPI_RELATION_DESCRIBED_BY, as_ao(radioAtspi)); } diff --git a/call-setting/presenters/items/base/CheckOptionItem.cpp b/call-setting/presenters/items/base/CheckOptionItem.cpp index a456984..ff1d095 100644 --- a/call-setting/presenters/items/base/CheckOptionItem.cpp +++ b/call-setting/presenters/items/base/CheckOptionItem.cpp @@ -85,17 +85,17 @@ namespace call_setting { void CheckOptionItem::setAtspiParams(ElmWidget &widget) { auto &checkAtspi = widget.getAtspi(); - auto itemAtspi = getItemAtspi(); + auto &itemAtspi = *getItemAtspi(); checkAtspi.setTDomain(TEXT_DOMAIN); checkAtspi.setRole(ELM_ATSPI_ROLE_TOGGLE_BUTTON); checkAtspi.setDescription(STR_SR_SWITCH); checkAtspi.addRelationship(ELM_ATSPI_RELATION_CONTROLLED_BY, - as_ao(*itemAtspi)); + as_ao(itemAtspi)); - itemAtspi->addRelationship(ELM_ATSPI_RELATION_CONTROLLER_FOR, + itemAtspi.addRelationship(ELM_ATSPI_RELATION_CONTROLLER_FOR, as_ao(checkAtspi)); - itemAtspi->addRelationship(ELM_ATSPI_RELATION_DESCRIBED_BY, + itemAtspi.addRelationship(ELM_ATSPI_RELATION_DESCRIBED_BY, as_ao(checkAtspi)); } diff --git a/call-setting/presenters/misc/AtspiHighlightHelper.cpp b/call-setting/presenters/misc/AtspiHighlightHelper.cpp index 5b9dc75..f978dca 100644 --- a/call-setting/presenters/misc/AtspiHighlightHelper.cpp +++ b/call-setting/presenters/misc/AtspiHighlightHelper.cpp @@ -79,7 +79,8 @@ namespace call_setting { if (!isActive()) { DLOG("Ignored. Presenter is not active"); - if (e.gestureInfo.type != ELM_ATSPI_GESTURE_ONE_FINGER_SINGLE_TAP) { + if ((e.gestureInfo.type != ELM_ATSPI_GESTURE_ONE_FINGER_SINGLE_TAP) + && (currentAo != as_ao(getWindow()))) { DLOG("Prevent default handler"); e.preventDefault = true; } diff --git a/call-setting/presenters/pages/BlockListPage.cpp b/call-setting/presenters/pages/BlockListPage.cpp index 4e843da..d27744b 100644 --- a/call-setting/presenters/pages/BlockListPage.cpp +++ b/call-setting/presenters/pages/BlockListPage.cpp @@ -112,10 +112,11 @@ namespace call_setting { makeListItems(std::move(blockUnknown)); - item = getNaviframe().push(getContent()); + item = getNaviframe().push(STR_BLOCK_LIST_PAGE_TITLE, getContent()); if (!item) { LOG_RETURN(RES_FAIL, "Naviframe::push() failed!"); } + item.setTitleEnabled(false); return RES_OK; } diff --git a/call-setting/presenters/pages/BlockedNumbersPage.cpp b/call-setting/presenters/pages/BlockedNumbersPage.cpp index c523686..f7792b1 100644 --- a/call-setting/presenters/pages/BlockedNumbersPage.cpp +++ b/call-setting/presenters/pages/BlockedNumbersPage.cpp @@ -165,10 +165,12 @@ namespace call_setting { registerAccessObjects(); - item = getNaviframe().push(getContent()); + item = getNaviframe().push(STR_BLOCKED_NUMBERS_PAGE_TITLE, + getContent()); if (!item) { LOG_RETURN(RES_FAIL, "Naviframe::push() failed!"); } + item.setTitleEnabled(false); getWindow().addEventHandler( INSTANCE_RESUMED, WEAK_DELEGATE_THIS(onInstanceResumed)); diff --git a/call-setting/presenters/pages/KeypadPage.cpp b/call-setting/presenters/pages/KeypadPage.cpp index 088e2f9..4c75b41 100644 --- a/call-setting/presenters/pages/KeypadPage.cpp +++ b/call-setting/presenters/pages/KeypadPage.cpp @@ -16,6 +16,8 @@ #include "KeypadPage.h" +#include "call-setting/resources.h" + #include "call-setting/presenters/common.h" namespace call_setting { @@ -87,10 +89,11 @@ namespace call_setting { FAIL_RETURN(createAtspiHighlightHelper(), "createAtspiHighlightHelper() failed!"); - item = getNaviframe().push(getContent()); + item = getNaviframe().push(STR_SR_KEYPAD, getContent()); if (!item) { LOG_RETURN(RES_FAIL, "Naviframe::push() failed!"); } + item.setTitleEnabled(false); return RES_OK; } diff --git a/call-setting/presenters/pages/MainPage.cpp b/call-setting/presenters/pages/MainPage.cpp index a861486..17c6a01 100644 --- a/call-setting/presenters/pages/MainPage.cpp +++ b/call-setting/presenters/pages/MainPage.cpp @@ -28,6 +28,7 @@ namespace call_setting { + using ucl::Atspi; using ucl::ListPresenter; using ucl::NaviItem; using ucl::NaviframeSRef; @@ -88,7 +89,8 @@ namespace call_setting { CallSettingSRef callSetting, Private) : Page(rc, std::move(navi), std::move(onExitRequest)), - m_callSetting(std::move(callSetting)) + m_callSetting(std::move(callSetting)), + m_isRefreshProcessing(false) { } @@ -108,6 +110,8 @@ namespace call_setting { LOG_RETURN(RES_FAIL, "Naviframe::push() failed!"); } + getItemAtspi().setNameCb(WEAK_DELEGATE_THIS(onAtspiNameCb)); + tryRefreshCallWaiting(); return RES_OK; @@ -161,7 +165,17 @@ namespace call_setting { m_processing->complete( STR_NETWORK_OR_SIM_ERROR_TOAST_MESSAGE); m_processing.reset(); + return; } + + m_isRefreshProcessing = true; + } + + CString MainPage::onAtspiNameCb(Atspi &atspi) + { + return CString::dup(m_isRefreshProcessing ? + STR_OPENING_POPUP_MESSAGE.translate() : + STR_MAIN_PAGE_TITLE.translate()); } void MainPage::onVoicemailItemSelected() @@ -196,8 +210,11 @@ namespace call_setting { void MainPage::onCallWaitingResult(Result result) { + m_isRefreshProcessing = false; + if (isGood(result)) { m_processing->complete(); + util::resetAtspiHighlight(getWindow()); } else { RESLOG(result, "Setting update failed"); m_processing->complete( @@ -206,5 +223,4 @@ namespace call_setting { m_processing.reset(); } - } diff --git a/call-setting/presenters/pages/MainPage.h b/call-setting/presenters/pages/MainPage.h index 5c4e416..c8e274d 100644 --- a/call-setting/presenters/pages/MainPage.h +++ b/call-setting/presenters/pages/MainPage.h @@ -61,6 +61,7 @@ namespace call_setting { void onBlockListItemSelected(); void onPageExitRequest(Page &page); void onCallWaitingResult(ucl::Result result); + ucl::CString onAtspiNameCb(ucl::Atspi &atspi); private: CallSettingSRef m_callSetting; @@ -69,6 +70,8 @@ namespace call_setting { PageWRef m_page; + bool m_isRefreshProcessing; + friend class ucl::ReffedObj; }; } diff --git a/call-setting/presenters/pages/NoContentPage.cpp b/call-setting/presenters/pages/NoContentPage.cpp index 42cba65..dfda60b 100644 --- a/call-setting/presenters/pages/NoContentPage.cpp +++ b/call-setting/presenters/pages/NoContentPage.cpp @@ -128,10 +128,12 @@ namespace call_setting { atspi.setRole(ELM_ATSPI_ROLE_TEXT); atspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME); - item = getNaviframe().push(getContent()); + item = getNaviframe().push(STR_BLOCKED_NUMBERS_PAGE_TITLE, + getContent()); if (!item) { LOG_RETURN(RES_FAIL, "Naviframe::push() failed!"); } + item.setTitleEnabled(false); return RES_OK; } diff --git a/call-setting/presenters/pages/VoicemailPage.cpp b/call-setting/presenters/pages/VoicemailPage.cpp index 1a5922e..4921fa1 100644 --- a/call-setting/presenters/pages/VoicemailPage.cpp +++ b/call-setting/presenters/pages/VoicemailPage.cpp @@ -138,10 +138,11 @@ namespace call_setting { makeListItems(); - item = getNaviframe().push(getContent()); + item = getNaviframe().push(STR_VOICEMAIL_PAGE_TITLE, getContent()); if (!item) { LOG_RETURN(RES_FAIL, "Naviframe::push() failed!"); } + item.setTitleEnabled(false); return RES_OK; } diff --git a/call-setting/presenters/pages/base/Page.cpp b/call-setting/presenters/pages/base/Page.cpp index 9c4362c..0455f30 100644 --- a/call-setting/presenters/pages/base/Page.cpp +++ b/call-setting/presenters/pages/base/Page.cpp @@ -27,6 +27,7 @@ namespace call_setting { namespace { namespace impl { namespace call_setting { + using ucl::Atspi; using ucl::Layout; using ucl::NaviItem; using ucl::NaviframeSRef; @@ -273,4 +274,17 @@ namespace call_setting { { updateRotaryActiveState(); } + + Atspi &Page::getItemAtspi() + { + ensureItemAtspi(); + return *m_itemAtspi; + } + + void Page::ensureItemAtspi() + { + if (!m_itemAtspi) { + m_itemAtspi = makeShared(m_item); + } + } } diff --git a/call-setting/presenters/pages/base/Page.h b/call-setting/presenters/pages/base/Page.h index b694a33..2ea028a 100644 --- a/call-setting/presenters/pages/base/Page.h +++ b/call-setting/presenters/pages/base/Page.h @@ -78,6 +78,12 @@ namespace call_setting { virtual void onBackKey(); virtual bool isNeedRotaryActivate() const; + /** + * @brief Gets Atspi of navi item of this page + * @return Reference to Atspi of navi item + */ + ucl::Atspi &getItemAtspi(); + // GuiPresenter // virtual void onActivate() override; @@ -91,6 +97,8 @@ namespace call_setting { void updateActiveState(); + void ensureItemAtspi(); + void onTransitionStarted(ucl::Widget &widget, void *eventInfo); void onTransitionFinished(ucl::Widget &widget, void *eventInfo); void onTopPageChanged(ucl::Widget &widget, void *eventInfo); @@ -102,6 +110,7 @@ namespace call_setting { const ucl::NaviframeSRef m_navi; const ExitRequestHandler m_onExitRequest; ucl::NaviItem m_item; + ucl::AtspiSRef m_itemAtspi; PageContentSRef m_content; PageSRef m_selfRef; Evas_Object *m_circleObject; diff --git a/call-setting/view/helpers.cpp b/call-setting/view/helpers.cpp index 11e5cc0..ce24600 100644 --- a/call-setting/view/helpers.cpp +++ b/call-setting/view/helpers.cpp @@ -25,10 +25,57 @@ namespace call_setting { namespace { namespace impl { + using ucl::Layout; + using ucl::Timeout; + constexpr EoDataKey CIRCLE_SURFACE {"callsetting,eext,circle,surface"}; constexpr LayoutTheme LAYOUT_FAKE_ACCESS_OBJECT {"layout", "callsetting", "fake_access_object"}; + + const auto ATSPI_HIGHLIGHT_RESET_TIMEOUT = 0.1; + + UCL_DECLARE_REF_ALIASES(AtspiHighlightResetter); + + static AtspiHighlightResetterSRef ATSPI_HIGHLIGHT_RESETTER; + + class AtspiHighlightResetter final : public ucl::RefCountAware { + public: + AtspiHighlightResetter(ucl::IRefCountObj &rc, ucl::Window &win) : + RefCountAware(&rc) + { + m_fakeObj = util::createFakeAccessObject(win); + + win.addEventHandler(WidgetEvent::DEL, + WEAK_DELEGATE_THIS(onWindowDel)); + + m_fakeObj->getAtspi().highlight(); + + resetTimeout(); + } + + void resetTimeout() + { + m_timeout = Timeout::create(ATSPI_HIGHLIGHT_RESET_TIMEOUT, + WEAK_DELEGATE_THIS(onResetTimeout)); + } + + private: + void onResetTimeout(Timeout *sender) + { + ATSPI_HIGHLIGHT_RESETTER.reset(); + } + + void onWindowDel(Widget &widget, void *eventInfo) + { + ATSPI_HIGHLIGHT_RESETTER.reset(); + } + + private: + ucl::ElmWidgetSRef m_fakeObj; + ucl::TimeoutSRef m_timeout; + + }; }}} namespace call_setting { namespace util { @@ -141,6 +188,17 @@ namespace call_setting { namespace util { return makeShared(ao); } + + void resetAtspiHighlight(ucl::Window &window) + { + if (impl::ATSPI_HIGHLIGHT_RESETTER) { + impl::ATSPI_HIGHLIGHT_RESETTER->resetTimeout(); + return; + } + + impl::ATSPI_HIGHLIGHT_RESETTER = + makeShared(window); + } }} namespace call_setting { diff --git a/call-setting/view/helpers.h b/call-setting/view/helpers.h index e5a8ec4..a0d47f6 100644 --- a/call-setting/view/helpers.h +++ b/call-setting/view/helpers.h @@ -27,8 +27,15 @@ namespace call_setting { namespace util { Eext_Circle_Surface *getCircleSurface(const ucl::ElmWidget &widget); ucl::ElmWidgetSRef createFakeAccessObject(ucl::ElmWidget &parent); + ucl::ElmWidgetSRef createAccessObject(ucl::EdjeWidget &widget, ucl::EdjePart part); + + /** + * @brief Resets Atspi highlight from current highlighted object + * @param[in] window Application window instance + */ + void resetAtspiHighlight(ucl::Window &window); }} namespace call_setting { diff --git a/ucl/include/ucl/gui/NaviItem.h b/ucl/include/ucl/gui/NaviItem.h index 62a5e71..495d3d8 100644 --- a/ucl/include/ucl/gui/NaviItem.h +++ b/ucl/include/ucl/gui/NaviItem.h @@ -45,17 +45,17 @@ namespace ucl { void setPopHandler(PopHandler handler) const; /** - * Pops all items of the naviframe state to this item + * @brief Pops all items of the naviframe state to this item */ void popTo() const; /** - * Moves this naviframe item to the top of the naviframe stack + * @brief Moves this naviframe item to the top of the naviframe stack */ void promote() const; /** - * Sets naviframe item tile visibility state + * @brief Sets naviframe item tile visibility state * @param[in] value Visibility state. true - visible, false - invisible * @param[in] useTransition Title show/hide transition animation flag. * true - use transition animation, false - no transition. @@ -63,13 +63,13 @@ namespace ucl { void setTitleEnabled(bool value, bool useTransition = false) const; /** - * Gets naviframe item tile visibility state + * @brief Gets naviframe item tile visibility state * @retrun Visibility state. true - visible, false - invisible */ bool isTitleEnabled() const; /** - * Sets naviframe item tile text + * @brief Sets naviframe item tile text * @param[in] title Translatable text to use as a title */ void setTitle(const TString &title) const; diff --git a/ucl/include/ucl/gui/NaviItem.hpp b/ucl/include/ucl/gui/NaviItem.hpp index b4cba2b..8b4730d 100644 --- a/ucl/include/ucl/gui/NaviItem.hpp +++ b/ucl/include/ucl/gui/NaviItem.hpp @@ -36,11 +36,6 @@ namespace ucl { inline void NaviItem::setTitle(const TString &title) const { - if (isEmpty(title)) { - setTitleEnabled(false); - } else { - setText(title); - setTitleEnabled(true); - } + setText(title); } } diff --git a/ucl/include/ucl/gui/Naviframe.hpp b/ucl/include/ucl/gui/Naviframe.hpp index a95ab56..c5dc4bf 100644 --- a/ucl/include/ucl/gui/Naviframe.hpp +++ b/ucl/include/ucl/gui/Naviframe.hpp @@ -14,6 +14,19 @@ * limitations under the License. */ +namespace ucl { namespace himpl { + + inline void initItemTitle(const NaviItem item, const TString &title) + { + if (isEmpty(title)) { + item.setTitleEnabled(false); + } else { + item.setTitle(title); + item.setTitleEnabled(true); + } + } +}} + namespace ucl { // Naviframe::Builder // @@ -90,7 +103,7 @@ namespace ucl { auto result = NaviItem(elm_naviframe_item_push(getEo(), nullptr, as_eo(backBtn), as_eo(moreBtn), as_eo(content), style.name)); - result.setTitle(title); + himpl::initItemTitle(result, title); if (result != getBottomItem()) { setInTransition(true); } @@ -128,7 +141,7 @@ namespace ucl { auto result = NaviItem(elm_naviframe_item_insert_after(getEo(), after, nullptr, as_eo(backBtn), as_eo(moreBtn), as_eo(content), style.name)); - result.setTitle(title); + himpl::initItemTitle(result, title); return result; } @@ -167,7 +180,7 @@ namespace ucl { auto result = NaviItem(elm_naviframe_item_insert_before(getEo(), before, nullptr, as_eo(backBtn), as_eo(moreBtn), as_eo(content), style.name)); - result.setTitle(title); + himpl::initItemTitle(result, title); return result; } -- cgit v1.2.3 From 558ec4df602cbcab54e7d7c0aba5273f7f066371 Mon Sep 17 00:00:00 2001 From: Igor Olshevskyi Date: Tue, 24 Oct 2017 13:08:05 +0300 Subject: TizenRefApp-9677 [Call Setting] Implement Screen Reader support for ProcessingPresenter Change-Id: I153398455dc27cd5076b2ccb71c2691fba384ba8 --- .../presenters/misc/ProcessingPresenter.cpp | 54 ++++++++++++++++++++-- call-setting/presenters/misc/ProcessingPresenter.h | 10 ++++ 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/call-setting/presenters/misc/ProcessingPresenter.cpp b/call-setting/presenters/misc/ProcessingPresenter.cpp index ea6085b..767ec1e 100644 --- a/call-setting/presenters/misc/ProcessingPresenter.cpp +++ b/call-setting/presenters/misc/ProcessingPresenter.cpp @@ -29,6 +29,7 @@ namespace call_setting { namespace { namespace impl { {"layout", "callsetting", "proccessing"}; constexpr EdjePart PART_PROGRESS {"callsetting.swallow.progress"}; + constexpr EdjePart PART_TEXT_AO {"elm.text"}; constexpr EdjeSignal SIGNAL_SHOW {"callsetting,show"}; constexpr EdjeSignal SIGNAL_SHOW_BG {"callsetting,show,bg"}; @@ -47,8 +48,6 @@ namespace call_setting { using ucl::Layout; using ucl::Timeout; - using ucl::PART_TEXT; - // ProcessingPresenter::Builder // ProcessingPresenter::Builder::Builder() : @@ -133,9 +132,12 @@ namespace call_setting { FAIL_RETURN(createWidget(parent, processingText), "createWidget() failed!"); FAIL_RETURN(moveWidget(), "moveWidget() failed!"); - FAIL_RETURN(createProgress(), "createProgress() failed!"); + FAIL_RETURN(createTextAo(processingText), "createTextAo() failed!"); + FAIL_RETURN(createAtspiHighlightHelper(), + "createAtspiHighlightHelper() failed!"); + if (forceProgress) { showProgress(); } else { @@ -167,11 +169,29 @@ namespace call_setting { LOG_RETURN(RES_FAIL, "Layout::build() failed!"); } + setDeactivatorSink(m_widget); + m_widget->setText(processingText); return RES_OK; } + Result ProcessingPresenter::createTextAo(const TString &processingText) + { + m_textAo = util::createAccessObject(*m_widget.get(), + impl::PART_TEXT_AO); + if (!m_textAo) { + LOG_RETURN(RES_FAIL, "util::createAccessObject() failed!"); + } + + auto &atspi = m_textAo->getAtspi(); + atspi.setTDomain(TEXT_DOMAIN); + atspi.setName(processingText.getCStr()); + atspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME); + + return RES_OK; + } + Result ProcessingPresenter::moveWidget() { const auto win = m_widget->getWindow(); @@ -201,6 +221,8 @@ namespace call_setting { elm_progressbar_pulse(progressEo, EINA_TRUE); show(progress); + progress.getAtspi().setHighlightable(false); + return RES_OK; } @@ -218,6 +240,8 @@ namespace call_setting { { m_widget->emit(impl::SIGNAL_SHOW); + show(*m_textAo); + m_state = State::PROCESSING; m_mayFinish = false; @@ -234,6 +258,8 @@ namespace call_setting { m_widget->emit(impl::SIGNAL_HIDE_PROGRESS); + hide(*m_textAo); + ToastDialog::Builder builder; builder.setText(std::move(m_completeText)); if (m_iconType == IconType::CHECK) { @@ -305,4 +331,26 @@ namespace call_setting { tryFinish(); } + + Result ProcessingPresenter::createAtspiHighlightHelper() + { + m_atspiHelper = AtspiHighlightHelper::newInstance(*this); + if (!m_atspiHelper) { + LOG_RETURN(RES_FAIL, + "AtspiHighlightHelper::newInstance() failed!"); + } + m_atspiHelper->registerObject(getWindow()); + m_atspiHelper->registerObject(*m_textAo); + + m_atspiHelper->setEventHandler(WEAK_DELEGATE_THIS(onAtspiHighlight)); + + return RES_OK; + } + + const Elm_Interface_Atspi_Accessible *ProcessingPresenter::onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation) + { + return as_ao(m_textAo); + } } diff --git a/call-setting/presenters/misc/ProcessingPresenter.h b/call-setting/presenters/misc/ProcessingPresenter.h index 1f1d3e1..27b769a 100644 --- a/call-setting/presenters/misc/ProcessingPresenter.h +++ b/call-setting/presenters/misc/ProcessingPresenter.h @@ -24,6 +24,8 @@ #include "ucl/mvp/GuiPresenter.h" +#include "call-setting/presenters/misc/AtspiHighlightHelper.h" + #include "call-setting/presenters/types.h" namespace call_setting { @@ -118,6 +120,7 @@ namespace call_setting { const ucl::TString &processingText); ucl::Result moveWidget(); ucl::Result createProgress(); + ucl::Result createTextAo(const ucl::TString &processingText); bool resetTimeout(double timeout); void showProgress(); @@ -128,6 +131,11 @@ namespace call_setting { void onTimeout(ucl::Timeout *sender); void onWindowDel(ucl::Widget &widget, void *eventInfo); + ucl::Result createAtspiHighlightHelper(); + const Elm_Interface_Atspi_Accessible *onAtspiHighlight( + const Elm_Interface_Atspi_Accessible *ao, + Elm_Atspi_Relation_Type flowRelation); + private: enum class State { IDLING, @@ -142,6 +150,8 @@ namespace call_setting { ucl::TString m_completeText; IconType m_iconType; ProcessingPresenterSRef m_selfRef; + AtspiHighlightHelperSRef m_atspiHelper; + ucl::ElmWidgetSRef m_textAo; ucl::TimeoutSRef m_timeout; State m_state; -- cgit v1.2.3 From 866d7bedceac4113add151875f0bc873384e4886 Mon Sep 17 00:00:00 2001 From: Igor Nazarov Date: Thu, 26 Oct 2017 13:30:50 +0300 Subject: [Call Setting] Hot-fix of recent changes Change-Id: Ic8752b12a020951bd7f7dcae4c227f0dcafada33 --- ucl/include/ucl/gui/Atspi.h | 2 +- ucl/include/ucl/gui/Atspi.hpp | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ucl/include/ucl/gui/Atspi.h b/ucl/include/ucl/gui/Atspi.h index 16db2b6..dcea2b1 100644 --- a/ucl/include/ucl/gui/Atspi.h +++ b/ucl/include/ucl/gui/Atspi.h @@ -251,7 +251,7 @@ namespace ucl { /** * @brief Passes through original constant Access object pointer * @param[in] ao Constant Access object pointer - * @return Constant acces object pointer + * @return Constant Access object pointer */ const Elm_Interface_Atspi_Accessible *as_ao( const Elm_Interface_Atspi_Accessible *ao); diff --git a/ucl/include/ucl/gui/Atspi.hpp b/ucl/include/ucl/gui/Atspi.hpp index 0a3e267..e1c53f6 100644 --- a/ucl/include/ucl/gui/Atspi.hpp +++ b/ucl/include/ucl/gui/Atspi.hpp @@ -1,3 +1,19 @@ +/* + * 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/helpers.h" #include "ucl/util/logging.h" @@ -149,7 +165,7 @@ namespace ucl { if (!m_isGestureCbRegistered) { m_isGestureCbRegistered = true; elm_atspi_accessible_gesture_cb_set(m_ao, - CALLBACK_A(Atspi::onAtspiGesture), this); + UCL_CALLBACK_A(Atspi::onAtspiGesture), this); } } @@ -158,7 +174,7 @@ namespace ucl { if (!m_isNameCbRegistered) { m_isNameCbRegistered = true; elm_atspi_accessible_name_cb_set(m_ao, - CALLBACK_A(Atspi::onAtspiNameCb), this); + UCL_CALLBACK_A(Atspi::onAtspiNameCb), this); } } @@ -167,7 +183,7 @@ namespace ucl { if (!m_isDescriptionCbRegistered) { m_isDescriptionCbRegistered = true; elm_atspi_accessible_description_cb_set(m_ao, - CALLBACK_A(Atspi::onAtspiDescriptionCb), this); + UCL_CALLBACK_A(Atspi::onAtspiDescriptionCb), this); } } -- cgit v1.2.3 From 3d869d6b98658dd43eb0a85f23a52d20c9a6c431 Mon Sep 17 00:00:00 2001 From: "Alexander\\ Kovalenko" Date: Wed, 11 Oct 2017 17:12:31 +0300 Subject: TizenRefApp-9536[Call Setting] Add doxygen documentation to Presenters items Change-Id: I86ff20bae7532f673f39e79845851fa75ad216be --- .../presenters/items/BlockUnknownCallersItem.h | 38 ++++++++++ call-setting/presenters/items/CallWaitingItem.h | 29 ++++++++ call-setting/presenters/items/CallerIdItem.h | 24 +++++++ call-setting/presenters/items/RadioOptionItem.h | 49 +++++++++++++ call-setting/presenters/items/SimpleListItem.h | 58 +++++++++++++++ .../presenters/items/VoicemailNumberItem.h | 24 +++++++ .../presenters/items/base/CheckOptionItem.h | 82 +++++++++++++++++++++- .../presenters/items/base/ListOptionItem.h | 69 +++++++++++++++++- ucl/include/ucl/mvp/ListItemPresenter.h | 2 +- 9 files changed, 369 insertions(+), 6 deletions(-) diff --git a/call-setting/presenters/items/BlockUnknownCallersItem.h b/call-setting/presenters/items/BlockUnknownCallersItem.h index af0a238..0b59ba5 100644 --- a/call-setting/presenters/items/BlockUnknownCallersItem.h +++ b/call-setting/presenters/items/BlockUnknownCallersItem.h @@ -25,19 +25,57 @@ namespace call_setting { UCL_DECLARE_REF_ALIASES(BlockUnknownCallersItem); + /** + * @brief Represents checkable option item + */ class BlockUnknownCallersItem final : public CheckOptionItem { public: + + /** + * @brief Creates instance of BlockUnknownCallersItem + * @param[in] model Shared reference to model component + * @return Shared reference to BlockUnknownCallersItem + */ static BlockUnknownCallersItemSRef newInstance( BlockUnknownCallersSRef model); protected: // CheckOptionItem // + /** + * @brief Gets state + * @return Current state + */ virtual State getState() const final override; + + /** + * @brief Gets option value + * @return Current option value. @see TriState + */ virtual TriState getOptionValue() const final override; + + /** + * @brief Gets option title + * @return Title + */ virtual ucl::CString getOptionTitle() const final override; + + /** + * @brief Checks if there is secondary text + * @return true if option has secondary text, false - if not + */ virtual bool hasOptionSubText() const final override; + + /** + * @brief Gets option sub text + * @return Sub text + */ virtual ucl::CString getOptionSubText() const final override; + + /** + * @brief Requests option value change + * @param[in] value Value + */ virtual void requestOptionValueChange(bool value) final override; private: diff --git a/call-setting/presenters/items/CallWaitingItem.h b/call-setting/presenters/items/CallWaitingItem.h index bc8e81c..4e079f0 100644 --- a/call-setting/presenters/items/CallWaitingItem.h +++ b/call-setting/presenters/items/CallWaitingItem.h @@ -27,8 +27,18 @@ namespace call_setting { UCL_DECLARE_REF_ALIASES(CallWaitingItem); + /** + * @brief Represents call waiting option item + */ class CallWaitingItem final : public CheckOptionItem { public: + + /** + * @brief Creates instance of CallWaitingItem + * @param[in] cw Shared reference to model component + * @param[in] toastParent Shared reference to toast parent + * @return Shared reference to CallWaitingItem + */ static CallWaitingItemSRef newInstance( CallWaitingSRef cw, ucl::ElmWidgetSRef toastParent); @@ -36,9 +46,28 @@ namespace call_setting { // CheckOptionItem // + /** + * @brief Gets state + * @return Current state + */ virtual State getState() const final override; + + /** + * @brief Gets option value + * @return Current option value. @see TriState + */ virtual TriState getOptionValue() const final override; + + /** + * @brief Gets option title + * @return Title + */ virtual ucl::CString getOptionTitle() const final override; + + /** + * @brief Requests option value change + * @param[in] value Value + */ virtual void requestOptionValueChange( const bool value) final override; diff --git a/call-setting/presenters/items/CallerIdItem.h b/call-setting/presenters/items/CallerIdItem.h index da6a6b5..9b8b5c7 100644 --- a/call-setting/presenters/items/CallerIdItem.h +++ b/call-setting/presenters/items/CallerIdItem.h @@ -25,8 +25,18 @@ namespace call_setting { UCL_DECLARE_REF_ALIASES(CallerIdItem); + /** + * @brief Represents caller id option item + */ class CallerIdItem final : public ListOptionItem { public: + + /** + * @brief Creates instance of CallerIdItem + * @param[in] model Shared reference to model component + * @param[in] dailogParent Shared reference to dialog parent + * @return Shared reference to CallerIdItem + */ static CallerIdItemSRef newInstance(CallerIdSRef model, ucl::ElmWidgetSRef dialogParent); @@ -39,8 +49,22 @@ namespace call_setting { // ListOptionItem // + /** + * @brief Gets option value + * @return Current option value + */ virtual int getOptionValue() const final override; + + /** + * @brief Gets option title + * @return Title + */ virtual ucl::CString getOptionTitle() const final override; + + /** + * @brief Requests option value change + * @param[in] value Value + */ virtual void requestOptionValueChange(const int value) final override; private: diff --git a/call-setting/presenters/items/RadioOptionItem.h b/call-setting/presenters/items/RadioOptionItem.h index 7cc68e5..6d0c6a4 100644 --- a/call-setting/presenters/items/RadioOptionItem.h +++ b/call-setting/presenters/items/RadioOptionItem.h @@ -27,28 +27,77 @@ namespace call_setting { UCL_DECLARE_REF_ALIASES(RadioOptionItem); + /** + * @brief Represents radio option item + */ class RadioOptionItem final : public ucl::ListItemPresenter { public: + /** + * @brief Radio group value type + */ using GroupValue = ucl::MonoObservable; UCL_DECLARE_REF_ALIASES_NOFW(GroupValue); public: + /** + * @brief Constructor + * @param[in] rc Pointer to IRefCountObj (passed automatically) + * @param[in] text Item text + * @param[in] value Item value + * @param[in] groupValue Group value + * @param[in] rGroup Shared reference to radio group + */ RadioOptionItem(ucl::IRefCountObj &rc, ucl::TString text, int value, GroupValueSRef groupValue, ucl::RadioBoxSRef rGroup); protected: + /** + * @brief Default destructor + */ ~RadioOptionItem() = default; + /** + * @brief Radio changed callback + * @param[in] widget Widget + * @param[in] eventInfo Event info + */ void onRadioChanged(ucl::Widget &widget, void *eventInfo); + + /** + * @brief Sets ATSPI parameters + * @param[in] widget Widget + */ void setAtspiParams(ucl::ElmWidget &widget); // ListItemPresenter // + /** + * @brief Gets GUI item insertion parameters + * @details Called just before item is added to list + * @return Item insertion params structure + */ virtual ItemInsertionParams getItemInsertionParams() final override; + + /** + * @brief Gets the content widget for specific GUI item part + * @param[in] part Target GUI item part + * @param[in] parent Parent widget to use for the content widget + * @return Shared reference to the content widget or NULL + */ virtual ucl::WidgetSRef getItemPartContent(ucl::EdjePart part, ucl::ElmWidget &parent) final override; + + /** + * @brief Gets text for specific GUI item part + * @param[in] part Target GUI item part + * @return Text for specific part or NULL + */ virtual ucl::CString getItemPartText(ucl::EdjePart part) final override; + + /** + * @brief Occurs when GUI item is selected + */ virtual void onItemSelected() final override; private: diff --git a/call-setting/presenters/items/SimpleListItem.h b/call-setting/presenters/items/SimpleListItem.h index b953a0f..f75c997 100644 --- a/call-setting/presenters/items/SimpleListItem.h +++ b/call-setting/presenters/items/SimpleListItem.h @@ -26,32 +26,90 @@ namespace call_setting { UCL_DECLARE_REF_ALIASES(SimpleListItem); + /** + * @brief Represents simple option item + */ class SimpleListItem final : public ucl::ListItemPresenter, public ucl::IPickable { public: + /** + * @brief Constructor + * @param[in] rc Pointer to IRefCountObj (passed automatically) + * @param[in] style Item style + * @param[in] parts Item parts + * @param[in] useAtspiRedundant ATSPI object redundancy flag. + * true if item is ATSPI-redundant, false - if not + */ SimpleListItem(ucl::IRefCountObj &rc, ucl::ElmStyle style, PartTextMap parts, bool useAtspiRedundant = false); + /** + * @brief Constructor + * @details Constructs item as ATSPI redundant object + * @param[in] rc Pointer to IRefCountObj (passed automatically) + * @param[in] style Item style + */ SimpleListItem(ucl::IRefCountObj &rc, ucl::ElmStyle style); + /** + * @brief Sets select handler + * @param[in] handler Handler + */ void setItemSelectHandler(NotiHandler handler); + + /** + * @brief Sets longpress handler + * @param[in] handler Handler + */ void setItemLongpressHandler(NotiHandler handler); // IPickable // + /** + * @brief Gets picker + * @return Picker. @see ucl::IPicker + */ virtual ucl::IPicker &getPicker() final override; protected: // ListItemPresenter // + /** + * @brief Gets GUI item insertion parameters + * @details Called just before item is added to list + * @return Item insertion params structure + */ virtual ItemInsertionParams getItemInsertionParams() override; + /** + * @brief Gets text for specific GUI item part + * @param[in] part Target GUI item part + * @return Text for specific part or NULL + */ virtual ucl::CString getItemPartText(ucl::EdjePart part) override; + + /** + * @brief Gets the content widget for specific GUI item part + * @param[in] part Target GUI item part + * @param[in] parent Parent widget to use for the content widget + * @return Shared reference to the content widget or NULL + */ virtual ucl::WidgetSRef getItemPartContent( ucl::EdjePart part, ucl::ElmWidget &parent) override; + /** + * @brief Occurs when GUI item is selected + */ virtual void onItemSelected() override; + + /** + * @brief Occurs when GUI item is long pressed + */ virtual void onItemLongpressed() override; + + /** + * @brief Occurs when GUI item is attached + */ virtual void onItemAttached() override; private: diff --git a/call-setting/presenters/items/VoicemailNumberItem.h b/call-setting/presenters/items/VoicemailNumberItem.h index ed9957c..2070109 100644 --- a/call-setting/presenters/items/VoicemailNumberItem.h +++ b/call-setting/presenters/items/VoicemailNumberItem.h @@ -27,8 +27,17 @@ namespace call_setting { UCL_DECLARE_REF_ALIASES(VoicemailNumberItem); + /** + * @brief Represents voicemail number item + */ class VoicemailNumberItem final : public ucl::ListItemPresenter { public: + /** + * @brief Creates instance of VoicemailNumberItem + * @param[in] model Shared reference to model component + * @param[in] itemSelectHandler Item select handler + * @return Shared reference to VoicemailNumberItem + */ static VoicemailNumberItemSRef newInstance( VoicemailSRef model, NotiHandler itemSelectHandler); @@ -36,8 +45,23 @@ namespace call_setting { protected: // ListItemPresenter // + /** + * @brief Gets GUI item insertion parameters + * @details Called just before item is added to list + * @return Item insertion params structure + */ virtual ItemInsertionParams getItemInsertionParams() final override; + + /** + * @brief Gets text for specific GUI item part + * @param[in] part Target GUI item part + * @return Text for specific part or NULL + */ virtual ucl::CString getItemPartText(ucl::EdjePart part) final override; + + /** + * @brief Occurs when GUI item is selected + */ virtual void onItemSelected() final override; private: diff --git a/call-setting/presenters/items/base/CheckOptionItem.h b/call-setting/presenters/items/base/CheckOptionItem.h index 9d6ece8..7e64168 100644 --- a/call-setting/presenters/items/base/CheckOptionItem.h +++ b/call-setting/presenters/items/base/CheckOptionItem.h @@ -25,37 +25,115 @@ namespace call_setting { UCL_DECLARE_REF_ALIASES(CheckOptionItem); + /** + * @brief Represents item with on/off indicator + */ class CheckOptionItem : public ucl::ListItemPresenter { protected: + + /** + * @brief Enumeration of item states + */ enum class State { - NORMAL, - PROCESSING + NORMAL, /**< Normal*/ + PROCESSING /**< Working*/ }; protected: + + /** + * @brief Constructor + * @param[in] rc Pointer to IRefCountObj (passed automatically) + */ CheckOptionItem(ucl::IRefCountObj &rc); + + /** + * @brief Default destructor + */ ~CheckOptionItem(); + + /** + * @brief Gets state + * @return Current state + */ virtual State getState() const = 0; + + /** + * @brief Gets option value + * @return Current option value. @see TriState + */ virtual TriState getOptionValue() const = 0; + + /** + * @brief Gets option title + * @return Title + */ virtual ucl::CString getOptionTitle() const = 0; + + /** + * @brief Checks if there is secondary text + * @return true if option has secondary text, false - if not + */ virtual bool hasOptionSubText() const; + + /** + * @brief Gets option sub text + * @return Sub text + */ virtual ucl::CString getOptionSubText() const; + + /** + * @brief Requests option value change + * @param[in] value Value + */ virtual void requestOptionValueChange(bool value) = 0; + /** + * @brief Prepares option data + */ void prepare(); + + /** + * @brief Updates option data + */ void update(); // ListItemPresenter // + /** + * @brief Gets GUI item insertion parameters + * @details Called just before item is added to list + * @return Item insertion params structure + */ virtual ItemInsertionParams getItemInsertionParams() final override; + /** + * @brief Occurs when GUI item is attached to this item presenter + * @details Called after getItemInsertionParams() at the end of + * item to list addition process. + */ virtual void onItemAttached() final override; + /** + * @brief Gets the content widget for specific GUI item part + * @param[in] part Target GUI item part + * @param[in] parent Parent widget to use for the content widget + * @return Shared reference to the content widget or NULL + */ virtual ucl::WidgetSRef getItemPartContent( ucl::EdjePart part, ucl::ElmWidget &parent) final override; + + /** + * @brief Gets text for specific GUI item part + * @param[in] part Target GUI item part + * @return Text for specific part or NULL + */ virtual ucl::CString getItemPartText(ucl::EdjePart part) final override; + /** + * @brief Occurs when GUI item is selected + */ virtual void onItemSelected() final override; private: diff --git a/call-setting/presenters/items/base/ListOptionItem.h b/call-setting/presenters/items/base/ListOptionItem.h index e59449a..322e28b 100644 --- a/call-setting/presenters/items/base/ListOptionItem.h +++ b/call-setting/presenters/items/base/ListOptionItem.h @@ -26,39 +26,102 @@ namespace call_setting { UCL_DECLARE_REF_ALIASES(ListOptionItem); + /** + * @brief Represents option item + */ class ListOptionItem : public ucl::ListItemPresenter { protected: + /** + * @brief Option entry + */ struct Option final { - int id; - ucl::TString text; + int id; /**< Option ID*/ + ucl::TString text; /**< Option name*/ + + /** + * @brief Constructor + * @param[in] optId Option ID + * @param[in] text Option name + */ Option(int optId, ucl::TString text) : id(optId), text(std::move(text)) { } }; + /** + * @brief List of options + */ using Options = std::list