The license change version 1.0 to version 1.1
[platform/framework/web/web-provider.git] / src / Core / Service / PeriodChanger.h
1 /*
2  * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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  * @file    PeriodChanger.h
18  * @author  Yunchan Cho (yunchan.cho@samsung.com)
19  */
20 #ifndef PERIOD_CHNAGER_H
21 #define PERIOD_CHNAGER_H
22
23 #include <string>
24 #include <memory>
25 #include <Evas.h>
26
27 namespace Service {
28 class PeriodChanger;
29 typedef std::shared_ptr<PeriodChanger> PeriodChangerPtr;
30
31 class PeriodChanger {
32     public:
33         static PeriodChangerPtr create(
34                 std::string& boxId, std::string& instanceId,
35                 float currentPeriod, float requestedPeriod)
36         {
37             return PeriodChangerPtr(
38                     new PeriodChanger(boxId, instanceId, currentPeriod, requestedPeriod));
39         }
40         bool change();
41         ~PeriodChanger();
42
43     private:
44         void showPeriodPopup();
45         void destroyPeriodPopup(Evas_Object *obj);
46         void setPopupListData();
47         bool requestToPlatform(float newPeriod);
48         static Evas_Object* createWindow();
49         static void destroyWindow();
50
51         static void selectPeriodCallback(void *data, Evas_Object *obj, void *event_info);
52         static void cancelButtonCallback(void *data, Evas_Object *obj, void *event_info);
53
54         PeriodChanger(
55                 std::string& boxId, std::string& instanceId,
56                 float currentPeriod, float requestedPeriod);
57
58         static Evas_Object* s_window;
59         std::string m_boxId;
60         std::string m_instanceId;
61         float m_currentPeriod;
62         float m_requestedPeriod;
63
64         struct PopupListData {
65             PeriodChanger* periodChanger;
66             float newPeriod;
67             const char* period;
68         };
69
70         PopupListData m_hour[5];
71 };
72 } // Service
73
74 #endif // PERIOD_CHNAGER_H