2 * Copyright 2018 Samsung Electronics Co., Ltd
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef SET_VALUE_PAGE_HPP
18 #define SET_VALUE_PAGE_HPP
20 #include "AppContext.hpp"
23 #include "GenlistItem.hpp"
24 #include "Scroller.hpp"
28 using ChangeValueCb = std::function<void(double)>;
30 enum class ValueEditorType
46 using ChangeValueCb = std::function<void(double)>;
47 using ChangeSwitchCb = std::function<void(bool)>;
48 using ChangeRadioItemCb = std::function<void(size_t)>;
49 using ChangeSwitchItemCb = std::function<void(int, bool)>;
50 using RequestListItemOptionsCb = std::function<void(int)>;
55 SetValuePage(ValueEditorType type, TranslatedString title, NaviframeItem targetItem = {});
56 void setDescription(const TranslatedString &description);
57 void setRange(double min, double max, double step);
58 void setValue(double value, const std::string &units);
59 void setSwitch(bool state);
60 void addRadioItem(const std::string &caption, int id, bool selected);
61 GenlistItem *addRadioListItem(const std::string &main_text, const std::string &sub_text, int option_id);
62 void addValueChangedCb(ChangeValueCb cb);
63 void addSwitchChangedCb(ChangeSwitchCb cb);
64 void addRadioItemChangedCb(ChangeRadioItemCb cb);
65 void addListItemOptionsRequestCb(RequestListItemOptionsCb cb);
66 void setCheckState(bool state);
69 void callRadioItemChangeCbAndPopNaviframe(GenlistItem *item);
70 Genlist *createGenlist(Widget *parent, TranslatedString title);
71 void createScroller();
72 Layout *createLayout(Widget *parent, const std::string &layoutGroup);
73 void displayValue(double value);
74 void checkStateChangedCb();
75 static void backCb(void *data, Evas_Object *obj, void *event_info);
78 NaviframeItem naviframeItem_;
80 Layout *layout_ = nullptr;
81 Scroller *scroller_ = nullptr;
83 Check *check_ = nullptr;
84 Genlist *genlist_ = nullptr;
85 std::vector<OptionsItem *> options_data;
91 ChangeValueCb changeValueCb_;
92 ChangeSwitchCb changeSwitchCb_;
93 ChangeRadioItemCb changeRadioItemCb_;
94 RequestListItemOptionsCb requestListItemOptionsCb_;