rackety mrlib/name-message

This commit is contained in:
Robby Findler 2010-06-22 11:56:59 -05:00
parent c5b0c73111
commit 9f5593c222
2 changed files with 21 additions and 21 deletions

View File

@ -1,4 +1,4 @@
#lang scheme/gui #lang racket/gui
;; min-w, min-h : number -> contract ;; min-w, min-h : number -> contract
;; determines if the widths and heights are suitable ;; determines if the widths and heights are suitable

View File

@ -8,7 +8,7 @@
@defclass[name-message% canvas% ()]{ @defclass[name-message% canvas% ()]{
A @scheme[name-message%] control displays a filename that the user can A @racket[name-message%] control displays a filename that the user can
click to show the filename's path and select one of the enclosing click to show the filename's path and select one of the enclosing
directories. Override the @method[name-message% on-choose-directory] directories. Override the @method[name-message% on-choose-directory]
method to handle the user's selection. method to handle the user's selection.
@ -16,7 +16,7 @@ method to handle the user's selection.
@defconstructor/auto-super[()]{ @defconstructor/auto-super[()]{
Passes all arguments to @scheme[super-init].} Passes all arguments to @racket[super-init].}
@defmethod[(on-choose-directory [dir path-string?]) @defmethod[(on-choose-directory [dir path-string?])
@ -42,7 +42,7 @@ Draws the control's current message.}
@defmethod[(set-hidden? [hidden? any/c]) @defmethod[(set-hidden? [hidden? any/c])
void?]{ void?]{
Calling this method with @scheme[#f] causes the name message Calling this method with @racket[#f] causes the name message
to become invisible and to stop responding to mouse movements. to become invisible and to stop responding to mouse movements.
Calling it with a true value restores its visibility and Calling it with a true value restores its visibility and
@ -55,19 +55,19 @@ makes it respond to mouse movements again.}
Sets the label for the control. Sets the label for the control.
If @scheme[file-name?] is @scheme[#t], @scheme[msg] is treated like a If @racket[file-name?] is @racket[#t], @racket[msg] is treated like a
pathname, and a click on the name-message control creates a popup pathname, and a click on the name-message control creates a popup
menu to open a get-file dialog. menu to open a get-file dialog.
If @scheme[file-name?] is @scheme[#f], @scheme[msg] is treated as a If @racket[file-name?] is @racket[#f], @racket[msg] is treated as a
label string. Clicking on the name-message control pops up a dialog label string. Clicking on the name-message control pops up a dialog
saying that there is no file name until the file is saved.} saying that there is no file name until the file is saved.}
@defmethod[(set-short-title [short-title? boolean?]) void?]{ @defmethod[(set-short-title [short-title? boolean?]) void?]{
Sets the @scheme[short-title?] flag. The flag defaults to @scheme[#f]. Sets the @racket[short-title?] flag. The flag defaults to @racket[#f].
If the flag is @scheme[#t], then If the flag is @racket[#t], then
the label for the control is simply the string @scheme["/"]. Otherwise, the label for the control is simply the string @racket["/"]. Otherwise,
the label is determined by the label is determined by
the @method[name-message% set-message]. the @method[name-message% set-message].
} }
@ -75,7 +75,7 @@ saying that there is no file name until the file is saved.}
@defmethod[(get-background-color) (or/c #f (is-a/c color%) string?)]{ @defmethod[(get-background-color) (or/c #f (is-a/c color%) string?)]{
The result of this method is used for the background color The result of this method is used for the background color
when redrawing the name message. If it is @scheme[#f], the when redrawing the name message. If it is @racket[#f], the
OS's default panel background is used. OS's default panel background is used.
} }
@ -104,8 +104,8 @@ Defaultly, the name-message does not allow shrinking.
(values real? real?)]{ (values real? real?)]{
Calculates the minimum width and height of a button label (when drawn Calculates the minimum width and height of a button label (when drawn
with @scheme[draw-button-label]). Returns two values: the width with @racket[draw-button-label]). Returns two values: the width
and height. The @scheme[dc] argument is used for sizing.} and height. The @racket[dc] argument is used for sizing.}
@defproc[(draw-button-label [dc (is-a?/c dc<%>)] @defproc[(draw-button-label [dc (is-a?/c dc<%>)]
@ -125,19 +125,19 @@ filename buttons in the top-left corner of the DrRacket frame. Use
this function to draw similar buttons. this function to draw similar buttons.
The basic idea is to create a canvas object whose on-paint method is The basic idea is to create a canvas object whose on-paint method is
overridden to call this function. The @scheme[dc] argument should be overridden to call this function. The @racket[dc] argument should be
canvas's drawing context, and @scheme[str] should be the string to canvas's drawing context, and @racket[str] should be the string to
display on the button. The @scheme[width] and @scheme[height] display on the button. The @racket[width] and @racket[height]
arguments should be the width and height of the button, and the arguments should be the width and height of the button, and the
@scheme[dx] and @scheme[dy] arguments specify an offset into @racket[dx] and @racket[dy] arguments specify an offset into
@scheme[dc] for the button. The @scheme[mouse-over?] argument should @racket[dc] for the button. The @racket[mouse-over?] argument should
be true when the mouse is over the button, and the @scheme[grabbed?] be true when the mouse is over the button, and the @racket[grabbed?]
argument should be true when the button has been pressed. The argument should be true when the button has been pressed. The
@scheme[font] and @scheme[background] arguments supply the font to use @racket[font] and @racket[background] arguments supply the font to use
in drawing (possibly @scheme[normal-control-font]) and the background in drawing (possibly @racket[normal-control-font]) and the background
color to paint (if any). color to paint (if any).
See @scheme[calc-button-min-sizes] for help calculating the min sizes See @racket[calc-button-min-sizes] for help calculating the min sizes
of the button.} of the button.}
@defproc[(pad-xywh [tx number?] @defproc[(pad-xywh [tx number?]