summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Nazarov <i.nazarov@samsung.com>2017-10-18 13:58:10 +0300
committerIgor Nazarov <i.nazarov@samsung.com>2017-10-18 13:58:10 +0300
commit1f0c45345b33e69daf48cb04c6ef373a4d66a160 (patch)
treed669985afd96cb65d31a7f9686fe13a35a37ec31
parentd6158b58552446c949c122c44255da4a2436832a (diff)
downloadcall-setting-1f0c45345b33e69daf48cb04c6ef373a4d66a160.tar.gz
call-setting-1f0c45345b33e69daf48cb04c6ef373a4d66a160.tar.bz2
call-setting-1f0c45345b33e69daf48cb04c6ef373a4d66a160.zip
TizenRefApp-9619 [Call Setting] Integrate ucl::Atspi into ucl::ElmWidget
Change-Id: I33400ec067005fda7364d3d1bb1700eb090a0e62
-rw-r--r--ucl/include/ucl/gui/ElmWidget.h37
-rw-r--r--ucl/include/ucl/gui/ElmWidget.hpp19
-rw-r--r--ucl/include/ucl/gui/GenlistItem.h2
-rw-r--r--ucl/source/gui/ElmWidget.cpp37
4 files changed, 28 insertions, 67 deletions
diff --git a/ucl/include/ucl/gui/ElmWidget.h b/ucl/include/ucl/gui/ElmWidget.h
index 26828fa..c69ee46 100644
--- a/ucl/include/ucl/gui/ElmWidget.h
+++ b/ucl/include/ucl/gui/ElmWidget.h
@@ -18,19 +18,10 @@
#define __UCL_GUI_ELM_WIDGET_H__
#include "Widget.h"
-
-/**
- * @brief Prefix to use in Smart events for forwarded ATSPI events
- */
-#define UCL_SMART_FWD_ATSPI UCL_SMART_FWD "atspi,"
+#include "Atspi.h"
namespace ucl {
- /**
- * @brief Occurs on ATSPI gesture
- */
- constexpr SmartEvent ATSPI_ON_GESTURE {UCL_SMART_FWD_ATSPI "gesture"};
-
class Window;
UCL_DECLARE_REF_ALIASES(ElmWidget);
@@ -41,25 +32,19 @@ namespace ucl {
*/
class ElmWidget : public Widget {
public:
- /**
- * @brief Constructor
- * @param[in] eo Underlying Evas object of the widget
- * @param[in] isOwner Evas object ownership flag (optional: true)
- */
- explicit ElmWidget(Evas_Object *eo, bool isOwner = true);
+ using Widget::Widget;
/**
- * @brief Constructor
- * @param[in] rc Pointer to IRefCountObj (passed automatically)
- * @param[in] eo Underlying Evas object of the widget
- * @param[in] isOwner Evas object ownership flag (optional: true)
+ * @brief Gets Atspi of this widget
+ * @return Reference to the Atspi object
*/
- ElmWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = true);
+ Atspi &getAtspi();
/**
- * @brief Destructor
+ * @brief Gets Atspi of this widget (constant version)
+ * @return Reference to the constant Atspi object
*/
- virtual ~ElmWidget();
+ Atspi &getAtspi() const;
/**
* @brief Sets enabled state of the widget
@@ -117,14 +102,12 @@ namespace ucl {
virtual void setFocusedImpl(bool value) final override;
virtual bool isFocusedImpl() const final override;
- virtual bool ensureFwdEvent(SmartEvent fwdEvent) override;
private:
- Eina_Bool onAtspiGesture(Elm_Atspi_Gesture_Info gestureInfo,
- Evas_Object *obj);
+ void ensureAtspi();
private:
- bool m_isAtspiGestureCbSet;
+ SharedRef<Atspi> m_atspi;
friend class ReffedObj<ElmWidget>;
};
diff --git a/ucl/include/ucl/gui/ElmWidget.hpp b/ucl/include/ucl/gui/ElmWidget.hpp
index a0ad01a..2151cfd 100644
--- a/ucl/include/ucl/gui/ElmWidget.hpp
+++ b/ucl/include/ucl/gui/ElmWidget.hpp
@@ -16,9 +16,24 @@
namespace ucl {
- inline ElmWidget::ElmWidget(Evas_Object *const eo, const bool isOwner) :
- ElmWidget(nullptr, eo, isOwner)
+ inline Atspi &ElmWidget::getAtspi()
{
+ ensureAtspi();
+ return *m_atspi;
+ }
+
+ inline Atspi &ElmWidget::getAtspi() const
+ {
+ // Need cast for lazy initialization. Can't use mutable.
+ const_cast<ElmWidget *>(this)->ensureAtspi();
+ return *m_atspi;
+ }
+
+ inline void ElmWidget::ensureAtspi()
+ {
+ if (!m_atspi) {
+ m_atspi = makeShared<Atspi>(getEo());
+ }
}
inline void ElmWidget::setEnabled(const bool value)
diff --git a/ucl/include/ucl/gui/GenlistItem.h b/ucl/include/ucl/gui/GenlistItem.h
index 8a56a19..3de1517 100644
--- a/ucl/include/ucl/gui/GenlistItem.h
+++ b/ucl/include/ucl/gui/GenlistItem.h
@@ -98,7 +98,7 @@ namespace ucl {
void update(const Elm_Genlist_Item_Class *newItc) const;
/**
- * @brief Update only specific parts and fileds of the item
+ * @brief Update only specific parts and fields of the item
* @param[in] parts Globbing expresion to match a part name.
* Can include '*', '?', and '.'
* @param[in] fields Bitwise or of FILED_* enumeration
diff --git a/ucl/source/gui/ElmWidget.cpp b/ucl/source/gui/ElmWidget.cpp
index 278407b..cace7be 100644
--- a/ucl/source/gui/ElmWidget.cpp
+++ b/ucl/source/gui/ElmWidget.cpp
@@ -23,19 +23,6 @@
namespace ucl {
- ElmWidget::ElmWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner) :
- Widget(rc, eo, isOwner),
- m_isAtspiGestureCbSet(false)
- {
- }
-
- ElmWidget::~ElmWidget()
- {
- if (m_isAtspiGestureCbSet) {
- elm_atspi_accessible_gesture_cb_set(getEo(), nullptr, nullptr);
- }
- }
-
void ElmWidget::setFocusedImpl(const bool value)
{
elm_object_focus_set(getEo(), toEina(value));
@@ -46,30 +33,6 @@ namespace ucl {
return elm_object_focus_get(getEo());
}
- bool ElmWidget::ensureFwdEvent(const SmartEvent fwdEvent)
- {
- if (Widget::ensureFwdEvent(fwdEvent)) {
- return true;
- }
- if (fwdEvent == ATSPI_ON_GESTURE) {
- if (!m_isAtspiGestureCbSet) {
- m_isAtspiGestureCbSet = true;
- elm_atspi_accessible_gesture_cb_set(getEo(),
- CALLBACK_A(ElmWidget::onAtspiGesture), this);
- }
- return true;
- }
- return false;
- }
-
- Eina_Bool ElmWidget::onAtspiGesture(Elm_Atspi_Gesture_Info gestureInfo,
- Evas_Object *obj)
- {
- AtspiGestureEventInfo eventInfo{gestureInfo};
- callEvent(ATSPI_ON_GESTURE, &eventInfo);
- return toEina(eventInfo.preventDefault);
- }
-
Window *ElmWidget::getWindow() const
{
return dynamicWidgetCast<Window>(getTopWidget());