previous chapter contents page top page next chapter

Stationery

inherits from Box


Class Description

Stationery objects represent the various kinds of telecards that users can copy to create messages. The plain postcard stationery object, for example, represents a prototype postcard, the ur postcard. The illustration above shows four familiar stationery types.

Remember that if the documentation and the software (especially the definition files) disagree, always trust the software.

Programming information

Instantiate: sometimes
Subclass: sometimes
Call its methods: often

You'll rarely need to create subclasses of class Stationery. When you need a new stationery type, you'll create a new object of class Stationery, not a whole new subclass. You'll create a prototype card to go with it, and an image to use to display the stationery's icon. You might use the builtin subclass of class Stationery, class DefaultFontStationery.

Methods defined by class Stationery

Class Stationery defines the following methods:

Method Description
AboutToHide Overriden to stop observing target
AboutToShow Overridden to destroy self if target has gone bad while self was off-screen
Notice Overridden to destroy self if target has gone bad
CalcBoundsBox Overridden to account for smeared stationery image and default stationery highlight
CanContain Overridden to return false
CanDrawIn Overridden to return kDontDrawHere
CreateNewCard Creates a new card in the system persistent cluster
CreateNewCardPreferred Return copy of target card in preferred container
CreateNewCardNear Return copy of target card near the nearThis parameter
CreateMessage Create a new card and minicard
CreateMiniCard Create a minicard wose
Draw Overridden to draw some gray behind the stationery
Finalize Overridden to make the post card stationery the default if the current default is being destroyed
Touch Overridden to create a copy of the default stationery and send a new minicard hopping; if the option key is down, opens stationery for editing
SetCurrentStationery Set the iDefaultStationery indexical to the new default

Fields defined by class Stationery

Class Stationery defines the following fields:

Field Type Description
Inherited from SingleLinkable
next Object Next item in view list
Inherited from Linkable
previous Object Previous item in view list
Inherited from Viewable
superview Viewable Container for this object
subview Viewable Object contained by this object
relativeOrigin Dot Origin relative to superview
contentSize Dot Size of content rectangle
viewFlags Flags Property settings
labelStyle TextStyle Text style of object's label
color Color Color of object's content
shadow Shadow Shadow drawn with object
sound Sound Sound associated with object
Inherited from HasBorder
border Border Framed border drawn around object
Defined by class Stationery
image Image The image to use to represent the stationery; if nilObject,
stationery is drawn using the card icon
card Card The prototype card used by this stationery
dependency Object Usually nilObject; if it's an indexical, touching will do
nothing if indexical has no current value
hopTarget Object A specific viewable to install a minicard onto when self is touched; if nilObject, the getter decides where

Here's an example of a familiar stationery type, the plain postcard. This stationery type is actually an object of subclass DefaultFontStationery.

Instance DefaultFontStationery 'plain postcard' 389;
           next: (DefaultFontStationery 'urgent postcard' 768);
       previous: nilObject;
      superview: (StationeryWindow 'Stationery' 754);
        subview: nilObject;
 relativeOrigin: <-145.0,-42.0>;
    contentSize: <66.0,48.0>;
      viewFlags: 0x10185000;
     labelStyle: iBook12;
          color: 0;
       altColor: 0;
         shadow: nilObject;
          sound: nilObject;
         border: nilObject;
          image: nilObject;
           card: (Telecard 769);
     dependency: nilObject;
      hopTarget: nilObject;
End Instance;
Instance Telecard 769;
           next: nilObject;
       previous: nilObject;
      superview: nilObject;
        subview: nilObject;
 relativeOrigin: <-30.0,0.0>;
    contentSize: <411.0,246.0>;
      viewFlags: 0x10005000;
     labelStyle: iBook12;
          color: 0;
       altColor: 0;
         shadow: nilObject;
          sound: nilObject;
           form: iPostCardForm;
        stack: nilObject;
      cardFlags: 0x64202040;
        message: (PersonalMessage 1129);
      envelope: nilObject;
        header2: $ 93;
          data2: $ 4465 6172 202F 6669 7273 7420 6E61 6D65 2F2C \
                 $ 0A;
End Instance;
Instance PersonalMessage 1129;
         length: 0;
autoForwardCount: 0;
  autoGenerated: false;
   dispatchTime: nilObject;
    displayView: nilObject;
    mailingCost: 1489;
    mailingRate: 150;

 originatorCard: nilObject;
   dateReceived: 0x0000C0BD;
   timeReceived: 0;
deliveryChoices: nilObject;
deliveryChoiceIndex: 0;
blindCopyRecipients: nilObject;
confidentiality: 0;
 copyRecipients: nilObject;
           from: nilObject;
     groupCards: nilObject;
     importance: 0;
      inReplyTo: nilObject;
      messageID: nilObject;
personalExtensions: nilObject;
relatedMessages: nilObject;
        replyBy: nilObject;
        replyTo: nilObject;
        subject: nilObject;
   toRecipients: nilObject;
End Instance;

The stationery object points to a prototype telecard, which in turn points to a personal message object. Your stationery objects will also need to have telecard and personal message objects defined for them.

Attributes defined by class Stationery

Class Stationery defines the following attributes:

Attribute Type Description
Card Card The prototype card copied by the various creation operations
HopTarget Object Viewables created from this stationery will land on this target at the terminus of their hop; if nilObject, the current scene is used
Image Image The image to use for drawing the stationery (optional)
Target Object A synonym for the Card attribute

Method Descriptions

CreateMessage

operation CreateMessage(referenceCard: Card; attachments: Viewable; 
toRecipient: AddressCard): Card, safe;

Call:   sometimes
Override: rarely

The system calls CreateMessage in a wide variety of situations where new message cards (sometimes called telecards) are created. You will call CreateMessage whenever you want your user's action to create a new message. CreateMessage creates a new card and mini-card. It displays the mini-card zooming up to reveal the new telecard ready for the user to edit.

Addressees and subject information for the new card are copied from the referenceCard, if you've supplied that information. The toRecipient parameter, if you provide one, is used as the recipient, overriding any recipient specified in the referenceCard parameter.

The attachments parameter handles the special cases for Task, Viewable, and AddressCard attachments. Datebook Task attachments are placed on the card as TaskProxy objects. Viewable attachments are made subviews of the card. And AddressCard attachments are passed as parameter to SetEntity on the message of the card.

CreateMiniCard

operation CreateMiniCard(): Object;

Call:  sometimes
Override: sometimes

Call CreateMiniCard to get a minicard representing the target card. CreateMiniCard returns the new minicard. It also sets the sender of the target card to the current user (stored in iCurrentUser).

Draw

overrides Draw

Call:  sometimes
Override: sometimes

The system calls Draw when it needs to draw a viewable object on the screen. You knew that! Class Stationery overrides Draw to do a few special drawing tasks for stationery.

If a stationery object doesn't specify a specific image to use to draw itself, Draw usies the image returned by calling CardIcon on the target card. The card icon is drawn staggered, so it looks like a pile of blank stationery. Stationery_Draw also draws a gray oval behind the default stationery.

SetCurrentStationery

operation SetCurrentStationery();

Call:  rarely
Override: rarely

The system calls SetCurrentStationery when the user changes the default stationery. SetCurrentStationery updates the iDefaultStationery indexical. It also ensures that old and new default stationery and the message icon on the desk are redrawn. The default stationery is drawn with a gray halo.