2 * Copyright 2013 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (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
8 * http://www.tizenopensource.org/license
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.
22 #include <livebox-errno.h>
24 #include "livebox-cpp.h"
25 #include "livebox-impl.h"
29 #define EAPI __attribute__((visibility("default")))
31 EAPI int livebox_initialize(const char *pkgname)
35 module = CModule::FindModule(pkgname);
37 return LB_STATUS_SUCCESS;
39 module = CModule::Load(pkgname);
41 return LB_STATUS_ERROR_FAULT;
43 return LB_STATUS_SUCCESS;
46 EAPI int livebox_finalize(const char *pkgname)
50 module = CModule::FindModule(pkgname);
52 return LB_STATUS_ERROR_NOT_EXIST;
55 return LB_STATUS_SUCCESS;
58 EAPI int livebox_create(const char *pkgname, const char *filename, const char *content, const char *cluster, const char *category)
64 module = CModule::FindModule(pkgname);
66 return LB_STATUS_ERROR_INVALID;
68 box = module->FindLiveBox(filename);
70 return LB_STATUS_ERROR_NOT_EXIST;
72 ret = module->Create(filename, content, cluster, category);
76 EAPI int livebox_destroy(const char *pkgname, const char *filename)
82 module = CModule::FindModule(pkgname);
84 return LB_STATUS_ERROR_INVALID;
86 box = module->FindLiveBox(filename);
88 return LB_STATUS_ERROR_NOT_EXIST;
90 ret = module->Destroy(box);
94 EAPI int livebox_need_to_update(const char *pkgname, const char *filename)
99 module = CModule::FindModule(pkgname);
101 return LB_STATUS_ERROR_INVALID;
103 box = module->FindLiveBox(filename);
105 return LB_STATUS_ERROR_NOT_EXIST;
107 return box->NeedToUpdate();
110 EAPI int livebox_need_to_destroy(const char *pkgname, const char *filename)
115 module = CModule::FindModule(pkgname);
117 return LB_STATUS_ERROR_INVALID;
119 box = module->FindLiveBox(filename);
121 return LB_STATUS_ERROR_NOT_EXIST;
123 return box->NeedToDestroy();
126 EAPI int livebox_update_content(const char *pkgname, const char *filename)
131 module = CModule::FindModule(pkgname);
133 return LB_STATUS_ERROR_INVALID;
135 box = module->FindLiveBox(filename);
137 return LB_STATUS_ERROR_NOT_EXIST;
139 return box->UpdateContent();
142 EAPI int livebox_clicked(const char *pkgname, const char *filename, const char *event, double timestamp, double x, double y)
147 module = CModule::FindModule(pkgname);
149 return LB_STATUS_ERROR_INVALID;
151 box = module->FindLiveBox(filename);
153 return LB_STATUS_ERROR_NOT_EXIST;
155 return box->Clicked(event, timestamp, x, y);
158 EAPI int livebox_content_event(const char *pkgname, const char *filename, const char *emission, const char *source, struct event_info *event_info)
163 module = CModule::FindModule(pkgname);
165 return LB_STATUS_ERROR_INVALID;
167 box = module->FindLiveBox(filename);
169 return LB_STATUS_ERROR_NOT_EXIST;
171 return box->ContentEvent(emission, source, event_info);
174 EAPI int livebox_resize(const char *pkgname, const char *filename, int type)
179 module = CModule::FindModule(pkgname);
181 return LB_STATUS_ERROR_INVALID;
183 box = module->FindLiveBox(filename);
185 return LB_STATUS_ERROR_NOT_EXIST;
187 return box->Resize(type);
190 EAPI int livebox_change_group(const char *pkgname, const char *filename, const char *cluster, const char *category)
195 module = CModule::FindModule(pkgname);
197 return LB_STATUS_ERROR_INVALID;
199 box = module->FindLiveBox(filename);
201 return LB_STATUS_ERROR_NOT_EXIST;
203 return box->ChangeGroup(cluster, category);
206 EAPI int livebox_get_info(const char *pkgname, const char *filename, int *w, int *h, double *priority, char **content, char **title)
211 module = CModule::FindModule(pkgname);
213 return LB_STATUS_ERROR_INVALID;
215 box = module->FindLiveBox(filename);
217 return LB_STATUS_ERROR_NOT_EXIST;
219 return box->GetInfo(w, h, priority, content, title);
222 EAPI int livebox_need_to_create(const char *pkgname, const char *cluster, const char *category)
226 module = CModule::FindModule(pkgname);
228 return LB_STATUS_ERROR_INVALID;
230 return module->NeedToCreate(cluster, category);
233 EAPI char *livebox_pinup(const char *pkgname, const char *filename, int pinup)
238 module = CModule::FindModule(pkgname);
242 box = module->FindLiveBox(filename);
246 return box->PinUp(pinup);
249 EAPI int livebox_is_pinned_up(const char *pkgname, const char *filename)
254 module = CModule::FindModule(pkgname);
258 box = module->FindLiveBox(filename);
262 return box->IsPinnedUp();
265 EAPI int livebox_system_event(const char *pkgname, const char *filename, int event)
270 module = CModule::FindModule(pkgname);
274 box = module->FindLiveBox(filename);
278 return box->SystemEvent(event);