1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644 |
- #include <precomp.h>
- #include "xuitree.h"
- #include <api/service/svc_enum.h>
- #include <bfc/parse/hierarchyparser.h>
- #include <api/script/scriptguid.h>
- #include <api/skin/feeds/TextFeedEnum.h>
- // The temporary memory buffer to hold our string returns.
- StringW GuiTreeScriptController::staticStr;
- class ScriptTreeItem;
- // -----------------------------------------------------------------------
- // class TreeItemScript -- This is the tree item type inserted into
- // the tree if a script or XML piece is inserting items into the tree.
- class TreeItemScript : public TreeItem
- {
- public:
- TreeItemScript(const wchar_t *label = NULL, ScriptTreeItem *_scriptitem = NULL) : scriptitem(_scriptitem), TreeItem(label)
- {}
- virtual ~TreeItemScript()
- {}
- virtual void onTreeAdd()
- {
- if (scriptitem) TreeItemScriptController::treeitem_onTreeAdd(SCRIPT_CALL, scriptitem->getScriptObject());
- }
- virtual void onTreeRemove()
- {
- if (scriptitem) TreeItemScriptController::treeitem_onTreeRemove(SCRIPT_CALL, scriptitem->getScriptObject());
- }
- virtual void onSelect()
- {
- if (scriptitem) TreeItemScriptController::treeitem_onSelect(SCRIPT_CALL, scriptitem->getScriptObject());
- }
- virtual void onDeselect()
- {
- if (scriptitem) TreeItemScriptController::treeitem_onDeselect(SCRIPT_CALL, scriptitem->getScriptObject());
- }
- virtual int onLeftDoubleClick()
- {
- scriptVar retval;
- if (scriptitem)
- retval = TreeItemScriptController::treeitem_onLeftDoubleClick(SCRIPT_CALL, scriptitem->getScriptObject());
- if ((retval.type == SCRIPT_VOID)
- || (retval.type == SCRIPT_OBJECT)
- || (retval.type == SCRIPT_STRING))
- return 0;
- return GET_SCRIPT_INT(retval);
- }
- virtual int onRightDoubleClick()
- {
- scriptVar retval;
- if (scriptitem) retval = TreeItemScriptController::treeitem_onRightDoubleClick(SCRIPT_CALL, scriptitem->getScriptObject());
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING)) return 0;
- return GET_SCRIPT_INT(retval);
- }
- // return 1 if you eat the key
- virtual int onChar(UINT key)
- {
- scriptVar retval;
- if (scriptitem) retval = TreeItemScriptController::treeitem_onChar(SCRIPT_CALL, scriptitem->getScriptObject(), MAKE_SCRIPT_INT(key));
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING)) return 0;
- return GET_SCRIPT_INT(retval);
- }
- // these are called after the expand/collapse happens
- virtual void onExpand()
- {
- if (scriptitem) TreeItemScriptController::treeitem_onExpand(SCRIPT_CALL, scriptitem->getScriptObject());
- }
- virtual void onCollapse()
- {
- if (scriptitem) TreeItemScriptController::treeitem_onCollapse(SCRIPT_CALL, scriptitem->getScriptObject());
- }
- virtual int onBeginLabelEdit()
- {
- scriptVar retval;
- if (scriptitem) retval = TreeItemScriptController::treeitem_onBeginLabelEdit(SCRIPT_CALL, scriptitem->getScriptObject());
- int retv = 0;
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING))
- {
- retv = -1;
- }
- if (!retv)
- {
- retv = GET_SCRIPT_INT(retval);
- }
- if (retv < 1)
- {
- retv = TreeItem::onBeginLabelEdit();
- }
- return retv;
- }
- virtual int onEndLabelEdit(const wchar_t *newlabel)
- {
- scriptVar retval;
- if (scriptitem)
- retval = TreeItemScriptController::treeitem_onEndLabelEdit(SCRIPT_CALL, scriptitem->getScriptObject(), MAKE_SCRIPT_STRING(newlabel));
- int retv = 0;
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING))
- {
- retv = -1;
- }
- if (!retv)
- {
- retv = GET_SCRIPT_INT(retval);
- }
- if (retv < 1)
- {
- retv = TreeItem::onEndLabelEdit(newlabel);
- }
- return retv;
- }
- virtual int onContextMenu(int x, int y)
- {
- scriptVar retval;
- if (scriptitem) retval = TreeItemScriptController::treeitem_onContextMenu(SCRIPT_CALL, scriptitem->getScriptObject(), MAKE_SCRIPT_INT(x), MAKE_SCRIPT_INT(y) );
- int retv = 0;
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING))
- {
- retv = -1;
- }
- if (!retv)
- {
- retv = GET_SCRIPT_INT(retval);
- }
- if (retv < 1)
- {
- retv = TreeItem::onContextMenu(x, y);
- }
- return retv;
- }
- protected:
- ScriptTreeItem *scriptitem;
- };
- // -----------------------------------------------------------------------
- const wchar_t ScriptTreeXuiObjectStr[] = L"Tree"; // This is the xml tag
- char ScriptTreeXuiSvcName[] = "Tree xui object";
- XMLParamPair ScriptTree::params[] = {
- {SCRIPTTREE_CHILDTABS, L"CHILDTABS"},
- {SCRIPTTREE_EXPANDROOT, L"EXPANDROOT"},
- {SCRIPTTREE_FEED, L"FEED"},
- {SCRIPTTREE_SETITEMS, L"ITEMS"},
- {SCRIPTTREE_SORTED, L"SORTED"},
- };
- // -----------------------------------------------------------------------
- ScriptTree::ScriptTree()
- {
- getScriptObject()->vcpu_setInterface(guitreeGuid, (void *)static_cast<ScriptTree *>(this));
- getScriptObject()->vcpu_setClassName(L"GuiTree"); // this is the script class name
- getScriptObject()->vcpu_setController(guiTreeController);
- myxuihandle = newXuiHandle();
- CreateXMLParameters(myxuihandle);
-
- feed = NULL;
- childtabs = 1;
- expandroot = 1;
- }
- void ScriptTree::CreateXMLParameters(int master_handle)
- {
- //SCRIPTTREE_PARENT::CreateXMLParameters(master_handle);
- int numParams = sizeof(params) / sizeof(params[0]);
- hintNumberOfParams(myxuihandle, numParams);
- for (int i = 0;i < numParams;i++)
- addParam(myxuihandle, params[i], XUI_ATTRIBUTE_IMPLIED);
- }
- // -----------------------------------------------------------------------
- ScriptTree::~ScriptTree()
- {
- closeFeed();
- // Clean up the ScriptTreeItems owned by this guy.
- TreeItem *item = enumRootItem(0);
- while (item != NULL)
- {
- // Delete this item.
- ScriptTreeItem *dead = NULL;
- //if (TISC::g_scriptitems.getItem(item, &dead) && (dead != NULL))
- //{ // true if it found something.
- // TISC::g_scriptitems.delItem(item);
- // delete dead;
- // // DebugString(" === deleting tree item (%08X, %08X, %08X)\n", item, dead, this);
- // continue;
- //}
- auto it = TISC::g_scriptitems.find(item);
- if (TISC::g_scriptitems.end() != it)
- {
- dead = it->second;
- delete dead;
- TISC::g_scriptitems.erase(it);
- continue;
- }
- else
- {
- // DebugString(" !!! ORPHAN TREE ITEM (%08X, %08X, %08X)\n", item, 0, this);
- }
- // Figure out who the next item to process should be.
- // 1) Children first.
- TreeItem *child = item->getChild();
- if (child != NULL)
- {
- item = child;
- }
- else
- {
- // 2) Siblings next.
- TreeItem *sibling = item->getSibling();
- if (sibling != NULL)
- {
- item = sibling;
- }
- else
- {
- // 3) Zip up parent chain last.
- TreeItem *item_parent, *parent_sibling;
- item_parent = item->getParent();
- item = NULL; // at this point if we do not assign, we are NULL.
- while (item_parent != NULL)
- {
- parent_sibling = item_parent->getSibling();
- if (parent_sibling != NULL)
- {
- item = parent_sibling;
- break;
- }
- item_parent = item_parent->getParent();
- }
- // 4) Uhhh.... you're null. All done. Go home.
- }
- }
- }
- /*
-
- // delete all of our script items from g_scriptitems
- int i = 0;
- TreeItem *next = enumRootItem(0);
- while (next) { // go through all of our items
- ScriptTreeItem *dead = NULL;
- if (TISC::g_scriptitems.getItem(next, &dead) && (dead != NULL)) { // true if it found something.
- TISC::g_scriptitems.delItem(next);
- delete dead;
- // DebugString(" === deleting tree item (%08X, %08X)\n", next, dead);
- } else {
- // DebugString(" !!! ORPHAN TREE ITEM (%08X, %08X)\n", next, i);
- }
- TreeItem *next = enumAllItems(i++);
- }
-
- */
- // some items will wind up leaked into g_scriptitems, most likely.
- }
- // -----------------------------------------------------------------------
- int ScriptTree::setXuiParam(int xuihandle, int xmlattributeid, const wchar_t *xmlattributename, const wchar_t *value)
- {
- if (xuihandle != myxuihandle)
- return SCRIPTTREE_PARENT::setXuiParam(xuihandle, xmlattributeid, xmlattributename, value);
- switch (xmlattributeid)
- {
- case SCRIPTTREE_SETITEMS:
- items = value;
- fillFromParams();
- #ifdef WASABI_COMPILE_CONFIG
- if (getGuiObject()->guiobject_hasCfgAttrib())
- selectFromConfig();
- #endif
- break;
- case SCRIPTTREE_FEED:
- {
- closeFeed();
- openFeed(value);
- break;
- }
- case SCRIPTTREE_SORTED:
- {
- setSorted(WTOB(value));
- break;
- }
- case SCRIPTTREE_CHILDTABS:
- {
- childtabs = WTOI(value);
- break;
- }
- case SCRIPTTREE_EXPANDROOT:
- {
- expandRoot(WTOI(value));
- break;
- }
- default:
- return 0;
- }
- return 1;
- }
- // -----------------------------------------------------------------------
- int ScriptTree::onInit()
- {
- SCRIPTTREE_PARENT::onInit();
- fillFromParams();
- return 1;
- }
- // -----------------------------------------------------------------------
- int ScriptTree::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)
- {
- SCRIPTTREE_PARENT::onAction(action, param, x, y, p1, p2, data, datalen, source);
- if (!WCSICMP(action, L"get_selection"))
- {
- if (source != NULL)
- {
- StringW res(L"");
- // Hmmmmm..... multiselection trees?
- sendAction(source, L"set_selection", res);
- }
- }
- return 1;
- }
- // -----------------------------------------------------------------------
- ScriptTreeItem *ScriptTree::bindScriptTreeItem(TreeItem *item)
- {
- ASSERT(item != NULL);
- // find this tree item in our map of tree items.
- ScriptTreeItem *si = NULL;
- //TISC::g_scriptitems.getItem(item, &si);
- auto it = TISC::g_scriptitems.find(item);
- if (TISC::g_scriptitems.end() == it)
- {
- // if there was no scriptobject in our map already, make one
- // for this tree item and place it in our map.
- si = new ScriptTreeItem(item, this);
- TISC::g_scriptitems.insert({ item, si });
- }
- else
- {
- si = it->second;
- }
- return si;
- }
- // -----------------------------------------------------------------------
- int ScriptTree::destroyScriptTreeItem(ScriptTreeItem *item)
- {
- ASSERT(item != NULL);
- // find this tree item in our map of tree items.
- TreeItem *ti = item->getItem();
- if (ti)
- {
- ScriptTreeItem *check = NULL;
- //TISC::g_scriptitems.getItem(ti, &check); // this is a doublecheck on who owns who.
- auto it = TISC::g_scriptitems.find(ti);
-
- if (TISC::g_scriptitems.end() != it)
- {
- // remove the treeitem from the tree
- this->removeTreeItem(ti); // (removes without deleting)
- // remove the scripttreeitem from the map
- TISC::g_scriptitems.erase(it);
- // and delete.(phew! bomb disposal!)
- delete ti;
- delete item;
- return 1; // yes, we deleted it.
- }
- }
- return 0; // Not ours, don't wanna delete it. Someone else can Deal With It.
- }
- // -----------------------------------------------------------------------
- void ScriptTree::onSetVisible(int i)
- {
- SCRIPTTREE_PARENT::onSetVisible(i);
- }
- #ifdef WASABI_COMPILE_CONFIG
- // -----------------------------------------------------------------------
- int ScriptTree::onReloadConfig()
- {
- SCRIPTTREE_PARENT::onReloadConfig();
- selectFromConfig();
- return 1;
- }
- // -----------------------------------------------------------------------
- void ScriptTree::saveToConfig()
- {}
- // -----------------------------------------------------------------------
- void ScriptTree::selectFromConfig()
- {}
- #endif
- // -----------------------------------------------------------------------
- int ScriptTree::selectEntry(const wchar_t *e, int cb)
- {
- return -1;
- }
- // -----------------------------------------------------------------------
- void ScriptTree::expandRoot(int val)
- {
- if (val)
- {
- expandroot = 1;
- int count;
- TreeItem *rootitem;
- for (count = 0, rootitem = enumRootItem(count); rootitem; rootitem = enumRootItem(++count))
- {
- rootitem->expand();
- }
- }
- else
- {
- expandroot = 0;
- }
- }
- // -----------------------------------------------------------------------
- void ScriptTree::fillFromHPNode(HPNode *node, TreeItem *parent)
- {
- // Go through the given node's children and add items for them
- // to the corresponding parent item.
- int i, n = node->getNumChildren();
- for (i = 0; i < n; i++)
- {
- // Here's a child node
- HPNode *child_node = static_cast<HPNode *>(node->enumChild(i));
- // Make a script-aware tree item and script item to correspond to it, labelled with the child_node's name
- ScriptTreeItem *si = new ScriptTreeItem;
- TreeItem *child_item = new TreeItemScript((*child_node)(), si);
- si->setItem(child_item);
- si->setScriptTree(this);
- // Add the script and tree items to the scriptitems map
- TISC::g_scriptitems.insert({ child_item, si });
- // DebugString(StringPrintf(" === NEW NODE ITEM (%08X, %08X, %08X)\n", child_item, si, this);
- // Add the child item to either ourselves or the given parent.
- addTreeItem(child_item, parent, getSorted(), childtabs);
- // And then continue to fill from that node.
- fillFromHPNode(child_node, child_item);
- }
- }
- // -----------------------------------------------------------------------
- void ScriptTree::fillFromParams()
- {
- deleteAllItems();
- if (!items.isempty())
- {
- HierarchyParser hierarchy(items);
- fillFromHPNode(hierarchy.rootNode());
- }
- // If we want our roots opened, do so now.
- expandRoot(expandroot);
- }
- // -----------------------------------------------------------------------
- void ScriptTree::selectEntries(const wchar_t *entries, int cb)
- {}
- // -----------------------------------------------------------------------
- void ScriptTree::openFeed(const wchar_t *feedid)
- {
- if (!_wcsicmp(feedid, last_feed)) return ;
- feed = TextFeedEnum(feedid).getFirst();
- if (feed != NULL)
- {
- viewer_addViewItem(feed->getDependencyPtr());
- setXuiParam(myxuihandle, SCRIPTTREE_SETITEMS, L"items", feed->getFeedText(feedid));
- }
- last_feed = feedid;
- }
- // -----------------------------------------------------------------------
- void ScriptTree::closeFeed()
- {
- if (feed)
- {
- viewer_delViewItem(feed->getDependencyPtr());
- SvcEnum::release(feed);
- }
- feed = NULL;
- last_feed = L"";
- }
- // -----------------------------------------------------------------------
- int ScriptTree::viewer_onEvent(api_dependent *item, const GUID *classguid, int event, intptr_t param, void *ptr, size_t ptrlen)
- {
- if (feed == dynamic_guid_cast<svc_textFeed>(item, classguid))
- {
- if (event == svc_textFeed::Event_TEXTCHANGE)
- {
- setXuiParam(myxuihandle, SCRIPTTREE_SETITEMS, L"items", (const wchar_t *)ptr);
- return 1;
- }
- }
- return 0;
- }
- // -----------------------------------------------------------------------
- // Callback methods that send hooks into the Script system
- int ScriptTree::onLeftButtonDown(int x, int y)
- {
- scriptVar retval;
- retval = GuiTreeScriptController::guitree_onLeftButtonDown(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(x), MAKE_SCRIPT_INT(y) );
- int retv = 0;
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING))
- {
- retv = -1;
- }
- if (!retv)
- {
- retv = GET_SCRIPT_INT(retval);
- }
- if (retv < 1)
- {
- retv = SCRIPTTREE_PARENT::onLeftButtonDown(x, y);
- }
- return retv;
- }
- int ScriptTree::onLeftButtonUp(int x, int y)
- {
- scriptVar retval;
- retval = GuiTreeScriptController::guitree_onLeftButtonUp(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(x), MAKE_SCRIPT_INT(y) );
- int retv = 0;
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING))
- {
- retv = -1;
- }
- if (!retv)
- {
- retv = GET_SCRIPT_INT(retval);
- }
- if (retv < 1)
- {
- retv = SCRIPTTREE_PARENT::onLeftButtonUp(x, y);
- }
- return retv;
- }
- int ScriptTree::onRightButtonUp(int x, int y)
- {
- scriptVar retval;
- retval = GuiTreeScriptController::guitree_onRightButtonUp(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(x), MAKE_SCRIPT_INT(y) );
- int retv = 0;
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING))
- {
- retv = -1;
- }
- if (!retv)
- {
- retv = GET_SCRIPT_INT(retval);
- }
- if (retv < 1)
- {
- retv = SCRIPTTREE_PARENT::onRightButtonUp(x, y);
- }
- return retv;
- }
- int ScriptTree::onMouseMove(int x, int y)
- {
- scriptVar retval;
- retval = GuiTreeScriptController::guitree_onMouseMove(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(x), MAKE_SCRIPT_INT(y) );
- int retv = 0;
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING))
- {
- retv = -1;
- }
- if (!retv)
- {
- retv = GET_SCRIPT_INT(retval);
- }
- if (retv < 1)
- {
- retv = SCRIPTTREE_PARENT::onMouseMove(x, y);
- }
- return retv;
- }
- int ScriptTree::wantAutoContextMenu()
- {
- scriptVar retval;
- retval = GuiTreeScriptController::guitree_wantAutoContextMenu(SCRIPT_CALL, getScriptObject() );
- int retv = 0;
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING))
- {
- retv = -1;
- }
- if (!retv)
- {
- retv = GET_SCRIPT_INT(retval);
- }
- if (retv < 1)
- {
- retv = SCRIPTTREE_PARENT::wantAutoContextMenu();
- }
- return retv;
- }
- int ScriptTree::onLeftButtonDblClk(int x, int y)
- {
- scriptVar retval;
- retval = GuiTreeScriptController::guitree_onLeftButtonDblClk(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(x), MAKE_SCRIPT_INT(y) );
- int retv = 0;
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING))
- {
- retv = -1;
- }
- if (!retv)
- {
- retv = GET_SCRIPT_INT(retval);
- }
- if (retv < 1)
- {
- retv = SCRIPTTREE_PARENT::onLeftButtonDblClk(x, y);
- }
- return retv;
- }
- int ScriptTree::onRightButtonDblClk(int x, int y)
- {
- scriptVar retval;
- retval = GuiTreeScriptController::guitree_onRightButtonDblClk(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(x), MAKE_SCRIPT_INT(y) );
- int retv = 0;
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING))
- {
- retv = -1;
- }
- if (!retv)
- {
- retv = GET_SCRIPT_INT(retval);
- }
- if (retv < 1)
- {
- retv = SCRIPTTREE_PARENT::onRightButtonDblClk(x, y);
- }
- return retv;
- }
- int ScriptTree::onMouseWheelUp(int clicked, int lines)
- {
- scriptVar retval;
- retval = GuiTreeScriptController::guitree_onMouseWheelUp(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(clicked), MAKE_SCRIPT_INT(lines) );
- int retv = 0;
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING))
- {
- retv = -1;
- }
- if (!retv)
- {
- retv = GET_SCRIPT_INT(retval);
- }
- if (retv < 1)
- {
- retv = SCRIPTTREE_PARENT::onMouseWheelUp(clicked, lines);
- }
- return retv;
- }
- int ScriptTree::onMouseWheelDown(int clicked, int lines)
- {
- scriptVar retval;
- retval = GuiTreeScriptController::guitree_onMouseWheelDown(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(clicked), MAKE_SCRIPT_INT(lines) );
- int retv = 0;
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING))
- {
- retv = -1;
- }
- if (!retv)
- {
- retv = GET_SCRIPT_INT(retval);
- }
- if (retv < 1)
- {
- retv = SCRIPTTREE_PARENT::onMouseWheelDown(clicked, lines);
- }
- return retv;
- }
- int ScriptTree::onContextMenu(int x, int y)
- {
- scriptVar retval;
- retval = GuiTreeScriptController::guitree_onContextMenu(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(x), MAKE_SCRIPT_INT(y) );
- int retv = 0;
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING))
- {
- retv = -1;
- }
- if (!retv)
- {
- retv = GET_SCRIPT_INT(retval);
- }
- if (retv < 1)
- {
- retv = SCRIPTTREE_PARENT::onContextMenu(x, y);
- }
- return retv;
- }
- int ScriptTree::onChar(wchar_t c)
- {
- scriptVar retval;
- retval = GuiTreeScriptController::guitree_onChar(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(c));
- int retv = 0;
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING))
- {
- retv = -1;
- }
- if (!retv)
- {
- retv = GET_SCRIPT_INT(retval);
- }
- if (retv < 1)
- {
- retv = SCRIPTTREE_PARENT::onChar(c);
- }
- return retv;
- }
- int ScriptTree::onKeyDown(int keycode)
- {
- scriptVar retval;
- retval = GuiTreeScriptController::guitree_onKeyDown(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_INT(keycode) );
- int retv = 0;
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING))
- {
- retv = -1;
- }
- if (!retv)
- {
- retv = GET_SCRIPT_INT(retval);
- }
- if (retv < 1)
- {
- retv = SCRIPTTREE_PARENT::onKeyDown(keycode);
- }
- return retv;
- }
- void ScriptTree::onItemRecvDrop(TreeItem *item)
- {
- ScriptTreeItem *sti_item = bindScriptTreeItem(item);
- GuiTreeScriptController::guitree_onItemRecvDrop(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_OBJECT(sti_item->getScriptObject()) );
- }
- void ScriptTree::onLabelChange(TreeItem *item)
- {
- ScriptTreeItem *sti_item = bindScriptTreeItem(item);
- GuiTreeScriptController::guitree_onLabelChange(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_OBJECT(sti_item->getScriptObject()) );
- }
- void ScriptTree::onItemSelected(TreeItem *item)
- {
- ScriptTreeItem *sti_item = bindScriptTreeItem(item);
- GuiTreeScriptController::guitree_onItemSelected(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_OBJECT(sti_item->getScriptObject()) );
- }
- void ScriptTree::onItemDeselected(TreeItem *item)
- {
- ScriptTreeItem *sti_item = bindScriptTreeItem(item);
- GuiTreeScriptController::guitree_onItemDeselected(SCRIPT_CALL, getScriptObject(), MAKE_SCRIPT_OBJECT(sti_item->getScriptObject()) );
- }
- int ScriptTree::onKillFocus()
- {
- scriptVar retval;
- retval = GuiTreeScriptController::guitree_onKillFocus(SCRIPT_CALL, getScriptObject() );
- int retv = 0;
- if ((retval.type == SCRIPT_VOID) || (retval.type == SCRIPT_OBJECT) || (retval.type == SCRIPT_STRING))
- {
- retv = -1;
- }
- if (!retv)
- {
- retv = GET_SCRIPT_INT(retval);
- }
- if (retv < 1)
- {
- retv = SCRIPTTREE_PARENT::onKillFocus();
- }
- return retv;
- }
- // -----------------------------------------------------------------------
- // Script Object
- GuiTreeScriptController _guiTreeController;
- GuiTreeScriptController *guiTreeController = &_guiTreeController;
- // -- Functions table -------------------------------------
- function_descriptor_struct GuiTreeScriptController::exportedFunction[] = {
- {L"getNumRootItems", 0, (void*)GuiTreeScriptController::guitree_getNumRootItems },
- {L"enumRootItem", 1, (void*)GuiTreeScriptController::guitree_enumRootItem },
- {L"onLeftButtonDown", 2, (void*)GuiTreeScriptController::guitree_onLeftButtonDown }, // , /*Int*/ scriptVar x, /*Int*/ scriptVar y);
- {L"onLeftButtonUp", 2, (void*)GuiTreeScriptController::guitree_onLeftButtonUp }, // , /*Int*/ scriptVar x, /*Int*/ scriptVar y);
- {L"onRightButtonUp", 2, (void*)GuiTreeScriptController::guitree_onRightButtonUp }, // , /*Int*/ scriptVar x, /*Int*/ scriptVar y);
- {L"onMouseMove", 2, (void*)GuiTreeScriptController::guitree_onMouseMove }, // , /*Int*/ scriptVar x, /*Int*/ scriptVar y);
- {L"onWantAutoContextMenu", 0, (void*)GuiTreeScriptController::guitree_wantAutoContextMenu }, // );
- {L"onLeftButtonDblClk", 2, (void*)GuiTreeScriptController::guitree_onLeftButtonDblClk }, // , /*Int*/ scriptVar x, /*Int*/ scriptVar y);
- {L"onRightButtonDblClk", 2, (void*)GuiTreeScriptController::guitree_onRightButtonDblClk }, // , /*Int*/ scriptVar x, /*Int*/ scriptVar y);
- {L"onMouseWheelUp", 2, (void*)GuiTreeScriptController::guitree_onMouseWheelUp }, // , /*Int*/ scriptVar clicked, /*Int*/ scriptVar lines);
- {L"onMouseWheelDown", 2, (void*)GuiTreeScriptController::guitree_onMouseWheelDown }, // , /*Int*/ scriptVar clicked, /*Int*/ scriptVar lines);
- {L"onContextMenu", 2, (void*)GuiTreeScriptController::guitree_onContextMenu }, // , /*Int*/ scriptVar x, /*Int*/ scriptVar y);
- {L"onChar", 1, (void*)GuiTreeScriptController::guitree_onChar }, // , /*Int*/ scriptVar c);
- {L"onKeyDown", 1, (void*)GuiTreeScriptController::guitree_onKeyDown }, // , /*Int*/ scriptVar keycode);
- {L"onItemRecvDrop", 1, (void*)GuiTreeScriptController::guitree_onItemRecvDrop }, // , /*TreeItem*/ scriptVar item);
- {L"onLabelChange", 1, (void*)GuiTreeScriptController::guitree_onLabelChange }, // , /*TreeItem*/ scriptVar item);
- {L"onItemSelected", 1, (void*)GuiTreeScriptController::guitree_onItemSelected }, // , /*TreeItem*/ scriptVar item);
- {L"onItemDeselected", 1, (void*)GuiTreeScriptController::guitree_onItemDeselected }, // , /*TreeItem*/ scriptVar item);
- {L"onKillFocus", 0, (void*)GuiTreeScriptController::guitree_onKillFocus }, // );
- {L"jumpToNext", 1, (void*)GuiTreeScriptController::guitree_jumpToNext }, // , /*Int*/ scriptVar c);
- {L"ensureItemVisible", 1, (void*)GuiTreeScriptController::guitree_ensureItemVisible }, // , /*TreeItem*/ scriptVar item);
- {L"getContentsWidth", 0, (void*)GuiTreeScriptController::guitree_getContentsWidth }, // );
- {L"getContentsHeight", 0, (void*)GuiTreeScriptController::guitree_getContentsHeight }, // );
- {L"addTreeItem", 4, (void*)GuiTreeScriptController::guitree_addTreeItem }, // , /*TreeItem*/ scriptVar item, /*TreeItem*/ scriptVar par, /*Int*/ scriptVar sorted, /*Int*/ scriptVar haschildtab);
- {L"removeTreeItem", 1, (void*)GuiTreeScriptController::guitree_removeTreeItem }, // , /*TreeItem*/ scriptVar item);
- {L"moveTreeItem", 2, (void*)GuiTreeScriptController::guitree_moveTreeItem }, // , /*TreeItem*/ scriptVar item, /*TreeItem*/ scriptVar newparent);
- {L"deleteAllItems", 0, (void*)GuiTreeScriptController::guitree_deleteAllItems }, // );
- {L"expandItem", 1, (void*)GuiTreeScriptController::guitree_expandItem }, // , /*TreeItem*/ scriptVar item);
- {L"expandItemDeferred", 1, (void*)GuiTreeScriptController::guitree_expandItemDeferred }, // , /*TreeItem*/ scriptVar item);
- {L"collapseItem", 1, (void*)GuiTreeScriptController::guitree_collapseItem }, // , /*TreeItem*/ scriptVar item);
- {L"collapseItemDeferred", 1, (void*)GuiTreeScriptController::guitree_collapseItemDeferred }, // , /*TreeItem*/ scriptVar item);
- {L"selectItem", 1, (void*)GuiTreeScriptController::guitree_selectItem }, // , /*TreeItem*/ scriptVar item);
- {L"selectItemDeferred", 1, (void*)GuiTreeScriptController::guitree_selectItemDeferred }, // , /*TreeItem*/ scriptVar item);
- {L"delItemDeferred", 1, (void*)GuiTreeScriptController::guitree_delItemDeferred }, // , /*TreeItem*/ scriptVar item);
- {L"hiliteItem", 1, (void*)GuiTreeScriptController::guitree_hiliteItem }, // , /*TreeItem*/ scriptVar item);
- {L"unhiliteItem", 1, (void*)GuiTreeScriptController::guitree_unhiliteItem }, // , /*TreeItem*/ scriptVar item);
- {L"getCurItem", 0, (void*)GuiTreeScriptController::guitree_getCurItem }, // );
- {L"hitTest", 2, (void*)GuiTreeScriptController::guitree_hitTest }, // , /*Int*/ scriptVar x, /*Int*/ scriptVar y);
- {L"editItemLabel", 1, (void*)GuiTreeScriptController::guitree_editItemLabel }, // , /*TreeItem*/ scriptVar item);
- {L"cancelEditLabel", 1, (void*)GuiTreeScriptController::guitree_cancelEditLabel }, // , /*Int*/ scriptVar destroyit);
- {L"setAutoEdit", 1, (void*)GuiTreeScriptController::guitree_setAutoEdit }, // , /*Int*/ scriptVar ae);
- {L"getAutoEdit", 0, (void*)GuiTreeScriptController::guitree_getAutoEdit }, // );
- {L"getByLabel", 2, (void*)GuiTreeScriptController::guitree_getByLabel }, // , /*TreeItem*/ scriptVar item, /*String*/ scriptVar name);
- {L"setSorted", 1, (void*)GuiTreeScriptController::guitree_setSorted }, // , /*Int*/ scriptVar dosort);
- {L"getSorted", 0, (void*)GuiTreeScriptController::guitree_getSorted }, // );
- {L"sortTreeItems", 0, (void*)GuiTreeScriptController::guitree_sortTreeItems }, // );
- {L"getSibling", 1, (void*)GuiTreeScriptController::guitree_getSibling }, // , /*TreeItem*/ scriptVar item);
- {L"setAutoCollapse", 1, (void*)GuiTreeScriptController::guitree_setAutoCollapse }, // , /*Int*/ scriptVar doautocollapse);
- {L"setFontSize", 1, (void*)GuiTreeScriptController::guitree_setFontSize }, // , /*Int*/ scriptVar newsize);
- {L"getFontSize", 0, (void*)GuiTreeScriptController::guitree_getFontSize }, // );
- {L"getNumVisibleChildItems", 1, (void*)GuiTreeScriptController::guitree_getNumVisibleChildItems }, // , /*TreeItem*/ scriptVar c);
- {L"getNumVisibleItems", 0, (void*)GuiTreeScriptController::guitree_getNumVisibleItems }, // );
- {L"enumVisibleItems", 1, (void*)GuiTreeScriptController::guitree_enumVisibleItems }, // , /*Int*/ scriptVar n);
- {L"enumVisibleChildItems", 2, (void*)GuiTreeScriptController::guitree_enumVisibleChildItems }, // , /*TreeItem*/ scriptVar c, /*Int*/ scriptVar n);
- {L"enumAllItems", 1, (void*)GuiTreeScriptController::guitree_enumAllItems }, // , /*Int*/ scriptVar n);
- {L"getItemRectX", 1, (void*)GuiTreeScriptController::guitree_getItemRectX }, // , /*TreeItem*/ scriptVar item);
- {L"getItemRectY", 1, (void*)GuiTreeScriptController::guitree_getItemRectY }, // , /*TreeItem*/ scriptVar item);
- {L"getItemRectW", 1, (void*)GuiTreeScriptController::guitree_getItemRectW }, // , /*TreeItem*/ scriptVar item);
- {L"getItemRectH", 1, (void*)GuiTreeScriptController::guitree_getItemRectH }, // , /*TreeItem*/ scriptVar item);
- // {L"getItemFromPoint", 2, (void*)GuiTreeScriptController::guitree_getItemFromPoint }, // , /*Int*/ scriptVar x, /*Int*/ scriptVar y);
- };
- ScriptObject *GuiTreeScriptController::instantiate()
- {
- ScriptTree *sp = new ScriptTree;
- ASSERT(sp != NULL);
- return sp->getScriptObject();
- }
- void GuiTreeScriptController::destroy(ScriptObject *o)
- {
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- ASSERT(sp != NULL);
- delete sp;
- }
- void *GuiTreeScriptController::encapsulate(ScriptObject *o)
- {
- return NULL; // no encapsulation for guitrees yet
- }
- void GuiTreeScriptController::deencapsulate(void *o)
- {}
- int GuiTreeScriptController::getNumFunctions()
- {
- return sizeof(exportedFunction) / sizeof(function_descriptor_struct);
- }
- const function_descriptor_struct *GuiTreeScriptController::getExportedFunctions()
- {
- return exportedFunction;
- }
- /*int*/ scriptVar GuiTreeScriptController::guitree_getNumRootItems(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree*>(o->vcpu_getInterface(guitreeGuid));
- int a = 0;
- if (sp != NULL)
- {
- a = sp->getNumRootItems();
- }
- return MAKE_SCRIPT_INT(a);
- }
- /*TreeItem*/ scriptVar GuiTreeScriptController::guitree_enumRootItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar which)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree*>(o->vcpu_getInterface(guitreeGuid));
- scriptVar retval = MAKE_SCRIPT_OBJECT(NULL);
- if (sp != NULL)
- {
- TreeItem *a = NULL;
- int _which = GET_SCRIPT_INT(which);
- a = sp->enumRootItem(_which);
- if (a != NULL)
- {
- ScriptTreeItem *item = sp->bindScriptTreeItem(a);
- if (item != NULL)
- {
- retval = MAKE_SCRIPT_OBJECT(item->getScriptObject());
- }
- }
- }
- return retval;
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_onLeftButtonDown(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*Int*/ scriptVar x, /*Int*/ scriptVar y)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS2(o, guiTreeController, x, y);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT2(o, x, y);
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_onLeftButtonUp(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*Int*/ scriptVar x, /*Int*/ scriptVar y)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS2(o, guiTreeController, x, y);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT2(o, x, y);
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_onRightButtonUp(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*Int*/ scriptVar x, /*Int*/ scriptVar y)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS2(o, guiTreeController, x, y);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT2(o, x, y);
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_onMouseMove(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*Int*/ scriptVar x, /*Int*/ scriptVar y)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS2(o, guiTreeController, x, y);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT2(o, x, y);
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_wantAutoContextMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS0(o, guiTreeController);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT0(o);
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_onLeftButtonDblClk(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*Int*/ scriptVar x, /*Int*/ scriptVar y)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS2(o, guiTreeController, x, y);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT2(o, x, y);
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_onRightButtonDblClk(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*Int*/ scriptVar x, /*Int*/ scriptVar y)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS2(o, guiTreeController, x, y);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT2(o, x, y);
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_onMouseWheelUp(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*Int*/ scriptVar clicked, /*Int*/ scriptVar lines)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS2(o, guiTreeController, clicked, lines);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT2(o, clicked, lines);
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_onMouseWheelDown(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*Int*/ scriptVar clicked, /*Int*/ scriptVar lines)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS2(o, guiTreeController, clicked, lines);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT2(o, clicked, lines);
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_onContextMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*Int*/ scriptVar x, /*Int*/ scriptVar y)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS2(o, guiTreeController, x, y);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT2(o, x, y);
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_onChar(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*Int*/ scriptVar c)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS1(o, guiTreeController, c);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT1(o, c);
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_onKeyDown(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*Int*/ scriptVar keycode)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS1(o, guiTreeController, keycode);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT1(o, keycode);
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_onItemRecvDrop(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*TreeItem*/ scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS1(o, guiTreeController, item);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT1(o, item);
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_onLabelChange(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*TreeItem*/ scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS1(o, guiTreeController, item);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT1(o, item);
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_onItemSelected(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*TreeItem*/ scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS1(o, guiTreeController, item);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT1(o, item);
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_onItemDeselected(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*TreeItem*/ scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS1(o, guiTreeController, item);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT1(o, item);
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_onKillFocus(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS0(o, guiTreeController);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT0(o);
- }
- // -------------------------------------------------------------------------
- /*Void*/ scriptVar GuiTreeScriptController::guitree_jumpToNext(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar c)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- int _c = GET_SCRIPT_INT(c);
- if (sp != NULL)
- {
- sp->jumpToNext(_c);
- }
- RETURN_SCRIPT_VOID;
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_ensureItemVisible(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- if (sp != NULL)
- {
- sp->ensureItemVisible(_item);
- }
- RETURN_SCRIPT_VOID;
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_getContentsWidth(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- scriptVar retval = MAKE_SCRIPT_INT(0);
- if (sp != NULL)
- {
- int a = 0;
- a = sp->getContentsWidth();
- retval = MAKE_SCRIPT_INT(a);
- }
- return retval;
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_getContentsHeight(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- scriptVar retval = MAKE_SCRIPT_INT(0);
- if (sp != NULL)
- {
- int a = 0;
- a = sp->getContentsHeight();
- retval = MAKE_SCRIPT_INT(a);
- }
- return retval;
- }
- /*TreeItem*/ scriptVar GuiTreeScriptController::guitree_addTreeItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item, scriptVar par, scriptVar sorted, scriptVar haschildtab)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_par = NULL;
- ScriptObject *so_par = GET_SCRIPT_OBJECT(par);
- if (so_par)
- {
- ScriptTreeItem *sti_par = static_cast<ScriptTreeItem *>(so_par->vcpu_getInterface(treeitemGuid));
- if (sti_par)
- {
- _par = sti_par->getItem();
- }
- }
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- int _haschildtab = GET_SCRIPT_INT(haschildtab);
- int _sorted = GET_SCRIPT_INT(sorted);
- scriptVar retval = MAKE_SCRIPT_OBJECT(NULL);
- if (sp != NULL)
- {
- TreeItem *a = NULL;
- a = sp->addTreeItem(_item, _par, _sorted, _haschildtab);
- if (a != NULL)
- {
- ScriptTreeItem *item = sp->bindScriptTreeItem(a);
- if (item != NULL)
- {
- retval = MAKE_SCRIPT_OBJECT(item->getScriptObject());
- }
- }
- }
- return retval;
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_removeTreeItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- scriptVar retval = MAKE_SCRIPT_INT(0);
- if (sp != NULL)
- {
- int a = 0;
- a = sp->removeTreeItem(_item);
- retval = MAKE_SCRIPT_INT(a);
- }
- return retval;
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_moveTreeItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item, scriptVar newparent)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_newparent = NULL;
- ScriptObject *so_newparent = GET_SCRIPT_OBJECT(newparent);
- if (so_newparent)
- {
- ScriptTreeItem *sti_newparent = static_cast<ScriptTreeItem *>(so_newparent->vcpu_getInterface(treeitemGuid));
- if (sti_newparent)
- {
- _newparent = sti_newparent->getItem();
- }
- }
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- if (sp != NULL)
- {
- sp->moveTreeItem(_item, _newparent);
- }
- RETURN_SCRIPT_VOID;
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_deleteAllItems(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- if (sp != NULL)
- {
- sp->deleteAllItems();
- }
- RETURN_SCRIPT_VOID;
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_expandItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- scriptVar retval = MAKE_SCRIPT_INT(0);
- if (sp != NULL)
- {
- int a = 0;
- a = sp->expandItem(_item);
- retval = MAKE_SCRIPT_INT(a);
- }
- return retval;
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_expandItemDeferred(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- if (sp != NULL)
- {
- sp->expandItemDeferred(_item);
- }
- RETURN_SCRIPT_VOID;
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_collapseItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- scriptVar retval = MAKE_SCRIPT_INT(0);
- if (sp != NULL)
- {
- int a = 0;
- a = sp->collapseItem(_item);
- retval = MAKE_SCRIPT_INT(a);
- }
- return retval;
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_collapseItemDeferred(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- if (sp != NULL)
- {
- sp->collapseItemDeferred(_item);
- }
- RETURN_SCRIPT_VOID;
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_selectItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- if (sp != NULL)
- {
- sp->selectItem(_item);
- }
- RETURN_SCRIPT_VOID;
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_selectItemDeferred(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- if (sp != NULL)
- {
- sp->selectItemDeferred(_item);
- }
- RETURN_SCRIPT_VOID;
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_delItemDeferred(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- if (sp != NULL)
- {
- sp->delItemDeferred(_item);
- }
- RETURN_SCRIPT_VOID;
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_hiliteItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- if (sp != NULL)
- {
- sp->hiliteItem(_item);
- }
- RETURN_SCRIPT_VOID;
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_unhiliteItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- if (sp != NULL)
- {
- sp->unhiliteItem(_item);
- }
- RETURN_SCRIPT_VOID;
- }
- /*TreeItem*/ scriptVar GuiTreeScriptController::guitree_getCurItem(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- scriptVar retval = MAKE_SCRIPT_OBJECT(NULL);
- if (sp != NULL)
- {
- TreeItem *a = NULL;
- a = sp->getCurItem();
- if (a != NULL)
- {
- ScriptTreeItem *item = sp->bindScriptTreeItem(a);
- if (item != NULL)
- {
- retval = MAKE_SCRIPT_OBJECT(item->getScriptObject());
- }
- }
- }
- return retval;
- }
- /*TreeItem*/ scriptVar GuiTreeScriptController::guitree_hitTest(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar x, scriptVar y)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- int _y = GET_SCRIPT_INT(y);
- int _x = GET_SCRIPT_INT(x);
- scriptVar retval = MAKE_SCRIPT_OBJECT(NULL);
- if (sp != NULL)
- {
- TreeItem *a = NULL;
- a = sp->hitTest(_x, _y);
- if (a != NULL)
- {
- ScriptTreeItem *item = sp->bindScriptTreeItem(a);
- if (item != NULL)
- {
- retval = MAKE_SCRIPT_OBJECT(item->getScriptObject());
- }
- }
- }
- return retval;
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_editItemLabel(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- if (sp != NULL)
- {
- sp->editItemLabel(_item);
- }
- RETURN_SCRIPT_VOID;
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_cancelEditLabel(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar destroyit)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- int _destroyit = GET_SCRIPT_INT(destroyit);
- if (sp != NULL)
- {
- sp->cancelEditLabel(_destroyit);
- }
- RETURN_SCRIPT_VOID;
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_setAutoEdit(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar ae)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- int _ae = GET_SCRIPT_INT(ae);
- if (sp != NULL)
- {
- sp->setAutoEdit(_ae);
- }
- RETURN_SCRIPT_VOID;
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_getAutoEdit(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- scriptVar retval = MAKE_SCRIPT_INT(0);
- if (sp != NULL)
- {
- int a = 0;
- a = sp->getAutoEdit();
- retval = MAKE_SCRIPT_INT(a);
- }
- return retval;
- }
- /*TreeItem*/ scriptVar GuiTreeScriptController::guitree_getByLabel(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item, /*String*/ scriptVar name)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- StringW _name = GET_SCRIPT_STRING(name);
- scriptVar retval = MAKE_SCRIPT_OBJECT(NULL);
- if (sp != NULL)
- {
- TreeItem *a = NULL;
- a = sp->getByLabel(_item, _name);
- if (a != NULL)
- {
- ScriptTreeItem *item = sp->bindScriptTreeItem(a);
- if (item != NULL)
- {
- retval = MAKE_SCRIPT_OBJECT(item->getScriptObject());
- }
- }
- }
- return retval;
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_setSorted(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar dosort)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- int _dosort = GET_SCRIPT_INT(dosort);
- if (sp != NULL)
- {
- sp->setSorted(!!_dosort);
- }
- RETURN_SCRIPT_VOID;
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_getSorted(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- scriptVar retval = MAKE_SCRIPT_OBJECT(NULL);
- if (sp != NULL)
- {
- int a = NULL;
- a = sp->getSorted();
- retval = MAKE_SCRIPT_INT(a);
- }
- return retval;
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_sortTreeItems(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- if (sp != NULL)
- {
- sp->sortTreeItems();
- }
- RETURN_SCRIPT_VOID;
- }
- /*TreeItem*/ scriptVar GuiTreeScriptController::guitree_getSibling(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- scriptVar retval = MAKE_SCRIPT_OBJECT(NULL);
- if (sp != NULL)
- {
- TreeItem *a = NULL;
- a = sp->getSibling(_item);
- if (a != NULL)
- {
- ScriptTreeItem *item = sp->bindScriptTreeItem(a);
- if (item != NULL)
- {
- retval = MAKE_SCRIPT_OBJECT(item->getScriptObject());
- }
- }
- }
- return retval;
- }
- /*Void*/ scriptVar GuiTreeScriptController::guitree_setAutoCollapse(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar doautocollapse)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- int _doautocollapse = GET_SCRIPT_INT(doautocollapse);
- if (sp != NULL)
- {
- sp->setAutoCollapse(!!_doautocollapse);
- }
- RETURN_SCRIPT_VOID;
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_setFontSize(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar newsize)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- int _newsize = GET_SCRIPT_INT(newsize);
- scriptVar retval = MAKE_SCRIPT_INT(0);
- if (sp != NULL)
- {
- int a = 0;
- a = sp->setFontSize(_newsize);
- retval = MAKE_SCRIPT_INT(a);
- }
- return retval;
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_getFontSize(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- scriptVar retval = MAKE_SCRIPT_INT(0);
- if (sp != NULL)
- {
- int a = 0;
- a = sp->getFontSize();
- retval = MAKE_SCRIPT_INT(a);
- }
- return retval;
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_getNumVisibleChildItems(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar c)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_c = NULL;
- ScriptObject *so_c = GET_SCRIPT_OBJECT(c);
- if (so_c)
- {
- ScriptTreeItem *sti_c = static_cast<ScriptTreeItem *>(so_c->vcpu_getInterface(treeitemGuid));
- if (sti_c)
- {
- _c = sti_c->getItem();
- }
- }
- scriptVar retval = MAKE_SCRIPT_INT(0);
- if (sp != NULL)
- {
- int a = 0;
- a = sp->getNumVisibleChildItems(_c);
- retval = MAKE_SCRIPT_INT(a);
- }
- return retval;
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_getNumVisibleItems(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- scriptVar retval = MAKE_SCRIPT_INT(0);
- if (sp != NULL)
- {
- int a = 0;
- a = sp->getNumVisibleItems();
- retval = MAKE_SCRIPT_INT(a);
- }
- return retval;
- }
- /*TreeItem*/ scriptVar GuiTreeScriptController::guitree_enumVisibleItems(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar n)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- int _n = GET_SCRIPT_INT(n);
- scriptVar retval = MAKE_SCRIPT_OBJECT(NULL);
- if (sp != NULL)
- {
- TreeItem *a = NULL;
- a = sp->enumVisibleItems(_n);
- if (a != NULL)
- {
- ScriptTreeItem *item = sp->bindScriptTreeItem(a);
- if (item != NULL)
- {
- retval = MAKE_SCRIPT_OBJECT(item->getScriptObject());
- }
- }
- }
- return retval;
- }
- /*TreeItem*/ scriptVar GuiTreeScriptController::guitree_enumVisibleChildItems(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar c, scriptVar n)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_c = NULL;
- ScriptObject *so_c = GET_SCRIPT_OBJECT(c);
- if (so_c)
- {
- ScriptTreeItem *sti_c = static_cast<ScriptTreeItem *>(so_c->vcpu_getInterface(treeitemGuid));
- if (sti_c)
- {
- _c = sti_c->getItem();
- }
- }
- int _n = GET_SCRIPT_INT(n);
- scriptVar retval = MAKE_SCRIPT_OBJECT(NULL);
- if (sp != NULL)
- {
- TreeItem *a = NULL;
- a = sp->enumVisibleChildItems(_c, _n);
- if (a != NULL)
- {
- ScriptTreeItem *item = sp->bindScriptTreeItem(a);
- if (item != NULL)
- {
- retval = MAKE_SCRIPT_OBJECT(item->getScriptObject());
- }
- }
- }
- return retval;
- }
- /*TreeItem*/ scriptVar GuiTreeScriptController::guitree_enumAllItems(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar n)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- int _n = GET_SCRIPT_INT(n);
- scriptVar retval = MAKE_SCRIPT_OBJECT(NULL);
- if (sp != NULL)
- {
- TreeItem *a = NULL;
- a = sp->enumAllItems(_n);
- if (a != NULL)
- {
- ScriptTreeItem *item = sp->bindScriptTreeItem(a);
- if (item != NULL)
- {
- retval = MAKE_SCRIPT_OBJECT(item->getScriptObject());
- }
- }
- }
- return retval;
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_getItemRectX(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- scriptVar retval = MAKE_SCRIPT_INT(0);
- if (sp != NULL)
- {
- int a = 0;
- RECT r;
- sp->getItemRect(_item, &r);
- a = r.left;
- retval = MAKE_SCRIPT_INT(a);
- }
- return retval;
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_getItemRectY(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- scriptVar retval = MAKE_SCRIPT_INT(0);
- if (sp != NULL)
- {
- int a = 0;
- RECT r;
- sp->getItemRect(_item, &r);
- a = r.top;
- retval = MAKE_SCRIPT_INT(a);
- }
- return retval;
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_getItemRectW(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- scriptVar retval = MAKE_SCRIPT_INT(0);
- if (sp != NULL)
- {
- int a = 0;
- RECT r;
- sp->getItemRect(_item, &r);
- a = r.left - r.right;
- retval = MAKE_SCRIPT_INT(a);
- }
- return retval;
- }
- /*Int*/ scriptVar GuiTreeScriptController::guitree_getItemRectH(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- TreeItem *_item = NULL;
- ScriptObject *so_item = GET_SCRIPT_OBJECT(item);
- if (so_item)
- {
- ScriptTreeItem *sti_item = static_cast<ScriptTreeItem *>(so_item->vcpu_getInterface(treeitemGuid));
- if (sti_item)
- {
- _item = sti_item->getItem();
- }
- }
- scriptVar retval = MAKE_SCRIPT_INT(0);
- if (sp != NULL)
- {
- int a = 0;
- RECT r;
- sp->getItemRect(_item, &r);
- a = r.bottom - r.top;
- retval = MAKE_SCRIPT_INT(a);
- }
- return retval;
- }
- #if 0 // Not implemented in TreeWnd, dammit.
- /*TreeItem*/ scriptVar GuiTreeScriptController::guitree_getItemFromPoint(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, scriptVar x, scriptVar y)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTree *sp = static_cast<ScriptTree *>(o->vcpu_getInterface(guitreeGuid));
- int _y = GET_SCRIPT_INT(y);
- int _x = GET_SCRIPT_INT(x);
- scriptVar retval = MAKE_SCRIPT_OBJECT(NULL);
- if (sp != NULL)
- {
- TreeItem *a = NULL;
- POINT p = {_x, _y};
- a = sp->getItemFromPoint(&p);
- if (a != NULL)
- {
- ScriptTreeItem *item = sp->bindScriptTreeItem(a);
- if (item != NULL)
- {
- retval = MAKE_SCRIPT_OBJECT(item->getScriptObject());
- }
- }
- }
- return retval;
- }
- #endif
- // -----------------------------------------------------------------------
- // Script Object For The Tree Item
- ScriptTreeItem::ScriptTreeItem(TreeItem *_item, ScriptTree *_tree) : item(_item), tree(_tree), SCRIPTTREEITEM_SCRIPTPARENT()
- {
- getScriptObject()->vcpu_setInterface(treeitemGuid, (void *)static_cast<ScriptTreeItem *>(this));
- getScriptObject()->vcpu_setClassName(L"TreeItem");
- getScriptObject()->vcpu_setController(treeItemController);
- }
- ScriptTreeItem::~ScriptTreeItem()
- {}
- int ScriptTreeItem::getNumChildren()
- {
- ASSERT(item);
- return item->getNumChildren();
- }
- void ScriptTreeItem::setLabel(const wchar_t *label)
- {
- ASSERT(item);
- item->setLabel(label);
- }
- const wchar_t *ScriptTreeItem::getLabel()
- {
- ASSERT(item);
- return item->getLabel();
- }
- void ScriptTreeItem::ensureVisible()
- {
- ASSERT(item);
- item->ensureVisible();
- }
- TreeItem *ScriptTreeItem::getNthChild(int nth)
- {
- ASSERT(item);
- return item->getNthChild(nth);
- }
- TreeItem *ScriptTreeItem::getChild()
- {
- ASSERT(item);
- return item->getChild();
- }
- TreeItem *ScriptTreeItem::getChildSibling(TreeItem *_item)
- {
- ASSERT(item);
- return item->getChildSibling(_item);
- }
- TreeItem *ScriptTreeItem::getSibling()
- {
- ASSERT(item);
- return item->getSibling();
- }
- TreeItem *ScriptTreeItem::getParent()
- {
- ASSERT(item);
- return item->getParent();
- }
- void ScriptTreeItem::editLabel()
- {
- ASSERT(item);
- item->editLabel();
- }
- bool ScriptTreeItem::hasSubItems()
- {
- ASSERT(item);
- return item->hasSubItems();
- }
- void ScriptTreeItem::setSorted(int issorted)
- {
- ASSERT(item);
- item->setSorted(issorted);
- }
- void ScriptTreeItem::setChildTab(int haschildtab)
- {
- ASSERT(item);
- item->setChildTab(haschildtab);
- }
- bool ScriptTreeItem::isSorted()
- {
- ASSERT(item);
- return item->isSorted();
- }
- bool ScriptTreeItem::isCollapsed()
- {
- ASSERT(item);
- return item->isCollapsed();
- }
- bool ScriptTreeItem::isExpanded()
- {
- ASSERT(item);
- return item->isExpanded();
- }
- void ScriptTreeItem::invalidate()
- {
- ASSERT(item);
- item->invalidate();
- }
- bool ScriptTreeItem::isSelected()
- {
- ASSERT(item);
- return item->isSelected();
- }
- bool ScriptTreeItem::isHilited()
- {
- ASSERT(item);
- return item->isHilited();
- }
- void ScriptTreeItem::setHilited(bool ishilited)
- {
- ASSERT(item);
- item->setHilited(ishilited);
- }
- int ScriptTreeItem::collapse()
- {
- ASSERT(item);
- return item->collapse();
- }
- int ScriptTreeItem::expand()
- {
- ASSERT(item);
- return item->expand();
- }
- #if 0
- // This was never implemented!
- void ScriptTreeItem::setCurrent(bool tf)
- {
- ASSERT(item);
- item->setCurrent(tf);
- }
- #endif
- TreeWnd *ScriptTreeItem::getTree()
- {
- ASSERT(item);
- return item->getTree();
- }
- // -----------------------------------------------------------------------
- // Script Controller For The Tree Item
- TreeItemScriptController _treeItemController;
- TreeItemScriptController *treeItemController = &_treeItemController;
- // -- Functions table -------------------------------------
- function_descriptor_struct TreeItemScriptController::exportedFunction[] = {
- {L"getNumChildren", 0, (void*)TreeItemScriptController::treeitem_getNumChildren },
- {L"setLabel", 1, (void*)TreeItemScriptController::treeitem_setLabel },
- {L"getLabel", 0, (void*)TreeItemScriptController::treeitem_getLabel },
- {L"ensureVisible", 0, (void*)TreeItemScriptController::treeitem_ensureVisible },
- {L"getNthChild", 1, (void*)TreeItemScriptController::treeitem_getNthChild },
- {L"getChild", 0, (void*)TreeItemScriptController::treeitem_getChild },
- {L"getChildSibling", 1, (void*)TreeItemScriptController::treeitem_getChildSibling },
- {L"getSibling", 0, (void*)TreeItemScriptController::treeitem_getSibling },
- {L"getParent", 0, (void*)TreeItemScriptController::treeitem_getParent },
- {L"editLabel", 0, (void*)TreeItemScriptController::treeitem_editLabel },
- {L"hasSubItems", 0, (void*)TreeItemScriptController::treeitem_hasSubItems },
- {L"setSorted", 1, (void*)TreeItemScriptController::treeitem_setSorted },
- {L"setChildTab", 1, (void*)TreeItemScriptController::treeitem_setChildTab },
- {L"isSorted", 0, (void*)TreeItemScriptController::treeitem_isSorted },
- {L"isCollapsed", 0, (void*)TreeItemScriptController::treeitem_isCollapsed },
- {L"isExpanded", 0, (void*)TreeItemScriptController::treeitem_isExpanded },
- {L"invalidate", 0, (void*)TreeItemScriptController::treeitem_invalidate },
- {L"isSelected", 0, (void*)TreeItemScriptController::treeitem_isSelected },
- {L"isHilited", 0, (void*)TreeItemScriptController::treeitem_isHilited },
- {L"setHilited", 1, (void*)TreeItemScriptController::treeitem_setHilited },
- {L"collapse", 0, (void*)TreeItemScriptController::treeitem_collapse },
- {L"expand", 0, (void*)TreeItemScriptController::treeitem_expand },
- {L"getTree", 0, (void*)TreeItemScriptController::treeitem_getTree },
- {L"onTreeAdd", 0, (void*)TreeItemScriptController::treeitem_onTreeAdd },
- {L"onTreeRemove", 0, (void*)TreeItemScriptController::treeitem_onTreeRemove },
- {L"onSelect", 0, (void*)TreeItemScriptController::treeitem_onSelect },
- {L"onDeselect", 0, (void*)TreeItemScriptController::treeitem_onDeselect },
- {L"onLeftDoubleClick", 0, (void*)TreeItemScriptController::treeitem_onLeftDoubleClick },
- {L"onRightDoubleClick", 0, (void*)TreeItemScriptController::treeitem_onRightDoubleClick },
- {L"onChar", 1, (void*)TreeItemScriptController::treeitem_onChar },
- {L"onExpand", 0, (void*)TreeItemScriptController::treeitem_onExpand },
- {L"onCollapse", 0, (void*)TreeItemScriptController::treeitem_onCollapse },
- {L"onBeginLabelEdit", 0, (void*)TreeItemScriptController::treeitem_onBeginLabelEdit },
- {L"onEndLabelEdit", 1, (void*)TreeItemScriptController::treeitem_onEndLabelEdit },
- {L"onContextMenu", 2, (void*)TreeItemScriptController::treeitem_onContextMenu },
- };
- StringW TreeItemScriptController::staticStr;
- ScriptTreeMap TreeItemScriptController::g_scriptitems;
- ScriptObject *TreeItemScriptController::instantiate()
- {
- ScriptTreeItem *sp = new ScriptTreeItem;
- ASSERT(sp != NULL);
- TreeItem *child_item = new TreeItemScript(L"", sp);
- ASSERT(child_item != NULL);
- sp->setItem(child_item);
- TISC::g_scriptitems.insert({ child_item, sp });
- // We're not attached to a tree. that's okay!
- return sp->getScriptObject();
- }
- // If the script asks to delete the item, delete the internal item as well.
- // We tell the owning ScriptTree to remove this object.
- void TreeItemScriptController::destroy(ScriptObject *o)
- {
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- ASSERT(sp != NULL);
- if (!sp->destroyScriptTreeItem())
- {
- auto item = sp->getItem();
- // Ask the owner tree to do it for us, but if not owned, we do it ourselves.
- if (item)
- {
- //TISC::g_scriptitems.delItem(sp->getItem());
- auto it = TISC::g_scriptitems.find(item);
- if (TISC::g_scriptitems.end() != it)
- {
- TISC::g_scriptitems.erase(it);
- }
- }
- // AND we delete our item, since we're not a part of a tree that will do it for us.
- delete item;
- delete sp;
- }
- }
- void *TreeItemScriptController::encapsulate(ScriptObject *o)
- {
- return NULL; // no encapsulation for guitrees yet
- }
- void TreeItemScriptController::deencapsulate(void *o)
- {}
- int TreeItemScriptController::getNumFunctions()
- {
- return sizeof(exportedFunction) / sizeof(function_descriptor_struct);
- }
- const function_descriptor_struct *TreeItemScriptController::getExportedFunctions()
- {
- return exportedFunction;
- }
- /*int*/ scriptVar TreeItemScriptController::treeitem_getNumChildren(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- int a = 0;
- if (sp != NULL)
- {
- a = sp->getNumChildren();
- }
- return MAKE_SCRIPT_INT(a);
- }
- /*void*/ scriptVar TreeItemScriptController::treeitem_setLabel(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*String*/ scriptVar label)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- StringW _label = GET_SCRIPT_STRING(label);
- if (sp != NULL)
- {
- sp->setLabel(_label);
- }
- RETURN_SCRIPT_VOID;
- }
- /*String*/ scriptVar TreeItemScriptController::treeitem_getLabel(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- if (sp != NULL)
- {
- staticStr = sp->getLabel();
- }
- return MAKE_SCRIPT_STRING(staticStr);
- }
- /*void*/ scriptVar TreeItemScriptController::treeitem_ensureVisible(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- if (sp != NULL)
- {
- sp->ensureVisible();
- }
- RETURN_SCRIPT_VOID;
- }
- /*TreeItem*/ scriptVar TreeItemScriptController::treeitem_getNthChild(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar nth)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- int _nth = GET_SCRIPT_INT(nth);
- TreeItem *a = NULL;
- if (sp != NULL)
- {
- a = sp->getNthChild(_nth);
- }
- ScriptTree *tree = sp->getScriptTree();
- ScriptTreeItem *retval = NULL;
- if (tree && a)
- {
- retval = tree->bindScriptTreeItem(a);
- }
- if (retval)
- {
- return MAKE_SCRIPT_OBJECT(retval->getScriptObject());
- }
- return MAKE_SCRIPT_OBJECT(NULL); // Return NULL
- }
- /*TreeItem*/ scriptVar TreeItemScriptController::treeitem_getChild(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- TreeItem *a = NULL;
- if (sp != NULL)
- {
- a = sp->getChild();
- }
- ScriptTree *tree = sp->getScriptTree();
- ScriptTreeItem *retval = NULL;
- if (tree && a)
- {
- retval = tree->bindScriptTreeItem(a);
- }
- if (retval)
- {
- return MAKE_SCRIPT_OBJECT(retval->getScriptObject());
- }
- return MAKE_SCRIPT_OBJECT(NULL); // Return NULL
- }
- /*TreeItem*/ scriptVar TreeItemScriptController::treeitem_getChildSibling(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*TreeItem*/ scriptVar _item)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- TreeItem *__item = NULL;
- ScriptObject *io = GET_SCRIPT_OBJECT(_item);
- if (io)
- {
- ScriptTreeItem *sio = static_cast<ScriptTreeItem *>(io->vcpu_getInterface(treeitemGuid));
- if (sio)
- {
- __item = sio->getItem();
- }
- }
- TreeItem *a = NULL;
- if (sp != NULL)
- {
- a = sp->getChildSibling(__item);
- }
- ScriptTree *tree = sp->getScriptTree();
- ScriptTreeItem *retval = NULL;
- if (tree && a)
- {
- retval = tree->bindScriptTreeItem(a);
- }
- if (retval)
- {
- return MAKE_SCRIPT_OBJECT(retval->getScriptObject());
- }
- return MAKE_SCRIPT_OBJECT(NULL); // Return NULL
- }
- /*TreeItem*/ scriptVar TreeItemScriptController::treeitem_getSibling(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- TreeItem *a = NULL;
- if (sp != NULL)
- {
- a = sp->getSibling();
- }
- ScriptTree *tree = sp->getScriptTree();
- ScriptTreeItem *retval = NULL;
- if (tree && a)
- {
- retval = tree->bindScriptTreeItem(a);
- }
- if (retval)
- {
- return MAKE_SCRIPT_OBJECT(retval->getScriptObject());
- }
- return MAKE_SCRIPT_OBJECT(NULL); // Return NULL
- }
- /*TreeItem*/ scriptVar TreeItemScriptController::treeitem_getParent(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- TreeItem *a = NULL;
- if (sp != NULL)
- {
- a = sp->getParent();
- }
- ScriptTree *tree = sp->getScriptTree();
- ScriptTreeItem *retval = NULL;
- if (tree && a)
- {
- retval = tree->bindScriptTreeItem(a);
- }
- if (retval)
- {
- return MAKE_SCRIPT_OBJECT(retval->getScriptObject());
- }
- return MAKE_SCRIPT_OBJECT(NULL); // Return NULL
- }
- /*void*/ scriptVar TreeItemScriptController::treeitem_editLabel(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- if (sp != NULL)
- {
- sp->editLabel();
- }
- RETURN_SCRIPT_VOID;
- }
- /*int*/ scriptVar TreeItemScriptController::treeitem_hasSubItems(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- int a = 0;
- if (sp != NULL)
- {
- a = sp->hasSubItems();
- }
- return MAKE_SCRIPT_INT(a);
- }
- /*void*/ scriptVar TreeItemScriptController::treeitem_setSorted(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar issorted)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- int _issorted = GET_SCRIPT_INT(issorted);
- if (sp != NULL)
- {
- sp->setSorted(_issorted);
- }
- RETURN_SCRIPT_VOID;
- }
- /*void*/ scriptVar TreeItemScriptController::treeitem_setChildTab(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar haschildtab)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- int _haschildtab = GET_SCRIPT_INT(haschildtab);
- if (sp != NULL)
- {
- sp->setChildTab(_haschildtab);
- }
- RETURN_SCRIPT_VOID;
- }
- /*int*/ scriptVar TreeItemScriptController::treeitem_isSorted(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- int a = 0;
- if (sp != NULL)
- {
- a = sp->isSorted();
- }
- return MAKE_SCRIPT_INT(a);
- }
- /*int*/ scriptVar TreeItemScriptController::treeitem_isCollapsed(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- int a = 0;
- if (sp != NULL)
- {
- a = sp->isCollapsed();
- }
- return MAKE_SCRIPT_INT(a);
- }
- /*int*/ scriptVar TreeItemScriptController::treeitem_isExpanded(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- int a = 0;
- if (sp != NULL)
- {
- a = sp->isExpanded();
- }
- return MAKE_SCRIPT_INT(a);
- }
- /*void*/ scriptVar TreeItemScriptController::treeitem_invalidate(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- if (sp != NULL)
- {
- sp->invalidate();
- }
- RETURN_SCRIPT_VOID;
- }
- /*int*/ scriptVar TreeItemScriptController::treeitem_isSelected(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- int a = 0;
- if (sp != NULL)
- {
- a = sp->isSelected();
- }
- return MAKE_SCRIPT_INT(a);
- }
- /*int*/ scriptVar TreeItemScriptController::treeitem_isHilited(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- int a = 0;
- if (sp != NULL)
- {
- a = sp->isHilited();
- }
- return MAKE_SCRIPT_INT(a);
- }
- /*void*/ scriptVar TreeItemScriptController::treeitem_setHilited(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar ishilited)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- int _ishilited = GET_SCRIPT_INT(ishilited);
- if (sp != NULL)
- {
- sp->setHilited(!!_ishilited);
- }
- RETURN_SCRIPT_VOID;
- }
- /*int*/ scriptVar TreeItemScriptController::treeitem_collapse(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- int a = 0;
- if (sp != NULL)
- {
- a = sp->collapse();
- }
- return MAKE_SCRIPT_INT(a);
- }
- /*int*/ scriptVar TreeItemScriptController::treeitem_expand(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- int a = 0;
- if (sp != NULL)
- {
- a = sp->expand();
- }
- return MAKE_SCRIPT_INT(a);
- }
- #if 0
- // This was never implemented!
- /*void*/ scriptVar TreeItemScriptController::treeitem_setCurrent(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar tf)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- int _tf = GET_SCRIPT_INT(tf);
- if (sp != NULL)
- {
- sp->setCurrent(_tf);
- }
- RETURN_SCRIPT_VOID;
- }
- #endif
- /*GuiTree*/ scriptVar TreeItemScriptController::treeitem_getTree(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- ScriptTreeItem *sp = static_cast<ScriptTreeItem *>(o->vcpu_getInterface(treeitemGuid));
- ScriptTree *a = NULL;
- ScriptObject *retval = NULL;
- if (sp != NULL)
- {
- a = sp->getScriptTree();
- }
- if (a)
- {
- retval = a->getScriptObject();
- }
- return MAKE_SCRIPT_OBJECT(retval);
- }
- /*void*/ scriptVar TreeItemScriptController::treeitem_onTreeAdd(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS0(o, guiTreeController);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT0(o);
- }
- /*void*/ scriptVar TreeItemScriptController::treeitem_onTreeRemove(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS0(o, guiTreeController);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT0(o);
- }
- /*void*/ scriptVar TreeItemScriptController::treeitem_onSelect(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS0(o, guiTreeController);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT0(o);
- }
- /*void*/ scriptVar TreeItemScriptController::treeitem_onDeselect(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS0(o, guiTreeController);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT0(o);
- }
- /*int*/ scriptVar TreeItemScriptController::treeitem_onLeftDoubleClick(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS0(o, guiTreeController);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT0(o);
- }
- /*int*/ scriptVar TreeItemScriptController::treeitem_onRightDoubleClick(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS0(o, guiTreeController);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT0(o);
- }
- /*int*/ scriptVar TreeItemScriptController::treeitem_onChar(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar _key)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS1(o, guiTreeController, _key);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT1(o, _key);
- }
- /*void*/ scriptVar TreeItemScriptController::treeitem_onExpand(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS0(o, guiTreeController);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT0(o);
- }
- /*void*/ scriptVar TreeItemScriptController::treeitem_onCollapse(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS0(o, guiTreeController);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT0(o);
- }
- /*int*/ scriptVar TreeItemScriptController::treeitem_onBeginLabelEdit(SCRIPT_FUNCTION_PARAMS, ScriptObject *o)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS0(o, guiTreeController);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT0(o);
- }
- /*int*/ scriptVar TreeItemScriptController::treeitem_onEndLabelEdit(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*String*/ scriptVar _newlabel)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS1(o, guiTreeController, _newlabel);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT1(o, _newlabel);
- }
- /*int*/ scriptVar TreeItemScriptController::treeitem_onContextMenu(SCRIPT_FUNCTION_PARAMS, ScriptObject *o, /*int*/ scriptVar _x, /*int*/ scriptVar _y)
- {
- SCRIPT_FUNCTION_INIT
- PROCESS_HOOKS2(o, guiTreeController, _x, _y);
- SCRIPT_FUNCTION_CHECKABORTEVENT;
- SCRIPT_EXEC_EVENT2(o, _x, _y);
- }
|