TizenRefApp-9690 [Call UI] Update UCL source files 96/157996/2
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Thu, 26 Oct 2017 12:37:07 +0000 (15:37 +0300)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Fri, 27 Oct 2017 06:47:01 +0000 (09:47 +0300)
Change-Id: I175a8c227169df3f12bee6c6101d3fef5b3dd54e

134 files changed:
call-ui/model/impl/BatteryStateSource.cpp
call-ui/model/impl/BluetoothManager.cpp
call-ui/model/impl/CallInfo.cpp
call-ui/model/impl/CallManager.cpp
call-ui/model/impl/ConnectionStateSource.cpp
call-ui/model/impl/RssiStateSource.cpp
call-ui/model/impl/SoundManager.cpp
call-ui/presenters/Instance.cpp
call-ui/presenters/dialogs/AcceptDialog.cpp
call-ui/presenters/dialogs/base/Dialog.cpp
call-ui/presenters/items/SimpleListItem.cpp
call-ui/presenters/items/SimpleListItem.h
call-ui/presenters/misc/AccessoryPresenter.cpp
call-ui/presenters/misc/AtspiHighlightHelper.cpp
call-ui/presenters/misc/AtspiHighlightHelper.h
call-ui/presenters/misc/CallInfoPresenter.cpp
call-ui/presenters/misc/CallInfoPresenter.h
call-ui/presenters/misc/CallStatusPresenter.cpp
call-ui/presenters/misc/CallStatusPresenter.h
call-ui/presenters/misc/DeviceStatePresenter.cpp
call-ui/presenters/misc/MoreOptionsPresenter.cpp
call-ui/presenters/misc/MoreOptionsPresenter.h
call-ui/presenters/misc/RejectMsgPresenter.cpp
call-ui/presenters/misc/RejectMsgPresenter.h
call-ui/presenters/pages/KeypadPage.cpp
call-ui/presenters/pages/KeypadPage.h
call-ui/presenters/pages/MainPage.cpp
call-ui/presenters/pages/MainPage.h
call-ui/view/AcceptRejectWidget.cpp
call-ui/view/Slider.cpp
call-ui/view/VolumeControl.cpp
call-ui/view/VolumeControl.h
call-ui/view/helpers.cpp
call-ui/view/helpers.h
ucl/include/ucl/appfw/IInstance.h
ucl/include/ucl/appfw/IInstanceAppControlExt.h
ucl/include/ucl/appfw/IInstanceContext.h
ucl/include/ucl/appfw/InstanceManagerBase.h
ucl/include/ucl/appfw/SysEventProvider.h
ucl/include/ucl/appfw/UIApp.h
ucl/include/ucl/appfw/helpers.h
ucl/include/ucl/appfw/types.h
ucl/include/ucl/gui/Atspi.h [new file with mode: 0644]
ucl/include/ucl/gui/Atspi.hpp [new file with mode: 0644]
ucl/include/ucl/gui/EdjeWidget.h
ucl/include/ucl/gui/EdjeWidget.hpp
ucl/include/ucl/gui/ElmWidget.h
ucl/include/ucl/gui/ElmWidget.hpp
ucl/include/ucl/gui/Genlist.h
ucl/include/ucl/gui/GenlistItem.h
ucl/include/ucl/gui/Layout.h
ucl/include/ucl/gui/NaviItem.h
ucl/include/ucl/gui/NaviItem.hpp
ucl/include/ucl/gui/Naviframe.h
ucl/include/ucl/gui/Naviframe.hpp
ucl/include/ucl/gui/RadioBox.h
ucl/include/ucl/gui/RadioBox.hpp
ucl/include/ucl/gui/StyledWidget.h
ucl/include/ucl/gui/Theme.h
ucl/include/ucl/gui/Theme.hpp
ucl/include/ucl/gui/Widget.h
ucl/include/ucl/gui/Widget.hpp
ucl/include/ucl/gui/WidgetItem.h
ucl/include/ucl/gui/WidgetItem.hpp
ucl/include/ucl/gui/Window.h
ucl/include/ucl/gui/helpers.h
ucl/include/ucl/gui/stdTheme/common.h
ucl/include/ucl/gui/stdTheme/layout.h
ucl/include/ucl/gui/stdTheme/naviframe.h
ucl/include/ucl/gui/types.h
ucl/include/ucl/misc/Aspect.h
ucl/include/ucl/misc/AutoObject.h
ucl/include/ucl/misc/CArray.h
ucl/include/ucl/misc/CString.h
ucl/include/ucl/misc/CString.hpp
ucl/include/ucl/misc/ConstCString.h
ucl/include/ucl/misc/ConstCString.hpp
ucl/include/ucl/misc/Event.h
ucl/include/ucl/misc/HashMap.h
ucl/include/ucl/misc/MonoObservable.h
ucl/include/ucl/misc/Observable.h
ucl/include/ucl/misc/RefCountAware.h
ucl/include/ucl/misc/TString.h
ucl/include/ucl/misc/Timeout.h
ucl/include/ucl/misc/Variant.h
ucl/include/ucl/misc/types.h
ucl/include/ucl/mvp/GuiPresenter.h
ucl/include/ucl/mvp/IPickable.h
ucl/include/ucl/mvp/IPicker.h
ucl/include/ucl/mvp/IPickerHost.h
ucl/include/ucl/mvp/ListItemPresenter.h
ucl/include/ucl/mvp/ListPresenter.h
ucl/include/ucl/util/delegation/BaseDelegate.h
ucl/include/ucl/util/delegation/BaseDelegate2.h
ucl/include/ucl/util/delegation/Callback.h
ucl/include/ucl/util/delegation/Delegate.h
ucl/include/ucl/util/delegation/Delegate.hpp
ucl/include/ucl/util/delegation/Delegate2.h
ucl/include/ucl/util/delegation/Delegate2.hpp
ucl/include/ucl/util/delegation/helpers.h
ucl/include/ucl/util/delegation/internal.h [new file with mode: 0644]
ucl/include/ucl/util/delegation/macro.h
ucl/include/ucl/util/helpers.h
ucl/include/ucl/util/helpers.hpp
ucl/include/ucl/util/logging.h
ucl/include/ucl/util/memory/BaseRef.h
ucl/include/ucl/util/memory/IRefCountObj.h
ucl/include/ucl/util/memory/RefCountObj.h
ucl/include/ucl/util/memory/RefCounterMT.h
ucl/include/ucl/util/memory/RefCounterST.h
ucl/include/ucl/util/memory/ReffedObj.h
ucl/include/ucl/util/memory/SharedRef.h
ucl/include/ucl/util/memory/WeakRef.h
ucl/include/ucl/util/memory/helpers.h
ucl/include/ucl/util/smartDelegation/WeakDelegate.h
ucl/include/ucl/util/smartDelegation/macro.h
ucl/include/ucl/util/threading/CondVar.h
ucl/include/ucl/util/threading/Mutex.h
ucl/include/ucl/util/threading/MutexLock.h
ucl/include/ucl/util/threading/Thread.h
ucl/include/ucl/util/threading/Thread.hpp
ucl/include/ucl/util/types/Result.h
ucl/include/ucl/util/types/baseTypes.h
ucl/include/ucl/util/types/classTypes.h
ucl/source/appfw/UIApp.cpp
ucl/source/gui/ElmWidget.cpp
ucl/source/gui/Genlist.cpp
ucl/source/gui/Layout.cpp
ucl/source/gui/Naviframe.cpp
ucl/source/gui/RadioBox.cpp
ucl/source/gui/Widget.cpp
ucl/source/gui/Window.cpp
ucl/source/mvp/ListItemPresenter.cpp
ucl/source/mvp/ListPresenter.cpp

index 4fb149847f6bb156538f840b05929d50c5fb563c..1a64825ff1ad31645890531298c926690417d40e 100644 (file)
@@ -139,25 +139,25 @@ namespace callui {
                int res = vconf_notify_key_changed(VCONFKEY_SYSMAN_CHARGER_STATUS,
                                CALLBACK_B(BatteryStateSource::onBatteryStateChangedCb), this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                res = vconf_notify_key_changed(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW,
                                CALLBACK_B(BatteryStateSource::onBatteryStateChangedCb), this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                res = vconf_notify_key_changed(VCONFKEY_SYSMAN_BATTERY_STATUS_LOW,
                                CALLBACK_B(BatteryStateSource::onBatteryStateChangedCb), this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                res = vconf_notify_key_changed(VCONFKEY_SYSMAN_BATTERY_CAPACITY,
                                CALLBACK_B(BatteryStateSource::onBatteryStateChangedCb), this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                return RES_OK;
index f5f39eb14a5fe0402ac5725bdcb21b6214a4d9be..0cb78c0168cad11085c7ddf6815a764e726e67dd 100644 (file)
@@ -90,10 +90,10 @@ namespace callui {
                                "initializeBluetooth() failed!");
 
                FAIL_RETURN(registerVolumeChangeHandling(),
-                               "registerVolumeChangeHandling() failed");
+                               "registerVolumeChangeHandling() failed!");
 
                FAIL_RETURN(registerScoStateHandling(),
-                               "registerScoStateHandling() failed");
+                               "registerScoStateHandling() failed!");
 
                FAIL_RETURN(registerHeadsetConnectionHandling(),
                                "registerHeadsetConnectionHandling() failed!");
index 36eed0804c160fe80812ebfa0672b2d747f4b595..d1913d3153e3d681c88e9424bcba623373155a8b 100644 (file)
@@ -196,7 +196,7 @@ namespace callui {
        {
                struct tm tmp{0};
                FAIL_RETURN_VALUE(impl::getCurrTimeDiffInTm(m_startTime, tmp),
-                               {0}, "getCurrTimeDiffInTm() failed");
+                               {0}, "getCurrTimeDiffInTm() failed!");
                return tmp;
        }
 
index 3df8dcdf1972e1ed2548f371a5438f4052cf1f51..c63803f646d2e010e7686d7cce4396f9253f6524 100644 (file)
@@ -58,7 +58,7 @@ namespace callui {
        {
                m_contactInfoProvider = ContactInfoProvider::newInstance();
                if (!m_contactInfoProvider) {
-                       ELOG("ContactInfoProvider::newInstance() failed");
+                       ELOG("ContactInfoProvider::newInstance() failed!");
                }
 
                FAIL_RETURN(initCalls(), "initCalls() failed!");
index e6eb76895e5281f6c7c8b621eef6014ad6b81c4f..0fbdbf18b1763ce8d14306a1b80168a72d6eb61c 100644 (file)
@@ -70,7 +70,7 @@ namespace callui {
        {
                int state = VCONFKEY_WIFI_UNCONNECTED;
                if (vconf_get_int(VCONFKEY_WIFI_STATE, &state) < 0) {
-                       ELOG("Get WiFi connection state failed");
+                       ELOG("Get WiFi connection state failed!");
                        return false;
                }
                return (state == VCONFKEY_WIFI_CONNECTED);
@@ -208,7 +208,7 @@ namespace callui {
                                return PacketDirection::NO_INPUT;
                        }
                }
-               ELOG("Get WiFi transfer state failed");
+               ELOG("Get WiFi transfer state failed!");
                return PacketDirection::NONE;
        }
 
@@ -223,7 +223,7 @@ namespace callui {
                        default:                   return PacketDirection::NO_INPUT;
                        }
                }
-               ELOG("Get packet state failed");
+               ELOG("Get packet state failed!");
                return PacketDirection::NONE;
        }
 
@@ -261,7 +261,7 @@ namespace callui {
                                CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb),
                                this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                res = vconf_notify_key_changed(
@@ -269,7 +269,7 @@ namespace callui {
                                CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb),
                                this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                res = vconf_notify_key_changed(
@@ -277,7 +277,7 @@ namespace callui {
                                CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb),
                                this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                res = vconf_notify_key_changed(
@@ -285,7 +285,7 @@ namespace callui {
                                CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb),
                                this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                res = vconf_notify_key_changed(
@@ -293,7 +293,7 @@ namespace callui {
                                CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb),
                                this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                res = vconf_notify_key_changed(
@@ -301,7 +301,7 @@ namespace callui {
                                CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb),
                                this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                res = vconf_notify_key_changed(
@@ -309,7 +309,7 @@ namespace callui {
                                CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb),
                                this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                res = vconf_notify_key_changed(
@@ -317,7 +317,7 @@ namespace callui {
                                CALLBACK_B(ConnectionStateSource::onConnTypeChangedCb),
                                this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                // PACKET
@@ -326,7 +326,7 @@ namespace callui {
                                CALLBACK_B(ConnectionStateSource::onPacketStateChangedCb),
                                this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                res = vconf_notify_key_changed(
@@ -334,7 +334,7 @@ namespace callui {
                                CALLBACK_B(ConnectionStateSource::onPacketStateChangedCb),
                                this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                return RES_OK;
index fe80040ce454d14de2464fc7eb863872d51829ae..915d71577bb57112fd79f29d158c8b595d44552b 100644 (file)
@@ -158,31 +158,31 @@ namespace callui {
                int res = vconf_notify_key_changed(VCONFKEY_TELEPHONY_SVC_ROAM,
                                CALLBACK_B(RssiStateSource::onRssiChangedCb), this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                res = vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
                                CALLBACK_B(RssiStateSource::onRssiChangedCb), this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                res = vconf_notify_key_changed(VCONFKEY_TELEPHONY_SVCTYPE,
                                CALLBACK_B(RssiStateSource::onRssiChangedCb), this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                res = vconf_notify_key_changed(VCONFKEY_TELEPHONY_RSSI,
                                CALLBACK_B(RssiStateSource::onRssiChangedCb), this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                res = vconf_notify_key_changed(VCONFKEY_TELEPHONY_ROAM_ICON_MODE,
                                CALLBACK_B(RssiStateSource::onRssiChangedCb), this);
                if (res != 0) {
-                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
 
                return RES_OK;
index f243df894d0760247a3836978d86c540388ccd48..563b6c246e7c0d4313fd9e5d867705763c4f7aff 100644 (file)
@@ -95,7 +95,7 @@ namespace callui {
                                &m_deviceVolumeCbId);
                if (ret != SOUND_MANAGER_ERROR_NONE) {
                        LOG_RETURN(RES_FAIL,
-                                       "sound_manager_add_volume_changed_cb() failed");
+                                       "sound_manager_add_volume_changed_cb() failed!");
                }
 
                if (isBTSupported()) {
index f976f3964a7b47f029bb7ced221db97b6e5fffc8..4a91defc10073e51f034f27c6eb6a72bb63b1d36 100644 (file)
@@ -61,7 +61,7 @@ namespace callui {
        {
                m_powerKeyHoldTimout.reset();
 
-               elm_win_keygrab_unset(*m_win, impl::STR_POWER_KEY, 0, 0);
+               elm_win_keygrab_unset(as_eo(*m_win), impl::STR_POWER_KEY, 0, 0);
 
                if (m_keyUpEventHandler) {
                        ecore_event_handler_del(m_keyUpEventHandler);
@@ -76,7 +76,7 @@ namespace callui {
 
                m_win = m_context->getWindow();
 
-               elm_win_keygrab_set(*m_win, impl::STR_POWER_KEY, 0, 0, 0,
+               elm_win_keygrab_set(as_eo(*m_win), impl::STR_POWER_KEY, 0, 0, 0,
                                ELM_WIN_KEYGRAB_TOPMOST);
 
                m_keyUpEventHandler = ecore_event_handler_add(ECORE_EVENT_KEY_UP,
@@ -102,8 +102,10 @@ namespace callui {
                }
 
                m_win->getConformant().setContent(*m_navi);
-               elm_atspi_accessible_translation_domain_set(*m_win, TEXT_DOMAIN);
-               elm_atspi_accessible_name_set(*m_win, AO_STR_CALL);
+
+               auto &atspi = m_win->getAtspi();
+               atspi.setTDomain(TEXT_DOMAIN);
+               atspi.setName(AO_STR_CALL);
 
                FAIL_RETURN(utils::createCircleSurface(*m_navi),
                                "createCircleSurface() failed!");
index 64a2373d05333010f22d68aa4821a7aa73403f37..f3d2ced032731c9fe14c222c6977b0727ddfb0c3 100644 (file)
@@ -75,7 +75,7 @@ namespace callui {
                                {
                                        return doPrepare();
                                }),
-                               "Dialog::prepare failed");
+                               "Dialog::prepare() failed!");
 
                return RES_OK;
        }
@@ -86,7 +86,7 @@ namespace callui {
 
                FAIL_RETURN(createList(), "createList() failed!");
 
-               FAIL_RETURN(createCircleObject(), "createCircleObject() failed");
+               FAIL_RETURN(createCircleObject(), "createCircleObject() failed!");
 
                FAIL_RETURN(createListItems(), "createListItems() failed!");
 
@@ -103,10 +103,10 @@ namespace callui {
                }
                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_circleObj = eext_circle_object_genlist_add(
-                               m_listPresenter->getWidget(), surface);
+                               as_eo(m_listPresenter->getWidget()), surface);
 
                eext_circle_object_genlist_scroller_policy_set(m_circleObj,
                                ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO);
index 7cde517262e43d149369f11989428cae46e41130..5236a6664339bf61766c8a665f49d81580b8d4c4 100644 (file)
@@ -38,17 +38,17 @@ namespace callui {
        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!");
                }
 
                m_popup = makeShared<StyledWidget>(popupEo);
-
                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 callui {
                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 callui {
        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();
index 46b12ad07e15275f6ae19577f05b92c22aa5287d..e34dc1d05a83ee1c926d1411b3a6fb92eab41871 100644 (file)
 
 namespace callui {
 
-       SimpleListItem::SimpleListItem(IRefCountObj &rc,
-                       ElmStyle style, PartTextMap parts) :
+       using ucl::ListItemPresenter;
+
+       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(IRefCountObj &rc, ElmStyle style) :
+               ListItemPresenter::ListItemPresenter(rc),
+               m_listItemStyle(style),
+               m_useAtspiRedundant(true)
        {
        }
 
@@ -57,4 +67,10 @@ namespace callui {
                }
        }
 
+       void SimpleListItem::onItemAttached()
+       {
+               if (m_useAtspiRedundant) {
+                       getItemAtspi()->setRole(ELM_ATSPI_ROLE_REDUNDANT_OBJECT);
+               }
+       }
 }
index 03f8e6f55e5d88f9a2febdd5c83ba292d9a71a4f..2ec4a9ac04b0522e6f85a394a98cea749076b86a 100644 (file)
@@ -27,20 +27,30 @@ namespace callui {
 
        class SimpleListItem final : public ucl::ListItemPresenter {
        public:
-
                /**
-                * @brief Constructor
-                * @param[in] rc Pointer to IRefCountObj (passed automatically)
-                * @param[in] style Item style
-                * @param[in] parts Map of item text parts value
-                */
+               * @brief Constructor
+               * @param[in] rc Pointer to IRefCountObj (passed automatically)
+               * @param[in] style Item style
+               * @param[in] parts Map of item text parts value
+               * @param[in] useAtspiRedundant true - if item is Atspi redundant object,
+               *  false - otherwise
+               */
                SimpleListItem(ucl::IRefCountObj &rc, ucl::ElmStyle style,
-                               PartTextMap parts = {});
+                               PartTextMap parts, bool useAtspiRedundant = false);
 
                /**
-                * @brief Sets item select handler
-                * @param[in] handler Select handler
-                */
+               * @brief Constructor
+               * @details Constructor that creates items already 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 item select handler
+               * @param[in] handler Select handler
+               */
                void setItemSelectHandler(NotiHandler handler);
 
        protected:
@@ -62,6 +72,11 @@ namespace callui {
                 */
                virtual void onItemSelected() override;
 
+               /**
+                * @see ucl::ListItemPresenter::onItemAttached()
+                */
+               virtual void onItemAttached() override;
+
        private:
                ~SimpleListItem() = default;
 
@@ -70,6 +85,7 @@ namespace callui {
                const PartTextMap m_listItemParts;
 
                NotiHandler m_onItemSelected;
+               bool m_useAtspiRedundant;
 
                friend class ucl::ReffedObj<SimpleListItem>;
        };
index 59045d42d82d23600eb36fa9c3eab583a545c3d2..dcee9e5f2b63f9bf985138f113abafb811a7d2f3 100644 (file)
@@ -138,8 +138,8 @@ namespace callui {
                }
 
                auto result = makeShared<AccessoryPresenter>(m_sm, m_exitHandler);
-               FAIL_RETURN_VALUE(result->prepare(parent, *m_parentWidget, m_cm),
-                               {}, "result->prepare() failed!");
+               FAIL_RETURN_VALUE(result->prepare(parent, *m_parentWidget, m_cm), {},
+                               "result->prepare() failed!");
 
                return result;
        }
@@ -167,16 +167,16 @@ namespace callui {
                        ElmWidget &parentWidget, const ICallManagerSRef &cm)
        {
                FAIL_RETURN(GuiPresenter::prepare(parent),
-                               "Presenter::prepare() failed");
+                               "Presenter::prepare() failed!");
 
                FAIL_RETURN(createWidget(parentWidget),
-                               "createWidget() failed");
+                               "createWidget() failed!");
 
                FAIL_RETURN(createSlider(),
-                               "createSlider() failed");
+                               "createSlider() failed!");
 
                FAIL_RETURN(createVolumeControl(),
-                               "createVolumeControl() failed");
+                               "createVolumeControl() failed!");
 
 
                updateCurrentVolume();
@@ -186,7 +186,7 @@ namespace callui {
                updateMode(cm);
 
                FAIL_RETURN(updateModeRelativeComponents(cm),
-                               "updateComponents() failed");
+                               "updateComponents() failed!");
 
                return RES_OK;
        }
@@ -214,7 +214,7 @@ namespace callui {
                m_audioState = m_sm->getAudioState();
 
                FAIL_RETURN(updateModeRelativeComponents(cm),
-                               "updateModeRelativeComponents() failed");
+                               "updateModeRelativeComponents() failed!");
 
                return RES_OK;
        }
@@ -247,13 +247,13 @@ namespace callui {
                updateMaxVolume();
                updateCurrentVolume();
 
-               FAIL_RETURN(createVolumeBtn(), "createVolumeBtn() failed");
+               FAIL_RETURN(createVolumeBtn(), "createVolumeBtn() failed!");
                m_widget->setContent(*m_volumeBtn, impl::PART_SWL_SLOT1);
 
-               FAIL_RETURN(createMuteBtn(), "createMuteBtn create failed");
+               FAIL_RETURN(createMuteBtn(), "createMuteBtn create failed!");
                m_widget->setContent(*m_muteBtn, impl::PART_SWL_SLOT3);
 
-               FAIL_RETURN(createBluetoothBtn(), "createBluetoothBtn() failed");
+               FAIL_RETURN(createBluetoothBtn(), "createBluetoothBtn() failed!");
                m_widget->setContent(*m_bluetoothBtn, impl::PART_SWL_SLOT2);
 
                if (m_mode == CallMode::OUTGOING) {
@@ -280,7 +280,7 @@ namespace callui {
                                isUnknownCaller(*callInfo)) &&
                                !(callInfo->getConferenceMemberCount() > 1) &&
                                !(callInfo->getContactInfo())) {
-                       FAIL_RETURN(createAddContactBtn(), "createAddContactBtn() failed");
+                       FAIL_RETURN(createAddContactBtn(), "createAddContactBtn() failed!");
                        m_widget->setContent(*m_addContactBtn, impl::PART_SWL_SLOT2);
                        m_unsavedPhoneNumber = callInfo->getPhoneNumber();
                }
@@ -317,7 +317,7 @@ namespace callui {
                                setMaxValue(m_sm->getMaxVolume()).
                                build(*m_widget);
                if (!m_slider) {
-                       LOG_RETURN(RES_FAIL, "Slider::build() failed");
+                       LOG_RETURN(RES_FAIL, "Slider::build() failed!");
                }
                m_widget->setContent(*m_slider, impl::PART_SWL_VOLUME_SLIDER);
 
@@ -332,7 +332,7 @@ namespace callui {
                                setEventHandler(WEAK_DELEGATE_THIS(onVolumeControlEventCb)).
                                build(*m_widget);
                if (!m_vc) {
-                       LOG_RETURN(RES_FAIL, "VolumeControl::build() failed");
+                       LOG_RETURN(RES_FAIL, "VolumeControl::build() failed!");
                }
 
                auto window = m_vc->getWindow();
@@ -353,69 +353,62 @@ namespace callui {
 
        Result AccessoryPresenter::createVolumeBtn()
        {
-               Evas_Object *eo = elm_button_add(*m_widget);
+               Evas_Object *const eo = elm_button_add(as_eo(*m_widget));
                if (!eo) {
-                       LOG_RETURN(RES_FAIL, "eo is NULL");
+                       LOG_RETURN(RES_FAIL, "elm_button_add() failed!");
                }
-
                m_volumeBtn = makeShared<StyledWidget>(eo);
                m_volumeBtn->setStyle(impl::STYLE_BTN_VOLUME);
                m_volumeBtn->addEventHandler(BTN_CLICKED,
                                WEAK_DELEGATE_THIS(onVolumeBtnClicked));
                show(*m_volumeBtn);
 
-               // Screen Reader
-               elm_atspi_accessible_translation_domain_set(*m_volumeBtn, TEXT_DOMAIN);
-               elm_atspi_accessible_name_set(*m_volumeBtn, STR_VOLUME);
+               auto &atspi = m_volumeBtn->getAtspi();
+               atspi.setTDomain(TEXT_DOMAIN);
+               atspi.setName(STR_VOLUME);
 
                return RES_OK;
        }
 
        Result AccessoryPresenter::createMuteBtn()
        {
-               Evas_Object *eo = elm_button_add(*m_widget);
+               Evas_Object *const eo = elm_button_add(as_eo(*m_widget));
                if (!eo) {
-                       LOG_RETURN(RES_FAIL, "eo is NULL");
+                       LOG_RETURN(RES_FAIL, "elm_button_add() failed!");
                }
                m_muteBtn = makeShared<StyledWidget>(eo);
                m_muteBtn->setStyle(impl::STYLE_BTN_MUTE);
                m_muteBtn->addEventHandler(BTN_CLICKED,
                                WEAK_DELEGATE_THIS(onMuteBtnClicked));
-
                show(*m_muteBtn);
 
-               // Screen Reader
-               elm_atspi_accessible_translation_domain_set(*m_muteBtn, TEXT_DOMAIN);
-               elm_atspi_accessible_name_set(*m_muteBtn, AO_STR_MUTE);
+               auto &atspi = m_muteBtn->getAtspi();
+               atspi.setTDomain(TEXT_DOMAIN);
+               atspi.setName(AO_STR_MUTE);
 
                return RES_OK;
        }
 
        Result AccessoryPresenter::createBluetoothBtn()
        {
-               Evas_Object *eo = elm_button_add(*m_widget);
+               Evas_Object *const eo = elm_button_add(as_eo(*m_widget));
                if (!eo) {
-                       LOG_RETURN(RES_FAIL, "eo is NULL");
+                       LOG_RETURN(RES_FAIL, "elm_button_add() failed!");
                }
                m_bluetoothBtn = makeShared<StyledWidget>(eo);
                m_bluetoothBtn->setStyle(impl::STYLE_BTN_BT);
                m_bluetoothBtn->addEventHandler(BTN_CLICKED,
                                WEAK_DELEGATE_THIS(onBluetoothBtnClicked));
-
                show(*m_bluetoothBtn);
 
-               // Screen Reader
-               elm_atspi_accessible_translation_domain_set(*m_bluetoothBtn, TEXT_DOMAIN);
+               auto &atspi = m_bluetoothBtn->getAtspi();
+               atspi.setTDomain(TEXT_DOMAIN);
                if (m_audioState == AudioStateType::BT) {
                        m_bluetoothBtn->emit(impl::SIGNAL_TURN_ON);
-                       // Screen Reader
-                       elm_atspi_accessible_name_set(*m_bluetoothBtn,
-                                       STR_MORE_GEAR);
+                       atspi.setName(STR_MORE_GEAR);
                } else {
                        m_bluetoothBtn->emit(impl::SIGNAL_TURN_OFF);
-                       // Screen Reader
-                       elm_atspi_accessible_name_set(*m_bluetoothBtn,
-                                       STR_MORE_HEADSET);
+                       atspi.setName(STR_MORE_HEADSET);
                }
 
                if (!m_sm->isBTSupported()) {
@@ -427,9 +420,9 @@ namespace callui {
 
        Result AccessoryPresenter::createAddContactBtn()
        {
-               Evas_Object *eo = elm_button_add(*m_widget);
+               Evas_Object *const eo = elm_button_add(as_eo(*m_widget));
                if (!eo) {
-                       LOG_RETURN(RES_FAIL, "eo is NULL");
+                       LOG_RETURN(RES_FAIL, "elm_button_add() failed!");
                }
                m_addContactBtn = makeShared<StyledWidget>(eo);
                m_addContactBtn->setStyle(impl::STYLE_BTN_ADD_CONTACT);
@@ -437,10 +430,9 @@ namespace callui {
                                WEAK_DELEGATE_THIS(onAddContactBtnClicked));
                show(*m_addContactBtn);
 
-               // Screen Reader
-               elm_atspi_accessible_translation_domain_set(*m_addContactBtn, TEXT_DOMAIN);
-               elm_atspi_accessible_name_set(*m_addContactBtn,
-                               AO_STR_ADD_TO_CONTACTS);
+               auto &atspi = m_addContactBtn->getAtspi();
+               atspi.setTDomain(TEXT_DOMAIN);
+               atspi.setName(AO_STR_ADD_TO_CONTACTS);
 
                return RES_OK;
        }
@@ -454,8 +446,7 @@ namespace callui {
 
                show(*m_vc);
                startVCTimer();
-
-               elm_atspi_component_highlight_grab(*m_vc);
+               m_vc->getAtspi().highlight();
        }
 
        void AccessoryPresenter::onMuteBtnClicked(Widget &widget, void *eventInfo)
@@ -474,16 +465,16 @@ namespace callui {
                if (m_audioState == AudioStateType::BT) {
                        auto res = m_sm->setBluetoothState(false);
                        if (res != RES_OK && res != RES_NOT_CONNECTED) {
-                               FAIL_RETURN_VOID(res, "setBluetoothState(false) failed");
+                               FAIL_RETURN_VOID(res, "setBluetoothState(false) failed!");
                        }
                } else {
                        auto res = m_sm->setBluetoothState(true);
                        if (res == RES_NOT_CONNECTED) {
                                DLOG("Launch bluetooth settings...");
                                FAIL_RETURN_VOID(impl::launchBluetoothSettings(),
-                                               "launchBluetoothSettings() failed");
+                                               "launchBluetoothSettings() failed!");
                        } else {
-                               FAIL_RETURN_VOID(res, "setBluetoothState(true) failed");
+                               FAIL_RETURN_VOID(res, "setBluetoothState(true) failed!");
                        }
                }
        }
@@ -492,7 +483,7 @@ namespace callui {
        {
                Result res = impl::launchAddContact(m_unsavedPhoneNumber);
                if (res != RES_OK) {
-                       RESLOG(res, "launchAddContact() failed");
+                       RESLOG(res, "launchAddContact() failed!");
                }
 
                if (const auto handler = m_exitHandler.lock()) {
@@ -574,7 +565,7 @@ namespace callui {
                        show(*m_vc);
                        startVCTimer();
                        m_isVcShowOnRotaryEvent = true;
-                       elm_atspi_component_highlight_grab(*m_vc);
+                       m_vc->getAtspi().highlight();
                }
 
                if (m_isVcShowOnRotaryEvent) {
@@ -634,7 +625,7 @@ namespace callui {
                auto cur = m_sm->getVolume();
                if (checkPossibilityToModifyVolume(cur, true)) {
                        FAIL_RETURN_VOID(m_sm->setVolume(cur + 1),
-                                       "setVolume() failed");
+                                       "setVolume() failed!");
                }
        }
 
@@ -643,7 +634,7 @@ namespace callui {
                auto cur = m_sm->getVolume();
                if (checkPossibilityToModifyVolume(cur, false)) {
                        FAIL_RETURN_VOID(m_sm->setVolume(cur - 1),
-                                       "setVolume() failed");
+                                       "setVolume() failed!");
                }
        }
 
@@ -663,14 +654,10 @@ namespace callui {
                        if (m_bluetoothBtn) {
                                if (m_audioState == AudioStateType::BT) {
                                        m_bluetoothBtn->emit(impl::SIGNAL_TURN_ON);
-                                       // Screen Reader
-                                       elm_atspi_accessible_name_set(*m_bluetoothBtn,
-                                                       STR_MORE_GEAR);
+                                       m_bluetoothBtn->getAtspi().setName(STR_MORE_GEAR);
                                } else {
                                        m_bluetoothBtn->emit(impl::SIGNAL_TURN_OFF);
-                                       // Screen Reader
-                                       elm_atspi_accessible_name_set(*m_bluetoothBtn,
-                                                       STR_MORE_HEADSET);
+                                       m_bluetoothBtn->getAtspi().setName(STR_MORE_HEADSET);
                                }
                        }
                }
@@ -695,7 +682,6 @@ namespace callui {
                        m_vc->setDecreaseBtnEnable(true);
                }
 
-               // Screen Reader
                if (m_vc->isVisible()) {
                        if (!m_isVcShowOnRotaryEvent) {
                                elm_atspi_bridge_utils_say(std::to_string(cur).c_str(),
@@ -724,8 +710,9 @@ namespace callui {
                        return;
                }
 
-               if (!elm_object_disabled_get(*m_muteBtn))
+               if (m_muteBtn->isEnabled()) {
                        updateMuteBtn();
+               }
        }
 
        void AccessoryPresenter::updateMuteBtn()
index e91f2926653e653284ad765d7c673bd572eefb4d..6dc83530821266dbd67abcafccc7e02127992a6d 100644 (file)
@@ -25,16 +25,16 @@ namespace callui { namespace { namespace impl {
 
 namespace callui {
 
+       using ucl::Atspi;
        using ucl::AtspiGestureEventInfo;
-
-       using ucl::ATSPI_ON_GESTURE;
+       using ucl::ListItemPresenter;
 
        AtspiHighlightHelperSRef AtspiHighlightHelper::newInstance(
-                       GuiPresenter &parent, ElmWidget &rootWidget)
+                       GuiPresenter &parent)
        {
                auto result = makeShared<AtspiHighlightHelper>();
 
-               FAIL_RETURN_VALUE(result->prepare(parent, rootWidget), {},
+               FAIL_RETURN_VALUE(result->prepare(parent), {},
                                "result->prepare() failed!");
 
                return result;
@@ -45,47 +45,42 @@ namespace callui {
        {
        }
 
-       Result AtspiHighlightHelper::prepare(GuiPresenter &parent,
-                       ElmWidget &rootWidget)
+       Result AtspiHighlightHelper::prepare(GuiPresenter &parent)
        {
                FAIL_RETURN(GuiPresenter::prepare(parent),
                                "GuiPresenter::prepare() failed!");
 
-               registerWidget(rootWidget);
-
                return RES_OK;
        }
 
-       void AtspiHighlightHelper::setRelationEventHandler(RelationEventHandler handler)
+       void AtspiHighlightHelper::setEventHandler(
+                       EventHandler handler)
        {
-               m_relationEventHandler = handler;
+               m_eventHandler = handler;
        }
 
-       void AtspiHighlightHelper::setGestureEventHandler(GestureEventHandler handler)
+       void AtspiHighlightHelper::registerObject(ElmWidget &widget)
        {
-               m_gestureEventHandler = handler;
+               widget.getAtspi().addGestureHandler(
+                               WEAK_DELEGATE_THIS(onAtspiGesture));
        }
 
-       void AtspiHighlightHelper::registerWidget(ElmWidget &widget)
+       void AtspiHighlightHelper::registerObject(ListItemPresenter &listItemPrs)
        {
-               widget.addEventHandler(ATSPI_ON_GESTURE,
+               listItemPrs.setItemAtspiGestureHandler(
                                WEAK_DELEGATE_THIS(onAtspiGesture));
        }
 
-       void AtspiHighlightHelper::handleAtspiGesture(
-                       Elm_Interface_Atspi_Accessible *ao,
+       void AtspiHighlightHelper::handleAtspiGesture(Atspi &atspi,
                        AtspiGestureEventInfo &e)
        {
-               DLOG("Access object [%p]", ao);
-
-               if (e.stopPropagation) {
-                       DLOG("Ignored. Propagation was stopped.");
-                       return;
-               }
+               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) {
+                       if ((e.gestureInfo.type != ELM_ATSPI_GESTURE_ONE_FINGER_SINGLE_TAP)
+                                       && (currentAo != as_ao(getWindow()))) {
                                DLOG("Prevent default handler");
                                e.preventDefault = true;
                        }
@@ -93,76 +88,61 @@ namespace callui {
                }
 
                e.stopPropagation = true;
-
-               if (const auto handler = m_gestureEventHandler.lock()) {
-                       if (handler(ao, e.gestureInfo.type)) {
-                               DLOG("Prevent default handler");
-                               e.preventDefault = true;
-                               return;
-                       }
-               }
-
                e.preventDefault = false;
 
-               if (!m_relationEventHandler) {
-                       DLOG("Relation event handler does not set");
-                       return;
-               }
-
                const Elm_Atspi_Relation_Type relation = getFlowRelation(e.gestureInfo);
                if (relation == ELM_ATSPI_RELATION_NULL) {
                        DLOG("Not supported gesture type for processing");
                        return;
                }
 
-               Elm_Interface_Atspi_Accessible *relationObj = nullptr;
-               if (const auto handler = m_relationEventHandler.lock()) {
-                       relationObj = handler(ao, relation);
+               const Elm_Interface_Atspi_Accessible *relationAo = nullptr;
+               if (const auto handler = m_eventHandler.lock()) {
+                       relationAo = handler(currentAo, relation);
                }
-               if (!relationObj) {
-                       DLOG("Relation object is NULL!");
+               if (!relationAo) {
+                       DLOG("Relation object is NULL");
                        return;
                }
-               DLOG("Relation object [%p]", relationObj);
+               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 atspiHelper = static_cast<Elm_Interface_Atspi_Accessible *>
-                               (win.getData(impl::ATSPI_HELPER_DATA));
+               auto widget = static_cast<ElmWidget *>(win.getData(
+                               impl::ATSPI_HELPER_DATA));
 
-               if (!atspiHelper) {
-                       const auto obj = utils::createFakeAccessObject(win);
+               if (!widget) {
+                       const ElmWidgetSRef obj = utils::createFakeAccessObject(win);
                        if (!obj) {
-                               LOG_RETURN_VOID(RES_FAIL, "createFakeAccessObject() failed!");
+                               LOG_RETURN_VALUE(RES_FAIL, nullptr,
+                                               "createFakeAccessObject() failed!");
                        }
                        obj->setIsOwner(false);
-                       atspiHelper = obj->getEo();
-                       win.setData(impl::ATSPI_HELPER_DATA, atspiHelper);
+                       widget = obj.get();
+                       win.setData(impl::ATSPI_HELPER_DATA, widget);
                }
 
-               if (ao == win) {
-                       ao = atspiHelper;
-                       elm_atspi_component_highlight_grab(ao);
-               }
-
-               elm_atspi_accessible_relationships_clear(ao);
-               elm_atspi_accessible_relationship_append(ao, relation, relationObj);
+               return &widget->getAtspi();
        }
 
-       void AtspiHighlightHelper::onAtspiGesture(
-                       Widget &widget, void *eventInfo)
+       void AtspiHighlightHelper::onAtspiGesture(Atspi &atspi,
+                       AtspiGestureEventInfo &eventInfo)
        {
-               handleAtspiGesture(widget,
-                               *static_cast<AtspiGestureEventInfo *>(eventInfo));
-       }
-
-       bool AtspiHighlightHelper::handleGesture(Elm_Interface_Atspi_Accessible *ao,
-                       const Elm_Atspi_Gesture_Info &info)
-       {
-               AtspiGestureEventInfo eventInfo {};
-               eventInfo.gestureInfo = info;
-
-               handleAtspiGesture(ao, eventInfo);
-
-               return eventInfo.preventDefault;
+               handleAtspiGesture(atspi, eventInfo);
        }
 }
index e9788c009fd976a58c2e42a1543090952260c1e6..34fd7428052aca4971443a3f81c26a107a1061c0 100644 (file)
@@ -18,6 +18,7 @@
 #define __CALL_UI_PRESENTERS_MISC_ATSPI_HIGHLIGHT_HELPER_H__
 
 #include "ucl/mvp/GuiPresenter.h"
+#include "ucl/mvp/ListItemPresenter.h"
 
 #include "call-ui/presenters/types.h"
 
@@ -32,75 +33,58 @@ namespace callui {
        public:
 
                /**
-                * @brief Relation event handler definition
+                * @brief Event handler definition
                 */
-               using RelationEventHandler = ucl::WeakDelegate<Elm_Interface_Atspi_Accessible *(
-                               Elm_Interface_Atspi_Accessible *ao,
-                               Elm_Atspi_Relation_Type flowRelation)>;
+               using EventHandler = ucl::WeakDelegate<
+                               const Elm_Interface_Atspi_Accessible *(
+                                       const Elm_Interface_Atspi_Accessible *ao,
+                                       Elm_Atspi_Relation_Type flowRelation)>;
 
-               /**
-                * @brief Gesture event handler definition
-                */
-               using GestureEventHandler = ucl::WeakDelegate<bool (
-                               Elm_Interface_Atspi_Accessible *ao,
-                               Elm_Atspi_Gesture_Type gestureType)>;
        public:
 
                /**
                 * @brief Creates new instance of AtspiHighlightHelper
                 * @param[in] parent Parent presenter
-                * @param[in] rootWidget Root widget for Screen Reader
                 * @return Shared reference to AtspiHighlightHelper instance
                 *  on success or NULL otherwise
                 */
-               static AtspiHighlightHelperSRef newInstance(GuiPresenter &parent,
-                               ucl::ElmWidget &rootWidget);
+               static AtspiHighlightHelperSRef newInstance(GuiPresenter &parent);
 
                /**
-                * @brief Sets relation event handler
-                * @param[in] handler Relation event handler
+                * @brief Sets event handler
+                * @param[in] handler Event handler
                 */
-               void setRelationEventHandler(RelationEventHandler handler);
+               void setEventHandler(EventHandler handler);
 
                /**
-                * @brief Sets gesture event handler
-                * @param[in] handler Gesture event handler
-                */
-               void setGestureEventHandler(GestureEventHandler handler);
-
-               /**
-                * @brief Registers widget for Screen Reader events
-                *  relation and gesture events
+                * @brief Registers widget for handling Atspi gesture events
                 * @param[in] widget Widget to register
                 */
-               void registerWidget(ucl::ElmWidget &widget);
+               void registerObject(ucl::ElmWidget &widget);
 
                /**
-                * @brief Handles gesture events on Access object that
-                *  are not register by AtspiHighlightHelper
-                * @param[in] widget Access object
-                * @param[in] info Gesture info
-                * @return true if no need to process gesture event by EFL,
-                *  false otherwise
+                * @brief Registers List Item presenter for handling Atspi
+                *        gesture events
+                * @param[in] listItemPrs List item presenter to register
                 */
-               bool handleGesture(Elm_Interface_Atspi_Accessible *widget,
-                               const Elm_Atspi_Gesture_Info &info);
+               void registerObject(ucl::ListItemPresenter &listItemPrs);
 
        private:
                AtspiHighlightHelper(ucl::IRefCountObj &rc);
                ~AtspiHighlightHelper() = default;
 
-               ucl::Result prepare(GuiPresenter &parent, ucl::ElmWidget &rootWidget);
+               ucl::Result prepare(GuiPresenter &parent);
 
-               void handleAtspiGesture(Elm_Interface_Atspi_Accessible *widget,
+               void handleAtspiGesture(ucl::Atspi &atspi,
                                ucl::AtspiGestureEventInfo &e);
 
-       private:
-               void onAtspiGesture(ucl::Widget &widget, void *eventInfo);
+               void onAtspiGesture(ucl::Atspi &atspi,
+                               ucl::AtspiGestureEventInfo &eventInfo);
+
+               ucl::Atspi *getFakeAtspi();
 
        private:
-               RelationEventHandler m_relationEventHandler;
-               GestureEventHandler m_gestureEventHandler;
+               EventHandler m_eventHandler;
 
                friend class ucl::ReffedObj<AtspiHighlightHelper>;
        };
index 45f3de249fb759e54149e3ac765a981cf217a7e8..0936bf7ebcbf391b98223d60d88144e4c86380d7 100644 (file)
@@ -74,7 +74,7 @@ namespace callui { namespace { namespace impl {
        int getTextWidth(ElmWidget &parent, const char *fontStyle,
                        int fontSize, const std::string &text)
        {
-               auto eoText = evas_object_text_add(evas_object_evas_get(parent));
+               auto eoText = evas_object_text_add(evas_object_evas_get(as_eo(parent)));
                evas_object_text_font_set(eoText, fontStyle, fontSize);
                evas_object_text_style_set(eoText, EVAS_TEXT_STYLE_PLAIN);
                evas_object_text_text_set(eoText, text.c_str());
@@ -342,7 +342,7 @@ namespace callui {
 
        Result CallInfoPresenter::createLabel(const std::string &text)
        {
-               auto *eo = elm_label_add(*m_widget);
+               Evas_Object *const eo = elm_label_add(as_eo(*m_widget));
                if (!eo) {
                        LOG_RETURN(RES_FAIL, "elm_label_add() failed!");
                }
@@ -358,40 +358,40 @@ namespace callui {
                m_label->setStyle(impl::STYLE_SLIDING_LABEL);
                m_label->setText(txtStyle.format(text.c_str()));
 
-               elm_label_slide_mode_set(*m_label, ELM_LABEL_SLIDE_MODE_AUTO);
-               elm_label_wrap_width_set(*m_label,
+               elm_label_slide_mode_set(eo, ELM_LABEL_SLIDE_MODE_AUTO);
+               elm_label_wrap_width_set(eo,
                                ELM_SCALE_SIZE(impl::SUB_TXT_MAX_WIDTH));
 
                double duration = (static_cast<double>(text.size())) /
                                impl::SLIDE_LABEL_DURATION_KOEFF;
-               elm_label_slide_duration_set(*m_label, duration);
-               elm_label_slide_go(*m_label);
+               elm_label_slide_duration_set(eo, duration);
+               elm_label_slide_go(eo);
 
                m_widget->setContent(*m_label, impl::PART_SWL_2LINE);
 
-               elm_atspi_accessible_can_highlight_set(*m_label, EINA_FALSE);
+               m_label->getAtspi().setHighlightable(false);
 
                return RES_OK;
        }
 
        Result CallInfoPresenter::createCallerIdImage(const std::string &imagePath)
        {
-               auto *eo = elm_image_add(*m_widget);
+               Evas_Object *const eo = elm_image_add(as_eo(*m_widget));
                if (!eo) {
-                       LOG_RETURN(RES_FAIL, "elm_image_add() failed");
+                       LOG_RETURN(RES_FAIL, "elm_image_add() failed!");
                }
-               auto callerId = makeShared<StyledWidget>(eo);
-               elm_image_file_set(*callerId, imagePath.c_str(), NULL);
-               elm_image_aspect_fixed_set(*callerId, EINA_TRUE);
-               elm_image_fill_outside_set(*callerId, EINA_TRUE);
+               elm_image_file_set(eo, imagePath.c_str(), NULL);
+               elm_image_aspect_fixed_set(eo, EINA_TRUE);
+               elm_image_fill_outside_set(eo, EINA_TRUE);
 
+               const auto callerId = makeShared<StyledWidget>(eo);
                auto window = callerId->getWindow();
                if (!window) {
                        LOG_RETURN(RES_FAIL, "Window is NULL!");
                }
                int w = 0, h = 0;
                window->getScreenSize(&w, &h);
-               evas_object_size_hint_min_set(*callerId, w, h);
+               callerId->setMin(w, h);
 
                m_widget->setContent(*callerId, impl::PART_SWL_CALLER_ID);
 
@@ -421,7 +421,7 @@ namespace callui {
                        }
 
                        FAIL_RETURN(createCallerIdImage(callerIdPath),
-                                       "createCallerIdImage() failed");
+                                       "createCallerIdImage() failed!");
 
                        m_widget->emit(impl::SIGN_CID_ENABLE, impl::SRC_CALLER_ID);
                }
@@ -457,7 +457,7 @@ namespace callui {
 
                if (!subTxt.empty()) {
                        m_isSubTxtEnable = true;
-                       FAIL_RETURN(createLabel(subTxt), "createLabel() failed");
+                       FAIL_RETURN(createLabel(subTxt), "createLabel() failed!");
                }
 
                if (m_mode == CallMode::INCOMING) {
@@ -651,12 +651,12 @@ namespace callui {
 
        ElmWidget *CallInfoPresenter::getMainTxtAo()
        {
-               return m_mainTxtAO.get();
+               return m_mainTxtAo.get();
        }
 
        ElmWidget *CallInfoPresenter::getSubTxtAo()
        {
-               return m_subTxtAO.get();
+               return m_subTxtAo.get();
        }
 
        ElmWidget *CallInfoPresenter::getStatusTxtAo()
@@ -666,18 +666,17 @@ namespace callui {
 
        Result CallInfoPresenter::setMainTxtAccessObject(const std::string &text)
        {
-               if (!m_mainTxtAO) {
-                       m_mainTxtAO = utils::createAccessObjectFromLyPart(*m_widget,
-                                       *m_widget,
-                                       impl::PART_AO_MAIN_TXT);
-                       if (!m_mainTxtAO) {
-                               LOG_RETURN(RES_FAIL, "createAccessObjectFromLyPart() failed!");
+               if (!m_mainTxtAo) {
+                       m_mainTxtAo = utils::createAccessObjectFromPart(*m_widget,
+                                       *m_widget, impl::PART_AO_MAIN_TXT);
+                       if (!m_mainTxtAo) {
+                               LOG_RETURN(RES_FAIL, "createAccessObjectFromPart() failed!");
                        }
                }
 
-               elm_atspi_accessible_reading_info_type_set(*m_mainTxtAO,
-                               ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
-               elm_atspi_accessible_name_set(*m_mainTxtAO, text.c_str());
+               auto &atspi = m_mainTxtAo->getAtspi();
+               atspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
+               atspi.setName(text.c_str());
 
                return RES_OK;
        }
@@ -685,23 +684,21 @@ namespace callui {
        Result CallInfoPresenter::setSubTxtAccessObject(const std::string &text)
        {
                if (!text.empty()) {
-                       if (!m_subTxtAO) {
-                               m_subTxtAO = utils::createAccessObjectFromLyPart(*m_widget,
-                                               *m_widget,
-                                               impl::PART_AO_SUB_TXT);
-                               if (!m_subTxtAO) {
+                       if (!m_subTxtAo) {
+                               m_subTxtAo = utils::createAccessObjectFromPart(*m_widget,
+                                               *m_widget, impl::PART_AO_SUB_TXT);
+                               if (!m_subTxtAo) {
                                        LOG_RETURN(RES_FAIL,
-                                                       "createAccessObjectFromLyPart() failed!");
+                                                       "createAccessObjectFromPart() failed!");
                                }
                        }
 
-                       elm_atspi_accessible_reading_info_type_set(*m_subTxtAO,
-                                       ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
-                       elm_atspi_accessible_name_set(*m_subTxtAO, text.c_str());
+                       auto &atspi = m_subTxtAo->getAtspi();
+                       atspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
+                       atspi.setName(text.c_str());
 
-               } else if (m_subTxtAO) {
-                       utils::destroyAccessObject(*m_subTxtAO);
-                       m_subTxtAO.reset();
+               } else if (m_subTxtAo) {
+                       m_subTxtAo.reset();
                }
 
                return RES_OK;
index 756b35a7f6dd222fe9b368bbab5586f30320b808..c10cf68b05cee32a3a53bf2607770f92b84924ec 100644 (file)
@@ -162,9 +162,9 @@ namespace callui {
                bool m_isSubTxtEnable;
                bool m_needModifyCallStatus;
 
-               ucl::ElmWidgetSRef m_statusAO;
-               ucl::ElmWidgetSRef m_mainTxtAO;
-               ucl::ElmWidgetSRef m_subTxtAO;
+               ucl::ElmWidgetSRef m_statusAo;
+               ucl::ElmWidgetSRef m_mainTxtAo;
+               ucl::ElmWidgetSRef m_subTxtAo;
 
                friend class ucl::ReffedObj<CallInfoPresenter>;
        };
index 30e9ae090e8b2fd3b81d9ec7706f70b74c6c8dd2..f66602dd90c468dde46d0c655a3e23e3b9094200 100644 (file)
@@ -281,31 +281,25 @@ namespace callui {
        Result CallStatusPresenter::createStatusTxtAo()
        {
                if (!m_statusTxtAo) {
-                       m_statusTxtAo = utils::createAccessObjectFromLyPart(*m_ly,
-                                       *m_ly,
+                       m_statusTxtAo = utils::createAccessObjectFromPart(*m_ly, *m_ly,
                                        impl::PART_AO_STATUS);
                        if (!m_statusTxtAo) {
-                               LOG_RETURN(RES_FAIL, "createAccessObjectFromLyPart() failed!");
+                               LOG_RETURN(RES_FAIL, "createAccessObjectFromPart() failed!");
                        }
 
-                       elm_atspi_accessible_reading_info_type_set(*m_statusTxtAo,
-                                       ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
-                       elm_atspi_accessible_name_cb_set(*m_statusTxtAo,
-                                       [](void *data, Evas_Object *obj) -> char *
-                                       {
-                                               auto self = static_cast<CallStatusPresenter *>(data);
-                                               if (!self) {
-                                                       return nullptr;
-                                               }
-                                               auto txt = self->m_ly->
-                                                               getText(impl::PART_TXT_TEXT_INFO).getCStr();
-                                               return (txt) ? strdup(txt) : nullptr;
-                                       },
-                                       this);
+                       auto &atspi = m_statusTxtAo->getAtspi();
+                       atspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
+                       atspi.setNameCb(WEAK_DELEGATE_THIS(onStatusTxtAoNameCb));
                }
                return RES_OK;
        }
 
+       CString CallStatusPresenter::onStatusTxtAoNameCb(Atspi &atspi)
+       {
+               const auto txt = m_ly->getText(impl::PART_TXT_TEXT_INFO);
+               return (!txt.empty()) ? CString::dup(txt.c_str()) : nullptr;
+       }
+
        ElmWidget *CallStatusPresenter::getStatusTextAo()
        {
                return m_statusTxtAo.get();
index 80486c0075268eab81c2b579f22f6e6e7b058090..710d1116586436d4bdcaaa872a2e78f4a609ce05 100644 (file)
@@ -121,6 +121,7 @@ namespace callui {
                void onLanguageChanged(ucl::Widget &widget, void *eventInfo);
 
                ucl::Result createStatusTxtAo();
+               ucl::CString onStatusTxtAoNameCb(ucl::Atspi &atspi);
 
        private:
                const ICallInfoWCRef m_info;
index ebdd2f934e15e5030e29e3c8f5a5c431d6db4c7d..bbda1f3c204cfb4238c2e203249649f56e7911bb 100644 (file)
@@ -85,17 +85,17 @@ namespace callui {
        {
                if (state != DisplayState::UNDEFINED) {
                        FAIL_RETURN(setDisplayState(state, true),
-                                       "setDisplayState() failed");
+                                       "setDisplayState() failed!");
                }
 
                if (mode != DisplayMode::UNDEFINED) {
                        FAIL_RETURN(setDisplayMode(mode),
-                                       "setDisplayMode() failed");
+                                       "setDisplayMode() failed!");
                }
 
                if (lockState) {
                        FAIL_RETURN(setCpuLockState(lockState),
-                                       "setCpuLockState() failed");
+                                       "setCpuLockState() failed!");
                }
 
                return RES_OK;
@@ -167,7 +167,8 @@ namespace callui {
                                EFL_UTIL_SCREEN_MODE_ALWAYS_ON :
                                EFL_UTIL_SCREEN_MODE_DEFAULT;
 
-               int res = efl_util_set_window_screen_mode(*m_window, setScreenMode);
+               int res = efl_util_set_window_screen_mode(as_eo(*m_window),
+                               setScreenMode);
                if (res != EFL_UTIL_ERROR_NONE) {
                        LOG_RETURN(RES_FAIL, "Set window screen mode failed."
                                        "res[%d] msg[%s]", res, get_error_message(res));
index 0b7753a8797283e7a58d4796d5a27400328b3110..8ec22e9f9b67bcd0b02efbb21a1b85e146eeab37 100644 (file)
@@ -56,7 +56,6 @@ namespace callui { namespace { namespace impl {
        constexpr EdjeSignal SIGNAL_EVEN {"even"};
 
        constexpr EdjeSignalSrc SIGNAL_SRC_MORE_OPTION {"more_option"};
-
 }}}
 
 namespace callui {
@@ -131,7 +130,7 @@ namespace callui {
                stopCallDurationTimer();
 
                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(MoreOptionsPresenter::onBackKey));
 
                        sendActivate(*m_widget);
@@ -192,33 +191,33 @@ namespace callui {
 
                createStatusTxtAo();
                if (m_statusTxtAo) {
-                       m_atspiHelper->registerWidget(*m_statusTxtAo);
+                       m_atspiHelper->registerObject(*m_statusTxtAo);
                }
        }
 
        Result MoreOptionsPresenter::createPanel()
        {
-               auto *eo = elm_panel_add(*m_widget);
+               Evas_Object *const eo = elm_panel_add(as_eo(*m_widget));
                if (!eo) {
                        LOG_RETURN(RES_FAIL, "elm_panel_add() failed!");
                }
                m_panel = makeShared<StyledWidget>(eo);
-               elm_panel_orient_set(*m_panel, ELM_PANEL_ORIENT_RIGHT);
+               elm_panel_orient_set(eo, ELM_PANEL_ORIENT_RIGHT);
                show(*m_panel);
 
                m_widget->setContent(*m_panel, impl::PART_SWL_RIGHT);
 
-               elm_panel_toggle(*m_panel);
+               elm_panel_toggle(eo);
 
-               elm_layout_signal_callback_add(*m_panel, "elm,state,active,finished",
+               elm_layout_signal_callback_add(eo, "elm,state,active,finished",
                                "elm", CALLBACK_A(MoreOptionsPresenter::onPanelActivate), this);
 
-               elm_layout_signal_callback_add(*m_panel, "elm,state,inactive,finished",
+               elm_layout_signal_callback_add(eo, "elm,state,inactive,finished",
                                "elm", CALLBACK_A(MoreOptionsPresenter::onPanelInactivate), this);
 
                setDeactivatorSink(m_panel);
 
-               elm_layout_signal_callback_add(*m_panel, "cue,clicked",
+               elm_layout_signal_callback_add(eo, "cue,clicked",
                                "elm", CALLBACK_A(MoreOptionsPresenter::onCueClicked), this);
 
                return RES_OK;
@@ -255,7 +254,7 @@ namespace callui {
        {
                if (const auto keypad = m_keypad.lock()) {
                        if (keypad->isAtTop()) {
-                               elm_panel_hidden_set(*m_panel, EINA_TRUE);
+                               elm_panel_hidden_set(as_eo(*m_panel), EINA_TRUE);
                        }
                }
        }
@@ -269,18 +268,18 @@ namespace callui {
                auto held = m_cm->getHeldCall();
 
                FAIL_RETURN_VOID(createKeypadButton(),
-                               "createKeypadButton() failed");
+                               "createKeypadButton() failed!");
 
                if (held) {
                        m_panelLy->emit(impl::SIGNAL_EVEN, impl::SIGNAL_SRC_MORE_OPTION);
 
                        if (active) {
                                FAIL_RETURN_VOID(createSwapButton(),
-                                               "createSwapButton() failed");
+                                               "createSwapButton() failed!");
                                setPanelContent(*m_btnSwap, impl::PART_SWL_SLOT1);
                        } else {
                                FAIL_RETURN_VOID(createUnholdButton(),
-                                               "createUnholdButton() failed");
+                                               "createUnholdButton() failed!");
                                setPanelContent(*m_btnUnhold, impl::PART_SWL_SLOT1);
                        }
                        setPanelContent(*m_btnKeypad, impl::PART_SWL_SLOT2);
@@ -330,7 +329,7 @@ namespace callui {
                if (!held) {
                        LOG_RETURN_VOID(RES_FAIL, "Held call is NULL");
                }
-               FAIL_RETURN_VOID(held->swapWithActive(), "swapWithActive() failed");
+               FAIL_RETURN_VOID(held->swapWithActive(), "swapWithActive() failed!");
        }
 
        void MoreOptionsPresenter::onUnholdBtnClick(Widget &sender, void *eventInfo)
@@ -339,7 +338,7 @@ namespace callui {
                if (!held) {
                        LOG_RETURN_VOID(RES_FAIL, "Held call is NULL");
                }
-               FAIL_RETURN_VOID(held->unhold(), "unhold() failed");
+               FAIL_RETURN_VOID(held->unhold(), "unhold() failed!");
        }
 
        void MoreOptionsPresenter::onKeypadBtnClick(Widget &sender, void *eventInfo)
@@ -365,11 +364,11 @@ namespace callui {
                        const TString &txt,
                        WidgetEventHandler handler)
        {
-               auto *eo = elm_button_add(*m_panelLy);
+               Evas_Object *const eo = elm_button_add(as_eo(*m_panelLy));
                if (!eo) {
                        LOG_RETURN_VALUE(RES_FAIL, {}, "elm_button_add() failed!");
                }
-               auto btn = makeShared<StyledWidget>(eo);
+               const auto btn = makeShared<StyledWidget>(eo);
                btn->setStyle(style);
                btn->setText(txt);
                btn->addEventHandler(BTN_CLICKED, std::move(handler));
@@ -400,21 +399,21 @@ namespace callui {
                        const char *emission,
                        const char *source)
        {
-               eext_object_event_callback_add(*m_widget, EEXT_CALLBACK_BACK,
+               eext_object_event_callback_add(as_eo(*m_widget), EEXT_CALLBACK_BACK,
                                                CALLBACK_A(MoreOptionsPresenter::onBackKey), this);
 
                const auto keepAliver = asShared(*this);
                sendDeactivate(*m_widget);
                activateBy(m_widget.get());
 
-               elm_atspi_component_highlight_grab(*m_fakeAo);
+               m_fakeAo->getAtspi().highlight();
        }
 
        void MoreOptionsPresenter::onPanelInactivate(Evas_Object *obj,
                        const char *emission,
                        const char *source)
        {
-               eext_object_event_callback_del(*m_widget, EEXT_CALLBACK_BACK,
+               eext_object_event_callback_del(as_eo(*m_widget), EEXT_CALLBACK_BACK,
                                CALLBACK_A(MoreOptionsPresenter::onBackKey));
 
                const auto keepAliver = asShared(*this);
@@ -425,14 +424,15 @@ namespace callui {
                hide(*m_panelLy);
                m_statusTxtAo.reset();
 
-               elm_atspi_accessible_can_highlight_set(*m_cueAo, EINA_TRUE);
+               m_cueAo->getAtspi().setHighlightable(true);
+
                hide(*m_fakeAo);
        }
 
        void MoreOptionsPresenter::onBackKey(Evas_Object *obj, void *eventInfo)
        {
-               if (isActive() && !elm_panel_hidden_get(*m_panel)) {
-                       elm_panel_toggle(*m_panel);
+               if (isActive() && !elm_panel_hidden_get(as_eo(*m_panel))) {
+                       elm_panel_toggle(as_eo(*m_panel));
                }
        }
 
@@ -523,123 +523,123 @@ namespace callui {
 
        Result MoreOptionsPresenter::createAtspiHighlightHelper()
        {
-               DLOG("ENTER");
-               m_atspiHelper = AtspiHighlightHelper::newInstance(*this, getWindow());
+               m_atspiHelper = AtspiHighlightHelper::newInstance(*this);
                if (!m_atspiHelper) {
                        LOG_RETURN(RES_FAIL,
                                        "AtspiHighlightHelper::newInstance() failed!");
                }
 
-               m_atspiHelper->setRelationEventHandler(
+               m_atspiHelper->setEventHandler(
                                WEAK_DELEGATE_THIS(onAtspiHighlight));
 
+
+               m_atspiHelper->registerObject(getWindow());
+
                if (m_fakeAo) {
-                       m_atspiHelper->registerWidget(*m_fakeAo);
+                       m_atspiHelper->registerObject(*m_fakeAo);
                }
 
                if (m_panelLy) {
-                       m_atspiHelper->registerWidget(*m_panelLy);
+                       m_atspiHelper->registerObject(*m_panelLy);
                }
 
                if (m_btnSwap) {
-                       m_atspiHelper->registerWidget(*m_btnSwap);
+                       m_atspiHelper->registerObject(*m_btnSwap);
                }
 
                if (m_btnUnhold) {
-                       m_atspiHelper->registerWidget(*m_btnUnhold);
+                       m_atspiHelper->registerObject(*m_btnUnhold);
                }
 
                if (m_btnKeypad) {
-                       m_atspiHelper->registerWidget(*m_btnKeypad);
+                       m_atspiHelper->registerObject(*m_btnKeypad);
                }
 
                if (m_statusTxtAo) {
-                       m_atspiHelper->registerWidget(*m_statusTxtAo);
+                       m_atspiHelper->registerObject(*m_statusTxtAo);
                }
-               DLOG("EXIT");
+
                return RES_OK;
        }
 
-       Elm_Interface_Atspi_Accessible *MoreOptionsPresenter::onAtspiHighlight(
-                       Elm_Interface_Atspi_Accessible *ao,
-                       Elm_Atspi_Relation_Type flowRelation)
+       const Elm_Interface_Atspi_Accessible *
+                       MoreOptionsPresenter::onAtspiHighlight(
+                                       const Elm_Interface_Atspi_Accessible *ao,
+                                       Elm_Atspi_Relation_Type flowRelation)
        {
-               DLOG("FlowRelation [%s]",
-                               flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM ?
-                                               "FROM" :
-                                               "TO");
+               const auto swapBtnAo = utils::getAo(m_btnSwap.get());
+               const auto unholdBtnAo = utils::getAo(m_btnUnhold.get());
+               const auto keypadBtnAo = utils::getAo(m_btnKeypad.get());
+               const auto statusTxtAo = utils::getAo(m_statusTxtAo.get());
+               const auto fakeAo = utils::getAo(m_fakeAo.get());
 
-               if (m_btnSwap && ao == *m_btnSwap) {
+               if (ao == swapBtnAo) {
                        DLOG("Swap button");
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *m_btnKeypad;
+                               return keypadBtnAo;
                        }
-               } else if (m_btnUnhold && ao == *m_btnUnhold) {
+               } else if (ao == unholdBtnAo) {
                        DLOG("Unhold button");
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *m_btnKeypad;
+                               return keypadBtnAo;
                        }
-               } else if (ao == *m_btnKeypad) {
+               } else if (ao == keypadBtnAo) {
                        DLOG("Keypad button");
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *m_statusTxtAo;
+                               return statusTxtAo;
                        } else {
-                               if (m_btnSwap) {
-                                       return *m_btnSwap;
-                               } else if (m_btnUnhold) {
-                                       return *m_btnUnhold;
+                               if (swapBtnAo) {
+                                       return swapBtnAo;
+                               } else if (unholdBtnAo) {
+                                       return unholdBtnAo;
                                }
                        }
-               } else if (ao == *m_statusTxtAo) {
+               } else if (ao == statusTxtAo) {
                        DLOG("Status text");
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM) {
-                               return *m_btnKeypad;
+                               return keypadBtnAo;
                        }
-               } else if (ao == getWindow() || ao == *m_fakeAo) {
+               } else if (ao == as_ao(getWindow()) || ao == fakeAo) {
                        DLOG("window or panelLy");
-                       if (m_btnSwap) {
-                               return *m_btnSwap;
-                       } else if (m_btnUnhold) {
-                               return *m_btnUnhold;
+                       if (swapBtnAo) {
+                               return swapBtnAo;
+                       } else if (unholdBtnAo) {
+                               return unholdBtnAo;
                        } else {
-                               return *m_btnKeypad;
+                               return keypadBtnAo;
                        }
-               } else {
-                       LOG_RETURN_VALUE(RES_FAIL, nullptr, "Unknown object!");
                }
-
-               return ao;
+               LOG_RETURN_VALUE(RES_FAIL, nullptr, "Unknown object!");
        }
 
        Result MoreOptionsPresenter::createAccessObjects()
        {
-               FAIL_RETURN(createCueAo(), "createCueAo() failed");
-               FAIL_RETURN(createStatusTxtAo(), "createStatusTxtAo() failed");
-               FAIL_RETURN(createFakeAo(), "createFakeAo() failed");
+               FAIL_RETURN(createCueAo(), "createCueAo() failed!");
+               FAIL_RETURN(createStatusTxtAo(), "createStatusTxtAo() failed!");
+               FAIL_RETURN(createFakeAo(), "createFakeAo() failed!");
 
                return RES_OK;
        }
 
        Result MoreOptionsPresenter::createCueAo()
        {
-               m_cueAo = utils::createAccessObjectFromLyPart(*m_widget,
-                               *m_panel,
+               m_cueAo = utils::createAccessObjectFromPart(*m_widget, *m_panel,
                                impl::PART_ACCESS);
                if (!m_cueAo) {
                        LOG_RETURN(RES_FAIL,
-                                       "createAccessObjectFromLyPart() failed!");
+                                       "createAccessObjectFromPart() failed!");
                }
-               elm_access_action_cb_set(*m_cueAo,
+               elm_access_action_cb_set(as_eo(*m_cueAo),
                                ELM_ACCESS_ACTION_ACTIVATE,
                                CALLBACK_A(MoreOptionsPresenter::onCueAoActionCb),
                                this);
 
-               elm_atspi_accessible_translation_domain_set(*m_cueAo, TEXT_DOMAIN);
-               elm_atspi_accessible_reading_info_type_set(*m_cueAo,
-                               ELM_ACCESSIBLE_READING_INFO_TYPE_NAME |
+               auto &atspi = m_cueAo->getAtspi();
+               atspi.setTDomain(TEXT_DOMAIN);
+               atspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME |
                                ELM_ACCESSIBLE_READING_INFO_TYPE_ROLE);
-               elm_atspi_accessible_name_set(*m_cueAo, AO_STR_MORE_OPTIONS);
-               elm_atspi_accessible_role_set(*m_cueAo, ELM_ATSPI_ROLE_PUSH_BUTTON);
+               atspi.setName(AO_STR_MORE_OPTIONS);
+               atspi.setRole(ELM_ATSPI_ROLE_PUSH_BUTTON);
 
                return RES_OK;
        }
@@ -661,52 +661,50 @@ namespace callui {
 
        Result MoreOptionsPresenter::createStatusTxtAo()
        {
-               m_statusTxtAo = utils::createAccessObjectFromLyPart(*m_widget,
-                               *m_panelLy,
-                               impl::PART_AO_TXT_STATUS);
+               m_statusTxtAo = utils::createAccessObjectFromPart(*m_panelLy,
+                               *m_panelLy, impl::PART_AO_TXT_STATUS);
                if (!m_statusTxtAo) {
                        LOG_RETURN(RES_FAIL,
-                                       "createAccessObjectFromLyPart() failed!");
-               }
-
-               elm_atspi_accessible_reading_info_type_set(*m_statusTxtAo,
-                               ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
-               elm_atspi_accessible_name_cb_set(*m_statusTxtAo,
-                               [](void *data, Evas_Object *obj) -> char *
-                               {
-                                       auto self = static_cast<MoreOptionsPresenter *>(data);
-                                       if (!self) {
-                                               return nullptr;
-                                       }
-                                       auto txt = self->m_panelLy->
-                                                       getText(impl::PART_TXT_STATUS).getCStr();
-                                       return (txt) ? strdup(txt) : nullptr;
-                               },
-                               this);
+                                       "createAccessObjectFromPart() failed!");
+               }
+
+               auto &atspi = m_statusTxtAo->getAtspi();
+               atspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
+               atspi.setNameCb(WEAK_DELEGATE_THIS(onStatusTxtAoNameCb));
 
                return RES_OK;
        }
 
+       CString MoreOptionsPresenter::onStatusTxtAoNameCb(Atspi &atspi)
+       {
+               const auto text = m_panelLy->getText(impl::PART_TXT_STATUS);
+               return (!text.empty()) ? CString::dup(text.c_str()) : nullptr;
+       }
+
        Eina_Bool MoreOptionsPresenter::onCueAoActionCb(Evas_Object *obj,
                                Elm_Access_Action_Info *actionInfo)
        {
                switch (actionInfo->action_type) {
                case ELM_ACCESS_ACTION_ACTIVATE:
-
+               {
                        show(*m_fakeAo);
                        m_panel->setContent(*m_panelLy);
                        show(*m_panelLy);
                        createStatusTxtAo();
+
                        if (m_statusTxtAo) {
-                               m_atspiHelper->registerWidget(*m_statusTxtAo);
+                               m_atspiHelper->registerObject(*m_statusTxtAo);
                        }
 
-                       elm_panel_toggle(*m_panel);
-                       elm_atspi_component_highlight_clear(*m_cueAo);
-                       elm_atspi_accessible_can_highlight_set(*m_cueAo, EINA_FALSE);
+                       elm_panel_toggle(as_eo(*m_panel));
+
+                       auto &atspi = m_cueAo->getAtspi();
+                       atspi.unhighlight();
+                       atspi.setHighlightable(false);
 
                        return EINA_TRUE;
                        break;
+               }
                default:
                        break;
                }
index 376052b2d912849ec774cb7b77be98e3160c441c..ddea718585e2ae2dbd2784e0336c588d0c314770 100644 (file)
@@ -173,12 +173,14 @@ namespace callui {
                ucl::Result createStatusTxtAo();
                ucl::Result createFakeAo();
                ucl::Result createAtspiHighlightHelper();
-               Elm_Interface_Atspi_Accessible *onAtspiHighlight(
-                               Elm_Interface_Atspi_Accessible *ao,
+               const Elm_Interface_Atspi_Accessible *onAtspiHighlight(
+                               const Elm_Interface_Atspi_Accessible *ao,
                                Elm_Atspi_Relation_Type flowRelation);
                Eina_Bool onCueAoActionCb(Evas_Object *obj,
                                Elm_Access_Action_Info *actionInfo);
 
+               ucl::CString onStatusTxtAoNameCb(ucl::Atspi &atspi);
+
        private:
                const ICallManagerSRef m_cm;
                const ISoundManagerSRef m_sm;
index 8c4dd072b6017250fd0b19064a1ec4cdf91ab6a7..1f3b62ff5de83291f677d4eb1b02d60ad91a462a 100644 (file)
@@ -189,7 +189,7 @@ namespace callui {
                        LOG_RETURN(RES_FAIL, "Layout::build() failed!");
                }
 
-               eext_object_event_callback_add(m_widget->getEo(), EEXT_CALLBACK_BACK,
+               eext_object_event_callback_add(as_eo(*m_widget), EEXT_CALLBACK_BACK,
                                CALLBACK_A(RejectMsgPresenter::onBackKey), this);
 
                return RES_OK;
@@ -204,14 +204,15 @@ namespace callui {
 
        void RejectMsgPresenter::panelScrollCb(Widget &widget, void *eventInfo)
        {
-               Elm_Panel_Scroll_Info *ev = static_cast<Elm_Panel_Scroll_Info *>(eventInfo);
+               Elm_Panel_Scroll_Info *ev =
+                               static_cast<Elm_Panel_Scroll_Info *>(eventInfo);
                DLOG("pos x[%f] y[%f]", ev->rel_x, ev->rel_y);
                auto prevState = m_state;
 
                if (ev->rel_y == 1.0) {
                        m_state = State::SHOWN;
                        // Prevent panel scrolling
-                       elm_object_scroll_freeze_push(m_panel->getEo());
+                       elm_object_scroll_freeze_push(as_eo(*m_panel));
                } else if (ev->rel_y == 0.0) {
                        m_state = State::HIDDEN;
                        destroyRejectMsgList();
@@ -248,14 +249,16 @@ namespace callui {
 
        Result RejectMsgPresenter::createPanel()
        {
-               m_panel = makeShared<StyledWidget>(elm_panel_add(*m_widget));
-               if (!m_panel) {
+               Evas_Object *const eo = elm_panel_add(as_eo(*m_widget));
+               if (!eo) {
                        LOG_RETURN(RES_FAIL, "elm_panel_add() failed!");
                }
-               elm_panel_scrollable_set(*m_panel, EINA_TRUE);
-               elm_panel_scrollable_content_size_set(*m_panel, 1.0);
-               elm_panel_hidden_set(*m_panel, EINA_TRUE);
-               elm_panel_orient_set(*m_panel, ELM_PANEL_ORIENT_BOTTOM);
+               m_panel = makeShared<StyledWidget>(eo);
+
+               elm_panel_scrollable_set(eo, EINA_TRUE);
+               elm_panel_scrollable_content_size_set(eo, 1.0);
+               elm_panel_hidden_set(eo, EINA_TRUE);
+               elm_panel_orient_set(eo, ELM_PANEL_ORIENT_BOTTOM);
                show(*m_panel);
 
                m_panel->addEventHandler(impl::EVENT_SCROLL,
@@ -270,16 +273,17 @@ namespace callui {
 
        Result RejectMsgPresenter::createPanelBg()
        {
-               m_panelBg = makeShared<ElmWidget>(
-                               evas_object_rectangle_add(evas_object_evas_get(*m_widget)),
-                               false);
-               if (!m_panelBg) {
+               Evas_Object *const eo = evas_object_rectangle_add(
+                               evas_object_evas_get(as_eo(*m_widget)));
+               if (!eo) {
                        LOG_RETURN(RES_FAIL, "evas_object_rectangle_add() failed!");
                }
+
+               m_panelBg = makeShared<ElmWidget>(eo);
                m_panelBg->setColor(0, 0);
                show(*m_panelBg);
 
-               m_widget->setContent(m_panelBg->getEo(), impl::PART_SWL_BG);
+               m_widget->setContent(*m_panelBg, impl::PART_SWL_BG);
 
                return RES_OK;
        }
@@ -292,6 +296,7 @@ namespace callui {
                if (!m_panelLy) {
                        LOG_RETURN(RES_FAIL, "Layout::build failed!");
                }
+
                m_panel->setContent(*m_panelLy);
 
                return RES_OK;
@@ -299,7 +304,7 @@ namespace callui {
 
        Result RejectMsgPresenter::createCircleSurfaceLy()
        {
-               auto circleLy = Layout::Builder().
+               const auto circleLy = Layout::Builder().
                                setIsOwner(false).
                                build(*m_panelLy);
                if (!circleLy) {
@@ -307,7 +312,7 @@ namespace callui {
                }
                m_panelLy->setContent(*circleLy, impl::PART_SWL_SCROLLER);
 
-               m_circleSurface = eext_circle_surface_layout_add(*circleLy);
+               m_circleSurface = eext_circle_surface_layout_add(as_eo(*circleLy));
                if (!m_circleSurface) {
                        LOG_RETURN(RES_FAIL, "eext_circle_surface_layout_add() failed!");
                }
@@ -321,7 +326,7 @@ namespace callui {
 
                FAIL_RETURN(makeListItems(), "makeListItems() failed!");
 
-               registerGenlistAtspiGestureCallbacks();
+               registerListItemsAo();
 
                return RES_OK;
        }
@@ -332,6 +337,9 @@ namespace callui {
 
                m_circleEo = nullptr;
 
+               m_firstItem.reset();
+               m_lastItem.reset();
+
                m_listPresenter.reset();
        }
 
@@ -347,7 +355,7 @@ namespace callui {
                                impl::PART_SWL_CONTENT);
 
                m_circleEo = eext_circle_object_genlist_add(
-                               m_listPresenter->getWidget(), m_circleSurface);
+                               as_eo(m_listPresenter->getWidget()), m_circleSurface);
                if (!m_circleEo) {
                        LOG_RETURN(RES_FAIL, "elm_genlist_add() failed!");
                }
@@ -361,16 +369,23 @@ namespace callui {
 
        Result RejectMsgPresenter::makeListItems()
        {
-               FAIL_RETURN(m_listPresenter->append(
-                               *makeTitleListItem(STR_DECLINE_MESSAGES)),
+               m_firstItem = makeTitleListItem(STR_DECLINE_MESSAGES);
+               FAIL_RETURN(m_listPresenter->append(*m_firstItem),
                                "m_listPresenter->append failed!");
 
                auto msgList = m_provider->getMsgList();
-               for (auto &iter : msgList) {
-                       FAIL_RETURN(m_listPresenter->append(
-                                       *RejectMsgListItem::newInstance(iter,
-                                                       WEAK_DELEGATE_THIS(onRejectMsgListItemSelect))),
+               const int listSize = msgList.size();
+
+               for (int i = 0 ; i < listSize; i++) {
+                       RejectMsgListItemSRef rmItem = RejectMsgListItem::newInstance(
+                                       msgList[i],
+                                       WEAK_DELEGATE_THIS(onRejectMsgListItemSelect));
+                       FAIL_RETURN(m_listPresenter->append(*rmItem),
                                        "m_listPresenter->append failed!");
+
+                       if (i == listSize - 1) {
+                               m_lastItem = rmItem;
+                       }
                }
 
                FAIL_RETURN(m_listPresenter->append(*makePaddingListItem()),
@@ -406,7 +421,7 @@ namespace callui {
                DLOG();
                if (m_state != State::SHOWN) {
                        DLOG("Panel state [NOT SHOWN]");
-                       elm_panel_hidden_set(m_panel->getEo(), EINA_FALSE);
+                       elm_panel_hidden_set(as_eo(*m_panel), EINA_FALSE);
                }
        }
 
@@ -415,8 +430,8 @@ namespace callui {
                DLOG();
                if (m_state == State::SHOWN) {
                        DLOG("Panel state [SHOWN]");
-                       elm_object_scroll_freeze_pop(m_panel->getEo());
-                       elm_panel_hidden_set(m_panel->getEo(), EINA_TRUE);
+                       elm_object_scroll_freeze_pop(as_eo(*m_panel));
+                       elm_panel_hidden_set(as_eo(*m_panel), EINA_TRUE);
                }
        }
 
@@ -446,76 +461,61 @@ namespace callui {
                }
        }
 
-       Elm_Interface_Atspi_Accessible *RejectMsgPresenter::getFirstAo()
-       {
-               return (m_listPresenter ?
-                               elm_genlist_first_item_get(m_listPresenter->getWidget()) :
-                               nullptr);
-       }
-
-       Elm_Interface_Atspi_Accessible *RejectMsgPresenter::getLastAo()
-       {
-               return (m_listPresenter ?
-                               elm_genlist_last_item_get(m_listPresenter->getWidget()) :
-                               nullptr);
-       }
-
        Result RejectMsgPresenter::createAtspiHighlightHelper()
        {
-               m_atspiHelper = AtspiHighlightHelper::newInstance(*this, getWindow());
+               m_atspiHelper = AtspiHighlightHelper::newInstance(*this);
                if (!m_atspiHelper) {
                        LOG_RETURN(RES_FAIL,
                                        "AtspiHighlightHelper::newInstance() failed!");
                }
 
-               m_atspiHelper->setRelationEventHandler(
-                               WEAK_DELEGATE_THIS(onAtspiHighlight));
+               m_atspiHelper->registerObject(getWindow());
+
+               m_atspiHelper->setEventHandler(WEAK_DELEGATE_THIS(onAtspiHighlight));
 
                return RES_OK;
        }
 
-       void RejectMsgPresenter::registerGenlistAtspiGestureCallbacks()
+       void RejectMsgPresenter::registerListItemsAo()
        {
-               auto item = getFirstAo();
-               elm_atspi_accessible_gesture_cb_set(item,
-                               CALLBACK_A(RejectMsgPresenter::onAtspiGesture), this);
+               if (m_firstItem) {
+                       m_atspiHelper->registerObject(*m_firstItem);
+               }
 
-               item = getLastAo();
-               elm_atspi_accessible_gesture_cb_set(item,
-                               CALLBACK_A(RejectMsgPresenter::onAtspiGesture), this);
+               if (m_lastItem) {
+                       m_atspiHelper->registerObject(*m_lastItem);
+               }
        }
 
-       Elm_Interface_Atspi_Accessible *RejectMsgPresenter::onAtspiHighlight(
-                       Elm_Interface_Atspi_Accessible *ao,
+       const Elm_Interface_Atspi_Accessible *RejectMsgPresenter::onAtspiHighlight(
+                       const Elm_Interface_Atspi_Accessible *ao,
                        Elm_Atspi_Relation_Type flowRelation)
        {
                DLOG("ENTER");
 
-               DLOG("FlowRelation [%s]",
-                               flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM ?
-                                               "FROM" :
-                                               "TO");
+               const Elm_Interface_Atspi_Accessible * firstListAo = nullptr;
+               if (m_firstItem) {
+                       firstListAo = as_ao(*m_firstItem);
+               }
+               const Elm_Interface_Atspi_Accessible * lastListAo = nullptr;
+               if (m_lastItem) {
+                       lastListAo = as_ao(*m_lastItem);
+               }
 
-               if (ao == getFirstAo()) {
+               if (ao == firstListAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
                                return nullptr;
                        }
-               } else if (ao == getLastAo()) {
+               } else if (ao == lastListAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM) {
                                return nullptr;
                        }
-               } else if (ao == getWindow()) {
-                       return getFirstAo();
+               } else if (ao == as_ao(getWindow())) {
+                       return firstListAo;
                } else {
                        LOG_RETURN_VALUE(RES_FAIL, nullptr, "Unknown object!");
                }
-               return ao;
-       }
 
-       Eina_Bool RejectMsgPresenter::onAtspiGesture(
-                       Elm_Atspi_Gesture_Info gestureInfo,
-                       Elm_Interface_Atspi_Accessible *ao)
-       {
-               return toEina(m_atspiHelper->handleGesture(ao, gestureInfo));
+               return ao;
        }
 }
index e52803dd7cf861893d8e986fb64cfdac7464d978..48fccb53afef9ecf01a00341dbed47fdbb12c9e3 100644 (file)
@@ -172,14 +172,9 @@ namespace callui {
                void onBackKey(Evas_Object *obj, void *eventInfo);
 
                ucl::Result createAtspiHighlightHelper();
-               void registerGenlistAtspiGestureCallbacks();
-               Elm_Interface_Atspi_Accessible *getFirstAo();
-               Elm_Interface_Atspi_Accessible *getLastAo();
-               Eina_Bool onAtspiGesture(
-                               Elm_Atspi_Gesture_Info gestureInfo,
-                               Elm_Interface_Atspi_Accessible *ao);
-               Elm_Interface_Atspi_Accessible *onAtspiHighlight(
-                               Elm_Interface_Atspi_Accessible *ao,
+               void registerListItemsAo();
+               const Elm_Interface_Atspi_Accessible *onAtspiHighlight(
+                               const Elm_Interface_Atspi_Accessible *ao,
                                Elm_Atspi_Relation_Type flowRelation);
 
                // GuiPresenter //
@@ -193,6 +188,8 @@ namespace callui {
                const SelectHandler m_selectHandler;
 
                ucl::ListPresenterSRef m_listPresenter;
+               ucl::ListItemPresenterSRef m_firstItem;
+               ucl::ListItemPresenterSRef m_lastItem;
 
                ucl::LayoutSRef m_widget;
                ucl::StyledWidgetSRef m_panel;
index f36d126df0c5be420159cd46de0912039fc567d5..2911c99a8d104ad0599b89eb9952052694cb2257 100644 (file)
@@ -230,8 +230,8 @@ namespace callui {
                DLOG("Button pressed [%c]", *(info->str));
 
                if (info->type == impl::OperationType::DTMF) {
-                       elm_entry_entry_append(*m_entry, info->str);
-                       elm_entry_cursor_end_set(*m_entry);
+                       elm_entry_entry_append(as_eo(*m_entry), info->str);
+                       elm_entry_cursor_end_set(as_eo(*m_entry));
                        startDtmf(*(info->str));
                }
        }
@@ -254,7 +254,7 @@ namespace callui {
                        show(*m_vc);
                        startVCTimer();
 
-                       elm_atspi_component_highlight_grab(*m_vc);
+                       m_vc->getAtspi().highlight();
                }
        }
 
@@ -263,14 +263,13 @@ namespace callui {
                m_widget = Layout::Builder().
                                setTheme(impl::LAYOUT_KEYPAD_WIDGET).
                                build(getNaviframe());
-
                if (!m_widget) {
                        LOG_RETURN(RES_FAIL, "Layout::build() failed!");
                }
 
                // RTL support
-               elm_object_mirrored_automatic_set(*m_widget, EINA_FALSE);
-               elm_object_mirrored_set(*m_widget, false);
+               elm_object_mirrored_automatic_set(as_eo(*m_widget), EINA_FALSE);
+               elm_object_mirrored_set(as_eo(*m_widget), false);
 
                setDeactivatorSink(m_widget);
 
@@ -279,7 +278,7 @@ namespace callui {
 
        ucl::Result KeypadPage::createEntry()
        {
-               Evas_Object *entry = elm_entry_add(*m_widget);
+               Evas_Object *const entry = elm_entry_add(as_eo(*m_widget));
                if (!entry) {
                        LOG_RETURN(RES_FAIL, "elm_entry_add() failed!");
                }
@@ -296,7 +295,7 @@ namespace callui {
                elm_entry_markup_filter_append(entry,
                                elm_entry_filter_accept_set, &digitsFilterData);
 
-               m_widget->setContent(entry, impl::PART_SWL_ENTRY);
+               m_widget->setContent(*m_entry, impl::PART_SWL_ENTRY);
                show(*m_entry);
 
                return RES_OK;
@@ -308,8 +307,7 @@ namespace callui {
                StyledWidgetSRef buttonSRef;
 
                for (int i = 0; i < impl::KEYPAD_BTN_MAX_COUNT; ++i) {
-                       button = elm_button_add(*m_widget);
-
+                       button = elm_button_add(as_eo(*m_widget));
                        if (!button) {
                                LOG_RETURN(RES_FAIL, "elm_button_add() failed!");
                        }
@@ -330,27 +328,20 @@ namespace callui {
                                                WEAK_DELEGATE_THIS(onBtnClicked));
 
                                // RTL support
-                               elm_object_mirrored_automatic_set(*buttonSRef, EINA_FALSE);
-                               elm_object_mirrored_set(*buttonSRef, false);
+                               elm_object_mirrored_automatic_set(button, EINA_FALSE);
+                               elm_object_mirrored_set(button, false);
                        }
 
                        // Screen Reader
-                       elm_atspi_accessible_name_cb_set(*buttonSRef,
-                                       [](void *data, Evas_Object *obj) -> char *
-                                       {
-                                               impl::ButtonInfo *info =
-                                                               static_cast<impl::ButtonInfo*>(asWidget(obj)->
-                                                                               getData(impl::BTN_DATA_KEY));
-                                               if (info->type == impl::OperationType::DTMF) {
-                                                       return strdup(info->str);
-                                               } else {
-                                                       return strdup(STR_VOLUME.translate());
-                                               }
-                                               return nullptr;
-                                       },
-                                       this);
-
-                       m_widget->setContent(button, impl::buttonsInfo[i].swlPart);
+                       auto &atspi = buttonSRef->getAtspi();
+                       atspi.setTDomain(TEXT_DOMAIN);
+                       if (impl::buttonsInfo[i].type == impl::OperationType::DTMF) {
+                               atspi.setName(impl::buttonsInfo[i].str);
+                       } else {
+                               atspi.setName(STR_VOLUME);
+                       }
+
+                       m_widget->setContent(*buttonSRef, impl::buttonsInfo[i].swlPart);
                        show(*buttonSRef);
                }
 
@@ -380,7 +371,7 @@ namespace callui {
                                setEventHandler(WEAK_DELEGATE_THIS(onVolumeControlEventCb)).
                                build(*m_widget);
                if (!m_vc) {
-                       LOG_RETURN(RES_FAIL, "VolumeControl::build() failed");
+                       LOG_RETURN(RES_FAIL, "VolumeControl::build() failed!");
                }
 
                auto window = m_vc->getWindow();
@@ -583,71 +574,70 @@ namespace callui {
 
        Result KeypadPage::createAtspiHighlightHelper()
        {
-               m_atspiHelper = AtspiHighlightHelper::newInstance(*this, getWindow());
+               m_atspiHelper = AtspiHighlightHelper::newInstance(*this);
                if (!m_atspiHelper) {
                        LOG_RETURN(RES_FAIL,
                                        "AtspiHighlightHelper::newInstance() failed!");
                }
 
-               m_atspiHelper->setRelationEventHandler(
+               m_atspiHelper->setEventHandler(
                                WEAK_DELEGATE_THIS(onAtspiHighlight));
 
-               m_atspiHelper->registerWidget(*getFirstButton());
-               m_atspiHelper->registerWidget(*getLastButton());
-               m_atspiHelper->registerWidget(*m_vc.get());
-               m_atspiHelper->registerWidget(*m_vc->getDecreaseBtn());
-               m_atspiHelper->registerWidget(*m_vc->getIncreaseBtn());
-               m_atspiHelper->registerWidget(*m_vc->getValueTxtAo());
+               m_atspiHelper->registerObject(getWindow());
+               m_atspiHelper->registerObject(*getFirstButton());
+               m_atspiHelper->registerObject(*getLastButton());
+               m_atspiHelper->registerObject(*m_vc.get());
+               m_atspiHelper->registerObject(*m_vc->getDecreaseBtn());
+               m_atspiHelper->registerObject(*m_vc->getIncreaseBtn());
+               m_atspiHelper->registerObject(*m_vc->getValueTxtAo());
 
                return RES_OK;
        }
 
-       Elm_Interface_Atspi_Accessible *KeypadPage::onAtspiHighlight(
-                               Elm_Interface_Atspi_Accessible *ao,
+       const Elm_Interface_Atspi_Accessible *KeypadPage::onAtspiHighlight(
+                               const Elm_Interface_Atspi_Accessible *ao,
                                Elm_Atspi_Relation_Type flowRelation)
        {
-               DLOG("FlowRelation [%s]",
-                               flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM ?
-                                               "FROM" : "TO");
+               DLOG();
 
-               auto firstBtn = getFirstButton();
-               auto lastBtn = getLastButton();
-               auto vcLayout = m_vc.get();
-               auto vcDecrVolumeBtn = m_vc->getDecreaseBtn();
-               auto vcIncrVolumeBtn = m_vc->getIncreaseBtn();
-               auto vcVolumeValueAo = m_vc->getValueTxtAo();
+               auto firstBtnAo = utils::getAo(getFirstButton());
+               auto lastBtnAo = utils::getAo(getLastButton());
+               auto vcLayoutAo = utils::getAo(m_vc.get());
+               auto vcDecrVolumeBtnAo = utils::getAo(m_vc->getDecreaseBtn());
+               auto vcIncrVolumeBtnAo = utils::getAo(m_vc->getIncreaseBtn());
+               auto vcVolumeValueAo = utils::getAo(m_vc->getValueTxtAo());
 
-               if (firstBtn && ao == *firstBtn) {
+               if (firstBtnAo && ao == firstBtnAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
                                return nullptr;
                        }
-               } else if (lastBtn && ao == *lastBtn) {
+               } else if (lastBtnAo && ao == lastBtnAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM) {
                                return nullptr;
                        }
-               } else if (ao == *vcLayout) {
+               } else if (ao == vcLayoutAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *vcDecrVolumeBtn;
+                               return vcDecrVolumeBtnAo;
                        }
-               } else if (ao == *vcDecrVolumeBtn) {
+               } else if (ao == vcDecrVolumeBtnAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *vcVolumeValueAo;
+                               return vcVolumeValueAo;
                        } else {
-                               return *vcLayout;
+                               return vcLayoutAo;
                        }
-               } else if (ao == *vcVolumeValueAo) {
+               } else if (ao == vcVolumeValueAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *vcIncrVolumeBtn;
+                               return vcIncrVolumeBtnAo;
                        } else {
-                               return *vcDecrVolumeBtn;
+                               return vcDecrVolumeBtnAo;
                        }
-               } else if (ao == *vcIncrVolumeBtn) {
+               } else if (ao == vcIncrVolumeBtnAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM) {
-                               return *vcVolumeValueAo;
+                               return vcVolumeValueAo;
                        }
-               } else if (ao == getWindow()) {
-                       if (firstBtn) {
-                               return *firstBtn;
+               } else if (ao == as_ao(getWindow())) {
+                       if (firstBtnAo) {
+                               return firstBtnAo;
                        }
                } else {
                        LOG_RETURN_VALUE(RES_FAIL, nullptr, "Unknown object!");
index f58758778f79c4dccf48704e9beb4c89ca70e353..5938aa8698af27200d439bf5c031c765b2e9b753 100644 (file)
@@ -117,8 +117,8 @@ namespace callui {
                void unregisterCallbacks();
 
                ucl::Result createAtspiHighlightHelper();
-               Elm_Interface_Atspi_Accessible *onAtspiHighlight(
-                               Elm_Interface_Atspi_Accessible *ao,
+               const Elm_Interface_Atspi_Accessible *onAtspiHighlight(
+                               const Elm_Interface_Atspi_Accessible *ao,
                                Elm_Atspi_Relation_Type flowRelation);
                ucl::ElmWidget *getFirstButton();
                ucl::ElmWidget *getLastButton();
index 51dd8e4abfac69139aa0f8f1289b24650cda10ab..da99bd98e6f0d89b62e4c110943639ead6b9b822 100644 (file)
@@ -45,10 +45,9 @@ namespace callui { namespace { namespace impl {
        constexpr EdjePart PART_SWL_BOTTOM_BTN {"swl.bottom_btn"};
        constexpr EdjePart PART_SWL_OVERLAY {"swl.overlay"};
        constexpr EdjePart PART_SWL_MORE_OPTION {"swl.more_option"};
-
+       constexpr EdjePart PART_TXT_REJECT_MSG {"reject_msg_text"};
        constexpr EdjePart PART_TXT_REJECT_MSG_CUE_AO {"ao_cue"};
 
-       constexpr EdjePart PART_TXT_REJECT_MSG {"reject_msg_text"};
        constexpr ElmStyle STYLE_BB_END_CALL {"callui/end_call"};
        constexpr ElmStyle STYLE_BB_RECALL {"callui/call_back"};
 }}}
@@ -251,7 +250,7 @@ namespace callui {
        Result MainPage::processEndCallMode()
        {
                FAIL_RETURN(createAccessoryPresenter(),
-                               "createAccessoryPresenter() failed");
+                               "createAccessoryPresenter() failed!");
 
                auto end = m_cm->getEndCall();
                if (end) {
@@ -261,7 +260,7 @@ namespace callui {
                                        !(info->getPhoneNumber().empty() &&
                                                        !info->isEmergency())) {
                                FAIL_RETURN(createBottomBtn(impl::STYLE_BB_RECALL, false),
-                                               "createBottomBtn() failed");
+                                               "createBottomBtn() failed!");
                                hide(*m_bottomBtn);
                        }
                } else {
@@ -281,11 +280,11 @@ namespace callui {
                m_rmCueAo.reset();
 
                FAIL_RETURN(createAccessoryPresenter(),
-                               "createAccessoryPresenter() failed");
+                               "createAccessoryPresenter() failed!");
                FAIL_RETURN(createMoreOptionsPresenter(),
-                               "createMoreOptionsPresenter() failed");
+                               "createMoreOptionsPresenter() failed!");
                FAIL_RETURN(createBottomBtn(impl::STYLE_BB_END_CALL),
-                               "createBottomBtn() failed");
+                               "createBottomBtn() failed!");
 
                return RES_OK;
        }
@@ -343,17 +342,21 @@ namespace callui {
 
        Result MainPage::createBottomBtn(const ElmStyle &style, bool setVisible)
        {
-               m_bottomBtn = makeShared<StyledWidget>(elm_button_add(*m_widget));
+               Evas_Object *const eo = elm_button_add(as_eo(*m_widget));
+               if (!eo) {
+                       LOG_RETURN(RES_FAIL, "elm_button_add() failed!");
+               }
+               m_bottomBtn = makeShared<StyledWidget>(eo);
                m_bottomBtn->setStyle(style);
-
                m_bottomBtn->addEventHandler(BTN_CLICKED,
                                WEAK_DELEGATE_THIS(MainPage::onBottomBtnClicked));
 
-               elm_atspi_accessible_translation_domain_set(*m_bottomBtn, TEXT_DOMAIN);
+               auto &atspi = m_bottomBtn->getAtspi();
+               atspi.setTDomain(TEXT_DOMAIN);
                if (style == impl::STYLE_BB_RECALL) {
-                       elm_atspi_accessible_name_set(*m_bottomBtn, AO_STR_CALLBACK);
+                       atspi.setName(AO_STR_CALLBACK);
                } else {
-                       elm_atspi_accessible_name_set(*m_bottomBtn, AO_STR_END_CALL);
+                       atspi.setName(AO_STR_END_CALL);
                }
 
                if (setVisible) {
@@ -656,43 +659,44 @@ namespace callui {
 
        Result MainPage::createRejectMsgCueAo()
        {
-               m_rmCueAo = utils::createAccessObjectFromLyPart(*m_widget,
-                               *m_rmLy,
+               m_rmCueAo = utils::createAccessObjectFromPart(*m_widget, *m_rmLy,
                                impl::PART_TXT_REJECT_MSG_CUE_AO);
                if (!m_rmCueAo) {
-                       LOG_RETURN(RES_FAIL, "createAccessObjectFromLyPart() failed!");
+                       LOG_RETURN(RES_FAIL, "createAccessObjectFromPart() failed!");
                }
-               elm_atspi_accessible_translation_domain_set(*m_rmCueAo, TEXT_DOMAIN);
-               elm_atspi_accessible_reading_info_type_set(*m_rmCueAo,
-                               ELM_ACCESSIBLE_READING_INFO_TYPE_NAME |
+
+               auto &atspi = m_rmCueAo->getAtspi();
+               atspi.setTDomain(TEXT_DOMAIN);
+               atspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME |
                                ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION);
-               elm_atspi_accessible_name_set(*m_rmCueAo, STR_DECLINE_MESSAGES);
-               elm_atspi_accessible_description_set(*m_rmCueAo,
+               atspi.setName(STR_DECLINE_MESSAGES);
+               atspi.setDescription(
                                AO_STR_SWIPE_UP_WITH_TWO_FINGERS_TO_SEND_A_DECLINE_MESSAGE);
-
-               elm_atspi_accessible_gesture_cb_set(*m_rmCueAo,
-                               [](void *data, Elm_Atspi_Gesture_Info gesture, Evas_Object *obj) {
-                               // TODO: ELM_ATSPI_GESTURE_TWO_FINGERS_HOVER must be replaced
-                                       if (gesture.type == ELM_ATSPI_GESTURE_TWO_FINGERS_HOVER) {
-                                               auto page = (MainPage *)data;
-                                               page->m_rmPrs->showPanel();
-                                               return EINA_TRUE;
-                                       }
-
-                                       return EINA_FALSE;
-                               }, this);
+               atspi.addGestureHandler(WEAK_DELEGATE_THIS(onRejectMsgCueAoGestureCb));
 
                return RES_OK;
        }
 
+       void MainPage::onRejectMsgCueAoGestureCb(Atspi &atspi,
+                       AtspiGestureEventInfo &eventInfo)
+       {
+               // TODO: ELM_ATSPI_GESTURE_TWO_FINGERS_HOVER must be replaced
+               if (eventInfo.gestureInfo.type == ELM_ATSPI_GESTURE_TWO_FINGERS_HOVER) {
+                       m_rmPrs->showPanel();
+                       eventInfo.preventDefault = true;
+               }
+       }
+
        Result MainPage::createAtspiHighlightHelper()
        {
-               m_atspiHelper = AtspiHighlightHelper::newInstance(*this, getWindow());
+               m_atspiHelper = AtspiHighlightHelper::newInstance(*this);
                if (!m_atspiHelper) {
                        LOG_RETURN(RES_FAIL,
                                        "AtspiHighlightHelper::newInstance() failed!");
                }
 
+               m_atspiHelper->registerObject(getWindow());
+
                switch (m_mode) {
                case CallMode::INCOMING:
                        registerIncomingCallModeAo();
@@ -712,118 +716,99 @@ namespace callui {
        void MainPage::registerIncomingCallModeAo()
        {
                DLOG("ENTER");
-               m_atspiHelper->setRelationEventHandler(
+               m_atspiHelper->setEventHandler(
                                WEAK_DELEGATE_THIS(onIncomingCallModeAtspiHighlight));
 
-               m_atspiHelper->setGestureEventHandler(
-                               WEAK_DELEGATE_THIS(onIncomingModeAtspiGesture));
-
-               auto acceptAO = m_acceptRejectPrs->getAcceptAo();
-               if (!acceptAO) {
+               auto acceptAo = m_acceptRejectPrs->getAcceptAo();
+               if (!acceptAo) {
                        DLOG("acceptAO is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*acceptAO);
+                       m_atspiHelper->registerObject(*acceptAo);
                }
 
                auto rejectAo = m_acceptRejectPrs->getRejectAo();
                if (!rejectAo) {
                        DLOG("rejectAo is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*rejectAo);
+                       m_atspiHelper->registerObject(*rejectAo);
                }
 
                auto statusTxtAo = m_callInfoPrs->getStatusTxtAo();
                if (!statusTxtAo) {
                        DLOG("statusTxtAo is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*statusTxtAo);
+                       m_atspiHelper->registerObject(*statusTxtAo);
                }
 
                auto mainTxtAo = m_callInfoPrs->getMainTxtAo();
                if (!mainTxtAo) {
                        DLOG("mainTxtAo is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*mainTxtAo);
+                       m_atspiHelper->registerObject(*mainTxtAo);
                }
 
                auto subTxtAo = m_callInfoPrs->getSubTxtAo();
                if (!subTxtAo) {
                        DLOG("subTxtAo is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*subTxtAo);
+                       m_atspiHelper->registerObject(*subTxtAo);
                }
 
                if (!m_rmCueAo) {
                        DLOG("m_rmCueAo is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*m_rmCueAo);
+                       m_atspiHelper->registerObject(*m_rmCueAo);
                }
 
                DLOG("EXIT");
        }
 
-       bool MainPage::onIncomingModeAtspiGesture(Elm_Interface_Atspi_Accessible *widget,
-                       Elm_Atspi_Gesture_Type gestureType)
-       {
-               DLOG(" GESTURE TYPE [%d]", gestureType);
-
-               if (m_rmCueAo && widget == *m_rmCueAo) {
-                       if (gestureType == ELM_ATSPI_GESTURE_TWO_FINGERS_HOVER) {
-                               m_rmPrs->showPanel();
-                               return true;
-                       }
-               }
-               return false;
-       }
-
-       Elm_Interface_Atspi_Accessible *MainPage::onIncomingCallModeAtspiHighlight(
-                       Elm_Interface_Atspi_Accessible *ao,
-                       Elm_Atspi_Relation_Type flowRelation)
+       const Elm_Interface_Atspi_Accessible *
+                       MainPage::onIncomingCallModeAtspiHighlight(
+                                       const Elm_Interface_Atspi_Accessible *ao,
+                                       Elm_Atspi_Relation_Type flowRelation)
        {
-               DLOG("FlowRelation [%s]",
-                               flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM ?
-                                               "FROM" : "TO");
-
-               auto acceptAo = m_acceptRejectPrs->getAcceptAo();
-               auto rejectAo = m_acceptRejectPrs->getRejectAo();
-               auto statusTxtAo = m_callInfoPrs->getStatusTxtAo();
-               auto mainTxtAo = m_callInfoPrs->getMainTxtAo();
-               auto subTxtAo = m_callInfoPrs->getSubTxtAo();
-
-               if (ao == *acceptAo) {
+               const auto acceptAo = utils::getAo(m_acceptRejectPrs->getAcceptAo());
+               const auto rejectAo = utils::getAo(m_acceptRejectPrs->getRejectAo());
+               const auto statusTxtAo = utils::getAo(m_callInfoPrs->getStatusTxtAo());
+               const auto mainTxtAo = utils::getAo(m_callInfoPrs->getMainTxtAo());
+               const auto subTxtAo = utils::getAo(m_callInfoPrs->getSubTxtAo());
+               const auto rmCueAo = utils::getAo(m_rmCueAo.get());
+
+               if (ao == acceptAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *statusTxtAo;
+                               return statusTxtAo;
                        }
-               } else if (ao == *statusTxtAo) {
+               } else if (ao == statusTxtAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *mainTxtAo;
+                               return mainTxtAo;
                        } else if (flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM) {
-                               return *acceptAo;
+                               return acceptAo;
                        }
-               } else if (ao == *mainTxtAo) {
+               } else if (ao == mainTxtAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return (subTxtAo) ? *subTxtAo : *rejectAo;
+                               return (subTxtAo) ? subTxtAo : rejectAo;
                        } else if (flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM) {
-                               return *statusTxtAo;
+                               return statusTxtAo;
                        }
-               } else if (subTxtAo && ao == *subTxtAo) {
+               } else if (ao == subTxtAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *rejectAo;
+                               return rejectAo;
                        } else if (flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM) {
-                               return *mainTxtAo;
+                               return mainTxtAo;
                        }
-               } else if (ao == *rejectAo) {
+               } else if (ao == rejectAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return m_rmCueAo ? *m_rmCueAo : ao;
+                               return rmCueAo ? rmCueAo : ao;
                        } else if (flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM) {
-                               return (subTxtAo) ? *subTxtAo : *mainTxtAo;
+                               return (subTxtAo) ? subTxtAo : mainTxtAo;
                        }
-               } else if (m_rmCueAo && ao == *m_rmCueAo) {
+               } else if (ao == rmCueAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM) {
-                               return *rejectAo;
+                               return rmCueAo;
                        }
-               } else if (ao == getWindow()) {
-                       return *acceptAo;
+               } else if (ao == as_ao(getWindow())) {
+                       return acceptAo;
                } else {
                        LOG_RETURN_VALUE(RES_FAIL, nullptr, "Unknown object!");
                }
@@ -834,177 +819,186 @@ namespace callui {
        void MainPage::registerActiveCallModeAo()
        {
                DLOG("ENTER");
-               m_atspiHelper->setRelationEventHandler(
+               m_atspiHelper->setEventHandler(
                                WEAK_DELEGATE_THIS(onActiveCallModeAtspiHighlight));
 
                auto statusTxtAo = m_callInfoPrs->getStatusTxtAo();
                if (!statusTxtAo) {
                        DLOG("statusTxtAo is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*statusTxtAo);
+                       m_atspiHelper->registerObject(*statusTxtAo);
                }
 
                auto mainTxtAo = m_callInfoPrs->getMainTxtAo();
                if (!mainTxtAo) {
                        DLOG("mainTxtAo is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*mainTxtAo);
+                       m_atspiHelper->registerObject(*mainTxtAo);
                }
 
                auto subTxtAo = m_callInfoPrs->getSubTxtAo();
                if (!subTxtAo) {
                        DLOG("subTxtAo is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*subTxtAo);
+                       m_atspiHelper->registerObject(*subTxtAo);
                }
 
                auto volumeBtnAo = m_accessoryPrs->getVolumBtn();
                if (!volumeBtnAo) {
                        DLOG("volumeBtnAo is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*volumeBtnAo);
+                       m_atspiHelper->registerObject(*volumeBtnAo);
                }
 
                auto bluetoothBtnAo = m_accessoryPrs->getBluetoothBtn();
                if (!bluetoothBtnAo) {
                        DLOG("bluetoothBtnAo is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*bluetoothBtnAo);
+                       m_atspiHelper->registerObject(*bluetoothBtnAo);
                }
 
                auto muteBtnAo = m_accessoryPrs->getMuteBtn();
                if (!muteBtnAo) {
                        DLOG("muteBtnAo is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*muteBtnAo);
+                       m_atspiHelper->registerObject(*muteBtnAo);
                }
 
                auto moreOptCueAo = m_moreOptionsPrs->getCueAo();
                if (!moreOptCueAo) {
                        DLOG("moreCueAo is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*moreOptCueAo);
+                       m_atspiHelper->registerObject(*moreOptCueAo);
                }
 
                if (!m_bottomBtn) {
                        DLOG("m_bottomBtn is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*m_bottomBtn);
+                       m_atspiHelper->registerObject(*m_bottomBtn);
                }
 
                auto vcLayout = m_accessoryPrs->getVolumeControlLy();
                if (!vcLayout) {
                        DLOG("vcLayout is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*vcLayout);
+                       m_atspiHelper->registerObject(*vcLayout);
 
-                       m_atspiHelper->registerWidget(*m_accessoryPrs->
+                       m_atspiHelper->registerObject(*m_accessoryPrs->
                                        getVolumeControlDecreaseBtn());
 
-                       m_atspiHelper->registerWidget(*m_accessoryPrs->
+                       m_atspiHelper->registerObject(*m_accessoryPrs->
                                        getVolumeControlIncreaseBtn());
 
-                       m_atspiHelper->registerWidget(*m_accessoryPrs->
+                       m_atspiHelper->registerObject(*m_accessoryPrs->
                                        getVolumeControlValueTxtAo());
                }
 
                DLOG("EXIT");
        }
 
-       Elm_Interface_Atspi_Accessible *MainPage::onActiveCallModeAtspiHighlight(
-                       Elm_Interface_Atspi_Accessible *ao,
-                       Elm_Atspi_Relation_Type flowRelation)
+       const Elm_Interface_Atspi_Accessible *
+                       MainPage::onActiveCallModeAtspiHighlight(
+                                       const Elm_Interface_Atspi_Accessible *ao,
+                                       Elm_Atspi_Relation_Type flowRelation)
        {
-               DLOG("FlowRelation [%s]",
-                               flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM ?
-                                               "FROM" : "TO");
-
-               auto statusTxtAo = m_callInfoPrs->getStatusTxtAo();
-               auto mainTxtAo = m_callInfoPrs->getMainTxtAo();
-               auto subTxtAo = m_callInfoPrs->getSubTxtAo();
-               auto volumeBtnAo = m_accessoryPrs->getVolumBtn();
-               auto bluetoothBtnAo = m_accessoryPrs->getBluetoothBtn();
-               auto muteBtnAo = m_accessoryPrs->getMuteBtn();
-               auto moreOptCueAo = m_moreOptionsPrs->getCueAo();
-               auto vcLayout = m_accessoryPrs->getVolumeControlLy();
-               auto vcDecrVolumeBtn = m_accessoryPrs->getVolumeControlDecreaseBtn();
-               auto vcIncrVolumeBtn = m_accessoryPrs->getVolumeControlIncreaseBtn();
-               auto vcVolumeValueAo = m_accessoryPrs->getVolumeControlValueTxtAo();
-
-               if (ao == *statusTxtAo) {
+               const auto statusTxtAo =
+                               utils::getAo(m_callInfoPrs->getStatusTxtAo());
+               const auto mainTxtAo =
+                               utils::getAo(m_callInfoPrs->getMainTxtAo());
+               const auto subTxtAo =
+                               utils::getAo(m_callInfoPrs->getSubTxtAo());
+               const auto volumeBtnAo =
+                               utils::getAo(m_accessoryPrs->getVolumBtn());
+               const auto bluetoothBtnAo =
+                               utils::getAo(m_accessoryPrs->getBluetoothBtn());
+               const auto muteBtnAo =
+                               utils::getAo(m_accessoryPrs->getMuteBtn());
+               const auto moreOptCueAo =
+                               utils::getAo(m_moreOptionsPrs->getCueAo());
+               const auto vcLayout =
+                               utils::getAo(m_accessoryPrs->getVolumeControlLy());
+               const auto vcDecrVolumeBtn =
+                               utils::getAo(m_accessoryPrs->getVolumeControlDecreaseBtn());
+               const auto vcIncrVolumeBtn =
+                               utils::getAo(m_accessoryPrs->getVolumeControlIncreaseBtn());
+               const auto vcVolumeValueAo =
+                               utils::getAo(m_accessoryPrs->getVolumeControlValueTxtAo());
+               const auto bottomBtnAo = utils::getAo(m_bottomBtn.get());
+
+               if (ao == statusTxtAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *mainTxtAo;
+                               return mainTxtAo;
                        }
-               } else if (ao == *mainTxtAo) {
+               } else if (ao == mainTxtAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
                                if (subTxtAo) {
-                                       return *subTxtAo;
+                                       return subTxtAo;
                                } else {
-                                       return *volumeBtnAo;
+                                       return volumeBtnAo;
                                }
                        } else {
-                               return *statusTxtAo;
+                               return statusTxtAo;
                        }
-               } else if (subTxtAo && ao == *subTxtAo) {
+               } else if (ao == subTxtAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *volumeBtnAo;
+                               return volumeBtnAo;
                        } else {
-                               return *mainTxtAo;
+                               return mainTxtAo;
                        }
-               } else if (ao == *volumeBtnAo) {
+               } else if (ao == volumeBtnAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *bluetoothBtnAo;
+                               return bluetoothBtnAo;
                        } else {
                                if (subTxtAo) {
-                                       return *subTxtAo;
+                                       return subTxtAo;
                                } else {
-                                       return *mainTxtAo;
+                                       return mainTxtAo;
                                }
                        }
-               } else if (ao == *bluetoothBtnAo) {
+               } else if (ao == bluetoothBtnAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *muteBtnAo;
+                               return muteBtnAo;
                        } else {
-                               return *volumeBtnAo;
+                               return volumeBtnAo;
                        }
-               } else if (ao == *muteBtnAo) {
+               } else if (ao == muteBtnAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *moreOptCueAo;
+                               return moreOptCueAo;
                        } else {
-                               return *bluetoothBtnAo;
+                               return bluetoothBtnAo;
                        }
-               } else if (ao == *moreOptCueAo) {
+               } else if (ao == moreOptCueAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                                       return *m_bottomBtn;
+                                       return bottomBtnAo;
                        } else {
-                               return *muteBtnAo;
+                               return muteBtnAo;
                        }
-               } else if (ao == *m_bottomBtn) {
+               } else if (ao == bottomBtnAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM) {
-                               return *moreOptCueAo;
+                               return moreOptCueAo;
                        }
-               } else if (ao == *vcLayout) {
+               } else if (ao == vcLayout) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *vcDecrVolumeBtn;
+                               return vcDecrVolumeBtn;
                        }
-               } else if (ao == *vcDecrVolumeBtn) {
+               } else if (ao == vcDecrVolumeBtn) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *vcVolumeValueAo;
+                               return vcVolumeValueAo;
                        } else {
-                               return *vcLayout;
+                               return vcLayout;
                        }
-               } else if (ao == *vcVolumeValueAo) {
+               } else if (ao == vcVolumeValueAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *vcIncrVolumeBtn;
+                               return vcIncrVolumeBtn;
                        } else {
-                               return *vcDecrVolumeBtn;
+                               return vcDecrVolumeBtn;
                        }
-               } else if (ao == *vcIncrVolumeBtn) {
+               } else if (ao == vcIncrVolumeBtn) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM) {
-                               return *vcVolumeValueAo;
+                               return vcVolumeValueAo;
                        }
-               } else if (ao == getWindow()) {
-                       return *statusTxtAo;
+               } else if (ao == as_ao(getWindow())) {
+                       return statusTxtAo;
                } else {
                        LOG_RETURN_VALUE(RES_FAIL, nullptr, "Unknown object!");
                }
@@ -1014,81 +1008,84 @@ namespace callui {
 
        void MainPage::registerEndCallModeAo()
        {
-               m_atspiHelper->setRelationEventHandler(
+               m_atspiHelper->setEventHandler(
                                WEAK_DELEGATE_THIS(onEndCallModeAtspiHighlight));
 
                auto statusTxtAo = m_callInfoPrs->getStatusTxtAo();
                if (!statusTxtAo) {
                        DLOG("statusTxtAo is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*statusTxtAo);
+                       m_atspiHelper->registerObject(*statusTxtAo);
                }
 
                auto mainTxtAo = m_callInfoPrs->getMainTxtAo();
                if (!mainTxtAo) {
                        DLOG("mainTxtAo is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*mainTxtAo);
+                       m_atspiHelper->registerObject(*mainTxtAo);
                }
 
                auto addContactsBtnAo = m_accessoryPrs->getAddContactBtn();
                if (!addContactsBtnAo) {
                        DLOG("addContactsBtnAo is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*addContactsBtnAo);
+                       m_atspiHelper->registerObject(*addContactsBtnAo);
                }
 
                if (!m_bottomBtn) {
                        DLOG("m_bottomBtn is NULL");
                } else {
-                       m_atspiHelper->registerWidget(*m_bottomBtn);
+                       m_atspiHelper->registerObject(*m_bottomBtn);
                }
 
                DLOG("EXIT");
        }
 
-       Elm_Interface_Atspi_Accessible *MainPage::onEndCallModeAtspiHighlight(
-                       Elm_Interface_Atspi_Accessible *ao,
-                       Elm_Atspi_Relation_Type flowRelation)
+       const Elm_Interface_Atspi_Accessible *
+                       MainPage::onEndCallModeAtspiHighlight(
+                                       const Elm_Interface_Atspi_Accessible *ao,
+                                       Elm_Atspi_Relation_Type flowRelation)
        {
-               DLOG("FlowRelation [%s]",
-                               flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM ?
-                                               "FROM" : "TO");
+               DLOG();
 
-               auto statusTxtAo = m_callInfoPrs->getStatusTxtAo();
-               auto mainTxtAo = m_callInfoPrs->getMainTxtAo();
-               auto addContactsBtnAo = m_accessoryPrs->getAddContactBtn();
+               const auto statusTxtAo =
+                               utils::getAo(m_callInfoPrs->getStatusTxtAo());
+               const auto mainTxtAo =
+                               utils::getAo(m_callInfoPrs->getMainTxtAo());
+               const auto addContactsBtnAo =
+                               utils::getAo(m_accessoryPrs->getAddContactBtn());
+               const auto bottomBtnAo = utils::getAo(m_bottomBtn.get());
 
-               if (ao == *statusTxtAo) {
+               if (ao == statusTxtAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *mainTxtAo;
+                               return mainTxtAo;
                        }
-               } else if (ao == *mainTxtAo) {
+               } else if (ao == mainTxtAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
                                if (addContactsBtnAo) {
-                                       return *addContactsBtnAo;
+                                       return addContactsBtnAo;
                                } else {
-                                       return *m_bottomBtn;
+                                       return bottomBtnAo;
                                }
                        } else {
-                               return *statusTxtAo;
+                               return statusTxtAo;
                        }
-               } else if (addContactsBtnAo && ao == *addContactsBtnAo) {
+               } else if (ao == addContactsBtnAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_TO) {
-                               return *m_bottomBtn;
+                               return bottomBtnAo;
                        } else {
-                               return *mainTxtAo;
+                               return mainTxtAo;
                        }
-               } else if (ao == *m_bottomBtn) {
+               } else if (ao == bottomBtnAo) {
                        if (flowRelation == ELM_ATSPI_RELATION_FLOWS_FROM) {
                                if (addContactsBtnAo) {
-                                       return *addContactsBtnAo;
+                                       return addContactsBtnAo;
                                } else {
-                                       return *mainTxtAo;
+                                       return mainTxtAo;
                                }
                        }
-               } else if (ao == getWindow()) {
-                       return *statusTxtAo;
+               } else if (ao == as_ao(getWindow())) {
+                       return statusTxtAo;
                } else {
                        LOG_RETURN_VALUE(RES_FAIL, nullptr, "Unknown object!");
                }
index 3f58b82fbb7665d5d7af8acd0980dc9fa9c6406c..c6654c00099f160d0807654aab68e5522229a2ae 100644 (file)
@@ -130,22 +130,21 @@ namespace callui {
                void onExitAppRequest();
 
                ucl::Result createRejectMsgCueAo();
+               void onRejectMsgCueAoGestureCb(ucl::Atspi &atspi,
+                               ucl::AtspiGestureEventInfo &eventInfo);
                ucl::Result createAtspiHighlightHelper();
                void registerIncomingCallModeAo();
                void registerActiveCallModeAo();
                void registerEndCallModeAo();
-               Elm_Interface_Atspi_Accessible *onIncomingCallModeAtspiHighlight(
-                               Elm_Interface_Atspi_Accessible *widget,
+               const Elm_Interface_Atspi_Accessible *onIncomingCallModeAtspiHighlight(
+                               const Elm_Interface_Atspi_Accessible *widget,
                                Elm_Atspi_Relation_Type flowRelation);
-               Elm_Interface_Atspi_Accessible *onActiveCallModeAtspiHighlight(
-                               Elm_Interface_Atspi_Accessible *widget,
+               const Elm_Interface_Atspi_Accessible *onActiveCallModeAtspiHighlight(
+                               const Elm_Interface_Atspi_Accessible *widget,
                                Elm_Atspi_Relation_Type flowRelation);
-               Elm_Interface_Atspi_Accessible *onEndCallModeAtspiHighlight(
-                               Elm_Interface_Atspi_Accessible *ao,
+               const Elm_Interface_Atspi_Accessible *onEndCallModeAtspiHighlight(
+                               const Elm_Interface_Atspi_Accessible *ao,
                                Elm_Atspi_Relation_Type flowRelation);
-               bool onIncomingModeAtspiGesture(
-                               Elm_Interface_Atspi_Accessible *widget,
-                               Elm_Atspi_Gesture_Type gestureType);
 
                // Page //
 
index 09b14dbc75f30185eee325b95e83036d393eac91..9b1e93a9dd35b256b5606a93f07ef433ac9a549c 100644 (file)
@@ -216,7 +216,7 @@ namespace callui {
                        NotiHandler acceptHandler,
                        NotiHandler rejectHandler,
                        AcceptButtonType acceptBtnType):
-               ElmWidget(&rc, *layout, false),
+               ElmWidget(&rc, as_eo(*layout), false),
                m_accHandler(std::move(acceptHandler)),
                m_rejHandler(std::move(rejectHandler)),
                m_layout(layout.get()),
@@ -279,7 +279,7 @@ namespace callui {
                DEL_TRANSIT(m_rejGuideTr);
                DEL_TRANSIT(m_rejIconTr);
 
-               eext_rotary_object_event_callback_del(*m_layout, CALLBACK_A(
+               eext_rotary_object_event_callback_del(as_eo(*m_layout), CALLBACK_A(
                                AcceptRejectWidget::onRotaryEvent));
        }
 
@@ -294,7 +294,7 @@ namespace callui {
                FAIL_RETURN_VOID(createBezelCueComponents(),
                                "createBezelCueImages() failed!");
 
-               eext_rotary_object_event_callback_add(*m_layout, CALLBACK_A(
+               eext_rotary_object_event_callback_add(as_eo(*m_layout), CALLBACK_A(
                                AcceptRejectWidget::onRotaryEvent), this);
        }
 
@@ -302,7 +302,7 @@ namespace callui {
        {
                m_accTracer = impl::createImage(*m_layout, impl::LAYOUT_IMG_ACTION_BG);
                if (!m_accTracer) {
-                       LOG_RETURN(RES_FAIL, "createImage() failed");
+                       LOG_RETURN(RES_FAIL, "createImage() failed!");
                }
                m_accTracer->setColor(CU_COL_TRANSPARENT);
                m_layout->setContent(*m_accTracer,
@@ -310,7 +310,7 @@ namespace callui {
 
                m_accGuide = impl::createImage(*m_layout, impl::LAYOUT_IMG_ACTION_BG);
                if (!m_accGuide) {
-                       LOG_RETURN(RES_FAIL, "createImage() failed");
+                       LOG_RETURN(RES_FAIL, "createImage() failed!");
                }
                m_accGuide->setColor(CU_COL_TRANSPARENT);
                m_layout->setContent(*m_accGuide,
@@ -327,7 +327,7 @@ namespace callui {
                        break;
                }
                if (!m_accIcon) {
-                       LOG_RETURN(RES_FAIL, "createImage() failed");
+                       LOG_RETURN(RES_FAIL, "createImage() failed!");
                }
                m_accIcon->setColor(CU_COL_AO0113);
                m_layout->setContent(*m_accIcon,
@@ -356,7 +356,7 @@ namespace callui {
        {
                m_rejTracer = impl::createImage(*m_layout, impl::LAYOUT_IMG_ACTION_BG);
                if (!m_rejTracer) {
-                       LOG_RETURN(RES_FAIL, "createImage() failed");
+                       LOG_RETURN(RES_FAIL, "createImage() failed!");
                }
                m_rejTracer->setColor(CU_COL_TRANSPARENT);
                m_layout->setContent(*m_rejTracer,
@@ -364,7 +364,7 @@ namespace callui {
 
                m_rejGuide = impl::createImage(*m_layout, impl::LAYOUT_IMG_ACTION_BG);
                if (!m_rejGuide) {
-                       LOG_RETURN(RES_FAIL, "createImage() failed");
+                       LOG_RETURN(RES_FAIL, "createImage() failed!");
                }
                m_rejGuide->setColor(CU_COL_TRANSPARENT);
                m_layout->setContent(*m_rejGuide,
@@ -372,7 +372,7 @@ namespace callui {
 
                m_rejIcon = impl::createImage(*m_layout, impl::LAYOUT_IMG_REJECT);
                if (!m_rejIcon) {
-                       LOG_RETURN(RES_FAIL, "createImage() failed");
+                       LOG_RETURN(RES_FAIL, "createImage() failed!");
                }
                m_rejIcon->setColor(CU_COL_AO0115);
                m_layout->setContent(*m_rejIcon,
@@ -431,13 +431,13 @@ namespace callui {
                        needTransition = false;
                }
 
-               if (widget == *m_accEventLy) {
+               if (as_eo(widget) == as_eo(*m_accEventLy)) {
                        DLOG("Accept button down");
                        m_isAccPressed = true;
                        if (needTransition) {
                                setAcceptPressedState();
                        }
-               } else if (widget == *m_rejEventLy) {
+               } else if (as_eo(widget) == as_eo(*m_rejEventLy)) {
                        DLOG("Reject button down");
                        m_isRejPressed = true;
                        if (needTransition) {
@@ -470,14 +470,14 @@ namespace callui {
 
                m_lastMoveDistance = impl::INIT_MOVE_DISTANCE_VAL;
 
-               if (widget == *m_accEventLy) {
+               if (as_eo(widget) == as_eo(*m_accEventLy)) {
                        if (m_isAccPressed) {
                                DLOG("Accept button released");
                                setAcceptUnpressedState();
                        } else {
                                LOG_RETURN_VOID(RES_FAIL, "Accept button was not pressed");
                        }
-               } else if (widget == *m_rejEventLy) {
+               } else if (as_eo(widget) == as_eo(*m_rejEventLy)) {
                        if (m_isRejPressed) {
                                DLOG("Reject button released");
                                setRejectUnpressedState();
@@ -518,12 +518,12 @@ namespace callui {
                }
 
                ElmWidgetSRef img;
-               if (widget == *m_accEventLy) {
+               if (as_eo(widget) == as_eo(*m_accEventLy)) {
                        if (!m_isAccPressed) {
                                LOG_RETURN_VOID(RES_FAIL, "Down callback is not come");
                        }
                        img = m_accTracer;
-               } else if (widget == *m_rejEventLy) {
+               } else if (as_eo(widget) == as_eo(*m_rejEventLy)) {
                        if (!m_isRejPressed) {
                                LOG_RETURN_VOID(RES_FAIL, "Down callback is not come");
                        }
@@ -578,7 +578,7 @@ namespace callui {
                m_accBCAnimIndex =  impl::BC_ITEM_COUNT - 1;
                Elm_Transit *tr1 = elm_transit_add();
                elm_transit_effect_color_add(tr1, CU_COL_AO0113D, CU_COL_AO0113);
-               elm_transit_object_add(tr1, *m_accBezelCueImg[m_accBCAnimIndex]);
+               elm_transit_object_add(tr1, as_eo(*m_accBezelCueImg[m_accBCAnimIndex]));
                elm_transit_duration_set(tr1,
                                impl::BC_ANIMATION_DURATION[m_accBCAnimIndex]);
                elm_transit_objects_final_state_keep_set(tr1, EINA_TRUE);
@@ -591,7 +591,7 @@ namespace callui {
                m_rejBCAnimIndex = impl::BC_ITEM_COUNT - 1;
                Elm_Transit *tr2 = elm_transit_add();
                elm_transit_effect_color_add(tr2, CU_COL_AO0115D, CU_COL_AO0115);
-               elm_transit_object_add(tr2, *m_rejBezelCueImg[m_rejBCAnimIndex]);
+               elm_transit_object_add(tr2, as_eo(*m_rejBezelCueImg[m_rejBCAnimIndex]));
                elm_transit_duration_set(tr2,
                                impl::BC_ANIMATION_DURATION[m_rejBCAnimIndex]);
                elm_transit_objects_final_state_keep_set(tr2, EINA_TRUE);
@@ -618,7 +618,7 @@ namespace callui {
                m_accTracerTr = elm_transit_add();
                elm_transit_effect_zoom_add(m_accTracerTr,
                                impl::ICON_ZOOM_EFF_VAL_MIN, impl::ICON_ZOOM_EFF_VAL_MID);
-               elm_transit_object_add(m_accTracerTr, *m_accTracer);
+               elm_transit_object_add(m_accTracerTr, as_eo(*m_accTracer));
                elm_transit_duration_set(m_accTracerTr, impl::ROTARY_ACTION_ANIM_DUR);
                elm_transit_objects_final_state_keep_set(m_accTracerTr, EINA_FALSE);
                elm_transit_del_cb_set(m_accTracerTr,
@@ -633,7 +633,7 @@ namespace callui {
                m_accGuideTr = elm_transit_add();
                elm_transit_effect_zoom_add(m_accGuideTr,
                                impl::ICON_ZOOM_EFF_VAL_MIN, impl::ICON_ZOOM_EFF_VAL_MAX);
-               elm_transit_object_add(m_accGuideTr, *m_accGuide);
+               elm_transit_object_add(m_accGuideTr, as_eo(*m_accGuide));
                elm_transit_duration_set(m_accGuideTr, impl::ROTARY_ACTION_ANIM_DUR);
                elm_transit_objects_final_state_keep_set(m_accGuideTr, EINA_FALSE);
                elm_transit_del_cb_set(m_accGuideTr,
@@ -647,7 +647,7 @@ namespace callui {
                DEL_TRANSIT(m_accIconTr);
                m_accIconTr = elm_transit_add();
                elm_transit_effect_color_add(m_accIconTr, CU_COL_AO0113, CU_COL_WHITE);
-               elm_transit_object_add(m_accIconTr, *m_accIcon);
+               elm_transit_object_add(m_accIconTr, as_eo(*m_accIcon));
                elm_transit_duration_set(m_accIconTr, impl::ROTARY_ACTION_ANIM_DUR);
                elm_transit_objects_final_state_keep_set(m_accIconTr, EINA_TRUE);
                elm_transit_del_cb_set(m_accIconTr,
@@ -684,7 +684,7 @@ namespace callui {
 
                m_rejIconTr = elm_transit_add();
                elm_transit_effect_translation_add(m_rejIconTr, 0, 0, animTrace, 0);
-               elm_transit_object_add(m_rejIconTr, *m_rejIcon);
+               elm_transit_object_add(m_rejIconTr, as_eo(*m_rejIcon));
                elm_transit_duration_set(m_rejIconTr, impl::ROTARY_ACTION_ANIM_DUR);
                elm_transit_objects_final_state_keep_set(m_rejIconTr, EINA_TRUE);
                elm_transit_del_cb_set(m_rejIconTr,
@@ -699,7 +699,7 @@ namespace callui {
                m_accTracerTr = elm_transit_add();
                elm_transit_effect_zoom_add(m_accTracerTr,
                                impl::ICON_ZOOM_EFF_VAL_MIN, impl::ICON_ZOOM_EFF_VAL_MAX);
-               elm_transit_object_add(m_accTracerTr, *m_accTracer);
+               elm_transit_object_add(m_accTracerTr, as_eo(*m_accTracer));
                elm_transit_duration_set(m_accTracerTr, impl::ROTARY_ACTION_ANIM_DUR);
                elm_transit_objects_final_state_keep_set(m_accTracerTr, EINA_FALSE);
                elm_transit_del_cb_set(m_accTracerTr,
@@ -715,7 +715,7 @@ namespace callui {
                m_accGuideTr = elm_transit_add();
                elm_transit_effect_zoom_add(m_accGuideTr,
                                impl::ICON_ZOOM_EFF_VAL_MAX, impl::ICON_ZOOM_EFF_VAL_MIN);
-               elm_transit_object_add(m_accGuideTr, *m_accGuide);
+               elm_transit_object_add(m_accGuideTr, as_eo(*m_accGuide));
                elm_transit_duration_set(m_accGuideTr, impl::ROTARY_ACTION_ANIM_DUR);
                elm_transit_objects_final_state_keep_set(m_accGuideTr, EINA_FALSE);
                elm_transit_del_cb_set(m_accGuideTr,
@@ -750,7 +750,7 @@ namespace callui {
 
                m_rejIconTr = elm_transit_add();
                elm_transit_effect_translation_add(m_rejIconTr, 0, 0, dx, 0);
-               elm_transit_object_add(m_rejIconTr, *m_rejIcon);
+               elm_transit_object_add(m_rejIconTr, as_eo(*m_rejIcon));
                elm_transit_duration_set(m_rejIconTr, impl::ROTARY_ACTION_ANIM_DUR);
                elm_transit_objects_final_state_keep_set(m_rejIconTr, EINA_TRUE);
                elm_transit_del_cb_set(m_rejIconTr,
@@ -781,7 +781,7 @@ namespace callui {
                m_rejTracerTr = elm_transit_add();
                elm_transit_effect_zoom_add(m_rejTracerTr,
                                impl::ICON_ZOOM_EFF_VAL_MIN, impl::ICON_ZOOM_EFF_VAL_MID);
-               elm_transit_object_add(m_rejTracerTr, *m_rejTracer);
+               elm_transit_object_add(m_rejTracerTr, as_eo(*m_rejTracer));
                elm_transit_duration_set(m_rejTracerTr, impl::ROTARY_ACTION_ANIM_DUR);
                elm_transit_objects_final_state_keep_set(m_rejTracerTr, EINA_FALSE);
                elm_transit_del_cb_set(m_rejTracerTr,
@@ -796,7 +796,7 @@ namespace callui {
                m_rejGuideTr = elm_transit_add();
                elm_transit_effect_zoom_add(m_rejGuideTr,
                                impl::ICON_ZOOM_EFF_VAL_MIN, impl::ICON_ZOOM_EFF_VAL_MAX);
-               elm_transit_object_add(m_rejGuideTr, *m_rejGuide);
+               elm_transit_object_add(m_rejGuideTr, as_eo(*m_rejGuide));
                elm_transit_duration_set(m_rejGuideTr, impl::ROTARY_ACTION_ANIM_DUR);
                elm_transit_objects_final_state_keep_set(m_rejGuideTr, EINA_FALSE);
                elm_transit_del_cb_set(m_rejGuideTr,
@@ -810,7 +810,7 @@ namespace callui {
                DEL_TRANSIT(m_rejIconTr);
                m_rejIconTr = elm_transit_add();
                elm_transit_effect_color_add(m_rejIconTr, CU_COL_AO0115, CU_COL_WHITE);
-               elm_transit_object_add(m_rejIconTr, *m_rejIcon);
+               elm_transit_object_add(m_rejIconTr, as_eo(*m_rejIcon));
                elm_transit_duration_set(m_rejIconTr, impl::ROTARY_ACTION_ANIM_DUR);
                elm_transit_objects_final_state_keep_set(m_rejIconTr, EINA_TRUE);
                elm_transit_del_cb_set(m_rejIconTr,
@@ -847,7 +847,7 @@ namespace callui {
 
                m_accIconTr = elm_transit_add();
                elm_transit_effect_translation_add(m_accIconTr, 0, 0, animTrace, 0);
-               elm_transit_object_add(m_accIconTr, *m_accIcon);
+               elm_transit_object_add(m_accIconTr, as_eo(*m_accIcon));
                elm_transit_duration_set(m_accIconTr, impl::ROTARY_ACTION_ANIM_DUR);
                elm_transit_objects_final_state_keep_set(m_accIconTr, EINA_TRUE);
                elm_transit_del_cb_set(m_accIconTr,
@@ -881,7 +881,7 @@ namespace callui {
 
                m_accIconTr = elm_transit_add();
                elm_transit_effect_translation_add(m_accIconTr, 0, 0, dx, 0);
-               elm_transit_object_add(m_accIconTr, *m_accIcon);
+               elm_transit_object_add(m_accIconTr, as_eo(*m_accIcon));
                elm_transit_duration_set(m_accIconTr, impl::ROTARY_ACTION_ANIM_DUR);
                elm_transit_objects_final_state_keep_set(m_accIconTr, EINA_TRUE);
                elm_transit_del_cb_set(m_accIconTr,
@@ -896,7 +896,7 @@ namespace callui {
                m_rejTracerTr = elm_transit_add();
                elm_transit_effect_zoom_add(m_rejTracerTr,
                                impl::ICON_ZOOM_EFF_VAL_MIN, impl::ICON_ZOOM_EFF_VAL_MAX);
-               elm_transit_object_add(m_rejTracerTr, *m_rejTracer);
+               elm_transit_object_add(m_rejTracerTr, as_eo(*m_rejTracer));
                elm_transit_duration_set(m_rejTracerTr, impl::ROTARY_ACTION_ANIM_DUR);
                elm_transit_objects_final_state_keep_set(m_rejTracerTr, EINA_FALSE);
                elm_transit_del_cb_set(m_rejTracerTr,
@@ -918,7 +918,7 @@ namespace callui {
                m_rejGuideTr = elm_transit_add();
                elm_transit_effect_zoom_add(m_rejGuideTr,
                                impl::ICON_ZOOM_EFF_VAL_MAX, impl::ICON_ZOOM_EFF_VAL_MIN);
-               elm_transit_object_add(m_rejGuideTr, *m_rejGuide);
+               elm_transit_object_add(m_rejGuideTr, as_eo(*m_rejGuide));
                elm_transit_duration_set(m_rejGuideTr, impl::ROTARY_ACTION_ANIM_DUR);
                elm_transit_objects_final_state_keep_set(m_rejGuideTr, EINA_FALSE);
                elm_transit_del_cb_set(m_rejGuideTr,
@@ -934,7 +934,7 @@ namespace callui {
                        m_accBezelCueImg[i] = impl::createImage(*m_layout,
                                        impl::ACCEPT_BC_PARAMS[i].theme);
                        if (!m_accBezelCueImg[i]) {
-                               LOG_RETURN(RES_FAIL, "Create bezel cue image failed");
+                               LOG_RETURN(RES_FAIL, "Create bezel cue image failed!");
                        }
                        m_accBezelCueImg[i]->setColor(CU_COL_AO0113T);
                        show(*m_accBezelCueImg[i]);
@@ -945,7 +945,7 @@ namespace callui {
                        m_rejBezelCueImg[i] = impl::createImage(*m_layout,
                                        impl::REJECT_BC_PARAMS[i].theme);
                        if (!m_rejBezelCueImg[i]) {
-                               LOG_RETURN(RES_FAIL, "Create bezel cue image failed");
+                               LOG_RETURN(RES_FAIL, "Create bezel cue image failed!");
                        }
                        m_rejBezelCueImg[i]->setColor(CU_COL_AO0113T);
                        show(*m_rejBezelCueImg[i]);
@@ -1069,7 +1069,8 @@ namespace callui {
                if (m_accBCAnimIndex == 0) {
                        Elm_Transit *tr1 = elm_transit_add();
                        elm_transit_effect_color_add(tr1, CU_COL_AO0113, CU_COL_AO0113D);
-                       elm_transit_object_add(tr1, *m_accBezelCueImg[m_accBCAnimIndex]);
+                       elm_transit_object_add(tr1,
+                                       as_eo(*m_accBezelCueImg[m_accBCAnimIndex]));
                        elm_transit_duration_set(tr1,
                                        impl::BC_ANIMATION_DURATION[impl::BC_ITEM_COUNT - 1]);
                        elm_transit_objects_final_state_keep_set(tr1, EINA_TRUE);
@@ -1088,7 +1089,7 @@ namespace callui {
 
                Elm_Transit *tr1 = elm_transit_add();
                elm_transit_effect_color_add(tr1, CU_COL_AO0113, CU_COL_AO0113D);
-               elm_transit_object_add(tr1, *m_accBezelCueImg[oldIndex]);
+               elm_transit_object_add(tr1, as_eo(*m_accBezelCueImg[oldIndex]));
                elm_transit_duration_set(tr1,
                                impl::BC_ANIMATION_DURATION[m_accBCAnimIndex]);
                elm_transit_objects_final_state_keep_set(tr1, EINA_TRUE);
@@ -1096,7 +1097,7 @@ namespace callui {
 
                Elm_Transit *tr2 = elm_transit_add();
                elm_transit_effect_color_add(tr2, CU_COL_AO0113D, CU_COL_AO0113);
-               elm_transit_object_add(tr2, *m_accBezelCueImg[m_accBCAnimIndex]);
+               elm_transit_object_add(tr2, as_eo(*m_accBezelCueImg[m_accBCAnimIndex]));
                elm_transit_duration_set(tr2,
                                impl::BC_ANIMATION_DURATION[m_accBCAnimIndex]);
                elm_transit_objects_final_state_keep_set(tr2, EINA_TRUE);
@@ -1122,7 +1123,8 @@ namespace callui {
                                        CU_COL_AO0113D, CU_COL_AO0113T);
                        for (int i = 0; i < impl::BC_ITEM_COUNT; i++) {
                                m_accBezelCueImg[i]->setColor(CU_COL_AO0113D);
-                               elm_transit_object_add(hideTransit, *m_accBezelCueImg[i]);
+                               elm_transit_object_add(hideTransit,
+                                               as_eo(*m_accBezelCueImg[i]));
                        }
                        elm_transit_duration_set(hideTransit, impl::BC_ANIM_DUR_HIDE);
                        elm_transit_objects_final_state_keep_set(hideTransit, EINA_TRUE);
@@ -1143,7 +1145,7 @@ namespace callui {
                m_accBCAnimIndex = impl::BC_ITEM_COUNT - 1;
                Elm_Transit *tr1 = elm_transit_add();
                elm_transit_effect_color_add(tr1, CU_COL_AO0113D, CU_COL_AO0113);
-               elm_transit_object_add(tr1, *m_accBezelCueImg[m_accBCAnimIndex]);
+               elm_transit_object_add(tr1, as_eo(*m_accBezelCueImg[m_accBCAnimIndex]));
                elm_transit_duration_set(tr1,
                                impl::BC_ANIMATION_DURATION[m_accBCAnimIndex]);
                elm_transit_objects_final_state_keep_set(tr1, EINA_TRUE);
@@ -1161,7 +1163,8 @@ namespace callui {
                if (m_rejBCAnimIndex == 0) {
                        Elm_Transit *tr1 = elm_transit_add();
                        elm_transit_effect_color_add(tr1, CU_COL_AO0115, CU_COL_AO0115D);
-                       elm_transit_object_add(tr1, *m_rejBezelCueImg[m_rejBCAnimIndex]);
+                       elm_transit_object_add(tr1,
+                                       as_eo(*m_rejBezelCueImg[m_rejBCAnimIndex]));
                        elm_transit_duration_set(tr1,
                                        impl::BC_ANIMATION_DURATION[impl::BC_ITEM_COUNT - 1]);
                        elm_transit_objects_final_state_keep_set(tr1, EINA_TRUE);
@@ -1179,7 +1182,7 @@ namespace callui {
 
                Elm_Transit *tr1 = elm_transit_add();
                elm_transit_effect_color_add(tr1, CU_COL_AO0115, CU_COL_AO0115D);
-               elm_transit_object_add(tr1, *m_rejBezelCueImg[oldIndex]);
+               elm_transit_object_add(tr1, as_eo(*m_rejBezelCueImg[oldIndex]));
                elm_transit_duration_set(tr1,
                                impl::BC_ANIMATION_DURATION[m_rejBCAnimIndex]);
                elm_transit_objects_final_state_keep_set(tr1, EINA_TRUE);
@@ -1187,7 +1190,7 @@ namespace callui {
 
                Elm_Transit *tr2 = elm_transit_add();
                elm_transit_effect_color_add(tr2, CU_COL_AO0115D, CU_COL_AO0115);
-               elm_transit_object_add(tr2, *m_rejBezelCueImg[m_rejBCAnimIndex]);
+               elm_transit_object_add(tr2, as_eo(*m_rejBezelCueImg[m_rejBCAnimIndex]));
                elm_transit_duration_set(tr2,
                                impl::BC_ANIMATION_DURATION[m_rejBCAnimIndex]);
                elm_transit_objects_final_state_keep_set(tr2, EINA_TRUE);
@@ -1213,7 +1216,8 @@ namespace callui {
                                        CU_COL_AO0115D, CU_COL_AO0115T);
                        for (int i = 0; i < impl::BC_ITEM_COUNT; i++) {
                                m_rejBezelCueImg[i]->setColor(CU_COL_AO0115D);
-                               elm_transit_object_add(hideTransit, *m_rejBezelCueImg[i]);
+                               elm_transit_object_add(hideTransit,
+                                               as_eo(*m_rejBezelCueImg[i]));
                        }
                        elm_transit_duration_set(hideTransit, impl::BC_ANIM_DUR_HIDE);
                        elm_transit_objects_final_state_keep_set(hideTransit, EINA_TRUE);
@@ -1234,7 +1238,7 @@ namespace callui {
                m_rejBCAnimIndex = impl::BC_ITEM_COUNT - 1;
                Elm_Transit *tr1 = elm_transit_add();
                elm_transit_effect_color_add(tr1, CU_COL_AO0115D, CU_COL_AO0115);
-               elm_transit_object_add(tr1, *m_rejBezelCueImg[m_rejBCAnimIndex]);
+               elm_transit_object_add(tr1, as_eo(*m_rejBezelCueImg[m_rejBCAnimIndex]));
                elm_transit_duration_set(tr1,
                                impl::BC_ANIMATION_DURATION[m_rejBCAnimIndex]);
                elm_transit_objects_final_state_keep_set(tr1, EINA_TRUE);
@@ -1398,11 +1402,11 @@ namespace callui {
 
        void AcceptRejectWidget::activateRotary()
        {
-               eext_rotary_object_event_activated_set(*m_layout, EINA_TRUE);
+               eext_rotary_object_event_activated_set(as_eo(*m_layout), EINA_TRUE);
        }
        void AcceptRejectWidget::deactivateRotary()
        {
-               eext_rotary_object_event_activated_set(*m_layout, EINA_FALSE);
+               eext_rotary_object_event_activated_set(as_eo(*m_layout), EINA_FALSE);
        }
 
        void AcceptRejectWidget::setAcceptBtnType(AcceptButtonType type)
@@ -1510,24 +1514,24 @@ namespace callui {
                if (!m_accAo) {
                        LOG_RETURN(RES_FAIL, "createAccessObject() failed!");
                }
-               elm_atspi_accessible_translation_domain_set(*m_accAo, TEXT_DOMAIN);
-               elm_atspi_accessible_reading_info_type_set(*m_accAo,
-                               ELM_ACCESSIBLE_READING_INFO_TYPE_NAME |
+               auto &acceptAtspi = m_accAo->getAtspi();
+               acceptAtspi.setTDomain(TEXT_DOMAIN);
+               acceptAtspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME |
                                ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION);
-               elm_atspi_accessible_name_set(*m_accAo, AO_STR_ACCEPT_CALL);
-               elm_atspi_accessible_description_set(*m_accAo,
+               acceptAtspi.setName(AO_STR_ACCEPT_CALL);
+               acceptAtspi.setDescription(
                                AO_STR_SWIPE_RIGHT_WITH_TWO_FINGERS_TO_ACCEPT);
 
                m_rejAo = utils::createAccessObject(parent, *m_rejEventLy);
                if (!m_rejAo) {
                        LOG_RETURN(RES_FAIL, "createAccessObject() failed!");
                }
-               elm_atspi_accessible_translation_domain_set(*m_rejAo, TEXT_DOMAIN);
-               elm_atspi_accessible_reading_info_type_set(*m_rejAo,
-                               ELM_ACCESSIBLE_READING_INFO_TYPE_NAME |
+               auto &rejectAtspi = m_rejAo->getAtspi();
+               rejectAtspi.setTDomain(TEXT_DOMAIN);
+               rejectAtspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME |
                                ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION);
-               elm_atspi_accessible_name_set(*m_rejAo, AO_STR_REJECT_CALL);
-               elm_atspi_accessible_description_set(*m_rejAo,
+               rejectAtspi.setName(AO_STR_REJECT_CALL);
+               rejectAtspi.setDescription(
                                AO_STR_SWIPE_LEFT_WITH_TWO_FINGERS_TO_REJECT);
 
                return RES_OK;
index 9431a5daf55be3a4dd7aeaec9f7881c304959960..2285f68ceeae1da725863035c2fee14462739077 100644 (file)
@@ -70,11 +70,12 @@ namespace callui {
                        const LayoutSRef &layout,
                        int maxValue,
                        int curValue):
-                               ElmWidget(&rc, *layout, false),
+                               ElmWidget(&rc, as_eo(*layout), false),
                                m_layout(layout.get()),
-                               m_circleLy(elm_layout_add(*m_layout)),
-                               m_circleSurf(eext_circle_surface_layout_add(m_circleLy)),
-                               m_slider(eext_circle_object_slider_add(*m_layout, m_circleSurf))
+                               m_circleLy(elm_layout_add(as_eo(*m_layout))),
+                               m_circleSurf(eext_circle_surface_layout_add(as_eo(m_circleLy))),
+                               m_slider(eext_circle_object_slider_add(as_eo(*m_layout),
+                                               m_circleSurf))
        {
                prepare(maxValue, curValue);
        }
@@ -95,21 +96,19 @@ namespace callui {
                setValue(curValue);
 
                // Screen Reader
-               elm_atspi_accessible_role_set(m_slider,
-                               ELM_ATSPI_ROLE_REDUNDANT_OBJECT);
-               elm_atspi_accessible_role_set(m_circleLy,
-                               ELM_ATSPI_ROLE_REDUNDANT_OBJECT);
-               elm_atspi_accessible_role_set(*m_layout,
-                               ELM_ATSPI_ROLE_REDUNDANT_OBJECT);
+               m_slider.getAtspi().setRole(ELM_ATSPI_ROLE_REDUNDANT_OBJECT);
+               m_circleLy.getAtspi().setRole(ELM_ATSPI_ROLE_REDUNDANT_OBJECT);
+               m_layout->getAtspi().setRole(ELM_ATSPI_ROLE_REDUNDANT_OBJECT);
        }
 
        void Slider::setValue(int value)
        {
-               eext_circle_object_value_set(m_slider, static_cast<double>(value));
+               eext_circle_object_value_set(as_eo(m_slider),
+                               static_cast<double>(value));
        }
 
        void Slider::setMaxValue(int maxValue)
        {
-               eext_circle_object_value_min_max_set(m_slider, 0, maxValue);
+               eext_circle_object_value_min_max_set(as_eo(m_slider), 0, maxValue);
        }
 }
index 5eeb11bd063e22ed798c09512ab05aef278bc25c..478070d76b53205f798a75ce8a564ddf764a7680 100644 (file)
@@ -104,8 +104,8 @@ namespace callui {
                        EventHandler handler):
                Slider(rc, layout, maxValue, curValue),
                m_handler(std::move(handler)),
-               m_decreaseBtn(elm_button_add(*m_layout)),
-               m_increaseBtn(elm_button_add(*m_layout))
+               m_decreaseBtn(elm_button_add(as_eo(*m_layout))),
+               m_increaseBtn(elm_button_add(as_eo(*m_layout)))
        {
                prepare(info, curValue);
        }
@@ -154,7 +154,8 @@ namespace callui {
 
        void VolumeControl::setValue(int value)
        {
-               eext_circle_object_value_set(m_slider, static_cast<double>(value));
+               eext_circle_object_value_set(as_eo(m_slider),
+                               static_cast<double>(value));
                m_layout->setText(std::to_string(value), impl::PART_TXT_VALUE);
        }
 
@@ -199,58 +200,48 @@ namespace callui {
 
        void VolumeControl::registerAccessObjectInformation()
        {
-               elm_atspi_accessible_translation_domain_set(m_slider, TEXT_DOMAIN);
-               elm_atspi_accessible_reading_info_type_set(m_slider,
-                               ELM_ACCESSIBLE_READING_INFO_TYPE_NAME
+               auto &sliderAtspi = m_slider.getAtspi();
+               sliderAtspi.setTDomain(TEXT_DOMAIN);
+               sliderAtspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME
                                | ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION);
-               elm_atspi_accessible_name_set(m_slider, STR_VOLUME);
-               elm_atspi_accessible_description_set(m_slider,
-                               AO_STR_ROTATE_BEZEL_TO_ADJUST);
-
-               elm_atspi_accessible_description_cb_set(m_slider,
-                               [](void *data, Evas_Object *obj) -> char *
-                               {
-                                       char buff[impl::DESCRIPTION_BUFF_SIZE] = { 0 } ;
-                                       snprintf(buff, sizeof(buff),
-                                                       AO_STR_ROTATE_BEZEL_TO_ADJUST.translate(),
-                                                       STR_VOLUME.translate());
-                                       return strdup(buff);
-                               },
-                               this);
-
-               elm_atspi_accessible_translation_domain_set(m_decreaseBtn, TEXT_DOMAIN);
-               elm_atspi_accessible_name_set(m_decreaseBtn,
-                               AO_STR_DECREASE_VOLUME);
-
-               elm_atspi_accessible_translation_domain_set(m_increaseBtn, TEXT_DOMAIN);
-               elm_atspi_accessible_name_set(m_increaseBtn,
-                               AO_STR_INCREASE_VOLUME);
-
-               m_valueTxtAo = utils::createAccessObjectFromLyPart(
-                               *m_layout,
-                               *m_layout,
+               sliderAtspi.setName(STR_VOLUME);
+               sliderAtspi.setDescriptionCb(
+                               WEAK_DELEGATE_THIS(onSliderAoDescriptionCb));
+
+               auto &dereaseAtspi = m_decreaseBtn.getAtspi();
+               dereaseAtspi.setTDomain(TEXT_DOMAIN);
+               dereaseAtspi.setName(AO_STR_DECREASE_VOLUME);
+
+               auto &increaseAtspi = m_increaseBtn.getAtspi();
+               increaseAtspi.setTDomain(TEXT_DOMAIN);
+               increaseAtspi.setName(AO_STR_INCREASE_VOLUME);
+
+               m_valueTxtAo = utils::createAccessObjectFromPart(*m_layout, *m_layout,
                                impl::PART_TXT_VALUE_AO);
                if (!m_valueTxtAo) {
-                       ELOG("createAccessObjectFromLyPart() failed");
+                       ELOG("createAccessObjectFromPart() failed!");
                } else {
-                       elm_atspi_accessible_translation_domain_set(*m_valueTxtAo,
-                                       TEXT_DOMAIN);
-                       elm_atspi_accessible_reading_info_type_set(*m_valueTxtAo,
-                                       ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
-                       elm_atspi_accessible_name_cb_set(*m_valueTxtAo,
-                                       [](void *data, Evas_Object *obj) -> char *
-                                       {
-                                               auto self = static_cast<VolumeControl *>(data);
-                                               if (!self) {
-                                                       return nullptr;
-                                               }
-                                               auto txt = self->m_layout->
-                                                               getText(impl::PART_TXT_VALUE).getCStr();
-                                               return (txt) ? strdup(txt) : nullptr;
-                                       },
-                                       this);
+                       auto &valueTxtAtspi = m_valueTxtAo->getAtspi();
+                       valueTxtAtspi.setTDomain(TEXT_DOMAIN);
+                       valueTxtAtspi.setReadingInfo(ELM_ACCESSIBLE_READING_INFO_TYPE_NAME);
+                       valueTxtAtspi.setNameCb(WEAK_DELEGATE_THIS(onValueTextAoNameCb));
                }
 
-               elm_atspi_accessible_role_set(*m_layout, ELM_ATSPI_ROLE_TEXT);
+               m_layout->getAtspi().setRole(ELM_ATSPI_ROLE_TEXT);
+       }
+
+       CString VolumeControl::onSliderAoDescriptionCb(Atspi &atspi)
+       {
+               char buff[impl::DESCRIPTION_BUFF_SIZE] = { 0 };
+               snprintf(buff, sizeof(buff),
+                               AO_STR_ROTATE_BEZEL_TO_ADJUST.translate(),
+                               STR_VOLUME.translate());
+               return CString::dup(buff);
+       }
+
+       CString VolumeControl::onValueTextAoNameCb(Atspi &atspi)
+       {
+               const auto txt = m_layout->getText(impl::PART_TXT_VALUE);
+               return (!txt.empty()) ? CString::dup(txt.c_str()) : nullptr;
        }
 }
index 168a4ea832db58c1c13364f499839930e351ef6a..5b14b8d55980d2681f772403d1f4191634257344 100644 (file)
@@ -173,6 +173,8 @@ namespace callui {
 
                void registerAccessObjectInformation();
 
+               ucl::CString onSliderAoDescriptionCb(ucl::Atspi &atspi);
+               ucl::CString onValueTextAoNameCb(ucl::Atspi &atspi);
        private:
                const EventHandler m_handler;
 
index 4e26d2228518e958017e56055ee411e1a3e34a7c..31e74a361b60503523da8bee0f9e6b718095606a 100644 (file)
@@ -47,7 +47,8 @@ namespace callui { namespace utils {
                        LOG_RETURN(RES_INVALID_OPERATION, "Circle Surface data already set!");
                }
 
-               const auto sfc = eext_circle_surface_conformant_add(win->getConformant());
+               const auto sfc = eext_circle_surface_conformant_add(
+                               as_eo(win->getConformant()));
                if (!sfc) {
                        LOG_RETURN(RES_FAIL,
                                        "eext_circle_surface_conformant_add() failed!");
@@ -89,14 +90,28 @@ namespace callui { namespace utils {
                result->setGeometry(0, 0, 1, 1);
                show(*result);
 
-               elm_atspi_accessible_reading_info_type_set(*result, 0);
+               struct FakeHandler {
+                       SharedRef<FakeHandler> selfRef;
 
-               elm_atspi_accessible_gesture_cb_set(*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<FakeHandler>();
+               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<FakeHandler *>(data)->selfRef.reset();
+                               }, fh.get());
+
+               auto &atspi = result->getAtspi();
+               atspi.setReadingInfo(0);
+               atspi.addGestureHandler(WEAK_DELEGATE(FakeHandler::onGestureCb, fh));
 
                return result;
        }
@@ -120,7 +135,7 @@ namespace callui { namespace utils {
 
        ElmWidgetSRef createAccessObject(ElmWidget &parent, Widget &obj)
        {
-               auto ao = elm_access_object_register(obj, parent);
+               auto ao = elm_access_object_register(as_eo(obj), as_eo(parent));
                if (!ao) {
                        LOG_RETURN_VALUE(RES_FAIL, {},
                                        "elm_access_object_register() failed!");
@@ -129,18 +144,23 @@ namespace callui { namespace utils {
                return makeShared<ElmWidget>(ao);
        }
 
-       ElmWidgetSRef createAccessObjectFromLyPart(ElmWidget &parent,
-                       Widget &ly,
-                       const EdjePart &lyPart)
+       ElmWidgetSRef createAccessObjectFromPart(ElmWidget &parent,
+                       EdjeWidget &widget, EdjePart part)
        {
-               auto po = const_cast<Evas_Object *>(
-                               edje_object_part_object_get(
-                                               elm_layout_edje_get(ly), lyPart));
-               if (!po) {
-                       LOG_RETURN_VALUE(RES_FAIL, {}, "Part object is NULL");
+               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<Evas_Object *>(
+                               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(po, parent);
+               auto ao = elm_access_object_register(edjeObj, as_eo(parent));
                if (!ao) {
                        LOG_RETURN_VALUE(RES_FAIL, {},
                                        "elm_access_object_register() failed!");
@@ -149,11 +169,6 @@ namespace callui { namespace utils {
                return makeShared<ElmWidget>(ao);
        }
 
-       void destroyAccessObject(ElmWidget &ao)
-       {
-               elm_access_object_unregister(ao);
-       }
-
        void setMirroredMode(bool isMirroredMode)
        {
                elm_config_mirrored_set(isMirroredMode);
@@ -164,6 +179,11 @@ namespace callui { namespace utils {
                return elm_config_mirrored_get();
        }
 
+       const Elm_Interface_Atspi_Accessible *getAo(ElmWidget *widget)
+       {
+               return (widget) ? as_ao(*widget) : nullptr;
+       }
+
 }}
 
 namespace callui {
index f6449f3d1c3328c71e8f21cd35909817ba69bdf1..c2398c1753cb264c5088d24ba97c2d23d07faa2c 100644 (file)
@@ -76,21 +76,15 @@ namespace callui { namespace utils {
 
        /**
         * @brief Creates Access object from layout part
-        * @param[in] parent ElmWidget which is used for creating
-        * @param[in] ly Widget which part is used to register as an accessible object
-        * @param[in] lyPart Widget part to register as an accessible object
+        * @param[in] parent Parent for access object
+        * @param[in] widget Widget which part is used to register as an accessible object
+        * @param[in] part Widget part to register as an accessible object
         * @return Shared reference to ElmWidget instance
         *  on success or NULL otherwise
         */
-       ucl::ElmWidgetSRef createAccessObjectFromLyPart(ucl::ElmWidget &parent,
-                       ucl::Widget &ly,
-                       const ucl::EdjePart &lyPart);
-
-       /**
-        * @brief Destroys Access object
-        * @param[in] ao Access object to destroy
-        */
-       void destroyAccessObject(ucl::ElmWidget &ao);
+       ucl::ElmWidgetSRef createAccessObjectFromPart(ucl::ElmWidget &parent,
+                       ucl::EdjeWidget &widget,
+                       ucl::EdjePart part);
 
        /**
         * @brief Sets mirrored mode status
@@ -104,6 +98,13 @@ namespace callui { namespace utils {
         */
        bool getMirroredMode();
 
+       /**
+        * @brief Gets Atspi object of the Widget
+        * @param[in] widget Pointer on widget
+        * @return Atspi object on success otherwise null on fail
+        */
+       const Elm_Interface_Atspi_Accessible *getAo(ucl::ElmWidget *widget);
+
 }}
 
 namespace callui {
index fd9dfe428d6a9826e6c25fa2969914557419b34d..bef5fc9be8d683c68e73314fcdfaad9257ba6fb7 100644 (file)
@@ -23,12 +23,43 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(IInstance);
 
+       /**
+        * @brief Abstract interface for the application instances
+        * @details Instance is an object inside the application executable that
+        *          represents it. UIApp may have only 1 instance per application.
+        *          Other types of applications (widget) may have more that one
+        *          instance (or none) in a single executable.
+        */
        class IInstance : protected NonCopyable {
        public:
+               /**
+                * @brief Called when instance is created.
+                * @details This function is called when instance gets created.
+                *          Implementation must allocate all global resources in this
+                *          function. For UIApp function called in app's "create" cb.
+                * @param[in] context Pointer to the context of this instance
+                * @return RES_OK on success,
+                *         otherwise other result
+                */
                virtual Result onCreate(IInstanceContext *context) = 0;
+
+               /**
+                * @brief Called when instance is paused
+                * @details For UIApp function called in app's "pause" cb.
+                */
                virtual void onPause() = 0;
+
+               /**
+                * @brief Called when instance is resumed
+                * @details For UIApp function called in app's "resume" cb.
+                */
                virtual void onResume() = 0;
+
        protected:
+               /**
+                * @brief Destructor
+                * @details Deallocate all resources here
+                */
                ~IInstance() = default;
        };
 }
index 9720dc76b29fdc17082659776de039e44f30594a..02a211b60ecdf04346bd2bb39330aa106f010cc7 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Extension interface for instances that supports processing of app
+        *        controll requests.
+        */
        class IInstanceAppControlExt : protected NonCopyable {
        public:
+               /**
+                * @brief Called to process an app control request.
+                * @details For UIApp function called in app's "app_control" cb.
+                * @param[in] appControl App control request to process
+                */
                virtual void onAppControl(app_control_h appControl) = 0;
+
        protected:
+               /**
+                * @brief Destructor
+                */
                ~IInstanceAppControlExt() = default;
        };
 }
index bab6a5bf01d48225ca6e324bf4681f62355f97e0..c67d9541a2dbb144140c1da5778eddffad09c081 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Abstract interface for the instance context.
+        * @details Instance context allows an instance to communicate with the
+        *          application
+        */
        class IInstanceContext : protected NonCopyable {
        public:
+               /**
+                * @brief Gets type of the application
+                * @return The application type
+                */
                virtual AppType getAppType() const = 0;
+
+               /**
+                * @brief Gets window of the instance
+                * @return Window object of the instance
+                */
                virtual WindowSRef getWindow() = 0;
+
+               /**
+                * @brief Singals to the application to terminate
+                */
                virtual void exitApp() = 0;
+
        protected:
+               /**
+                * @brief Destructor
+                */
                ~IInstanceContext() = default;
        };
 }
index 04482442adaa3f269dee8a0d51310fb208d80d4b..aaa894a2c5f594dfcaff5fe7b1bff967e39e6b95 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Base class for implementing instance manager
+        * @details Instance manager is class that is used by the application
+        *          class (UIApp) to create instances.
+        */
        class InstanceManagerBase : protected NonCopyable {
        public:
+               /**
+                * @brief Gets customization parameters for the application
+                * @return Reference to the parameters object
+                */
                const AppParams &getAppParams() const;
 
+               /**
+                * @brief Stores systems event provider in the manager
+                * @param[in] provider Unique pointer to system event provider object
+                */
                void setSysEventProvider(SysEventProviderUPtr provider);
 
+               /**
+                * @brief Creates new application instance object
+                * @return Shared reference to the new instance
+                */
                virtual IInstanceSRef newInstance() const = 0;
 
        protected:
+               /**
+                * @brief Constructor
+                * @param[in] appParams Customization parameters for the application
+                */
                InstanceManagerBase(AppParams appParams);
+
+               /**
+                * @brief Destructor
+                */
                ~InstanceManagerBase();
 
+               /**
+                * @brief Gets system event provider that was stored in the manager
+                * @details If system event provider was not stored before using this
+                *          function runtime assert is performed
+                * @return Reference to the stored system event provider
+                */
                SysEventProvider &getSysEventProvider() const;
 
        private:
index 2d926e9dec4491f7ed542e6c88d399656d621481..45a65b1c25c903c9a0b322f5b67009ad622e5749 100644 (file)
@@ -26,18 +26,44 @@ namespace ucl {
        class SysEventProvider;
        using SysEventProviderUPtr = std::unique_ptr<SysEventProvider>;
 
+       /**
+        * @brief Provider for system events.
+        */
        class SysEventProvider final : protected NonCopyable {
        public:
+               /**
+                * @brief Pointer to function that adds Tizen system event handler
+                */
                using EventHandlerAddFunc = int (*)(app_event_handler_h *,
                                app_event_type_e, app_event_cb, void *);
+
+               /**
+                * @brief Pointer to function that deletes Tizen system event handler
+                */
                using EventHandlerDelFunc = int (*)(app_event_handler_h);
 
        public:
+               /**
+                * @brief Constructor
+                * @param[in] addFunc Tizen API for adding system event handler
+                * @param[in] delFunc Tizen API for deleting system event handler
+                */
                SysEventProvider(EventHandlerAddFunc addFunc,
                                EventHandlerDelFunc delFunc);
+
+               /**
+                * @brief Destructor
+                */
                ~SysEventProvider();
 
+               /**
+                * @brief Registers system event handler
+                */
                void addEventHandler(SysEventHandler handler);
+
+               /**
+                * @brief Deregisters system event handler
+                */
                void delEventHandler(SysEventHandler::CDRef handler);
 
        private:
index 2e2b4359edced1a0c89486631f979d9d53f39ad9..39afee861fe29143dc1e8d1faf1309d0db25afa7 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Represent Tizen UI application.
+        * @details Root object of any application.
+        */
        class UIApp final : private IInstanceContext {
        public:
+               /**
+                * @brief Constructor
+                * @param[in] instanceMgr Reference to the instance manager
+                */
                UIApp(InstanceManagerBase &instanceMgr);
+
+               /**
+                * @brief Destructor
+                */
                ~UIApp();
 
+               /**
+                * @brief Runs the application
+                * @details Must be run in the application "main()" function
+                * @param[in] argc Count of command line arguments
+                *            (must be passed from "main()"")
+                * @param[in] argv Array of command line arguments
+                *            (must be passed from "main()"")
+                * @return 0 on success,
+                *         otherwise a negative error value
+                */
                int run(int argc, char *argv[]);
 
        private:
index fe598d9e29910fd5a13f531ee5fe99b0586fa1e1..dbb850cf2752ce98cd34b3778ac097c3fb213820 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Generates full path to the resource file.
+        * @param[in] relativePath Relative (to the "res" folder) path of the
+        *            resource file (without leading "/")
+        * @return Full path to the resource file
+        */
        std::string getResPath(const char *relativePath);
 }
 
index d8455eb82f250c3f5a618c871df96402db348a9e..8268e57cd165f6b12b6bdd03c0fb86af516f981d 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Enumeration of application types
+        */
        enum class AppType {
                UI,
                WIDGET,
                WATCH
        };
 
+       /**
+        * @brief Defines keys for the application customization parameters
+        */
        enum class AppParam {
                BASE_SCALE,
-               ACCELERATION_PREFERENECE,
+               ACCELERATION_PREFERENCE,
                WINDOW_TYPE,
-               WINDOW_NAME
+               WINDOW_NAME,
        };
 
+       /**
+        * @brief Application customization parameters
+        */
        using AppParams = HashMap<AppParam, Variant>;
 
+       /**
+        * @brief Enumeration of system events
+        */
        enum class SysEvent {
                LANGUAGE_CHANGED,
                REGION_FMT_CHANGED,
@@ -55,8 +67,14 @@ namespace ucl {
                UPDATE_REQUESTED
        };
 
+       /**
+        * @brief Delegate to handle system events
+        */
        using SysEventHandler = WeakDelegate<void(SysEvent)>;
 
+       /**
+        * @brief Automatic handle to native Tizen app control
+        */
        using AppCtrlAuto = AutoObject<app_control_h, int, app_control_destroy>;
 }
 
diff --git a/ucl/include/ucl/gui/Atspi.h b/ucl/include/ucl/gui/Atspi.h
new file mode 100644 (file)
index 0000000..4194ddc
--- /dev/null
@@ -0,0 +1,262 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __UCL_GUI_ATSPI_H__
+#define __UCL_GUI_ATSPI_H__
+
+#include "types.h"
+
+#include "ucl/misc/Event.h"
+
+namespace ucl {
+
+       UCL_DECLARE_REF_ALIASES(Atspi);
+
+       /**
+        * @brief Provides Accessibility interface
+        */
+       class Atspi final : private NonCopyable {
+       public:
+               /**
+                * @brief Gets the underlying Access object
+                * @param[in] atspi Reference to target atspi
+                * @return Pointer to the underlying Access object
+                */
+               friend Elm_Interface_Atspi_Accessible *as_ao(Atspi &atspi);
+
+               /**
+                * @brief Gets the underlying constant Access object
+                * @param[in] atspi Constant reference to target atspi
+                * @return Pointer to the underlying constant Access object
+                */
+               friend const Elm_Interface_Atspi_Accessible *as_ao(const Atspi &atspi);
+
+       public:
+               /**
+                * @brief Constructor
+                * @param[in] eo Underlying Access object of the Atspi
+                */
+               explicit Atspi(Elm_Interface_Atspi_Accessible *ao);
+
+               /**
+                * @brief Destructor
+                * @details Unregisters all Access object callbacks
+                */
+               ~Atspi();
+
+               /**
+                * @brief Sets name
+                * @param[in] name New name
+                */
+               void setName(const std::string &name);
+
+               /**
+                * @brief Gets name
+                * @return Current name
+                */
+               std::string getName() const;
+
+               /**
+                * @brief Sets name callback
+                * @param[in] cb name callback
+                */
+               void setNameCb(AtspiStringCb cb);
+
+               /**
+                * @brief Sets description
+                * @param[in] description New description
+                */
+               void setDescription(const std::string &description);
+
+               /**
+                * @brief Gets description
+                * @return Current description
+                */
+               std::string getDescription() const;
+
+               /**
+                * @brief Sets description callback
+                * @param[in] cb description callback
+                */
+               void setDescriptionCb(AtspiStringCb cb);
+
+               /**
+                * @brief Sets translation domain
+                * @param[in] domain New translation domain
+                */
+               void setTDomain(const std::string &domain);
+
+               /**
+                * @brief Gets translation domain
+                * @return Current translation domain
+                */
+               std::string getTDomain() const;
+
+               /**
+                * @brief Sets reading information type mask
+                * @param[in] info New reading information type mask
+                */
+               void setReadingInfo(Elm_Atspi_Reading_Info_Type_Mask info);
+
+               /**
+                * @brief Gets reading information type mask
+                * @return Current reading information type mask
+                */
+               Elm_Atspi_Reading_Info_Type_Mask getReadingInfo() const;
+
+               /**
+                * @brief Sets role
+                * @param[in] role New role
+                */
+               void setRole(Elm_Atspi_Role role);
+
+               /**
+                * @brief Gets role
+                * @return Current role
+                */
+               Elm_Atspi_Role getRole() const;
+
+               /**
+                * @brief Sets highlight ability status
+                * @param[in] value New highlight ability status
+                */
+               void setHighlightable(bool value);
+
+               /**
+                * @brief Gets highlight ability status
+                * @return Current highlight ability status
+                */
+               bool isHighlightable() const;
+
+               /**
+                * @brief Makes this Access object highlighted
+                */
+               void highlight();
+
+               /**
+                * @brief Makes this Access object not highlighted
+                */
+               void unhighlight();
+
+               /**
+                * @brief Adds new relationship
+                * @param[in] type Type of the new relationship
+                * @param[in] relation Pointer to relation Access object
+                */
+               void addRelationship(Elm_Atspi_Relation_Type type,
+                               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 (optional)
+                */
+               void delRelationship(Elm_Atspi_Relation_Type type,
+                               const Elm_Interface_Atspi_Accessible *relation = nullptr);
+
+               /**
+                * @brief Deletes all exiting relationships
+                */
+               void clearRelationships();
+
+               /**
+                * @brief Registers gesture event handler
+                * @param[in] handler Handler of the event
+                */
+               void addGestureHandler(AtspiGestureHandler handler);
+
+               /**
+                * @brief Deregisters gesture event handler
+                * @param[in] handler Handler of the event
+                */
+               void delGestureHandler(const AtspiGestureHandler &handler);
+
+       private:
+               Elm_Interface_Atspi_Accessible *getAo();
+               const Elm_Interface_Atspi_Accessible *getAo() const;
+
+               void registerGestureCb();
+               void registerNameCb();
+               void registerDescriptionCb();
+
+               void unregisterGestureCb();
+               void unregisterNameCb();
+               void unregisterDescriptionCb();
+               void unregisterAllCallbacks();
+
+               Eina_Bool onAtspiGesture(
+                               Elm_Atspi_Gesture_Info gestureInfo, Evas_Object *obj);
+               char *onAtspiNameCb(Evas_Object *obj);
+               char *onAtspiDescriptionCb(Evas_Object *obj);
+
+       private:
+               Elm_Interface_Atspi_Accessible *const m_ao;
+
+               Event<AtspiGestureHandler> m_onGesture;
+               AtspiStringCb m_nameCb;
+               AtspiStringCb m_descriptionCb;
+
+               bool m_isGestureCbRegistered;
+               bool m_isNameCbRegistered;
+               bool m_isDescriptionCbRegistered;
+       };
+
+       // Non-member functions //
+
+       /**
+        * @brief Gets Access object from pointed object
+        * @param[in] ptr Target object pointer
+        * @return Pointer to Access object or NULL
+        */
+       template <class T>
+       inline auto as_ao(const T &ptr) -> typename std::enable_if<
+                       std::is_convertible<T, bool>::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 <class T>
+       inline auto as_ao(const T &iter) -> typename std::enable_if<
+                       !std::is_convertible<T, bool>::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 Access object pointer
+        */
+       const Elm_Interface_Atspi_Accessible *as_ao(
+                       const Elm_Interface_Atspi_Accessible *ao);
+}
+
+#include "Atspi.hpp"
+
+#endif // __UCL_GUI_ATSPI_H__
diff --git a/ucl/include/ucl/gui/Atspi.hpp b/ucl/include/ucl/gui/Atspi.hpp
new file mode 100644 (file)
index 0000000..e1c53f6
--- /dev/null
@@ -0,0 +1,270 @@
+/*
+ * 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"
+
+namespace ucl {
+
+       inline Atspi::Atspi(Elm_Interface_Atspi_Accessible *const ao) :
+               m_ao(ao),
+               m_isGestureCbRegistered(false),
+               m_isNameCbRegistered(false),
+               m_isDescriptionCbRegistered(false)
+       {
+               UCL_ASSERT(ao, "ao is NULL");
+       }
+
+       inline Atspi::~Atspi()
+       {
+               unregisterAllCallbacks();
+       }
+
+       inline Elm_Interface_Atspi_Accessible *Atspi::getAo()
+       {
+               return m_ao;
+       }
+
+       inline const Elm_Interface_Atspi_Accessible *Atspi::getAo() const
+       {
+               return m_ao;
+       }
+
+       inline void Atspi::setName(const std::string &name)
+       {
+               elm_atspi_accessible_name_set(getAo(), name.c_str());
+       }
+
+       inline std::string Atspi::getName() const
+       {
+               return nz(elm_atspi_accessible_name_get(getAo()));
+       }
+
+       inline void Atspi::setNameCb(AtspiStringCb cb)
+       {
+               if (cb) {
+                       registerNameCb();
+               }
+               m_nameCb = std::move(cb);
+       }
+
+       inline void Atspi::setDescription(const std::string &description)
+       {
+               elm_atspi_accessible_description_set(getAo(), description.c_str());
+       }
+
+       inline std::string Atspi::getDescription() const
+       {
+               return nz(elm_atspi_accessible_description_get(getAo()));
+       }
+
+       inline void Atspi::setDescriptionCb(AtspiStringCb cb)
+       {
+               if (cb) {
+                       registerDescriptionCb();
+               }
+               m_descriptionCb = std::move(cb);
+       }
+
+       inline void Atspi::setTDomain(const std::string &domain)
+       {
+               elm_atspi_accessible_translation_domain_set(getAo(), domain.c_str());
+       }
+
+       inline std::string Atspi::getTDomain() const
+       {
+               return nz(elm_atspi_accessible_translation_domain_get(getAo()));
+       }
+
+       inline void Atspi::setReadingInfo(
+                       const Elm_Atspi_Reading_Info_Type_Mask info)
+       {
+               elm_atspi_accessible_reading_info_type_set(getAo(), info);
+       }
+
+       inline Elm_Atspi_Reading_Info_Type_Mask Atspi::getReadingInfo() const
+       {
+               return elm_atspi_accessible_reading_info_type_get(getAo());
+       }
+
+       inline void Atspi::setRole(const Elm_Atspi_Role role)
+       {
+               elm_atspi_accessible_role_set(getAo(), role);
+       }
+
+       inline Elm_Atspi_Role Atspi::getRole() const
+       {
+               return elm_atspi_accessible_role_get(getAo());
+       }
+
+       inline void Atspi::setHighlightable(const bool value)
+       {
+               elm_atspi_accessible_can_highlight_set(getAo(), toEina(value));
+       }
+
+       inline bool Atspi::isHighlightable() const
+       {
+               return elm_atspi_accessible_can_highlight_get(getAo());
+       }
+
+       inline void Atspi::highlight()
+       {
+               elm_atspi_component_highlight_grab(getAo());
+       }
+
+       inline void Atspi::unhighlight()
+       {
+               elm_atspi_component_highlight_clear(getAo());
+       }
+
+       inline void Atspi::addRelationship(const Elm_Atspi_Relation_Type type,
+                       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,
+                       const Elm_Interface_Atspi_Accessible *const relation)
+       {
+               elm_atspi_accessible_relationship_remove(getAo(), type, relation);
+       }
+
+       inline void Atspi::clearRelationships()
+       {
+               elm_atspi_accessible_relationships_clear(getAo());
+       }
+
+       inline void Atspi::addGestureHandler(AtspiGestureHandler handler)
+       {
+               if (handler) {
+                       registerGestureCb();
+                       m_onGesture += std::move(handler);
+               }
+       }
+
+       inline void Atspi::delGestureHandler(const AtspiGestureHandler &handler)
+       {
+               m_onGesture -= handler;
+       }
+
+       inline void Atspi::registerGestureCb()
+       {
+               if (!m_isGestureCbRegistered) {
+                       m_isGestureCbRegistered = true;
+                       elm_atspi_accessible_gesture_cb_set(m_ao,
+                                       UCL_CALLBACK_A(Atspi::onAtspiGesture), this);
+               }
+       }
+
+       inline void Atspi::registerNameCb()
+       {
+               if (!m_isNameCbRegistered) {
+                       m_isNameCbRegistered = true;
+                       elm_atspi_accessible_name_cb_set(m_ao,
+                                       UCL_CALLBACK_A(Atspi::onAtspiNameCb), this);
+               }
+       }
+
+       inline void Atspi::registerDescriptionCb()
+       {
+               if (!m_isDescriptionCbRegistered) {
+                       m_isDescriptionCbRegistered = true;
+                       elm_atspi_accessible_description_cb_set(m_ao,
+                                       UCL_CALLBACK_A(Atspi::onAtspiDescriptionCb), this);
+               }
+       }
+
+       inline void Atspi::unregisterGestureCb()
+       {
+               if (m_isGestureCbRegistered) {
+                       m_isGestureCbRegistered = false;
+                       elm_atspi_accessible_gesture_cb_set(m_ao, nullptr, nullptr);
+               }
+       }
+
+       inline void Atspi::unregisterNameCb()
+       {
+               if (m_isNameCbRegistered) {
+                       m_isNameCbRegistered = false;
+                       elm_atspi_accessible_name_cb_set(m_ao, nullptr, nullptr);
+               }
+       }
+
+       inline void Atspi::unregisterDescriptionCb()
+       {
+               if (m_isDescriptionCbRegistered) {
+                       m_isDescriptionCbRegistered = false;
+                       elm_atspi_accessible_description_cb_set(m_ao, nullptr, nullptr);
+               }
+       }
+
+       inline void Atspi::unregisterAllCallbacks()
+       {
+               unregisterGestureCb();
+               unregisterNameCb();
+               unregisterDescriptionCb();
+       }
+
+       inline Eina_Bool Atspi::onAtspiGesture(
+                       Elm_Atspi_Gesture_Info gestureInfo, Evas_Object *obj)
+       {
+               AtspiGestureEventInfo eventInfo{gestureInfo};
+               m_onGesture.dispatchPred(
+                               [&eventInfo]() { return !eventInfo.stopPropagation; },
+                               *this, eventInfo);
+               return toEina(eventInfo.preventDefault);
+       }
+
+       inline char *Atspi::onAtspiNameCb(Evas_Object *obj)
+       {
+               if (const auto cb = m_nameCb.lock()) {
+                       return cb(*this).release();
+               }
+               return nullptr;
+       }
+
+       inline char *Atspi::onAtspiDescriptionCb(Evas_Object *obj)
+       {
+               if (const auto cb = m_descriptionCb.lock()) {
+                       return cb(*this).release();
+               }
+               return nullptr;
+       }
+
+       // Non-member functions //
+
+       inline Elm_Interface_Atspi_Accessible *as_ao(Atspi &atspi)
+       {
+               return atspi.m_ao;
+       }
+
+       inline const Elm_Interface_Atspi_Accessible *as_ao(const Atspi &atspi)
+       {
+               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;
+       }
+}
index 8d045c4ba7183d24f42732fc260d22e81945092f..da3250190b84e6cdd64382c313bdbd24c4edecf1 100644 (file)
@@ -23,26 +23,91 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(EdjeWidget);
 
+       /**
+        * @brief Base class for all widgets that has Edje theme
+        */
        class EdjeWidget : public ElmWidget {
        public:
+               /**
+                * @brief Sets text to default part
+                * @param[in] value Translatable text value to set
+                */
                void setText(const TString &value);
+
+               /**
+                * @brief Sets text to specific part
+                * @param[in] value Translatable text value to set
+                * @param[in] part Destination Edje part
+                */
                void setText(const TString &value, EdjePart part);
 
-               TString getText() const;
-               TString getText(EdjePart part) const;
+               /**
+                * @brief Gets text from default part
+                * @return Translated text from default part
+                */
+               std::string getText() const;
+
+               /**
+                * @brief Gets text from specific part
+                * @param[in] part Source Edje part
+                * @return Translated text from specific part
+                */
+               std::string getText(EdjePart part) const;
+
+               /**
+                * @brief Sets content to default part
+                * @param[in] content Content widget
+                */
+               void setContent(Widget &content);
 
-               void setContent(Evas_Object *content);
-               void setContent(Evas_Object *content, EdjePart part);
+               /**
+                * @brief Sets content to specific part
+                * @param[in] content Content widget
+                * @param[in] part Destination Edje part
+                */
+               void setContent(Widget &content, EdjePart part);
+
+               /**
+                * @brief Unsets content from default part
+                * @return Content Evas object or NULL
+                */
                Evas_Object *unsetContent();
+
+               /**
+                * @brief Unsets content from specific part
+                * @param[in] part Source Edje part
+                * @return content Evas object or NULL
+                */
                Evas_Object *unsetContent(EdjePart part);
 
+               /**
+                * @brief Gets content from default part
+                * @return Content Evas object or NULL
+                */
                Evas_Object *getContent() const;
+
+               /**
+                * @brief Gets content from specific part
+                * @param[in] part Source Edje part
+                * @return content Evas object or NULL
+                */
                Evas_Object *getContent(EdjePart part) const;
 
+               /**
+                * @brief Emits signal to the widget's Edje theme
+                * @param[in] signal Emitted signal
+                * @param[in] signal Emitted signal source (optional)
+                */
                void emit(EdjeSignal signal, EdjeSignalSrc source =
                                EdjeSignalSrc(""));
 
        protected:
+               /**
+                * @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)
+                */
                EdjeWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = true);
        };
 }
index 3f989c75972175ff49f92afc6e566d3fa4381310..763808eff363859956f50201f09e1068d7aaccfb 100644 (file)
@@ -22,25 +22,25 @@ namespace ucl {
        {
        }
 
-       inline TString EdjeWidget::getText() const
+       inline std::string EdjeWidget::getText() const
        {
                return elm_object_text_get(getEo());
        }
 
-       inline TString EdjeWidget::getText(const EdjePart part) const
+       inline std::string EdjeWidget::getText(const EdjePart part) const
        {
                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()
index 795cf2b9472b91d7576037608609ea0cf88c5b0a..a0e2d60fa9849a8863a538a4c5ab2080c96bb9a5 100644 (file)
 #define __UCL_GUI_ELM_WIDGET_H__
 
 #include "Widget.h"
-
-#define UCL_SMART_FWD_ATSPI UCL_SMART_FWD "atspi,"
+#include "Atspi.h"
 
 namespace ucl {
 
-       constexpr SmartEvent ATSPI_ON_GESTURE {UCL_SMART_FWD_ATSPI "gesture"};
-
        class Window;
 
        UCL_DECLARE_REF_ALIASES(ElmWidget);
 
+       /**
+        * @brief Represents Elementary widget and serves as base class for more
+        *        concrete widget types
+        */
        class ElmWidget : public Widget {
        public:
-               explicit ElmWidget(Evas_Object *eo, bool isOwner = true);
-               ElmWidget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = true);
-               virtual ~ElmWidget();
-
+               using Widget::Widget;
+
+               /**
+                * @brief Gets Atspi of this widget
+                * @return Reference to the Atspi object
+                */
+               Atspi &getAtspi();
+
+               /**
+                * @brief Gets Atspi of this widget (constant version)
+                * @return Reference to the constant Atspi object
+                */
+               Atspi &getAtspi() const;
+
+               /**
+                * @brief Sets enabled state of the widget
+                * @param[in] value New state
+                */
                void setEnabled(bool value);
-               bool isEnabled() const;
 
-               void setFocusAlowed(bool value);
-               bool isFocusAlowed() const;
+               /**
+                * @brief Gets enabled state of the widget
+                * @return true if enabled, false if disabled
+                */
+               bool isEnabled() const;
 
+               /**
+                * @brief Sets if key-input focus is allowed for the widget
+                * @param[in] value New state
+                */
+               void setFocusAllowed(bool value);
+
+               /**
+                * @brief Gets if key-input focus is allowed for the widget
+                * @return true if allowed, false if not allowed
+                */
+               bool isFocusAllowed() const;
+
+               /**
+                * @brief Sets theme object to the widget
+                * @details This function does not affect look of this widget directly,
+                *          instead it makes all styles from Theme visible to this
+                *          widget and all it's children.
+                * @param[in] th Theme object to set
+                */
                void setTheme(Elm_Theme *th);
+
+               /**
+                * @brief Gets theme object that assigned to the widget
+                * @return Assigned Theme object
+                */
                Elm_Theme *getTheme();
 
+               /**
+                * @brief Gets top level parent of the widget
+                * @return Top level Evas object
+                */
                Evas_Object *getTopWidget() const;
+
+               /**
+                * @brief Tries to get top level parent of the widget as Window widget
+                * @return Window widget or NULL
+                */
                Window *getWindow() const;
 
        protected:
+               // Widget //
+
                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;
+               AtspiSRef m_atspi;
 
                friend class ReffedObj<ElmWidget>;
        };
 
        // 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);
+        * @param[in] widget Reference to target widget
+        */
        void enable(ElmWidget &widget);
+
+       /**
+        * @brief Sets widget to disabled state
+        * @details This is equivalent to: widget.setEnabled(false);
+        * @param[in] widget Reference to target widget
+        */
        void disable(ElmWidget &widget);
 }
 
index 0673a57276897104ddba6f84d4efda17f0bfa18d..6fe586d9dfb2809f8163da29252dd4e3044f9b70 100644 (file)
 
 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)
@@ -31,12 +46,12 @@ namespace ucl {
                return !elm_object_disabled_get(getEo());
        }
 
-       inline void ElmWidget::setFocusAlowed(const bool value)
+       inline void ElmWidget::setFocusAllowed(const bool value)
        {
                elm_object_focus_allow_set(getEo(), toEina(value));
        }
 
-       inline bool ElmWidget::isFocusAlowed() const
+       inline bool ElmWidget::isFocusAllowed() const
        {
                return elm_object_focus_allow_get(getEo());
        }
@@ -58,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);
index 7c80ab455004c8bf333a64b8de753f184296d13a..3791d8f3e8b1108b22dc61828e8dd4885f8f8bf9 100644 (file)
@@ -24,8 +24,14 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(Genlist);
 
+       /**
+        * @brief Represents Elementary Genlist widget
+        */
        class Genlist final : public StyledWidget {
        public:
+               /**
+                * @brief Enumeration of Genlist modes
+                */
                enum class Mode {
                        COMPRESS = ELM_LIST_COMPRESS,
                        SCROLL = ELM_LIST_SCROLL,
@@ -33,15 +39,58 @@ namespace ucl {
                        EXPAND = ELM_LIST_EXPAND
                };
 
+               /**
+                * @brief Builder of Genlist objects
+                */
                class Builder final {
                public:
+                       /**
+                        * @brief Constructor
+                        */
                        Builder();
+
+                       /**
+                        * @brief Sets style of the future object
+                        * @param[in] style Style of the future object
+                        * @return Reference to this builder
+                        */
                        Builder &setStyle(ElmStyle style);
+
+                       /**
+                        * @brief Sets mode of the future object
+                        * @param[in] mode Mode of the future object
+                        * @return Reference to this builder
+                        */
                        Builder &setMode(Mode mode);
+
+                       /**
+                        * @brief Sets if future object will be homogeneous or not
+                        * @param[in] value true if homogeneous, false - otherwise
+                        * @return Reference to this builder
+                        */
                        Builder &setHomogeneous(bool value);
+
+                       /**
+                        * @brief Sets Evas object ownership flag of the future object
+                        * @param[in] value true if owner, false - otherwise
+                        * @return Reference to this builder
+                        */
                        Builder &setIsOwner(bool value);
+
+                       /**
+                        * @brief Sets if future object needs to be bind to it's Evas object
+                        * @param[in] value true if need to bind, false - otherwise
+                        * @return Reference to this builder
+                        */
                        Builder &setNeedBindToEo(bool value);
+
+                       /**
+                        * @brief Creates new Genlist object using current parameters
+                        * @param[in] parent Reference to parent widget
+                        * @return Shared reference to new Genlist object or NULL
+                        */
                        GenlistSRef build(ElmWidget &parent) const;
+
                private:
                        ElmStyle m_style;
                        Mode m_mode;
@@ -53,31 +102,102 @@ namespace ucl {
        public:
                using StyledWidget::StyledWidget;
 
+               /**
+                * @brief Sets mode of the genlist
+                * @param[in] mode New mode of the genlist
+                */
                void setMode(Mode mode);
+
+               /**
+                * @brief Gets mode of the genlist
+                * @return Current mode of the genlist
+                */
                Mode getMode() const;
 
+               /**
+                * @brief Sets homogeneous flag of the genlist
+                * @param[in] mode New flag value
+                */
                void setHomogeneous(bool isHomogeneous);
+
+               /**
+                * @brief Gets homogeneous flag of the genlist
+                * @return Current flag value
+                */
                bool isHomogeneous() const;
 
+               /**
+                * @brief Updates all items that are realized
+                */
                void updateRealizedItems();
+
+               /**
+                * @brief Removes all items from the genlist
+                */
                void clear();
 
+               /**
+                * @brief Appends new item to the genlist
+                * @param[in] itc Item class of the future item
+                * @param[in] data Pointer to user data of the item
+                * @param[in] onSelect Convenience callback when item
+                *            is selected (optional)
+                * @param[in] type Type of the future item
+                *            (optional: GenlistItem::Type::SIMPLE)
+                * @param[in] parent Parent item for the future item (optional)
+                * @return New item
+                */
                GenlistItem append(const Elm_Genlist_Item_Class *itc,
                                const void *data, SmartCbHandler onSelect = nullptr,
                                GenlistItem::Type type = GenlistItem::Type::SIMPLE,
                                GenlistItem parent = nullptr);
 
+               /**
+                * @brief Prepends new item to the genlist
+                * @param[in] itc Item class of the future item
+                * @param[in] data Pointer to user data of the item
+                * @param[in] onSelect Convenience callback when item
+                *            is selected (optional)
+                * @param[in] type Type of the future item
+                *            (optional: GenlistItem::Type::SIMPLE)
+                * @param[in] parent Parent item for the future item (optional)
+                * @return New item
+                */
                GenlistItem prepend(const Elm_Genlist_Item_Class *itc,
                                const void *data, SmartCbHandler onSelect = nullptr,
                                GenlistItem::Type type = GenlistItem::Type::SIMPLE,
                                GenlistItem parent = nullptr);
 
+               /**
+                * @brief Inserts new item to the genlist after specific item
+                * @param[in] after Item after which future item will be inserted
+                * @param[in] itc Item class of the future item
+                * @param[in] data Pointer to user data of the item
+                * @param[in] onSelect Convenience callback when item
+                *            is selected (optional)
+                * @param[in] type Type of the future item
+                *            (optional: GenlistItem::Type::SIMPLE)
+                * @param[in] parent Parent item for the future item (optional)
+                * @return New item
+                */
                GenlistItem insertAfter(GenlistItem after,
                                const Elm_Genlist_Item_Class *itc, const void *data,
                                SmartCbHandler onSelect = nullptr,
                                GenlistItem::Type type = GenlistItem::Type::SIMPLE,
                                GenlistItem parent = nullptr);
 
+               /**
+                * @brief Inserts new item to the genlist before specific item
+                * @param[in] before Item before which future item will be inserted
+                * @param[in] itc Item class of the future item
+                * @param[in] data Pointer to user data of the item
+                * @param[in] onSelect Convenience callback when item
+                *            is selected (optional)
+                * @param[in] type Type of the future item
+                *            (optional: GenlistItem::Type::SIMPLE)
+                * @param[in] parent Parent item for the future item (optional)
+                * @return New item
+                */
                GenlistItem insertBefore(GenlistItem before,
                                const Elm_Genlist_Item_Class *itc, const void *data,
                                SmartCbHandler onSelect = nullptr,
index 2c96b9caa6791dfd119065e31ba108e9d9bf9191..3de1517c69ee49ccec5cd4a87e5a015ce0c73b15 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Represents Elementary Genlist widget item
+        * @details This class has semantic of a pointer and therefore does not
+        *          manage lifetime of the item. Pointer is always point to the non
+        *          constant Genlist item. Most of the methods marked as const
+        *          because pointer is not changed in these method calls.
+        */
        class GenlistItem final : public WidgetItem {
        public:
+               /**
+                * @brief Enumeration of Genlist item types
+                */
                enum class Type {
                        SIMPLE = ELM_GENLIST_ITEM_NONE,
                        TREE = ELM_GENLIST_ITEM_TREE,
                        GROUP = ELM_GENLIST_ITEM_GROUP
                };
 
+               /**
+                * @brief Enumeration of select modes for Genlist item
+                */
                enum class SelectMode {
                        DEFAULT = ELM_OBJECT_SELECT_MODE_DEFAULT,
                        ALWAYS = ELM_OBJECT_SELECT_MODE_ALWAYS,
@@ -36,6 +49,9 @@ namespace ucl {
                        DISPLAY_ONLY = ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY
                };
 
+               /**
+                * @brief Enumeration of update field flags
+                */
                enum {
                        FIELD_ALL = ELM_GENLIST_ITEM_FIELD_ALL,
                        FIELD_TEXT = ELM_GENLIST_ITEM_FIELD_TEXT,
@@ -46,14 +62,48 @@ namespace ucl {
        public:
                using WidgetItem::WidgetItem;
 
+               /**
+                * @brief Sets select mode of the genlist item
+                * @param[in] mode New select mode of the genlist item
+                */
                void setSelectMode(SelectMode mode) const;
+
+               /**
+                * @brief Gets select mode of the genlist item
+                * @return Current mode of the genlist item
+                */
                SelectMode getSelectMode() const;
 
+               /**
+                * @brief Sets selected state of the genlist item
+                * @param[in] isSelected New select state of the genlist item
+                */
                void setSelected(bool isSelected) const;
+
+               /**
+                * @brief Gets selected state of the genlist item
+                * @return Current selected state of the genlist item
+                */
                bool isSelected() const;
 
+               /**
+                * @brief Performs full update of the genlist item
+                */
                void update() const;
+
+               /**
+                * @brief Changes item class of the genlist item and
+                *        performs full update
+                */
                void update(const Elm_Genlist_Item_Class *newItc) const;
+
+               /**
+                * @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
+                *            (optional: FIELD_ALL)
+                */
                void update(const char *parts, int fields = FIELD_ALL) const;
        };
 }
index dbfc163bc4cec3ccfc46f2d95a0f18607acb6156..2a25de08aab2ea8aabd5c20b39f2ffd19add6345 100644 (file)
@@ -23,16 +23,61 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(Layout);
 
+       /**
+        * @brief Represents Elementary Layout widget
+        */
        class Layout : public EdjeWidget {
        public:
+               /**
+                * @brief Builder of Layout objects
+                */
                class Builder final {
                public:
+                       /**
+                        * @brief Constructor
+                        */
                        Builder();
+
+                       /**
+                        * @brief Sets layout theme of the future object
+                        * @details EdjeFile property takes precedence over this property
+                        *          if both are set.
+                        * @param[in] value Layout of the future object
+                        * @return Reference to this builder
+                        */
                        Builder &setTheme(const LayoutTheme &value);
+
+                       /**
+                        * @brief Sets edje file and group of the future object
+                        * @details This property takes precedence over Theme property
+                        *          if both are set.
+                        * @param[in] filePath Path to the Edje file
+                        * @param[in] group Edje group to apply to the future object
+                        * @return Reference to this builder
+                        */
                        Builder &setEdjeFile(std::string filePath, EdjeGroup group);
+
+                       /**
+                        * @brief Sets Evas object ownership flag of the future object
+                        * @param[in] value true if owner, false - otherwise
+                        * @return Reference to this builder
+                        */
                        Builder &setIsOwner(bool value);
+
+                       /**
+                        * @brief Sets if future object needs to be bind to it's Evas object
+                        * @param[in] value true if need to bind, false - otherwise
+                        * @return Reference to this builder
+                        */
                        Builder &setNeedBindToEo(bool value);
+
+                       /**
+                        * @brief Creates new Layout object using current parameters
+                        * @param[in] parent Reference to parent widget
+                        * @return Shared reference to new Layout object or NULL
+                        */
                        LayoutSRef build(ElmWidget &parent) const;
+
                private:
                        LayoutTheme m_theme;
                        std::string m_edjeFilePath;
@@ -42,14 +87,41 @@ namespace ucl {
                };
 
        public:
-               using EdjeWidget::EdjeWidget;
+               using ElmWidget::setTheme;
+
+               /**
+                * @brief Constructor
+                * @param[in] eo Underlying Elementary Layout Evas object
+                * @param[in] isOwner Evas object ownership flag (optional: true)
+                */
                explicit Layout(Evas_Object *eo, bool isOwner = true);
 
+               /**
+                * @brief Applies LayoutTheme to the layout
+                * @param[in] theme LayoutTheme to apply
+                * @return true on success, false on failure
+                */
                bool setTheme(const LayoutTheme &theme);
+
+               /**
+                * @brief Applies edje file and group to the layout
+                * @param[in] filePath Path to the Edje file
+                * @param[in] group Edje group to apply to the layout
+                * @return true on success, false on failure
+                */
                bool setEdjeFile(const std::string &filePath, EdjeGroup group);
 
+               /**
+                * @brief Gets data from Edje theme applied to the layout
+                * @param[in] key Edje data key of the data
+                * @return TYPE_STRING Variant value of the Edje data,
+                *         or TYPE_NIL if not found
+                */
                Variant getData(EdjeDataKey key);
 
+       protected:
+               using EdjeWidget::EdjeWidget;
+
        private:
                friend class ReffedObj<Layout>;
        };
index a11c7cae7f4e9cbac1b9f16b4f811404e65a3fa6..495d3d811601bdc48b26ac675b9e3a8851602131 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Represents Elementary Naviframe widget item
+        * @details This class has semantic of a pointer and therefore does not
+        *          manage lifetime of the item. Pointer is always point to the non
+        *          constant Naviframe item. Most of the methods marked as const
+        *          because pointer is not changed in these method calls.
+        */
        class NaviItem final : public WidgetItem {
        public:
+               /**
+                * @brief Delegate for handling naviframe item pop event
+                */
                using PopHandler = Delegate<Eina_Bool(Elm_Object_Item *)>;
 
        public:
                using WidgetItem::WidgetItem;
 
+               /**
+                * @brief Registers item pop handler
+                * @param[in] handler Handler delegate
+                */
                void setPopHandler(PopHandler handler) const;
 
+               /**
+                * @brief Pops all items of the naviframe state to this item
+                */
                void popTo() const;
+
+               /**
+                * @brief Moves this naviframe item to the top of the naviframe stack
+                */
                void promote() const;
 
+               /**
+                * @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.
+                */
                void setTitleEnabled(bool value, bool useTransition = false) const;
+
+               /**
+                * @brief Gets naviframe item tile visibility state
+                * @retrun Visibility state. true - visible, false - invisible
+                */
                bool isTitleEnabled() const;
 
+               /**
+                * @brief Sets naviframe item tile text
+                * @param[in] title Translatable text to use as a title
+                */
                void setTitle(const TString &title) const;
        };
 }
index b4cba2bb79787a6cbd81975469c2d26915350f57..8b4730d350c85a78ba482a02d594ea794a87f39b 100644 (file)
@@ -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);
        }
 }
index 7333e11594bc476ecb97146694b3384c00b69cec..cc7a94f1733db2f9cc20cbc0d8fc054e451b1627 100644 (file)
@@ -29,64 +29,267 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(Naviframe);
 
+       /**
+        * @brief Represents Elementary Naviframe widget
+        */
        class Naviframe final : public StyledWidget {
        public:
+               /**
+                * @brief Builder of Naviframe objects
+                */
                class Builder final {
                public:
+                       /**
+                        * @brief Constructor
+                        */
                        Builder();
+
+                       /**
+                        * @brief Sets style of the future object
+                        * @param[in] style Style of the future object
+                        * @return Reference to this builder
+                        */
                        Builder &setStyle(ElmStyle value);
+
+                       /**
+                        * @brief Sets if future object needs to be bind to it's Evas object
+                        * @param[in] value true if need to bind, false - otherwise
+                        * @return Reference to this builder
+                        */
                        Builder &setNeedBindToEo(bool value);
+
+                       /**
+                        * @brief Creates new Naviframe object using current parameters
+                        * @param[in] parent Reference to parent widget
+                        * @return Shared reference to new Naviframe object or NULL
+                        */
                        NaviframeSRef build(ElmWidget &parent) const;
+
                private:
                        ElmStyle m_style;
                        bool m_needBindToEo;
                };
 
        public:
+               /**
+                * @brief Sets transition state of naviframe
+                * @details Warning! It is workaround function for internal use only.
+                *          TODO Need to remove when page manager will be implemented.
+                * @param[in] inTransition true if in transition, false - otherwise
+                */
                void setInTransition(bool inTransition);
+
+               /**
+                * @brief Gets current transition state of naviframe
+                * @details Warning! It is workaround function for internal use only.
+                *          TODO Need to remove when page manager will be implemented.
+                * @return true if in transition, false - otherwise
+                */
                bool isInTransition() const;
 
+               /**
+                * @brief Sets if back button should be automatically created in
+                *        items on push
+                * @param[in] value true if need create, false - otherwise
+                */
                void setAutoBackBtn(bool value);
+
+               /**
+                * @brief Gets if back button will be automatically created in
+                *        items on push
+                * @return true if will be created, false - otherwise
+                */
                bool isAutoBackBtn() const;
 
+               /**
+                * @brief Sets if item content should be preserved on pop
+                * @param[in] value true if need preserve, false - otherwise
+                */
                void setPreservePop(bool value);
+
+               /**
+                * @brief Gets if item content will be preserved on pop
+                * @return true if will be preserve, false - otherwise
+                */
                bool isPreservePop() const;
 
+               /**
+                * @brief Sets if events should be processed by naviframe
+                *        on item transition
+                * @param[in] value true if need to process events, false - otherwise
+                */
                void setEventsEnabledOnTransition(bool value);
+
+               /**
+                * @brief Gets if events will be processed by naviframe
+                *        on item transition
+                * @return true if will be process events, false - otherwise
+                */
                bool isEventsEnabledOnTransition() const;
 
+               /**
+                * @brief Pops and then deletes topmost item from stack with transition
+                * @return Preserved content of the popped item or NULL
+                */
                Evas_Object *pop();
 
-               NaviItem push(const TString &title,
-                               Evas_Object *backBtn, Evas_Object *moreBtn,
-                               Evas_Object *content, ElmStyle style = nullptr);
-               NaviItem push(const TString &title,
-                               Evas_Object *content, ElmStyle style = nullptr);
-               NaviItem push(Evas_Object *content, 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
+                * @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, 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
+                * @param[in] style Elm style of the item (optional)
+                * @return New item
+                */
+               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] style Elm style of the item (optional)
+                * @return New item
+                */
+               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] 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
+                * @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
+                * @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] 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
+                * @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
+                * @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
+                * @return Top item
+                */
                NaviItem getTopItem()const;
+
+               /**
+                * @brief Gets bottom item of the naviframe stack
+                * @return Bottom item
+                */
                NaviItem getBottomItem() const;
+
+               /**
+                * @brief Gets all items of the naviframe stack
+                * @return Items vector
+                */
                std::vector<NaviItem> getItems() const;
 
        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:
index e8fdc19087cd296c9921dbe1aa106f33f0b863df..c5dc4bf74bad6cbeb311d80a7a08de01905f9d1b 100644 (file)
  * 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 //
@@ -83,77 +96,119 @@ 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));
-               result.setTitle(title);
+                               nullptr, as_eo(backBtn), as_eo(moreBtn),
+                               as_eo(content), style.name));
+               himpl::initItemTitle(result, title);
                if (result != getBottomItem()) {
                        setInTransition(true);
                }
                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, &content, backBtn, moreBtn, style);
+       }
+
+       inline NaviItem Naviframe::push(const TString &title, Widget &content,
+                       const ElmStyle style)
+       {
+               return push(title, &content, nullptr, nullptr, style);
+       }
+
+       inline NaviItem Naviframe::push(Widget &content, const ElmStyle style)
        {
-               return push(title, nullptr, nullptr, content, style);
+               return push(nullptr, &content, nullptr, nullptr, style);
        }
 
-       inline NaviItem Naviframe::push(
-                       Evas_Object *const content, const ElmStyle style)
+       inline NaviItem Naviframe::push(const ElmStyle style)
        {
-               return push(nullptr, nullptr, nullptr, content, style);
+               return push(nullptr, nullptr, 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::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));
-               result.setTitle(title);
+                               after, nullptr, as_eo(backBtn), as_eo(moreBtn),
+                               as_eo(content), style.name));
+               himpl::initItemTitle(result, 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, nullptr, nullptr, content, style);
+               return insertAfter(after, title, &content, backBtn, moreBtn, style);
        }
 
-       inline NaviItem Naviframe::insertAfter(NaviItem after,
-                       Evas_Object *const content, const ElmStyle style)
+       inline NaviItem Naviframe::insertAfter(const NaviItem after,
+                       const TString &title, Widget &content,
+                       const ElmStyle style)
        {
-               return insertAfter(after, nullptr, nullptr, nullptr, content, style);
+               return insertAfter(after, title, &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,
+                       Widget &content, const ElmStyle style)
+       {
+               return insertAfter(after, nullptr, &content, nullptr, nullptr, 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));
-               result.setTitle(title);
+                               before, nullptr, as_eo(backBtn), as_eo(moreBtn),
+                               as_eo(content), style.name));
+               himpl::initItemTitle(result, 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
index 7737852c8a1d03a744ce90f076213c45828881a7..715b0bdbf2ce2307b38f4bad3b1d7b6f45ca0af4 100644 (file)
@@ -23,15 +23,49 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(RadioBox);
 
+       /**
+        * @brief Represents Elementary Radio widget
+        */
        class RadioBox final : public StyledWidget {
        public:
+               /**
+                * @brief Builder of RadioBox objects
+                */
                class Builder final {
                public:
+                       /**
+                        * @brief Constructor
+                        */
                        Builder();
+
+                       /**
+                        * @brief Sets style of the future object
+                        * @param[in] style Style of the future object
+                        * @return Reference to this builder
+                        */
                        Builder &setStyle(ElmStyle style);
+
+                       /**
+                        * @brief Sets Evas object ownership flag of the future object
+                        * @param[in] value true if owner, false - otherwise
+                        * @return Reference to this builder
+                        */
                        Builder &setIsOwner(bool value);
+
+                       /**
+                        * @brief Sets if future object needs to be bind to it's Evas object
+                        * @param[in] value true if need to bind, false - otherwise
+                        * @return Reference to this builder
+                        */
                        Builder &setNeedBindToEo(bool value);
+
+                       /**
+                        * @brief Creates new RadioBox object using current parameters
+                        * @param[in] parent Reference to parent widget
+                        * @return Shared reference to new RadioBox object or NULL
+                        */
                        RadioBoxSRef build(ElmWidget &parent) const;
+
                private:
                        ElmStyle m_style;
                        bool m_isOwner;
@@ -41,16 +75,55 @@ namespace ucl {
        public:
                using StyledWidget::StyledWidget;
 
+               /**
+                * @brief Assigns a value that this radio box represents
+                * @param[in] value Integer value for this radio box
+                */
                void setItemValue(int value);
+
+               /**
+                * @brief Gets a value that this radio box represents
+                * @return Integer value for this radio box
+                */
                int getItemValue() const;
 
-               void addToGroup(Elm_Radio *group);
+               /**
+                * @brief Adds this radio box to the group of other radio boxes
+                * @param[in] group Radio box to which group this radio box
+                *            should be added
+                */
+               void addToGroup(RadioBox &group);
 
+               /**
+                * @brief Sets a value of the group in which this radio box is member
+                * @details All radio boxes in the same group will be selected if
+                *          their index matches group index.
+                * @param[in] value Integer value for the group of this radio box
+                */
                void setGroupValue(int value);
+
+               /**
+                * @brief Gets a value of the group in which this radio box is member
+                * @return Integer value for the group of this radio box
+                */
                int getGroupValue() const;
 
+               /**
+                * @brief Sets pointer to track group value of this radio box
+                * @details If pointer is not NULL group value will be changed to the
+                *          value pointed by this pointer. From this time value pointed
+                *          by this pointer will automatically change each time when
+                *          group value changes. Do not change pointed value manually.
+                * @param[in] valuePtr Pointer to integer for tracking the group value.
+                *            Use NULL to remove previous pointer.
+                */
                void setGroupValuePointer(int *valuePtr);
 
+               /**
+                * @brief Gets currently selected radio box Evas object
+                * @return Pointer to selected radio box Evas object,
+                *         or NULL if no selection
+                */
                Elm_Radio *getSelectedObject() const;
 
        private:
index 894327888719c32ed97da3f24876daf891373618..3efe0e022002d337b7af6e53c69f7f8dff756024 100644 (file)
@@ -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)
index 5401d2a8eefd58c54ce40bb88e9d4c12532330ee..c852c7c2d95f42f9d4d2bc6e8f8785fb091e26b1 100644 (file)
@@ -23,11 +23,25 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(StyledWidget);
 
+       /**
+        * @brief Represents Elementary widget which can apply ElmStyle
+        *        and serves as base class for more concrete widget types
+        */
        class StyledWidget : public EdjeWidget {
        public:
                using EdjeWidget::EdjeWidget;
+
+               /**
+                * @brief Constructor
+                * @param[in] eo Underlying Evas object of the widget
+                * @param[in] isOwner Evas object ownership flag (optional: true)
+                */
                explicit StyledWidget(Evas_Object *eo, bool isOwner = true);
 
+               /**
+                * @brief Applies style to the widget
+                * @param[in] style Style to apply
+                */
                void setStyle(ElmStyle style);
 
        private:
index d8b5b315d217029a84f0f9dd93d562a55ab394f9..d8191864ba4b36351f296874f2600145d6d62c1d 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Represents Elementary theme object that can be assigned to
+        *        any Elementary widget.
+        * @see ElmWidget::setTheme
+        */
        class Theme final : NonCopyable {
        public:
+               /**
+                * @brief Creates new Theme object that refers default theme
+                * @return New Theme object (may not valid)
+                */
                static Theme create();
 
+               /**
+                * @brief Swaps Theme objects with each other
+                * @param[in/out] x First theme object
+                * @param[in/out] y Second theme object
+                */
                friend void swap(Theme &x, Theme &y);
 
        public:
+               /**
+                * @brief Default constructor
+                * @details Constructs empty non valid theme
+                */
                Theme();
+
+               /**
+                * @brief Constructor
+                * @details Same as default constructor
+                */
                Theme(std::nullptr_t);
+
+               /**
+                * @brief Constructor
+                * @details Wraps native Elementary theme object. Native Elementary
+                *          theme objet will be deleted if Theme object is owner.
+                * @param[in] th Native Elementary theme object
+                * @param[in] isOwner Elementary theme object ownership
+                *            flag (optional: false)
+                */
                explicit Theme(Elm_Theme *th, bool isOwner = false);
+
+               /**
+                * @brief Move constructor
+                * @param[in] tmp Source temporary Theme object
+                */
                Theme(Theme &&tmp);
-               Theme &operator=(Theme &&tmp);
+
+               /**
+                * @brief Destructor
+                * @details Deletes native Elementary theme object if owner.
+                */
                ~Theme();
 
+               /**
+                * @brief Assigns one Them object to another
+                * @details Only move assignment is possible. Original will be deleted.
+                * @param[in] tmp Source Theme object
+                * @return Reference to this Theme object
+                */
+               Theme &operator=(Theme tmp);
+
+               /**
+                * @brief Gets native Elementary theme object
+                * @return Pointer to native Elementary theme object
+                */
                Elm_Theme *getTh();
+
+               /**
+                * @brief Gets native Elementary theme object (constant version)
+                * @return Pointer to native constant Elementary theme object
+                */
                const Elm_Theme *getTh() const;
 
+               /**
+                * @brief Implicitly casts to native Elementary theme object
+                * @return Pointer to native Elementary theme object
+                */
                operator Elm_Theme *();
+
+               /**
+                * @brief Implicitly casts to native Elementary
+                *        theme object (constant version)
+                * @return Pointer to native constant Elementary theme object
+                */
                operator const Elm_Theme *() const;
 
+               /**
+                * @brief Adds specified Edje file as extension to this Theme object
+                * @details All Edje groups from the extension will be examined after
+                *          all groups currently existing in this theme.
+                * @param[in] edjePath File path to Edje file with extension
+                */
                void addExtension(const std::string edjePath);
+
+               /**
+                * @brief Adds specified Edje file as overlay to this Theme object
+                * @details All Edje groups from the overlay will be examined before
+                *          all groups currently existing in this theme.
+                * @param[in] edjePath File path to Edje file with overlay
+                */
                void addOverlay(const std::string edjePath);
 
        private:
@@ -51,7 +132,13 @@ namespace ucl {
 
        // Non-member functions //
 
-       bool isValid(const Theme &item);
+       /**
+        * @brief Checks whether Theme object is valid
+        * @details This is equivalent to: item.getTh() != NULL;
+        * @param[in] theme Reference to target Theme object
+        * @return true if valid, false if not valid
+        */
+       bool isValid(const Theme &theme);
 }
 
 #include "Theme.hpp"
index 65910df3f8912092573f796dd39e35888f176177..b357dd7fc007e9b4803910ebaf99b9a7ec2876d6 100644 (file)
@@ -48,12 +48,6 @@ namespace ucl {
                tmp.m_th = nullptr;
        }
 
-       inline Theme &Theme::operator=(Theme &&tmp)
-       {
-               swap(*this, tmp);
-               return *this;
-       }
-
        inline Theme::~Theme()
        {
                if (m_isOwner && m_th) {
@@ -61,6 +55,12 @@ namespace ucl {
                }
        }
 
+       inline Theme &Theme::operator=(Theme tmp)
+       {
+               swap(*this, tmp);
+               return *this;
+       }
+
        inline Elm_Theme *Theme::getTh()
        {
                return m_th;
@@ -93,9 +93,9 @@ namespace ucl {
 
        // Non-member functions //
 
-       inline bool isValid(const Theme &item)
+       inline bool isValid(const Theme &theme)
        {
-               return !!item.getTh();
+               return !!theme.getTh();
        }
 
        inline void swap(Theme &x, Theme &y)
index 9292cad2d85f38710e51d66dbb0f078cb84598bc..e6506ab9ceb77735c5eb046f4330e8c091f2c91d 100644 (file)
@@ -29,79 +29,367 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(Widget);
 
+       /**
+        * @brief Represents Evas widget and serves as base class for more
+        *        concrete widget types
+        */
        class Widget : public RefCountAware {
        public:
+               /**
+                * @brief Constant for setWeight() method
+                */
                static constexpr auto EXPAND = EVAS_HINT_EXPAND;
+
+               /**
+                * @brief Constant for setAllign() method
+                */
                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
+                * @param[in] eo Underlying Evas object of the widget
+                * @param[in] isOwner Evas object ownership flag (optional: true)
+                */
                explicit Widget(Evas_Object *eo, bool isOwner = true);
+
+               /**
+                * @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)
+                */
                Widget(IRefCountObj *rc, Evas_Object *eo, bool isOwner = true);
+
+               /**
+                * @brief Destructor
+                */
                virtual ~Widget();
 
+               /**
+                * @brief Binds underlying Evas object to this widget
+                * @details When Evas object is bound it makes possible to convert
+                *          Evas object pointer to Widget pointer. Only single
+                *          Widget object may be bound same Evas object.
+                */
                void bindToEo();
+
+               /**
+                * @brief Unbinds underlying Evas object from this widget
+                * @details Reverts the effect of bindToEo() function call. Use this
+                *          function if you want to bind different Widget object to
+                *          same Evas object (usefull when wrapping widgets).
+                */
                void unbindFromEo();
 
+               /**
+                * @brief Sets ownership of Evas object flag to this widget
+                * @details In all cases:
+                *          Evas object can't be destroyed while Widget object is alive.
+                *          But it can still be marked for deletion.
+                *
+                *          In all cases when ownership flag is true:
+                *          Underlying Evas object is marked for deletion in the
+                *          destructor of this Widget object. Otherwise...
+                *
+                *          In case if Widget object is shared:
+                *          While Evas object is alive Widget object is also remains
+                *          alive even if all visible shared references destroyed.
+                *          It is possible to create new shared reference to Widget
+                *          from Evas object pointer.
+                *
+                *          In case if Widget object is not shared:
+                *          Underlying Evas object is not marked for deletion in the
+                *          destructor of this Widget object
+                *
+                * @param[in] value Ownership flag. true - owner, false - not owner.
+                */
                void setIsOwner(bool value);
 
-               Evas_Object *getEo();
-               const Evas_Object *getEo() const;
-
-               operator Evas_Object *();
-               operator const Evas_Object *() const;
-
+               /**
+                * @brief Gets Evas canvas on which underlying Evas object resides
+                * @return Pointer to the Evas canvas
+                */
                Evas *getEvas() const;
 
+               /**
+                * @brief Assigns user data to this widget
+                * @param[in] key Name of the data key
+                * @param[in] data Pointer to the user data
+                */
                void setData(EoDataKey key, void *data);
+
+               /**
+                * @brief Deletes user data from this widget
+                * @param[in] key Name of the data key
+                */
                void delData(EoDataKey key);
+
+               /**
+                * @brief Gets user data from this widget
+                * @param[in] key Name of the data key
+                * @return Pointer to the user data or NULL if not found
+                */
                void *getData(EoDataKey key) const;
 
+               /**
+                * @brief Registers standard widget event handler
+                * @param[in] event Value of the standart widget event enumeration
+                * @param[in] handler Handler of the event
+                */
                void addEventHandler(WidgetEvent event, WidgetEventHandler handler);
+
+               /**
+                * @brief Registers smart widget event handler
+                * @param[in] event Name of the smart widget event
+                * @param[in] handler Handler of the event
+                */
                void addEventHandler(SmartEvent event, WidgetEventHandler handler);
 
+               /**
+                * @brief Deregisters standard widget event handler
+                * @param[in] event Value of the standart widget event enumeration
+                * @param[in] handler Handler of the event
+                */
                void delEventHandler(WidgetEvent event,
                                WidgetEventHandler::CDRef handler);
+
+               /**
+                * @brief Deregisters smart widget event handler
+                * @param[in] event Name of the smart widget event
+                * @param[in] handler Handler of the event
+                */
                void delEventHandler(SmartEvent event,
                                WidgetEventHandler::CDRef handler);
 
+               /**
+                * @brief Calls smart widget event on this widget
+                * @details All handler of this event on this widget will handle this
+                *          event synchronously during call to this function.
+                * @param[in] event Name of the smart widget event
+                * @param[in] eventInfo Pointer to event info (optional)
+                */
                void callEvent(SmartEvent event, void *eventInfo = nullptr);
 
+               /**
+                * @brief Marks underlying Evas object for deletion
+                * @details Evas object will be deleted when there is no Widget objects
+                * referencing it and no other references to it.
+                */
                void markForDeletion();
 
+               /**
+                * @brief Sets visibility state of the widget
+                * @param[in] value New state
+                */
                void setVisible(bool value);
+
+               /**
+                * @brief Gets visibility state of the widget
+                * @return true if visible, false if invisible
+                */
                bool isVisible() const;
 
+               /**
+                * @brief Sets color to this widget
+                * @details Color component values must be premultiplied if alpha
+                *          is not 255.
+                * @param[in] r Red component of the color [0-255]
+                * @param[in] g Green component of the color [0-255]
+                * @param[in] b Blue component of the color [0-255]
+                * @param[in] a Alpha transparency of the color [0-255] (optional: 255)
+                */
                void setColor(int r, int g, int b, int a = 255);
+
+               /**
+                * @brief Sets gray color to this widget
+                * @param[in] l Luminosity of the color [0-255]
+                * @param[in] a Alpha transparency of the color [0-255] (optional: 255)
+                */
                void setColor(int l, int a = 255);
+
+               /**
+                * @brief Gets color of this widget
+                * @param[out] r Reference to the red component of the color
+                * @param[out] g Reference to the green component of the color
+                * @param[out] b Reference to the blue component of the color
+                * @param[out] a Reference to the alpha
+                */
                void getColor(int &r, int &g, int &b, int &a) const;
 
+               /**
+                * @brief Performs forced size calculations on the widget
+                */
                void calculate();
 
+               /**
+                * @brief Sets geometry of this widget
+                * @param[in] x Top-left X coordinate of the widget
+                * @param[in] y Top-left Y coordinate of the widget
+                * @param[in] w New width of the widget
+                * @param[in] h New height of the widget
+                */
                void setGeometry(int x, int y, int w, int h);
+
+               /**
+                * @brief Changes position of this widget
+                * @param[in] x Top-left X coordinate of the widget
+                * @param[in] y Top-left Y coordinate of the widget
+                */
                void move(int x, int y);
+
+               /**
+                * @brief Changes size of this widget
+                * @param[in] w New width of the widget
+                * @param[in] h New height of the widget
+                */
                void resize(int w, int h);
 
+               /**
+                * @brief Gets geometry of this widget
+                * @param[out] x Top-left X coordinate of the widget (may be NULL)
+                * @param[out] y Top-left Y coordinate of the widget (may be NULL)
+                * @param[out] w Width of the widget (may be NULL)
+                * @param[out] h Height of the widget (may be NULL)
+                */
                void getGeometry(int *x, int *y, int *w, int *h) const;
 
-               void setWeight(double w, double h);
-               void setAlign(double w, double h);
+               /**
+                * @brief Sets weight size hints to the widget
+                * @details Use EXPAND to expand container to the parent size
+                * @param[in] x Weight of the widget along X axis
+                * @param[in] y Weight of the widget along Y axis
+                */
+               void setWeight(double x, double y);
+
+               /**
+                * @brief Sets align size hints to the widget
+                * @details Use FILL to streth to the size of the container
+                * @param[in] x Align of the widget along X axis [0.0-1.0]
+                * @param[in] y Align of the widget along Y axis [0.0-1.0]
+                */
+               void setAlign(double x, double y);
+
+               /**
+                * @brief Sets mimimum size hints to the widget
+                * @param[in] w Minimul allowed with of the widget
+                * @param[in] h Minimul allowed height of the widget
+                */
                void setMin(int w, int h);
+
+               /**
+                * @brief Sets maximum size hints to the widget
+                * @details Use -1 for infinity.
+                * @param[in] w Maximum allowed with of the widget
+                * @param[in] h Maximum allowed height of the widget
+                */
                void setMax(int w, int h);
 
-               void getWeight(double *w, double *h) const;
-               void getAlign(double *w, double *h) const;
+               /**
+                * @brief Gets weight size hints of the widget
+                * @param[out] x Weight of the widget along X axis (may be NULL)
+                * @param[out] y Weight of the widget along Y axis (may be NULL)
+                */
+               void getWeight(double *x, double *y) const;
+
+               /**
+                * @brief Gets align size hints of the widget
+                * @param[out] x Align of the widget along X axis (may be NULL)
+                * @param[out] y Align of the widget along Y axis (may be NULL)
+                */
+               void getAlign(double *x, double *y) const;
+
+               /**
+                * @brief Gets mimimum size hints of the widget
+                * @param[in] w Minimul allowed with of the widget (may be NULL)
+                * @param[in] h Minimul allowed height of the widget (may be NULL)
+                */
                void getMin(int *w, int *h) const;
+
+               /**
+                * @brief Gets maximum size hints of the widget
+                * @param[in] w Maximum allowed with of the widget (may be NULL)
+                * @param[in] h Maximum allowed height of the widget (may be NULL)
+                */
                void getMax(int *w, int *h) const;
 
+               /**
+                * @brief Sets aspect ratio size hints to the widget
+                * @param[in] arControl Type of aspect ration control
+                * @param[in] w Width aspect ration term
+                * @param[in] h Height aspect ration term
+                */
                void setARHint(WidgetARHint arControl, int w, int h);
+
+               /**
+                * @brief Gets aspect ratio size hints of the widget
+                * @param[out] arControl Type of aspect ration control
+                * @param[out] w Width aspect ration term
+                * @param[out] h Height aspect ration term
+                */
                void getARHint(WidgetARHint &arControl, int &w, int &h);
 
+               /**
+                * @brief Sets key-input focus state to the widget
+                * @param[in] value New state. true - to set focus, false - to unset
+                */
                void setFocused(bool value);
+
+               /**
+                * @brief Gets key-input focus state of the widget
+                * @return true if focused, false id not focused
+                */
                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
+                * @param[in] value New state. true - to set focus, false - to unset
+                */
                virtual void setFocusedImpl(bool value);
+
+               /**
+                * @brief Actually gets key-input focus state of the widget
+                * @details May be overriden in subclasses to change behaviour
+                * @return true if focused, false id not focused
+                */
                virtual bool isFocusedImpl() const;
+
+               /**
+                * @brief Setups all necessary state to handle forwarded smart events
+                * @details Called when a handler for UCL_SMART_FWD is added.
+                * @param[in] fwdEvent Smart event that needs to be forwarded
+                * @return true - if forwarded event is supported and necessary state
+                *         was succesfully prepared, false - otherwise
+                */
                virtual bool ensureFwdEvent(SmartEvent fwdEvent);
 
        private:
@@ -146,24 +434,97 @@ 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 <class T>
+       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
+        * @param[out] x Top-left X coordinate of the widget (may be NULL)
+        * @param[out] y Top-left Y coordinate of the widget (may be NULL)
+        */
        void getPosition(const Widget &widget, int *x, int *y);
+
+       /**
+        * @brief Gets size of the widget
+        * @param[in] widget Reference to target widget
+        * @param[out] w Width of the widget (may be NULL)
+        * @param[out] h Height of the widget (may be NULL)
+        */
        void getSize(const Widget &widget, int *w, int *h);
 
+       /**
+        * @brief Makes the widget visible
+        * @details This is equivalent to: widget.setVisible(true);
+        * @param[in] widget Reference to target widget
+        */
        void show(Widget &widget);
+
+       /**
+        * @brief Makes the widget invisible
+        * @details This is equivalent to: widget.setVisible(false);
+        * @param[in] widget Reference to target widget
+        */
        void hide(Widget &widget);
 
+       /**
+        * @brief Makes the widget transparent
+        * @details This is equivalent to: widget.setColor(0, 0);
+        * @param[in] widget Reference to target widget
+        */
        void makeTransparent(Widget &widget);
+
+       /**
+        * @brief Makes the widget color white
+        * @details This is equivalent to: widget.setColor(255);
+        * @param[in] widget Reference to target widget
+        */
        void makeWhite(Widget &widget);
 
+       /**
+        * @brief Sets widget to focused state
+        * @details This is equivalent to: widget.setFocused(true);
+        * @param[in] widget Reference to target widget
+        */
        void focus(Widget &widget);
+
+       /**
+        * @brief Sets widget to unfocused state
+        * @details This is equivalent to: widget.setFocused(false);
+        * @param[in] widget Reference to target widget
+        */
        void unfocus(Widget &widget);
 
+       /**
+        * @brief Sets EXPAND weight size hits to the widget
+        * @details This is equivalent to:
+        *          widget.setWight(Widget::EXPAND, Widget::EXPAND);
+        * @param[in] widget Reference to target widget
+        */
        void expand(Widget &widget);
+
+       /**
+        * @brief Sets FILL align size hits to the widget
+        * @details This is equivalent to:
+        *          widget.setAlign(Widget::FILL, Widget::FILL);
+        * @param[in] widget Reference to target widget
+        */
        void fill(Widget &widget);
-       void expandAndFill(Widget &widget);
 
-       bool operator==(const Widget &lhs, const Widget &rhs);
-       bool operator!=(const Widget &lhs, const Widget &rhs);
+       /**
+        * @brief Sets EXPAND weight and FILL align size hits to the widget
+        * @details This is equivalent to: expand(widget); fill(widget);
+        * @param[in] widget Reference to target widget
+        */
+       void expandAndFill(Widget &widget);
 }
 
 #include "Widget.hpp"
index 95da66ac6dcc534b5a57585c3f9ee2fb39070c0a..9e98bfdbc15e602da5372de5f915d462d347fc5f 100644 (file)
@@ -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());
@@ -141,14 +131,14 @@ namespace ucl {
                evas_object_geometry_get(getEo(), x, y, w, h);
        }
 
-       inline void Widget::setWeight(const double w, const double h)
+       inline void Widget::setWeight(const double x, const double y)
        {
-               evas_object_size_hint_weight_set(getEo(), w, h);
+               evas_object_size_hint_weight_set(getEo(), x, y);
        }
 
-       inline void Widget::setAlign(const double w, const double h)
+       inline void Widget::setAlign(const double x, const double y)
        {
-               evas_object_size_hint_align_set(getEo(), w, h);
+               evas_object_size_hint_align_set(getEo(), x, y);
        }
 
        inline void Widget::setMin(const int w, const int h)
@@ -161,14 +151,14 @@ namespace ucl {
                evas_object_size_hint_max_set(getEo(), w, h);
        }
 
-       inline void Widget::getWeight(double *const w, double *const h) const
+       inline void Widget::getWeight(double *const x, double *const y) const
        {
-               evas_object_size_hint_weight_get(getEo(), w, h);
+               evas_object_size_hint_weight_get(getEo(), x, y);
        }
 
-       inline void Widget::getAlign(double *const w, double *const h) const
+       inline void Widget::getAlign(double *const x, double *const y) const
        {
-               evas_object_size_hint_align_get(getEo(), w, h);
+               evas_object_size_hint_align_get(getEo(), x, y);
        }
 
        inline void Widget::getMin(int *const w, int *const h) const
@@ -206,6 +196,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 +261,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());
-       }
 }
index 646cf50ee665b3704a289d015a9fefc7a2c4f434..3ef57d41558023867dff4d747613a7a2af290618 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Represents generic Elementary widget item and serves as base
+        *        class for more concrete widget item types
+        * @details This class has semantic of a pointer and therefore does not
+        *          manage lifetime of the item. Pointer is always point to the non
+        *          constant Genlist item. Most of the methods marked as const
+        *          because pointer is not changed in these method calls.
+        */
        class WidgetItem {
        public:
+               /**
+                * @brief Default constructor
+                * @details Constructs NULL item
+                */
                constexpr WidgetItem();
+
+               /**
+                * @brief Constructor
+                * @details Same as default constructor
+                */
                constexpr WidgetItem(std::nullptr_t);
+
+               /**
+                * @brief Constructor
+                * @details Wraps native Elementary widget item.
+                * @param[in] it Native Elementary widget item
+                */
                explicit WidgetItem(Elm_Object_Item *it);
 
+               /**
+                * @brief Gets native Elementary widget item
+                * @return Pointer to native Elementary widget item
+                */
                Elm_Object_Item *getIt() const;
 
+               /**
+                * @brief Implicitly casts to native Elementary widget item
+                * @return Pointer to native Elementary widget item
+                */
                operator Elm_Object_Item *() const;
+
+               /**
+                * @brief Explicitly casts to boolen type
+                * @return true if native item is not NULL, false - if NULL
+                */
                explicit operator bool() const;
 
+               /**
+                * @brief Gets owning Evas object of this widget item
+                * @return Pointer to the owning Evas object
+                */
                Evas_Object *getWidget() const;
 
+               /**
+                * @brief Sets widget item delete callback
+                * @details Callback is called when item is deleted.
+                *          Data of the callback is set by setData() method.
+                * @param[in] cb Pointer to callback function
+                */
                void setDelCallback(Evas_Smart_Cb cb) const;
 
+               /**
+                * Deletes this widget item and NULL the pointer
+                */
                void del();
 
+               /**
+                * @brief Assigns user data to this widget item
+                * @param[in] data Pointer to the user data
+                */
                void setData(void *data) const;
+
+               /**
+                * @brief Gets assigned user data to this widget item
+                * @return Pointer to the assigned user data or NULL
+                */
                void *getData() const;
 
+               /**
+                * @brief Sets enabled state of the widget item
+                * @param[in] value New state
+                */
                void setEnabled(bool value) const;
+
+               /**
+                * @brief Gets enabled state of the widget item
+                * @return true if enabled, false if disabled
+                */
                bool isEnabled() const;
 
+               /**
+                * @brief Applies style to the widget item
+                * @param[in] style Style to apply
+                */
                void setStyle(ElmStyle style) const;
 
+               /**
+                * @brief Sets text to default part of the widget item
+                * @param[in] value Translatable text value to set
+                */
                void setText(const TString &value) const;
-               void setText(const TString &value, EdjePart part) const;
 
-               TString getText() const;
-               TString getText(EdjePart part) const;
+               /**
+                * @brief Sets text to specific part of the widget item
+                * @param[in] value Translatable text value to set
+                * @param[in] part Destination Edje part
+                */
+               void setText(const TString &value, EdjePart part) const;
 
-               void setContent(Evas_Object *content) const;
-               void setContent(Evas_Object *content, EdjePart part) const;
+               /**
+                * @brief Gets text from default part of the widget item
+                * @return Translated text from default part
+                */
+               std::string getText() const;
+
+               /**
+                * @brief Gets text from specific part of the widget item
+                * @param[in] part Source Edje part
+                * @return Translated text from specific part
+                */
+               std::string getText(EdjePart part) const;
+
+               /**
+                * @brief Sets content to default part of the widget item
+                * @param[in] content Content widget
+                */
+               void setContent(Widget &content) const;
+
+               /**
+                * @brief Sets content to specific part of the widget item
+                * @param[in] content Content widget
+                * @param[in] part Destination Edje part
+                */
+               void setContent(Widget &content, EdjePart part) const;
+
+               /**
+                * @brief Unsets content from default part of the widget item
+                * @return Content Evas object or NULL
+                */
                Evas_Object *unsetContent() const;
+
+               /**
+                * @brief Unsets content from specific part of the widget item
+                * @param[in] part Source Edje part
+                * @return content Evas object or NULL
+                */
                Evas_Object *unsetContent(EdjePart part) const;
 
+               /**
+                * @brief Gets content from default part of the widget item
+                * @return Content Evas object or NULL
+                */
                Evas_Object *getContent() const;
+
+               /**
+                * @brief Gets content from specific part of the widget item
+                * @param[in] part Source Edje part
+                * @return content Evas object or NULL
+                */
                Evas_Object *getContent(EdjePart part) const;
 
+               /**
+                * @brief Emits signal to the widget item's Edje theme
+                * @param[in] signal Emitted signal
+                * @param[in] signal Emitted signal source (optional)
+                */
                void emit(EdjeSignal signal, EdjeSignalSrc source =
                                EdjeSignalSrc("")) const;
 
@@ -69,10 +196,32 @@ namespace ucl {
 
        // Non-member functions //
 
+       /**
+        * @brief Sets widget item to enabled state
+        * @details This is equivalent to: item.setEnabled(true);
+        * @param[in] item Reference to target widget item
+        */
        void enable(WidgetItem item);
+
+       /**
+        * @brief Sets widget item to disabled state
+        * @details This is equivalent to: item.setEnabled(false);
+        * @param[in] item Reference to target widget item
+        */
        void disable(WidgetItem item);
 
+       /**
+        * @brief Compares equals underlying item pointers of target widgets items
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        */
        bool operator==(WidgetItem lhs, WidgetItem rhs);
+
+       /**
+        * @brief Compares unequals underlying item pointers of target widget items
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        */
        bool operator!=(WidgetItem lhs, WidgetItem rhs);
 }
 
index 26b6cbda19b5496d8985dcd41baefae9655d2887..b36cfa4ec6928012711be34fcb2e0cb0933d2ee3 100644 (file)
@@ -87,25 +87,25 @@ namespace ucl {
                elm_object_item_style_set(getIt(), style.name);
        }
 
-       inline TString WidgetItem::getText() const
+       inline std::string WidgetItem::getText() const
        {
                return elm_object_item_text_get(getIt());
        }
 
-       inline TString WidgetItem::getText(const EdjePart part) const
+       inline std::string WidgetItem::getText(const EdjePart part) const
        {
                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
index c21fb4252bb6bc9413c75fb91d5087db43be6d73..053a627b9b926e7ca3218700c5c8b855c9a36d76 100644 (file)
@@ -27,29 +27,98 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(Window);
 
+       /**
+        * @brief Represents Elementary Window widget with Conformant
+        */
        class Window final : public ElmWidget {
        public:
+               /**
+                * @brief Enumeration of Window types
+                */
                enum class Type {
                        BASIC = ELM_WIN_BASIC
                };
 
+               /**
+                * @brief Builder of Window objects
+                */
                class Builder final {
                public:
+                       /**
+                        * @brief Constructor
+                        */
                        Builder();
 
+                       /**
+                        * @brief Sets Evas object for the future window
+                        * @details If Evas object is set builder will create wrapper
+                        *          Window object.
+                        * @param[in] value Pointer to window Evas object
+                        * @return Reference to this builder
+                        */
                        Builder &setWinEo(Evas_Object *value);
 
+                       /**
+                        * @brief Sets type of the future window
+                        * @details Ignored if WinEo is set.
+                        * @param[in] type Type of the future window
+                        * @return Reference to this builder
+                        */
                        Builder &setType(Type type);
+
+                       /**
+                        * @brief Sets name of the future window
+                        * @details Ignored if WinEo is set or used as title (if not set).
+                        * @param[in] value Name of the future window
+                        * @return Reference to this builder
+                        */
                        Builder &setName(std::string value);
 
+                       /**
+                        * @brief Sets title of the future window
+                        * @details Name is used if not set.
+                        * @param[in] value Title of the future window
+                        * @return Reference to this builder
+                        */
                        Builder &setTitle(std::string value);
+
+                       /**
+                        * @brief Sets indicator visibility state of the future window
+                        * @param[in] value Indicator visibility state of the future window
+                        * @return Reference to this builder
+                        */
                        Builder &setIndicatorVisible(bool value);
+
+                       /**
+                        * @brief Sets supported rotations by the future window
+                        * @param[in] value Rotations supported by the future window
+                        * @return Reference to this builder
+                        */
                        Builder &setRotations(std::vector<int> value);
 
+                       /**
+                        * @brief Sets Evas object ownership flag of the future object
+                        * @details If not set and WinEo is also not IsOwner
+                        *          is true by default, otherwise - false.
+                        * @param[in] value true if owner, false - otherwise
+                        * @return Reference to this builder
+                        */
                        Builder &setIsOwner(bool value);
+
+                       /**
+                        * @brief Sets if future object needs to be bind to it's Evas object
+                        * @param[in] value true if need to bind, false - otherwise
+                        * @return Reference to this builder
+                        */
                        Builder &setNeedBindToEo(bool value);
 
+                       /**
+                        * @brief Creates new Window object using current parameters
+                        * @param[in] parent Reference to parent widget
+                        * @return Shared reference to new Window object or NULL
+                        */
                        WindowSRef build() const;
+
                private:
                        std::string m_name;
                        std::string m_title;
@@ -63,21 +132,69 @@ namespace ucl {
                };
 
        public:
+               /**
+                * @brief Gets conformant of this Window
+                * @return Reference to Conformant widget
+                */
                StyledWidget &getConformant();
+
+               /**
+                * @brief Gets conformant of this Window (constant version)
+                * @return Reference to constant Conformant widget
+                */
                const StyledWidget &getConformant() const;
 
+               /**
+                * @brief Gets screen size of the window
+                * @param[out] w Width of the screen (may be NULL)
+                * @param[out] h Height of the screen (may be NULL)
+                */
                void getScreenSize(int *w, int *h) const;
 
+               /**
+                * @brief Sets title of the window
+                * @param[in] value Title of the window
+                */
                void setTitle(const std::string &title);
+
+               /**
+                * @brief Gets title of the window
+                * @return Title of the window
+                */
                std::string getTitle() const;
 
+               /**
+                * Sets window indicator visibility state
+                * @param[in] value Visibility state. true - visible, false - invisible
+                */
                void setIndicatorVisible(bool value);
+
+               /**
+                * Gets window indicator visibility state
+                * @retrun Visibility state. true - visible, false - invisible
+                */
                bool isIndicatorVisible() const;
 
+               /**
+                * Gets window rotations support status
+                * @retrun true - rotation supported, false - no supported
+                */
                bool isRotationsSupported() const;
+
+               /**
+                * @brief Sets supported rotations to the window
+                * @param[in] value Rotations supported by the window
+                */
                void setRotations(const std::vector<int> &value);
 
+               /**
+                * @brief Resizes the window to fill whole screen
+                */
                void resizeToScreen();
+
+               /**
+                * @brief Moves window to foreground
+                */
                void lower();
 
        private:
@@ -94,11 +211,27 @@ namespace ucl {
 
        // Window //
 
+       /**
+        * @brief Makes the window indicator visible
+        * @details This is equivalent to: win.setIndicatorVisible(true);
+        * @param[in] win Reference to target window
+        */
        void showIndicator(Window &win);
+
+       /**
+        * @brief Makes the window indicator invisible
+        * @details This is equivalent to: win.setIndicatorVisible(false);
+        * @param[in] win Reference to target window
+        */
        void hideIndicator(Window &win);
 
        // Window::Type //
 
+       /**
+        * @brief Checks validity of window type value
+        * @param[in] winType Window type value to validate
+        * @return true - if window type valid, false - otherwise
+        */
        bool isValid(Window::Type winType);
 }
 
index d42eccb613d1d77a0da3dc28920123c486755276..6e2bd226c501ea433aaa1fe387678e94006a525c 100644 (file)
@@ -23,11 +23,31 @@ namespace ucl {
 
        // Converts Evas_Object to Widget pointer //
 
+       /**
+        * @brief Converts Evas object pointer to Widget pointer
+        * @details Widget::bindToEo() must be called on widget object in order
+        *          for this function to work.
+        * @return Pointer to the corresponding Widget object or NULL
+        */
        Widget *asWidget(Evas_Object *eo);
+
+       /**
+        * @brief Converts pointer to constant Evas object to pointer
+        *        to constant Widget
+        * @details Widget::bindToEo() must be called on widget object in order
+        *          for this function to work.
+        * @return Pointer to the corresponding Widget object or NULL
+        */
        const Widget *asWidget(const Evas_Object *eo);
 
        // Widget casting functions from Evas_Object //
 
+       /**
+        * @brief Statically casts Evas object pointer to WIDGET_TYPE pointer
+        * @details This function performs static_cast<WIDGET_TYPE *> on
+        *          the result of asWidget() function call.
+        * @return Pointer to the corresponding WIDGET_TYPE object or NULL
+        */
        template <class WIDGET_TYPE>
        inline auto staticWidgetCast(Evas_Object *eo) ->
                        decltype(static_cast<WIDGET_TYPE *>(asWidget(eo)))
@@ -35,13 +55,27 @@ namespace ucl {
                return static_cast<WIDGET_TYPE *>(asWidget(eo));
        }
 
+       /**
+        * @brief Statically casts pointer to constant Evas object to pointer
+        *        to constant WIDGET_TYPE
+        * @details This function performs static_cast<const WIDGET_TYPE *> on
+        *          the result of asWidget() function call.
+        *          Do not need to add const to WIDGET_TYPE.
+        * @return Pointer to the corresponding WIDGET_TYPE object or NULL
+        */
        template <class WIDGET_TYPE>
        inline auto staticWidgetCast(const Evas_Object *eo) ->
-                       decltype(static_cast<WIDGET_TYPE *>(asWidget(eo)))
+                       decltype(static_cast<const WIDGET_TYPE *>(asWidget(eo)))
        {
-               return static_cast<WIDGET_TYPE *>(asWidget(eo));
+               return static_cast<const WIDGET_TYPE *>(asWidget(eo));
        }
 
+       /**
+        * @brief Dynamically casts Evas object pointer to WIDGET_TYPE pointer
+        * @details This function performs dynamic_cast<WIDGET_TYPE *> on
+        *          the result of asWidget() function call.
+        * @return Pointer to the corresponding WIDGET_TYPE object or NULL
+        */
        template <class WIDGET_TYPE>
        inline auto dynamicWidgetCast(Evas_Object *eo) ->
                        decltype(dynamic_cast<WIDGET_TYPE *>(asWidget(eo)))
@@ -49,13 +83,27 @@ namespace ucl {
                return dynamic_cast<WIDGET_TYPE *>(asWidget(eo));
        }
 
+       /**
+        * @brief Dynamically casts pointer to constant Evas object to pointer
+        *        to constant WIDGET_TYPE
+        * @details This function performs dynamic_cast<const WIDGET_TYPE *>
+        *          on the result of asWidget() function call.
+        *          Do not need to add const to WIDGET_TYPE.
+        * @return Pointer to the corresponding WIDGET_TYPE object or NULL
+        */
        template <class WIDGET_TYPE>
        inline auto dynamicWidgetCast(const Evas_Object *eo) ->
-                       decltype(dynamic_cast<WIDGET_TYPE *>(asWidget(eo)))
+                       decltype(dynamic_cast<const WIDGET_TYPE *>(asWidget(eo)))
        {
-               return dynamic_cast<WIDGET_TYPE *>(asWidget(eo));
+               return dynamic_cast<const WIDGET_TYPE *>(asWidget(eo));
        }
 
+       /**
+        * @brief Statically casts Evas object pointer to SharedRef<WIDGET_TYPE>
+        * @details This function calls asShared() on the result of
+        *          staticWidgetCast<WIDGET_TYPE>() function call.
+        * @return Shared reference to the corresponding WIDGET_TYPE object or NULL
+        */
        template <class WIDGET_TYPE>
        inline auto staticWidgetRefCast(Evas_Object *eo) ->
                        decltype(asShared(staticWidgetCast<WIDGET_TYPE>(eo)))
@@ -63,6 +111,13 @@ namespace ucl {
                return asShared(staticWidgetCast<WIDGET_TYPE>(eo));
        }
 
+       /**
+        * @brief Statically casts pointer to constant Evas object
+        *        to SharedRef<const WIDGET_TYPE>
+        * @details This function calls asShared() on the result of
+        *          staticWidgetCast<WIDGET_TYPE>() function call.
+        * @return Shared reference to the corresponding WIDGET_TYPE object or NULL
+        */
        template <class WIDGET_TYPE>
        inline auto staticWidgetRefCast(const Evas_Object *eo) ->
                        decltype(asShared(staticWidgetCast<WIDGET_TYPE>(eo)))
@@ -70,6 +125,12 @@ namespace ucl {
                return asShared(staticWidgetCast<WIDGET_TYPE>(eo));
        }
 
+       /**
+        * @brief Dynamically casts Evas object pointer to SharedRef<WIDGET_TYPE>
+        * @details This function calls asShared() on the result of
+        *          dynamicWidgetCast<WIDGET_TYPE>() function call.
+        * @return Shared reference to the corresponding WIDGET_TYPE object or NULL
+        */
        template <class WIDGET_TYPE>
        inline auto dynamicWidgetRefCast(Evas_Object *eo) ->
                        decltype(asShared(dynamicWidgetCast<WIDGET_TYPE>(eo)))
@@ -77,6 +138,13 @@ namespace ucl {
                return asShared(dynamicWidgetCast<WIDGET_TYPE>(eo));
        }
 
+       /**
+        * @brief Dynamically casts pointer to constant Evas object
+        *        to SharedRef<const WIDGET_TYPE>
+        * @details This function calls asShared() on the result of
+        *          dynamicWidgetCast<WIDGET_TYPE>() function call.
+        * @return Shared reference to the corresponding WIDGET_TYPE object or NULL
+        */
        template <class WIDGET_TYPE>
        inline auto dynamicWidgetRefCast(const Evas_Object *eo) ->
                        decltype(asShared(dynamicWidgetCast<WIDGET_TYPE>(eo)))
index 7ec81b96bd6092451fc526e3f82f44c956000bf9..d7537c22107e4481b5c9dbf7b42151abea02bc96 100644 (file)
@@ -23,15 +23,36 @@ namespace ucl {
 
        // Styles //
 
+       /**
+        * @brief Style that is default for wide range of widgets
+        */
        constexpr ElmStyle STYLE_DEFAULT {"default"};
 
        // Parts //
 
+       /**
+        * @brief Default text part for wide range of widgets
+        */
        constexpr EdjePart PART_TEXT  {"elm.text"};
+
+       /**
+        * @brief Default title text part for wide range of widgets
+        */
        constexpr EdjePart PART_TITLE {"elm.text.title"};
 
+       /**
+        * @brief Default content part for wide range of widgets
+        */
        constexpr EdjePart PART_CONTENT {"elm.swallow.content"};
+
+       /**
+        * @brief Default icon part for wide range of widgets
+        */
        constexpr EdjePart PART_ICON    {"elm.swallow.icon"};
+
+       /**
+        * @brief Default button part for wide range of widgets
+        */
        constexpr EdjePart PART_BUTTON  {"elm.swallow.button"};
 }
 
index 79ff4267387c759189a996ae56f3add5cae9dbb4..24bc3616dd45577257c42142edab770750d405e4 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Application default layout theme
+        */
        constexpr LayoutTheme LAYOUT_DEFAULT {"layout", "application", "default"};
 
+       /**
+        * @brief No contents layout theme
+        */
        constexpr LayoutTheme LAYOUT_NO_CONTENTS
                        {"layout", "nocontents", "default"};
 }
index fd99fdc6830e93c382cea49384112f5cdb230c17..9c0cc491c1a87597f73cc5674c36649a084a8d4b 100644 (file)
@@ -21,6 +21,9 @@
 
 namespace ucl {
 
+       /**
+        * @brief Empty naviframe style (only with content part)
+        */
        constexpr ElmStyle NAVIFRAME_EMPTY {"empty"};
 }
 
index 6d43d766b9039ca6b267603c34073b061e52c531..03dd8aa9ebb4a513627cd9c288fdc05600cb326f 100644 (file)
@@ -33,34 +33,70 @@ namespace ucl {
 
        // Aspects //
 
+       /**
+        * @brief Represent Edje part name
+        */
        struct EdjePart : Aspect<EdjePart> { using Aspect::Aspect; };
+
+       /**
+        * @brief Represent Edje group name
+        */
        struct EdjeGroup : Aspect<EdjeGroup> { using Aspect::Aspect; };
+
+       /**
+        * @brief Represent Edje data key name
+        */
        struct EdjeDataKey : Aspect<EdjeDataKey> { using Aspect::Aspect; };
 
+       /**
+        * @brief Represent Edje signal name
+        */
        struct EdjeSignal : Aspect<EdjeSignal> { using Aspect::Aspect; };
+
+       /**
+        * @brief Represent Edje signal source name
+        */
        struct EdjeSignalSrc : Aspect<EdjeSignalSrc> { using Aspect::Aspect; };
 
+       /**
+        * @brief Represent Elementary widget style name
+        */
        struct ElmStyle : Aspect<ElmStyle> { using Aspect::Aspect; };
 
+       /**
+        * @brief Represent Evas object smart callback name
+        */
        struct SmartEvent : Aspect<SmartEvent> { using Aspect::Aspect; };
 
+       /**
+        * @brief Represent Evas object data key name
+        */
        struct EoDataKey : Aspect<EoDataKey> { using Aspect::Aspect; };
 
        // Delegates //
 
+       /**
+        * @brief Handler for events with the Evas object smart callback signature
+        */
        using SmartCbHandler = Delegate<void(Evas_Object *obj, void *eventInfo)>;
 
        // WidgetEventHandler //
 
        class Widget;
 
+       /**
+        * @brief Handler for Widget standard/smart events
+        */
        using WidgetEventHandler =
                        WeakDelegate<void(Widget &widget, void *eventInfo)>;
 
        // WidgetEvent //
 
+       /**
+        * @brief Enumeration of Widget standard events
+        */
        enum class WidgetEvent {
-               DEL  = EVAS_CALLBACK_DEL,
+               DEL = EVAS_CALLBACK_DEL,
 
                MOUSE_IN    = EVAS_CALLBACK_MOUSE_IN,
                MOUSE_OUT   = EVAS_CALLBACK_MOUSE_OUT,
@@ -94,16 +130,34 @@ namespace ucl {
 
        // AtspiGestureEventInfo //
 
+       class Atspi;
+
+       /**
+        * @brief Event info data for ATSPI gesture smart event
+        */
        struct AtspiGestureEventInfo final {
                Elm_Atspi_Gesture_Info gestureInfo;
                bool preventDefault;
                bool stopPropagation;
        };
 
+       /**
+        * @brief Handler for Atspi gesture events
+        */
+       using AtspiGestureHandler = WeakDelegate<void(Atspi &atspi,
+                       AtspiGestureEventInfo &eventInfo)>;
+
+       /**
+        * @brief Callback for Atspi string requesting functions (name, description)
+        */
+       using AtspiStringCb = WeakDelegate<CString(Atspi &atspi)>;
+
        // WidgetARHint //
 
-       enum class WidgetARHint
-       {
+       /**
+        * @brief Enumeration of widget aspect ration hints
+        */
+       enum class WidgetARHint {
                NEITHER = EVAS_ASPECT_CONTROL_NEITHER,
                HORIZONTAL = EVAS_ASPECT_CONTROL_HORIZONTAL,
                VERTICAL = EVAS_ASPECT_CONTROL_VERTICAL,
@@ -112,19 +166,54 @@ namespace ucl {
 
        // LayoutTheme //
 
+       /**
+        * @brief Represents Layout theme description
+        */
        struct LayoutTheme final {
+               /**
+                * @brief Name of the widget class
+                */
                const char *klass;
+
+               /**
+                * @brief Name of the group
+                */
                const char *group;
+
+               /**
+                * @brief Name of the style
+                */
                const char *style;
 
+               /**
+                * @brief Default constructor
+                * @details Constructs empty non valid LayoutTheme
+                */
                constexpr LayoutTheme();
+
+               /**
+                * @brief Constructor
+                * @details Same as default constructor
+                */
                constexpr LayoutTheme(std::nullptr_t);
+
+               /**
+                * @brief Constructor
+                * @param[in] klass Name of the widget class
+                * @param[in] group Name of the group
+                * @param[in] style Name of the style
+                */
                constexpr LayoutTheme(const char *klass,
                                const char *group, const char *style);
        };
 
        // LayoutTheme non-member functions //
 
+       /**
+        * @brief Checks whether LayoutTheme object is valid
+        * @param[in] value Reference to target LayoutTheme object
+        * @return true if valid, false if not valid
+        */
        constexpr bool isValid(const LayoutTheme &value);
 }
 
index 0c55bf63db2a70452ba68ce5b2f45e2b82783673..88c92b6aee3b2dc72da6b1d394290982c25e09f2 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Implementation for CHILD aspect
+        * @details CHILD class must inherit from this template to implement
+        *          specific aspect
+        */
        template <class CHILD>
        struct Aspect {
+               /**
+                * @brief Name of the aspect
+                */
                const char *name;
 
+               /**
+                * @brief Default constructor
+                * @details Initializes "name" to NULL.
+                */
                constexpr Aspect();
+
+               /**
+                * @brief Constructor
+                * @details Same as default constructor
+                */
                constexpr Aspect(std::nullptr_t);
+
+               /**
+                * @brief Constructor
+                * @param[in] name Name for the new aspect or NULL
+                */
                explicit constexpr Aspect(const char *name);
 
+               /**
+                * @brief Returns name of the aspect
+                */
                constexpr operator const char *() const;
 
+               /**
+                * @brief Custom hash functor for Aspect<CHILD>
+                */
                struct Hash final {
                        size_t operator()(const Aspect &key) const;
                };
@@ -38,11 +66,29 @@ namespace ucl {
 
        // Non-member functions //
 
+       /**
+        * @brief Checks validity of the Aspect<CHILD> (name is not NULL)
+        * @param[in] aspect Target aspect
+        * @return Validity status. true - valid, false - not valid
+        */
        template <class CHILD>
        constexpr bool isValid(Aspect<CHILD> aspect);
 
+       /**
+        * @brief Compares equals names of target aspects
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        * @return true - if equal, false - not equal
+        */
        template <class CHILD>
        constexpr bool operator==(Aspect<CHILD> lhs, Aspect<CHILD> rhs);
+
+       /**
+        * @brief Compares unequals names of target aspects
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        * @return true - if not equal, false - equal
+        */
        template <class CHILD>
        constexpr bool operator!=(Aspect<CHILD> lhs, Aspect<CHILD> rhs);
 }
index e2d06a13df26f086c5af6dd6fb64195a31e66697..cb65f9e49f82981bb23e950a96b754cbc7df443b 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Resource wrapper for automatically deallocate OBJ_TYPE
+        *        using DEL_FUNC in destructor
+        */
        template <class OBJ_TYPE, class DEL_RET, DEL_RET(*DEL_FUNC)(OBJ_TYPE)>
        struct AutoObject final : ucl::NonCopyable {
-               using Handle = OBJ_TYPE;
-
+               /**
+                * @brief Type of the wrapped object
+                */
+               using ObjType = OBJ_TYPE;
+
+               /**
+                * @brief Value of the object
+                */
                OBJ_TYPE obj;
 
+               /**
+                * @brief Default constructor
+                * @details Initializes "obj" using value initialization
+                */
                AutoObject() :
                        obj{}
                {
                }
 
+               /**
+                * @brief Constructor
+                * @details Same as default constructor
+                */
                AutoObject(std::nullptr_t) :
                        AutoObject()
                {
                }
 
+               /**
+                * @brief Constructor
+                * @param[in] obj Source object to wrap
+                */
                AutoObject(const OBJ_TYPE &obj) :
                        obj{obj}
                {
                }
 
+               /**
+                * @brief Destructor
+                * @details Calls DEL_FUNC on the object if it explicitly
+                *          casts to "true"
+                */
                ~AutoObject()
                {
                        if (obj) {
@@ -49,23 +76,42 @@ namespace ucl {
                        }
                }
 
+               /**
+                * @brief Move constructor
+                * @details Source will be in the default constructed state
+                * @param[in] src Source of the move
+                */
                AutoObject(AutoObject &&src) :
                        obj{src.obj}
                {
                        src.obj = {};
                }
 
+               /**
+                * @brief Assigns one AutoObject to another
+                * @details Only move assignment is possible. Original will be deleted.
+                * @param[in] src Source AutoObject
+                * @return Reference to this AutoObject
+                */
                AutoObject &operator=(AutoObject src)
                {
                        swap(*this, src);
                        return *this;
                }
 
+               /**
+                * @brief Returns pointer to "obj" member
+                * @datails This is unsafe function, avoid using it. May use in
+                *          templates to get the underlying object type.
+                */
                OBJ_TYPE *operator&()
                {
                        return &obj;
                }
 
+               /**
+                * @brief Returns constant reference to "obj"
+                */
                operator const OBJ_TYPE &() const
                {
                        return obj;
@@ -74,6 +120,11 @@ namespace ucl {
 
        // Non-member functions //
 
+       /**
+        * @brief Swaps AutoObject objects with each other
+        * @param[in/out] x First AutoObject
+        * @param[in/out] y Second AutoObject
+        */
        template <class OBJ_TYPE, class DEL_RET, DEL_RET(*DEL_FUNC)(OBJ_TYPE)>
        inline void swap(AutoObject<OBJ_TYPE, DEL_RET, DEL_FUNC> &x,
                        AutoObject<OBJ_TYPE, DEL_RET, DEL_FUNC> &y) noexcept
index 131873505755fa06876bd5c888ead6436c8f4ee6..9e5ca117c484f18691152c9b80d47cf77e84bece 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Simple wrapper for C-Style array of T
+        */
        template <class T>
        struct CArray {
+               /**
+                * @brief Data of the array
+                */
                T *data;
+
+               /**
+                * @brief Length of the array
+                */
                int length;
 
+               /**
+                * @brief Default constructor
+                * @details Creates empty array
+                */
                CArray() noexcept;
+
+               /**
+                * @brief Constructor
+                * @details Same as default constructor
+                */
                CArray(std::nullptr_t) noexcept;
 
+               /**
+                * @brief Checks if array is no empty
+                * @return true - array is not empty, false - array is empty
+                */
                explicit operator bool() const noexcept;
        };
 
        // Non-member functions //
 
+       /**
+        * @brief Checks validity of the CArray<T>
+        * @param[in] array Target array
+        * @return Validity status. true - valid, false - not valid
+        */
        template <class T>
        bool isValid(const CArray<T> &array);
 
+       /**
+        * @brief Checks emptiness of the CArray<T>
+        * @param[in] array Target array
+        * @return Emptiness status. true - empty, false - not empty
+        */
        template <class T>
        bool isEmpty(const CArray<T> &array);
 
+       /**
+        * @brief Performs destruction of the array and array items
+        * @param[in] array Target array
+        * @param[in] itemDelCb Callback which is called to delete each item
+        */
        template <class T, class ITEM_DEL_CB>
        void performDestroy(const CArray<T> &array, ITEM_DEL_CB &&itemDelCb);
 }
 
 namespace ucl { namespace aux {
 
+       /**
+        * @brief Performs destruction of the array and array items using free
+        * @param[in] array Target array
+        */
        template <class T>
        void destroyUsingFree(CArray<T> array);
 }}
index 5496cdaedfcea3a5f57767584e1bd0415670dd44..1704f63ca2df933c9a71d4db09c432707053f766 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Represents managed mutable C-String
+        */
        class CString final : protected NonCopyable {
        public:
+               /**
+                * @brief Swaps CString objects with each other
+                * @param[in/out] x First theme object
+                * @param[in/out] y Second theme object
+                */
                friend void swap(CString &x, CString &y) noexcept;
 
+               /**
+                * @brief Creates new CString object by duplicating source C-String
+                * @param[in] ptr Pointer to source C-String
+                * @details New C-String will be freed in destructor.
+                */
                static CString dup(const char *ptr);
+
+               /**
+                * @brief Creates new CString object by taking over source C-String
+                * @param[in] ptr Pointer to source C-String
+                * @details Source C-String will be freed in destructor.
+                */
                static CString takeover(char *ptr) noexcept;
 
+               /**
+                * @brief Defatult constructor
+                * @details Creates NULL CString object
+                */
                CString() noexcept;
+
+               /**
+                * @brief Constructor
+                * @details Same as default constructor
+                */
                CString(std::nullptr_t) noexcept;
+
+               /**
+                * @brief Move constructor
+                * @details Transfers ownership from source to the new object.
+                *          Source string pointer will become NULL.
+                * @param[in] s Source CString object
+                */
                CString(CString &&s) noexcept;
+
+               /**
+                * @brief Converting constructor
+                * @details Duplicates source std::string if it is not empty.
+                *          If std::string is empty NULL CString object will be created.
+                * @param[in] s Source std::string object
+                */
                CString(const std::string &s);
+
+               /**
+                * @brief Destructor
+                * @details Frees C-String pointer if not NULL
+                */
                ~CString() noexcept;
 
+               /**
+                * @brief Assigns one CString object to another
+                * @details Only move assignment is possible. Original will be deleted.
+                * @param[in] s Source CString object
+                * @return Reference to this CString object
+                */
                CString &operator=(CString s) noexcept;
 
-               bool isEmpty() const;
-
+               /**
+                * @brief Releases this CString object from C-String ownership
+                * @details This CString object will become NULL
+                * @return Pointer to underlying C-String
+                */
                char *release() noexcept;
 
+               /**
+                * @brief Gets underlying C-String pointer;
+                * @return Pointer to underlying C-String
+                */
                char *get() const noexcept;
 
        private:
@@ -48,6 +108,14 @@ namespace ucl {
        private:
                char *m_ptr;
        };
+
+       /**
+        * @brief Checks whether string is empty
+        * @details This is equivalent to: isEmpty(s.get());
+        * @param[in] s Reference to target CString object
+        * @return true if empty, false if not empty
+        */
+       bool isEmpty(const CString &s);
 }
 
 #include "CString.hpp"
index 086b3c26f02b2402ba2072bef92fc15f91f5673c..b7456f3a3a1712c62e8acba6c0b3bfebe8fb2d33 100644 (file)
@@ -67,11 +67,6 @@ namespace ucl {
                return *this;
        }
 
-       inline bool CString::isEmpty() const
-       {
-               return !m_ptr;
-       }
-
        inline char *CString::release() noexcept
        {
                char *const result = m_ptr;
@@ -90,4 +85,9 @@ namespace ucl {
        {
                std::swap(x.m_ptr, y.m_ptr);
        }
+
+       inline bool isEmpty(const CString &s)
+       {
+               return isEmpty(s.get());
+       }
 }
index e31967621c84fb87fa2bcbab024d0392253294e1..51bd3ca48343d816897a51f274b45a5221770f8d 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Represents managed constant C-String
+        */
        class ConstCString final : protected NonCopyable {
        public:
+               /**
+                * @brief Swaps ConstCString objects with each other
+                * @param[in/out] x First theme object
+                * @param[in/out] y Second theme object
+                */
                friend void swap(ConstCString &x, ConstCString &y) noexcept;
 
+               /**
+                * @brief Creates new ConstCString object by wrapping source C-String
+                * @param[in] ptr Pointer to source C-String
+                * @details Source C-String will not be freed in destructor.
+                *          Ownership can be transferred only using move constructors.
+                */
                static ConstCString wrap(const char *ptr) noexcept;
 
+               /**
+                * @brief Defatult constructor
+                * @details Creates NULL ConstCString object
+                */
                ConstCString() noexcept;
+
+               /**
+                * @brief Constructor
+                * @details Same as default constructor
+                */
                ConstCString(std::nullptr_t) noexcept;
+
+               /**
+                * @brief Move constructor
+                * @details Transfers ownership from source to the new object.
+                *          Source string pointer will not change.
+                * @param[in] s Source ConstCString object
+                */
                ConstCString(ConstCString &&s) noexcept;
+
+               /**
+                * @brief Move constructor
+                * @details Transfers ownership from source to the new object.
+                *          Source string pointer will become NULL.
+                * @param[in] s Source CString object
+                */
                ConstCString(CString &&s) noexcept;
+
+               /**
+                * @brief Destructor
+                * @details Frees C-String pointer if owner
+                */
                ~ConstCString() noexcept;
 
+               /**
+                * @brief Assigns one ConstCString object to another
+                * @details Only move assignment is possible. Original will be deleted.
+                * @param[in] s Source ConstCString object
+                * @return Reference to this ConstCString object
+                */
                ConstCString &operator=(ConstCString s) noexcept;
 
-               bool isEmpty() const;
-
+               /**
+                * @brief Gets underlying C-String pointer;
+                * @return Pointer to underlying C-String
+                */
                const char *get() const noexcept;
 
        private:
@@ -46,6 +96,14 @@ namespace ucl {
                const char *m_ptr;
                bool m_isOwner;
        };
+
+       /**
+        * @brief Checks whether string is empty
+        * @details This is equivalent to: isEmpty(s.get());
+        * @param[in] s Reference to target ConstCString object
+        * @return true if empty, false if not empty
+        */
+       bool isEmpty(const ConstCString &s);
 }
 
 #include "ConstCString.hpp"
index 50df6052b171464e6886d068dad2d8c29f56dedd..7089b529d36c88996857cafeb54b066ba05289d3 100644 (file)
@@ -66,11 +66,6 @@ namespace ucl {
                return *this;
        }
 
-       inline bool ConstCString::isEmpty() const
-       {
-               return !m_ptr;
-       }
-
        inline const char *ConstCString::get() const noexcept
        {
                return m_ptr;
@@ -83,4 +78,9 @@ namespace ucl {
                std::swap(x.m_ptr, y.m_ptr);
                std::swap(x.m_isOwner, y.m_isOwner);
        }
+
+       inline bool isEmpty(const ConstCString &s)
+       {
+               return isEmpty(s.get());
+       }
 }
index cd27f298bef42c3c9453249077076888520a5168..cb72292679e0a5a0669706a4fc4580d32b4e1bf8 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Implements event dispatching using specified DELEGATE class
+        */
        template <class DELEGATE>
        class Event final {
        public:
+               /**
+                * @brief Default constructor
+                */
                Event();
 
+               /**
+                * @brief Adds new delegate to the delegate list
+                * @param[in] delegate Delagate object to add.
+                *        DELEGATE2 must be convertible to DELEGATE
+                */
                template <class DELEGATE2>
                void operator+=(DELEGATE2 &&delegate);
+
+               /**
+                * @brief Removes existing delegate from the delegate list
+                * @param[in] delegate Delagate object to add.
+                *        DELEGATE2 must be comparable with DELEGATE
+                */
                template <class DELEGATE2>
                void operator-=(const DELEGATE2 &delegate);
 
+               /**
+                * @brief Checks if the delegate list is empty
+                * @return true - the delegate list is empty, false - not empty
+                */
                bool isEmpty() const;
 
+               /**
+                * @brief Dispatches event on delegates in list
+                * @details Delegates are called in order from old to new. If new
+                *          delegates will be added in the dispatch process they will
+                *          be ignored until next dispatch. It is possible to remove
+                *          existing delegate from list. Removed delagate will not be
+                *          invoked.
+                * @param[in] args Event dispatch arguments
+                */
                template <class ...ARGS>
                void dispatch(ARGS &&...args);
+
+               /**
+                * @brief Dispatches event on delegates using canceling predecate
+                * @details Same as dispatch() but with canceling predecate. Predicate
+                *          is called on each delegate invoke with the return result of
+                *          this invoke as single argument or no arguments if return
+                *          type is void. Predicate must return true if dispatch should
+                *          continue or false if it should stop. Result type of the
+                *          predicate may be any object convertible to bool.
+                * @param[in] args Event dispatch arguments
+                */
                template <class PREDICATE, class ...ARGS>
                void dispatchPred(PREDICATE &&pred, ARGS &&...args);
 
index 8470fed6ebdd33e23a2597c9afb54ae9f1a77570..ada832eda815b2471f5df69351d6e7d0570f9b58 100644 (file)
@@ -31,17 +31,51 @@ namespace ucl {
 
        using VarDict = Dict<Variant>;
 
+       /**
+        * @brief Represents simple to use HashMap collection
+        * @details Enumerations are supported as KEY type. Custom hashing function
+        *          may be specified for KEY using nested KEY::Hash functor.
+        */
        template <class KEY, class VALUE>
        class HashMap final {
        public:
+               /**
+                * @brief Sets value with specified key to the map
+                * @details Overrides existing values
+                * @param[in] key Key of the value
+                * @param[in] value Value
+                * @return Reference to this hashMap object
+                */
                template <class VALUE2>
                HashMap &set(const KEY &key, VALUE2 &&value);
+
+               /**
+                * @brief Unsets value with specified key from the map
+                * @details Removes existing value or do nothing
+                * @param[in] key Key of the value
+                * @return Reference to this hashMap object
+                */
                HashMap &unset(const KEY &key);
 
+               /**
+                * @brief Gets value with specified key from the map
+                * @param[in] key Key of the value
+                * @param[out] value Existing value if exists
+                * @return true - if value with key exists, false - not exists
+                */
                template <class VALUE2>
                bool get(const KEY &key, VALUE2 &value) const;
+
+               /**
+                * @brief Gets value with specified key from the map
+                * @param[in] key Key of the value
+                * @return Existing value if exists, or {} if not exists
+                */
                VALUE get(const KEY &key) const;
 
+               /**
+                * @brief Removes all values from the map
+                */
                void clear();
 
        private:
index 16604b2b085bbfea79c730e34a6a34776fcd9f9a..dd4c9bf4b2334eb76145bc39d3807681381558c1 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Represents observable value of type T by single observer
+        */
        template <class T>
        class MonoObservable final : protected NonCopyable {
        public:
+               /**
+                * @brief Swaps MonoObservable objects with each other
+                * @param[in/out] x First theme object
+                * @param[in/out] y Second theme object
+                */
                template <class U>
                friend void swap(MonoObservable<U> &x, MonoObservable<U> &y) noexcept;
 
        public:
+               /**
+                * @brief Defatult constructor
+                * @details Value will be initialized with {}
+                */
                MonoObservable() noexcept;
+
+               /**
+                * @brief Conversion constructor
+                * @param[in] value Source value
+                */
                explicit MonoObservable(T value) noexcept;
+
+               /**
+                * @brief Constructor
+                * @param[in] value Source value
+                * @param[in] handler Observer of the value change
+                */
                MonoObservable(T value, NotiHandler handler) noexcept;
+
+               /**
+                * @brief Move constructor
+                * @param[in] rv Source MonoObservable object
+                */
                MonoObservable(MonoObservable &&rv) noexcept;
 
+               /**
+                * @brief Assigns one MonoObservable object to another
+                * @details Only move assignment is possible. Original will be deleted.
+                * @param[in] s Source MonoObservable object
+                * @return Reference to this MonoObservable object
+                */
                MonoObservable &operator=(MonoObservable v) noexcept;
 
+               /**
+                * @brief Assigns an observer to this observable
+                * @param[in] handler Observer delegate (may be empty to remove)
+                */
                void setObserver(NotiHandler handler) noexcept;
 
+               /**
+                * @brief Gets value of this observable
+                * @return Constant reference to the value of this observable
+                */
                const T &getValue() const noexcept;
 
+               /**
+                * @brief Casts to the value of this observable
+                * @return Constant reference to the value of this observable
+                */
                operator const T &() const noexcept;
 
+               /**
+                * @brief Assigns new value to this observable
+                * @param[in] value New value
+                * @return Reference to this MonoObservable object
+                */
                MonoObservable &operator=(const T &value);
+
+               /**
+                * @brief Move-assigns new value to this observable
+                * @param[in] value New value
+                * @return Reference to this MonoObservable object
+                */
                MonoObservable &operator=(T &&value);
 
-       public:
+       private:
                T m_value;
                NotiHandler m_onValueChanged;
        };
index 4e180f40ac97d60729eee71513ffc6f881cd875a..0fc7209ba6e2710861f32dcc730d135a81e27f18 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Represents observable value of type T by multiple observers
+        */
        template <class T>
        class Observable final : protected NonCopyable {
        public:
+               /**
+                * @brief Swaps Observable objects with each other
+                * @param[in/out] x First theme object
+                * @param[in/out] y Second theme object
+                */
                template <class U>
                friend void swap(Observable<U> &x, Observable<U> &y) noexcept;
 
        public:
+               /**
+                * @brief Defatult constructor
+                * @details Value will be initialized with {}
+                */
                Observable() noexcept;
+
+               /**
+                * @brief Conversion constructor
+                * @param[in] value Source value
+                */
                explicit Observable(T value) noexcept;
+
+               /**
+                * @brief Move constructor
+                * @param[in] rv Source Observable object
+                */
                Observable(Observable &&rv) noexcept;
 
+               /**
+                * @brief Assigns one Observable object to another
+                * @details Only move assignment is possible. Original will be deleted.
+                * @param[in] s Source Observable object
+                * @return Reference to this Observable object
+                */
                Observable &operator=(Observable v) noexcept;
 
+               /**
+                * @brief Adds new observer to this observable
+                * @param[in] handler Observer delegate
+                */
                void addObserver(NotiHandler handler);
+
+               /**
+                * @brief Removes existing observer from this observable
+                * @param[in] handler Observer delegate
+                */
                void removeObserver(NotiHandler::CDRef handler);
 
+               /**
+                * @brief Gets value of this observable
+                * @return Constant reference to the value of this observable
+                */
                const T &getValue() const noexcept;
 
+               /**
+                * @brief Casts to the value of this observable
+                * @return Constant reference to the value of this observable
+                */
                operator const T &() const noexcept;
 
+               /**
+                * @brief Assigns new value to this observable
+                * @param[in] value New value
+                * @return Reference to this Observable object
+                */
                Observable &operator=(const T &value);
+
+               /**
+                * @brief Move-assigns new value to this observable
+                * @param[in] value New value
+                * @return Reference to this Observable object
+                */
                Observable &operator=(T &&value);
 
-       public:
+       private:
                T m_value;
                Event<NotiHandler> m_onValueChanged;
        };
index 2f4d4a2bf877f3066442a77030b99d0d42f808fd..7d2ff6e977e67e688557ffd6face20bda0e60191 100644 (file)
@@ -24,20 +24,56 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(RefCountAware);
 
+       /**
+        * @brief Base class for objects that aware if they are shared or not
+        */
        class RefCountAware : protected NonCopyable {
        public:
+               /**
+                * @brief Returns shared state of the object
+                * @return true - object is shared, false - no shared
+                */
                bool isShared() const;
+
+               /**
+                * @brief Returns count of shared references to this object if shared
+                * @return Count of shared references (0 on error)
+                */
                UInt getUseCount() const;
+
+               /**
+                * @brief Gets pointer to the allocated storage of this object
+                * @details Matches "this" of the instance's class.
+                * @return Pointer to the allocated storage of this object
+                */
                const void *getObjPtr() const;
 
+               /**
+                * @brief Creates shared reference to T from "this" pointer
+                * @param[in] thisAlias Pointer to "this" implicitly converted to "T *"
+                * @return Shared reference to T
+                */
                template <class T>
                SharedRef<T> asSharedThis(T *thisAlias) const;
 
+               /**
+                * @brief Creates weak reference to T from "this" pointer
+                * @param[in] thisAlias Pointer to "this" implicitly converted to "T *"
+                * @return Weak reference to T
+                */
                template <class T>
                WeakRef<T> asWeakThis(T *thisAlias) const;
 
        protected:
+               /**
+                * @brief Constructor
+                * @param[in] rc Pointer to IRefCountObj (may be NULL)
+                */
                RefCountAware(IRefCountObj *rc);
+
+               /**
+                * @brief Destructor
+                */
                ~RefCountAware() = default;
 
        private:
@@ -54,40 +90,106 @@ namespace ucl {
 
        // Non-member functions //
 
+       /**
+        * @brief Creates shared reference to specified object
+        * @param[in] obj Reference to target object
+        * @return Shared reference to specified object or NULL
+        */
        template <class T>
        SharedRef<T> asShared(T &obj);
+
+       /**
+        * @brief Creates shared reference to specified object
+        * @param[in] obj Pointer to target object
+        * @return Shared reference to specified object or NULL
+        */
        template <class T>
        SharedRef<T> asShared(T *obj);
 
+       /**
+        * @brief Creates weak reference to specified object
+        * @param[in] obj Reference to target object
+        * @return Weak reference to specified object or NULL
+        */
        template <class T>
        WeakRef<T> asWeak(T &obj);
+
+       /**
+        * @brief Creates weak reference to specified object
+        * @param[in] obj Pointer to target object
+        * @return Weak reference to specified object or NULL
+        */
        template <class T>
        WeakRef<T> asWeak(T *obj);
 
+       /**
+        * @brief Creates shared reference to T from specified object
+        * @param[in] obj Reference to target object
+        * @return Shared reference to specified object as T
+        */
        template <class T, class U, class = typename
                        std::enable_if<!std::is_same<T, U>::value>::type>
        SharedRef<T> asShared(U &obj);
+
+       /**
+        * @brief Creates shared reference to T from specified object
+        * @param[in] obj Pointer to target object
+        * @return Shared reference to specified object as T
+        */
        template <class T, class U, class = typename
                        std::enable_if<!std::is_same<T, U>::value>::type>
        SharedRef<T> asShared(U *obj);
 
+       /**
+        * @brief Creates weak reference to T from specified object
+        * @param[in] obj Reference to target object
+        * @return Weak reference to specified object as T
+        */
        template <class T, class U, class = typename
                        std::enable_if<!std::is_same<T, U>::value>::type>
        WeakRef<T> asWeak(U &obj);
+
+       /**
+        * @brief Creates weak reference to T from specified object
+        * @param[in] obj Pointer to target object
+        * @return Weak reference to specified object as T
+        */
        template <class T, class U, class = typename
                        std::enable_if<!std::is_same<T, U>::value>::type>
        WeakRef<T> asWeak(U *obj);
 
+       /**
+        * @brief Creates shared reference to T from specified constant object
+        * @param[in] obj Reference to target constant object
+        * @return Shared reference to specified constant object as T
+        */
        template <class T, class U, class = typename
                        std::enable_if<!std::is_same<T, const U>::value>::type>
        SharedRef<const T> asShared(const U &obj);
+
+       /**
+        * @brief Creates shared reference to T from specified constant object
+        * @param[in] obj Pointer to target constant object
+        * @return Shared reference to specified constant object as T
+        */
        template <class T, class U, class = typename
                        std::enable_if<!std::is_same<T, const U>::value>::type>
        SharedRef<const T> asShared(const U *obj);
 
+       /**
+        * @brief Creates weak reference to T from specified constant object
+        * @param[in] obj Reference to target constant object
+        * @return Weak reference to specified constant object as T
+        */
        template <class T, class U, class = typename
                        std::enable_if<!std::is_same<T, const U>::value>::type>
        WeakRef<const T> asWeak(const U &obj);
+
+       /**
+        * @brief Creates weak reference to T from specified constant object
+        * @param[in] obj Pointer to target constant object
+        * @return Weak reference to specified constant object as T
+        */
        template <class T, class U, class = typename
                        std::enable_if<!std::is_same<T, const U>::value>::type>
        WeakRef<const T> asWeak(const U *obj);
index 71ca2d994c5a9643a69d6de86abc9c6fff4e3090..7ce0e8a89b1e3ee9a11176f330a693b3d68f452c 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Represents translatable string
+        */
        class TString final {
        public:
+               /**
+                * @brief Default constructor
+                * @datails Creates empty string
+                */
                TString();
 
                /**
-                * Constructs TString from std::string and domain
-                *
-                * @param str     Text string or string id if translatable.
-                * @param domain  Valid domain name or "" for default domain,
-                *                nullptr - if string is not translatable
+                * @brief Constructor
+                * @details Constructs TString from std::string and domain
+                * @param[in] str Text string or string id if translatable
+                * @param[in] domain Valid domain name or "" for default domain,
+                *            NULL - if string is not translatable
                 */
                TString(const std::string &str, const char *domain);
+
+               /**
+                * @brief Constructor
+                * @details Constructs TString from std::string
+                * @param[in] str Text string or string id if translatable.
+                * @param[in] translatable true - translate using default domain,
+                *            false - if string is not translatable
+                */
                TString(const std::string &str, bool translatable = false);
 
+               /**
+                * @brief Constructor
+                * @details Constructs TString from temporrary std::string and domain
+                * @param[in] str Temporrary text string or string id if translatable
+                * @param[in] domain Valid domain name or "" for default domain,
+                *            NULL - if string is not translatable
+                */
                TString(std::string &&str, const char *domain);
+
+               /**
+                * @brief Constructor
+                * @details Constructs TString from temporrary std::string
+                * @param[in] str Temporrary text string or string id if translatable.
+                * @param[in] translatable true - translate using default domain,
+                *            false - if string is not translatable
+                */
                TString(std::string &&str, bool translatable = false);
 
+               /**
+                * @brief Constructor
+                * @details Constructs TString from C-String and domain
+                * @param[in] str Text string or string id if translatable
+                * @param[in] domain Valid domain name or "" for default domain,
+                *            NULL - if string is not translatable
+                */
                TString(const char *str, const char *domain);
+
+               /**
+                * @brief Constructor
+                * @details Constructs TString from C-String
+                * @param[in] str Text string or string id if translatable.
+                * @param[in] translatable true - translate using default domain,
+                *            false - if string is not translatable
+                */
                TString(const char *str, bool translatable = false);
 
+               /**
+                * @brief Checks if string is empty
+                * @return true - if empty, false - if not empty
+                */
                bool isEmpty() const;
 
+               /**
+                * @brief Gets translatable state of the string
+                * @return true - if translatable, false - if not translateable
+                */
                bool isTranslatable() const;
+
+               /**
+                * @brief Checks if string has translatable domain
+                * @return true - if has domain, false - otherwise (domain is NULL)
+                */
                bool hasDomain() const;
+
+               /**
+                * @brief Gets translatable domain of the string
+                * @return Translatable domain of the string,
+                *         "" - default,
+                *         NULL - not translatable
+                */
                const char *getDomain() const;
 
+               /**
+                * @brief Gets underlying std::string of the string
+                * @return Constant reference to the underlying std::string
+                */
                const std::string &getStr() const;
+
+               /**
+                * @brief Casts to underlying std::string of the string
+                * @return Constant reference to the underlying std::string
+                */
                operator const std::string &() const;
 
+               /**
+                * @brief Gets C-String of the underlying std::string
+                * @return Underlying C-String of the underlying std::string
+                */
                const char *getCStr() const;
+
+               /**
+                * @brief Casts to C-String of the underlying std::string
+                * @return Underlying C-String of the underlying std::string
+                */
                operator const char *() const;
 
+               /**
+                * @brief Translates the string if translatable
+                * @return Translated string or original if not translated
+                */
                const char *translate() const;
 
+               /**
+                * @brief Formats translation (if translatable) of the string
+                * @param[in] args Format arguments
+                * @return Formatted translation (if translatable) of the string
+                */
                template <typename ...ARGS>
                std::string format(ARGS ...args) const;
 
index ebff0320ddf32e8d3d088b88b2f3cde3ed6150c9..2f572a66da00dda794c9542d3e8ef75cb7c7383d 100644 (file)
@@ -26,13 +26,29 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(Timeout);
 
+       /**
+        * @brief Eecutes specific action after specified timeout
+        */
        class Timeout final : protected NonCopyable {
        public:
+               /**
+                * @brief Delegate of the timeout action
+                */
                using TimeoutHandler = WeakDelegate<void(Timeout *sender)>;
 
        public:
+               /**
+                * @brief Creates new Timeout object
+                * @param[in] timeoutSec Timeout value in seconds
+                * @param[in] handler Action of the timeout
+                * @return Shared reference to new Timeout object
+                */
                static TimeoutSRef create(double timeoutSec, TimeoutHandler handler);
 
+               /**
+                * @brief Gets expiration status of the timeout
+                * @return true - timeout is already expired, false - in progress
+                */
                bool isExpired() const;
 
        private:
index a07e10b693991adc324dfedccd52854ed1ec26d6..92c4f9bb1b08d70ad4715b91c2553b87ff0ea895 100644 (file)
@@ -32,8 +32,14 @@ namespace ucl {
        template <size_t N>
        using VarArray = std::array<Variant, N>;
 
+       /**
+        * @brief Represents value with dynamic type
+        */
        class Variant final {
        public:
+               /**
+                * @brief Enumeration of possible value types
+                */
                enum Type {
                        TYPE_NIL,
                        TYPE_BOOLEAN,
@@ -45,72 +51,326 @@ namespace ucl {
                };
 
        public:
+               /**
+                * @brief Swaps Variant objects with each other
+                * @param[in/out] x First theme object
+                * @param[in/out] y Second theme object
+                */
                friend void swap(Variant &x, Variant &y) noexcept;
 
+               /**
+                * @brief Compares equals two Variant objects by value
+                * @param[in] lhs Left hand side operand
+                * @param[in] rhs Right hand side operand
+                * @return true - if equal, false - not equal
+                */
                friend bool operator==(const Variant &lhs, const Variant &rhs) noexcept;
+
+               /**
+                * @brief Compares unequals two Variant objects by value
+                * @param[in] lhs Left hand side operand
+                * @param[in] rhs Right hand side operand
+                * @return true - if not equal, false - equal
+                */
                friend bool operator!=(const Variant &lhs, const Variant &rhs) noexcept;
 
        public:
+               /**
+                * @brief Default constructor
+                * @details Creates TYPE_NIL value
+                */
                Variant() noexcept;
+
+               /**
+                * @brief Constructor
+                * @details Same as deafult constructor
+                */
                Variant(std::nullptr_t) noexcept;
 
+               /**
+                * @brief Constructor
+                * @details Creates TYPE_BOOLEAN value
+                * @param[in] aBool Source value
+                */
                Variant(bool aBool) noexcept;
+
+               /**
+                * @brief Constructor
+                * @details Creates TYPE_INTEGER value
+                * @param[in] anInt Source value
+                */
                Variant(int anInt) noexcept;
+
+               /**
+                * @brief Constructor
+                * @details Creates TYPE_FLOAT value
+                * @param[in] aFloat Source value
+                */
                Variant(float aFloat) noexcept;
+
+               /**
+                * @brief Constructor
+                * @details Creates TYPE_DOUBLE value
+                * @param[in] aDouble Source value
+                */
                Variant(double aDouble) noexcept;
 
+               /**
+                * @brief Constructor
+                * @details Creates TYPE_STRING value
+                * @param[in] aString NULL-terminated source value
+                */
                Variant(const char *aString);
+
+               /**
+                * @brief Constructor
+                * @details Creates TYPE_STRING value
+                * @param[in] aString Source value
+                * @param[in] length Length of the string
+                */
                Variant(const char *aString, int length);
+
+               /**
+                * @brief Constructor
+                * @details Creates TYPE_STRING value
+                * @param[in] aString Source value
+                */
                Variant(const std::string &aString);
 
+               /**
+                * @brief Constructor
+                * @details Creates TYPE_ARRAY value
+                * @param[in] <std::nullptr_t> nullptr for all TYPE_NIL elements
+                * @param[in] arrayLength Length of the array
+                */
                Variant(std::nullptr_t, int arrayLength);
+
+               /**
+                * @brief Constructor
+                * @details Creates TYPE_ARRAY value
+                * @param[in] anArray Source Variant C-Array
+                * @param[in] length Length of the array
+                */
                Variant(const Variant *anArray, int length);
+
+               /**
+                * @brief Constructor
+                * @details Creates TYPE_ARRAY value
+                * @param[in] anArray Source std::vector<Variant>
+                */
                Variant(const VarVector &anArray);
+
+               /**
+                * @brief Constructor
+                * @details Creates TYPE_ARRAY value
+                * @param[in] anArray Source std::array<Variant, N>
+                */
                template <size_t N>
                Variant(const VarArray<N> &anArray);
+
+               /**
+                * @brief Constructor
+                * @details Creates TYPE_ARRAY value
+                * @param[in] anArray Source std::initializer_list<Variant>
+                */
                Variant(std::initializer_list<Variant> anArray);
 
+               /**
+                * @brief Destructor
+                */
                ~Variant();
 
+               /**
+                * @brief Copy constructor
+                * @param[in] v Source value
+                */
                Variant(const Variant &v);
+
+               /**
+                * @brief Move constructor
+                * @param[in] v Source value
+                */
                Variant(Variant &&v) noexcept;
 
+               /**
+                * @brief Assigns one Variant object to another
+                * @param[in] v Source value
+                * @return Reference to this Variant object
+                */
                Variant &operator=(Variant v);
 
+               /**
+                * @brief Gets type of the variant value
+                * @return Type of the value
+                */
                Type getType() const noexcept;
+
+               /**
+                * @brief Gets lengths of the value
+                * @return Lengths of string/array, 1 for other types and 0 for TYPE_NIL
+                */
                int getLength() const noexcept;
+
+               /**
+                * @brief Checks whether variant is empty
+                * @details This is equivalent to: (getLength() == 0);
+                * @return true if empty, false if not empty
+                */
                bool isEmpty() const noexcept;
 
+               /**
+                * @brief Reads current variant value as bool
+                * @return Value of the variant converted to bool:
+                *         as is - for boolean;
+                *         true - (numeric values != 0);
+                *         true - string in case insensitive
+                *                ("true", "yes", "ok", "on", "1");
+                *         true - (array length != 0);
+                *         false - otherwise
+                */
                bool asBool() const noexcept;
+
+               /**
+                * @brief Reads current variant value as int
+                * @return Value of the variant converted to int:
+                *         static_cast<int>() - all numeric values;
+                *         std::atoi() - for string;
+                *         length - for array;
+                *         0 - otherwise
+                */
                int asInt() const noexcept;
+
+               /**
+                * @brief Reads current variant value as float
+                * @return Value of the variant converted to float:
+                *         static_cast<float>() - all numeric values;
+                *         static_cast<float>(std::atof()) - for string;
+                *         static_cast<float>(length) - for array;
+                *         0.0f - otherwise
+                */
                float asFloat() const noexcept;
+
+               /**
+                * @brief Reads current variant value as double
+                * @return Value of the variant converted to double:
+                *         static_cast<double>() - all numeric values;
+                *         std::atof() - for string;
+                *         static_cast<double>(length) - for array;
+                *         0.0 - otherwise
+                */
                double asDouble() const noexcept;
 
+               /**
+                * @brief Reads current variant value as string
+                * @return Value of the variant converted to string:
+                *         as is - for string
+                *         "true"|"false" - for boolean;
+                *         printf("%d") - integer, array length;
+                *         printf("%f") - float and double;
+                *         "" - otherwise
+                */
                ConstCString asString() const noexcept;
 
+               /**
+                * @brief Reads current variant value as Variant C-Array
+                * @return Value of the variant converted as Variant C-Array
+                *         as is - for array
+                *         this - for simple value
+                */
                Variant *asArray() noexcept;
+
+               /**
+                * @brief Reads current variant value as constant Variant C-Array
+                * @return Value of the variant converted as constant Variant C-Array
+                *         as is - for array
+                *         this - for simple value
+                */
                const Variant *asArray() const noexcept;
 
+               /**
+                * @brief Gets begin iterator of this variant as an array
+                * @return Begin iterator
+                */
                Variant *begin() noexcept;
+
+               /**
+                * @brief Gets end iterator of this variant as an array
+                * @return End iterator
+                */
                Variant *end() noexcept;
+
+               /**
+                * @brief Gets begin constant iterator of this variant as an array
+                * @return Begin constant iterator
+                */
                const Variant *begin() const noexcept;
+
+               /**
+                * @brief Gets end constant iterator of this variant as an array
+                * @return End constant iterator
+                */
                const Variant *end() const noexcept;
 
+               /**
+                * @brief Gets indexed element of this variant as an array
+                * @param[in] index Index of the element
+                * @return Reference to indexed element
+                */
                Variant &operator[](int index) noexcept;
+
+               /**
+                * @brief Gets indexed constant element of this variant as an array
+                * @param[in] index Index of the element
+                * @return Reference to indexed constant element
+                */
                const Variant &operator[](int index) const noexcept;
 
+               /**
+                * @brief Explicitly casts to bool
+                * @details Same as asBool()
+                * @return Value of the variant converted to bool
+                */
                explicit operator bool() const noexcept;
+
+               /**
+                * @brief Explicitly casts to int
+                * @details Same as asInt()
+                * @return Value of the variant converted to int
+                */
                explicit operator int() const noexcept;
+
+               /**
+                * @brief Explicitly casts to float
+                * @details Same as asFloat()
+                * @return Value of the variant converted to float
+                */
                explicit operator float() const noexcept;
+
+               /**
+                * @brief Explicitly casts to double
+                * @details Same as asDouble()
+                * @return Value of the variant converted to double
+                */
                explicit operator double() const noexcept;
 
+               /**
+                * @brief Compares equals Variant object type with other type
+                * @param[in] rhs Right hand side operand
+                * @return true - if equal, false - not equal
+                */
                bool operator==(Variant::Type rhs) const noexcept;
+
+               /**
+                * @brief Compares unequals Variant object type with other type
+                * @param[in] rhs Right hand side operand
+                * @return true - if not equal, false - equal
+                */
                bool operator!=(Variant::Type rhs) const noexcept;
 
        private:
                const char *getStr() const noexcept;
 
-       public:
+       private:
                union {
                        uint8_t m_type;
                        struct {
index c56004c835eec1105b492a4471ad57873bba68c9..adf79dcf7bbd8f55ff6bacec1d05184222cb0438 100644 (file)
@@ -21,6 +21,9 @@
 
 namespace ucl {
 
+       /**
+        * @brief Represents delegate to handle simple notification events
+        */
        using NotiHandler = WeakDelegate<void()>;
 }
 
index d56e0bd056003e9f8a5f2945ccb209239c1bedab..c2942effd7aa80eecf25f9c42229a9923c3564b4 100644 (file)
@@ -27,59 +27,264 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(GuiPresenter);
 
+       /**
+        * @brief Base class for presenters with GUI
+        */
        class GuiPresenter : public RefCountAware {
        public:
+               /**
+                * @brief Information about deactivator that used in events
+                */
                struct DeactivatorInfo final {
+                       /**
+                        * @brief Deactivator pointer
+                        */
                        const void *deactivator;
+                       /**
+                        * @brief true - deactivator was broadcasted, false - otherwise
+                        */
                        bool isBroadcast;
                };
 
        public:
+               /**
+                * @brief Gets activation status
+                * @return true - if presenter is active, false - if not active
+                */
                bool isActive() const;
+
+               /**
+                * @brief Checks whether this presenter is deactivated
+                *        by specific deactivator
+                * @param[in] deactivator Pointer to the target deactivator
+                * @return true - if deactivated by the deactivator, false - otherwise
+                */
                bool isDeactivatedBy(const void *deactivator) const;
 
+               /**
+                * @brief Activates the presenter by specific deactivator
+                * @details If this presenter was not deactivated by the deactivator
+                *          this function has no effect, otherwise deactivation
+                *          imposed by the deactivator is lifted. Deactivator exception
+                *          does not affect this function.
+                * @param[in] deactivator Pointer to the target deactivator
+                */
                void activateBy(const void *deactivator);
+
+               /**
+                * @brief Deactivates the presenter by specific deactivator
+                * @details If this presenter is already deactivated by the deactivator
+                *          or listed in the deactivator exception list this function
+                *          has no effect, otherwise this presenter becomes deactivated
+                *          by the deactivator.
+                * @param[in] deactivator Pointer to the target deactivator
+                */
                void deactivateBy(const void *deactivator);
 
+               /**
+                * @brief Registers specific widget as a deactivator source
+                * @details This presenter will be automatically activated/deactivated
+                *          by the events send by the widget. These events may be send
+                *          directly by the call to sendActivate()/sendDeactivate()
+                *          methods or through parant's deactivator sink.
+                * @param[in] source Reference to the deactivator source widget
+                */
                void addDeactivatorSource(Widget &source);
+
+               /**
+                * @brief Deregisters specific widget as a deactivator source
+                * @param[in] source Reference to the deactivator source widget
+                */
                void delDeactivatorSource(Widget &source);
 
        protected:
+               /**
+                * @brief Enumeration of preparation flags
+                */
                enum {
+                       /**
+                        * @brief Indicates that new presenter needs to be automatically
+                        *        activated/deactivated by it's parent or broadcast events
+                        * @details This flag is needed for all presenters that needs to use
+                        *          isActive() property, which should be all presenters
+                        *          processing user events. Presenters that only display
+                        *          information (PASSIVE) does not require this flag.
+                        */
                        PF_ADD_DEACTIVATOR_SOURCES = 1,
+
+                       /**
+                        * @brief Indicates that new presenter needs to add self to the
+                        *        deactivator exception list
+                        * @details This flag is needed for all presenters that emit
+                        *          activate/deactivate events (DEACTIVATORs) because there
+                        *          is a big chance that this events may return to the
+                        *          calling presenter and cause undesired effect.
+                        */
                        PF_ADD_SELF_EXCEPT = 2,
 
+                       /**
+                        * @brief Helper flag set to use for PASSIVE presenters
+                        */
                        PF_PASSIVE = 0,
+
+                       /**
+                        * @brief Helper flag set to use for DEACTIVATOR presenters
+                        */
                        PF_DEACTIVATOR = (PF_ADD_DEACTIVATOR_SOURCES | PF_ADD_SELF_EXCEPT),
+
+                       /**
+                        * @brief Helper flag set to use for not PASSIVE not DEACTIVATOR
+                        *        presenters
+                        */
                        PF_DEFAULT = PF_ADD_DEACTIVATOR_SOURCES
                };
 
        protected:
+               /**
+                * @brief Constructor
+                * @param[in] rc Pointer to IRefCountObj (passed automatically)
+                */
                GuiPresenter(IRefCountObj &rc);
+
+               /**
+                * @brief Destructor
+                */
                ~GuiPresenter();
 
+               /**
+                * @brief Prepares this presenter instance as a root presenter
+                * @details Specified widget must have a Window as a top level parent.
+                * @param[in] widget Any widget to which tree this presenter
+                *            should belong
+                * @param[in] flags Preparation flags (optional: PF_DEFAULT)
+                * @retrun RES_OK on success, error otherwise
+                */
                Result prepare(ElmWidget &widget, int flags = PF_DEFAULT);
+
+               /**
+                * @brief Prepares this presenter instance as a child presenter
+                * @details Parent presenter must have deactivator sink registered
+                *          unless this presenter does not specify
+                *          PF_ADD_DEACTIVATOR_SOURCES flag.
+                * @param[in] parent Reference to the parent presenter
+                * @param[in] flags Preparation flags (optional: PF_DEFAULT)
+                * @retrun RES_OK on success, error otherwise
+                */
                Result prepare(GuiPresenter &parent, int flags = PF_DEFAULT);
 
+               /**
+                * @brief Gets reference to the Window widget
+                * @details If Window was not initialized application will terminate
+                *          with assertion.
+                */
                Window &getWindow();
+
+               /**
+                * @brief Gets shared reference to the Window widget
+                * @details Use in destructor and check for NULL, because destructor
+                *          is always called event after prepare() failure
+                *          (Window may be not initialized yet).
+                */
                WindowSRef getWindowRef();
 
+               /**
+                * @brief Adds specific deactivator as exception
+                * @details All deactivating functionality will ignore specified
+                *          deactivator. Note however that this does not cancel any
+                *          deactivation effect that was imposed by this deactivator
+                *          before adding exception. Therefore, activation functionality
+                *          will work fo this deactivator.
+                * @param[in] deactivator Pointer to the target deactivator
+                */
                void addDeactivatorException(const void *deactivator);
+
+               /**
+                * @brief Sets specified widget as deactivator sink fo this presenter
+                * @details All activate/deactivate actions that occurs on this
+                *          presenter will be send as events on this widget. This
+                *          function needs to be called if this presenter may be a
+                *          parent for other presenters. This will enable propagation of
+                *          activate/deactivate actions from parent to children.
+                * @param[in] sink Shared reference to the event sink widget
+                */
                void setDeactivatorSink(const WidgetSRef &sink);
 
+               /**
+                * @brief Gets deactivator that can be used for self deactivation
+                * @details Self deactivator pointer is garanteed to be unique and
+                *          unknown for external code. So it is not possible to
+                *          accidentally deactivate this presenter by this deactivator
+                *          from external code.
+                * @return Pointer to the deactivator
+                */
                const void *getSelfDeactivator() const;
+
+               /**
+                * @brief Activates self using self deactivator
+                */
                void activateSelf();
+
+               /**
+                * @brief Deactivates self using self deactivator
+                */
                void deactivateSelf();
 
+               /**
+                * @brief Sends activation event using specified widget sender
+                * @details All presenters that added this widget as a deactivator
+                *          source will be activate by this event.
+                * @param[in] sender Reference to sender widgets
+                */
                void sendActivate(Widget &sender);
+
+               /**
+                * @brief Sends deactivation event using specified widget sender
+                * @details All presenters that added this widget as a deactivator
+                *          source will be deactivated by this event.
+                * @param[in] sender Reference to sender widgets
+                */
                void sendDeactivate(Widget &sender);
 
+               /**
+                * @brief Broadcasts activation event
+                * @details All root presenters with PF_ADD_DEACTIVATOR_SOURCES flag
+                *          will be activate by this event.
+                */
                void broadcastActivate();
+
+               /**
+                * @brief Broadcasts deactivation event
+                * @details All root presenters with PF_ADD_DEACTIVATOR_SOURCES flag
+                *          will be deactivated by this event.
+                */
                void broadcastDeactivate();
 
+               /**
+                * @brief Occurs when this presenter becomes active
+                * @details This event occurs after onActivateBy().
+                */
                virtual void onActivate();
+
+               /**
+                * @brief Occurs when this presenter becomes inactive
+                * @details This event occurs after onDeactivateBy().
+                */
                virtual void onDeactivate();
+
+               /**
+                * @brief Occurs when this presenter is first time activated by
+                *        specific deactivator
+                * @details This event occurs after processing the deactivator sink.
+                * @param[in] info Deactivator info of the deactivator
+                */
                virtual void onActivateBy(const DeactivatorInfo &info);
+
+               /**
+                * @brief Occurs when this presenter is first time deactivated by
+                *        specific deactivator
+                * @details This event occurs after processing the deactivator sink.
+                * @param[in] info Deactivator info of the deactivator
+                */
                virtual void onDeactivateBy(const DeactivatorInfo &info);
 
        private:
index c0b221daa990f6fe4762baec05a0c3f3c268fd54..fdd20b9fa945f445fe6748f23cdd1a0316dd75b8 100644 (file)
@@ -23,10 +23,21 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(IPickable);
 
+       /**
+        * @brief Abstract interface for a object that can be picked (selected)
+        */
        class IPickable : protected NonCopyable {
        public:
+               /**
+                * @brief Gets IPicker interface to perform picking
+                * @return Reference to IPicker interface
+                */
                virtual IPicker &getPicker() = 0;
+
        protected:
+               /**
+                * @brief Destructor
+                */
                ~IPickable() = default;
        };
 }
index c071a87a4bad3f33a702b088ddf42a7f3e88f6d3..4fb69595bc18f74782655d614754b3b7f7986063 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Abstract interface to perform picking process on item (selection)
+        */
        class IPicker : protected NonCopyable {
        public:
+               /**
+                * @brief Assigns a picker host to this picker
+                * @details Picker host is handles global activities of
+                *          a picking process
+                * @param[in] host Weak reference to a IPickerHost implementation
+                */
                virtual void setPickerHost(IPickerHostWRef host) = 0;
+
+               /**
+                * @brief Sets a picked state to this picker
+                * @details This function may not update any related states
+                *          (such as GUI representing a new state). All synchronizations
+                *          need to be performed eternally.
+                * param[in] isPicked A picked state. true - picked, false - not picked
+                */
                virtual void setPicked(bool isPicked) = 0;
+
+               /**
+                * @brief Updates a picked state to this picker
+                * @details This function is also updates any related states (such as
+                *          GUI representing a new state).
+                * param[in] isPicked A picked state. true - picked, false - not picked
+                */
                virtual void updatePicked(bool isPicked) = 0;
+
+               /**
+                * @brief Gets current picked state of this picker
+                * @return Current picked state. true - picked, false -not picked.
+                */
                virtual bool isPicked() const = 0;
+
        protected:
+               /**
+                * @brief Destructor
+                */
                ~IPicker() = default;
        };
 }
index 7ea04e210dc1c5e36a81c64efe1c217dcec6569d..9e7cad68a868912bec551cd3afe43e13dfc0c813 100644 (file)
@@ -23,12 +23,40 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(IPickerHost);
 
+       /**
+        * @brief Abstract interface that handles global activities of
+        *        a picking process
+        */
        class IPickerHost : protected NonCopyable {
        public:
+               /**
+                * @brief Increments count of picked items
+                * @details This method must be called whenewer picked state of the
+                *          IPicker changes internally without calls to setPicked() or
+                *          updatePicked() functions (by the user from GUI).
+                */
                virtual void incrementPickCounter() = 0;
+
+               /**
+                * @brief Decrements count of picked items
+                * @details This method must be called whenewer picked state of the
+                *          IPicker changes internally without calls to setPicked() or
+                *          updatePicked() functions (by the user from GUI).
+                */
                virtual void decrementPickCounter() = 0;
+
+               /**
+                * @brief Returs pick mode state
+                * @details None of the modifying function of this iterface must be
+                *          called if pick mode is not active.
+                * @return Pick mode state. true - active, false - not active.
+                */
                virtual bool isPickModeActive() const = 0;
+
        protected:
+               /**
+                * @brief Destructor
+                */
                ~IPickerHost() = default;
        };
 }
index b31c29caf7f0430d48f5e2a55293911fcb045fb3..bda4546c06b2fd419525d8d93dba0d62f93abff4 100644 (file)
@@ -28,16 +28,48 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(ListItemPresenter);
 
+       /**
+        * @brief Represents presenter of the ListPresenter item
+        */
        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
+                */
                Result updateItem();
+
+               /**
+                * @brief Scrolls GUI item of this item to specific position
+                *        with animation
+                * @param[in] type Scroll type (optional: ELM_GENLIST_ITEM_SCROLLTO_IN)
+                */
                Result bringInItem(Elm_Genlist_Item_Scrollto_Type type =
                                ELM_GENLIST_ITEM_SCROLLTO_IN);
+
+               /**
+                * @brief Scrolls GUI item of this item to specific position
+                *        without animation
+                * @param[in] type Scroll type (optional: ELM_GENLIST_ITEM_SCROLLTO_IN)
+                */
                Result showItem(Elm_Genlist_Item_Scrollto_Type type =
                                ELM_GENLIST_ITEM_SCROLLTO_IN);
 
+               /**
+                * @brief Sets GUI item Atspi gesture event handler
+                * @param[in] handler Handler of the event
+                */
+               void setItemAtspiGestureHandler(AtspiGestureHandler handler);
 
                // IDisposable //
 
@@ -48,32 +80,97 @@ namespace ucl {
                UCL_DECLARE_REF_ALIASES(ItemClass);
                UCL_DECLARE_REF_ALIASES(ItemClassCache);
 
-               // Flags
+               /**
+                * @brief Enumeration of behaviour flags
+                */
                enum {
+                       /**
+                        * @brief Automatically unselect GUI item in select callback
+                        */
                        PF_AUTO_UNSELECT = 1
                };
 
+               /**
+                * @brief Information about GUI item that is used when this item is
+                *        inserted into the ListPresenter
+                */
                struct ItemInsertionParams {
+                       /**
+                        * @brief GUI item style
+                        */
                        ElmStyle itemStyle;
+
+                       /**
+                        * @brief GUI item type
+                        */
                        GenlistItem::Type itemType;
 
+                       /**
+                        * @brief Constructor
+                        * @param[in] itemStyle GUI item style
+                        * @param[in] itemType GUI item type
+                        *            (optional: GenlistItem::Type::SIMPLE)
+                        */
                        ItemInsertionParams(ElmStyle itemStyle,
                                        GenlistItem::Type itemType = GenlistItem::Type::SIMPLE) :
                                itemStyle(itemStyle), itemType(itemType) {}
                };
 
+               /**
+                * @brief Information that is used to create GUI for pick mode
+                */
                struct ItemPickModeParams {
+                       /**
+                        * @brief Part in GUI item for check widget
+                        */
                        EdjePart checkPart;
+
+                       /**
+                        * @brief Style of the check widget
+                        */
                        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
+                        */
                        bool isValid() const;
                };
 
+               /**
+                * @brief Represents GUI item class
+                */
                class ItemClass final : protected NonCopyable {
                public:
+                       /**
+                        * @brief Creates new instance of ItemClass object
+                        * @param[in] itemStyle GUI item style of new item class
+                        */
                        static ItemClassSRef newInstance(ElmStyle itemStyle);
+
                public:
+                       /**
+                        * @brief Gets native Elementary genlist itm class object
+                        * @return Pointer to the underlying Elementary genlist ITC
+                        */
                        Elm_Genlist_Item_Class *get();
+
                private:
                        ItemClass(ElmStyle itemStyle, Private);
                        ~ItemClass();
@@ -82,49 +179,183 @@ namespace ucl {
                        friend class ReffedObj<ItemClass>;
                };
 
+               /**
+                * @brief Cache storage and factory for ItemClass objects
+                */
                class ItemClassCache final : protected NonCopyable {
                public:
+                       /**
+                        * @brief Gets an instance of ItemClass object (new or from cache)
+                        * @param[in] itemStyle GUI item style of item class
+                        */
                        ItemClassSRef getItemClass(ElmStyle itemStyle);
+
+                       /**
+                        * Removes all cached objects
+                        */
                        void purge();
+
                private:
                        HashMap<ElmStyle, ItemClassSRef> m_itcMap;
                };
 
        protected:
+               /**
+                * @brief Constructor
+                * @param[in] rc Pointer to IRefCountObj (passed automatically)
+                */
                ListItemPresenter(IRefCountObj &rc);
+
+               /**
+                * @brief Destructor
+                */
                ~ListItemPresenter();
 
+               /**
+                * @brief Sets behaviour flags to this item presenter
+                * @param[in] flags New behaviour flags
+                */
                void setFlags(int flags);
+
+               /**
+                * @brief Gets behaviour flags from this item presenter
+                * @return Current behaviour flags
+                */
                int getFlags() const;
 
+               /**
+                * @brief Gets activation status of this item presenter
+                * @return true - if presenter is active, false - if not active
+                */
                bool isActive() const;
 
+               /**
+                * @brief Gets pick mode activation status
+                * @return true - active, false - not active
+                */
                bool isPickModeActive() const;
+
+               /**
+                * @brief Handles item pick event
+                * @param[in] isPicked New item picked state.
+                *            true - picked, false - not picked
+                */
                void handleItemPick(bool isPicked);
 
+               /**
+                * @brief Gets attached GUI item of this item presenter
+                * @return Attached GUI item
+                */
                GenlistItem getItem();
+
+               /**
+                * @brief Gets Atspi of attached GUI item of this presenter
+                * @return Pointer to Atspi of attached GUI item or NULL
+                */
+               Atspi *getItemAtspi();
+
+               /**
+                * @brief Gets constant Atspi of attached GUI item of this presenter
+                * @return Pointer to Constant Atspi of attached GUI item or NULL
+                */
+               const Atspi *getItemAtspi() const;
+
+               /**
+                * @brief Gets attached GUI item class cache of this item presenter
+                * @return Attached GUI item class cache
+                */
                ItemClassCache *getItemClassCache();
 
+               /**
+                * @brief Updates GUI item style
+                * @details Internally uses item class cache to get GUI item class for
+                *          specified GUI item style.
+                * @param[in] newItemStyle New GUI item style to apply
+                * @return RES_OK on success, error otherwise
+                */
                Result updateItemStyle(ElmStyle newItemStyle);
 
+               /**
+                * @brief Creates GUI item part content for pick mode if in pick mode
+                * @param[in] part Edje part for which to try create the content widget
+                * @param[in] parent Parent widget to use for the content widget
+                * @param[in] params Parameters for the content widget creation
+                * @return Shared reference to the content widget or NULL
+                */
                WidgetSRef tryCreatePickModeItemPartContent(
                                EdjePart part, ElmWidget &parent,
                                const ItemPickModeParams &params);
 
+               /**
+                * @brief Return GUI item insertion parameters
+                * @details Called just before item is added to list
+                * @return Item insertion params structure
+                */
                virtual ItemInsertionParams getItemInsertionParams() = 0;
 
+               /**
+                * @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();
+
+               /**
+                * @brief Occurs when GUI item is detached from this item presenter
+                * @details Called when GUI item is removed.
+                */
                virtual void onItemDetached();
 
+               /**
+                * @brief Gets text for specific GUI item part
+                * @param[in] part Target GUI item part
+                * @return Text for specific part or NULL
+                */
                virtual CString getItemPartText(EdjePart part);
+
+               /**
+                * @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 WidgetSRef getItemPartContent(EdjePart part, ElmWidget &parent);
+
+               /**
+                * @brief Gets state for specific GUI item part
+                * @param[in] part Target GUI item part
+                * @return State of the part
+                */
                virtual bool getItemPartState(EdjePart part);
 
+               /**
+                * @brief Occurs when GUI item is selected
+                */
                virtual void onItemSelected();
+
+               /**
+                * @brief Occurs when GUI item is realized
+                */
                virtual void onItemRealized();
+
+               /**
+                * @brief Occurs when GUI item is unrealized
+                */
                virtual void onItemUnrealized();
+
+               /**
+                * @brief Occurs when GUI item is highlighted
+                */
                virtual void onItemHighlighted();
+
+               /**
+                * @brief Occurs when GUI item is unhighlighted
+                */
                virtual void onItemUnhighlighted();
+
+               /**
+                * @brief Occurs when GUI item is long pressed
+                */
                virtual void onItemLongpressed();
 
                // IPicker //
@@ -135,27 +366,33 @@ namespace ucl {
                virtual bool isPicked() const final override;
 
        private:
-               void attachItem(GenlistItem item,
-                               ElmWidgetSRef &&parent,
-                               const ItemClassCacheSRef &itcCache,
-                               const SharedRef<bool> &isActiveRef);
+               void attachItem(GenlistItem item, ElmWidgetSRef parent,
+                               ItemClassCacheSRef itcCache, SharedRef<bool> isActiveRef);
 
                void deleteDetachedItem(bool silent = false);
                void detachItem(bool silent = false);
+               void tryEnsureItemAtspi();
+               void tryListenToItemAtspiGesture();
 
                void onPickCheckChanged(Widget &widget, void *eventInfo);
                void onItemSelectedHook();
                void onItemDel(Evas_Object *obj, void *eventInfo);
+               void onItemAtspiGesture(Atspi &atspi, AtspiGestureEventInfo &eventInfo);
 
        private:
                ListItemPresenterSRef m_selfRef;
                IPickerHostWRef m_pickerHost;
+               AtspiGestureHandler m_itemAtspiGestureHandler;
+
                GenlistItem m_item;
+               AtspiSRef m_itemAtspi;
+               ElmWidgetSRef m_parent;
                ItemClassCacheSRef m_itcCache;
                SharedRef<bool> m_isActiveRef;
-               ElmWidgetSRef m_parent;
+
                int m_flags;
                bool m_isItemPicked;
+               bool m_isListeningToItemAtspiGesture;
 
                friend class ListPresenter;
        };
index 7f39899373ac537b8aa6cd238251d7dad6fc732e..1415c059e8236ecd029eee150602a25b798177bd 100644 (file)
@@ -26,27 +26,94 @@ namespace ucl {
 
        UCL_DECLARE_REF_ALIASES(ListPresenter);
 
+       /**
+        * @brief Represents presenter of item list using Genlist widget
+        */
        class ListPresenter final : public GuiPresenter {
        public:
+               /**
+                * @brief Enumeration of build flags
+                */
                enum {
+                       /**
+                        * @brief Need to apply homogeneous mode to genlist
+                        */
                        FLAG_HOMOGENEOUS = (1 << 0),
+
+                       /**
+                        * @brief Need to calculate X min size hint for genlist
+                        */
                        FLAG_CALC_X_MIN = (1 << 1),
+
+                       /**
+                        * @brief Need to calculate Y min size hint for genlist
+                        */
                        FLAG_CALC_Y_MIN = (1 << 2),
 
+                       /**
+                        * @brief Need to notify item realized event
+                        */
                        FLAG_NOTIFY_REALIZED = (1 << 8),
+
+                       /**
+                        * @brief Need to notify item unrealized event
+                        */
                        FLAG_NOTIFY_UNREALIZED = (1 << 9),
+
+                       /**
+                        * @brief Need to notify item highlighted event
+                        */
                        FLAG_NOTIFY_HIGHLIGHTED = (1 << 10),
+
+                       /**
+                        * @brief Need to notify item unhighlighted event
+                        */
                        FLAG_NOTIFY_UNHIGHLIGHTED = (1 << 11),
+
+                       /**
+                        * @brief Need to notify item long pressed event
+                        */
                        FLAG_NOTIFY_LONGPRESSED = (1 << 12),
                };
 
+               /**
+                * @brief Builder of ListPresenter objects
+                */
                class Builder final {
                public:
+                       /**
+                        * @brief Constructor
+                        */
                        Builder();
+
+                       /**
+                        * @brief Sets genlist style of the future object
+                        * @param[in] style Genlist Style of the future object
+                        * @return Reference to this builder
+                        */
                        Builder &setStyle(ElmStyle style);
+
+                       /**
+                        * @brief Sets build flags for the future object
+                        * @param[in] flags Build flags for the future object
+                        * @return Reference to this builder
+                        */
                        Builder &setFlags(int flags);
+
+                       /**
+                        * @brief Sets genlist parent widget of the future object
+                        * @param[in] parentWidget Genlist parent widget
+                        * @return Reference to this builder
+                        */
                        Builder &setParentWidget(const ElmWidgetSRef &parentWidget);
+
+                       /**
+                        * @brief Creates new ListPresenter object using current parameters
+                        * @param[in] parent Reference to parent presenter
+                        * @return Shared reference to new ListPresenter object or NULL
+                        */
                        ListPresenterSRef build(GuiPresenter &parent) const;
+
                private:
                        ucl::ElmWidgetSRef m_parentWidget;
                        ElmStyle m_style;
@@ -54,20 +121,53 @@ namespace ucl {
                };
 
        public:
+               /**
+                * @brief Gets underlying genlist widget
+                * @return Reference to the Genlist object
+                */
                Genlist &getWidget();
 
+               /**
+                * @brief Removes all items from the list
+                */
                void clear();
 
+               /**
+                * @brief Appends an item to the list
+                * @param[in] itemPresenter Reference to the target item
+                * @param[in] parent Parent item (optional)
+                * @return RES_OK on success, error otherwise
+                */
                Result append(ListItemPresenter &itemPresenter,
                                ListItemPresenter *parent = nullptr);
 
+               /**
+                * @brief Prepends an item to the list
+                * @param[in] itemPresenter Reference to the target item
+                * @param[in] parent Parent item (optional)
+                * @return RES_OK on success, error otherwise
+                */
                Result prepend(ListItemPresenter &itemPresenter,
                                ListItemPresenter *parent = nullptr);
 
+               /**
+                * @brief Inserts an item to the list after specific item in this list
+                * @param[in] after Reference to the "after" item
+                * @param[in] itemPresenter Reference to the target item
+                * @param[in] parent Parent item (optional)
+                * @return RES_OK on success, error otherwise
+                */
                Result insertAfter(const ListItemPresenter &after,
                                ListItemPresenter &itemPresenter,
                                ListItemPresenter *parent = nullptr);
 
+               /**
+                * @brief Inserts an item to the list before specific item in this list
+                * @param[in] before Reference to the "before" item
+                * @param[in] itemPresenter Reference to the target item
+                * @param[in] parent Parent item (optional)
+                * @return RES_OK on success, error otherwise
+                */
                Result insertBefore(const ListItemPresenter &before,
                                ListItemPresenter &itemPresenter,
                                ListItemPresenter *parent = nullptr);
index e02de8d5f885b9d79f4eb5e4240bb60fb22b115a..11805b9cce8ec82afe5018a8da1b17049960550c 100644 (file)
@@ -27,32 +27,96 @@ namespace ucl {
        template <class FUNC_SIG, class DATA>
        class BaseDelegate2;
 
+       /**
+        * @brief Base class for implementing delegates with 1 function stub
+        */
        template <class R, class ...ARGS, class DATA>
        class BaseDelegate<R(ARGS...), DATA> {
        public:
+               /**
+                * @brief Callback of this delegate
+                */
                using Cb = Callback<R(ARGS...)>;
+
+               /**
+                * @brief StubA function pointer type of this delegate
+                */
                using StubA = typename Cb::StubA;
 
        public:
+               /**
+                * @brief Default constructor
+                * @details Creates NULL delegate
+                */
                constexpr BaseDelegate() noexcept;
+
+               /**
+                * @brief Constructor
+                * @details Safe as default constructor
+                */
                constexpr BaseDelegate(std::nullptr_t) noexcept;
 
+               /**
+                * @brief Conversion constructor from BaseDelegate2
+                * @param[in] d Source delegate
+                */
                template <class FUNC_SIG>
                BaseDelegate(const BaseDelegate2<FUNC_SIG, DATA> &d) noexcept;
+
+               /**
+                * @brief Conversion move constructor from BaseDelegate2
+                * @param[in] d Source delegate
+                */
                template <class FUNC_SIG>
                BaseDelegate(BaseDelegate2<FUNC_SIG, DATA> &&d) noexcept;
 
+               /**
+                * @brief Resets this delegate to NULL
+                */
                void reset() noexcept;
 
+               /**
+                * @brief Gets bound object data pointer
+                * @details May be used to invoke this delegate from C code.
+                * @return Bound object data pointer
+                */
                const DATA &getData() const noexcept;
+
+               /**
+                * @brief Gets bound StubA function pointer
+                * @details May be used to invoke this delegate from C code.
+                * @return Pointer to bound StubA function
+                */
                StubA getStubA() const noexcept;
+
+               /**
+                * @brief Checks if this delegate is not NULL
+                * @return true - if not NULL, false - if NULL
+                */
                explicit operator bool() const noexcept;
 
        protected:
+               /**
+                * @brief Constructor
+                * @param[in] data Object data pointer
+                * @param[in] stubA StubA function pointer
+                */
                BaseDelegate(DATA data, StubA stubA) noexcept;
 
+               /**
+                * @brief Destructor
+                */
+               ~BaseDelegate() = default;
+
        protected:
+               /**
+                * @brief Bound object data pointer
+                */
                DATA m_data;
+
+               /**
+                * @brief Bound StubA function pointer
+                */
                StubA m_stubA;
        };
 }
index dc84bc1e14eee0ded6583893bc57be5c69936e96..c47d611f16f12d2fa1a0ca928606f754ec577f05 100644 (file)
@@ -24,23 +24,56 @@ namespace ucl {
        template <class FUNC_SIG, class DATA>
        class BaseDelegate2;
 
+       /**
+        * @brief Base class for implementing delegates with 2 function stub
+        */
        template <class R, class ...ARGS, class DATA>
        class BaseDelegate2<R(ARGS...), DATA> :
                        public BaseDelegate<R(ARGS...), DATA> {
        public:
+               /**
+                * @brief Callback of this delegate
+                */
                using Cb = typename BaseDelegate2::Cb;
+
+               /**
+                * @brief StubA function pointer type of this delegate
+                */
                using StubA = typename Cb::StubA;
+
+               /**
+                * @brief StubB function pointer type of this delegate
+                */
                using StubB = typename Cb::StubB;
 
        public:
                using BaseDelegate<R(ARGS...), DATA>::BaseDelegate;
 
+               /**
+                * @brief Gets bound StubB function pointer
+                * @details May be used to invoke this delegate from C code.
+                * @return Pointer to bound StubB function
+                */
                StubB getStubB() const noexcept;
 
        protected:
+               /**
+                * @brief Constructor
+                * @param[in] data Object data pointer
+                * @param[in] stubA StubA function pointer
+                * @param[in] stubB StubB function pointer
+                */
                BaseDelegate2(DATA data, StubA stubA, StubB stubB) noexcept;
 
+               /**
+                * @brief Destructor
+                */
+               ~BaseDelegate2() = default;
+
        private:
+               /**
+                * @brief Bound StubB function pointer
+                */
                StubB m_stubB;
        };
 }
index 69724bebce4333d21ea6e2f098fdf31e4a7cfbcf..76a7345f21d75056c286320ebd17c12a45e932e5 100644 (file)
@@ -24,47 +24,153 @@ namespace ucl {
        template <class FUNC_SIG>
        class Callback;
 
+       /**
+        * @brief Generates function stubs to use in callbacks and delegates
+        */
        template <class R, class ...ARGS>
        class Callback<R(ARGS...)> {
        public:
+               /**
+                * @brief StubA function pointer type
+                * @details This function takes data argument as first parameter
+                */
                using StubA = R(*)(void *, ARGS...);
+
+               /**
+                * @brief StubB function pointer type
+                * @details This function takes data argument as last parameter
+                */
                using StubB = R(*)(ARGS..., void *);
 
        public:
+               /**
+                * @brief Wraps instance method as StubA
+                * @param[in] data This pointer of the instance
+                * @param[in] args Method arguments
+                * @return R Result of the method call
+                */
                template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
                static R stubA(void *data, ARGS ...args);
+
+               /**
+                * @brief Wraps instance method as StubB
+                * @param[in] args Method arguments
+                * @param[in] data This pointer of the instance
+                * @return R Result of the method call
+                */
                template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
                static R stubB(ARGS ...args, void *data);
 
+               /**
+                * @brief Wraps constant instance method as StubA
+                * @param[in] data This pointer of the instance
+                * @param[in] args Method arguments
+                * @return R Result of the method call
+                */
                template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
                static R stubA(void *data, ARGS ...args);
+
+               /**
+                * @brief Wraps constant instance method as StubB
+                * @param[in] args Method arguments
+                * @param[in] data This pointer of the instance
+                * @return R Result of the method call
+                */
                template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
                static R stubB(ARGS ...args, void *data);
 
+               /**
+                * @brief Wraps StubA-style function taking object as StubA
+                * @param[in] data Pointer of the object
+                * @param[in] args Function arguments
+                * @return R Result of the function call
+                */
                template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
                static R stubA2A(void *data, ARGS ...args);
+
+               /**
+                * @brief Wraps StubA-style function taking object as StubB
+                * @param[in] args Function arguments
+                * @param[in] data Pointer of the object
+                * @return R Result of the function call
+                */
                template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
                static R stubB2A(ARGS ...args, void *data);
 
+               /**
+                * @brief Wraps StubB-style function taking object as StubA
+                * @param[in] data Pointer of the object
+                * @param[in] args Function arguments
+                * @return R Result of the function call
+                */
                template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
                static R stubA2B(void *data, ARGS ...args);
+
+               /**
+                * @brief Wraps StubB-style function taking object as StubB
+                * @param[in] args Function arguments
+                * @param[in] data Pointer of the object
+                * @return R Result of the function call
+                */
                template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
                static R stubB2B(ARGS ...args, void *data);
 
+               /**
+                * @brief Wraps StubA-style function taking object handle as StubA
+                * @param[in] data Handle of the object
+                * @param[in] args Function arguments
+                * @return R Result of the function call
+                */
                template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
                static R stubA2A(void *data, ARGS ...args);
+
+               /**
+                * @brief Wraps StubA-style function taking object handle as StubB
+                * @param[in] args Function arguments
+                * @param[in] data Handle of the object
+                * @return R Result of the function call
+                */
                template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
                static R stubB2A(ARGS ...args, void *data);
 
+               /**
+                * @brief Wraps StubB-style function taking object handle as StubA
+                * @param[in] data Handle of the object
+                * @param[in] args Function arguments
+                * @return R Result of the function call
+                */
                template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
                static R stubA2B(void *data, ARGS ...args);
+
+               /**
+                * @brief Wraps StubB-style function taking object handle as StubB
+                * @param[in] args Function arguments
+                * @param[in] data Handle of the object
+                * @return R Result of the function call
+                */
                template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
                static R stubB2B(ARGS ...args, void *data);
 
+               /**
+                * @brief Wraps static function as StubA
+                * @param[in] data Not used
+                * @param[in] args Function arguments
+                * @return R Result of the function call
+                */
                template <R(*FUNC)(ARGS...)>
                static R stubA2V(void *data, ARGS ...args);
+
+               /**
+                * @brief Wraps static function as StubB
+                * @param[in] args Function arguments
+                * @param[in] data Not used
+                * @return R Result of the function call
+                */
                template <R(*FUNC)(ARGS...)>
                static R stubB2V(ARGS ...args, void *data);
+
+       private:
+               Callback() = delete;
        };
 }
 
index 714b448a930c7ce5ee17654b49e0b2608250147c..9243ef631716a4fc5104a3d31fcb0d629c2463e6 100644 (file)
@@ -24,33 +24,89 @@ namespace ucl {
        template <class FUNC_SIG>
        class Delegate;
 
+       /**
+        * @brief Delegate that uses "void *" as data pointer
+        */
        template <class R, class ...ARGS>
        class Delegate<R(ARGS...)> : public BaseDelegate<R(ARGS...), void *> {
        public:
+               /**
+                * @brief Result delegate of the lock() method
+                */
                using LockDelegate = Delegate;
 
        public:
                using BaseDelegate<R(ARGS...), void *>::BaseDelegate;
 
+               /**
+                * @brief Locks this delegate before further invoke
+                * @details This function simply returns copy of this delegate.
+                *          Provided for interface compatibility with other delegate
+                *          types.
+                * @return Lock delegate
+                */
                LockDelegate lock() const;
 
+               /**
+                * @brief Invokes this delegate
+                * @details Delgates must be checked for NULL before invoke.
+                * @params[in] args Arguments of the invoke
+                * @return Result of the invoke
+                */
                R operator()(ARGS ...args) const;
 
+               /**
+                * @brief Creates delegate to instance method
+                * @param[in] data This pointer of the instance
+                * @return Created delegate
+                */
                template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
                static Delegate make(CLASS *data) noexcept;
+
+               /**
+                * @brief Creates delegate to constant instance method
+                * @param[in] data Constant this pointer of the instance
+                * @return Created delegate
+                */
                template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
                static Delegate make(const CLASS *data) noexcept;
 
+               /**
+                * @brief Creates delegate to StubA-style function taking object
+                * @param[in] data Pointer of the object
+                * @return Created delegate
+                */
                template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
                static Delegate makeA(CLASS *data) noexcept;
+
+               /**
+                * @brief Creates delegate to StubB-style function taking object
+                * @param[in] data Pointer of the object
+                * @return Created delegate
+                */
                template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
                static Delegate makeB(CLASS *data) noexcept;
 
+               /**
+                * @brief Creates delegate to StubA-style function taking object handle
+                * @param[in] data Handle of the object
+                * @return Created delegate
+                */
                template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
                static Delegate makeA(HANDLE data) noexcept;
+
+               /**
+                * @brief Creates delegate to StubB-style function taking object handle
+                * @param[in] data Handle of the object
+                * @return Created delegate
+                */
                template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
                static Delegate makeB(HANDLE data) noexcept;
 
+               /**
+                * @brief Creates delegate to static function
+                * @return Created delegate
+                */
                template <R(*FUNC)(ARGS...)>
                static Delegate make() noexcept;
        };
index ed24a92a147e76e145cb371b86e4bf11bc344d1b..18d12289a674e67ae36f69f02b1b570a59954153 100644 (file)
@@ -88,6 +88,7 @@ namespace ucl {
        inline Delegate<R(ARGS...)>
                        Delegate<R(ARGS...)>::make() noexcept
        {
-               return {nullptr, Delegate::Cb::template stubA2V<FUNC>};
+               const auto fakeData = reinterpret_cast<void *>(1);
+               return {fakeData, Delegate::Cb::template stubA2V<FUNC>};
        }
 }
index 7c643efe50bdb090ed3c12264ef0fb82748bb50c..330419fa9815dcf1bb2b1ba8eb6ff13afe9dafea 100644 (file)
@@ -24,33 +24,89 @@ namespace ucl {
        template <class FUNC_SIG>
        class Delegate2;
 
+       /**
+        * @brief Delegate2 that uses "void *" as data pointer
+        */
        template <class R, class ...ARGS>
        class Delegate2<R(ARGS...)> : public BaseDelegate2<R(ARGS...), void *> {
        public:
+               /**
+                * @brief Result delegate of the lock() method
+                */
                using LockDelegate = Delegate2;
 
        public:
                using BaseDelegate2<R(ARGS...), void *>::BaseDelegate2;
 
+               /**
+                * @brief Locks this delegate before further invoke
+                * @details This function simply returns copy of this delegate.
+                *          Provided for interface compatibility with other delegate
+                *          types.
+                * @return Lock delegate
+                */
                LockDelegate lock() const;
 
+               /**
+                * @brief Invokes this delegate
+                * @details Delgates must be checked for NULL before invoke.
+                * @params[in] args Arguments of the invoke
+                * @return Result of the invoke
+                */
                R operator()(ARGS ...args) const;
 
+               /**
+                * @brief Creates delegate to instance method
+                * @param[in] data This pointer of the instance
+                * @return Created delegate
+                */
                template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
                static Delegate2 make(CLASS *data) noexcept;
+
+               /**
+                * @brief Creates delegate to constant instance method
+                * @param[in] data Constant this pointer of the instance
+                * @return Created delegate
+                */
                template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
                static Delegate2 make(const CLASS *data) noexcept;
 
+               /**
+                * @brief Creates delegate to StubA-style function taking object
+                * @param[in] data Pointer of the object
+                * @return Created delegate
+                */
                template <class CLASS, R(*FUNC)(CLASS &, ARGS...)>
                static Delegate2 makeA(CLASS *data) noexcept;
+
+               /**
+                * @brief Creates delegate to StubB-style function taking object
+                * @param[in] data Pointer of the object
+                * @return Created delegate
+                */
                template <class CLASS, R(*FUNC)(ARGS..., CLASS &)>
                static Delegate2 makeB(CLASS *data) noexcept;
 
+               /**
+                * @brief Creates delegate to StubA-style function taking object handle
+                * @param[in] data Handle of the object
+                * @return Created delegate
+                */
                template <class HANDLE, R(*FUNC)(HANDLE, ARGS...)>
                static Delegate2 makeA(HANDLE data) noexcept;
+
+               /**
+                * @brief Creates delegate to StubB-style function taking object handle
+                * @param[in] data Handle of the object
+                * @return Created delegate
+                */
                template <class HANDLE, R(*FUNC)(ARGS..., HANDLE)>
                static Delegate2 makeB(HANDLE data) noexcept;
 
+               /**
+                * @brief Creates delegate to static function
+                * @return Created delegate
+                */
                template <R(*FUNC)(ARGS...)>
                static Delegate2 make() noexcept;
        };
index a3ad4117dbfa65f182af4aa68c025a9853994de2..6b6fe09b835a64e245cc83ee534084220b64e134 100644 (file)
@@ -94,7 +94,8 @@ namespace ucl {
        inline Delegate2<R(ARGS...)>
                        Delegate2<R(ARGS...)>::make() noexcept
        {
-               return {nullptr,
+               const auto fakeData = reinterpret_cast<void *>(1);
+               return {fakeData,
                                Delegate2::Cb::template stubA2V<FUNC>,
                                Delegate2::Cb::template stubB2V<FUNC>};
        }
index d4f574b396850c6a06c4fccb018b583d512e8bd9..2c471b63f37925281d6f53d67b591809d834caa8 100644 (file)
 
 namespace ucl {
 
-       // Automatic function signature detection for a specific type //
-
-       template <template <typename ...> class T, class FUNC>
-       struct AutoFuncSig;
-
-       template <template <typename ...> class T,
-                       class R, class CLASS, class ...ARGS>
-       struct AutoFuncSig<T, R(CLASS::*)(ARGS...)> {
-               using Data = CLASS;
-               using Type = T<R(ARGS...)>;
-
-               template <R(CLASS::*METHOD)(ARGS...), class DATA>
-               static Type makeDelegate(DATA &&data) noexcept
-               {
-                       return Type::template make<CLASS, METHOD>(std::forward<DATA>(data));
-               }
-       };
-
-       template <template <typename ...> class T,
-                       class CLASS, class R, class ...ARGS>
-       struct AutoFuncSig<T, R(CLASS::*)(ARGS...) const> {
-               using Data = CLASS;
-               using Type = T<R(ARGS...)>;
-
-               template <R(CLASS::*METHOD)(ARGS...) const, class DATA>
-               static Type makeDelegate(DATA &&data) noexcept
-               {
-                       return Type::template make<CLASS, METHOD>(std::forward<DATA>(data));
-               }
-       };
-
-       template <template <typename ...> class T,
-                       class CLASS, class R, class ...ARGS>
-       struct AutoFuncSig<T, R(*)(CLASS &, ARGS...)> {
-               using Data = CLASS;
-               using Type = T<R(ARGS...)>;
-
-               template <R(*FUNC)(CLASS &, ARGS...), class DATA>
-               static Type makeDelegate(DATA &&data) noexcept
-               {
-                       return Type::template makeA<CLASS, FUNC>(std::forward<DATA>(data));
-               }
-       };
-
-       template <template <typename ...> class T,
-                       class HANDLE, class R, class ...ARGS>
-       struct AutoFuncSig<T, R(*)(HANDLE, ARGS...)> {
-               using Data = HANDLE;
-               using Type = T<R(ARGS...)>;
-               using TypeV = T<R(HANDLE, ARGS...)>;
-
-               template <R(*FUNC)(HANDLE, ARGS...), class DATA>
-               static Type makeDelegate(DATA &&data) noexcept
-               {
-                       return Type::template makeA<HANDLE, FUNC>(std::forward<DATA>(data));
-               }
-
-               template <R(*FUNC)(HANDLE, ARGS...)>
-               static TypeV makeDelegate() noexcept
-               {
-                       return TypeV::template make<FUNC>();
-               }
-       };
-
-       template <template <typename ...> class T, class R>
-       struct AutoFuncSig<T, R(*)()> {
-               using TypeV = T<R()>;
-
-               template <R(*FUNC)()>
-               static TypeV makeDelegate() noexcept
-               {
-                       return TypeV::template make<FUNC>();
-               }
-       };
-
        // Relation operators //
 
+       /**
+        * @brief Compares equals target delegates
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        * @return true - if equal, false - not equal
+        */
        template <class R, class ...ARGS, class DATA1, class DATA2>
        inline bool operator==(const BaseDelegate<R(ARGS...), DATA1> &lhs,
                        const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
@@ -104,6 +35,12 @@ namespace ucl {
                                lhs.getData() == rhs.getData()));
        }
 
+       /**
+        * @brief Compares unequals target delegates
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        * @return true - if not equal, false - equal
+        */
        template <class R, class ...ARGS, class DATA1, class DATA2>
        inline bool operator!=(const BaseDelegate<R(ARGS...), DATA1> &lhs,
                        const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
@@ -112,6 +49,12 @@ namespace ucl {
                                lhs.getData() != rhs.getData()));
        }
 
+       /**
+        * @brief Compares less target delegates
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        * @return true - if left is less than right, false - otherwise
+        */
        template <class R, class ...ARGS, class DATA1, class DATA2>
        inline bool operator<(const BaseDelegate<R(ARGS...), DATA1> &lhs,
                        const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
@@ -121,6 +64,12 @@ namespace ucl {
                                        lhs.getData() < rhs.getData())));
        }
 
+       /**
+        * @brief Compares less or equals target delegates
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        * @return true - if left is less or equals to right, false - otherwise
+        */
        template <class R, class ...ARGS, class DATA1, class DATA2>
        inline bool operator<=(const BaseDelegate<R(ARGS...), DATA1> &lhs,
                        const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
@@ -130,6 +79,12 @@ namespace ucl {
                                        lhs.getData() <= rhs.getData())));
        }
 
+       /**
+        * @brief Compares greater target delegates
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        * @return true - if left is greater than right, false - otherwise
+        */
        template <class R, class ...ARGS, class DATA1, class DATA2>
        inline bool operator>(const BaseDelegate<R(ARGS...), DATA1> &lhs,
                        const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
@@ -139,6 +94,12 @@ namespace ucl {
                                        lhs.getData() > rhs.getData())));
        }
 
+       /**
+        * @brief Compares greater or equals target delegates
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        * @return true - if left is greater or equals to right, false - otherwise
+        */
        template <class R, class ...ARGS, class DATA1, class DATA2>
        inline bool operator>=(const BaseDelegate<R(ARGS...), DATA1> &lhs,
                        const BaseDelegate<R(ARGS...), DATA2> &rhs) noexcept
diff --git a/ucl/include/ucl/util/delegation/internal.h b/ucl/include/ucl/util/delegation/internal.h
new file mode 100644 (file)
index 0000000..daf00ef
--- /dev/null
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __UCL_UTIL_DELEGATION_INTERNAL_H__
+#define __UCL_UTIL_DELEGATION_INTERNAL_H__
+
+namespace ucl { namespace himpl {
+
+       // Automatic function signature detection for a specific type //
+
+       template <template <typename ...> class T, class FUNC>
+       struct AutoFuncSig;
+
+       template <template <typename ...> class T,
+                       class R, class CLASS, class ...ARGS>
+       struct AutoFuncSig<T, R(CLASS::*)(ARGS...)> {
+               using Data = CLASS;
+               using Type = T<R(ARGS...)>;
+
+               template <R(CLASS::*METHOD)(ARGS...), class DATA>
+               static Type makeDelegate(DATA &&data) noexcept
+               {
+                       return Type::template make<CLASS, METHOD>(std::forward<DATA>(data));
+               }
+       };
+
+       template <template <typename ...> class T,
+                       class CLASS, class R, class ...ARGS>
+       struct AutoFuncSig<T, R(CLASS::*)(ARGS...) const> {
+               using Data = CLASS;
+               using Type = T<R(ARGS...)>;
+
+               template <R(CLASS::*METHOD)(ARGS...) const, class DATA>
+               static Type makeDelegate(DATA &&data) noexcept
+               {
+                       return Type::template make<CLASS, METHOD>(std::forward<DATA>(data));
+               }
+       };
+
+       template <template <typename ...> class T,
+                       class CLASS, class R, class ...ARGS>
+       struct AutoFuncSig<T, R(*)(CLASS &, ARGS...)> {
+               using Data = CLASS;
+               using Type = T<R(ARGS...)>;
+
+               template <R(*FUNC)(CLASS &, ARGS...), class DATA>
+               static Type makeDelegate(DATA &&data) noexcept
+               {
+                       return Type::template makeA<CLASS, FUNC>(std::forward<DATA>(data));
+               }
+       };
+
+       template <template <typename ...> class T,
+                       class HANDLE, class R, class ...ARGS>
+       struct AutoFuncSig<T, R(*)(HANDLE, ARGS...)> {
+               using Data = HANDLE;
+               using Type = T<R(ARGS...)>;
+               using TypeV = T<R(HANDLE, ARGS...)>;
+
+               template <R(*FUNC)(HANDLE, ARGS...), class DATA>
+               static Type makeDelegate(DATA &&data) noexcept
+               {
+                       return Type::template makeA<HANDLE, FUNC>(std::forward<DATA>(data));
+               }
+
+               template <R(*FUNC)(HANDLE, ARGS...)>
+               static TypeV makeDelegate() noexcept
+               {
+                       return TypeV::template make<FUNC>();
+               }
+       };
+
+       template <template <typename ...> class T, class R>
+       struct AutoFuncSig<T, R(*)()> {
+               using TypeV = T<R()>;
+
+               template <R(*FUNC)()>
+               static TypeV makeDelegate() noexcept
+               {
+                       return TypeV::template make<FUNC>();
+               }
+       };
+}}
+
+#endif // __UCL_UTIL_DELEGATION_INTERNAL_H__
index 3ee55e0a1d2e7f720dbdb25b0eea289871bfaba9..a590557745caa087911d1dd8e4b5c456fca35ac1 100644 (file)
 #ifndef __UCL_UTIL_DELEGATION_MACRO_H__
 #define __UCL_UTIL_DELEGATION_MACRO_H__
 
+#include "internal.h"
+
 // Helper macro to simplify use of AutoFuncSig template
 
 #define _UCL_AFS(DELEGATE, FUNC) \
-               ::ucl::AutoFuncSig<DELEGATE, decltype(&FUNC)>
+               ::ucl::himpl::AutoFuncSig<DELEGATE, decltype(&FUNC)>
 
 // Helper macro to automatically generate different delegate objects //
 
 
 // Helper macro to automatically generate Delegate objects //
 
+/**
+ * @brief Creates Delegate<auto> to specified function
+ * @param FUNC Function for the delegate without &
+ * @param DATA Data for the delegate (optional)
+ * @return Created delegate
+ */
 #define UCL_DELEGATE(FUNC, DATA...) _UCL_DELEGATE( \
                ::ucl::Delegate, FUNC, ##DATA)
 
+/**
+ * @brief Creates Delegate<auto> to "this" instance method
+ * @param FUNC_NAME name of the function of the "this" class
+ * @return Created delegate
+ */
 #define UCL_DELEGATE_THIS(FUNC_NAME) UCL_DELEGATE( \
                std::remove_pointer<decltype(this)>::type::FUNC_NAME, this)
 
 // Helper macro to automatically generate Delegate2 objects //
 
+/**
+ * @brief Creates Delegate2<auto> to specified function
+ * @param FUNC Function for the delegate without &
+ * @param DATA Data for the delegate (optional)
+ * @return Created delegate
+ */
 #define UCL_DELEGATE2(FUNC, DATA...) _UCL_DELEGATE( \
                ::ucl::Delegate2, FUNC, ##DATA)
 
+/**
+ * @brief Creates Delegate2<auto> to "this" instance method
+ * @param FUNC_NAME name of the function of the "this" class
+ * @return Created delegate
+ */
 #define UCL_DELEGATE2_THIS(FUNC_NAME) UCL_DELEGATE2( \
                std::remove_pointer<decltype(this)>::type::FUNC_NAME, this)
 
 // Helper macro to automatically generate Callback stubs //
 
+/**
+ * @brief Returns Callback<auto>::stubA to specified function
+ * @param FUNC Function for the callback without &
+ * @return Pointer to the stab function
+ */
 #define UCL_CALLBACK_A(FUNC) &_UCL_AFS(::ucl::Callback, FUNC)::Type:: \
                template stubA<typename _UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>
+
+/**
+ * @brief Returns Callback<auto>::stubB to specified function
+ * @param FUNC Function for the callback without &
+ * @return Pointer to the stab function
+ */
 #define UCL_CALLBACK_B(FUNC) &_UCL_AFS(::ucl::Callback, FUNC)::Type:: \
                template stubB<typename _UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>
 
+/**
+ * @brief Returns Callback<auto>::stubA2A to specified function
+ * @param FUNC Function for the callback without &
+ * @return Pointer to the stab function
+ */
 #define UCL_CALLBACK_A2A(FUNC) &_UCL_AFS(::ucl::Callback, FUNC)::Type:: \
                template stubA2A<typename _UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>
+
+/**
+ * @brief Returns Callback<auto>::stubB2A to specified function
+ * @param FUNC Function for the callback without &
+ * @return Pointer to the stab function
+ */
 #define UCL_CALLBACK_B2A(FUNC) &_UCL_AFS(::ucl::Callback, FUNC)::Type:: \
                template stubB2A<typename _UCL_AFS(::ucl::Callback, FUNC)::Data, &FUNC>
 
+/**
+ * @brief Returns Callback<auto>::stubA2V to specified function
+ * @param FUNC Function for the callback without &
+ * @return Pointer to the stab function
+ */
 #define UCL_CALLBACK_A2V(FUNC) &_UCL_AFS(::ucl::Callback, FUNC)::TypeV:: \
                template stubA2V<&FUNC>
+
+/**
+ * @brief Returns Callback<auto>::stubB2V to specified function
+ * @param FUNC Function for the callback without &
+ * @return Pointer to the stab function
+ */
 #define UCL_CALLBACK_B2V(FUNC) &_UCL_AFS(::ucl::Callback, FUNC)::TypeV:: \
                template stubB2V<&FUNC>
 
index 5abf690809116ce60a93caa14e664670b7e4aad7..fe6b029e9d763b3ead73d06344c599d4fc8d0828 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Converts a value to corresponding Eina type
+        * @param[in] value Original bool value
+        * @return Corresponding Eina_Bool value
+        */
        constexpr Eina_Bool toEina(bool value);
 
-       // "nz()" - "Not Zero" functions
-       // return "zValue" if "!value" is true
+       /**
+        * @brief Returns "zValue" if source is NULL
+        * @param[in] value Source C-String
+        * @param[in] zValue Value to return when "value" is NULL (optional: "")
+        * @return "value" - if not NULL, "zValue" - otherwise
+        */
        constexpr const char *nz(const char *value, const char *zValue = "");
 
-       // "ne()" - "Not Empty" functions
-       // return "eValue" if "isEmpty(value)" is true
+       /**
+        * @brief Returns "eValue" if source is empty string
+        * @param[in] value Source C-String
+        * @param[in] eValue Value to return when "value" is NULL (optional: NULL)
+        * @return "value" - if not empty, "eValue" - otherwise
+        */
        constexpr const char *ne(const char *value, const char *eValue = nullptr);
 
+       /**
+        * @brief Checks C-String for emptiness
+        * @param[in] value Source C-String
+        * @return true - if empty (NULL or ""), false - otherwise
+        */
        constexpr bool isEmpty(const char *value);
 
+       /**
+        * @brief Checks T object for emptiness
+        * @details Works by wrapping object's empty() method if exists
+        * @param[in] value Source object
+        * @return true - if empty, false - otherwise
+        */
        template <class T>
        constexpr auto isEmpty(const T &value) -> decltype(value.empty())
        {
                return value.empty();
        }
 
+       /**
+        * @brief Checks T object for emptiness
+        * @details Works by wrapping object's isEmpty() method if exists
+        * @param[in] value Source object
+        * @return true - if empty, false - otherwise
+        */
        template <class T>
        constexpr auto isEmpty(const T &value) -> decltype(value.isEmpty())
        {
                return value.isEmpty();
        }
 
+       /**
+        * @brief Checks T object passed by pointer for emptiness
+        * @details Uses isEmpty() function on dereferenced value if not NULL.
+        * @param[in] value Source object pointer
+        * @return true - if empty or NULL, false - otherwise
+        */
        template <class T>
        constexpr auto isEmpty(const T &value) -> decltype(isEmpty(*value))
        {
                return (!value || isEmpty(*value));
        }
 
+       /**
+        * @brief Checks T object for validity
+        * @details Works by wrapping object's valid() method if exists
+        * @param[in] value Source object
+        * @return true - if valid, false - otherwise
+        */
        template <class T>
        constexpr auto isValid(const T &value) -> decltype(value.valid())
        {
                return value.valid();
        }
 
+       /**
+        * @brief Checks T object for validity
+        * @details Works by wrapping object's isValid() method if exists
+        * @param[in] value Source object
+        * @return true - if valid, false - otherwise
+        */
        template <class T>
        constexpr auto isValid(const T &value) -> decltype(value.isValid())
        {
                return value.isValid();
        }
 
+       /**
+        * @brief Checks T object passed by pointer for validity
+        * @details Uses isValid() function on dereferenced value if not NULL.
+        * @param[in] value Source object pointer
+        * @return true - if valid, false - otherwise
+        */
        template <class T>
        constexpr auto isValid(const T &value) -> decltype(isValid(*value))
        {
                return (value && isValid(*value));
        }
 
+       /**
+        * @brief Checks T object for not emptiness
+        * @details Works by negating isEmpty() function
+        * @param[in] value Source object
+        * @return true - if not empty, false - otherwise
+        */
        template <class T>
        constexpr bool isNotEmpty(T &&value);
 
+       /**
+        * @brief Checks T object for not validity
+        * @details Works by negating isValid() function
+        * @param[in] value Source object
+        * @return true - if not valid, false - otherwise
+        */
        template <class T>
        constexpr bool isNotValid(T &&value);
 
+       /**
+        * @brief Duplicates C-String with NULL check
+        * @param[in] value Source C-String
+        * @return Duplicated C-String or NULL
+        */
        char *strDupSafe(const char *value);
+
+       /**
+        * @brief Compares C-String wrapped with nz() function
+        * @param[in] lhs Left hand side C-String
+        * @param[in] lhs Right hand side C-String
+        * @return 0 - equals, <0 - less, >0 - greater
+        */
        int strCmpSafe(const char *lhs, const char *rhs);
 
+       /**
+        * @brief Dynamically casts an object
+        * @param[in] src Source object
+        * @return Result object
+        */
        template <class T1, class T2>
        inline auto dynamicCast(T2 &&src) -> decltype(
                        dynamic_cast<T1>(std::forward<T2>(src)))
@@ -86,6 +169,11 @@ namespace ucl {
                return dynamic_cast<T1>(std::forward<T2>(src));
        }
 
+       /**
+        * @brief Const casts an object
+        * @param[in] src Source object
+        * @return Result object
+        */
        template <class T1, class T2>
        inline auto constCast(T2 &&src) -> decltype(
                        const_cast<T1>(std::forward<T2>(src)))
@@ -93,21 +181,49 @@ namespace ucl {
                return const_cast<T1>(std::forward<T2>(src));
        }
 
+       /**
+        * @brief Calculates minimum from two values
+        * @param[in] a First value
+        * @param[in] b Second value
+        * @return Constant reference to minimum value
+        */
        template <class T>
        constexpr const T &min(const T &a, const T &b);
 
+       /**
+        * @brief Calculates maximum from two values
+        * @param[in] a First value
+        * @param[in] b Second value
+        * @return Constant reference to maximum value
+        */
        template <class T>
        constexpr const T &max(const T &a, const T &b);
 
+       /**
+        * @brief Checks if a value is a Power of Two
+        * @param[in] value Source value
+        * @return true - if value is POT, false - otherwise
+        */
        template <class T>
        constexpr bool isPot(T value)
        {
                return (((value - 1) & value) == 0);
        }
 
+       /**
+        * @brief Divides integer T by MULTIPLE with ceiling
+        * @param[in] value Source value
+        * @return Ceiled result of the division
+        */
        template <uint MULTIPLE, class T>
        constexpr T ceilDiv(T value);
 
+       /**
+        * @brief Rounds integer T to not less value that is a multiple of MULTIPLE
+        * @details Optimized version for POT numbers
+        * @param[in] value Source value
+        * @return Result of the rounding
+        */
        template <uint MULTIPLE, class T>
        constexpr typename std::enable_if<isPot(MULTIPLE), T>::type
                        roundUp(T value)
@@ -115,6 +231,12 @@ namespace ucl {
                return ((value + (MULTIPLE - 1)) & ~static_cast<T>(MULTIPLE - 1));
        }
 
+       /**
+        * @brief Rounds integer T to not less value that is a multiple of MULTIPLE
+        * @details Version for not POT numbers
+        * @param[in] value Source value
+        * @return Result of the rounding
+        */
        template <uint MULTIPLE, class T>
        constexpr typename std::enable_if<!isPot(MULTIPLE), T>::type
                        roundUp(T value)
@@ -125,9 +247,26 @@ namespace ucl {
 
 namespace ucl { namespace util {
 
+       /**
+        * @brief Wraps T object pointer with std::unique_ptr
+        * @param[in] p Source pointer
+        * @return Result std::unique_ptr
+        */
        template <class T>
-       std::unique_ptr<T> makeUnique(T *p);
+       std::unique_ptr<T> wrapUnique(T *p);
+
+       /**
+        * @brief Makes new instance of T and calls wrapUnique()
+        * @param[in] args Arguments for T constructor
+        * @return Result std::unique_ptr
+        */
+       template <class T, class ...ARGS>
+       std::unique_ptr<T> makeUnique(ARGS &&...args);
 
+       /**
+        * @brief Safely disposes object and NULLs pointer
+        * @param[in/out] p Target pointer
+        */
        template <class T, class = typename std::enable_if<
                        std::is_convertible<T *, IDisposable *>::value>::type>
        inline void dispose(T *&p) noexcept
index a7606f81f8d9f207eeea023a04a92fe6b4375568..33fd3263d26393e6df5edbb865c82cc51f9d83d1 100644 (file)
@@ -80,8 +80,14 @@ namespace ucl {
 namespace ucl { namespace util {
 
        template <class T>
-       inline std::unique_ptr<T> makeUnique(T *const p)
+       inline std::unique_ptr<T> wrapUnique(T *const p)
        {
                return std::unique_ptr<T>(p);
        }
+
+       template <class T, class ...ARGS>
+       inline std::unique_ptr<T> makeUnique(ARGS &&...args)
+       {
+               return wrapUnique(new T(std::forward<ARGS>(args)...));
+       }
 }}
index 804a51301f78ca0a206afadae6e84a5ba6f6b63b..da3e115a648d715d95e145370f9673ffa898fc21 100644 (file)
 
 #include "types/Result.h"
 
+/**
+ * @brief Gets result data for result codes defined in "ucl/types/Result.h"
+ * @param[in] result Result value
+ * @return Corresponding result data for the result value
+ */
 ::ucl::ResultData getUCLResultData(::ucl::Result result);
 
 #ifndef UCL_LOG_LEVEL
index 25970000af290470457e18f3d30c0ace5c361402..405bf859c575af7b4a44c3d2b2864355121c348a 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Base class for reference-counted pointers
+        */
        template <class T>
        class BaseRef {
        public:
+               /**
+                * @brief Alias for "T"
+                */
                using Type = T;
 
        public:
+               /**
+                * @brief Gets use count of the pointed object (strong count)
+                */
                UInt getUseCount() const noexcept;
 
        protected:
+               /**
+                * @brief Default constructor
+                */
                constexpr BaseRef() noexcept;
+
+               /**
+                * @brief Constructor
+                * @param[in] rc Pointer to reference-counted objet
+                * @param[in] ptr Pointed object pointer
+                */
                BaseRef(IRefCountObj *rc, T *ptr) noexcept;
+
+               /**
+                * @brief Move constructor
+                * @param[in] r Source object
+                */
                BaseRef(BaseRef<T> &&r) noexcept;
+
+               /**
+                * @brief Conversion move constructor
+                * @param[in] r Source object
+                */
                template <class U>
                BaseRef(BaseRef<U> &&r) noexcept;
 
        protected:
+               /**
+                * @brief Reference counter-counted objet
+                */
                IRefCountObj *m_rc;
+
+               /**
+                * @brief Pointed object pointer
+                */
                T *m_ptr;
 
                template <class U>
index 760e61197cb856fc8caab7ed85a7fb0656642c3e..5dc2c3e0d21f145d0587f69f3c628f782ea916d9 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Interface for reference-counted object
+        */
        class IRefCountObj : protected NonCopyable {
        public:
+               /**
+                * @brief Increments use counter
+                */
                virtual void ref() noexcept = 0;
+
+               /**
+                * @brief Decrements use counter
+                * @details When use count reches 0 object will be destroyed
+                */
                virtual void unref() noexcept = 0;
+
+               /**
+                * @brief Increments use counter if it is not 0
+                */
                virtual bool refNz() noexcept = 0;
+
+               /**
+                * @brief Increments weak counter
+                */
                virtual void refWeak() noexcept = 0;
+
+               /**
+                * @brief Decrements weak counter
+                * @details When weak count reches 0 "delete this" will be called
+                */
                virtual void unrefWeak() noexcept = 0;
+
+               /**
+                * @brief Gets use count (strong count)
+                * @return use count
+                */
                virtual UInt getUseCount() const noexcept = 0;
+
+               /**
+                * @brief Gets pointer of the object
+                * @return Pointer of the object
+                */
                virtual const void *getObjPtr() const noexcept = 0;
+
        protected:
+               /**
+                * @brief Destructor
+                */
                ~IRefCountObj() = default;
        };
 }
index 24c1323238b8e9cb6a4b65ddf3063d08ca442d56..c132e237596634f769d1cde49a2d5b1a785c8f7a 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Represents reference-counted object of type T and counter C
+        */
        template <class T, class C>
        class RefCountObj final : public IRefCountObj {
        public:
+               /**
+                * @brief Constructor
+                * @param[in] args Arguments for T constructor
+                */
                template <class ...ARGS>
                RefCountObj(ARGS &&...args);
 
+               /**
+                * @brief Gets pointer of the object
+                * @return Pointer of the object
+                */
                T *getObj() noexcept;
 
                // IRefCountObj //
index 1d2fb95aa91dbdf86d0a33f48dde79b54bb26734..5b7ea170a4ce8e2a3b578605f6445939fcc0e1ed 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Represents multithreaded reference counter
+        */
        class RefCounterMT final {
        public:
+               /**
+                * @brief Constructor
+                * @param[in] count Initial counter value
+                */
                explicit RefCounterMT(const UInt count = 0) noexcept;
 
+               /**
+                * @brief Atomically increments counter
+                * @return New counter value
+                */
                UInt ref() noexcept;
+
+               /**
+                * @brief Atomically decrements counter
+                * @return New counter value
+                */
                UInt unref() noexcept;
+
+               /**
+                * @brief Atomically increments counter if not 0
+                * @return New counter value
+                */
                UInt refNz() noexcept;
 
+               /**
+                * @brief Atomically gets current counter value
+                * @return Current counter value
+                */
                UInt get() const noexcept;
 
        private:
index 30e5e3550f232b07c1328cd049a095ce4ff6f5b8..ca941a701a82aaec74cc166d905423bcf17e111f 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Represents singlethreaded reference counter
+        */
        class RefCounterST final {
        public:
+               /**
+                * @brief Constructor
+                * @param[in] count Initial counter value
+                */
                explicit RefCounterST(const UInt count = 0) noexcept;
 
+               /**
+                * @brief Increments counter
+                * @return New counter value
+                */
                UInt ref() noexcept;
+
+               /**
+                * @brief Decrements counter
+                * @return New counter value
+                */
                UInt unref() noexcept;
+
+               /**
+                * @brief Increments counter if not 0
+                * @return New counter value
+                */
                UInt refNz() noexcept;
 
+               /**
+                * @brief Gets current counter value
+                * @return Current counter value
+                */
                UInt get() const noexcept;
 
        private:
index ab253bcf0ac1c330276014289ad15428a2edc173..490a23699781d2c67649cb0c560aae80d0d9dde3 100644 (file)
@@ -25,16 +25,42 @@ namespace ucl {
        template <class T, class C>
        class RefCountObj;
 
+       /**
+        * @brief Helpers class to store object of type T for reference counting
+        * @details You need to friend ReffedObj<T> if constructor/destructor
+        *          of T is not public
+        */
        template <class T>
        class ReffedObj final {
        private:
+               /**
+                * @brief Calls constructor of T
+                * @param[in] Arguments for T constructor
+                */
                template <class ...ARGS>
                void create(ARGS &&...args);
+
+               /**
+                * @brief Calls destructor of T
+                */
                void destroy() noexcept;
 
+               /**
+                * @brief Gets pointer to T object
+                * @return Pointer to T object
+                */
                T *get() noexcept;
+
+               /**
+                * @brief Gets pointer to constant T object
+                * @return Pointer to constant T object
+                */
                const T *get() const noexcept;
 
+               /**
+                * @brief Calls "get()->onUniqueChanged()" on the T object
+                * @param[in] isUnique true - if use count is 1, false - otherwise
+                */
                template <class T2>
                void dispatchOnUniqueChanged(bool isUnique);
 
index 45db0c5b667d869e80a4504106f5d93136e2a3b2..614fa9fc7dfb9de703e7cd9fb53abba527c662d7 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Implements shared reference (pointer) to T object
+        */
        template <class T>
        class SharedRef final : public BaseRef<T> {
        public:
+               /**
+                * @brief Swaps SharedRef objects with each other
+                * @param[in/out] x First SharedRef
+                * @param[in/out] y Second SharedRef
+                */
                template <class U>
                friend void swap(SharedRef<U> &x, SharedRef<U> &y) noexcept;
 
+               /**
+                * @brief Statically casts SharedRef<U> to SharedRef<T2>
+                * @param[in] r Source shared reference
+                * @return Result shared reference
+                */
                template <class T2, class U>
                friend SharedRef<T2> staticRefCast(const SharedRef<U> &r) noexcept;
+
+               /**
+                * @brief Dynamically casts SharedRef<U> to SharedRef<T2>
+                * @param[in] r Source shared reference
+                * @return Result shared reference
+                */
                template <class T2, class U>
                friend SharedRef<T2> dynamicRefCast(const SharedRef<U> &r) noexcept;
 
        public:
+               /**
+                * @brief Default constructor
+                * @details Creates empty reference
+                */
                constexpr SharedRef() noexcept;
+
+               /**
+                * @brief Constructor
+                * @details Same as default constructor
+                */
                constexpr SharedRef(std::nullptr_t) noexcept;
 
+               /**
+                * @brief Constructor
+                * @details Increments reference counter
+                * @param[in] rc Pointer to reference-counted objet
+                * @param[in] ptr Pointed object pointer
+                */
                SharedRef(IRefCountObj *rc, T *ptr) noexcept;
+
+               /**
+                * @brief Constructor
+                * @details Does not increment reference counter
+                * @param[in] rc Pointer to reference-counted objet
+                * @param[in] ptr Pointed object pointer
+                * @param[in] noRef Not used.
+                */
                SharedRef(IRefCountObj *rc, T *ptr, bool noRef) noexcept;
 
+               /**
+                * @brief Copy constructor
+                * @param[in] r Source object
+                */
                SharedRef(const SharedRef<T> &r) noexcept;
+
+               /**
+                * @brief Converting copy constructor
+                * @param[in] r Source object
+                */
                template <class U>
                SharedRef(const SharedRef<U> &r) noexcept;
 
+               /**
+                * @brief Move constructor
+                * @param[in] r Source object
+                */
                SharedRef(SharedRef<T> &&r) noexcept;
+
+               /**
+                * @brief Converting move constructor
+                * @param[in] r Source object
+                */
                template <class U>
                SharedRef(SharedRef<U> &&r) noexcept;
 
+               /**
+                * @brief Destructor
+                * @details Decrements reference counter
+                */
                ~SharedRef();
 
+               /**
+                * @brief Assigns one SharedRef to another
+                * @param[in] r Source object
+                * @return Reference to this SharedRef
+                */
                SharedRef<T> &operator=(SharedRef<T> r) noexcept;
 
+               /**
+                * @brief Makes this reference empty
+                */
                void reset() noexcept;
 
+               /**
+                * @brief Gets pointed object pointer
+                * @return Pointer object pointer
+                */
                T *get() const noexcept;
+
+               /**
+                * @brief Explicitly casts to bool
+                * @return true - if not empty, false - otherwise
+                */
                explicit operator bool() const noexcept;
 
+               /**
+                * @brief Gets pointed object pointer
+                * @return Pointer object pointer
+                */
                T *operator->() const noexcept;
+
+               /**
+                * @brief Gets pointed object reference
+                * @return Pointer object reference
+                */
                typename std::add_lvalue_reference<T>::type operator*() const noexcept;
 
+               /**
+                * @brief Implicitly casts to compatible SharedRef type
+                * @return Reference to this object as casted type
+                */
                template <class U, class = typename std::enable_if<
                        std::is_convertible<T *, U *>::value && (
                                std::is_same<typename std::remove_cv<U>::type, void>::value ||
@@ -72,13 +166,36 @@ namespace ucl {
 
        // Non-member functions //
 
+       /**
+        * @brief Makes new instance of T as shared object
+        * @param[in] args Arguments for T constructor
+        * @return Shared reference to new T
+        */
        template <class T, class ...ARGS>
        SharedRef<T> makeShared(ARGS &&...args);
+
+       /**
+        * @brief Makes new instance of T as shared object
+        * @details Multiple thread may refer to this object
+        * @param[in] args Arguments for T constructor
+        * @return Shared reference to new T
+        */
        template <class T, class ...ARGS>
        SharedRef<T> makeSharedMT(ARGS &&...args);
 
+       /**
+        * @brief Const casts SharedRef<U> to SharedRef<T>
+        * @param[in] r Source shared reference
+        * @return Result shared reference
+        */
        template <class T, class U>
        const SharedRef<T> &constRefCast(const SharedRef<U> &r) noexcept;
+
+       /**
+        * @brief Const casts SharedRef<U> to SharedRef<T>
+        * @param[in] r Source shared reference
+        * @return Result shared reference
+        */
        template <class T, class U>
        SharedRef<T> &&constRefCast(SharedRef<U> &&r) noexcept;
 }
index eb9605198560b3ffd9e5078d983d1591e193bf15..cad6841b5139f900f568be2766a0c055daaf163a 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Implements weak reference (pointer) to T object
+        */
        template <class T>
        class WeakRef final : public BaseRef<T> {
        public:
+               /**
+                * @brief Swaps WeakRef objects with each other
+                * @param[in/out] x First WeakRef
+                * @param[in/out] y Second WeakRef
+                */
                template <class U>
                friend void swap(WeakRef<U> &x, WeakRef<U> &y) noexcept;
 
+               /**
+                * @brief Statically casts WeakRef<U> to WeakRef<T2>
+                * @param[in] r Source weak reference
+                * @return Result weak reference
+                */
                template <class T2, class U>
                friend WeakRef<T2> staticRefCast(const WeakRef<U> &r) noexcept;
+
+               /**
+                * @brief Dynamically casts WeakRef<U> to WeakRef<T2>
+                * @param[in] r Source weak reference
+                * @return Result weak reference
+                */
                template <class T2, class U>
                friend WeakRef<T2> dynamicRefCast(const WeakRef<U> &r) noexcept;
 
        public:
+               /**
+                * @brief Default constructor
+                * @details Creates expired reference
+                */
                constexpr WeakRef() noexcept;
+
+               /**
+                * @brief Constructor
+                * @details Same as default constructor
+                */
                constexpr WeakRef(std::nullptr_t) noexcept;
 
+               /**
+                * @brief Constructor
+                * @details Increments weak reference counter
+                * @param[in] rc Pointer to reference-counted objet
+                * @param[in] ptr Pointed object pointer
+                */
                WeakRef(IRefCountObj *rc, T *ptr) noexcept;
 
+               /**
+                * @brief Copy constructor
+                * @param[in] r Source object
+                */
                WeakRef(const WeakRef<T> &r) noexcept;
+
+               /**
+                * @brief Converting copy constructor
+                * @param[in] r Source object
+                */
                template <class U>
                WeakRef(const BaseRef<U> &r) noexcept;
 
+               /**
+                * @brief Move constructor
+                * @param[in] r Source object
+                */
                WeakRef(WeakRef<T> &&r) noexcept;
+
+               /**
+                * @brief Converting move constructor
+                * @param[in] r Source object
+                */
                template <class U>
                WeakRef(WeakRef<U> &&r) noexcept;
 
+               /**
+                * @brief Destructor
+                * @details Decrements weak reference counter
+                */
                ~WeakRef();
 
+               /**
+                * @brief Assigns one WeakRef to another
+                * @param[in] r Source object
+                * @return Reference to this WeakRef
+                */
                WeakRef<T> &operator=(WeakRef<T> r) noexcept;
 
+               /**
+                * @brief Makes this reference empty
+                */
                void reset() noexcept;
 
+               /**
+                * @brief Returns SharedRef for this weak reference
+                * @details Will return empty shared reference if expired
+                */
                SharedRef<T> lock() const noexcept;
 
+               /**
+                * @brief Gets pointed object pointer
+                * @details Do not dereference. Use as ID for comparison.
+                * @return Pointer object pointer
+                */
                T *getUnsafePtr() const noexcept;
+
+               /**
+                * @brief Explicitly casts to bool
+                * @return true - if not empty/expired, false - otherwise
+                */
                explicit operator bool() const noexcept;
 
+               /**
+                * @brief Implicitly casts to compatible WeakRef type
+                * @return Reference to this object as casted type
+                */
                template <class U, class = typename std::enable_if<
                        std::is_convertible<T *, U *>::value && (
                                std::is_same<typename std::remove_cv<U>::type, void>::value ||
@@ -70,11 +152,27 @@ namespace ucl {
 
        // Non-member functions //
 
+       /**
+        * @brief Makes weak reference for specific shared reference
+        * @param[in] r Source shared reference
+        * @return Result weak reference
+        */
        template <class T>
        WeakRef<T> makeWeak(const SharedRef<T> &r) noexcept;
 
+       /**
+        * @brief Const casts WeakRef<U> to WeakRef<T>
+        * @param[in] r Source weak reference
+        * @return Result weak reference
+        */
        template <class T, class U>
        const WeakRef<T> &constRefCast(const WeakRef<U> &r) noexcept;
+
+       /**
+        * @brief Const casts WeakRef<U> to WeakRef<T>
+        * @param[in] r Source weak reference
+        * @return Result weak reference
+        */
        template <class T, class U>
        WeakRef<T> &&constRefCast(WeakRef<U> &&r) noexcept;
 }
index 40a16e83b6f6e736665da16636c6be4d39a658a0..24074ccad2d4386d1b8624c94e20786fd955b85e 100644 (file)
@@ -23,6 +23,10 @@ namespace ucl {
 
        namespace util {
 
+               /**
+                * @brief Safely disposes object and resets shared reference
+                * @param[in/out] r Target shared reference
+                */
                template <class T, class = typename std::enable_if<
                                std::is_convertible<T *, IDisposable *>::value>::type>
                inline void dispose(SharedRef<T> &r) noexcept
@@ -33,6 +37,10 @@ namespace ucl {
                        }
                }
 
+               /**
+                * @brief Safely disposes object and resets weak reference
+                * @param[in/out] r Target weak reference
+                */
                template <class T, class = typename std::enable_if<
                                std::is_convertible<T *, IDisposable *>::value>::type>
                inline void dispose(WeakRef<T> &r) noexcept
@@ -46,6 +54,11 @@ namespace ucl {
 
        // Generic casting functions //
 
+       /**
+        * @brief Dynamically casts reference objects
+        * @param[in] src Source reference object
+        * @return Result reference object
+        */
        template <class T, class U>
        inline auto dynamicCast(const U &src) noexcept -> decltype(
                        dynamicRefCast<typename T::Type>(src))
@@ -53,6 +66,11 @@ namespace ucl {
                return dynamicRefCast<typename T::Type>(src);
        }
 
+       /**
+        * @brief Const casts reference objects
+        * @param[in] src Source reference object
+        * @return Result reference object
+        */
        template <class T, class U>
        inline auto constCast(U &&src) noexcept -> decltype(
                        constRefCast<typename T::Type>(std::forward<U>(src)))
@@ -91,6 +109,12 @@ namespace ucl {
                }
        }
 
+       /**
+        * @brief Compares equals target pointers/references
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        * @return true - if equal, false - not equal
+        */
        template <class T, class U, class = typename std::enable_if<
                        himpl::IsShared<T>::value || himpl::IsShared<U>::value>::type>
        inline bool operator==(const T &lhs, const U &rhs) noexcept
@@ -98,6 +122,12 @@ namespace ucl {
                return (himpl::getCmpPtr(lhs) == himpl::getCmpPtr(rhs));
        }
 
+       /**
+        * @brief Compares unequals target pointers/references
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        * @return true - if not equal, false - equal
+        */
        template <class T, class U, class = typename std::enable_if<
                        himpl::IsShared<T>::value || himpl::IsShared<U>::value>::type>
        inline bool operator!=(const T &lhs, const U &rhs) noexcept
@@ -105,6 +135,12 @@ namespace ucl {
                return (himpl::getCmpPtr(lhs) != himpl::getCmpPtr(rhs));
        }
 
+       /**
+        * @brief Compares less target pointers/references
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        * @return true - if left is less than right, false - otherwise
+        */
        template <class T, class U, class = typename std::enable_if<
                        himpl::IsShared<T>::value || himpl::IsShared<U>::value>::type>
        inline bool operator<(const T &lhs, const U &rhs) noexcept
@@ -112,6 +148,12 @@ namespace ucl {
                return (himpl::getCmpPtr(lhs) < himpl::getCmpPtr(rhs));
        }
 
+       /**
+        * @brief Compares less or equals target pointers/references
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        * @return true - if left is less or equals to right, false - otherwise
+        */
        template <class T, class U, class = typename std::enable_if<
                        himpl::IsShared<T>::value || himpl::IsShared<U>::value>::type>
        inline bool operator<=(const T &lhs, const U &rhs) noexcept
@@ -119,6 +161,12 @@ namespace ucl {
                return (himpl::getCmpPtr(lhs) <= himpl::getCmpPtr(rhs));
        }
 
+       /**
+        * @brief Compares greater target pointers/references
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        * @return true - if left is greater than right, false - otherwise
+        */
        template <class T, class U, class = typename std::enable_if<
                        himpl::IsShared<T>::value || himpl::IsShared<U>::value>::type>
        inline bool operator>(const T &lhs, const U &rhs) noexcept
@@ -126,6 +174,12 @@ namespace ucl {
                return (himpl::getCmpPtr(lhs) > himpl::getCmpPtr(rhs));
        }
 
+       /**
+        * @brief Compares greater or equals target pointers/references
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        * @return true - if left is greater or equals to right, false - otherwise
+        */
        template <class T, class U, class = typename std::enable_if<
                        himpl::IsShared<T>::value || himpl::IsShared<U>::value>::type>
        inline bool operator>=(const T &lhs, const U &rhs) noexcept
@@ -133,6 +187,12 @@ namespace ucl {
                return (himpl::getCmpPtr(lhs) >= himpl::getCmpPtr(rhs));
        }
 
+       /**
+        * @brief Compares equals target reference and NULL
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs NULL
+        * @return true - if equal, false - not equal
+        */
        template <class T, class = typename std::enable_if<
                        himpl::IsShared<T>::value>::type>
        inline bool operator==(const T &lhs, std::nullptr_t rhs) noexcept
@@ -140,6 +200,12 @@ namespace ucl {
                return !lhs;
        }
 
+       /**
+        * @brief Compares equals target reference and NULL
+        * @param[in] lhs NULL
+        * @param[in] rhs Right hand side operand
+        * @return true - if equal, false - not equal
+        */
        template <class T, class = typename std::enable_if<
                        himpl::IsShared<T>::value>::type>
        bool operator==(std::nullptr_t lhs, const T &rhs) noexcept
@@ -147,6 +213,12 @@ namespace ucl {
                return !rhs;
        }
 
+       /**
+        * @brief Compares unequals target reference and NULL
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs NULL
+        * @return true - if not equal, false - equal
+        */
        template <class T, class = typename std::enable_if<
                        himpl::IsShared<T>::value>::type>
        bool operator!=(const T &lhs, std::nullptr_t rhs) noexcept
@@ -154,6 +226,12 @@ namespace ucl {
                return lhs;
        }
 
+       /**
+        * @brief Compares unequals target reference and NULL
+        * @param[in] lhs NULL
+        * @param[in] rhs Right hand side operand
+        * @return true - if not equal, false - equal
+        */
        template <class T, class = typename std::enable_if<
                        himpl::IsShared<T>::value>::type>
        bool operator!=(std::nullptr_t lhs, const T &rhs) noexcept
index 27c7a93a1a46f743d7a9c29d3f1b846a0aa0c393..65725c500dc68947d83755791129dbfe4c9e37bc 100644 (file)
@@ -25,16 +25,40 @@ namespace ucl {
        template <class FUNC_SIG>
        class WeakDelegate;
 
+       /**
+        * @brief Delegate that uses WeakRef<void> as data pointer
+        */
        template <class R, class ...ARGS>
        class WeakDelegate<R(ARGS...)> :
                        public BaseDelegate<R(ARGS...), WeakRef<void>> {
        public:
+               /**
+                * @brief Constant reference to regular Delegate with same signature
+                * @details Useful as unsubscribe delegate. Especially useful in
+                *          destructors because asWeak(*this) will return NULL
+                *          reference.
+                */
                using CDRef = const Delegate<R(ARGS...)> &;
 
+               /**
+                * @brief Result delegate of the lock() method
+                */
                class LockDelegate {
                public:
+                       /**
+                        * @brief Checks if this delegate is not NULL
+                        * @return true - if not NULL, false - if NULL
+                        */
                        explicit operator bool() const noexcept;
+
+                       /**
+                        * @brief Invokes this delegate
+                        * @details Delgates must be checked for NULL before invoke.
+                        * @params[in] args Arguments of the invoke
+                        * @return Result of the invoke
+                        */
                        R operator()(ARGS ...args) const;
+
                private:
                        LockDelegate(SharedRef<void> data,
                                        typename WeakDelegate::StubA stubA) noexcept;
@@ -47,11 +71,25 @@ namespace ucl {
        public:
                using BaseDelegate<R(ARGS...), WeakRef<void>>::BaseDelegate;
 
+               /**
+                * @brief Locks this delegate for further invoke
+                * @return Lock delegate
+                */
                LockDelegate lock() const;
 
+               /**
+                * @brief Creates delegate to shared instance method
+                * @param[in] data This weak reference of the instance
+                * @return Created delegate
+                */
                template <class CLASS, R(CLASS::*METHOD)(ARGS...)>
                static WeakDelegate make(WeakRef<CLASS> data) noexcept;
 
+               /**
+                * @brief Creates delegate to constant shared instance method
+                * @param[in] data Constant this weak reference of the instance
+                * @return Created delegate
+                */
                template <class CLASS, R(CLASS::*METHOD)(ARGS...) const>
                static WeakDelegate make(WeakRef<const CLASS> data) noexcept;
        };
index 1fc2ebe156145c64b9d79c302f6cb8e115f35625..cd4baa5de8103c0b5d731671a79cb1426a7e2eb3 100644 (file)
 #ifndef __UCL_UTIL_SMART_DELEGATION_MACRO_H__
 #define __UCL_UTIL_SMART_DELEGATION_MACRO_H__
 
+/**
+ * @brief Creates WeakDelegate<auto> to specified shared instance method
+ * @param FUNC Function for the delegate without &
+ * @param DATA Weak reference of the instance
+ * @return Created delegate
+ */
 #define UCL_WEAK_DELEGATE(FUNC, DATA) _UCL_DELEGATE( \
                ::ucl::WeakDelegate, FUNC, DATA)
 
+/**
+ * @brief Creates WeakDelegate<auto> to shared "this" instance method
+ * @param FUNC_NAME name of the function of the "this" class
+ * @return Created delegate
+ */
 #define UCL_WEAK_DELEGATE_THIS(FUNC_NAME) UCL_WEAK_DELEGATE( \
                std::remove_pointer<decltype(this)>::type::FUNC_NAME, asWeak(*this))
 
index ed11c79a0cf558ed99038e2a6aef7ba0a15f5ff6..8226520fd5afeb40303594b2330f2a0d5832b629 100644 (file)
 
 namespace ucl {
 
-       class CondVar final : protected NonCopyable {
+       /**
+        * @brief Implements conditional variable
+        */
+       class CondVar final : private NonCopyable {
        public:
+               /**
+                * @brief Constructor
+                */
                CondVar();
+
+               /**
+                * @brief Destructor
+                */
                ~CondVar();
+
+               /**
+                * @brief Waits on MutexLock until notification
+                * @param[in] lock Target MutexLock object
+                */
                void wait(MutexLock &lock);
+
+               /**
+                * @brief Notifies single waiter of this variable
+                */
                void notify();
+
+               /**
+                * @brief Notifies all waiters of this variable
+                */
                void notifyAll();
+
+               /**
+                * @brief Gets native pthread conditional variable
+                * @return Pointer to pthread conditional variable
+                */
                pthread_cond_t *getHandle();
+
        private:
                pthread_cond_t m_cond;
        };
index aa7233c973d53b1e23a0c6b1771561cb52265959..7370f69eff6373be484080eb59c41cd5bb73dbcb 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Implements mutex
+        */
        class Mutex final : protected NonCopyable {
        public:
+               /**
+                * @brief Constructor
+                * @param[in] recursive Allow reentrancy for this mutex
+                */
                Mutex(bool recursive = false);
+
+               /**
+                * @brief Destructor
+                */
                ~Mutex();
+
+               /**
+                * @brief Acquires lock for this mutex by calling thread
+                */
                void lock();
+
+               /**
+                * @brief Releases lock for this mutex from calling thread
+                */
                void unlock();
+
+               /**
+                * @brief Gets native pthread mutex
+                * @return Pointer to pthread mutex
+                */
                pthread_mutex_t *getHandle();
+
        private:
                pthread_mutex_t m_mutex;
        };
index cf3eb7522b3846e37f6921871c93d0c95c0426cc..927e2232165faf11b63af36eb8973b126a243469 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Implements mutex lock
+        */
        class MutexLock final : protected NonCopyable {
        public:
+               /**
+                * @brief Constructor
+                * @details Locks target mutex
+                * @param[in] mutex Target mutex
+                */
                MutexLock(Mutex &mutex);
+
+               /**
+                * @brief Destructor
+                * @details Unlocks locked mutex
+                */
                ~MutexLock();
+
+               /**
+                * @brief Gets locked mutex
+                * @return Reference to locked mutex
+                */
                Mutex &getMutex();
+
        private:
                Mutex &m_mutex;
        };
index 66a732d738ce51536c3018d85d1d82d282efe388..affb7f7fe90d3043f3d312203791cac270ec64df 100644 (file)
 #ifndef __UCL_UTIL_THREADING_THREAD_H__
 #define __UCL_UTIL_THREADING_THREAD_H__
 
-// Use pthread because Tizen 3.0 officially not support C++ 11
-// And there were problems with threading in C++ 11 and Tizen 3.0
+// Use pthread because Tizen officially not support C++ 11
+// And there were problems with threading in C++ 11 and Tizen
 #include <pthread.h>
 
 #include "ucl/util/types/classTypes.h"
 
 namespace ucl {
 
+       /**
+        * @brief Implements executing thread
+        */
        class Thread final : protected NonCopyable {
        public:
+               /**
+                * @brief Constructor
+                * @details Creates idling thread
+                */
                Thread();
+
+               /**
+                * @brief Constructor
+                * @details Creates running thread
+                * @param[in] func Function to call in new the thread
+                */
                template <class FUNC>
                explicit Thread(FUNC &&func);
+
+               /**
+                * @brief Destructor
+                * @details Joins if was started and not joined
+                */
                ~Thread();
 
+               /**
+                * @brief Gets started status of the thread
+                * @return true - if was started, false - otherwise
+                */
                bool wasStarted() const;
+
+               /**
+                * @brief Gets joined status of the thread
+                * @return true - if was joined, false - otherwise
+                */
                bool wasJoinded() const;
 
+               /**
+                * @brief Starts the thread
+                * @param[in] func Function to call in the new thread
+                * @return true - if was started, false - otherwise
+                */
                template <class FUNC>
                bool start(FUNC &&func);
+
+               /**
+                * @brief Joins with the thread
+                */
                void join();
 
+               /**
+                * @brief Gets native pthread thread
+                * @return Pointer to pthread thread
+                */
                pthread_t *getHandle();
 
        private:
index 74259c15180d96b255f6f4fdbea141414178e751..eea5e1480f35d476f32c61ea27f73114eb48b31b 100644 (file)
@@ -34,7 +34,7 @@ namespace ucl {
 
        inline Thread::~Thread()
        {
-               if (!m_wasJoined) {
+               if (m_wasStarted && !m_wasJoined) {
                        join();
                }
        }
@@ -76,7 +76,7 @@ namespace ucl {
        inline void Thread::join()
        {
                if (!m_wasStarted) {
-                       UCL_WLOG("Not stared started!");
+                       UCL_WLOG("Not started!");
                        return;
                }
                if (m_wasJoined) {
index 93bbdce8329ec287e430d46b4f182a3611d6f2b0..224a1aa7ad8e919bf4e00678376c5c7aded37716 100644 (file)
@@ -23,6 +23,9 @@ namespace ucl {
 
        // ResultData declaration //
 
+       /**
+        * @brief Data that for specific result code
+        */
        struct ResultData final {
                const char *name;
                int logPrio;
@@ -30,32 +33,86 @@ namespace ucl {
 
        // Result declaration //
 
+       /**
+        * @brief Type safe container for "int" result codes
+        */
        struct Result final {
+               /**
+                * @brief Result code value
+                */
                int value;
 
+               /**
+                * @brief Defaulted default constructor
+                */
                Result() = default;
 
+               /**
+                * @brief Conversion constructor
+                * @details v Value of result. Can be any type convertible to "int"
+                *          that has "_UCL_RESULT" constant as public member.
+                */
                template <class VALUE, class = char(*)[VALUE::_UCL_RESULT * 0 + 1]>
                constexpr Result(const VALUE &v) : value(v) {}
        };
 
        // Result non-member functions //
 
+       /**
+        * @brief Gets result data for specific result code
+        * @param[in] result Specific result code
+        * @return Reference to ResultData
+        */
        const ResultData &getResultData(Result result);
 
+       /**
+        * @brief Checks if specific result code is good (>= 0)
+        * @param[in] result Specific result code
+        * @return true - if good, false - otherwise
+        */
        constexpr bool isGood(Result result);
+
+       /**
+        * @brief Checks if specific result code is bad (< 0)
+        * @param[in] result Specific result code
+        * @return true - if bad, false - otherwise
+        */
        constexpr bool isBad(Result result);
 
+       /**
+        * @brief Compares equals values of target results
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        * @return true - if equal, false - not equal
+        */
        constexpr bool operator==(Result lhs, Result rhs);
+
+       /**
+        * @brief Compares unequals values of target results
+        * @param[in] lhs Left hand side operand
+        * @param[in] rhs Right hand side operand
+        * @return true - if not equal, false - equal
+        */
        constexpr bool operator!=(Result lhs, Result rhs);
 
        // Basic Result values //
 
+       /**
+        * @brief Enumeration of basic result codes
+        */
        enum {
+               /**
+                * @brief Allows conversion to Result
+                */
                _UCL_RESULT,
 
                RES_OK    = 0,
                RES_FALSE = 1,
+
+               /**
+                * @brief Denotes past-end result code of the enumeration range
+                * @details Do not move this value around.
+                */
                _RES_END,
 
                RES_FAIL              = -1,
@@ -66,8 +123,12 @@ namespace ucl {
                RES_NOT_SUPPORTED     = -6,
                RES_INVALID_DATA      = -7,
                RES_FATAL             = -8,
-               // TODO MUST match previous item!
-               _RES_BEGIN            = RES_FATAL
+
+               /**
+                * @brief Denotes first result code of the enumeration range
+                * @details Must be last and match previous enumeration value
+                */
+               _RES_BEGIN = RES_FATAL
        };
 }
 
index c5062db0cccb412cfe5f109d3dd0be0f8a6fbf44..2e59dab492eac18f513e695a7926ddd56307bdad 100644 (file)
 #include "ucl/config.h"
 
 namespace ucl {
+
+       /**
+        * @brief Alias for "unsigned int"
+        */
        using UInt = unsigned int;
 }
 
index 6c928ef1d4cef53a19a4aadb2760b3175ca1ae89..c28980919716297b5ed65e52cb0b0c28704a1851 100644 (file)
 
 namespace ucl {
 
+       /**
+        * @brief Base class for all non-copyable objects
+        */
        class NonCopyable {
        public:
+               /**
+                * @brief Deleted copy constructor
+                */
                NonCopyable(const NonCopyable &) = delete;
+
+               /**
+                * @brief Deleted assignment operator
+                */
                NonCopyable &operator=(const NonCopyable &) = delete;
+
        private:
                struct PrivateType {};
+
        protected:
+               /**
+                * @brief Tag-type for restricting non public access
+                */
                using Private = const PrivateType &;
+
+               /**
+                * @brief Value for Private type to allow access
+                */
                static const PrivateType PRIVATE;
+
        protected:
+               /**
+                * @brief Default constructor
+                */
                NonCopyable() = default;
+
+               /**
+                * @brief Destructor
+                */
                ~NonCopyable() = default;
        };
 
+       /**
+        * @brief Interface for object that cen be disposed (half destroyed)
+        */
        class IDisposable : protected NonCopyable {
        public:
+               /**
+                * @brief Disposes the object if not already disposed
+                */
                virtual void dispose() = 0;
+
+               /**
+                * @brief Gets the dispose state
+                * @return true - if disposed, false - otherwise
+                */
                virtual bool isDisposed() const = 0;
+
        protected:
+               /**
+                * @brief Destructor
+                */
                ~IDisposable() = default;
        };
 
+       /**
+        * @brief Template interface for factory that builds IPRODUCT
+        */
        template <class IPRODUCT>
        class IFactory : protected NonCopyable {
        public:
+               /**
+                * @brief Alias for "IPRODUCT"
+                */
                using IProduct = IPRODUCT;
+
        public:
+               /**
+                * @brief Creates new instance of type IPRODUCT
+                * @return Pointer to new instance of type IPRODUCT
+                */
                virtual IPRODUCT *newInstance() const = 0;
+
        protected:
+               /**
+                * @brief Destructor
+                */
                ~IFactory() = default;
        };
 
+       /**
+        * @brief Template implementation of factory that builds PRODUCT
+        */
        template <class PRODUCT, class IPRODUCT>
        class Factory final : public IFactory<IPRODUCT> {
        public:
+               /**
+                * @brief Alias for "PRODUCT"
+                */
                using Product = PRODUCT;
+
        public:
+               /**
+                * @brief Creates new instance of PRODUCT
+                * @return Pointer to new instance of PRODUCT as IPRODUCT
+                */
                virtual IPRODUCT *newInstance() const final override
                {
                        return new PRODUCT();
                }
        };
 
-       // Priority selector for SFINAE functions
+       /**
+        * @brief Priority selector for SFINAE functions
+        * @details Main tamplate for N > 0
+        */
        template <int N>
        struct P : P<N - 1> {};
+
+       /**
+        * @brief Priority selector for SFINAE functions
+        * @details Breaks recursion for N = 0
+        */
        template <>
        struct P<0> {};
 }
index 1983fa67f10bfea735af1982e36d424c6319b472..debb5ac17113b2c30bb1de1f52e55eeff766a6de 100644 (file)
@@ -126,11 +126,11 @@ namespace ucl {
                        elm_app_base_scale_set(baseScale);
                }
 
-               if (appParams.get(AppParam::ACCELERATION_PREFERENECE, paramValue)) {
+               if (appParams.get(AppParam::ACCELERATION_PREFERENCE, paramValue)) {
                        const auto accelPreference = paramValue.asString();
                        if (isEmpty(accelPreference)) {
                                LOG_RETURN(RES_INVALID_DATA,
-                                               "Invalid parameter ACCELERATION_PREFERENECE: %s",
+                                               "Invalid parameter ACCELERATION_PREFERENCE: %s",
                                                accelPreference.get());
                        }
                        elm_config_accel_preference_set(accelPreference.get());
@@ -173,9 +173,9 @@ namespace ucl {
        void UIApp::initSysEventManager()
        {
                m_instanceMgr.setSysEventProvider(
-                               util::makeUnique(new SysEventProvider(
+                               util::makeUnique<SysEventProvider>(
                                        &ui_app_add_event_handler,
-                                       &ui_app_remove_event_handler)));
+                                       &ui_app_remove_event_handler));
        }
 
        Result UIApp::createInstance()
@@ -186,7 +186,7 @@ namespace ucl {
                }
 
                const auto res = instance->onCreate(this);
-               if (isBad(res)) {
+               if (res != RES_OK) {
                        LOG_RETURN(res, "instance->onCreate() failed!");
                }
 
index 278407bd36ac78682416f8f04eb3d20a5f75d480..cace7be2945460525c306143f70abecefa49933e 100644 (file)
 
 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());
index 6195bde45f4c3f1d5a30e73d4822c1f26230ed44..2b20d48da001b66988f727a4e56072327c5d0ef7 100644 (file)
@@ -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!");
                }
index 1509fc5a8726a206db29d24dff86d92c765d0e22..f5fb2fd0bc9053859f83a99bb4b81c11e88812e9 100644 (file)
@@ -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!");
                }
index 4cee1f8e7bd6ed31c42b0b586f5aef56551fc722..7943607a705ab0f1e9c549382aa193f237476200 100644 (file)
@@ -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 {};
index 3065e0adfa81430cfdfd2320ae7d446f8d2d8607..ce8ecc7c75175af285cfacaa26de3a53f61ce9ed 100644 (file)
@@ -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!");
                }
index bc7d6e823742e240312ac4ed2d860ded145f0780..7da5d29fc1493ed83c5c9ddb31952b6c78be267b 100644 (file)
@@ -35,7 +35,7 @@ namespace ucl {
                        m_handler(std::move(handler)),
                        m_type(static_cast<Evas_Callback_Type>(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);
                        }
                }
index 923551308d6fcb3c14542b1238e69ea750af0c12..78addf33c3e528379978786e264d029c405ba7a3 100644 (file)
@@ -45,21 +45,22 @@ 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);
 
-               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<Window>(winEo, isOwner, conform, PRIVATE);
+               auto result = makeShared<Window>(winEo, isOwner,
+                               as_eo(conform), PRIVATE);
 
                if (m_needBindToEo) {
                        result->bindToEo();
index 865fdec7e9a833dce1be1ba8502ba589ecf0f98d..bb8d71937f340d5936d226835787c552acc0690c 100644 (file)
@@ -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;
                        };
@@ -134,7 +134,8 @@ namespace ucl {
        ListItemPresenter::ListItemPresenter(IRefCountObj &rc) :
                RefCountAware(&rc),
                m_flags(PF_AUTO_UNSELECT),
-               m_isItemPicked(false)
+               m_isItemPicked(false),
+               m_isListeningToItemAtspiGesture(false)
        {
        }
 
@@ -146,9 +147,8 @@ namespace ucl {
                }
        }
 
-       void ListItemPresenter::attachItem(GenlistItem item, ElmWidgetSRef &&parent,
-                       const ItemClassCacheSRef &itcCache,
-                       const SharedRef<bool> &isActiveRef)
+       void ListItemPresenter::attachItem(GenlistItem item, ElmWidgetSRef parent,
+                       ItemClassCacheSRef itcCache, SharedRef<bool> isActiveRef)
        {
                if (m_item) {
                        deleteDetachedItem();
@@ -158,10 +158,13 @@ namespace ucl {
                m_item.setData(this);
                m_item.setDelCallback(CALLBACK_A(ListItemPresenter::onItemDel));
 
-               m_parent = std::move(parent);
+               if (m_itemAtspiGestureHandler) {
+                       tryListenToItemAtspiGesture();
+               }
 
-               m_itcCache = itcCache;
-               m_isActiveRef = isActiveRef;
+               m_parent = std::move(parent);
+               m_itcCache = std::move(itcCache);
+               m_isActiveRef = std::move(isActiveRef);
 
                if (!m_selfRef) {
                        m_selfRef = asShared(*this);
@@ -179,6 +182,9 @@ namespace ucl {
 
        void ListItemPresenter::detachItem(const bool silent)
        {
+               m_itemAtspi.reset();
+               m_isListeningToItemAtspiGesture = false;
+
                m_item.setData(nullptr);
                m_item.setDelCallback(nullptr);
                m_item = nullptr;
@@ -192,6 +198,24 @@ namespace ucl {
                }
        }
 
+       void ListItemPresenter::tryEnsureItemAtspi()
+       {
+               if (!m_itemAtspi && m_item) {
+                       m_itemAtspi = makeShared<Atspi>(m_item);
+               }
+       }
+
+       void ListItemPresenter::tryListenToItemAtspiGesture()
+       {
+               if (!m_isListeningToItemAtspiGesture) {
+                       if (const auto atspi = getItemAtspi()) {
+                               m_isListeningToItemAtspiGesture = true;
+                               atspi->addGestureHandler(
+                                               WEAK_DELEGATE_THIS(onItemAtspiGesture));
+                       }
+               }
+       }
+
        void ListItemPresenter::onItemDel(Evas_Object *obj, void *eventInfo)
        {
                if (m_item) {
@@ -200,6 +224,14 @@ namespace ucl {
                m_selfRef.reset();
        }
 
+       void ListItemPresenter::onItemAtspiGesture(Atspi &atspi,
+                       AtspiGestureEventInfo &eventInfo)
+       {
+               if (const auto handler = m_itemAtspiGestureHandler.lock()) {
+                       handler(atspi, eventInfo);
+               }
+       }
+
        void ListItemPresenter::setFlags(const int flags)
        {
                m_flags = flags;
@@ -282,27 +314,41 @@ namespace ucl {
                        return nullptr;
                }
 
-               auto check = makeShared<StyledWidget>(elm_check_add(parent));
+               auto check = makeShared<StyledWidget>(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));
 
+               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;
        }
 
        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);
@@ -316,6 +362,19 @@ namespace ucl {
                return m_item;
        }
 
+       Atspi *ListItemPresenter::getItemAtspi()
+       {
+               tryEnsureItemAtspi();
+               return m_itemAtspi.get();
+       }
+
+       const Atspi *ListItemPresenter::getItemAtspi() const
+       {
+               // Need cast for lazy initialization. Can't use mutable.
+               const_cast<ListItemPresenter *>(this)->tryEnsureItemAtspi();
+               return m_itemAtspi.get();
+       }
+
        ListItemPresenter::ItemClassCache *ListItemPresenter::getItemClassCache()
        {
                return m_itcCache.get();
@@ -354,6 +413,15 @@ namespace ucl {
                return RES_OK;
        }
 
+       void ListItemPresenter::setItemAtspiGestureHandler(
+                       AtspiGestureHandler handler)
+       {
+               if (handler) {
+                       tryListenToItemAtspiGesture();
+               }
+               m_itemAtspiGestureHandler = std::move(handler);
+       }
+
        Result ListItemPresenter::updateItemStyle(const ElmStyle newItemStyle)
        {
                if (!m_item) {
@@ -441,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());
+       }
 }
index 407cb5c728762bf8481eea26449940cdeefa82c1..242928e4ea523edf8fc3f1f3a3b1fcc159a369c0 100644 (file)
@@ -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));
 
@@ -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,