xuilist.cpp 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734
  1. #include <precomp.h>
  2. #include "xuilist.h"
  3. #include <api/service/svc_enum.h>
  4. #include <bfc/parse/paramparser.h>
  5. #include <api/script/scriptguid.h>
  6. #include <api/skin/feeds/TextFeedEnum.h>
  7. // The temporary memory buffer to hold our string returns.
  8. StringW GuiListScriptController::staticStr;
  9. // -----------------------------------------------------------------------
  10. const wchar_t ScriptListXuiObjectStr[] = L"List"; // This is the xml tag
  11. char ScriptListXuiSvcName[] = "List xui object";
  12. XMLParamPair ScriptList::params[] = {
  13. {SCRIPTLIST_SETITEMS, L"ITEMS"},
  14. {SCRIPTLIST_SETMULTISELECT, L"MULTISELECT"},
  15. {SCRIPTLIST_SETAUTODESELECT, L"AUTODESELECT"},
  16. {SCRIPTLIST_SELECT, L"SELECT"},
  17. {SCRIPTLIST_FEED, L"FEED"},
  18. {SCRIPTLIST_HOVERSELECT, L"HOVERSELECT"},
  19. {SCRIPTLIST_SORT, L"SORT"},
  20. {SCRIPTLIST_SELECTONUPDOWN, L"SELECTONUPDOWN"},
  21. {SCRIPTLIST_NUMCOLUMNS, L"NUMCOLUMNS"},
  22. {SCRIPTLIST_COLUMNWIDTHS, L"COLUMNWIDTHS"},
  23. {SCRIPTLIST_COLUMNLABELS, L"COLUMNLABELS"},
  24. };
  25. // -----------------------------------------------------------------------
  26. ScriptList::ScriptList()
  27. {
  28. getScriptObject()->vcpu_setInterface(guilistGuid, (void *)static_cast<ScriptList *>(this));
  29. getScriptObject()->vcpu_setClassName(L"GuiList"); // this is the script class name
  30. getScriptObject()->vcpu_setController(guiListController);
  31. myxuihandle = newXuiHandle();
  32. CreateXMLParameters(myxuihandle);
  33. setPreventMultipleSelection(1);
  34. setVirtual(0);
  35. feed = NULL;
  36. multiselect = 0;
  37. xmlnumcolumns = -1;
  38. last_numcolumns = 0x80000000; // go ahead and try and be equal to that.
  39. getGuiObject()->guiobject_getScriptObject()->vcpu_setInterface(listGuid, (void *)this);
  40. }
  41. void ScriptList::CreateXMLParameters(int master_handle)
  42. {
  43. SCRIPTLIST_PARENT::CreateXMLParameters(master_handle);
  44. int numParams = sizeof(params) / sizeof(params[0]);
  45. hintNumberOfParams(myxuihandle, numParams);
  46. for (int i = 0;i < numParams;i++)
  47. addParam(myxuihandle, params[i], XUI_ATTRIBUTE_IMPLIED);
  48. }
  49. // -----------------------------------------------------------------------
  50. ScriptList::~ScriptList()
  51. {
  52. closeFeed();
  53. }
  54. // -----------------------------------------------------------------------
  55. int ScriptList::setXuiParam(int xuihandle, int xmlattributeid, const wchar_t *xmlattributename, const wchar_t *value)
  56. {
  57. if (xuihandle != myxuihandle)
  58. return SCRIPTLIST_PARENT::setXuiParam(xuihandle, xmlattributeid, xmlattributename, value);
  59. switch (xmlattributeid)
  60. {
  61. case SCRIPTLIST_SETITEMS:
  62. items = value;
  63. fillFromParams();
  64. #ifdef WASABI_COMPILE_CONFIG
  65. if (getGuiObject()->guiobject_hasCfgAttrib())
  66. selectFromConfig();
  67. #endif
  68. break;
  69. case SCRIPTLIST_SETMULTISELECT:
  70. multiselect = WTOI(value);
  71. break;
  72. case SCRIPTLIST_SETAUTODESELECT:
  73. setWantAutoDeselect(WTOI(value));
  74. break;
  75. case SCRIPTLIST_SELECT:
  76. {
  77. int i = selectEntry(value);
  78. if (i != -1)
  79. ensureItemVisible(i);
  80. else
  81. selectFirstEntry();
  82. break;
  83. }
  84. case SCRIPTLIST_FEED:
  85. {
  86. closeFeed();
  87. openFeed(value);
  88. break;
  89. }
  90. case SCRIPTLIST_HOVERSELECT:
  91. {
  92. setHoverSelect(WTOI(value));
  93. break;
  94. }
  95. case SCRIPTLIST_SORT:
  96. {
  97. setAutoSort(WTOB(value));
  98. break;
  99. }
  100. case SCRIPTLIST_SELECTONUPDOWN:
  101. {
  102. setSelectOnUpDown(WTOI(value));
  103. break;
  104. }
  105. case SCRIPTLIST_NUMCOLUMNS:
  106. {
  107. xmlnumcolumns = WTOI(value);
  108. setNumColumns();
  109. break;
  110. }
  111. case SCRIPTLIST_COLUMNWIDTHS:
  112. {
  113. columnwidths = value;
  114. setColumnWidths();
  115. break;
  116. }
  117. case SCRIPTLIST_COLUMNLABELS:
  118. {
  119. columnlabels = value;
  120. setColumnLabels();
  121. break;
  122. }
  123. default:
  124. return 0;
  125. }
  126. return 1;
  127. }
  128. // -----------------------------------------------------------------------
  129. int ScriptList::onInit()
  130. {
  131. SCRIPTLIST_PARENT::onInit();
  132. last_numcolumns = 0x80000000;
  133. setNumColumns(); // Sets widths and labels if necessary
  134. setPreventMultipleSelection(!multiselect);
  135. // fillFromParams(); // done by setNumColumns();
  136. return 1;
  137. }
  138. /*
  139. Moved to script-oriented section
  140. // -----------------------------------------------------------------------
  141. void ScriptList::onDoubleClick(int itemnum) {
  142. #ifdef WASABI_COMPILE_CONFIG
  143. saveToConfig();
  144. #endif
  145. }
  146. */
  147. /*
  148. Moved to script-oriented section
  149. // -----------------------------------------------------------------------
  150. void ScriptList::onItemSelection(int itemnum, int selected) {
  151. SCRIPTLIST_PARENT::onItemSelection(itemnum, selected);
  152. #ifdef WASABI_COMPILE_CONFIG
  153. saveToConfig();
  154. #endif
  155. }
  156. */
  157. // -----------------------------------------------------------------------
  158. int ScriptList::onAction(const wchar_t *action, const wchar_t *param, int x, int y, intptr_t p1, intptr_t p2, void *data, size_t datalen, ifc_window *source)
  159. {
  160. SCRIPTLIST_PARENT::onAction(action, param, x, y, p1, p2, data, datalen, source);
  161. if (!_wcsicmp(action, L"select_all"))
  162. {
  163. selectAll(0);
  164. #ifdef WASABI_COMPILE_CONFIG
  165. saveToConfig();
  166. #endif
  167. }
  168. if (!_wcsicmp(action, L"deselect_all"))
  169. {
  170. deselectAll(0);
  171. #ifdef WASABI_COMPILE_CONFIG
  172. saveToConfig();
  173. #endif
  174. }
  175. if (!_wcsicmp(action, L"get_selection"))
  176. {
  177. if (source != NULL)
  178. {
  179. StringW res(L"");
  180. for (int i = 0;i < getNumItems();i++)
  181. {
  182. if (getItemSelected(i))
  183. {
  184. if (!res.isempty()) res += L";";
  185. res += getSubitemText(i, 0);
  186. }
  187. }
  188. sendAction(source, L"set_selection", res);
  189. }
  190. }
  191. return 1;
  192. }
  193. void ScriptList::onSetVisible(int i)
  194. {
  195. SCRIPTLIST_PARENT::onSetVisible(i);
  196. }
  197. #ifdef WASABI_COMPILE_CONFIG
  198. // -----------------------------------------------------------------------
  199. int ScriptList::onReloadConfig()
  200. {
  201. SCRIPTLIST_PARENT::onReloadConfig();
  202. selectFromConfig();
  203. return 1;
  204. }
  205. // -----------------------------------------------------------------------
  206. void ScriptList::saveToConfig()
  207. {
  208. StringW res(L"");
  209. for (int i = 0;i < getNumItems();i++)
  210. {
  211. if (getItemSelected(i))
  212. {
  213. if (!res.isempty()) res += L";";
  214. res += getSubitemText(i, 0);
  215. }
  216. }
  217. getGuiObject()->guiobject_setCfgString(res);
  218. }
  219. // -----------------------------------------------------------------------
  220. void ScriptList::selectFromConfig()
  221. {
  222. deselectAll(0);
  223. const wchar_t *p = getGuiObject()->guiobject_getCfgString();
  224. if (p != NULL)
  225. {
  226. ParamParser pp(p);
  227. for (int i = 0;i < pp.getNumItems();i++)
  228. selectEntry(pp.enumItem(i), 0);
  229. }
  230. }
  231. #endif
  232. // -----------------------------------------------------------------------
  233. int ScriptList::selectEntry(const wchar_t *e, int cb)
  234. {
  235. for (int i = 0;i < getNumItems();i++)
  236. {
  237. const wchar_t *si = getSubitemText(i, 0);
  238. if (WCSCASEEQLSAFE(si, e))
  239. {
  240. setSelected(i, 1, cb);
  241. return i;
  242. }
  243. }
  244. return -1;
  245. }
  246. // -----------------------------------------------------------------------
  247. void ScriptList::fillFromParams()
  248. {
  249. deleteAllItems();
  250. if (!items.isempty())
  251. {
  252. ParamParser pp(items);
  253. if (xmlnumcolumns == -1)
  254. {
  255. // OLD WAY
  256. for (int i = 0;i < pp.getNumItems();i++)
  257. addItem(pp.enumItem(i), (LPARAM)NULL);
  258. }
  259. else
  260. {
  261. // NEW WAY
  262. int i, n = pp.getNumItems();
  263. for (i = 0; i < n; i++)
  264. {
  265. StringW row = pp.enumItem(i);
  266. ParamParser rp(row, L",");
  267. addItem(rp.enumItem(0), (LPARAM)NULL);
  268. int j, m = rp.getNumItems();
  269. for (j = 1; j < m; j++)
  270. {
  271. setSubItem(i, j, rp.enumItem(j));
  272. }
  273. }
  274. }
  275. }
  276. }
  277. // -----------------------------------------------------------------------
  278. void ScriptList::selectEntries(const wchar_t *entries, int cb)
  279. {
  280. ParamParser pp(entries);
  281. for (int i = 0;i < pp.getNumItems();i++)
  282. selectEntry(pp.enumItem(i), cb);
  283. }
  284. // -----------------------------------------------------------------------
  285. void ScriptList::setColumnWidths()
  286. {
  287. // don't bother if there's no value.
  288. if (columnwidths.len())
  289. {
  290. ParamParser pp(columnwidths);
  291. int i, n = MIN(pp.getNumItems(), getNumColumns()); // whichever is less.
  292. for (i = 0; i < n; i++)
  293. {
  294. ListColumn *column = getColumn(i);
  295. if (column)
  296. {
  297. column->setWidth(WTOI(pp.enumItem(i)));
  298. }
  299. }
  300. }
  301. }
  302. // -----------------------------------------------------------------------
  303. void ScriptList::setColumnLabels()
  304. {
  305. // don't bother if there's no value.
  306. if (columnlabels.len())
  307. {
  308. ParamParser pp(columnlabels);
  309. int i, n = MIN(pp.getNumItems(), getNumColumns()); // whichever is less.
  310. for (i = 0; i < n; i++)
  311. {
  312. ListColumn *column = getColumn(i);
  313. if (column)
  314. {
  315. column->setLabel(pp.enumItem(i));
  316. }
  317. }
  318. }
  319. }
  320. // -----------------------------------------------------------------------
  321. void ScriptList::setNumColumns()
  322. {
  323. if (last_numcolumns == xmlnumcolumns) return ;
  324. if (xmlnumcolumns == -1)
  325. {
  326. // the old way.
  327. insertColumn(new ListColumn(L"", TRUE));
  328. }
  329. else
  330. {
  331. // delete all columns.
  332. int i, n = getNumColumns();
  333. for (i = 0; i < n; i++)
  334. {
  335. this->delColumnByPos(0);
  336. }
  337. // create new ones.
  338. ParamParser cw(columnwidths);
  339. int nw = cw.getNumItems();
  340. ParamParser cl(columnlabels);
  341. int nl = cl.getNumItems();
  342. for (i = 0; i < xmlnumcolumns; i++)
  343. {
  344. const wchar_t *collabel = L"";
  345. int colwidth = -1; // magic value for "be dynamic"
  346. if (i < nl)
  347. {
  348. collabel = cl.enumItem(i);
  349. }
  350. if (i < nw)
  351. {
  352. colwidth = WTOI(cw.enumItem(i));
  353. }
  354. ListColumn *pCol = new ListColumn(collabel, (colwidth < 0));
  355. if (colwidth >= 0)
  356. {
  357. pCol->setWidth(colwidth);
  358. }
  359. insertColumn(pCol);
  360. }
  361. fillFromParams();
  362. }
  363. last_numcolumns = xmlnumcolumns;
  364. }
  365. // -----------------------------------------------------------------------
  366. void ScriptList::openFeed(const wchar_t *feedid)
  367. {
  368. if (!_wcsicmp(feedid, last_feed)) return ;
  369. feed = TextFeedEnum(feedid).getFirst();
  370. if (feed != NULL)
  371. {
  372. viewer_addViewItem(feed->getDependencyPtr());
  373. }
  374. last_feed = feedid;
  375. }
  376. // -----------------------------------------------------------------------
  377. void ScriptList::closeFeed()
  378. {
  379. if (feed)
  380. {
  381. viewer_delViewItem(feed->getDependencyPtr());
  382. SvcEnum::release(feed);
  383. }
  384. feed = NULL;
  385. last_feed = L"";
  386. }
  387. // -----------------------------------------------------------------------
  388. int ScriptList::viewer_onEvent(api_dependent *item, const GUID *classguid, int event, intptr_t param, void *ptr, size_t ptrlen)
  389. {
  390. if (feed && feed->getDependencyPtr() == item)
  391. {
  392. if (event == svc_textFeed::Event_TEXTCHANGE)
  393. {
  394. setXuiParam(myxuihandle, SCRIPTLIST_SETITEMS, L"items", (const wchar_t *)ptr);
  395. return 1;
  396. }
  397. }
  398. return 0;
  399. }
  400. // -----------------------------------------------------------------------
  401. // Callback methods that send hooks into the Script system
  402. void ScriptList::onSelectAll()
  403. {
  404. SCRIPTLIST_PARENT::onSelectAll();
  405. GuiListScriptController::guilist_onSelectAll(SCRIPT_CALL, getScriptObject());
  406. }
  407. void ScriptList::onDelete()
  408. {
  409. SCRIPTLIST_PARENT::onDelete();
  410. GuiListScriptController::guilist_onDelete(SCRIPT_CALL, getScriptObject());
  411. }
  412. void ScriptList::onDoubleClick(int itemnum)
  413. {
  414. SCRIPTLIST_PARENT::onDoubleClick(itemnum);
  415. GuiListScriptController::guilist_onDoubleClick(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(itemnum));
  416. #ifdef WASABI_COMPILE_CONFIG
  417. saveToConfig();
  418. #endif
  419. }
  420. void ScriptList::onLeftClick(int itemnum)
  421. {
  422. SCRIPTLIST_PARENT::onLeftClick(itemnum);
  423. GuiListScriptController::guilist_onLeftClick(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(itemnum));
  424. }
  425. int ScriptList::onIconLeftClick(int itemnum, int x , int y)
  426. {
  427. SCRIPTLIST_PARENT::onIconLeftClick(itemnum, x, y);
  428. scriptVar v = GuiListScriptController::guilist_onIconLeftClick(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(itemnum), MAKE_SCRIPT_INT(x), MAKE_SCRIPT_INT(y));
  429. if ((v.type != SCRIPT_VOID) && (v.type != SCRIPT_OBJECT) && (v.type != SCRIPT_STRING))
  430. {
  431. return GET_SCRIPT_INT(v);
  432. }
  433. return 0;
  434. }
  435. void ScriptList::onSecondLeftClick(int itemnum)
  436. {
  437. SCRIPTLIST_PARENT::onSecondLeftClick(itemnum);
  438. GuiListScriptController::guilist_onSecondLeftClick(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(itemnum));
  439. }
  440. int ScriptList::onRightClick(int itemnum)
  441. {
  442. SCRIPTLIST_PARENT::onRightClick(itemnum);
  443. scriptVar v = GuiListScriptController::guilist_onRightClick(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(itemnum));
  444. if ((v.type != SCRIPT_VOID) && (v.type != SCRIPT_OBJECT) && (v.type != SCRIPT_STRING))
  445. {
  446. return GET_SCRIPT_BOOLEAN(v);
  447. }
  448. return 0;
  449. }
  450. int ScriptList::onColumnDblClick(int col, int x, int y)
  451. {
  452. SCRIPTLIST_PARENT::onColumnDblClick(col, x, y);
  453. scriptVar v = GuiListScriptController::guilist_onColumnDblClick(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(col), MAKE_SCRIPT_INT(y), MAKE_SCRIPT_INT(x));
  454. if ((v.type != SCRIPT_VOID) && (v.type != SCRIPT_OBJECT) && (v.type != SCRIPT_STRING))
  455. {
  456. return GET_SCRIPT_BOOLEAN(v);
  457. }
  458. return 0;
  459. }
  460. int ScriptList::onColumnLabelClick(int col, int x, int y)
  461. {
  462. SCRIPTLIST_PARENT::onColumnLabelClick(col, x, y);
  463. scriptVar v = GuiListScriptController::guilist_onColumnLabelClick(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(col), MAKE_SCRIPT_INT(y), MAKE_SCRIPT_INT(x));
  464. if ((v.type != SCRIPT_VOID) && (v.type != SCRIPT_OBJECT) && (v.type != SCRIPT_STRING))
  465. {
  466. return GET_SCRIPT_BOOLEAN(v);
  467. }
  468. return 1; // don't ask me, that's what ListWnd does.
  469. }
  470. void ScriptList::onItemSelection(int itemnum, int selected)
  471. {
  472. SCRIPTLIST_PARENT::onItemSelection(itemnum, selected);
  473. GuiListScriptController::guilist_onItemSelection(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(itemnum), MAKE_SCRIPT_INT(selected));
  474. #ifdef WASABI_COMPILE_CONFIG
  475. saveToConfig();
  476. #endif
  477. }
  478. // -----------------------------------------------------------------------
  479. // Script Object
  480. GuiListScriptController _guiListController;
  481. GuiListScriptController *guiListController = &_guiListController;
  482. // -- Functions table -------------------------------------
  483. function_descriptor_struct GuiListScriptController::exportedFunction[] = {
  484. {L"getNumItems", 0, (void*)GuiListScriptController::guilist_getNumItems },
  485. {L"getWantAutoDeselect", 0, (void*)guilist_getWantAutoDeselect },
  486. {L"setWantAutoDeselect", 1, (void*)guilist_setWantAutoDeselect },
  487. {L"onSetVisible", 1, (void*)guilist_onSetVisible },
  488. {L"setAutoSort", 1, (void*)guilist_setAutoSort },
  489. {L"next", 0, (void*)guilist_next },
  490. {L"selectCurrent", 0, (void*)guilist_selectCurrent },
  491. {L"selectFirstEntry", 0, (void*)guilist_selectFirstEntry },
  492. {L"previous", 0, (void*)guilist_previous },
  493. {L"pagedown", 0, (void*)guilist_pagedown },
  494. {L"pageup", 0, (void*)guilist_pageup },
  495. {L"home", 0, (void*)guilist_home },
  496. {L"end", 0, (void*)guilist_end },
  497. {L"reset", 0, (void*)guilist_reset },
  498. {L"addColumn", 3, (void*)guilist_addColumn },
  499. {L"getNumColumns", 0, (void*)guilist_getNumColumns },
  500. {L"getColumnWidth", 1, (void*)guilist_getColumnWidth },
  501. {L"setColumnWidth", 2, (void*)guilist_setColumnWidth },
  502. {L"getColumnLabel", 1, (void*)guilist_getColumnLabel },
  503. {L"setColumnLabel", 2, (void*)guilist_setColumnLabel },
  504. {L"getColumnNumeric", 1, (void*)guilist_getColumnNumeric },
  505. {L"setColumnDynamic", 2, (void*)guilist_setColumnDynamic },
  506. {L"isColumnDynamic", 1, (void*)guilist_isColumnDynamic },
  507. {L"setMinimumSize", 1, (void*)guilist_setMinimumSize },
  508. {L"addItem", 1, (void*)guilist_addItem },
  509. {L"insertItem", 2, (void*)guilist_insertItem },
  510. {L"getLastAddedItemPos", 0, (void*)guilist_getLastAddedItemPos },
  511. {L"setSubItem", 3, (void*)guilist_setSubItem },
  512. {L"deleteAllItems", 0, (void*)guilist_deleteAllItems },
  513. {L"deleteByPos", 1, (void*)guilist_deleteByPos },
  514. {L"getItemLabel", 2, (void*)guilist_getItemLabel },
  515. {L"setItemLabel", 2, (void*)guilist_setItemLabel },
  516. {L"setItemIcon", 2, (void*)guilist_setItemIcon },
  517. {L"getItemIcon", 1, (void*)guilist_getItemIcon },
  518. {L"setShowIcons", 1, (void*)guilist_setShowIcons },
  519. {L"getShowIcons", 0, (void*)guilist_getShowIcons },
  520. {L"setIconWidth", 1, (void*)guilist_setIconWidth },
  521. {L"getIconWidth", 0, (void*)guilist_getIconWidth },
  522. {L"setIconHeight", 1, (void*)guilist_setIconHeight },
  523. {L"getIconHeight", 0, (void*)guilist_getIconHeight },
  524. {L"onIconLeftclick", 3, (void*)guilist_onIconLeftClick },
  525. {L"getItemSelected", 1, (void*)guilist_getItemSelected },
  526. {L"isItemFocused", 1, (void*)guilist_isItemFocused },
  527. {L"getItemFocused", 0, (void*)guilist_getItemFocused },
  528. {L"setItemFocused", 1, (void*)guilist_setItemFocused },
  529. {L"ensureItemVisible", 1, (void*)guilist_ensureItemVisible },
  530. {L"invalidateColumns", 0, (void*)guilist_invalidateColumns },
  531. {L"scrollAbsolute", 1, (void*)guilist_scrollAbsolute },
  532. {L"scrollRelative", 1, (void*)guilist_scrollRelative },
  533. {L"scrollLeft", 1, (void*)guilist_scrollLeft },
  534. {L"scrollRight", 1, (void*)guilist_scrollRight },
  535. {L"scrollUp", 1, (void*)guilist_scrollUp },
  536. {L"scrollDown", 1, (void*)guilist_scrollDown },
  537. {L"getSubitemText", 2, (void*)guilist_getSubitemText },
  538. {L"getFirstItemSelected", 0, (void*)guilist_getFirstItemSelected },
  539. {L"getNextItemSelected", 1, (void*)guilist_getNextItemSelected },
  540. {L"selectAll", 0, (void*)guilist_selectAll },
  541. {L"deselectAll", 0, (void*)guilist_deselectAll },
  542. {L"invertSelection", 0, (void*)guilist_invertSelection },
  543. {L"invalidateItem", 1, (void*)guilist_invalidateItem },
  544. {L"getFirstItemVisible", 0, (void*)guilist_getFirstItemVisible },
  545. {L"getLastItemVisible", 0, (void*)guilist_getLastItemVisible },
  546. {L"setFontSize", 1, (void*)guilist_setFontSize },
  547. {L"getFontSize", 0, (void*)guilist_getFontSize },
  548. {L"jumpToNext", 1, (void*)guilist_jumpToNext },
  549. {L"scrollToItem", 1, (void*)guilist_scrollToItem },
  550. {L"resort", 0, (void*)guilist_resort },
  551. {L"getSortDirection", 0, (void*)guilist_getSortDirection },
  552. {L"getSortColumn", 0, (void*)guilist_getSortColumn },
  553. {L"setSortColumn", 1, (void*)guilist_setSortColumn },
  554. {L"setSortDirection", 1, (void*)guilist_setSortDirection },
  555. {L"getItemCount", 0, (void*)guilist_getItemCount },
  556. {L"setSelectionStart", 1, (void*)guilist_setSelectionStart },
  557. {L"setSelectionEnd", 1, (void*)guilist_setSelectionEnd },
  558. {L"setSelected", 2, (void*)guilist_setSelected },
  559. {L"toggleSelection", 2, (void*)guilist_toggleSelection },
  560. {L"getHeaderHeight", 0, (void*)guilist_getHeaderHeight },
  561. {L"getPreventMultipleSelection", 0, (void*)guilist_getPreventMultipleSelection },
  562. {L"setPreventMultipleSelection", 1, (void*)guilist_setPreventMultipleSelection },
  563. {L"moveItem", 2, (void*)guilist_moveItem },
  564. {L"onSelectAll", 0, (void*)guilist_onSelectAll },
  565. {L"onDelete", 0, (void*)guilist_onDelete },
  566. {L"onDoubleClick", 1, (void*)guilist_onDoubleClick },
  567. {L"onLeftClick", 1, (void*)guilist_onLeftClick },
  568. {L"onSecondLeftClick", 1, (void*)guilist_onSecondLeftClick },
  569. {L"onRightClick", 1, (void*)guilist_onRightClick },
  570. {L"onColumnDblClick", 3, (void*)guilist_onColumnDblClick },
  571. {L"onColumnLabelClick", 3, (void*)guilist_onColumnLabelClick },
  572. {L"onItemSelection", 2, (void*)guilist_onItemSelection },
  573. };
  574. ScriptObject *GuiListScriptController::instantiate()
  575. {
  576. ScriptList *sp = new ScriptList;
  577. ASSERT(sp != NULL);
  578. return sp->getScriptObject();
  579. }
  580. void GuiListScriptController::destroy(ScriptObject *o)
  581. {
  582. ScriptList *sp = static_cast<ScriptList *>(o->vcpu_getInterface(guilistGuid));
  583. ASSERT(sp != NULL);
  584. delete sp;
  585. }
  586. void *GuiListScriptController::encapsulate(ScriptObject *o)
  587. {
  588. return NULL; // no encapsulation for guilists yet
  589. }
  590. void GuiListScriptController::deencapsulate(void *o)
  591. {}
  592. int GuiListScriptController::getNumFunctions()
  593. {
  594. return sizeof(exportedFunction) / sizeof(function_descriptor_struct);
  595. }
  596. const function_descriptor_struct *GuiListScriptController::getExportedFunctions()
  597. {
  598. return exportedFunction;
  599. }
  600. /*int*/ scriptVar GuiListScriptController::guilist_getNumItems(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  601. {
  602. SCRIPT_FUNCTION_INIT
  603. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  604. int a = 0;
  605. if (sp) a = sp->getNumItems();
  606. return MAKE_SCRIPT_INT(a);
  607. }
  608. /*int*/ scriptVar GuiListScriptController::guilist_getWantAutoDeselect(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  609. {
  610. SCRIPT_FUNCTION_INIT
  611. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  612. int a = 0;
  613. if (sp)
  614. {
  615. sp->wantAutoDeselect();
  616. }
  617. return MAKE_SCRIPT_INT(a);
  618. }
  619. /*void*/ scriptVar GuiListScriptController::guilist_setWantAutoDeselect(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar want)
  620. {
  621. SCRIPT_FUNCTION_INIT
  622. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  623. if (sp)
  624. {
  625. int _want = GET_SCRIPT_INT(want);
  626. sp->setWantAutoDeselect(_want);
  627. }
  628. RETURN_SCRIPT_VOID;
  629. }
  630. /*void*/ scriptVar GuiListScriptController::guilist_onSetVisible(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar show)
  631. {
  632. SCRIPT_FUNCTION_INIT
  633. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  634. if (sp)
  635. {
  636. int _show = GET_SCRIPT_INT(show);
  637. sp->onSetVisible(_show);
  638. }
  639. RETURN_SCRIPT_VOID;
  640. }
  641. /*void*/ scriptVar GuiListScriptController::guilist_setAutoSort(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar dosort)
  642. {
  643. SCRIPT_FUNCTION_INIT
  644. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  645. if (sp)
  646. {
  647. int _dosort = GET_SCRIPT_INT(dosort);
  648. sp->setAutoSort(!!_dosort);
  649. }
  650. RETURN_SCRIPT_VOID;
  651. }
  652. /*void*/ scriptVar GuiListScriptController::guilist_next(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  653. {
  654. SCRIPT_FUNCTION_INIT
  655. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  656. if (sp)
  657. {
  658. sp->next();
  659. }
  660. RETURN_SCRIPT_VOID;
  661. }
  662. /*void*/ scriptVar GuiListScriptController::guilist_selectCurrent(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  663. {
  664. SCRIPT_FUNCTION_INIT
  665. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  666. if (sp)
  667. {
  668. sp->selectCurrent();
  669. }
  670. RETURN_SCRIPT_VOID;
  671. }
  672. /*void*/ scriptVar GuiListScriptController::guilist_selectFirstEntry(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  673. {
  674. SCRIPT_FUNCTION_INIT
  675. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  676. if (sp)
  677. {
  678. sp->selectFirstEntry();
  679. }
  680. RETURN_SCRIPT_VOID;
  681. }
  682. /*void*/ scriptVar GuiListScriptController::guilist_previous(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  683. {
  684. SCRIPT_FUNCTION_INIT
  685. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  686. if (sp)
  687. {
  688. sp->previous();
  689. }
  690. RETURN_SCRIPT_VOID;
  691. }
  692. /*void*/ scriptVar GuiListScriptController::guilist_pagedown(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  693. {
  694. SCRIPT_FUNCTION_INIT
  695. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  696. if (sp)
  697. {
  698. sp->pagedown();
  699. }
  700. RETURN_SCRIPT_VOID;
  701. }
  702. /*void*/ scriptVar GuiListScriptController::guilist_pageup(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  703. {
  704. SCRIPT_FUNCTION_INIT
  705. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  706. if (sp)
  707. {
  708. sp->pageup();
  709. }
  710. RETURN_SCRIPT_VOID;
  711. }
  712. /*void*/ scriptVar GuiListScriptController::guilist_home(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  713. {
  714. SCRIPT_FUNCTION_INIT
  715. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  716. if (sp)
  717. {
  718. sp->home();
  719. }
  720. RETURN_SCRIPT_VOID;
  721. }
  722. /*void*/ scriptVar GuiListScriptController::guilist_end(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  723. {
  724. SCRIPT_FUNCTION_INIT
  725. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  726. if (sp)
  727. {
  728. sp->end();
  729. }
  730. RETURN_SCRIPT_VOID;
  731. }
  732. /*void*/ scriptVar GuiListScriptController::guilist_reset(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  733. {
  734. SCRIPT_FUNCTION_INIT
  735. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  736. if (sp)
  737. {
  738. sp->reset();
  739. }
  740. RETURN_SCRIPT_VOID;
  741. }
  742. /*int*/ scriptVar GuiListScriptController::guilist_addColumn(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*String*/ scriptVar name, /*int*/ scriptVar width, /*int*/ scriptVar numeric)
  743. {
  744. SCRIPT_FUNCTION_INIT
  745. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  746. int retval = 0;
  747. if (sp)
  748. {
  749. StringW _name = GET_SCRIPT_STRING(name);
  750. int _width = GET_SCRIPT_INT(width);
  751. int _numeric = GET_SCRIPT_INT(numeric);
  752. retval = sp->addColumn(_name, _width, _numeric);
  753. }
  754. return MAKE_SCRIPT_INT(retval);
  755. }
  756. /*int*/ scriptVar GuiListScriptController::guilist_getNumColumns(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  757. {
  758. SCRIPT_FUNCTION_INIT
  759. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  760. int retval = 0;
  761. if (sp)
  762. {
  763. retval = sp->getNumColumns();
  764. }
  765. return MAKE_SCRIPT_INT(retval);
  766. }
  767. /*int*/ scriptVar GuiListScriptController::guilist_getColumnWidth(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar column)
  768. {
  769. SCRIPT_FUNCTION_INIT
  770. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  771. int retval = 0;
  772. if (sp)
  773. {
  774. int _column = GET_SCRIPT_INT(column);
  775. retval = sp->getColumnWidth(_column);
  776. }
  777. return MAKE_SCRIPT_INT(retval);
  778. }
  779. /*void*/ scriptVar GuiListScriptController::guilist_setColumnWidth(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar column, /*int*/ scriptVar newwidth)
  780. {
  781. SCRIPT_FUNCTION_INIT
  782. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  783. if (sp)
  784. {
  785. int _column = GET_SCRIPT_INT(column);
  786. int _newwidth = GET_SCRIPT_INT(newwidth);
  787. ListColumn *c = sp->getColumn(_column);
  788. if (c)
  789. {
  790. c->setWidth(_newwidth);
  791. }
  792. }
  793. RETURN_SCRIPT_VOID;
  794. }
  795. /*String*/ scriptVar GuiListScriptController::guilist_getColumnLabel(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar column)
  796. {
  797. SCRIPT_FUNCTION_INIT
  798. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  799. const wchar_t * retval = L"";
  800. if (sp)
  801. {
  802. int _column = GET_SCRIPT_INT(column);
  803. ListColumn *c = sp->getColumn(_column);
  804. if (c)
  805. {
  806. retval = c->getLabel();
  807. }
  808. }
  809. return MAKE_SCRIPT_STRING(retval);
  810. }
  811. /*void*/ scriptVar GuiListScriptController::guilist_setColumnLabel(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar column, /*String*/ scriptVar newlabel)
  812. {
  813. SCRIPT_FUNCTION_INIT
  814. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  815. if (sp)
  816. {
  817. int _column = GET_SCRIPT_INT(column);
  818. StringW _newlabel = GET_SCRIPT_STRING(newlabel);
  819. ListColumn *c = sp->getColumn(_column);
  820. if (c)
  821. {
  822. c->setLabel(_newlabel);
  823. }
  824. }
  825. RETURN_SCRIPT_VOID;
  826. }
  827. /*int*/ scriptVar GuiListScriptController::guilist_getColumnNumeric(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar column)
  828. {
  829. SCRIPT_FUNCTION_INIT
  830. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  831. int retval = 0;
  832. if (sp)
  833. {
  834. int _column = GET_SCRIPT_INT(column);
  835. ListColumn *c = sp->getColumn(_column);
  836. if (c)
  837. {
  838. retval = c->getNumeric();
  839. }
  840. }
  841. return MAKE_SCRIPT_INT(retval);
  842. }
  843. /*void*/ scriptVar GuiListScriptController::guilist_setColumnDynamic(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar column, /*int*/ scriptVar isdynamic)
  844. {
  845. SCRIPT_FUNCTION_INIT
  846. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  847. if (sp)
  848. {
  849. int _column = GET_SCRIPT_INT(column);
  850. int _isdynamic = GET_SCRIPT_INT(isdynamic);
  851. ListColumn *c = sp->getColumn(_column);
  852. if (c)
  853. {
  854. c->setDynamic(_isdynamic);
  855. }
  856. }
  857. RETURN_SCRIPT_VOID;
  858. }
  859. /*int*/ scriptVar GuiListScriptController::guilist_isColumnDynamic(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar column)
  860. {
  861. SCRIPT_FUNCTION_INIT
  862. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  863. int retval = 0;
  864. if (sp)
  865. {
  866. int _column = GET_SCRIPT_INT(column);
  867. ListColumn *c = sp->getColumn(_column);
  868. if (c)
  869. {
  870. retval = c->isDynamic();
  871. }
  872. }
  873. return MAKE_SCRIPT_INT(retval);
  874. }
  875. /*void*/ scriptVar GuiListScriptController::guilist_setMinimumSize(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar size)
  876. {
  877. SCRIPT_FUNCTION_INIT
  878. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  879. if (sp)
  880. {
  881. int _size = GET_SCRIPT_INT(size);
  882. sp->setMinimumSize(_size);
  883. }
  884. RETURN_SCRIPT_VOID;
  885. }
  886. /*int*/ scriptVar GuiListScriptController::guilist_addItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*String*/ scriptVar label)
  887. {
  888. SCRIPT_FUNCTION_INIT
  889. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  890. int retval = 0;
  891. if (sp)
  892. {
  893. StringW _label = GET_SCRIPT_STRING(label);
  894. retval = sp->addItem(_label, 0);
  895. }
  896. return MAKE_SCRIPT_INT(retval);
  897. }
  898. /*int*/ scriptVar GuiListScriptController::guilist_insertItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos, /*String*/ scriptVar label)
  899. {
  900. SCRIPT_FUNCTION_INIT
  901. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  902. int retval = 0;
  903. if (sp)
  904. {
  905. int _pos = GET_SCRIPT_INT(pos);
  906. StringW _label = GET_SCRIPT_STRING(label);
  907. retval = sp->insertItem(_pos, _label, 0);
  908. }
  909. return MAKE_SCRIPT_INT(retval);
  910. }
  911. /*int*/ scriptVar GuiListScriptController::guilist_getLastAddedItemPos(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  912. {
  913. SCRIPT_FUNCTION_INIT
  914. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  915. int retval = 0;
  916. if (sp)
  917. {
  918. retval = sp->getLastAddedItemPos();
  919. }
  920. return MAKE_SCRIPT_INT(retval);
  921. }
  922. /*void*/ scriptVar GuiListScriptController::guilist_setSubItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos, /*int*/ scriptVar subpos, /*String*/ scriptVar txt)
  923. {
  924. SCRIPT_FUNCTION_INIT
  925. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  926. if (sp)
  927. {
  928. int _pos = GET_SCRIPT_INT(pos);
  929. int _subpos = GET_SCRIPT_INT(subpos);
  930. StringW _txt = GET_SCRIPT_STRING(txt);
  931. sp->setSubItem(_pos, _subpos, _txt);
  932. }
  933. RETURN_SCRIPT_VOID;
  934. }
  935. /*void*/ scriptVar GuiListScriptController::guilist_deleteAllItems(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  936. {
  937. SCRIPT_FUNCTION_INIT
  938. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  939. if (sp)
  940. {
  941. sp->deleteAllItems();
  942. }
  943. RETURN_SCRIPT_VOID;
  944. }
  945. /*int*/ scriptVar GuiListScriptController::guilist_deleteByPos(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos)
  946. {
  947. SCRIPT_FUNCTION_INIT
  948. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  949. int retval = 0;
  950. if (sp)
  951. {
  952. int _pos = GET_SCRIPT_INT(pos);
  953. retval = sp->deleteByPos(_pos);
  954. }
  955. return MAKE_SCRIPT_INT(retval);
  956. }
  957. /*String*/ scriptVar GuiListScriptController::guilist_getItemLabel(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos, /*int*/ scriptVar subpos)
  958. {
  959. SCRIPT_FUNCTION_INIT
  960. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  961. wchar_t retval[255] = { 0 };
  962. if (sp)
  963. {
  964. int _pos = GET_SCRIPT_INT(pos);
  965. int _subpos = GET_SCRIPT_INT(subpos);
  966. sp->getItemLabel(_pos, _subpos, retval, 254);
  967. retval[254]=0;
  968. }
  969. staticStr = retval;
  970. return MAKE_SCRIPT_STRING(staticStr);
  971. }
  972. /*void*/ scriptVar GuiListScriptController::guilist_setItemLabel(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos, /*String*/ scriptVar text)
  973. {
  974. SCRIPT_FUNCTION_INIT
  975. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  976. if (sp)
  977. {
  978. int _pos = GET_SCRIPT_INT(pos);
  979. StringW _text = GET_SCRIPT_STRING(text);
  980. sp->setItemLabel(_pos, _text);
  981. }
  982. RETURN_SCRIPT_VOID;
  983. }
  984. /*void*/ scriptVar GuiListScriptController::guilist_setItemIcon(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos, /*String*/ scriptVar bitmapId)
  985. {
  986. SCRIPT_FUNCTION_INIT
  987. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  988. if (sp)
  989. {
  990. int _pos = GET_SCRIPT_INT(pos);
  991. StringW _bitmapId = GET_SCRIPT_STRING(bitmapId);
  992. sp->setItemIcon(_pos, _bitmapId);
  993. }
  994. RETURN_SCRIPT_VOID;
  995. }
  996. /*string*/ scriptVar GuiListScriptController::guilist_getItemIcon(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos)
  997. {
  998. SCRIPT_FUNCTION_INIT
  999. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1000. if (sp)
  1001. {
  1002. int _pos = GET_SCRIPT_INT(pos);
  1003. SkinBitmap * bmp = sp->getItemIcon(_pos);
  1004. staticStr = bmp->getBitmapName();
  1005. }
  1006. return MAKE_SCRIPT_STRING(staticStr);
  1007. }
  1008. /*void*/ scriptVar GuiListScriptController::guilist_setShowIcons(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar onoff)
  1009. {
  1010. SCRIPT_FUNCTION_INIT
  1011. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1012. if (sp)
  1013. {
  1014. int _onoff = GET_SCRIPT_INT(onoff);
  1015. sp->setShowIcons(_onoff);
  1016. }
  1017. RETURN_SCRIPT_VOID;
  1018. }
  1019. /*int*/ scriptVar GuiListScriptController::guilist_getShowIcons(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1020. {
  1021. SCRIPT_FUNCTION_INIT
  1022. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1023. int retval = 0;
  1024. if (sp)
  1025. {
  1026. retval = sp->getShowIcons();
  1027. }
  1028. return MAKE_SCRIPT_INT(retval);
  1029. }
  1030. /*void*/ scriptVar GuiListScriptController::guilist_setIconWidth(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar val)
  1031. {
  1032. SCRIPT_FUNCTION_INIT
  1033. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1034. if (sp)
  1035. {
  1036. int _val = GET_SCRIPT_INT(val);
  1037. sp->setIconWidth(_val);
  1038. }
  1039. RETURN_SCRIPT_VOID;
  1040. }
  1041. /*int*/ scriptVar GuiListScriptController::guilist_getIconWidth(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1042. {
  1043. SCRIPT_FUNCTION_INIT
  1044. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1045. int retval = 0;
  1046. if (sp)
  1047. {
  1048. retval = sp->getIconWidth();
  1049. }
  1050. return MAKE_SCRIPT_INT(retval);
  1051. }
  1052. /*void*/ scriptVar GuiListScriptController::guilist_setIconHeight(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar val)
  1053. {
  1054. SCRIPT_FUNCTION_INIT
  1055. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1056. if (sp)
  1057. {
  1058. int _val = GET_SCRIPT_INT(val);
  1059. sp->setIconHeight(_val);
  1060. }
  1061. RETURN_SCRIPT_VOID;
  1062. }
  1063. /*int*/ scriptVar GuiListScriptController::guilist_getIconHeight(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1064. {
  1065. SCRIPT_FUNCTION_INIT
  1066. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1067. int retval = 0;
  1068. if (sp)
  1069. {
  1070. retval = sp->getIconHeight();
  1071. }
  1072. return MAKE_SCRIPT_INT(retval);
  1073. }
  1074. /*int*/ scriptVar GuiListScriptController::guilist_getItemSelected(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos)
  1075. {
  1076. SCRIPT_FUNCTION_INIT
  1077. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1078. int retval = 0;
  1079. if (sp)
  1080. {
  1081. int _pos = GET_SCRIPT_INT(pos);
  1082. retval = sp->getItemSelected(_pos);
  1083. }
  1084. return MAKE_SCRIPT_INT(retval);
  1085. }
  1086. /*int*/ scriptVar GuiListScriptController::guilist_isItemFocused(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos)
  1087. {
  1088. SCRIPT_FUNCTION_INIT
  1089. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1090. int retval = 0;
  1091. if (sp)
  1092. {
  1093. int _pos = GET_SCRIPT_INT(pos);
  1094. retval = sp->getItemFocused(_pos);
  1095. }
  1096. return MAKE_SCRIPT_INT(retval);
  1097. }
  1098. /*int*/ scriptVar GuiListScriptController::guilist_getItemFocused(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1099. {
  1100. SCRIPT_FUNCTION_INIT
  1101. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1102. int retval = 0;
  1103. if (sp)
  1104. {
  1105. retval = sp->getItemFocused();
  1106. }
  1107. return MAKE_SCRIPT_INT(retval);
  1108. }
  1109. /*void*/ scriptVar GuiListScriptController::guilist_setItemFocused(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos)
  1110. {
  1111. SCRIPT_FUNCTION_INIT
  1112. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1113. if (sp)
  1114. {
  1115. int _pos = GET_SCRIPT_INT(pos);
  1116. sp->setItemFocused(_pos);
  1117. }
  1118. RETURN_SCRIPT_VOID;
  1119. }
  1120. /*void*/ scriptVar GuiListScriptController::guilist_ensureItemVisible(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos)
  1121. {
  1122. SCRIPT_FUNCTION_INIT
  1123. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1124. if (sp)
  1125. {
  1126. int _pos = GET_SCRIPT_INT(pos);
  1127. sp->ensureItemVisible(_pos);
  1128. }
  1129. RETURN_SCRIPT_VOID;
  1130. }
  1131. /*void*/ scriptVar GuiListScriptController::guilist_invalidateColumns(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1132. {
  1133. SCRIPT_FUNCTION_INIT
  1134. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1135. if (sp)
  1136. {
  1137. sp->invalidateColumns();
  1138. }
  1139. RETURN_SCRIPT_VOID;
  1140. }
  1141. /*int*/ scriptVar GuiListScriptController::guilist_scrollAbsolute(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar x)
  1142. {
  1143. SCRIPT_FUNCTION_INIT
  1144. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1145. int retval = 0;
  1146. if (sp)
  1147. {
  1148. int _x = GET_SCRIPT_INT(x);
  1149. retval = sp->scrollAbsolute(_x);
  1150. }
  1151. return MAKE_SCRIPT_INT(retval);
  1152. }
  1153. /*int*/ scriptVar GuiListScriptController::guilist_scrollRelative(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar x)
  1154. {
  1155. SCRIPT_FUNCTION_INIT
  1156. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1157. int retval = 0;
  1158. if (sp)
  1159. {
  1160. int _x = GET_SCRIPT_INT(x);
  1161. retval = sp->scrollRelative(_x);
  1162. }
  1163. return MAKE_SCRIPT_INT(retval);
  1164. }
  1165. /*void*/ scriptVar GuiListScriptController::guilist_scrollLeft(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar lines)
  1166. {
  1167. SCRIPT_FUNCTION_INIT
  1168. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1169. if (sp)
  1170. {
  1171. //int _lines = GET_SCRIPT_INT(lines);
  1172. sp->scrollLeft();
  1173. }
  1174. RETURN_SCRIPT_VOID;
  1175. }
  1176. /*void*/ scriptVar GuiListScriptController::guilist_scrollRight(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar lines)
  1177. {
  1178. SCRIPT_FUNCTION_INIT
  1179. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1180. if (sp)
  1181. {
  1182. //int _lines = GET_SCRIPT_INT(lines);
  1183. sp->scrollRight();
  1184. }
  1185. RETURN_SCRIPT_VOID;
  1186. }
  1187. /*void*/ scriptVar GuiListScriptController::guilist_scrollUp(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar lines)
  1188. {
  1189. SCRIPT_FUNCTION_INIT
  1190. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1191. if (sp)
  1192. {
  1193. //int _lines = GET_SCRIPT_INT(lines);
  1194. sp->scrollUp();
  1195. }
  1196. RETURN_SCRIPT_VOID;
  1197. }
  1198. /*void*/ scriptVar GuiListScriptController::guilist_scrollDown(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar lines)
  1199. {
  1200. SCRIPT_FUNCTION_INIT
  1201. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1202. if (sp)
  1203. {
  1204. //int _lines = GET_SCRIPT_INT(lines);
  1205. sp->scrollDown();
  1206. }
  1207. RETURN_SCRIPT_VOID;
  1208. }
  1209. /*String*/ scriptVar GuiListScriptController::guilist_getSubitemText(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos, /*int*/ scriptVar subpos)
  1210. {
  1211. SCRIPT_FUNCTION_INIT
  1212. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1213. const wchar_t *retval = 0;
  1214. if (sp)
  1215. {
  1216. int _pos = GET_SCRIPT_INT(pos);
  1217. int _subpos = GET_SCRIPT_INT(subpos);
  1218. retval = sp->getSubitemText(_pos, _subpos);
  1219. }
  1220. return MAKE_SCRIPT_STRING(retval);
  1221. }
  1222. /*int*/ scriptVar GuiListScriptController::guilist_getFirstItemSelected(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1223. {
  1224. SCRIPT_FUNCTION_INIT
  1225. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1226. int retval = 0;
  1227. if (sp)
  1228. {
  1229. retval = sp->getFirstItemSelected();
  1230. }
  1231. return MAKE_SCRIPT_INT(retval);
  1232. }
  1233. /*int*/ scriptVar GuiListScriptController::guilist_getNextItemSelected(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar lastpos)
  1234. {
  1235. SCRIPT_FUNCTION_INIT
  1236. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1237. int retval = 0;
  1238. if (sp)
  1239. {
  1240. int _lastpos = GET_SCRIPT_INT(lastpos);
  1241. retval = sp->getNextItemSelected(_lastpos);
  1242. }
  1243. return MAKE_SCRIPT_INT(retval);
  1244. }
  1245. /*int*/ scriptVar GuiListScriptController::guilist_selectAll(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1246. {
  1247. SCRIPT_FUNCTION_INIT
  1248. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1249. int retval = 0;
  1250. if (sp)
  1251. {
  1252. retval = sp->selectAll();
  1253. }
  1254. return MAKE_SCRIPT_INT(retval);
  1255. }
  1256. /*int*/ scriptVar GuiListScriptController::guilist_deselectAll(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1257. {
  1258. SCRIPT_FUNCTION_INIT
  1259. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1260. int retval = 0;
  1261. if (sp)
  1262. {
  1263. retval = sp->deselectAll();
  1264. }
  1265. return MAKE_SCRIPT_INT(retval);
  1266. }
  1267. /*int*/ scriptVar GuiListScriptController::guilist_invertSelection(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1268. {
  1269. SCRIPT_FUNCTION_INIT
  1270. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1271. int retval = 0;
  1272. if (sp)
  1273. {
  1274. retval = sp->invertSelection();
  1275. }
  1276. return MAKE_SCRIPT_INT(retval);
  1277. }
  1278. /*int*/ scriptVar GuiListScriptController::guilist_invalidateItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos)
  1279. {
  1280. SCRIPT_FUNCTION_INIT
  1281. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1282. int retval = 0;
  1283. if (sp)
  1284. {
  1285. int _pos = GET_SCRIPT_INT(pos);
  1286. retval = sp->invalidateItem(_pos);
  1287. }
  1288. return MAKE_SCRIPT_INT(retval);
  1289. }
  1290. /*int*/ scriptVar GuiListScriptController::guilist_getFirstItemVisible(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1291. {
  1292. SCRIPT_FUNCTION_INIT
  1293. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1294. int retval = 0;
  1295. if (sp)
  1296. {
  1297. retval = sp->getFirstItemVisible();
  1298. }
  1299. return MAKE_SCRIPT_INT(retval);
  1300. }
  1301. /*int*/ scriptVar GuiListScriptController::guilist_getLastItemVisible(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1302. {
  1303. SCRIPT_FUNCTION_INIT
  1304. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1305. int retval = 0;
  1306. if (sp)
  1307. {
  1308. retval = sp->getLastItemVisible();
  1309. }
  1310. return MAKE_SCRIPT_INT(retval);
  1311. }
  1312. /*int*/ scriptVar GuiListScriptController::guilist_setFontSize(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar size)
  1313. {
  1314. SCRIPT_FUNCTION_INIT
  1315. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1316. int retval = 0;
  1317. if (sp)
  1318. {
  1319. int _size = GET_SCRIPT_INT(size);
  1320. retval = sp->setFontSize(_size);
  1321. }
  1322. return MAKE_SCRIPT_INT(retval);
  1323. }
  1324. /*int*/ scriptVar GuiListScriptController::guilist_getFontSize(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1325. {
  1326. SCRIPT_FUNCTION_INIT
  1327. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1328. int retval = 0;
  1329. if (sp)
  1330. {
  1331. retval = sp->getFontSize();
  1332. }
  1333. return MAKE_SCRIPT_INT(retval);
  1334. }
  1335. /*void*/ scriptVar GuiListScriptController::guilist_jumpToNext(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*char*/ scriptVar c)
  1336. {
  1337. SCRIPT_FUNCTION_INIT
  1338. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1339. if (sp)
  1340. {
  1341. char _c = GET_SCRIPT_INT(c);
  1342. sp->jumpToNext(_c);
  1343. }
  1344. RETURN_SCRIPT_VOID;
  1345. }
  1346. /*void*/ scriptVar GuiListScriptController::guilist_scrollToItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos)
  1347. {
  1348. SCRIPT_FUNCTION_INIT
  1349. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1350. if (sp)
  1351. {
  1352. int _pos = GET_SCRIPT_INT(pos);
  1353. sp->scrollToItem(_pos);
  1354. }
  1355. RETURN_SCRIPT_VOID;
  1356. }
  1357. /*void*/ scriptVar GuiListScriptController::guilist_resort(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1358. {
  1359. SCRIPT_FUNCTION_INIT
  1360. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1361. if (sp)
  1362. {
  1363. sp->resort();
  1364. }
  1365. RETURN_SCRIPT_VOID;
  1366. }
  1367. /*int*/ scriptVar GuiListScriptController::guilist_getSortDirection(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1368. {
  1369. SCRIPT_FUNCTION_INIT
  1370. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1371. int retval = 0;
  1372. if (sp)
  1373. {
  1374. retval = sp->getSortDirection();
  1375. }
  1376. return MAKE_SCRIPT_INT(retval);
  1377. }
  1378. /*int*/ scriptVar GuiListScriptController::guilist_getSortColumn(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1379. {
  1380. SCRIPT_FUNCTION_INIT
  1381. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1382. int retval = 0;
  1383. if (sp)
  1384. {
  1385. retval = sp->getSortColumn();
  1386. }
  1387. return MAKE_SCRIPT_INT(retval);
  1388. }
  1389. /*void*/ scriptVar GuiListScriptController::guilist_setSortColumn(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar col)
  1390. {
  1391. SCRIPT_FUNCTION_INIT
  1392. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1393. if (sp)
  1394. {
  1395. int _col = GET_SCRIPT_INT(col);
  1396. sp->setSortColumn(_col);
  1397. }
  1398. RETURN_SCRIPT_VOID;
  1399. }
  1400. /*void*/ scriptVar GuiListScriptController::guilist_setSortDirection(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar dir)
  1401. {
  1402. SCRIPT_FUNCTION_INIT
  1403. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1404. if (sp)
  1405. {
  1406. int _dir = GET_SCRIPT_INT(dir);
  1407. sp->setSortDirection(_dir);
  1408. }
  1409. RETURN_SCRIPT_VOID;
  1410. }
  1411. /*int*/ scriptVar GuiListScriptController::guilist_getItemCount(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1412. {
  1413. SCRIPT_FUNCTION_INIT
  1414. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1415. int retval = 0;
  1416. if (sp)
  1417. {
  1418. retval = sp->getItemCount();
  1419. }
  1420. return MAKE_SCRIPT_INT(retval);
  1421. }
  1422. /*void*/ scriptVar GuiListScriptController::guilist_setSelectionStart(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos)
  1423. {
  1424. SCRIPT_FUNCTION_INIT
  1425. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1426. if (sp)
  1427. {
  1428. int _pos = GET_SCRIPT_INT(pos);
  1429. sp->setSelectionStart(_pos);
  1430. }
  1431. RETURN_SCRIPT_VOID;
  1432. }
  1433. /*void*/ scriptVar GuiListScriptController::guilist_setSelectionEnd(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos)
  1434. {
  1435. SCRIPT_FUNCTION_INIT
  1436. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1437. if (sp)
  1438. {
  1439. int _pos = GET_SCRIPT_INT(pos);
  1440. sp->setSelectionEnd(_pos);
  1441. }
  1442. RETURN_SCRIPT_VOID;
  1443. }
  1444. /*void*/ scriptVar GuiListScriptController::guilist_setSelected(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos, /*int*/ scriptVar selected)
  1445. {
  1446. SCRIPT_FUNCTION_INIT
  1447. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1448. if (sp)
  1449. {
  1450. int _pos = GET_SCRIPT_INT(pos);
  1451. int _selected = GET_SCRIPT_INT(selected);
  1452. sp->setSelected(_pos, _selected);
  1453. }
  1454. RETURN_SCRIPT_VOID;
  1455. }
  1456. /*void*/ scriptVar GuiListScriptController::guilist_toggleSelection(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar pos, /*int*/ scriptVar setfocus)
  1457. {
  1458. SCRIPT_FUNCTION_INIT
  1459. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1460. if (sp)
  1461. {
  1462. int _pos = GET_SCRIPT_INT(pos);
  1463. int _setfocus = GET_SCRIPT_INT(setfocus);
  1464. sp->toggleSelection(_pos, _setfocus);
  1465. }
  1466. RETURN_SCRIPT_VOID;
  1467. }
  1468. /*int*/ scriptVar GuiListScriptController::guilist_getHeaderHeight(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1469. {
  1470. SCRIPT_FUNCTION_INIT
  1471. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1472. int retval = 0;
  1473. if (sp)
  1474. {
  1475. retval = sp->getHeaderHeight();
  1476. }
  1477. return MAKE_SCRIPT_INT(retval);
  1478. }
  1479. /*int*/ scriptVar GuiListScriptController::guilist_getPreventMultipleSelection(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1480. {
  1481. SCRIPT_FUNCTION_INIT
  1482. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1483. int retval = 0;
  1484. if (sp)
  1485. {
  1486. retval = sp->getPreventMultipleSelection();
  1487. }
  1488. return MAKE_SCRIPT_INT(retval);
  1489. }
  1490. /*int*/ scriptVar GuiListScriptController::guilist_setPreventMultipleSelection(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar val)
  1491. {
  1492. SCRIPT_FUNCTION_INIT
  1493. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1494. int retval = 0;
  1495. if (sp)
  1496. {
  1497. int _val = GET_SCRIPT_INT(val);
  1498. retval = sp->setPreventMultipleSelection(_val);
  1499. }
  1500. return MAKE_SCRIPT_INT(retval);
  1501. }
  1502. /*void*/ scriptVar GuiListScriptController::guilist_moveItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar from, /*int*/ scriptVar to)
  1503. {
  1504. SCRIPT_FUNCTION_INIT
  1505. ScriptList *sp = static_cast<ScriptList*>(o->vcpu_getInterface(guilistGuid));
  1506. if (sp)
  1507. {
  1508. int _from = GET_SCRIPT_INT(from);
  1509. int _to = GET_SCRIPT_INT(to);
  1510. sp->moveItem(_from, _to);
  1511. }
  1512. RETURN_SCRIPT_VOID;
  1513. }
  1514. /*void*/ scriptVar GuiListScriptController::guilist_onSelectAll(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1515. {
  1516. SCRIPT_FUNCTION_INIT
  1517. PROCESS_HOOKS0(o, guiListController);
  1518. SCRIPT_FUNCTION_CHECKABORTEVENT;
  1519. SCRIPT_EXEC_EVENT0(o);
  1520. }
  1521. /*void*/ scriptVar GuiListScriptController::guilist_onDelete(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
  1522. {
  1523. SCRIPT_FUNCTION_INIT
  1524. PROCESS_HOOKS0(o, guiListController);
  1525. SCRIPT_FUNCTION_CHECKABORTEVENT;
  1526. SCRIPT_EXEC_EVENT0(o);
  1527. }
  1528. /*void*/ scriptVar GuiListScriptController::guilist_onDoubleClick(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar itemnum)
  1529. {
  1530. SCRIPT_FUNCTION_INIT
  1531. PROCESS_HOOKS1(o, guiListController, itemnum);
  1532. SCRIPT_FUNCTION_CHECKABORTEVENT;
  1533. SCRIPT_EXEC_EVENT1(o, itemnum);
  1534. }
  1535. /*void*/ scriptVar GuiListScriptController::guilist_onLeftClick(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar itemnum)
  1536. {
  1537. SCRIPT_FUNCTION_INIT
  1538. PROCESS_HOOKS1(o, guiListController, itemnum);
  1539. SCRIPT_FUNCTION_CHECKABORTEVENT;
  1540. SCRIPT_EXEC_EVENT1(o, itemnum);
  1541. }
  1542. /*void*/ scriptVar GuiListScriptController::guilist_onIconLeftClick(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar itemnum, /*int*/ scriptVar x, /*int*/ scriptVar y)
  1543. {
  1544. SCRIPT_FUNCTION_INIT
  1545. PROCESS_HOOKS3(o, guiListController, itemnum, x, y);
  1546. SCRIPT_FUNCTION_CHECKABORTEVENT;
  1547. SCRIPT_EXEC_EVENT3(o, itemnum, x, y);
  1548. }
  1549. /*void*/ scriptVar GuiListScriptController::guilist_onSecondLeftClick(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar itemnum)
  1550. {
  1551. SCRIPT_FUNCTION_INIT
  1552. PROCESS_HOOKS1(o, guiListController, itemnum);
  1553. SCRIPT_FUNCTION_CHECKABORTEVENT;
  1554. SCRIPT_EXEC_EVENT1(o, itemnum);
  1555. }
  1556. /*int*/ scriptVar GuiListScriptController::guilist_onRightClick(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar itemnum)
  1557. {
  1558. SCRIPT_FUNCTION_INIT
  1559. PROCESS_HOOKS1(o, guiListController, itemnum);
  1560. SCRIPT_FUNCTION_CHECKABORTEVENT;
  1561. SCRIPT_EXEC_EVENT1(o, itemnum);
  1562. }
  1563. /*int*/ scriptVar GuiListScriptController::guilist_onColumnDblClick(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar col, /*int*/ scriptVar x, /*int*/ scriptVar y)
  1564. {
  1565. SCRIPT_FUNCTION_INIT
  1566. PROCESS_HOOKS3(o, guiListController, col, x, y);
  1567. SCRIPT_FUNCTION_CHECKABORTEVENT;
  1568. SCRIPT_EXEC_EVENT3(o, col, x, y);
  1569. }
  1570. /*int*/ scriptVar GuiListScriptController::guilist_onColumnLabelClick(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar col, /*int*/ scriptVar x, /*int*/ scriptVar y)
  1571. {
  1572. SCRIPT_FUNCTION_INIT
  1573. PROCESS_HOOKS3(o, guiListController, col, x, y);
  1574. SCRIPT_FUNCTION_CHECKABORTEVENT;
  1575. SCRIPT_EXEC_EVENT3(o, col, x, y);
  1576. }
  1577. /*void*/ scriptVar GuiListScriptController::guilist_onItemSelection(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar itemnum, /*int*/ scriptVar selected)
  1578. {
  1579. SCRIPT_FUNCTION_INIT
  1580. PROCESS_HOOKS2(o, guiListController, itemnum, selected);
  1581. SCRIPT_FUNCTION_CHECKABORTEVENT;
  1582. SCRIPT_EXEC_EVENT2(o, itemnum, selected);
  1583. }