| 481 | } |
| 482 | |
| 483 | void PiuApplication_create(xsMachine* the) |
| 484 | { |
| 485 | PiuApplication* self; |
| 486 | xsIntegerValue c, i; |
| 487 | xsVars(5); |
| 488 | |
| 489 | if (!xsFindInteger(xsArg(1), xsID_touchCount, &c)) |
| 490 | c = 1; |
| 491 | int size = sizeof(PiuApplicationRecord) + ((c - 1) * sizeof(PiuTouchLink*)); |
| 492 | xsSetHostChunk(xsThis, NULL, size); |
| 493 | self = PIU(Application, xsThis); |
| 494 | xsSetContext(the, self); |
| 495 | (*self)->the = the; |
| 496 | (*self)->reference = xsToReference(xsThis); |
| 497 | xsSetHostHooks(xsThis, (xsHostHooks*)&PiuApplicationHooks); |
| 498 | (*self)->dispatch = (PiuDispatch)&PiuApplicationDispatchRecord; |
| 499 | (*self)->recordSize = PiuRecordSize(size); |
| 500 | (*self)->flags = piuVisible | piuContainer | piuDisplaying; |
| 501 | if (!xsFindResult(xsArg(1), xsID__DeferLink)) |
| 502 | xsErrorPrintf("no DeferLink"); |
| 503 | (*self)->DeferLink = xsResult; |
| 504 | if (!xsFindResult(xsArg(1), xsID__Skin)) |
| 505 | xsErrorPrintf("no Skin"); |
| 506 | (*self)->Skin = xsResult; |
| 507 | if (!xsFindResult(xsArg(1), xsID__Style)) |
| 508 | xsErrorPrintf("no Style"); |
| 509 | (*self)->Style = xsResult; |
| 510 | if (!xsFindResult(xsArg(1), xsID__Texture)) |
| 511 | xsErrorPrintf("no Texture"); |
| 512 | (*self)->Texture = xsResult; |
| 513 | |
| 514 | PiuStyleLinkNew(the); |
| 515 | (*self)->styleList = PIU(StyleLink, xsResult); |
| 516 | |
| 517 | if (!xsFindResult(xsArg(1), xsID__TouchLink)) |
| 518 | xsErrorPrintf("no TouchLink"); |
| 519 | xsVar(0) = xsResult; |
| 520 | (*self)->touchLinkCount = c; |
| 521 | for (i = 0; i < c; i++) { |
| 522 | xsResult = xsNewFunction0(xsVar(0)); |
| 523 | (*self)->touchLinks[i] = PIU(TouchLink, xsResult); |
| 524 | } |
| 525 | |
| 526 | (*self)->application = self; |
| 527 | (*self)->focus = (PiuContent*)self; |
| 528 | |
| 529 | if (!xsFindResult(xsArg(1), xsID__View)) |
| 530 | xsErrorPrintf("no View"); |
| 531 | xsNewFunction2(xsResult, xsThis, xsArg(1)); |
| 532 | |
| 533 | PiuContentDictionary(the, self); |
| 534 | PiuContainerDictionary(the, self); |
| 535 | PiuViewDictionary(the, self); |
| 536 | PiuBehaviorOnCreate(self); |
| 537 | PiuApplicationResize(self); |
| 538 | } |
| 539 | |
| 540 | #ifdef piuPC |
nothing calls this directly
no test coverage detected