Add update of GenlistItem fields when text and description are changed
[profile/mobile/apps/native/accessibility-setting.git] / src / AccessoriesSwitchesPage.hpp
1 /*
2  * Copyright 2018 Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *  http://www.apache.org/licenses/LICENSE-2.0
9
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef ACCESSORIES_SWITCHES_PAGE_HPP
18 #define ACCESSORIES_SWITCHES_PAGE_HPP
19
20 #include "ActionPage.hpp"
21 #include "AppContext.hpp"
22 #include "setting-accessibility.h"
23
24 #include <Elementary.h>
25
26 /**
27  * View allowing to configure switches provided by AccessoriesSwitchProvider.
28  *
29  * @param ad global context of application
30  *
31  * TODO:
32  *  replace classical callbacks with lambda expressions
33  */
34 class AccessoriesSwitchesPage
35 {
36         public:
37         AccessoriesSwitchesPage(NaviframeItem targetItem);
38         void attachActionCallback(UniversalSwitchCb cb, void *cbData);
39
40         private:
41         static void captureSwitchCb(void *user_data, const std::string &switch_id);
42         static void accessorySwitchActionCb(const std::string &action, void *user_data);
43         static Eina_Bool renewCaptureSwitchCb(void *data, Elm_Object_Item *it);
44         void alreadyMappedSwitchPopup(); // TODO rename
45         void newSwitchPopup();
46
47         AppContext &context_;
48         UniversalSwitchCb accessories_switch_added_cb;
49         void *accessories_switch_added_cb_data = nullptr;
50         std::string switchName_; // TODO remove when lambda expression would be added
51         std::unique_ptr<ActionPage> actionPage_;
52         NaviframeItem targetItem_;
53         std::string switchId;
54
55         const std::string EDJ_ACCESSORY = "edje/accessibility-smart-switch-accessory.edj";
56         const std::string PRT_ACCESSORY_LABEL = "accessory_label";
57         const std::string EDJ_ACCESSORY_POPUP = "edje/accessibility-smart-switch-accessory-popup.edj";
58         const std::string PRT_ACCESSORY_POPUP_ENTRY = "accessory_popup_entry";
59         const std::string GRP_ACCESSORY_POPUP = "accessory_popup";
60         const std::string GRP_ACCESSORY = "accessory";
61         const std::string PRT_ACCESSORY_POPUP_LABEL = "accessory_popup_label";
62 };
63
64 #endif