1
0

compbuck2.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  1. #include "precomp.h"
  2. #include <bfc/std_math.h>
  3. #include "compbuck2.h"
  4. #include <api/wac/wac.h>
  5. #include <tataki/bitmap/bitmap.h>
  6. #include <api/wndmgr/layout.h>
  7. #include <api/wnd/notifmsg.h>
  8. #include <api/service/service.h>
  9. #include <api/service/services.h>
  10. #include <api/wnd/wndclass/svcwndhold.h>
  11. #define TIMER_SCROLL (0x400+8879)
  12. #define TIMER_SCROLLPAGE (0x400+8880)
  13. #define TIMER_SPEED 10
  14. #define SCROLL_STEPS 10
  15. #define SCROLL_SPEED 20
  16. #define SCROLL_LEFT -2
  17. #define SCROLL_RIGHT +2
  18. #ifndef PI
  19. #define PI 3.1415926536
  20. #endif
  21. const wchar_t componentBucketXuiObjectStr[] = L"ComponentBucket"; // This is the xml tag
  22. char componentBucketXuiSvcName[] = "ComponentBucket xui object"; // this is the name of the xuiservice
  23. XMLParamPair ComponentBucket2::params[] =
  24. {
  25. {COMPBUCK_LEFTMARGIN, L"LEFTMARGIN"},
  26. {COMPBUCK_RIGHTMARGIN, L"RIGHTMARGIN"},
  27. {COMPBUCK_SPACING, L"SPACING"},
  28. {COMPBUCK_VERTICAL, L"VERTICAL"},
  29. {COMPBUCK_WNDTYPE, L"WNDTYPE"},
  30. };
  31. ComponentBucket2::ComponentBucket2() {
  32. getScriptObject()->vcpu_setInterface(cbucketGuid, (void *)static_cast<ComponentBucket2 *>(this));
  33. getScriptObject()->vcpu_setClassName(L"ComponentBucket");
  34. getScriptObject()->vcpu_setController(cbucketController);
  35. lastticcount=0;
  36. wndtype = BUCKETITEM;
  37. timeron = 0;
  38. lmargin = 2;
  39. rmargin = 2;
  40. spacing = 2;
  41. direction = 0;
  42. xscroll = 0;
  43. timerset = 0;
  44. cblist.addItem(this);
  45. vertical = 0;
  46. scrollpage_timerset = 0;
  47. scrollpage_starttime = 0;
  48. scrollpage_start = 0;
  49. scrollpage_target = 0;
  50. scrollpage_speed = 250;
  51. xuihandle = newXuiHandle();
  52. CreateXMLParameters(xuihandle);
  53. }
  54. void ComponentBucket2::CreateXMLParameters(int master_handle)
  55. {
  56. //COMPONENTBUCKET2_PARENT::CreateXMLParameters(master_handle);
  57. int numParams = sizeof(params) / sizeof(params[0]);
  58. hintNumberOfParams(xuihandle, numParams);
  59. for (int i = 0;i < numParams;i++)
  60. addParam(xuihandle, params[i], XUI_ATTRIBUTE_IMPLIED);
  61. }
  62. ComponentBucket2::~ComponentBucket2() {
  63. if (scrollpage_timerset) killTimer(TIMER_SCROLLPAGE);
  64. myclients.deleteAll();
  65. cblist.removeItem(this);
  66. if (cblist.getNumItems() == 0) cblist.removeAll();
  67. }
  68. int ComponentBucket2::onInit() {
  69. COMPONENTBUCKET2_PARENT::onInit();
  70. load();
  71. return 1;
  72. }
  73. int ComponentBucket2::setXuiParam(int _xuihandle, int id, const wchar_t *name, const wchar_t *strval) {
  74. if (xuihandle == _xuihandle) {
  75. switch (id) {
  76. case COMPBUCK_LEFTMARGIN: setLMargin(WTOI(strval)); return 1;
  77. case COMPBUCK_RIGHTMARGIN: setRMargin(WTOI(strval)); return 1;
  78. case COMPBUCK_SPACING: setSpacing(WTOI(strval)); return 1;
  79. case COMPBUCK_VERTICAL: setVertical(WTOI(strval)); return 1;
  80. case COMPBUCK_WNDTYPE: wndtype = strval; return 1;
  81. }
  82. }
  83. return COMPONENTBUCKET2_PARENT::setXuiParam(_xuihandle, id, name, strval);
  84. }
  85. void ComponentBucket2::setScroll(int v) {
  86. xscroll = v;
  87. if (isInited())
  88. onResize();
  89. invalidate();
  90. }
  91. int ComponentBucket2::getScroll() {
  92. return xscroll;
  93. }
  94. void ComponentBucket2::timerCallback(int id) {
  95. switch (id) {
  96. case TIMER_SCROLL: {
  97. RECT r;
  98. getClientRect(&r);
  99. do {
  100. xscroll += direction;
  101. lastticcount += TIMER_SPEED;
  102. } while (lastticcount < Wasabi::Std::getTickCount() - TIMER_SPEED);
  103. if (!vertical)
  104. xscroll = MIN((int)(getMaxWidth()-(r.right-r.left)), xscroll);
  105. else
  106. xscroll = MIN((int)(getMaxHeight()-(r.bottom-r.top)), xscroll);
  107. xscroll = MAX(0, xscroll);
  108. if (isInited())
  109. onResize();
  110. invalidate();
  111. return;
  112. }
  113. case TIMER_SCROLLPAGE: {
  114. int n = MulDiv(Wasabi::Std::getTickCount()-scrollpage_starttime,256,scrollpage_speed);
  115. if (n > 255) n = 255; if (n < 0) n = 0;
  116. float sintrans = (float)(sin(((float)n/255)*PI-PI/2)/2+0.5);
  117. xscroll = (int)(((float)(scrollpage_target - scrollpage_start) * sintrans) + scrollpage_start);
  118. if (n == 255) {
  119. killTimer(TIMER_SCROLLPAGE);
  120. scrollpage_timerset = 0;
  121. }
  122. if (isInited())
  123. onResize();
  124. invalidate();
  125. return;
  126. }
  127. default:
  128. COMPONENTBUCKET2_PARENT::timerCallback(id);
  129. return;
  130. }
  131. }
  132. int ComponentBucket2::childNotify(ifc_window *child, int msg, intptr_t p1, intptr_t p2) {
  133. switch (msg) {
  134. case ChildNotify::COMPONENTBUCKET_SETTEXT:
  135. setText((const wchar_t *)p1);
  136. return 1;
  137. }
  138. return COMPONENTBUCKET2_PARENT::childNotify(child, msg, p1, p2);
  139. }
  140. void ComponentBucket2::prev_down(Group *l) {
  141. if (!l) return;
  142. for (int i=0;i<cblist.getNumItems();i++) {
  143. if (cblist[i]->getGuiObject()->guiobject_getParentGroup()->getParentContainer() == l->getParentContainer())
  144. cblist[i]->prev_down();
  145. }
  146. }
  147. void ComponentBucket2::next_down(Group *l) {
  148. if (!l) return;
  149. for (int i=0;i<cblist.getNumItems();i++) {
  150. if (cblist[i]->getGuiObject()->guiobject_getParentGroup()->getParentContainer() == l->getParentContainer())
  151. cblist[i]->next_down();
  152. }
  153. }
  154. void ComponentBucket2::prev_up(Group *l) {
  155. if (!l) return;
  156. for (int i=0;i<cblist.getNumItems();i++) {
  157. if (cblist[i]->getGuiObject()->guiobject_getParentGroup()->getParentContainer() == l->getParentContainer())
  158. cblist[i]->prev_up();
  159. }
  160. }
  161. void ComponentBucket2::next_up(Group *l) {
  162. if (!l) return;
  163. for (int i=0;i<cblist.getNumItems();i++) {
  164. if (cblist[i]->getGuiObject()->guiobject_getParentGroup()->getParentContainer() == l->getParentContainer())
  165. cblist[i]->next_up();
  166. }
  167. }
  168. void ComponentBucket2::prev_page(Group *l) {
  169. if (!l) return;
  170. for (int i=0;i<cblist.getNumItems();i++) {
  171. if (cblist[i]->getGuiObject()->guiobject_getParentGroup()->getParentContainer() == l->getParentContainer())
  172. cblist[i]->prev_page();
  173. }
  174. }
  175. void ComponentBucket2::next_page(Group *l) {
  176. if (!l) return;
  177. for (int i=0;i<cblist.getNumItems();i++) {
  178. if (cblist[i]->getGuiObject()->guiobject_getParentGroup()->getParentContainer() == l->getParentContainer())
  179. cblist[i]->next_page();
  180. }
  181. }
  182. void ComponentBucket2::prev_down() {
  183. direction = SCROLL_LEFT;
  184. startScrollTimer();
  185. }
  186. void ComponentBucket2::prev_up() {
  187. stopScrollTimer();
  188. }
  189. void ComponentBucket2::next_down() {
  190. direction = SCROLL_RIGHT;
  191. startScrollTimer();
  192. }
  193. void ComponentBucket2::next_up() {
  194. stopScrollTimer();
  195. }
  196. void ComponentBucket2::prev_page() {
  197. scrollpage_starttime = Wasabi::Std::getTickCount();
  198. scrollpage_start = xscroll;
  199. RECT r;
  200. getClientRect(&r);
  201. int nx = 0;
  202. if (vertical)
  203. nx = r.bottom - r.top;
  204. else
  205. nx = r.right - r.left;
  206. nx = xscroll - nx;
  207. if (nx < 0) nx = 0;
  208. scrollpage_target = nx;
  209. if (!scrollpage_timerset) {
  210. setTimer(TIMER_SCROLLPAGE, 20);
  211. scrollpage_timerset = 1;
  212. }
  213. }
  214. void ComponentBucket2::next_page() {
  215. scrollpage_starttime = Wasabi::Std::getTickCount();
  216. scrollpage_start = xscroll;
  217. RECT r;
  218. getClientRect(&r);
  219. int nx = 0;
  220. if (vertical)
  221. nx = r.bottom - r.top;
  222. else
  223. nx = r.right - r.left;
  224. nx += xscroll;
  225. if (!vertical)
  226. nx = MIN((int)(getMaxWidth()-(r.right-r.left)), nx);
  227. else
  228. nx = MIN((int)(getMaxHeight()-(r.bottom-r.top)), nx);
  229. scrollpage_target = nx;
  230. if (!scrollpage_timerset) {
  231. setTimer(TIMER_SCROLLPAGE, 20);
  232. scrollpage_timerset = 1;
  233. }
  234. }
  235. void ComponentBucket2::startScrollTimer() {
  236. if (timerset) return;
  237. timerset=1;
  238. lastticcount = Wasabi::Std::getTickCount();
  239. setTimer(TIMER_SCROLL, TIMER_SPEED);
  240. }
  241. void ComponentBucket2::stopScrollTimer() {
  242. if (!timerset) return;
  243. killTimer(TIMER_SCROLL);
  244. timerset=0;
  245. }
  246. void ComponentBucket2::setText(const wchar_t *t)
  247. {
  248. for (int i=0;i<txtlist.getNumItems();i++) {
  249. if (txtlist.enumItem(i)->getRootParent() == getRootParent()) {
  250. txtlist.enumItem(i)->setName(t);
  251. txtlist.enumItem(i)->invalidate();
  252. }
  253. }
  254. }
  255. void ComponentBucket2::setText(ifc_window *cb , const wchar_t *txt) {
  256. for (int i=0;i<cblist.getNumItems();i++) {
  257. if (static_cast<ifc_window *>(cblist.enumItem(i)) == cb)
  258. cblist.enumItem(i)->setText(txt);
  259. }
  260. }
  261. void ComponentBucket2::registerText(Text *t, const wchar_t *id)
  262. {
  263. ComponentBucket2 *cb = getComponentBucket(id);
  264. if (cb) {
  265. cb->doRegisterText(t);
  266. return;
  267. }
  268. ifc_window *p = t->getDesktopParent();
  269. for (int i=0;i<cblist.getNumItems();i++) {
  270. if (cblist.enumItem(i)->getDesktopParent() == p)
  271. cblist.enumItem(i)->doRegisterText(t);
  272. }
  273. }
  274. void ComponentBucket2::unRegisterText(Text *t, const wchar_t *id) {
  275. ComponentBucket2 *cb = getComponentBucket(id);
  276. if (cb) {
  277. cb->doUnregisterText(t);
  278. return;
  279. }
  280. ifc_window *p = t->getDesktopParent();
  281. for (int i=0;i<cblist.getNumItems();i++) {
  282. if (cblist.enumItem(i)->getDesktopParent() == p)
  283. cblist.enumItem(i)->doUnregisterText(t);
  284. }
  285. }
  286. ComponentBucket2 *ComponentBucket2::getComponentBucket(const wchar_t *cb) {
  287. if (!cb) return NULL;
  288. for (int i=0;i<cblist.getNumItems();i++) {
  289. if (cblist.enumItem(i)->getGuiObject()->guiobject_getId()
  290. && !WCSICMP(cblist.enumItem(i)->getGuiObject()->guiobject_getId(), cb))
  291. return cblist.enumItem(i);
  292. }
  293. return NULL;
  294. }
  295. void ComponentBucket2::setLMargin(int i) {
  296. lmargin = i;
  297. invalidate();
  298. }
  299. void ComponentBucket2::setRMargin(int i) {
  300. rmargin = i;
  301. invalidate();
  302. }
  303. void ComponentBucket2::setSpacing(int i) {
  304. spacing = i;
  305. invalidate();
  306. }
  307. int ComponentBucket2::getLMargin(void) {
  308. return lmargin;
  309. }
  310. int ComponentBucket2::getRMargin(void) {
  311. return rmargin;
  312. }
  313. int ComponentBucket2::getSpacing(void) {
  314. return spacing;
  315. }
  316. void ComponentBucket2::load() {
  317. WindowCreateByTypeEnum wce(wndtype);
  318. svc_windowCreate *obj;
  319. while ((obj = wce.getNext()) != NULL) {
  320. addItems(obj);
  321. }
  322. if (isPostOnInit())
  323. onResize();
  324. }
  325. void ComponentBucket2::doRegisterText(Text *t) {
  326. txtlist.addItem(t);
  327. }
  328. void ComponentBucket2::doUnregisterText(Text *t) {
  329. txtlist.delItem(t);
  330. }
  331. void ComponentBucket2::addItems(svc_windowCreate *svc) {
  332. for (int i = 0; ; i++) {
  333. ASSERTPR(i < 1336, "someone is lame-o");
  334. ServiceWndHolder *svcwnd = new ServiceWndHolder;
  335. ifc_window *wnd = svc->createWindowOfType(wndtype, svcwnd, i);
  336. if (wnd == NULL) {
  337. delete svcwnd;
  338. if (i==0) SvcEnum::release(svc);
  339. break;
  340. }
  341. svcwnd->setChild(wnd, svc);
  342. myclients.addItem(svcwnd);
  343. svcwnd->setStartHidden(1);
  344. svcwnd->init(this);
  345. }
  346. }
  347. int ComponentBucket2::getMaxWidth() {
  348. if (!vertical) {
  349. int p = getLMargin();
  350. for (int j=0;j<myclients.getNumItems();j++) {
  351. //CUT for (int i=0;i<myclients.enumItem(j)->wnds.getNumItems();i++) {
  352. RECT r;
  353. myclients[j]->getClientRect(&r);
  354. p+=(r.right-r.left)+getSpacing();
  355. //CUT }
  356. }
  357. return p+getRMargin();
  358. }
  359. RECT r;
  360. getClientRect(&r);
  361. return r.right-r.left;
  362. }
  363. int ComponentBucket2::getMaxHeight() {
  364. if (vertical) {
  365. int p = getLMargin();
  366. for (int j=0;j<myclients.getNumItems();j++) {
  367. //CUT for (int i=0;i<myclients.enumItem(j)->wnds.getNumItems();i++) {
  368. RECT r;
  369. myclients[j]->getClientRect(&r);
  370. p+=(r.bottom-r.top)+getSpacing();
  371. //CUT }
  372. }
  373. return p+getLMargin();
  374. }
  375. RECT r;
  376. getClientRect(&r);
  377. return r.right-r.left;
  378. }
  379. int ComponentBucket2::onResize() {
  380. COMPONENTBUCKET2_PARENT::onResize();
  381. RECT r;
  382. getClientRect(&r);
  383. int sh;
  384. int myh;
  385. if (!vertical) {
  386. sh = r.bottom - r.top;
  387. } else {
  388. sh = r.right - r.left;
  389. }
  390. myh = sh;
  391. int p = getLMargin() - xscroll;
  392. for (int j=0;j<myclients.getNumItems();j++) {
  393. //CUT for (int i=0;i<myclients.enumItem(j)->wnds.getNumItems();i++) {
  394. //CUT api_window *c = myclients.enumItem(j)->wnds.enumItem(i);
  395. ifc_window *c = myclients[j];
  396. int w = c->getPreferences(SUGGESTED_W);
  397. int h = c->getPreferences(SUGGESTED_H);
  398. if (!vertical) {
  399. float rt = (float)myh / (float)h;
  400. if (ABS(rt-1.0f) > 0.1) {
  401. w = (int)((float)w*rt);
  402. h = (int)((float)h*rt);
  403. }
  404. } else {
  405. float rt = (float)myh / (float)w;
  406. if (ABS(rt-1.0f) > 0.1) {
  407. w = (int)((float)w*rt);
  408. h = (int)((float)h*rt);
  409. }
  410. }
  411. if (!vertical)
  412. c->resize(p+r.left, r.top+(sh - h) / 2, w, h);
  413. else
  414. c->resize(r.left+(sh - w) / 2, p+r.top, w, h);
  415. if (!vertical)
  416. p+=w+getSpacing();
  417. else
  418. p+=h+getSpacing();
  419. if (!c->isVisible()) c->setVisible(1);
  420. //CUT }
  421. }
  422. return 1;
  423. }
  424. void ComponentBucket2::setVertical(int v) {
  425. if (v == vertical) return;
  426. vertical = v;
  427. if (isInited()) invalidate();
  428. }
  429. int ComponentBucket2::getNumChildren() {
  430. return myclients.getNumItems();
  431. }
  432. GuiObject *ComponentBucket2::enumChildren(int i) {
  433. ServiceWndHolder *w = myclients.enumItem(i);
  434. if (!w) return NULL;
  435. ifc_window *_w = w->rootwndholder_getRootWnd();
  436. if (!_w) return NULL;
  437. return _w->getGuiObject();
  438. }
  439. PtrList<ComponentBucket2> ComponentBucket2::cblist;
  440. CompBucketScriptController _cbucketController;
  441. CompBucketScriptController *cbucketController = &_cbucketController;
  442. // -- Functions table -------------------------------------
  443. function_descriptor_struct CompBucketScriptController ::exportedFunction[] = {
  444. {L"getMaxWidth", 0, (void*)ComponentBucket2::script_vcpu_getMaxWidth},
  445. {L"getMaxHeight", 0, (void*)ComponentBucket2::script_vcpu_getMaxHeight},
  446. {L"getScroll", 0, (void*)ComponentBucket2::script_vcpu_getScroll},
  447. {L"setScroll", 1, (void*)ComponentBucket2::script_vcpu_setScroll},
  448. {L"getNumChildren", 0, (void*)ComponentBucket2::script_vcpu_getNumChildren},
  449. {L"enumChildren", 1, (void*)ComponentBucket2::script_vcpu_enumChildren},
  450. {L"fake", 0, (void*)ComponentBucket2::script_vcpu_fake },
  451. };
  452. const wchar_t *CompBucketScriptController ::getClassName() {
  453. return L"ComponentBucket";
  454. }
  455. const wchar_t *CompBucketScriptController ::getAncestorClassName() {
  456. return L"GuiObject";
  457. }
  458. ScriptObject *CompBucketScriptController::instantiate() {
  459. ComponentBucket2 *cb = new ComponentBucket2;
  460. ASSERT(cb != NULL);
  461. return cb->getScriptObject();
  462. }
  463. void CompBucketScriptController::destroy(ScriptObject *o) {
  464. ComponentBucket2 *cb = static_cast<ComponentBucket2 *>(o->vcpu_getInterface(cbucketGuid));
  465. ASSERT(cb != NULL);
  466. delete cb;
  467. }
  468. void *CompBucketScriptController::encapsulate(ScriptObject *o) {
  469. return NULL; // no encapsulation for componentbucket yet
  470. }
  471. void CompBucketScriptController::deencapsulate(void *o) {
  472. }
  473. int CompBucketScriptController ::getNumFunctions() {
  474. return sizeof(exportedFunction) / sizeof(function_descriptor_struct);
  475. }
  476. const function_descriptor_struct *CompBucketScriptController ::getExportedFunctions() {
  477. return exportedFunction;
  478. }
  479. GUID CompBucketScriptController ::getClassGuid() {
  480. return cbucketGuid;
  481. }
  482. scriptVar ComponentBucket2::script_vcpu_fake(SCRIPT_FUNCTION_PARAMS, ScriptObject *o) {
  483. SCRIPT_FUNCTION_INIT
  484. RETURN_SCRIPT_VOID;
  485. }
  486. scriptVar ComponentBucket2::script_vcpu_getMaxWidth(SCRIPT_FUNCTION_PARAMS, ScriptObject *o) {
  487. SCRIPT_FUNCTION_INIT
  488. ComponentBucket2 *cb = static_cast<ComponentBucket2*>(o->vcpu_getInterface(cbucketGuid));
  489. if (cb) return MAKE_SCRIPT_INT(cb->getMaxWidth());
  490. RETURN_SCRIPT_ZERO;
  491. }
  492. scriptVar ComponentBucket2::script_vcpu_getMaxHeight(SCRIPT_FUNCTION_PARAMS, ScriptObject *o) {
  493. SCRIPT_FUNCTION_INIT
  494. ComponentBucket2 *cb = static_cast<ComponentBucket2*>(o->vcpu_getInterface(cbucketGuid));
  495. if (cb) return MAKE_SCRIPT_INT(cb->getMaxHeight());
  496. RETURN_SCRIPT_ZERO;
  497. }
  498. scriptVar ComponentBucket2::script_vcpu_getScroll(SCRIPT_FUNCTION_PARAMS, ScriptObject *o) {
  499. SCRIPT_FUNCTION_INIT
  500. ComponentBucket2 *cb = static_cast<ComponentBucket2*>(o->vcpu_getInterface(cbucketGuid));
  501. if (cb) return MAKE_SCRIPT_INT(cb->getScroll());
  502. RETURN_SCRIPT_ZERO;
  503. }
  504. scriptVar ComponentBucket2::script_vcpu_setScroll(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar v) {
  505. SCRIPT_FUNCTION_INIT
  506. ComponentBucket2 *cb = static_cast<ComponentBucket2*>(o->vcpu_getInterface(cbucketGuid));
  507. if (cb) cb->setScroll(GET_SCRIPT_INT(v));
  508. RETURN_SCRIPT_VOID;
  509. }
  510. scriptVar ComponentBucket2::script_vcpu_getNumChildren(SCRIPT_FUNCTION_PARAMS, ScriptObject *o) {
  511. SCRIPT_FUNCTION_INIT
  512. ComponentBucket2 *cb = static_cast<ComponentBucket2*>(o->vcpu_getInterface(cbucketGuid));
  513. if (cb) return MAKE_SCRIPT_INT(cb->getNumChildren());
  514. RETURN_SCRIPT_VOID;
  515. }
  516. scriptVar ComponentBucket2::script_vcpu_enumChildren(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar v) {
  517. SCRIPT_FUNCTION_INIT
  518. ComponentBucket2 *cb = static_cast<ComponentBucket2*>(o->vcpu_getInterface(cbucketGuid));
  519. if (cb) {
  520. GuiObject *o = cb->enumChildren(GET_SCRIPT_INT(v));
  521. if (o) return MAKE_SCRIPT_OBJECT(o->guiobject_getScriptObject());
  522. }
  523. RETURN_SCRIPT_ZERO;
  524. }