patch for rc20
[framework/osp/web.git] / src / controls / FWebCtrl_WebNotificationHandler.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_WebNotificationImpl.h
20  * @brief               The file contains the declaration of _WebNotificationHandler class.
21  *
22  * The file contains the declaration of _WebNotificationHandler class.
23  */
24 #ifndef _FWEB_CTRL_INTERNAL_WEB_NOTIFCATION_Handler_H_
25 #define _FWEB_CTRL_INTERNAL_WEB_NOTIFCATION_Handler_H_
26
27
28 #include <FBaseString.h>
29 #include <FGrpDimension.h>
30 #include <FGrpRectangle.h>
31 #include <FUiControl.h>
32 #include <FUiIPropagatedTouchEventListener.h>
33 #include <FUiTouchEventInfo.h>
34
35 const Tizen::Graphics::Color NOTIFCATION_NORMAL_BLACKGROUND_COLOR = Tizen::Graphics::Color(255, 255, 255, 255);
36 const Tizen::Graphics::Color NOTIFCATION_NORMAL_FOREGROUND_COLOR = Tizen::Graphics::Color(0, 0, 0, 255);
37 const Tizen::Graphics::Rectangle NOTIFCATION_RECT_AREA = Tizen::Graphics::Rectangle(0,0,600,150);
38 const Tizen::Graphics::Rectangle NOTIFCATION_BUTTON_AREA = Tizen::Graphics::Rectangle(550,0,50,50);
39
40 const int NOTIFCATION_STATE_NORMAL = 0;
41 const int NOTIFCATION_STATE_PRESSED = 1;
42 const int NOTIFCATION_STATE_MAX = 2;
43
44 const int NOTIFCATION_COLOR_BG_NORMAL = 0;
45 const int NOTIFCATION_COLOR_FG_NORMAL = 1;
46 const int NOTIFCATION_COLOR_MAX = 2;
47
48
49 namespace Tizen { namespace Web { namespace Controls
50 {
51 // forward declaration
52 class _WebNotification;
53 class _WebNotificationHandler;
54
55 class _WebNotificationHandler
56         : public Tizen::Ui::IPropagatedTouchEventListener
57 {
58 // Life-cycle
59 public:
60         _WebNotificationHandler(void);
61         virtual ~_WebNotificationHandler(void);
62
63         result Construct(_WebNotification* pnotification);
64
65         int GetState(void) const;
66         void SetState(int newState);
67
68         bool OnPreviewTouchMoved(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
69         bool OnPreviewTouchPressed(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
70         bool OnPreviewTouchReleased(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
71         bool OnTouchCanceled(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
72         bool OnTouchMoved(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
73         bool OnTouchPressed(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
74         bool OnTouchReleased(Tizen::Ui::Control &source, const Tizen::Ui::TouchEventInfo &touchEventInfo);
75
76         virtual result DrawNotification(Tizen::Graphics::Canvas& canvas);
77         void SetText(const Tizen::Base::String& text);
78         Tizen::Base::String GetText(void) const;
79
80
81 protected:
82         _WebNotification*       __pNotification;
83         int __state;
84         Tizen::Base::String __text;
85         Tizen::Graphics::Rectangle __bounds;
86         Tizen::Graphics::Color __pallete[NOTIFCATION_COLOR_MAX];
87 }; // _WebNotificationHandler
88
89 }}}
90 #endif // _FWEB_CTRL_INTERNAL_WEB_NOTIFCATION_Handler_H_