[appwidget-service] Remove Open Service Platform words
[framework/osp/appwidget-service.git] / inc / FShell_AppWidgetContext.h
1 //
2 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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 /**
18  * @file        FShell_AppWidgetContext.h
19  * @brief       This is the header file for the _AppWidgetContext class.
20  *
21  * This header file contains the declarations of the _AppWidgetContext class.
22  */
23
24 #ifndef _FSHELL_INTERNAL_APPWIDGET_CONTEXT_H_
25 #define _FSHELL_INTERNAL_APPWIDGET_CONTEXT_H_
26
27 #include <provider.h>
28 #include <provider_buffer.h>
29
30 #include <FAppTypes.h>
31 #include <FBaseRtTimer.h>
32 #include <FBaseObject.h>
33 #include <FBaseColArrayListT.h>
34
35 #include "FShell_AppWidgetContextBase.h"
36
37
38 #define MAX_PACKAGENAME  512
39
40
41 namespace Tizen { namespace Shell  { namespace App
42 {
43 class _AppWidgetPopupContext;
44
45 class _AppWidgetContext
46          : public _AppWidgetContextBase
47           ,public Tizen::Base::Runtime::ITimerEventListener
48 {
49 public:
50         _AppWidgetContext(const Tizen::Base::String& name, const Tizen::Base::String& appId, const Tizen::Base::String& instanceId,
51                                                 int width, int height, int period, int priority);
52         virtual ~_AppWidgetContext();
53         void OnAdded(void);
54         void OnUpdate(const Tizen::Base::String& argument);
55         void OnResize(int width, int height);
56         void OnRemoved();
57         void OnForeground();
58         void OnBackground();
59
60         virtual void OnPopupCreated(double x, double y, int width, int height);
61         virtual void OnPopupDestoyed(void);
62
63         result RequestUpdateRemote(int width, int height);
64
65         _AppWidgetPopupContext* GetAppWidgetPopup() const;
66         virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y);
67
68 //      void RestartLifeDurationTimer();
69
70 private:
71         result SendAddRequest(int width, int height);
72         result SendUpdateRequest(int width, int height, const Tizen::Base::String& argument);
73         result SendResizeRequest(int width, int height);
74         result SendRemoveRequest();
75
76         result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
77         void SendPendingTouchEvent(void);
78
79         virtual Tizen::Base::Collection::HashMap* CreateRequestArgs(void);
80
81         virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
82
83         struct PendingTouchEvent
84         {
85         public:
86                 PendingTouchEvent(int eventType, double timeStamp, double       x, double       y)
87                  : eventType(eventType), timeStamp(timeStamp), x(x), y(y) {  }
88
89                 int eventType;
90                 double  timeStamp;
91                 double  x;
92                 double  y;
93         };
94
95 private:
96         _AppWidgetPopupContext* __pAppWidgetPopup;
97 //      Tizen::Base::Runtime::Timer __lifeDurationTimer;
98         Tizen::Base::Runtime::Timer __updateTimer;
99         int __updateMillis;
100         Tizen::Base::Collection::ArrayListT<PendingTouchEvent*>* __pPendingTouchEventList;
101 };
102
103
104 } } } // Tizen::Shell::App {
105
106
107 #endif // _FSHELL_INTERNAL_APPWIDGET_CONTEXT_H_