2968b58f0f3c8b6fb93169a9e8d661feb568a77d
[platform/framework/native/appwidget-service.git] / inc / FShell_LiveboxContextBase.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_LiveboxContextBase.h
20  * @brief       This is the header file for the _LiveboxContextBase class.
21  *
22  * This header file contains the declarations of the _LiveboxContextBase class.
23  */
24
25 #ifndef _FSHELL_INTERNAL_LIVEBOX_CONTEXT_BASE_H_
26 #define _FSHELL_INTERNAL_LIVEBOX_CONTEXT_BASE_H_
27
28 #include <provider.h>
29
30 #include <FAppTypes.h>
31 #include <FBaseObject.h>
32 #include <FBaseColHashMap.h>
33
34 #define LIVEBOX_PROVIDER_ID_ENABLE true
35
36 typedef struct _bundle_t bundle;//TODO move code to osp-appfw
37
38 namespace Tizen { namespace Shell  { namespace App
39 {
40
41 class _LiveboxContextBase:
42         public Tizen::Base::Object
43 {
44 public:
45         _LiveboxContextBase(target_type type, const Tizen::Base::String& userInfo, const Tizen::Base::String& providerId, const Tizen::Base::String& instanceId, int width, int height, int priority);
46         virtual ~_LiveboxContextBase();
47
48         virtual void OnPopupCreated(int width, int height) = 0;
49         virtual void OnPopupDestoyed(void) = 0;
50
51         virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y) = 0;
52
53         void SetClientId(int clientId);
54         bool HasValidClientId() const;
55         // for buffered livebox
56         int GetSharedMemId(int w, int h);
57         result ReleaseSharedMem();
58
59
60 protected:
61         Tizen::Base::Collection::HashMap* CreateRequestArgs(void);
62         result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
63
64 public:
65         target_type __type;
66         Tizen::Base::String __userInfo;
67         Tizen::Base::String __appId;
68         Tizen::Base::String __providerName;
69         Tizen::Base::String __providerId;
70         Tizen::Base::String __instanceId;
71         int __width;
72         int __height;
73         int __priority;
74
75 protected:
76         bool __isForeground;// LB only?
77         int __ipcClientId;
78
79 private:
80         void *__buffer;
81         struct livebox_buffer *__buffer_info;
82 };
83
84 class _LiveboxRequestHelper
85 {
86 public:
87         static result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
88 //      static result AddStrArrayToBundle(bundle* b, const char* key, const Tizen::Base::Collection::IList* pList);
89 //      static result ExtractPackageIdAndExecutableName(Tizen::App::AppId inAppId, Tizen::Base::String& outPackageId, Tizen::Base::String& outExecutableName);
90 };
91
92 } /* namespace App */
93 } /* namespace Livebox */
94 } /* namespace Samsung */
95 #endif // _FSHELL_INTERNAL_LIVEBOX_CONTEXT_BASE_H_