changed the way equal<%> and snip% interact. Specifically:
- snip% now implements equal<%> its equal-to? delegates to other-equal-to?. - snip%'s other-equal-to and equal-hash-code and equal-secondary-hash-code all just amount to using eq?. The setup is here just to make snip% be the one that declares that it implements equal<%> so that various snips can adjust other-equal-to? (and the hash code methods) - image-snip% no longer implements equal<%> (but it extends snip% and it overrides other-equal-to? and the hash-code methods to do what they always did) original commit: 2f009ca529fcbe4ebe496379a5403cbcf1a0cd14
This commit is contained in:
parent
5198977f05
commit
069cfb2d19
|
@ -1,7 +1,7 @@
|
|||
#lang scribble/doc
|
||||
@(require "common.ss")
|
||||
|
||||
@defclass/title[image-snip% snip% (equal<%>)]{
|
||||
@defclass/title[image-snip% snip% ()]{
|
||||
|
||||
An @scheme[image-snip%] is a snip that can display bitmap images
|
||||
(usually loaded from a file). When the image file cannot be found, a
|
||||
|
@ -43,19 +43,6 @@ secondary hash code for @this-obj[] (using the same notion of
|
|||
|
||||
See also @scheme[equal<%>].}
|
||||
|
||||
|
||||
@defmethod[(equal-to? [snip (is-a?/c image-snip%)]
|
||||
[equal? (any/c any/c . -> . boolean?)])
|
||||
boolean?]{
|
||||
|
||||
Calls the @method[image-snip% other-equal-to?] method of @scheme[snip]
|
||||
(to simulate multi-method dispatch) in case @scheme[snip] provides a
|
||||
more specific equivalence comparison.
|
||||
|
||||
See also @scheme[equal<%>].}
|
||||
|
||||
|
||||
|
||||
@defmethod[(get-bitmap)
|
||||
(or/c (is-a?/c bitmap%) #f)]{
|
||||
|
||||
|
@ -145,7 +132,7 @@ If @scheme[inline?] is not @scheme[#f], the image data will be saved
|
|||
boolean?]{
|
||||
|
||||
Returns @scheme[#t] if @this-obj[] and @scheme[snip] both have bitmaps
|
||||
and the bitmaps are the same dimensions. If either has a mask bitmap
|
||||
and the bitmaps are the same. If either has a mask bitmap
|
||||
with the same dimensions as the main bitmap, then the masks must be
|
||||
the same (or if only one mask is present, it must correspond to a
|
||||
solid mask).
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#lang scribble/doc
|
||||
@(require "common.ss")
|
||||
|
||||
@defclass/title[snip% object% ()]{
|
||||
@defclass/title[snip% object% (equal<%>)]{
|
||||
|
||||
A direct instance of @scheme[snip%] is uninteresting. Useful snips are
|
||||
defined by instantiating derived subclasses, but this class defines
|
||||
|
@ -217,7 +217,35 @@ Draws nothing.
|
|||
|
||||
}}
|
||||
|
||||
@defmethod[(equal-to? [snip (is-a?/c snip%)]
|
||||
[equal? (-> any/c any/c boolean?)])
|
||||
boolean?]{
|
||||
@methspec{See @scheme[equal<%>].}
|
||||
|
||||
@methimpl{Calls the @method[snip% other-equal-to?] method of @scheme[snip]
|
||||
(to simulate multi-method dispatch) in case @scheme[snip] provides a
|
||||
more specific equivalence comparison.}}
|
||||
|
||||
@defmethod[(other-equal-to? [that (is-a?/c snip%)]
|
||||
[equal? (-> any/c any/ boolean?)])
|
||||
boolean?]{
|
||||
@methimpl{Returns @racket[(eq? this that)].}
|
||||
}
|
||||
|
||||
@defmethod[(equal-hash-code [hash-code (any/c . -> . exact-integer?)])
|
||||
exact-integer?]{
|
||||
|
||||
@methspec{See @scheme[equal<%>].}
|
||||
|
||||
@methimpl{Returns @scheme[(eq-hash-code this)].}}
|
||||
|
||||
@defmethod[(equal-secondary-hash-code [hash-code (any/c . -> . exact-integer?)])
|
||||
exact-integer?]{
|
||||
|
||||
@methspec{See @scheme[equal<%>].}
|
||||
|
||||
@methimpl{Returns @scheme[1].}}
|
||||
|
||||
@defmethod[(find-scroll-step [y real?])
|
||||
exact-nonnegative-integer?]{
|
||||
|
||||
|
@ -234,7 +262,6 @@ Returns @scheme[0].
|
|||
|
||||
}}
|
||||
|
||||
|
||||
@defmethod[(get-admin)
|
||||
(or/c (is-a?/c snip-admin%) false/c)]{
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user