previous chapter contents page top page next chapter

Stamp

October 5, 1992last updated April 1, 1994

Defined in Stamp.Def 
Inherits from Viewable

Class Description

As you look through the Magic Cap software, you'll see cards decorated with all sorts of small pictures: company logos, postage stamps, animals, cacti, stylized skyscrapers, and lots more. These pictures are objects of class Stamp. You can add them to any card and position them anywhere you like.

The Magic Hat contains dozens of stamps that you can use in decorating your software. The stamps are divided into categories, with each category filling a drawer in the Magic Hat.

If you're running the Magic Cap software on a Macintosh(tm) personal computer, you can create your own stamps from Macintosh graphics. Just select any Macintosh image and copy it to the clipboard. Then, start or activate the Magic Cap software and choose Paste from the Macintosh's Edit menu (or type -V on the Macintosh keyboard). The image is transformed into a coupon on the Magic Cap screen. (If the image is in color and you want to create a color stamp, hold down the Macintosh shift key while you choose Paste, or type -shift-V.) To create a stamp from the coupon, first get a copy of any existing stamp from the Magic Hat. Then drag the image coupon onto the stamp. Voila! A new stamp with your image!

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

Using a Stamp Object

Class Stamp is a direct descendent of the venerable class Viewable. Every stamp includes an image that's used when the stamp is drawn on the screen. To use a stamp, just get one from the Magic Hat, then drag it to the location you want.

Programming Information

Instantiate: rarely
Subclass: rarely
Call its methods: rarely

You'll rarely call any methods of class Stamp. Usually, you'll just get stamps from the Magic Hat and put them in place in your packages.

You might create a subclass of Stamp if you want to add special capabilities that aren't available in standard stamps. The system defines several subclasses of Stamp, including Button and Animation.

Methods you might call

The Stamp class has no methods that you're likely to call.

Methods you might override

When you create a subclass of Stamp, you might override these methods under the following circumstances:

Method When to override
Action If objects of your subclass should do something when tapped
Tap You want to change the default highlighting
Draw The stamp isn't simply drawn from its image

Class Stamp has a wide variety of subclasses, which override many inherited methods and define many others. Your subclass might very well override more methods than the ones mentioned here.

Description of fields

The Stamp class 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 Unsigned 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
Defined by Stamp:
image Image Image used to draw stamp

Method Descriptions

Action

overrides Action

Call: rarely
Override: sometimes

The system calls Action when the user taps on stamp objects, by invoking Action from Viewable_Tap. You should override Action to define what objects of your subclass do when tapped.

For example, class Icon overrides Action to do the main job of an icon: zooming to a destination. Class ScrollArrow overrides Action to scroll when tapped.

Tap

overrides Tap

Call: rarely
Override: sometimes

The system calls Tap when the user taps on the stamp. Stamp_Tap highlights the stamp, calls its inherited Tap method, then removes the highlighting. You should override Tap if you want objects of your subclass to indicate taps in some way other than highlighting

The touchInput parameter indicates the device that reported the tap. Usually, you'll ignore this parameter, or simply pass it along when you call the inherited tap method. See Viewable_Tap for more information.


Version note: Previous versions of this document recommended that you override Tap to perform some action when objects of your subclass are tapped. It's better magical form, though, to override Action instead of Tap. Override Tap only to avoid the default highlighting.


Draw

overrides Draw

Call: rarely
Override: sometimes

When the system has to draw a stamp on the screen, it calls the stamp's Draw method. Stamp_Draw simply calls DrawShadowedImage, which draws the stamp's image and its shadow, if it has one.

You should override Draw if you want coupons of your subclass to be drawn in some other manner than the standard, which is simply to draw the stamp's image and its shadow. Your overriding method should draw the coupon as you wish. You should call the inherited Draw from your overriding method if you want the stamp's image and shadow to be drawn; if so, you'll probably call the inherited Draw at the start of your overriding method.

See Viewable_Draw for more information.