merge from master
[platform/framework/native/appwidget-service.git] / inc / FShell_AppWidgetContext.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        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 <FBaseColArrayList.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         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
78         virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
79
80 private:
81         _AppWidgetPopupContext* __pAppWidgetPopup;
82         Tizen::Base::Runtime::Timer __lifeDurationTimer;
83         Tizen::Base::Runtime::Timer __UpdateTimer;
84         int __UpdateMillis;
85
86 };
87
88
89 } } } // Tizen::Shell::App {
90
91
92 #endif // _FSHELL_INTERNAL_APPWIDGET_CONTEXT_H_