previous chapter contents page top page next chapter

Class ImageCoupon

Inherits from Coupon
encodes empty field list;

Class Description

Class ImageCoupon is a subclass of Coupon that allows the user to change the image associated with an object. Objects of this class work by calling ApplyImage on the coupon's target.

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

Programming information

Instantiate: rarely
Subclass: rarely
Call its methods: rarely

You might instantiate objects of this class if you want to create your own image coupons, and you might create subclasses if you wanted to create a coupon for a specialized kind of image class.

Methods defined by class ImageCoupon

Class ImageCoupon defines the following methods:

Method Description
ApplyCoupon Overridden to call ApplyImage on coupon's target.
CalcContentBox Overridden to use image to compute content box.
CanStretch Overridden to return false.
Draw Overridden to show image in coupon instead of text.
Image Overridden to return coupon object as its image.
MaxHeight Maximum height for images drawn in coupons.
MaxWidth Maximum width for images drawn in coupons.

Fields defined by class ImageCoupon

Class ImageCoupon defines no fields.

Method Descriptions

ApplyCoupon

overrides ApplyCoupon

Call: rarely
Override: sometimes

Magic Cap calls ApplyCoupon when the user drops a coupon into a viewable object. ApplyCoupon should perform the action represented by the coupon. ImageCoupon_ApplyCoupon sets the target's image by calling ApplyImage.

CalcContentBox

overrides CalcContentBox

Call: rarely
Override: sometimes

ImageCoupon overrides CalcContentBox to use the coupon's image when calculating its content box.

CanStretch

overrides CanStretch

Call: rarely
Override: sometimes

ImageCoupon overrides CanStretch to return false if the coupon has a coupon object. Otherwise, CanStretch calls its inherited implementation.

Draw

overrides Draw

Call: rarely
Override: sometimes

Magic Cap calls Draw to draw the coupon on the screen. ImageCoupon_Draw draws the coupon showing the coupon's image.

See Viewable_Draw for more information.

Image

overrides Image

Call: rarely
Override: sometimes

ImageCoupon overrides Image to return the coupon object as its image.

MaxHeight

attribute MaxHeight: Micron, readOnly
  // operation MaxHeight(): Micron


Call: rarely
Override: rarely

Magic Cap calls MaxHeight to determine the maximum height of an image when drawn in a coupon.

MaxWidth

attribute MaxWidth: Micron, readOnly
  // operation MaxWidth(): Micron

Call: rarely
Override: rarely

Magic Cap calls MaxWidth to determine the maximum width of an image when drawn in a coupon.