inherits from Coupon;
Class RuleCoupon is a subclass of Coupon that allows the user to add a rule to an object, usually a list of rules. When the user copies a rule from a rule view, the newly copied object appears as a rule coupon. Objects of this class work by calling AddTo or AddAt on the coupon's target.
Instantiate: never Subclass: rarely Call its methods: never
You might create subclasses of this class if you wanted to customize the behavior of newly copied rules that become rule coupons.
Class RuleCoupon defines the following methods:
Method | Description |
---|---|
ApplyCoupon |
Overridden to add rule to list of rules. |
Copying | Overridden to set owner scene of newly copied rule coupon. |
Copying | Overridden to set opaque when hovering over rule view. |
Draw | Overridden to make coupon look like a rule. |
OwnerScene | Get scene associated with this rule. |
OwnerScene | Set scene associated with this rule. |
Class RuleCoupon 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 |
Inherited from Coupon | ||
couponObject | Object | Object or attribute associated with coupon |
selector | Unsigned | Provides detail on coupon's action |
amount | Unsigned | Provides value for coupon's action |
Define by RuleCoupon | ||
ownerScene | Scene | Scene associated with this rule |
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. RuleCoupon_ApplyCoupon adds the rule to the rule view that accepts the coupon.
overrides Copying Call: rarely Override: sometimes
Class RuleCoupon overrides Copying to set the coupon's ownerScene attribute when a new rule coupon is created.
overrides DragAsGhost Call: rarely Override: sometimes
Class RuleCoupon overrides DragAsGhost to prevent drawing the dragged coupon as a ghost if it is hovering over a rule view.
overrides Draw Call: rarely Override: sometimes
Magic Cap calls Draw to draw the coupon on the screen. RuleCoupon_Draw draws the coupon with a customized appearance that shows the text of the rule and its checkbox.
See Viewable_Draw for more information.
attribute OwnerScene: Scene // operation OwnerScene(): Scene // operation SetOwnerScene (newScene); Call: rarely Override: rarely
Magic Cap uses the OwnerScene attribute to determine which scene the rule is associated with. If the user tries to move a rule coupon outside its owner scene, the rule pops back into its owner scene and an explanatory announcement appears.