4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
8 * Jaewon Lim <jaewon81.lim@samsung.com>
9 * Woojin Jung <woojin2.jung@samsung.com>
10 * Juyoung Kim <j0.kim@samsung.com>
12 * This library is free software; you can redistribute it and/or modify it under
13 * the terms of the GNU Lesser General Public License as published by the
14 * Free Software Foundation; either version 2.1 of the License, or (at your option)
17 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
18 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
20 * License for more details.
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with this library; if not, write to the Free Software Foundation, Inc., 51
24 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
36 #include "dacollection.h"
38 #include "osp_probe.h"
42 using namespace Tizen::Ui;
43 using namespace Tizen::Ui::Controls;
44 using namespace Tizen::Ui::Animations;
46 #define APPEND_LOG_CONTROL_OSP(CONTROL) \
48 if(unlikely(CONTROL == NULL)) { \
49 log.length += sprintf(log.data + log.length, "`,`,`,"); \
51 char *type = NULL, *name = NULL; \
52 if(find_object_hash((void*)(CONTROL), &type, &name) == 1) { \
53 log.length += sprintf(log.data + log.length, "`,%s`,%s", type, name); \
55 log.length += sprintf(log.data + log.length, "`,`,"); \
57 log.length += sprintf(log.data + log.length, "`,%p", \
62 extern IFrameAnimatorEventListener& GetFrameAnimatorEventListener();
64 bool IsRegisteredFrameAnimatorEventListener = false;
66 namespace Tizen { namespace App {
68 result UiApp::AddFrame(const Tizen::Ui::Controls::Frame& frame)
70 typedef result (UiApp::*methodType)(const Tizen::Ui::Controls::Frame& frame);
71 static methodType uiapp_addframep;
72 DECLARE_COMMON_VARIABLE;
75 GET_REAL_FUNC_OSP(_ZN5Tizen3App5UiApp8AddFrameERKNS_2Ui8Controls5FrameE, LIBOSP_UIFW, uiapp_addframep);
77 ret = (this->*uiapp_addframep)(frame);
82 frame.IsInTouchMode();
84 if(isOptionEnabled(OPT_UI))
86 Control* parent = NULL;
87 setProbePoint(&probeInfo);
89 APPEND_LOG_BASIC_NAME(LC_UICREATE, "AddFrame");
90 APPEND_LOG_COMMON_NONE(CALLER_ADDRESS);
91 APPEND_LOG_CONTROL_OSP(parent);
92 APPEND_LOG_CONTROL_OSP(&frame);
93 printLog(&log, MSG_LOG);
96 PACK_COMMON_BEGIN(MSG_PROBE_UICONTROL,
99 PACK_COMMON_END(ret, 0, 0);
100 PACK_UICONTROL(parent);
101 PACK_UICONTROL(&frame);
110 result UiApp::RemoveFrame(const Tizen::Ui::Controls::Frame &frame)
112 typedef result (UiApp::*methodType)(const Tizen::Ui::Controls::Frame& frame);
113 static methodType uiapp_removeframep;
114 DECLARE_COMMON_VARIABLE;
120 GET_REAL_FUNC_OSP(_ZN5Tizen3App5UiApp11RemoveFrameERKNS_2Ui8Controls5FrameE, LIBOSP_UIFW, uiapp_removeframep);
123 frame.IsInTouchMode();
125 if((bOption = isOptionEnabled(OPT_UI)))
127 Control* parent = NULL;
128 setProbePoint(&probeInfo);
130 APPEND_LOG_BASIC_NAME(LC_UICREATE, "RemoveFrame");
131 APPEND_LOG_COMMON_NONE(CALLER_ADDRESS);
132 APPEND_LOG_CONTROL_OSP(parent);
133 APPEND_LOG_CONTROL_OSP(&frame);
135 PACK_COMMON_BEGIN(MSG_PROBE_UICONTROL,
138 PACK_COMMON_END(0, 0, 0);
139 PACK_UICONTROL(parent);
140 PACK_UICONTROL(&frame);
144 ret = (this->*uiapp_removeframep)(frame);
150 printLog(&log, MSG_LOG);
155 PACK_RETURN_END(ret);
162 } } // end of namespce Tizen::App
165 namespace Tizen { namespace Ui {
167 bool Control::IsInTouchMode(void) const
169 typedef bool (Control::*methodType)(void) const;
170 static methodType control_isintouchmodep;
172 GET_REAL_FUNC_OSP(_ZNK5Tizen2Ui7Control13IsInTouchModeEv, LIBOSP_UIFW, control_isintouchmodep);
175 add_object_hash_class((void*)(this), typeid(*this).name());
178 return (this->*control_isintouchmodep)();
181 void Control::SetName(const Tizen::Base::String &name)
183 typedef void (Control::*methodType)(const Tizen::Base::String &name);
184 static methodType control_setnamep;
185 DECLARE_COMMON_VARIABLE;
187 GET_REAL_FUNC_OSP(_ZN5Tizen2Ui7Control7SetNameERKNS_4Base6StringE, LIBOSP_UIFW, control_setnamep);
189 (this->*control_setnamep)(name);
194 if(isOptionEnabled(OPT_UI))
196 Control* parent = NULL;
197 setProbePoint(&probeInfo);
199 APPEND_LOG_BASIC_NAME(LC_UICREATE, "SetName");
200 APPEND_LOG_COMMON_NONE(CALLER_ADDRESS);
201 APPEND_LOG_CONTROL_OSP(this);
202 APPEND_LOG_CONTROL_OSP(parent);
203 printLog(&log, MSG_LOG);
206 PACK_COMMON_BEGIN(MSG_PROBE_UICONTROL,
209 PACK_COMMON_END(0, 0, 0);
210 PACK_UICONTROL(this);
211 PACK_UICONTROL(parent);
217 result Container::AddControl(const Control &control)
219 typedef result (Container::*methodType)(const Control &control);
220 static methodType container_addcontrolp;
221 DECLARE_COMMON_VARIABLE;
224 GET_REAL_FUNC_OSP(_ZN5Tizen2Ui9Container10AddControlERKNS0_7ControlE, LIBOSP_UIFW, container_addcontrolp);
227 if(unlikely(IsRegisteredFrameAnimatorEventListener == false))
229 char *type = NULL, *classname = NULL;
230 if(likely(find_object_hash((void*)this, &type, &classname) == 1)) // there is entry in object hash
232 if(strcmp(type, "Frame") == 0)
234 FrameAnimator* fa = ((Frame*)this)->GetFrameAnimator();
237 fa->AddFrameAnimatorEventListener(GetFrameAnimatorEventListener());
238 IsRegisteredFrameAnimatorEventListener = true;
240 else // frame is not yet constructed
248 ret = (this->*container_addcontrolp)(control);
254 control.IsInTouchMode();
256 if(isOptionEnabled(OPT_UI))
258 setProbePoint(&probeInfo);
260 APPEND_LOG_BASIC_NAME(LC_UICREATE, "AddControl");
261 APPEND_LOG_COMMON_NONE(CALLER_ADDRESS);
262 APPEND_LOG_CONTROL_OSP(this);
263 APPEND_LOG_CONTROL_OSP(&control);
264 printLog(&log, MSG_LOG);
267 PACK_COMMON_BEGIN(MSG_PROBE_UICONTROL,
270 PACK_COMMON_END(ret, 0, 0);
271 PACK_UICONTROL(this);
272 PACK_UICONTROL(&control);
281 result Container::RemoveControl(const Control &control)
283 typedef result (Container::*methodType)(const Control &control);
284 static methodType container_removecontrolp;
285 DECLARE_COMMON_VARIABLE;
291 GET_REAL_FUNC_OSP(_ZN5Tizen2Ui9Container13RemoveControlERKNS0_7ControlE, LIBOSP_UIFW, container_removecontrolp);
294 control.IsInTouchMode();
296 if((bOption = isOptionEnabled(OPT_UI)))
298 setProbePoint(&probeInfo);
300 APPEND_LOG_BASIC_NAME(LC_UICREATE, "RemoveControl");
301 APPEND_LOG_COMMON_NONE(CALLER_ADDRESS);
302 APPEND_LOG_CONTROL_OSP(this);
303 APPEND_LOG_CONTROL_OSP(&control);
305 PACK_COMMON_BEGIN(MSG_PROBE_UICONTROL,
308 PACK_COMMON_END(0, 0, 0);
309 PACK_UICONTROL(this);
310 PACK_UICONTROL(&control);
314 ret = (this->*container_removecontrolp)(control);
320 printLog(&log, MSG_LOG);
325 PACK_RETURN_END(ret);
332 result Container::RemoveControl(int index)
334 typedef result (Container::*methodType)(int index);
335 static methodType container_removecontrolip;
336 DECLARE_COMMON_VARIABLE;
342 GET_REAL_FUNC_OSP(_ZN5Tizen2Ui9Container13RemoveControlEi, LIBOSP_UIFW, container_removecontrolip);
345 Control* pcontrol = GetControl(index);
346 pcontrol->IsInTouchMode();
348 if((bOption = isOptionEnabled(OPT_UI)))
350 setProbePoint(&probeInfo);
352 APPEND_LOG_BASIC_NAME(LC_UICREATE, "RemoveControl");
353 APPEND_LOG_COMMON_NONE(CALLER_ADDRESS);
354 APPEND_LOG_CONTROL_OSP(this);
355 APPEND_LOG_CONTROL_OSP(pcontrol);
357 PACK_COMMON_BEGIN(MSG_PROBE_UICONTROL,
360 PACK_COMMON_END(0, 0, 0);
361 PACK_UICONTROL(this);
362 PACK_UICONTROL(pcontrol);
366 ret = (this->*container_removecontrolip)(index);
372 printLog(&log, MSG_LOG);
377 PACK_RETURN_END(ret);
384 void Container::RemoveAllControls(void)
386 typedef void (Container::*methodType)(void);
387 static methodType container_removeallcontrolp;
388 DECLARE_COMMON_VARIABLE;
390 GET_REAL_FUNC_OSP(_ZN5Tizen2Ui9Container17RemoveAllControlsEv, LIBOSP_UIFW, container_removeallcontrolp);
393 if(isOptionEnabled(OPT_UI))
395 Control* pcontrol = NULL;
396 setProbePoint(&probeInfo);
398 APPEND_LOG_BASIC_NAME(LC_UICREATE, "RemoveAllControl");
399 APPEND_LOG_COMMON_NONE(CALLER_ADDRESS);
400 APPEND_LOG_CONTROL_OSP(this);
401 APPEND_LOG_CONTROL_OSP(pcontrol);
402 printLog(&log, MSG_LOG);
405 PACK_COMMON_BEGIN(MSG_PROBE_UICONTROL,
408 PACK_COMMON_END(0, 0, 0);
409 PACK_UICONTROL(this);
410 PACK_UICONTROL(pcontrol);
415 (this->*container_removeallcontrolp)();
418 } } // end of namespace Tizen::Ui