752e3455fb3a2efba7afab57ea1ecb7ea3032ffb
[framework/osp/web.git] / src / controls / inc / FWebCtrl_WebPopup.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FWebCtrl_WebPopup.h
20  * @brief               The file contains the declaration of _WebPopup class.
21  *
22  * The file contains the declaration of _WebPopup class.
23  */
24 #ifndef _FWEB_CTRL_INTERNAL_WEB_POPUP_H_
25 #define _FWEB_CTRL_INTERNAL_WEB_POPUP_H_
26
27 #include <unique_ptr.h>
28 #include <FUiCtrlPopup.h>
29
30
31 namespace Tizen { namespace Base {  namespace Collection
32 {
33 class IList;
34 }}} // Tizen::Base::Collection
35
36 namespace Tizen { namespace Graphics
37 {
38 class Dimension;
39 }} // Tizen::Graphics
40
41 namespace Tizen { namespace Ui
42 {
43 class IActionEventListener;
44 }} // Tizen::Ui
45
46 namespace Tizen { namespace Ui { namespace Controls
47 {
48 class Button;
49 class Panel;
50 class Popup;
51 }}} // Tizen::Ui::Controls
52
53 namespace Tizen { namespace Web { namespace Controls
54 {
55
56 enum _WebPopupButtonId
57 {
58         ID_BUTTON_COMMON_CLOSE
59 };
60
61 struct _WebPopupData
62 {
63         Tizen::Graphics::Dimension btnDim;
64         Tizen::Graphics::Dimension editDim;
65         Tizen::Graphics::Dimension popupDim;
66         Tizen::Graphics::Dimension dateDim;
67         Tizen::Graphics::Dimension colorDim;
68         Tizen::Graphics::Dimension checkDim;
69         Tizen::Graphics::Dimension labelDim;
70
71         int labelFontSize;
72         int spacePad;
73         int sideMargin;
74         int titleHeight;
75         int bottomMargin;
76 };
77
78 class _WebPopup
79         : public Tizen::Ui::Controls::Popup
80         , virtual public Tizen::Ui::IActionEventListener
81 {
82 public:
83         /**
84          * Constructor
85          */
86         _WebPopup(void);
87
88         /**
89          * Destructor
90          */
91         virtual ~_WebPopup(void);
92
93         result Construct(bool hasTitle, const Tizen::Graphics::Dimension& popupDim);
94
95         virtual void OnActionPerformed(const Tizen::Ui::Control& source, int actionId);
96
97         /**
98          * This function launches non modal (asynchronous) popup
99          */
100         result ShowPopup(void);
101
102         result HidePopup(int modalResult = 0);
103
104         /**
105          * This function launches modal (synchronous) popup
106          */
107         result ShowAndWait(int& modalResult);
108
109         Tizen::Ui::Controls::Panel* CreateAndAddPanel(void);
110
111         result CreateAndAddButtons(const Tizen::Base::Collection::IList& buttonIds,
112                                         const Tizen::Base::Collection::IList& buttonTitles,
113                                         Tizen::Ui::Controls::Panel* pPanel);
114
115         bool IsModalPopup(void);
116
117 protected:
118         static _WebPopupData* GetPopupData(bool refresh = false);
119
120 private:
121         _WebPopup(const _WebPopup& source);
122
123         _WebPopup& operator =(const _WebPopup& source);
124
125 private:
126         static std::unique_ptr<_WebPopupData> __pWebPopupData;
127         bool __isModal;
128         int __modal;
129
130 }; // _WebPopup
131
132 }}} //Tizen::Web::Controls
133 #endif // _FWEB_CTRL_INTERNAL_WEB_POPUP_H_