From: Lukasz Wlazly Date: Thu, 6 Dec 2018 08:05:22 +0000 (+0100) Subject: Naviframe in cpp style X-Git-Tag: submit/tizen/20190116.045417~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=851439b9200cc3a4a3882f532723bac888c06659;p=profile%2Fmobile%2Fapps%2Fnative%2Faccessibility-setting.git Naviframe in cpp style Change-Id: I5a2dfb8086d4cb0f8348f06eb4eeed709ff89e58 --- diff --git a/src/AccessibilityLauncherPage.cpp b/src/AccessibilityLauncherPage.cpp index 9c051fd..8df5722 100644 --- a/src/AccessibilityLauncherPage.cpp +++ b/src/AccessibilityLauncherPage.cpp @@ -45,7 +45,7 @@ AccessibilityLauncherPage::AccessibilityLauncherPage(SettingAccessibility *ad) int ret; int state = 0; GenGroupItemData *item = NULL; - Evas_Object *genlist = elm_genlist_add(ad->md.getNaviframe()); + Evas_Object *genlist = elm_genlist_add(ad->md.getNaviframe()->getObject()); if (genlist == NULL) { SETTING_TRACE_ERROR("Cannot set genlist object as content of layout"); delete[] items; @@ -101,12 +101,12 @@ AccessibilityLauncherPage::AccessibilityLauncherPage(SettingAccessibility *ad) } - ad->md.naviframe_it = elm_naviframe_item_push(ad->md.getNaviframe(), _("IDS_ACCS_ACCESSIBILITY_LAUNCHER"), NULL, NULL, genlist, NULL); + ad->md.naviframe_it = elm_naviframe_item_push(ad->md.getNaviframe()->getObject(), _("IDS_ACCS_ACCESSIBILITY_LAUNCHER"), NULL, NULL, genlist, NULL); elm_naviframe_item_pop_cb_set(ad->md.naviframe_it, onNaviframePopCb, items); elm_object_item_domain_text_translatable_set(ad->md.naviframe_it, PACKAGE, EINA_TRUE); - Evas_Object *back_btn = WidgetFactory::createButton(ad->md.getNaviframe(), {}, WidgetFactory::BACK_BUTTON_ARROW_STYLE, onBackButtonCb, ad); - elm_layout_content_set(ad->md.getNaviframe(), "prev_btn", back_btn); + Evas_Object *back_btn = WidgetFactory::createButton(ad->md.getNaviframe()->getObject(), {}, WidgetFactory::BACK_BUTTON_ARROW_STYLE, onBackButtonCb, ad); + elm_layout_content_set(ad->md.getNaviframe()->getObject(), "prev_btn", back_btn); } Eina_Bool AccessibilityLauncherPage::onNaviframePopCb(void *data, Elm_Object_Item *it) @@ -122,7 +122,7 @@ void AccessibilityLauncherPage::onBackButtonCb(void *data, Evas_Object *obj, voi { retm_if(data == NULL, "Data argument is NULL"); auto ad = static_cast(data); - elm_naviframe_item_pop(ad->md.getNaviframe()); + elm_naviframe_item_pop(ad->md.getNaviframe()->getObject()); } void AccessibilityLauncherPage::updateVconf(ItemWrapper *items) diff --git a/src/AccessoriesSwitchesPage.cpp b/src/AccessoriesSwitchesPage.cpp index 1e900aa..0039995 100644 --- a/src/AccessoriesSwitchesPage.cpp +++ b/src/AccessoriesSwitchesPage.cpp @@ -32,17 +32,17 @@ AccessoriesSwitchesPage::AccessoriesSwitchesPage(SettingAccessibility *ad) { retm_if(ad == NULL, "Input parameter is NULL"); - Evas_Object *layout = createLayout(ad->md.getNaviframe(), EDJ_ACCESSORY, GRP_ACCESSORY); + Evas_Object *layout = createLayout(ad->md.getNaviframe()->getObject(), EDJ_ACCESSORY, GRP_ACCESSORY); ad->us_configuration.switch_id = {}; elm_layout_text_set(layout, PRT_ACCESSORY_LABEL, _("IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_ACCESSORIES_DESC")); - Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->md.getNaviframe(), _("IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_ACCESSORIES_TITLE"), NULL, NULL, layout, NULL); + Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->md.getNaviframe()->getObject(), _("IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_ACCESSORIES_TITLE"), NULL, NULL, layout, NULL); elm_naviframe_item_pop_cb_set(navi_it, naviframPopCb, ad); elm_object_item_domain_text_translatable_set(navi_it, PACKAGE, EINA_TRUE); - Evas_Object *back_btn = WidgetFactory::createButton(ad->md.getNaviframe(), {}, WidgetFactory::BACK_BUTTON_ARROW_STYLE, backCb, ad); - elm_layout_content_set(ad->md.getNaviframe(), "prev_btn", back_btn); + Evas_Object *back_btn = WidgetFactory::createButton(ad->md.getNaviframe()->getObject(), {}, WidgetFactory::BACK_BUTTON_ARROW_STYLE, backCb, ad); + elm_layout_content_set(ad->md.getNaviframe()->getObject(), "prev_btn", back_btn); setting_accessibility_universal_switch_dbus_config_captureSwitch(&ad->config, ACCESSIBILITY_UNIVERSAL_SWITCH_ACCESSORIES_SWITCH_PROVIDER, -1, captureSwitchCb, ad); } @@ -100,7 +100,7 @@ void AccessoriesSwitchesPage::captureSwitchCb(void *user_data, const char *switc } ad->us_configuration.switch_id = switch_id; - ad->settingPopup_ = std::make_unique(ad, ad->md.getNaviframe(), + ad->settingPopup_ = std::make_unique(ad, ad->md.getNaviframe()->getObject(), "IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH", std::string{}, popupResponseCb, 0, true, @@ -117,7 +117,7 @@ void AccessoriesSwitchesPage::captureSwitchCb(void *user_data, const char *switc void AccessoriesSwitchesPage::alreadyMappedSwitchPopup(SettingAccessibility *ad) { - ad->settingPopup_ = std::make_unique(ad, ad->md.getNaviframe(), + ad->settingPopup_ = std::make_unique(ad, ad->md.getNaviframe()->getObject(), "IDS_ACCS_UNIVERSAL_SWITCH_UNABLE_TO_ADD", std::string{}, okResponseCb, 0, true, @@ -154,7 +154,7 @@ void AccessoriesSwitchesPage::popupResponseCb(void *data, Evas_Object *obj, void } ad->actionPage_ = std::make_unique(ad); - elm_naviframe_item_pop_cb_set(elm_naviframe_top_item_get(ad->md.getNaviframe()), renewCaptureSwitchCb, ad); + elm_naviframe_item_pop_cb_set(elm_naviframe_top_item_get(ad->md.getNaviframe()->getObject()), renewCaptureSwitchCb, ad); ActionPage::attachCallback(ad, accessorySwitchActionCb, (void *)strdup(switch_name)); } else { renewCaptureSwitchCb(ad, NULL); @@ -201,5 +201,5 @@ void AccessoriesSwitchesPage::backCb(void *data, Evas_Object *obj, void *event_i { retm_if(data == NULL, "Data argument is NULL"); auto ad = static_cast(data); - elm_naviframe_item_pop(ad->md.getNaviframe()); + elm_naviframe_item_pop(ad->md.getNaviframe()->getObject()); } diff --git a/src/AddSwitchPage.cpp b/src/AddSwitchPage.cpp index d8904c4..ac543a5 100644 --- a/src/AddSwitchPage.cpp +++ b/src/AddSwitchPage.cpp @@ -24,7 +24,7 @@ AddSwitchPage::AddSwitchPage(SettingAccessibility *ad) { retm_if(ad == NULL, "Input parameter is NULL"); - Evas_Object *genlist = elm_genlist_add(ad->md.getNaviframe()); + Evas_Object *genlist = elm_genlist_add(ad->md.getNaviframe()->getObject()); retm_if(genlist == NULL, "Cannot set genlist object as content of layout"); elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); @@ -46,12 +46,12 @@ AddSwitchPage::AddSwitchPage(SettingAccessibility *ad) } } - Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->md.getNaviframe(), _("IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH"), NULL, NULL, genlist, NULL); + Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->md.getNaviframe()->getObject(), _("IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH"), NULL, NULL, genlist, NULL); elm_naviframe_item_pop_cb_set(navi_it, onNaviframePopCb, ad); elm_object_item_domain_text_translatable_set(navi_it, PACKAGE, EINA_TRUE); - Evas_Object *back_btn = WidgetFactory::createButton(ad->md.getNaviframe(), {}, WidgetFactory::BACK_BUTTON_ARROW_STYLE, backCb, ad); - elm_layout_content_set(ad->md.getNaviframe(), "prev_btn", back_btn); + Evas_Object *back_btn = WidgetFactory::createButton(ad->md.getNaviframe()->getObject(), {}, WidgetFactory::BACK_BUTTON_ARROW_STYLE, backCb, ad); + elm_layout_content_set(ad->md.getNaviframe()->getObject(), "prev_btn", back_btn); } void AddSwitchPage::attachCallbackOnSwitchAttach(SettingAccessibility *ad, UniversalSwitchUpdateCb cb) @@ -113,7 +113,7 @@ void AddSwitchPage::backCb(void *data, Evas_Object *obj, void *event_info) retm_if(data == NULL, "Data argument is NULL"); auto ad = static_cast(data); - elm_naviframe_item_pop(ad->md.getNaviframe()); + elm_naviframe_item_pop(ad->md.getNaviframe()->getObject()); } Eina_Bool AddSwitchPage::onNaviframePopCb(void *data, Elm_Object_Item *it) diff --git a/src/CameraSwitchesPage.cpp b/src/CameraSwitchesPage.cpp index 6e089d9..345f2ad 100644 --- a/src/CameraSwitchesPage.cpp +++ b/src/CameraSwitchesPage.cpp @@ -24,7 +24,7 @@ CameraSwitchesPage::CameraSwitchesPage(SettingAccessibility *ad) { retm_if(ad == NULL, "Input parameter is NULL"); - Evas_Object *genlist = elm_genlist_add(ad->md.getNaviframe()); + Evas_Object *genlist = elm_genlist_add(ad->md.getNaviframe()->getObject()); retm_if(genlist == NULL, "Cannot set genlist object as content of layout"); elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); @@ -59,11 +59,11 @@ CameraSwitchesPage::CameraSwitchesPage(SettingAccessibility *ad) } } - Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->md.getNaviframe(), _("IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_CAMERA_TITLE"), NULL, NULL, genlist, NULL); + Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->md.getNaviframe()->getObject(), _("IDS_ACCS_UNIVERSAL_SWITCH_ADD_SWITCH_CAMERA_TITLE"), NULL, NULL, genlist, NULL); elm_object_item_domain_text_translatable_set(navi_it, PACKAGE, EINA_TRUE); - Evas_Object *back_btn = WidgetFactory::createButton(ad->md.getNaviframe(), {}, WidgetFactory::BACK_BUTTON_ARROW_STYLE, backCb, ad); - elm_layout_content_set(ad->md.getNaviframe(), "prev_btn", back_btn); + Evas_Object *back_btn = WidgetFactory::createButton(ad->md.getNaviframe()->getObject(), {}, WidgetFactory::BACK_BUTTON_ARROW_STYLE, backCb, ad); + elm_layout_content_set(ad->md.getNaviframe()->getObject(), "prev_btn", back_btn); } void CameraSwitchesPage::attachActionCallback(SettingAccessibility *ad, UniversalSwitchUpdateCb cb) @@ -109,5 +109,5 @@ void CameraSwitchesPage::backCb(void *data, Evas_Object *obj, void *event_info) retm_if(data == NULL, "Data argument is NULL"); auto ad = static_cast(data); - elm_naviframe_item_pop(ad->md.getNaviframe()); + elm_naviframe_item_pop(ad->md.getNaviframe()->getObject()); } diff --git a/src/MainData.cpp b/src/MainData.cpp index bec8fbc..83f3f60 100644 --- a/src/MainData.cpp +++ b/src/MainData.cpp @@ -21,7 +21,6 @@ #include "setting-debug.h" #include "WidgetFactory.hpp" -#include #include int MainData::initApp(const std::string &name) @@ -61,9 +60,9 @@ Evas_Object *MainData::getWindow() const return window->getObject(); } -Evas_Object *MainData::getNaviframe() const +Naviframe *MainData::getNaviframe() const { - return naviframe; + return naviframe_; } Evas_Object *MainData::getGenlist() const @@ -79,31 +78,21 @@ int MainData::initViewWithoutGenlist(const std::string &name) conformant->show(); window->addResizeObject(conformant); - /* create a naviframe */ - naviframe = elm_naviframe_add(conformant->getObject()); - setting_retvm_if(naviframe == NULL, SETTING_RETURN_FAIL, "naviframe == NULL"); + naviframe_ = Widget::make(conformant); + naviframe_->createPrevBtnAutomatically(false); + conformant->setContent(naviframe_); - elm_naviframe_prev_btn_auto_pushed_set(naviframe, EINA_FALSE); - eext_object_event_callback_add(naviframe, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL); - eext_object_event_callback_add(naviframe, EEXT_CALLBACK_MORE, eext_naviframe_more_cb, NULL); - - elm_object_content_set(conformant->getObject(), naviframe); conformant->emitSignal("elm,state,virtualkeypad,enable"); conformant->emitSignal("elm,state,clipboard,enable"); /* LAYOUT */ - layout = elm_layout_add(naviframe); + layout = elm_layout_add(naviframe_->getObject()); setting_retvm_if(layout == NULL, FALSE, "layout == NULL"); elm_layout_theme_set(layout, "layout", "application", "default"); - /* push a view to the naviframe */ - naviframe_it = elm_naviframe_item_push(naviframe, NULL, NULL, NULL, layout, NULL); - elm_object_item_disabled_set(naviframe_it, EINA_FALSE); - elm_naviframe_item_title_enabled_set(naviframe_it, EINA_TRUE, EINA_TRUE); - elm_object_item_domain_text_translatable_set(naviframe_it, PACKAGE, EINA_TRUE); - elm_object_item_part_text_set(naviframe_it, "elm.text.title", name.c_str()); + naviframe_it = elm_naviframe_item_push(naviframe_->getObject(), name.c_str(), NULL, NULL, layout, NULL); - evas_object_show(naviframe); + naviframe_->show(); evas_object_show(layout); return SETTING_RETURN_SUCCESS; @@ -155,8 +144,8 @@ void MainData::onAllGenlistRealizedCb(void *data, Evas_Object *obj, void *event_ void MainData::addBackButton(Elm_Naviframe_Item_Pop_Cb view_pop_cb, void *ad) const { - auto back_button = WidgetFactory::createButton(naviframe, "IDS_ST_BUTTON_BACK", WidgetFactory::BACK_BUTTON_ARROW_STYLE, softkeyBackClickCb, naviframe); - elm_layout_content_set(naviframe, "prev_btn", back_button); + auto back_button = WidgetFactory::createButton(naviframe_->getObject(), "IDS_ST_BUTTON_BACK", WidgetFactory::BACK_BUTTON_ARROW_STYLE, softkeyBackClickCb, naviframe_->getObject()); + elm_layout_content_set(naviframe_->getObject(), "prev_btn", back_button); elm_naviframe_item_pop_cb_set(naviframe_it, view_pop_cb, ad); } diff --git a/src/MainData.hpp b/src/MainData.hpp index f70c889..bc203e6 100644 --- a/src/MainData.hpp +++ b/src/MainData.hpp @@ -19,6 +19,7 @@ #include "Window.hpp" #include "Conformant.hpp" +#include "Naviframe.hpp" #include @@ -34,7 +35,7 @@ public: int initApp(const std::string &name); void initView(const std::string &name); Evas_Object *getWindow() const; - Evas_Object *getNaviframe() const; + Naviframe *getNaviframe() const; Evas_Object *getGenlist() const; void addBackButton(Elm_Naviframe_Item_Pop_Cb view_pop_cb, void *ad) const; Elm_Object_Item *naviframe_it; @@ -49,7 +50,7 @@ private: Evas *evas; std::unique_ptr window; - Evas_Object *naviframe; + Naviframe *naviframe_; Evas_Object *layout; Evas_Object *genlist; }; diff --git a/src/Naviframe.cpp b/src/Naviframe.cpp index 3647fb6..5489e06 100644 --- a/src/Naviframe.cpp +++ b/src/Naviframe.cpp @@ -2,10 +2,14 @@ #include "setting-debug.h" +#include + Naviframe::Naviframe(Widget *parent) : Widget(parent) { obj_ = elm_naviframe_add(parent->getObject()); + eext_object_event_callback_add(obj_, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL); + eext_object_event_callback_add(obj_, EEXT_CALLBACK_MORE, eext_naviframe_more_cb, NULL); } void Naviframe::createPrevBtnAutomatically(bool automatically) @@ -15,26 +19,34 @@ void Naviframe::createPrevBtnAutomatically(bool automatically) void Naviframe::pushBack(const TranslatedString &title, Widget *content, const std::string &style, std::function onPopCb) { - auto it = elm_naviframe_item_push(obj_, title.c_str(), nullptr, nullptr, content->getObject(), style.c_str()); - callbacks.insert_or_assign(it, std::move(onPopCb)); - elm_naviframe_item_pop_cb_set(it, callbackMethod, this); + top_ = elm_naviframe_item_push(obj_, title.c_str(), nullptr, nullptr, content->getObject(), style.c_str()); + if (onPopCb) { + naviframeCallbacks_.insert_or_assign(top_, std::move(onPopCb)); + elm_naviframe_item_pop_cb_set(top_, callbackMethod, this); + } } void Naviframe::popBack() { elm_naviframe_item_pop(obj_); + top_ = elm_naviframe_top_item_get(obj_); } void Naviframe::onPop(Elm_Object_Item *item) { - auto cb = callbacks.find(item); - if (cb == callbacks.end()) { + auto cb = naviframeCallbacks_.find(item); + if (cb == naviframeCallbacks_.end()) { SETTING_TRACE_ERROR("No callback registered for this frame"); return; } cb->second(); } +Elm_Naviframe_Item *Naviframe::top() +{ + return top_; +} + Eina_Bool Naviframe::callbackMethod(void *data, Elm_Object_Item *it) { auto self = static_cast(data); diff --git a/src/Naviframe.hpp b/src/Naviframe.hpp index 239a94a..10afde6 100644 --- a/src/Naviframe.hpp +++ b/src/Naviframe.hpp @@ -3,7 +3,7 @@ #include "Widget.hpp" -class Naviframe : public Widget, std::enable_shared_from_this +class Naviframe : public Widget { public: Naviframe(Widget *parent); @@ -12,12 +12,13 @@ public: void pushBack(const TranslatedString &title, Widget *content, const std::string &style, std::function onPopCb); void popBack(); void onPop(Elm_Object_Item *item); + Elm_Naviframe_Item *top(); private: static Eina_Bool callbackMethod(void *data, Elm_Object_Item *it); - Elm_Naviframe_Item *top = nullptr; - std::unordered_map> callbacks; + Elm_Naviframe_Item *top_ = nullptr; + std::unordered_map> naviframeCallbacks_; }; #endif diff --git a/src/RemoveSwitchPage.cpp b/src/RemoveSwitchPage.cpp index efeeb8f..c556648 100644 --- a/src/RemoveSwitchPage.cpp +++ b/src/RemoveSwitchPage.cpp @@ -33,11 +33,11 @@ RemoveSwitchPage::RemoveSwitchPage(SettingAccessibility *ad) ad->setValuePage_ = std::make_unique(ad, ValueEditorType::SWITCHES, _("IDS_ACCS_SELECT_ITEMS")); - ad->all_checkbox = WidgetFactory::createCheck(ad->md.getNaviframe(), EINA_FALSE, nullptr, {}, onAllButtonsClicked, ad); - elm_layout_content_set(ad->md.getNaviframe(), "prev_btn", ad->all_checkbox); + ad->all_checkbox = WidgetFactory::createCheck(ad->md.getNaviframe()->getObject(), EINA_FALSE, nullptr, {}, onAllButtonsClicked, ad); + elm_layout_content_set(ad->md.getNaviframe()->getObject(), "prev_btn", ad->all_checkbox); - ad->remove_switches_popup_button = WidgetFactory::createButton(ad->md.getNaviframe(), "IDS_ACCS_DELETE_CAPS", "naviframe/title_right", onDeleteButtonClicked, ad); - elm_layout_content_set(ad->md.getNaviframe(), "title_right_btn", ad->remove_switches_popup_button); + ad->remove_switches_popup_button = WidgetFactory::createButton(ad->md.getNaviframe()->getObject(), "IDS_ACCS_DELETE_CAPS", "naviframe/title_right", onDeleteButtonClicked, ad); + elm_layout_content_set(ad->md.getNaviframe()->getObject(), "title_right_btn", ad->remove_switches_popup_button); elm_object_disabled_set(ad->remove_switches_popup_button, EINA_TRUE); for (auto i = 0u; i < ad->config.configuration_items.size(); ++i) { @@ -97,12 +97,12 @@ void RemoveSwitchPage::useNaviframeTitleAsCounter(SettingAccessibility *ad) title = TranslatedString{"IDS_ACCS_SELECT_ITEMS"} .str(); } elm_object_disabled_set(ad->remove_switches_popup_button, ad->switches_to_remove_counter ? EINA_FALSE : EINA_TRUE); - elm_layout_text_set(ad->md.getNaviframe(), "default", title.c_str()); + elm_layout_text_set(ad->md.getNaviframe()->getObject(), "default", title.c_str()); } void RemoveSwitchPage::createPopupForSwitchesRemoving(SettingAccessibility *ad) { - ad->popup = elm_popup_add(ad->md.getNaviframe()); + ad->popup = elm_popup_add(ad->md.getNaviframe()->getObject()); retm_if(!ad->popup, "Popup creation failure"); elm_popup_orient_set(ad->popup, ELM_POPUP_ORIENT_CENTER); evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); @@ -158,7 +158,7 @@ void RemoveSwitchPage::onRemoveSelectedSwitches(void *data, Evas_Object *obj, vo evas_object_del(ad->popup); ad->popup = NULL; - elm_naviframe_item_pop(ad->md.getNaviframe()); + elm_naviframe_item_pop(ad->md.getNaviframe()->getObject()); if (disable_universal_switch && vconf_set_bool(VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_INTERACTION_SERVICE, 0)) LOGE("Failed to set vconf key %s.", VCONFKEY_SETAPPL_ACCESSIBILITY_UNIVERSAL_SWITCH_INTERACTION_SERVICE); diff --git a/src/ScreenReaderPage.cpp b/src/ScreenReaderPage.cpp index 50b1d14..7d65b4e 100644 --- a/src/ScreenReaderPage.cpp +++ b/src/ScreenReaderPage.cpp @@ -23,7 +23,7 @@ ScreenReaderPage::ScreenReaderPage(SettingAccessibility *data) { auto ad = static_cast(data); - Evas_Object *genlist = elm_genlist_add(ad->md.getNaviframe()); + Evas_Object *genlist = elm_genlist_add(ad->md.getNaviframe()->getObject()); retm_if(genlist == NULL, "Cannot set genlist object as content of layout"); elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); elm_object_style_set(genlist, "dialogue"); @@ -80,7 +80,7 @@ ScreenReaderPage::ScreenReaderPage(SettingAccessibility *data) __BACK_POINTER_SET(screen_reader_settings); } - Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->md.getNaviframe(), _("IDS_ST_MBODY_SCREEN_READER_HTTS"), NULL, NULL, genlist, NULL); + Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->md.getNaviframe()->getObject(), _("IDS_ST_MBODY_SCREEN_READER_HTTS"), NULL, NULL, genlist, NULL); elm_object_item_domain_text_translatable_set(navi_it, PACKAGE, EINA_TRUE); @@ -145,7 +145,7 @@ Eina_Bool ScreenReaderPage::hideScreenReaderPage(void *data, Elm_Object_Item *it retv_if(data == NULL, EINA_TRUE); auto ad = static_cast(data); vconf_ignore_key_changed(VCONFKEY_SETAPPL_ACCESSIBILITY_TTS, onVconfChangedCb); - elm_naviframe_item_pop(ad->md.getNaviframe()); + elm_naviframe_item_pop(ad->md.getNaviframe()->getObject()); return EINA_TRUE; } diff --git a/src/ScreenReaderSettingsPage.cpp b/src/ScreenReaderSettingsPage.cpp index 28147c5..b2be721 100644 --- a/src/ScreenReaderSettingsPage.cpp +++ b/src/ScreenReaderSettingsPage.cpp @@ -60,7 +60,7 @@ ScreenReaderSettingsPage::ScreenReaderSettingsPage(SettingAccessibility *data) int vconf_val = 0; int vconf_ret; - Evas_Object *genlist = elm_genlist_add(ad->md.getNaviframe()); + Evas_Object *genlist = elm_genlist_add(ad->md.getNaviframe()->getObject()); retm_if(genlist == NULL, "Cannot set genlist object as content of layout"); elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); elm_object_style_set(genlist, "dialogue"); @@ -221,7 +221,7 @@ ScreenReaderSettingsPage::ScreenReaderSettingsPage(SettingAccessibility *data) ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } - Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->md.getNaviframe(), _("IDS_ST_OPT_SETTINGS"), NULL, NULL, genlist, NULL); + Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->md.getNaviframe()->getObject(), _("IDS_ST_OPT_SETTINGS"), NULL, NULL, genlist, NULL); elm_object_item_domain_text_translatable_set(navi_it, PACKAGE, EINA_TRUE); elm_naviframe_item_pop_cb_set(navi_it, hidePage, ad); @@ -619,7 +619,7 @@ Eina_Bool ScreenReaderSettingsPage::hidePage(void *data, Elm_Object_Item *it) LOGE("Fail to setting finalize"); return -1; } - elm_naviframe_item_pop(ad->md.getNaviframe()); + elm_naviframe_item_pop(ad->md.getNaviframe()->getObject()); return EINA_TRUE; } diff --git a/src/SetValuePage.cpp b/src/SetValuePage.cpp index fbbec8e..ef1c2fd 100644 --- a/src/SetValuePage.cpp +++ b/src/SetValuePage.cpp @@ -65,7 +65,7 @@ SetValuePage::SetValuePage(SettingAccessibility *ad, ValueEditorType type, const SETTING_TRACE_DEBUG("Unrecognized layout type!"); } - ad->set_value_layout.setLayout(createLayout(ad->md.getNaviframe(), layout_grp)); + ad->set_value_layout.setLayout(createLayout(ad->md.getNaviframe()->getObject(), layout_grp)); switch (type) { case ValueEditorType::NUMERIC: @@ -94,12 +94,12 @@ SetValuePage::SetValuePage(SettingAccessibility *ad, ValueEditorType type, const LOGE("Wrong value type"); } - Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->md.getNaviframe(), title, NULL, NULL, ad->set_value_layout.getLayout(), NULL); + Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->md.getNaviframe()->getObject(), title, NULL, NULL, ad->set_value_layout.getLayout(), NULL); elm_naviframe_item_pop_cb_set(navi_it, naviframePopCb, ad); elm_object_item_domain_text_translatable_set(navi_it, PACKAGE, EINA_TRUE); - Evas_Object *back_btn = WidgetFactory::createButton(ad->md.getNaviframe(), {}, WidgetFactory::BACK_BUTTON_ARROW_STYLE, backCb, ad); - elm_layout_content_set(ad->md.getNaviframe(), "prev_btn", back_btn); + Evas_Object *back_btn = WidgetFactory::createButton(ad->md.getNaviframe()->getObject(), {}, WidgetFactory::BACK_BUTTON_ARROW_STYLE, backCb, ad); + elm_layout_content_set(ad->md.getNaviframe()->getObject(), "prev_btn", back_btn); } void SetValuePage::setDescription(SettingAccessibility *ad, const char *description) @@ -288,7 +288,7 @@ void SetValuePage::createUpdateAccessoriesSwitchPage(SettingAccessibility *ad) { Evas_Object *tb; Elm_Object_Item *nf_it; - tb = elm_toolbar_add(ad->md.getNaviframe()); + tb = elm_toolbar_add(ad->md.getNaviframe()->getObject()); elm_toolbar_select_mode_set(tb, ELM_OBJECT_SELECT_MODE_NONE); evas_object_smart_callback_add(tb, "clicked", closeUpdateAccessoriesSwitchPage, ad); evas_object_show(tb); @@ -299,7 +299,7 @@ void SetValuePage::createUpdateAccessoriesSwitchPage(SettingAccessibility *ad) elm_toolbar_item_append(tb, NULL, _("IDS_ACCS_UNIVERSAL_SWITCH_CANCEL"), NULL, NULL); ad->save_object_item = elm_toolbar_item_append(tb, NULL, _("IDS_ACCS_UNIVERSAL_SWITCH_SAVE"), NULL, NULL); - ad->set_value_layout.setLayout(createLayout(ad->md.getNaviframe(), GRP_SET_VALUE_UPDATE_ACCESSORIES_SWITCH)); + ad->set_value_layout.setLayout(createLayout(ad->md.getNaviframe()->getObject(), GRP_SET_VALUE_UPDATE_ACCESSORIES_SWITCH)); ad->entry = elm_entry_add(ad->set_value_layout.getLayout()); elm_entry_entry_set(ad->entry, ad->config_item_to_update.user_name.c_str()); elm_entry_cursor_end_set(ad->entry); @@ -311,7 +311,7 @@ void SetValuePage::createUpdateAccessoriesSwitchPage(SettingAccessibility *ad) ad->update_accessories_action_genlist = createGenlist(ad->set_value_layout.getLayout(), NULL); addActionGendialField(ad); - nf_it = elm_naviframe_item_push(ad->md.getNaviframe(), "", NULL, NULL, ad->set_value_layout.getLayout(), "tabbar/notitle"); + nf_it = elm_naviframe_item_push(ad->md.getNaviframe()->getObject(), "", NULL, NULL, ad->set_value_layout.getLayout(), "tabbar/notitle"); elm_object_item_domain_text_translatable_set(nf_it, PACKAGE, EINA_TRUE); elm_object_item_part_content_set(nf_it, "tabbar", tb); } @@ -353,7 +353,7 @@ void SetValuePage::updateSwitchChooseAction(SettingAccessibility *ad, const std: { ad->config_item_to_update.activity_type = action; updateGendialActionField(ad); - elm_naviframe_item_pop(ad->md.getNaviframe()); + elm_naviframe_item_pop(ad->md.getNaviframe()->getObject()); } void SetValuePage::updateGendialActionField(SettingAccessibility *ad) @@ -372,7 +372,7 @@ void SetValuePage::closeUpdateAccessoriesSwitchPage(void *data, Evas_Object *obj if (event_info == ad->save_object_item) saveAccessoriesSwitchUpdateChanges(ad); - elm_naviframe_item_pop(ad->md.getNaviframe()); + elm_naviframe_item_pop(ad->md.getNaviframe()->getObject()); } void SetValuePage::saveAccessoriesSwitchUpdateChanges(SettingAccessibility *ad) @@ -412,10 +412,10 @@ void SetValuePage::callRadioItemChangeCbAndPopNaviframe(GenGroupItemData *list_i ad->set_value_layout.radio_item_change_cb(ad, list_item->chk_id); if (ad->md.naviframe_it) { - elm_naviframe_item_pop_cb_set(elm_naviframe_top_item_get(ad->md.getNaviframe()), NULL, NULL); + elm_naviframe_item_pop_cb_set(elm_naviframe_top_item_get(ad->md.getNaviframe()->getObject()), NULL, NULL); elm_naviframe_item_pop_to(ad->md.naviframe_it); } else { - elm_naviframe_item_pop(ad->md.getNaviframe()); + elm_naviframe_item_pop(ad->md.getNaviframe()->getObject()); } } @@ -651,5 +651,5 @@ void SetValuePage::backCb(void *data, Evas_Object *obj, void *event_info) retm_if(data == NULL, "Data argument is NULL"); auto ad = static_cast(data); - elm_naviframe_item_pop(ad->md.getNaviframe()); + elm_naviframe_item_pop(ad->md.getNaviframe()->getObject()); } diff --git a/src/SwitchesPage.cpp b/src/SwitchesPage.cpp index 9ba1d0f..64308e7 100644 --- a/src/SwitchesPage.cpp +++ b/src/SwitchesPage.cpp @@ -24,18 +24,18 @@ SwitchesPage::SwitchesPage(SettingAccessibility *ad) { retm_if(ad == NULL, "Input parameter is NULL"); - Evas_Object *genlist = elm_genlist_add(ad->md.getNaviframe()); + Evas_Object *genlist = elm_genlist_add(ad->md.getNaviframe()->getObject()); retm_if(genlist == NULL, "Cannot set genlist object as content of layout"); - ad->md.naviframe_it = elm_naviframe_item_push(ad->md.getNaviframe(), _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SWITCHES"), NULL, NULL, genlist, NULL); + ad->md.naviframe_it = elm_naviframe_item_push(ad->md.getNaviframe()->getObject(), _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_SWITCHES"), NULL, NULL, genlist, NULL); elm_naviframe_item_pop_cb_set(ad->md.naviframe_it, naviframePopCb, ad); elm_object_item_domain_text_translatable_set(ad->md.naviframe_it, PACKAGE, EINA_TRUE); - Evas_Object *back_btn = WidgetFactory::createButton(ad->md.getNaviframe(), {}, WidgetFactory::BACK_BUTTON_ARROW_STYLE, backCb, ad); - elm_layout_content_set(ad->md.getNaviframe(), "prev_btn", back_btn); + Evas_Object *back_btn = WidgetFactory::createButton(ad->md.getNaviframe()->getObject(), {}, WidgetFactory::BACK_BUTTON_ARROW_STYLE, backCb, ad); + elm_layout_content_set(ad->md.getNaviframe()->getObject(), "prev_btn", back_btn); - ad->remove_switches_page_button = WidgetFactory::createButton(ad->md.getNaviframe(), "IDS_ACCS_DELETE_CAPS", "naviframe/title_right", createRemovePageCb, ad); - elm_layout_content_set(ad->md.getNaviframe(), "title_right_btn", ad->remove_switches_page_button); + ad->remove_switches_page_button = WidgetFactory::createButton(ad->md.getNaviframe()->getObject(), "IDS_ACCS_DELETE_CAPS", "naviframe/title_right", createRemovePageCb, ad); + elm_layout_content_set(ad->md.getNaviframe()->getObject(), "title_right_btn", ad->remove_switches_page_button); elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); elm_object_style_set(genlist, "dialogue"); @@ -190,5 +190,5 @@ void SwitchesPage::backCb(void *data, Evas_Object *obj, void *event_info) retm_if(data == NULL, "Data argument is NULL"); auto ad = static_cast(data); - elm_naviframe_item_pop(ad->md.getNaviframe()); + elm_naviframe_item_pop(ad->md.getNaviframe()->getObject()); } diff --git a/src/UniversalSwitchPage.cpp b/src/UniversalSwitchPage.cpp index 179761b..b274a8d 100644 --- a/src/UniversalSwitchPage.cpp +++ b/src/UniversalSwitchPage.cpp @@ -26,7 +26,7 @@ UniversalSwitchPage::UniversalSwitchPage(SettingAccessibility *ad) int ret; int state = false; ad->md.naviframe_it = NULL; - Evas_Object *genlist = (Evas_Object *)elm_genlist_add(ad->md.getNaviframe()); + Evas_Object *genlist = (Evas_Object *)elm_genlist_add(ad->md.getNaviframe()->getObject()); retm_if(genlist == NULL, "Cannot set genlist object as content of layout"); elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); @@ -73,20 +73,20 @@ UniversalSwitchPage::UniversalSwitchPage(SettingAccessibility *ad) elm_genlist_item_select_mode_set(ad->universal_switch_comment->item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY); } - ad->md.naviframe_it = elm_naviframe_item_push(ad->md.getNaviframe(), _("IDS_ACCS_UNIVERSAL_SWITCH"), NULL, NULL, genlist, NULL); + ad->md.naviframe_it = elm_naviframe_item_push(ad->md.getNaviframe()->getObject(), _("IDS_ACCS_UNIVERSAL_SWITCH"), NULL, NULL, genlist, NULL); elm_object_item_domain_text_translatable_set(ad->md.naviframe_it, PACKAGE, EINA_TRUE); elm_naviframe_item_pop_cb_set(ad->md.naviframe_it, naviframePopCb, ad); ad->universal_switch_main_item = ad->md.naviframe_it; std::string title_str = "" + TranslatedString{"IDS_ACCS_SETTINGS_CAPS"} .str() + ""; - ad->universal_switch_settings_btn = WidgetFactory::createButton(ad->md.getNaviframe(), title_str, "naviframe/title_right", createSettingsPage, ad); + ad->universal_switch_settings_btn = WidgetFactory::createButton(ad->md.getNaviframe()->getObject(), title_str, "naviframe/title_right", createSettingsPage, ad); if (ad->universal_switch_settings_btn) elm_object_disabled_set(ad->universal_switch_settings_btn, EINA_TRUE); - elm_layout_content_set(ad->md.getNaviframe(), "title_right_btn", ad->universal_switch_settings_btn); + elm_layout_content_set(ad->md.getNaviframe()->getObject(), "title_right_btn", ad->universal_switch_settings_btn); - Evas_Object *back_btn = WidgetFactory::createButton(ad->md.getNaviframe(), {}, WidgetFactory::BACK_BUTTON_ARROW_STYLE, backCb, ad); - elm_layout_content_set(ad->md.getNaviframe(), "prev_btn", back_btn); + Evas_Object *back_btn = WidgetFactory::createButton(ad->md.getNaviframe()->getObject(), {}, WidgetFactory::BACK_BUTTON_ARROW_STYLE, backCb, ad); + elm_layout_content_set(ad->md.getNaviframe()->getObject(), "prev_btn", back_btn); startUniversalSwitch(ad); } @@ -139,7 +139,7 @@ void UniversalSwitchPage::updateVconfKey(int state, void *data) if (state && switch_count == 0) { elm_check_state_set(ad->universal_switch_off_checkbox->eo_check, EINA_FALSE); - ad->md.naviframe_it = elm_naviframe_top_item_get(ad->md.getNaviframe()); + ad->md.naviframe_it = elm_naviframe_top_item_get(ad->md.getNaviframe()->getObject()); ad->settingPopup_ = std::make_unique(data, ad->md.getWindow(), std::string{}, "To turn on Universal switch, tap ADD SWITCH and add at least one switch", popupResponseCb, 0, @@ -192,7 +192,7 @@ void UniversalSwitchPage::backCb(void *data, Evas_Object *obj, void *event_info) retm_if(data == NULL, "Data argument is NULL"); auto ad = static_cast(data); - elm_naviframe_item_pop(ad->md.getNaviframe()); + elm_naviframe_item_pop(ad->md.getNaviframe()->getObject()); } Eina_Bool UniversalSwitchPage::naviframePopCb(void *data, Elm_Object_Item *it) diff --git a/src/UniversalSwitchSettingsPage.cpp b/src/UniversalSwitchSettingsPage.cpp index 0d7b0a4..b3fcc68 100644 --- a/src/UniversalSwitchSettingsPage.cpp +++ b/src/UniversalSwitchSettingsPage.cpp @@ -139,7 +139,7 @@ UniversalSwitchSettingsPage::UniversalSwitchSettingsPage(SettingAccessibility *a retm_if(ad == NULL, "Input parameter is NULL"); ad->launched_by_app_control = false; ad->md.naviframe_it = NULL; - Evas_Object *genlist = elm_genlist_add(ad->md.getNaviframe()); + Evas_Object *genlist = elm_genlist_add(ad->md.getNaviframe()->getObject()); retm_if(genlist == NULL, "Cannot set genlist object as content of layout"); elm_genlist_mode_set(genlist, ELM_LIST_COMPRESS); @@ -152,13 +152,13 @@ UniversalSwitchSettingsPage::UniversalSwitchSettingsPage(SettingAccessibility *a createFeedbackGroup(ad, genlist); createManageGroup(ad, genlist); - Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->md.getNaviframe(), _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS"), NULL, NULL, genlist, NULL); + Elm_Object_Item *navi_it = elm_naviframe_item_push(ad->md.getNaviframe()->getObject(), _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS"), NULL, NULL, genlist, NULL); ad->universal_switch_settings_item = navi_it; elm_naviframe_item_pop_cb_set(navi_it, naviframPopCb, ad); elm_object_item_domain_text_translatable_set(navi_it, PACKAGE, EINA_TRUE); - Evas_Object *back_btn = WidgetFactory::createButton(ad->md.getNaviframe(), {}, WidgetFactory::BACK_BUTTON_ARROW_STYLE, backCb, ad); - elm_layout_content_set(ad->md.getNaviframe(), "prev_btn", back_btn); + Evas_Object *back_btn = WidgetFactory::createButton(ad->md.getNaviframe()->getObject(), {}, WidgetFactory::BACK_BUTTON_ARROW_STYLE, backCb, ad); + elm_layout_content_set(ad->md.getNaviframe()->getObject(), "prev_btn", back_btn); } void UniversalSwitchSettingsPage::createManageGroup(SettingAccessibility *ad, Evas_Object *genlist) @@ -313,7 +313,7 @@ Evas_Object *UniversalSwitchSettingsPage::createCtxPopup(SettingAccessibility *a Evas_Object *ctxpopup = NULL; retvm_if(ad == NULL, NULL, "Input parameter is NULL"); - ctxpopup = elm_ctxpopup_add(ad->md.getNaviframe()); + ctxpopup = elm_ctxpopup_add(ad->md.getNaviframe()->getObject()); elm_ctxpopup_auto_hide_disabled_set(ctxpopup, EINA_TRUE); evas_object_data_set(ctxpopup, CTXPOPUP_DATA_AD, (void *)ad); eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_BACK, ctxPopupDelCb, NULL); @@ -620,7 +620,7 @@ void UniversalSwitchSettingsPage::feedbackVoiceItemOptionsRequestCb(SettingAcces ad->setValuePage_ = std::make_unique(ad, ValueEditorType::RADIOS, page_title); SetValuePage::addRadioItemChangedCb(ad, cb); - elm_naviframe_item_pop_cb_set(elm_naviframe_top_item_get(ad->md.getNaviframe()), NULL, NULL); + elm_naviframe_item_pop_cb_set(elm_naviframe_top_item_get(ad->md.getNaviframe()->getObject()), NULL, NULL); int i; for (i = 0; i < MEDIA_LEVEL_COUNT; i++) @@ -716,7 +716,7 @@ void UniversalSwitchSettingsPage::feedbackSoundItemOptionsRequestCb(SettingAcces { ad->setValuePage_ = std::make_unique(ad, ValueEditorType::RADIOS, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_SOUND_VOLUME")); SetValuePage::addRadioItemChangedCb(ad, feedbackSoundVolumeChangedCb); - elm_naviframe_item_pop_cb_set(elm_naviframe_top_item_get(ad->md.getNaviframe()), NULL, NULL); + elm_naviframe_item_pop_cb_set(elm_naviframe_top_item_get(ad->md.getNaviframe()->getObject()), NULL, NULL); int i; for (i = 0; i < MEDIA_LEVEL_COUNT; i++) @@ -784,7 +784,7 @@ void UniversalSwitchSettingsPage::cursorColorCb(void *data, Evas_Object *obj, vo ad->setValuePage_ = std::make_unique(ad, ValueEditorType::RADIOS, _("IDS_ACCS_UNIVERSAL_SWITCH_SETTINGS_GROUP_FEEDBACK_CURSOR_CL")); SetValuePage::addRadioItemChangedCb(ad, cursorColorListItemChangedCb); - elm_naviframe_item_pop_cb_set(elm_naviframe_top_item_get(ad->md.getNaviframe()), NULL, NULL); + elm_naviframe_item_pop_cb_set(elm_naviframe_top_item_get(ad->md.getNaviframe()->getObject()), NULL, NULL); for (i = 0; i < CURSOR_COLORS_COUNT; i++) SetValuePage::addRadioItem(ad, _cursor_color[i].key, i, _cursor_color[i].id == ad->us_configuration.cursor_color); @@ -1276,7 +1276,7 @@ void UniversalSwitchSettingsPage::backCb(void *data, Evas_Object *obj, void *eve retm_if(data == NULL, "Data argument is NULL"); auto ad = static_cast(data); - elm_naviframe_item_pop(ad->md.getNaviframe()); + elm_naviframe_item_pop(ad->md.getNaviframe()->getObject()); } void UniversalSwitchSettingsPage::syncVoiceFeedbackWithVconf(keynode_t *node, void *user_data)