Add update of GenlistItem fields when text and description are changed
[profile/mobile/apps/native/accessibility-setting.git] / src / AddSwitchPage.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 ADD_SWITCH_PAGE_HPP
18 #define ADD_SWITCH_PAGE_HPP
19
20 #include "AccessibilitySettingLog.hpp"
21 #include "AccessoriesSwitchesPage.hpp"
22 #include "AppContext.hpp"
23 #include "CameraSwitchesPage.hpp"
24 #include "ScreenSwitchPage.hpp"
25
26 #include <Elementary.h>
27
28 /**
29  * View that supports searching of switches by narrowing search space to particular SwitchProvider
30  *
31  * @param ad global context of application
32  *
33  * TODO:
34  *  replace classical callbacks with lambda expressions
35  */
36 class AddSwitchPage
37 {
38         public:
39         AddSwitchPage();
40         void attachCallbackOnSwitchAttach(UniversalSwitchCb cb, void *cbData); // TODO: rename
41
42         private:
43         void disableSwitchProviderWhenAllSwitchesConfigured(
44                 UniversalSwitchSwitchProvider *switchProvider, GenlistItem *switchProviderView);
45         bool areAllSwitchesConfigured(const std::vector<UniversalSwitchConfigurationItem *> &switchConfigurationItems,
46                 const std::vector<UniversalSwitchInfoType *> &switchAllItems);
47         void showSwitchesPage(const std::string &providerId);
48
49         AppContext &context_;
50         std::unique_ptr<ScreenSwitchPage> screenSwitchPage_;
51         std::unique_ptr<CameraSwitchesPage> cameraSwitchesPage_;
52         std::unique_ptr<AccessoriesSwitchesPage> accessoriesSwitchesPage_;
53         NaviframeItem previousTopItem_;
54
55         UniversalSwitchCb switch_added_cb = nullptr;
56         void *switch_added_cb_data = nullptr;
57 };
58
59 #endif