Object <- Viewable <- Card |
|
| Field | Type | |
|---|---|---|
| Viewable: | superview: | Viewable |
| relativeOrigin: | Dot | |
| contentSize: | Dot | |
| viewFlags: | Flags | |
| labelStyle: | TextStyle | |
| color: | Unsigned | |
| altColor: | Unsigned | |
| shadow: | Shadow | |
| sound: | Playable | |
| Card: | prototypeForm: | Form |
| stack: | StackOfCards | |
| noEnvelope: | Boolean | |
| sentFlag: | Boolean | |
| isEnvelope: | Boolean | |
| isStationery: | Boolean | |
| substitute: | Boolean | |
| suppressCardData: | Boolean | |
| autoAddress: | Boolean | |
| wasSeen: | Boolean | |
| autoPencil: | Boolean | |
| noAutoKeyboard: | Boolean | |
| tempTOCEntry: | Boolean | |
| rightPageEntry: | Boolean | |
| noDrawing: | Boolean | |
| dontPurge: | Boolean | |
| locked: | Boolean | |
| isConfirmed: | Boolean | |
| shrinkToFit: | Boolean | |
| noFileAfterSend: | Boolean | |
| noSubstituteCard: | Boolean | |
| isReadOnly: | Boolean | |
| dontAppearInLog: | Boolean | |
| deliveryReport: | Boolean | |
| createdPostR1: | Boolean | |
| onePagePerCard: | Boolean |
instance Card tag; relativeOrigin: <0.0,0.0>; contentSize: <0.0,0.0>; viewFlags: 0x00000000; labelStyle: nilObject; color: 0; altColor: 0; shadow: nilObject; sound: nilObject; prototypeForm: nilObject; stack: nilObject; noEnvelope: false; sentFlag: false; isEnvelope: false; isStationery: false; substitute: false; suppressCardData: false; autoAddress: false; wasSeen: false; autoPencil: false; noAutoKeyboard: false; tempTOCEntry: false; rightPageEntry: false; noDrawing: false; dontPurge: false; locked: false; isConfirmed: false; shrinkToFit: false; noFileAfterSend: false; noSubstituteCard: false; isReadOnly: false; dontAppearInLog: false; deliveryReport: false; createdPostR1: false; onePagePerCard: false; end instance;
Define Class Card; inherits from Viewable; inherits from HasContent, HasAddress; inherits from CanBeFiled; inherits from HasScrolling; inherits from HasGoTo; inherits from CanBeSearched; uses shared extra; field prototypeForm: Form, getter, setter; field stack: StackOfCards, weak; field noEnvelope: Boolean; // used by Telecard to distinguish postcard-style from letter-style cards field sentFlag: Boolean; // used to distinguish cards that have been mailed from ones that haven't; // used by SetSentFlag and WasSent operations field isEnvelope: Boolean; // used to distinguish an envelope from other cards; used by IsEnvelope operation field isStationery: Boolean, getter; // used to distinguish the target card of a Stationery object from other cards; field substitute: Boolean; // set when text that still needs to be mapped is stored in the form data of this card field suppressCardData: Boolean; // used in conjunction with substituteBit; // set when text in form data should not be displayed until substitution field autoAddress: Boolean; // if set on the target of stationery, will address card to current contact // when stationery is touched field wasSeen: Boolean, getter, setter; // set when card has been drawn on the screen; used by WasSeen attribute field autoPencil: Boolean; // used in conjunction with noDrawingBit to determine whether a drawing tool // should be enabled when this card is displayed field noAutoKeyboard: Boolean; // set on cards that should not be activated for typing when displayed field tempTOCEntry: Boolean; // for book pages: set by system when a marked page is inserted into an index field rightPageEntry: Boolean; // true/false - book page begins on right side of card field noDrawing: Boolean; // if set, drawing tools will do nothing on this card; used by CanDrawIn field dontPurge: Boolean, getter, setter; // set on cards that should not be offered to the user for deletion; // used by DontPurge attribute field locked: Boolean; // used by Locked attribute field isConfirmed: Boolean; // set by Confirmed operation; read by IsConfirmed operation field shrinkToFit: Boolean; // if set, AdjustSize resizes card to fit content field noFileAfterSend: Boolean; // if set on a Telecard, iMessageSent trigger is not posted when card is sent field noSubstituteCard: Boolean; // if set, text is not mapped when this card is a reply or forwarded-message cover page field isReadOnly: Boolean, getter, setter; // set on cards that should never be changed by the user, // e.g. non-delivery report card; used by IsReadOnly attribute field dontAppearInLog: Boolean; // set on Telecards that should not appear in the name card log field deliveryReport: Boolean; // if set, request a delivery report field createdPostR1: Boolean; // card was created with 1.5 or later software field onePagePerCard: Boolean; // for book pages: specifies whether there is one page per card or two // mini-cards operation InstallMiniCard(cardOrScene: Viewable): MiniCard; // call to create a mini-card for self using NewMiniCard(self) // newly-created mini-card is made a subview of <cardOrScene> and returned // handles some special cases for <cardOrScene>, such as using current card instead of a stackscene // gets position for mini-card from AttachmentPosition (or DeskPosition if installing on a Desktop) // override rarely operation MiniCardPrototype(): MiniCard; // called by NewMinicard when creating a mini-card // override sometimes to return a different kind of mini-card for a card subclass operation NewMiniCard(): MiniCard; // call this to create a new minicard. // stack-related operation MoveToStack(newStack: StackOfCards), noFail; // call to move card out of current stack (if any) and into <newStack> // <newStack> can be nilObject // makes card current card of <newStack>'s stack scene if it had no cards installed before // override occasionally for special processing when moving subclass into or out of specific stacks operation MoveToSorted(); // moves card to correct position in sorted stack // call after changing card in a way that might affect its sorted position // if stack is not sorted, does nothing // override rarely // visiting overrides AboutToHide; // nils out values of iCurrentCard and the considerably more obscure iCurrentCardList // dismisses form and stabilizes self (e.g. to coalesce scribbles) // calls SetWasSeen(self, true) if screen was redrawn at least once while card was on screen overrides AboutToShow; // sets up value of iCurrentCard and the considerably more obscure iCurrentCardList // installs form in self, resizes self to fit content with AdjustSize, and scrolls to top operation DefaultScene(): Scene; // call to get stack scene to use when viewing a card that's not in a stack // returns iSingleCardScene // override sometimes when subclass should be displayed in a special scene overrides GoTo; // calls GoToVia with nilObject as <zoomBackSpot> overrides GoToVia; // if a mini-card for this card can be found, calls GoTo on the minicard // otherwise uses Stack and if necessary DefaultScene to find appropriate scene, // then sets current card of scene to self and calls GoToVia on scene with <zoomBackSpot> operation StepBackToCard(); // called by scene when stepping back // similar to GoToVia except does not try to find mini-card // override rarely attribute WasSeen: Boolean; // call getter to determine if this card has ever been displayed on the screen // setter is called in AboutToHide if screen was redrawn while card was on screen // override rarely // moving and growing card overrides CanMove; // returns false overrides ConstrainMove; // prevents card from getting too far from top or bottom of scene // used by scrolling, not by Move tool (since CanMove returns false) overrides ConstrainToolTarget; // if target is form, make target self instead overrides PageUp; // moves card up by 3/4 of its visible height, taking keyboard into account overrides PageDown; // moves card down by 3/4 of its visible height, taking keyboard into account overrides ScrollToTop; // moves card until top is visible overrides ScrollToBottom; // moves card until bottom is visible, taking keyboard into account operation RevealBox(box: Box); // position card to show location at box coordinates overrides RevealSelection; // if text selection is in a subview of self, moves card until selection is visible overrides AdjustSize; // if shrinkToFit card flag is set, resizes card to fit content // will not make card smaller than MinimumHeight(self) attribute MinimumHeight: Micron, readOnly; // minimum height of card // returns a constant value (246*onePixel) // override occasionally to align minimum height with some visual feature of card (e.g. notebook spirals) #ifdef RESIZABLE_SCREEN attribute AbsoluteMinimumHeight: Micron, readOnly; // desired height for resizable screens #endif overrides RevealViewable; // moves card up or down as needed to make subview <objectToReveal> visible overrides SetContentSize; // sets size of attached form after calling inherited method // scribbles overrides CanDrawIn; // if card is locked, returns kAskUserToDecide // else if noDrawing flag is set, returns kDontDraw // else returns kDoDraw // form attribute PrototypeForm: Form; // gets/sets form, which contains viewables shared by multiple cards // data in some of these viewables is stored in card data // this form is stored in the card's <prototypeForm> field // a copy of this form is installed as a subview by BeginUsingForm // callers should use InstalledForm instead if they are examining the stored data // override rarely attribute InstalledForm: Form, readOnly; // returns form (if any) that is currently a subview of self // this is the copy that was created by BeginUsingForm, and will be destroyed by EndUsingForm // override rarely attribute CurrentForm: Form, readOnly; // returns InstalledForm, if any, else returns PrototypeForm // call to get a read-only form if caller doesn't care whether form is currently installed // override rarely operation BeginUsingForm(needCardData: Boolean): Boolean; // call to install copy of form into card // returns false if card already had a form installed // otherwise extracts card data from this card into form if <needCardData>, then returns true // override rarely operation EndUsingForm(hadCardData: Boolean; returnFromBeginUsingForm: Boolean); // call when done using form, after borrowing it earlier // if <returnFromBeginUsingForm> is false, does nothing except balance BeginUsingForm // if <hadCardData> is true, stores data from form into card // override rarely operation StoreFormData(), noFail; // stores data from <form> into card // if <form> is nilObject, currently installed form (if any) is used // override rarely operation ExtractCardData(form: Form; skipText: Boolean), noFail; // extracts data from card into <form> // does not extract text data (but does extract text styles) if <skipText> is true // override rarely attribute FormModified: Boolean; // setter called by the system when this card's local copy of the form has been changed // getter called by the system in EndUsingForm so changes will be preserved // override rarely operation MakeFormCanonical(form: Form); // call to erase form and make erased form be the standard height // override occasionally to standardize and empty form in some other way operation PromoteModifiedForm(); // promotes changes in local copy of form by changing value of indexical in <form> field // all other cards that reference the same indexical form will get these changes // called by user interface in response to user choice when form elements are changed with coupons // override rarely overrides ExtraListObjectsUsedBySubclasses; // overriden to let class Viewable know we are using some items in the extra list operation BeginActorUseOfForm(); // call when using the form of this card // no other actor can use the form of this card until it's released operation EndActorUseOfForm(); // call when done using the form of this card overrides Erase; // if form is installed in card, calls Erase(form) // then calls inherited method overrides DestroySubviews; // removes and reinstalls form if installed around call to inherited method overrides EraseRecent; // removes and reinstalls form around call to inherited method, if option key is down overrides Draw; // borrows and returns form around call to inherited method overrides DrawWithContents; // borrows and returns form around call to inherited method overrides CalcBorderBox; // borrows and returns form // result is union of inherited method and bounds of form overrides CalcInsidePart; // borrows and returns form // calls CalcInsidePart on form, if any, else calls inherited method overrides CalcOpaqueBox; // borrows and returns form // calls CalcOpaqueBox on form, if any, else calls inherited method overrides InsidePart; // prevents hit testing from borrowing a form to measure the card // while it is being rendered overrides ChangedContents; // ensures that form remains the first (rearmost) subview overrides Copying; // sets stack of copy to nilObject, if copy is not in stack overrides CanExtendBottom; // returns true overrides ExtendBottomBy; // centers form in card after calling inherited method, then scrolls to bottom operation ExtendBottom(); // extends the card by a reasonable amount (1/3 of the scene's display size height) // text overrides ActivateForTyping; // activate a body field if one is found // else calls inherited method overrides ContentDescription; // returns label of card, if any // else returns ephemeral copy of iDefaultCardType overrides TypeDescription; // returns label of card, if any // else returns ephemeral copy of iDefaultCardType operation CardText(index: Unsigned): Text; // returns text from item <index> in form items // gets text from form item directly if form is installed, or from card data otherwise // override rarely operation SetCardText(index: Unsigned; newText: HasText); // call to set text of item <index> in form items // borrows and returns form if necessary // override rarely operation MainField(): TextField; // returns first (presumably only) subview that is a body field attribute MainText: Text; // getter returns text from main field, or from card data if form not installed // setter replaces text of main field // override rarely operation SubstituteText(); // does nothing at this level // called by AboutToShow and Render // Telecard uses this to perform text mappings on previously-hidden card data (e.g. in stationery) // override rarely // debugging #ifdef VALIDATE overrides Validate; // checks reserved card flags, consistency of canDelete bit with subviews, consistency of stack/card links, etc. #endif // searching operation CardOrEnvelopeContainsText(textToMatch: HasText): Boolean, noFail; // calls MatchTextDeep on both card and envelope (if any) // called by auto-filing mechanism to quickly determine whether any part of a card contains specified text // not called by search dog, because that user-level searching is more fine-grained operation CardOrEnvelopeDisplaysImage(imageToMatch: HasText): Boolean, noFail; // calls MatchImageDeep on both card and envelope (if any) // called by auto-filing mechanism to quickly determine whether any part of a card contains specified image // not called by search dog, because that user-level searching is more fine-grained overrides DrawAttentionTo; // calls BlinkPlaceName(iNameBar); overrides MatchText; // searches in card data // note that this is used by CardOrEnvelopeContainsText, but is not used by the search dog // because Card_SearchForObject does not call it overrides SearchForObject; // searches in card data as well as calling inherited method // Sorting (for listviews, etc.) operation CompareCards(otherCard: Card; sortKey: OperationNumber): Signed; // used by system when sorting MailStacks // avoid calling or overriding since we hope to eliminate this design // MailStack should control order, not the cards within it (which may be of different types) // sending overrides AttachmentPosition; // if <attachment> is a task proxy, sets <putItHere> to lower right corner of card // else calls inherited method operation MakeMiniCardAndHop(); // makes a new mini card for this card appear at the desk scene, hop into position, then zoom open // call to draw attention to creation of new message that user may want to change before sending // override rarely overrides MailOnTelecard; // install a minicard copy of this card on a telecard for sending operation SetSentFlag(sentFlag: Boolean), noFail; // sets sent flag in card flags // used on stationery to indicate that the stationery is not editable // used on non-stationery to indicate that the user interface should display this card as sent // operation WasSent reads this flag // override rarely operation WasSent(): Boolean, safe, noFail; // reads sent flag in card flags // used on stationery to indicate that the stationery is not editable // used on non-stationery to indicate that the user interface should display this card as sent // operation SetSentFlag sets this flag // override rarely operation IsEnvelope(): Boolean, safe; // call to determine whether this card is an envelope for another card // reads isEnvelope flag in cardFlags // override rarely operation Confirmable(): Boolean; // returns true // subclasses override to add criteria for returning true // called by the yes/no install/delete buttons on the confirmation form // returning false will disable the buttons overrides Confirmed; // sets confirmed flag in cardFlags, then passes Confirmed call to subviews operation IsConfirmed(): Boolean, safe, noFail; // call to see whether user has pressed yes/no buttons on confirmation form // reads confirmed flag in cardFlags // override rarely // filing overrides CanFileIntoFileCabinet; // returns true overrides CopyIntoSystem; // keeps card in same stack if it's in a system stack // makes new minicard if necessary // otherwise moves card to receiver from package's install list overrides FileTo; // destroys mini-card if found before calling FileInContainer overrides FilingChoiceImage; // returns SmallCardImage overrides InstalledReceiver; // gets installed receiver from stack // if card has no stack or card's stack has no installed receiver, returns iMainFolderTray overrides NeedsInstallEntry; // returns true if self is in a package and is not an envelope overrides GoToAfterFiling; // returns true if this is the current card // misc. overrides Init; // calls SetCanContain(self, true) after calling inherited method overrides Finalize; // removes self from stack (if any), and removes form (if installed) from self attribute DefaultTool: ChooseableTool, readOnly; // called by system to determine what tool should be active when card is displayed // getter respects autoPencil flag in cardFlags and result of CanDrawIn // override rarely (set the card flags instead) operation DetachCard(); // detaches card from stack // passes card along to stack scene of stack if possible, else does work here // override rarely overrides ArrowState; // determines up/down scrolling state by comparing content box against display area // display area takes keyboard into account if appropriate // ignores horizontal scrolling attribute SmallCardImage: Image, readOnly; // call to get an image used to represent this card // override sometimes to return specialized small image for subclass overrides CanAccept; // returns true only if inherited method returns true, and <probe> is within content box overrides CanAcceptCoupon; // returns true only if coupon is a ViewCoupon with selector viewCouponShowSubviews overrides CanBringToFront; // returns false overrides CanChangeContainers; // returns false overrides CanCopy; // returns false overrides CanDelete; // returns false if self is target of default stationery // otherwise returns result of inherited method overrides CanDeleteAtWill; // returns false, since cards typically contain user-entered data and so // they should not be deleted lightly overrides SetName; // after calling inherited method, dirties name bar if self is current card attribute Locked: Boolean; // call getter to determine whether card is protected against user-interface-level changes // getter respects Locked attribute of scene as well as cardLocked flag in cardFlags // call setter to change value of cardLocked flag in cardFlags // used primarily for received mail // override rarely attribute LShapedBodyField: Boolean; // gets/sets createdPostR1 flag in cardFlags // used by postcard-type stationery to maximize text that fits on message that includes postmark // override rarely attribute IsReadOnly: Boolean; // gets/sets isReadOnly flag in cardFlags // used by SpecialButtons to disallow certain modification operations // avoid using this attribute // override rarely attribute DontPurge: Boolean; // gets/sets dontPurge flag in cardFlags // respected by operations that decide which objects to offer for discarding // user can apply "save" stamps to control this // override rarely attribute IsStationery: Boolean; // gets/sets stationery flag in cardFlags // call when there is a need to distinguish stationery from other cards in user interface // override rarely attribute Stack: StackOfCards; // gets/sets which stack of cards this card is a member of // Stack() doesn't simply return the stack field. It will only return // a value when the card is actually in the stack. SetStack() doesn't // simply set the stack field. It may choose to store an indexical if // the stack passed in is in the list of system stack indexicals. // override rarely operation FillOutCard(); // called by system when new card is created from stationery // does nothing at this level // override occasionally to set up card dynamically before AboutToShow overrides Render; // borrows/returns form or copy of form as necessary overrides RenderIntoPage; // handles rendering into standard size overrides RenderPageCount; // to get the right page count when formatting to full page overrides ShouldUseInPageCount; // so the card doesn't get counted if it's going to be rendered full size overrides CanFormatToStandardPaper; // returns true if there is a prototype operation StandardPaperSizePrototype(): StandardPaperSizeCard; // returns an object to be used to display the viewable's data in standard letter // size format operation StandardPaperSizeVersion(): Card; // Creates a transient copy of StandardPaperSizePrototype with the text from // this card on a standard 8 1/2 X 11 layout. intrinsic CenterForm(form: Form); operation EachCardDataItem(form: Form; function: EachCardDataItemFunction; parameters: Pointer): Object, intrinsic; end class;