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