MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / PiuApplicationCanMenu

Function PiuApplicationCanMenu

modules/piu/All/piuApplication.c:544–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

542static void PiuApplicationFindMenu(PiuApplication* self, xsIntegerValue id);
543
544xsIntegerValue PiuApplicationCanMenu(PiuApplication* self, xsIntegerValue id)
545{
546 xsMachine* the = (*self)->the;
547 xsIntegerValue result = 0;
548 PiuApplicationFindMenu(self, id);
549 if (xsTest(xsVar(2))) {
550 xsIdentifier canID = (xsIdentifier)xsToInteger(xsGet(xsVar(2), xsID_canID));
551 PiuContent* content = (*self)->focus;
552 while (content) {
553 if ((*content)->behavior) {
554 xsVar(0) = xsReference((*content)->behavior);
555 if (xsFindResult(xsVar(0), canID)) {
556 xsVar(1) = xsReference((*content)->reference);
557 xsVar(3) = xsCallFunction2(xsResult, xsVar(0), xsVar(1), xsVar(2));
558 if (xsTest(xsVar(3)))
559 result |= piuMenuEnabled;
560 break;
561 }
562 }
563 content = (PiuContent*)(*content)->container;
564 }
565 xsVar(3) = xsGet(xsVar(2), xsID_check);
566 if (xsTest(xsVar(3)))
567 result |= piuMenuChecked;
568 xsVar(3) = xsGet(xsVar(2), xsID_titles);
569 if (xsTest(xsVar(3))) {
570 xsVar(0) = xsGet(xsVar(2), xsID_state);
571 xsVar(1) = xsGetAt(xsVar(3), xsVar(0));
572 xsSet(xsVar(2), xsID_title, xsVar(1));
573 result |= piuMenuTitled;
574 }
575 xsResult = xsVar(2);
576 }
577 return result;
578}
579
580void PiuApplicationDoMenu(PiuApplication* self, xsIntegerValue id)
581{

Callers 1

PiuWindowProcFunction · 0.85

Calls 1

PiuApplicationFindMenuFunction · 0.85

Tested by

no test coverage detected