Update wrt-commons_0.2.53
[framework/web/wrt-commons.git] / modules / popup / include / dpl / popup / popup.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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  * @file        popup.h
18  * @author      Lukasz Wrzosek (l.wrzosek@samsung.com)
19  * @version     1.0
20  * @brief       This is popup inteface declaration
21  */
22
23 #ifndef WRT_SRC_POPUP_POPUP_H_
24 #define WRT_SRC_POPUP_POPUP_H_
25
26 #include <dpl/enable_shared_from_this.h>
27 #include <dpl/shared_ptr.h>
28 #include <dpl/assert.h>
29 #include <dpl/log/log.h>
30 #include <string>
31 #include <dpl/optional.h>
32 #include <dpl/popup/popup_object.h>
33
34 namespace DPL {
35 namespace Popup {
36
37 struct AnswerCallbackData
38 {
39     int buttonAnswer;
40     DPL::Optional<std::string> password;
41     bool chackState;
42 };
43
44 class PopupManager;
45 class IPopup;
46 typedef DPL::SharedPtr<IPopup> IPopupPtr;
47
48 class IPopup : protected DPL::EnableSharedFromThis<IPopup>
49 {
50   public:
51     virtual void SetTitle(const std::string &title) = 0;
52     /*The object is deleted automatically after rendered */
53     virtual void Append(PopupObject::IPopupObject *object) = 0;
54
55   protected:
56     typedef void (*PopupCallbackType)(const AnswerCallbackData& answer,
57                                       void *data);
58     virtual void Show(PopupCallbackType callback,
59             void* data) = 0;
60     virtual ~IPopup()
61     {
62     }
63
64   private:
65     friend class PopupManager;
66     friend class DPL::SharedPtr<IPopup>;
67 };
68
69 } // namespace Popup
70 } // namespace DPL
71
72 #endif //WRT_SRC_POPUP_POPUP_H_