Object <- Viewable <- Form |
|
|
AttachToCard CanAccept CanAcceptCoupon DetachFromCard Draw DrawCardBackground |
Erase ExtendBottomBy Finalize SetContentSize UpdateFormItems Validate |
|
CanExtendBottom FormItems HasErasablePiece OpaqueBox RelativeOrigin |
| Field | Type | |
|---|---|---|
| Viewable: | superview: | Viewable |
| relativeOrigin: | Dot | |
| contentSize: | Dot | |
| viewFlags: | Flags | |
| labelStyle: | TextStyle | |
| color: | Unsigned | |
| altColor: | Unsigned | |
| shadow: | Shadow | |
| sound: | Playable | |
| HasBorder: | border: | Border |
| Form: | image: | Image |
| formItems: | ObjectList |
instance Form tag; relativeOrigin: <0.0,0.0>; contentSize: <0.0,0.0>; viewFlags: 0x00000000; labelStyle: nilObject; color: 0; altColor: 0; shadow: nilObject; sound: nilObject; border: nilObject; image: nilObject; formItems: nilObject; end instance;
Define Class Form; inherits from Viewable, HasBorder; has dispatcher hintdata; shares members; field image: Image, getter, sharedSetter; // get/set the image that is drawn as the background of the form // if present, the image is drawn at the origin of the card and form // rarely override field formItems: ObjectList, getter, setter; // form items and card data attribute FormItems: ObjectList; // get/set to get the list of items that this form saves data for // the data for all these items is stored on each card that uses the form // rarely override operation UpdateFormItems(): ObjectList; // called by card to make list of form items match current reality // rarely override operation AttachToCard(card: Card); // called by card when card is being set up after setting up all form items // does nothing in this class // sometimes override to set up things other than form items // better than AboutToShow because it works for printing as well as on-screen operation DetachFromCard(card: Card); // called by card when card is giving up the form, after putting form item data into card // does nothing in this class // sometimes override to return things to steady state and balance out AttachToCard // better than AboutToHide because it works for printing as well as on-screen // common appearance of cards with this form operation DrawCardBackground(), noFail; // called by card to draw the form's contribution the card background // the card itself draws nothing, and the form draws nothing in the Draw method // sometimes override to make form subclasses that draw // contents and appearance overrides CanAccept; // override so new items never drop into the form overrides CanAcceptCoupon; // override so no coupons are accepted overrides CanExtendBottom; // returns true overrides ExtendBottomBy; // override so the form will be resized when the card is overrides Draw; // override to draw nothing overrides Erase; // override to delete the text of all the background fields overrides Finalize; // override to not dirty the form when it is destroyed, since the form is invisible overrides HasErasablePiece; // returns false so the form is not erased by a tap on an "erase" button overrides OpaqueBox; // override to say the form is not opaque at all overrides SetContentSize, SetRelativeOrigin; // override to not dirty the form, since the card dirties when it changes size // debugging #ifdef VALIDATE overrides Validate; // called by validate framework // checks that relative origin is 0,0 // checks that content box matches card content box if it is installed in a card // checks that the form items list is correct #endif end class;