checkpoint mred doc work

svn: r7071
This commit is contained in:
Matthew Flatt 2007-08-09 22:43:41 +00:00
parent 7514daa7b9
commit b771af51a9
8 changed files with 198 additions and 400 deletions

View File

@ -23,26 +23,24 @@ All @scheme[area-container<%>] classes accept the following named
@defmethod[(get-children) @defmethod[(get-children)
list of @scheme[subarea<%>] objects]{ (listof (is-a/c subarea<%>))]{
@spec{
Returns a list of the container's non-deleted children. (The non-deleted Returns a list of the container's non-deleted children. (The non-deleted
children are the ones currently managed by the container; deleted children are the ones currently managed by the container; deleted
children are generally hidden.) The order of the children in the list children are generally hidden.) The order of the children in the list
is significant. For example, in a vertical panel, the first child in is significant. For example, in a vertical panel, the first child in
the list is placed at the top of the panel. the list is placed at the top of the panel.
}} }
@defmethod[(change-children [filter procedure of one argument, a list of \scmintf{subarea} objects, that returns a list of \scmintf{subarea} objects]) @defmethod[(change-children [filter ((listof (is-a/c subarea<%>)) . -> . (listof (is-a/c subarea<%>)))])
void?]{ void?]{
@spec{
Takes a filter procedure and changes the container's list of non-deleted Takes a filter procedure and changes the container's list of
children. The filter procedure takes a list of children areas and non-deleted children. The filter procedure takes a list of
returns a new list of children areas. The new list must consist of children areas and returns a new list of children areas. The new
children that were created as subareas of this area (i.e., list must consist of children that were created as subareas of
@method[area-container<%> change-children] cannot be used to change the parent of a subarea). this area (i.e., @method[area-container<%> change-children]
cannot be used to change the parent of a subarea).
After the set of non-deleted children is changed, the container computes After the set of non-deleted children is changed, the container computes
the sets of newly deleted and newly non-deleted children. Newly deleted the sets of newly deleted and newly non-deleted children. Newly deleted
@ -52,56 +50,59 @@ Since non-window areas cannot be hidden, non-window areas cannot be
deleted. If the filter procedure removes non-window subareas, deleted. If the filter procedure removes non-window subareas,
an exception is raised and the set of non-deleted children is not changed. an exception is raised and the set of non-deleted children is not changed.
}} }
@defmethod[(place-children [info list of list containing two \IntsIn{0}{10000} and two booleans] @defmethod[(place-children [info (listof (list/c (integer-in 0 10000)
(integer-in 0 10000)
any/c
any/c))]
[width (integer-in 0 10000)] [width (integer-in 0 10000)]
[height (integer-in 0 10000)]) [height (integer-in 0 10000)])
list of list containing four \IntsIn{0}{10000}]{ (listof (list/c (integer-in 0 10000)
@spec{ (integer-in 0 10000)
(integer-in 0 10000)
(integer-in 0 10000)))]{
Called to place the children of a container. See @|geomdiscuss| Called to place the children of a container. See @|geomdiscuss|
for more information. for more information.
}} }
@defmethod[(container-size [info list of list containing two \IntsIn{0}{10000} and two booleans]) @defmethod[(container-size [info (listof (list/c (integer-in 0 10000)
two \IntsIn{0}{10000}]{ (integer-in 0 10000)
@spec{ any/c
any/c))])
(values (integer-in 0 10000) (integer-in 0 10000))]{
Called to determine the minimum size of a container. See Called to determine the minimum size of a container. See
@|geomdiscuss| for more information. @|geomdiscuss| for more information.
}} }
@defmethod[(add-child [child (is-a/c subwindow<%>)]) @defmethod[(add-child [child (is-a/c subwindow<%>)])
void?]{ void?]{
@spec{
Add the given subwindow to the set of non-deleted children. See also Add the given subwindow to the set of non-deleted children. See also
@method[area-container<%> change-children]. @method[area-container<%> change-children].
}} }
@defmethod[(delete-child [child (is-a/c subwindow<%>)]) @defmethod[(delete-child [child (is-a/c subwindow<%>)])
void?]{ void?]{
@spec{
Removes the given subwindow from the list of non-deleted children. See also Removes the given subwindow from the list of non-deleted children. See also
@method[area-container<%> change-children]. @method[area-container<%> change-children].
}} }
@defmethod[(after-new-child [child (is-a/c subarea<%>)]) @defmethod[(after-new-child [child (is-a/c subarea<%>)])
void?]{ void?]{
@spec{ @methspec{
This method is called after a new containee area is created with this This method is called after a new containee area is created with this
area as its container. The new child is provided as an argument to area as its container. The new child is provided as an argument to
the method. the method.
} }
@impl{ @methimpl{
Does nothing. Does nothing.
@ -113,64 +114,26 @@ Does nothing.
(integer-in 0 1000)] (integer-in 0 1000)]
[(border [margin (integer-in 0 1000)]) [(border [margin (integer-in 0 1000)])
void?])]{ void?])]{
@spec{
Gets or sets the border margin for the container in pixels. This Gets or sets the border margin for the container in pixels. This
margin is used as an inset into the panel's client area before the margin is used as an inset into the panel's client area before the
locations and sizes of the subareas are computed. locations and sizes of the subareas are computed.
} }
@impl{
First case:
Returns the current border margin.
Second case:
Sets the border margin.
}}
@defmethod*[([(spacing) @defmethod*[([(spacing)
(integer-in 0 1000)] (integer-in 0 1000)]
[(spacing [spacing (integer-in 0 1000)]) [(spacing [spacing (integer-in 0 1000)])
void?])]{ void?])]{
@spec{
Gets or sets the spacing, in pixels, used between subareas in the Gets or sets the spacing, in pixels, used between subareas in the
container. For example, a vertical panel inserts this spacing between container. For example, a vertical panel inserts this spacing between
each pair of vertically aligned subareas (with no extra space at the each pair of vertically aligned subareas (with no extra space at the
top or bottom). top or bottom).
} }
@impl{
First case:
Returns the current spacing.
Second case:
Sets the spacing.
}}
@defmethod[(set-alignment [horiz-align (symbols/c right center left)] @defmethod[(set-alignment [horiz-align (symbols/c right center left)]
[vert-align (symbols/c bottom center top)]) [vert-align (symbols/c bottom center top)])
void?]{ void?]{
@spec{
Sets the alignment specification for a container, which determines how Sets the alignment specification for a container, which determines how
it positions its children when the container has leftover space (when it positions its children when the container has leftover space (when
a child was not stretchable in a particular dimension). a child was not stretchable in a particular dimension).
@ -185,51 +148,46 @@ When the container's horizontal alignment is @scheme['left], the
Similarly, a container's vertical alignment can be @scheme['top], Similarly, a container's vertical alignment can be @scheme['top],
@scheme['center], or @scheme['bottom]. @scheme['center], or @scheme['bottom].
}} }
@defmethod[(get-alignment) @defmethod[(get-alignment)
two symbols]{ (values (symbols/c right center left)
@spec{ (symbols/c bottom center top))]{
Returns the container's current alignment specification. See Returns the container's current alignment specification. See
@method[area-container<%> set-alignment] for more information. @method[area-container<%> set-alignment] for more information.
}} }
@defmethod[(reflow-container) @defmethod[(reflow-container)
void?]{ void?]{
@spec{
When a container window is not shown, changes to the container's set When a container window is not shown, changes to the container's
of children do not necessarily trigger the immediate re-computation set of children do not necessarily trigger the immediate
of the container's size and its children's sizes and positions. re-computation of the container's size and its children's sizes
Instead, the recalculation is delayed until the container is shown, and positions. Instead, the recalculation is delayed until the
which avoids redundant computations between a series of changes. The container is shown, which avoids redundant computations between a
@method[area-container<%> reflow-container] method forces the immediate recalculation of the container's and its series of changes. The @method[area-container<%>
children's sizes and locations. reflow-container] method forces the immediate recalculation of
the container's and its children's sizes and locations.
Immediately after calling the Immediately after calling the @method[area-container<%>
@method[area-container<%> reflow-container] method, reflow-container] method, @method[window<%> get-size],
@method[window<%> get-size], @method[window<%> get-client-size], @method[window<%> get-width],
@method[window<%> get-client-size], @method[window<%> get-height], @method[window<%> get-x], and
@method[window<%> get-width], @method[window<%> get-y] report the manager-applied sizes and
@method[window<%> get-height], locations for the container and its children, even when the
@method[window<%> get-x], and container is hidden. A container implementation can call
@method[window<%> get-y] report the manager-applied sizes and locations for the container and functions such as @method[window<%> get-size] at any time to
its children, even when the container is hidden. A obtain the current state of a window (because the functions do
container implementation can call functions such as not trigger geometry management).
@method[window<%> get-size] at any time to obtain the current state of a window (because the
functions do not trigger geometry management).
See also See also @method[area-container<%> container-flow-modified].
@method[area-container<%> container-flow-modified].
}} }
@defmethod[(container-flow-modified) @defmethod[(container-flow-modified)
void?]{ void?]{
@spec{
Call this method when the result changes for an overridden flow-defining method, such as Call this method when the result changes for an overridden flow-defining method, such as
@method[area-container<%> place-children]. The call notifies the geometry manager that the placement of the @method[area-container<%> place-children]. The call notifies the geometry manager that the placement of the
container's children needs to be recomputed. container's children needs to be recomputed.
@ -238,12 +196,10 @@ The
@method[area-container<%> reflow-container]method only recomputes child positions when the geometry manager @method[area-container<%> reflow-container]method only recomputes child positions when the geometry manager
thinks that the placement has changed since the last computation. thinks that the placement has changed since the last computation.
}} }
@defmethod[(begin-container-sequence) @defmethod[(begin-container-sequence)
void?]{ void?]{
@spec{
Suspends geometry management in the container's top-level window Suspends geometry management in the container's top-level window
until until
@method[area-container<%> end-container-sequence] is called. The @method[area-container<%> end-container-sequence] is called. The
@ -255,20 +211,13 @@ Suspends geometry management in the container's top-level window
@method[window<%> show] until the sequence is complete. Sequence begin and end commands may @method[window<%> show] until the sequence is complete. Sequence begin and end commands may
be nested arbitrarily deep. be nested arbitrarily deep.
}} }
@defmethod[(end-container-sequence) @defmethod[(end-container-sequence)
void?]{ void?]{
@spec{
See See
@method[area-container<%> begin-container-sequence]. @method[area-container<%> begin-container-sequence].
} }}
@impl{
}}}

View File

@ -3,6 +3,6 @@
@definterface[area-container-window<%> (area-container<%> window<%>)]{ @definterface[area-container-window<%> (area-container<%> window<%>)]{
Combines two interfaces.
} }

View File

@ -26,34 +26,31 @@ All @scheme[area<%>] classes accept the following named instantiation
@defmethod[(get-parent) @defmethod[(get-parent)
(or/c (is-a/c area-container<%>) false/c)]{ (or/c (is-a/c area-container<%>) false/c)]{
@spec{
Returns the area's parent. A top-level window may have no parent (in Returns the area's parent. A top-level window may have no parent (in
which case @scheme[#f] is returned), or it may have another top-level which case @scheme[#f] is returned), or it may have another top-level
window as its parent. window as its parent.
}} }
@defmethod[(get-top-level-window) @defmethod[(get-top-level-window)
@scheme[frame%] or @scheme[dialog%] object]{ (or/c (is-a/c frame%) (is-a/c dialog))]{
@spec{
Returns the area's closest frame or dialog ancestor. For a frame or Returns the area's closest frame or dialog ancestor. For a frame or
dialog area, the frame or dialog itself is returned. dialog area, the frame or dialog itself is returned.
}} }
@defmethod*[([(min-width) @defmethod*[([(min-width)
(integer-in 0 10000)] (integer-in 0 10000)]
[(min-width [w (integer-in 0 10000)]) [(min-width [w (integer-in 0 10000)])
void?])]{ void?])]{
@spec{
Gets or sets the area's minimum width (in pixels) for geometry Gets or sets the area's minimum width (in pixels) for geometry
management. management.
The minimum width is ignored when it is smaller than the area's The minimum width is ignored when it is smaller than the area's
\DefinedElsewhere{minimum graphical width}, or when it is smaller @tech{graphical minimum width}, or when it is smaller
than the width reported by than the width reported by
@method[area-container<%> container-size] if the area is a container. See @|geomdiscuss| for more information. @method[area-container<%> container-size] if the area is a container. See @|geomdiscuss| for more information.
@ -61,35 +58,20 @@ An area's initial minimum width is its graphical minimum width. See
also also
@method[area<%> get-graphical-min-size] . @method[area<%> get-graphical-min-size] .
When setting the minimum width, if @scheme[w] is smaller than the
internal hard minimum, @|MismatchExn|.
} }
@impl{
First case:
Returns the current minimum width (in pixels).
Second case:
Sets the minimum width (in pixels); if @scheme[w] is smaller than the
internal hard minimum, @|MismatchExn|}.
}}
@defmethod*[([(min-height) @defmethod*[([(min-height)
(integer-in 0 10000)] (integer-in 0 10000)]
[(min-height [h (integer-in 0 10000)]) [(min-height [h (integer-in 0 10000)])
void?])]{ void?])]{
@spec{
Gets or sets the area's minimum height for geometry management. Gets or sets the area's minimum height for geometry management.
The minimum height is ignored when it is smaller than the area's The minimum height is ignored when it is smaller than the area's
\DefinedElsewhere{minimum graphical height}, or when it is smaller @tech{graphical minimum height}, or when it is smaller
than the height reported by than the height reported by
@method[area-container<%> container-size] if the area is a container. See @|geomdiscuss| for more information. @method[area-container<%> container-size] if the area is a container. See @|geomdiscuss| for more information.
@ -97,91 +79,41 @@ An area's initial minimum height is its graphical minimum height. See
also also
@method[area<%> get-graphical-min-size] . @method[area<%> get-graphical-min-size] .
When setting the minimum height (in pixels); if @scheme[h] is smaller
than the internal hard minimum, @|MismatchExn|.
} }
@impl{
First case:
Returns the current minimum height (in pixels).
Second case:
Sets the minimum height (in pixels); if @scheme[h] is smaller than the
internal hard minimum, @|MismatchExn|}.
}}
@defmethod[(get-graphical-min-size) @defmethod[(get-graphical-min-size)
two \IntsIn{0}{10000}]{ (values (integer-in 0 10000)
@spec{ (integer-in 0 10000))]{
Returns the area's graphical minimum size as two values: the minimum Returns the area's graphical minimum size as two values: the minimum
width and the minimum height (in pixels). width and the minimum height (in pixels).
See @|geomdiscuss| for more information. Note that the return value See @|geomdiscuss| for more information. Note that the return value
{\em does not} depend on the area's @italic{does not} depend on the area's
@method[area<%> min-width] and @method[area<%> min-width] and
@method[area<%> min-height] settings. @method[area<%> min-height] settings.
}} }
@defmethod*[([(stretchable-width) @defmethod*[([(stretchable-width)
boolean?] boolean?]
[(stretchable-width [stretch? any/c]) [(stretchable-width [stretch? any/c])
void?])]{ void?])]{
@spec{
Gets or sets the area's horizontal stretchability for geometry Gets or sets the area's horizontal stretchability for geometry
management. See @|geomdiscuss| for more information. management. See @|geomdiscuss| for more information.
} }
@impl{
First case:
Returns the current horizontal stretchability.
Second case:
Sets the horizontal stretchability.
}}
@defmethod*[([(stretchable-height) @defmethod*[([(stretchable-height)
boolean?] boolean?]
[(stretchable-height [stretch? any/c]) [(stretchable-height [stretch? any/c])
void?])]{ void?])]{
@spec{
Gets or sets the area's vertical stretchability for geometry Gets or sets the area's vertical stretchability for geometry
management. See @|geomdiscuss| for more information. management. See @|geomdiscuss| for more information.
} }}
@impl{
First case:
Returns the current vertical stretchability.
Second case:
Sets the vertical stretchability.
}}}

View File

@ -8,21 +8,22 @@ Whenever a button is clicked by the user, the buttons's callback
procedure is invoked. A callback procedure is provided as an procedure is invoked. A callback procedure is provided as an
initialization argument when each button is created. initialization argument when each button is created.
@defconstructor[[label (or/c label-string? (is-a/c bitmap%))] @defconstructor[([label (or/c label-string? (is-a/c bitmap%))]
[parent (or/c (is-a/c frame%) (is-a/c dialog%) (is-a/c panel%) (is-a/c pane%))] [parent (or/c (is-a/c frame%) (is-a/c dialog%)
[callback ((is-a/c button%) (is-a/c control-event%) . -> . any) (lambda (b e) (void))] (is-a/c panel%) (is-a/c pane%))]
[style (symbols/c deleted border) null] [callback ((is-a/c button%) (is-a/c control-event%) . -> . any) (lambda (b e) (void))]
[font (is-a/c font%) @scheme[normal-control-font]] [style (symbols/c deleted border) null]
[enabled any/c #t] [font (is-a/c font%) @scheme[normal-control-font]]
[vert-margin (integer-in 0 1000) 2] [enabled any/c #t]
[horiz-margin (integer-in 0 1000) 2] [vert-margin (integer-in 0 1000) 2]
[min-width (integer-in 0 10000) @italic{graphical minimum width}] [horiz-margin (integer-in 0 1000) 2]
[min-height (integer-in 0 10000) @italic{graphical minimum height}] [min-width (integer-in 0 10000) _graphical-minimum-width]
[stretchable-width any/c #f] [min-height (integer-in 0 10000) _graphical-minimum-height]
[stretchable-height any/c #f]]{ [stretchable-width any/c #f]
[stretchable-height any/c #f])]{
Creates a button with a string or bitmap label. Creates a button with a string or bitmap label.
label @bitmaplabeluse[label]
@labelstripped[(scheme label) @elem{ (when @scheme[label] is a string)} @elem{effectively click the button}] @labelstripped[(scheme label) @elem{ (when @scheme[label] is a string)} @elem{effectively click the button}]
@ -32,7 +33,7 @@ The @scheme[callback] procedure is called (with the event type
If @scheme[style] includes @scheme['border], the button is drawn with If @scheme[style] includes @scheme['border], the button is drawn with
a special border that indicates to the user that it is the default a special border that indicates to the user that it is the default
action button (see @method[top-level-window<%> action button (see @method[top-level-window<%>
on-traverse-char]). \DeletedStyleNote{button} on-traverse-char]). @DeletedStyleNote{button}
@FontKWs[] @WindowKWs[] @SubareaKWs[] @AreaKWs[]} @FontKWs[] @WindowKWs[] @SubareaKWs[] @AreaKWs[]}
@ -40,10 +41,9 @@ on-traverse-char]). \DeletedStyleNote{button}
@defmethod[#:mode 'add @defmethod[#:mode 'add
(set-label [label (is-a/c bitmap%)]) (set-label [label (is-a/c bitmap%)])
void?]{ void?]{
@impl{
Sets the bitmap label for a bitmap button. @bitmaplabeluseisbm[label] Sets the bitmap label for a bitmap button. @bitmaplabeluseisbm[label]
@|bitmapiforiglabel| @|bitmapiforiglabel|
}}} }}

View File

@ -21,24 +21,17 @@ The @scheme[control<%>] interface is implemented by the built-in
@defmethod[(command [event (is-a/c control-event%)]) @defmethod[(command [event (is-a/c control-event%)])
void?]{ void?]{
@spec{
Calls the control's callback function, passing on the given Calls the control's callback function, passing on the given
@scheme[control-event%] object. @scheme[control-event%] object.
}} }
@defmethod[(get-font) @defmethod[(get-font)
(is-a/c font%)]{ (is-a/c font%)]{
@spec{
Returns the font used for the control, which is optionally supplied Returns the font used for the control, which is optionally supplied
when a control is created. when a control is created.
} }}
@impl{
}}}

View File

@ -26,55 +26,21 @@ All @scheme[subarea<%>] classes accept the following named
(integer-in 0 1000)] (integer-in 0 1000)]
[(horiz-margin [margin (integer-in 0 1000)]) [(horiz-margin [margin (integer-in 0 1000)])
void?])]{ void?])]{
@spec{
Gets or sets the area's horizontal margin, which is added both to the Gets or sets the area's horizontal margin, which is added both to the
right and left, for geometry management. See @|geomdiscuss| for more right and left, for geometry management. See @|geomdiscuss| for more
information. information.
} }
@impl{
First case:
Returns the current horizontal margin.
Second case:
Sets the horizontal margin.
}}
@defmethod*[([(vert-margin) @defmethod*[([(vert-margin)
(integer-in 0 1000)] (integer-in 0 1000)]
[(vert-margin [margin (integer-in 0 1000)]) [(vert-margin [margin (integer-in 0 1000)])
void?])]{ void?])]{
@spec{
Gets or sets the area's vertical margin, which is added both to the Gets or sets the area's vertical margin, which is added both to the
right and left, for geometry management. See @|geomdiscuss| for more top and bottom, for geometry management. See @|geomdiscuss| for more
information. information.
} }}
@impl{
First case:
Returns the current vertical margin.
Second case:
Sets the vertical margin.
}}}

View File

@ -20,18 +20,17 @@ All @scheme[window<%>] classes accept the following named instantiation
@defmethod[(on-focus [on? any/c]) @defmethod[(on-focus [on? any/c])
void?]{ void?]{
@spec{ @methspec{
\index{keyboard focus!notification} @index['("keyboard focus" "notification")]{Called} when a window
Called when a window receives or loses the keyboard focus. If the receives or loses the keyboard focus. If the argument is @scheme[#t],
argument is @scheme[#t], the keyboard focus was received, otherwise it the keyboard focus was received, otherwise it was lost.
was lost.
Note that under X, keyboard focus can move to the menu bar Note that under X, keyboard focus can move to the menu bar
when the user is selecting a menu item. when the user is selecting a menu item.
} }
@impl{ @methimpl{
Does nothing. Does nothing.
@ -42,14 +41,14 @@ Does nothing.
@defmethod[(on-size [width (integer-in 0 10000)] @defmethod[(on-size [width (integer-in 0 10000)]
[height (integer-in 0 10000)]) [height (integer-in 0 10000)])
void?]{ void?]{
@spec{ @methspec{
Called when the window is resized. The window's new size (in pixels) Called when the window is resized. The window's new size (in pixels)
is provided to the method. The size values are for the entire window, is provided to the method. The size values are for the entire window,
not just the client area. not just the client area.
} }
@impl{ @methimpl{
Does nothing. Does nothing.
@ -60,14 +59,14 @@ Does nothing.
@defmethod[(on-move [x (integer-in -10000 10000)] @defmethod[(on-move [x (integer-in -10000 10000)]
[y (integer-in -10000 10000)]) [y (integer-in -10000 10000)])
void?]{ void?]{
@spec{ @methspec{
Called when the window is moved. (For windows that are not top-level Called when the window is moved. (For windows that are not top-level
windows, ``moved'' means moved relative to the parent's top-left windows, ``moved'' means moved relative to the parent's top-left
corner.) The new position is provided to the method. corner.) The new position is provided to the method.
} }
@impl{ @methimpl{
Does nothing. Does nothing.
@ -78,7 +77,7 @@ Does nothing.
@defmethod[(on-subwindow-char [receiver (is-a/c window<%>)] @defmethod[(on-subwindow-char [receiver (is-a/c window<%>)]
[event (is-a/c key-event%)]) [event (is-a/c key-event%)])
boolean?]{ boolean?]{
@spec{ @methspec{
Called when this window or a child window receives a keyboard event. Called when this window or a child window receives a keyboard event.
The The
@ -97,20 +96,20 @@ BEWARE: The default
reach the ``receiver'' child unless the default frame or dialog reach the ``receiver'' child unless the default frame or dialog
method is overridden. method is overridden.
}
@impl{
The @scheme[event] argument is the event that was generated for the The @scheme[event] argument is the event that was generated for the
@scheme[receiver] window. Returns @scheme[#f]. @scheme[receiver] window.
}
@methimpl{
Returns @scheme[#f].
}} }}
@defmethod[(on-subwindow-event [receiver (is-a/c window<%>)] @defmethod[(on-subwindow-event [receiver (is-a/c window<%>)]
[event (is-a/c mouse-event%)]) [event (is-a/c mouse-event%)])
boolean?]{ boolean?]{
@spec{ @methspec{
Called when this window or a child window receives a mouse event. Called when this window or a child window receives a mouse event.
The The
@ -121,29 +120,28 @@ Called when this window or a child window receives a mouse event.
@method[window<%> on-subwindow-event] method returns @scheme[#f], the event is passed on to the @method[window<%> on-subwindow-event] method returns @scheme[#f], the event is passed on to the
receiver's normal mouse-handling mechanism. receiver's normal mouse-handling mechanism.
}
@impl{
The @scheme[event] argument is the event that was generated for the The @scheme[event] argument is the event that was generated for the
@scheme[receiver] window. Returns @scheme[#f]. @scheme[receiver] window.
}
@methimpl{
Returns @scheme[#f].
}} }}
@defmethod[(client->screen [x (integer-in -10000 10000)] @defmethod[(client->screen [x (integer-in -10000 10000)]
[y (integer-in -10000 10000)]) [y (integer-in -10000 10000)])
two \IntsIn{-10000}{10000}]{ (values (integer-in -10000 10000)
@spec{ (integer-in -10000 10000))]{
\index{global coordinates} @index["global coordinates"]{Converts} local window coordinates to
Converts local window coordinates to screen coordinates. screen coordinates.
}} }
@defmethod[(enable [enable? any/c]) @defmethod[(enable [enable? any/c])
void?]{ void?]{
@spec{
Enables or disables a window so that input events are ignored. (Input Enables or disables a window so that input events are ignored. (Input
events include mouse events, keyboard events, and close-box clicks, events include mouse events, keyboard events, and close-box clicks,
@ -152,29 +150,21 @@ Enables or disables a window so that input events are ignored. (Input
@MonitorMethod[@elem{The enable state of a window} @elem{enabling a parent window} @elem{@method[window<%> on-superwindow-enable]} @elem{enable state}] @MonitorMethod[@elem{The enable state of a window} @elem{enabling a parent window} @elem{@method[window<%> on-superwindow-enable]} @elem{enable state}]
}
@impl{
If @scheme[enable?] is true, the window is enabled, otherwise it is If @scheme[enable?] is true, the window is enabled, otherwise it is
disabled. disabled.
}
}}
@defmethod[(is-enabled?) @defmethod[(is-enabled?)
boolean?]{ boolean?]{
@spec{
Returns @scheme[#t] if the window is enabled when all of its ancestors Returns @scheme[#t] if the window is enabled when all of its ancestors
are enabled, @scheme[#f] otherwise. are enabled, @scheme[#f] otherwise.
}} }
@defmethod[(on-superwindow-enable [enabled? any/c]) @defmethod[(on-superwindow-enable [enabled? any/c])
void?]{ void?]{
@spec{
Called via the event queue whenever the enable state of a window has Called via the event queue whenever the enable state of a window has
changed, either through a call to the window's changed, either through a call to the window's
@ -195,33 +185,30 @@ If the enable state of a window's ancestor changes while the window is
different from the window's state when it was de-activated, then an different from the window's state when it was de-activated, then an
enable event is immediately queued. enable event is immediately queued.
}} }
@defmethod[(get-width) @defmethod[(get-width)
(integer-in 0 10000)]{ (integer-in 0 10000)]{
@spec{
Returns the window's current total width (in pixels). Returns the window's current total width (in pixels).
See also See also
@method[area-container<%> reflow-container]. @method[area-container<%> reflow-container].
}} }
@defmethod[(get-height) @defmethod[(get-height)
(integer-in 0 10000)]{ (integer-in 0 10000)]{
@spec{
Returns the window's total height (in pixels). Returns the window's total height (in pixels).
See also See also
@method[area-container<%> reflow-container]. @method[area-container<%> reflow-container].
}} }
@defmethod[(get-x) @defmethod[(get-x)
(integer-in -10000 10000)]{ (integer-in -10000 10000)]{
@spec{
Returns the position of the window's left edge in its Returns the position of the window's left edge in its
parent's coordinate system. parent's coordinate system.
@ -229,11 +216,10 @@ Returns the position of the window's left edge in its
See also See also
@method[area-container<%> reflow-container]. @method[area-container<%> reflow-container].
}} }
@defmethod[(get-y) @defmethod[(get-y)
(integer-in -10000 10000)]{ (integer-in -10000 10000)]{
@spec{
Returns the position of the window's top edge in its Returns the position of the window's top edge in its
parent's coordinate system. parent's coordinate system.
@ -241,11 +227,10 @@ Returns the position of the window's top edge in its
See also See also
@method[area-container<%> reflow-container]. @method[area-container<%> reflow-container].
}} }
@defmethod[(get-label) @defmethod[(get-label)
(or/c {\labelstring}, @scheme[bitmap%] object, @scheme['app], @scheme['caution], @scheme['stop], false/c)]{ (or/c {\labelstring}, @scheme[bitmap%] object, @scheme['app], @scheme['caution], @scheme['stop], false/c)]{
@spec{
Gets a window's label, if any. Control windows generally display their Gets a window's label, if any. Control windows generally display their
label in some way. Frames and dialogs display their label as a window label in some way. Frames and dialogs display their label as a window
@ -268,66 +253,59 @@ The label string may contain ampersands (``\&''), which serve as
If the window does not have a label, @scheme[#f] is returned. If the window does not have a label, @scheme[#f] is returned.
}} }
@defmethod[(set-label [l label-string?]) @defmethod[(set-label [l label-string?])
void?]{ void?]{
@spec{
Sets a window's label. The window's natural minimum size might be Sets a window's label. The window's natural minimum size might be
different after the label is changed, but the window's minimum size different after the label is changed, but the window's minimum size
is not recomputed. is not recomputed.
If the window was not created with a label, or if the window was
created with a non-string label, @scheme[l] is ignored.
See See
@method[window<%> get-label] for more information. @method[window<%> get-label] for more information.
} }
@impl{
If the window was not created with a label, or if the window was
created with a non-string label, @scheme[l] is ignored.
}}
@defmethod[(get-plain-label) @defmethod[(get-plain-label)
(or/c string false/c)]{ (or/c string false/c)]{
@spec{
Like Like
@method[window<%> get-label], except that ampersands in the label are removed. If the window has @method[window<%> get-label], except that ampersands in the label are removed. If the window has
no label or the window's no label or the window's
label is not a string, @scheme[#f] is returned. label is not a string, @scheme[#f] is returned.
}
}}
@defmethod[(get-handle) @defmethod[(get-handle)
exact integer]{ exact-integer?]{
@spec{
Returns an exact integer representing a handle to the window in the Returns an exact integer representing a handle to the window in the
current platform's GUI toolbox. Cast this number from a C \cpp{long} current platform's GUI toolbox. Cast this number from a C \cpp{long}
to a platform-specific C type: to a platform-specific C type:
@itemize{ @itemize{
@item{Windows: \cpp{HWND}} @item{Windows: @tt{HWND}}
@item{Mac OS X: \cpp{WindowRef} for a @scheme[top-level-window<%>] object, @item{Mac OS X: @tt{WindowRef} for a @scheme[top-level-window<%>] object,
\cpp{ControlRef} for other windows} @tt{ControlRef} for other windows}
@item{X: \cpp{Widget*}} @item{X: @tt{Widget*}}
} }
Some windows may not have a representation in the platform's GUI level, Some windows may not have a representation in the platform's GUI level,
in which case the result of this method is @scheme[0]. in which case the result of this method is @scheme[0].
}} }
@defmethod[(get-size) @defmethod[(get-size)
two \IntsIn{0}{10000}]{ (values (integer-in 0 10000)
@spec{ (integer-in 0 10000))]{
Gets the current size of the entire window in pixels, not counting Gets the current size of the entire window in pixels, not counting
horizontal and vertical margins. (Under X, this size does not include horizontal and vertical margins. (Under X, this size does not include
@ -339,11 +317,11 @@ The geometry is returned as two values: width and height (in pixels).
See also See also
@method[area-container<%> reflow-container]. @method[area-container<%> reflow-container].
}} }
@defmethod[(get-client-size) @defmethod[(get-client-size)
two \IntsIn{0}{10000}]{ (values (integer-in 0 10000)
@spec{ (integer-in 0 10000))]{
Gets the interior size of the window in pixels. For a container, the Gets the interior size of the window in pixels. For a container, the
interior size is the size available for placing subwindows (including interior size is the size available for placing subwindows (including
@ -355,38 +333,35 @@ The client size is returned as two values: width and height (in pixels).
See also See also
@method[area-container<%> reflow-container]. @method[area-container<%> reflow-container].
}
}}
@defmethod[(refresh) @defmethod[(refresh)
void?]{ void?]{
@spec{
Enqueues an event to repaint the window. Enqueues an event to repaint the window.
}} }
@defmethod[(screen->client [x (integer-in -10000 10000)] @defmethod[(screen->client [x (integer-in -10000 10000)]
[y (integer-in -10000 10000)]) [y (integer-in -10000 10000)])
two \IntsIn{-10000}{10000}]{ (values (integer-in -10000 10000)
@spec{ (integer-in -10000 10000))]{
\index{global coordinates} @index["global coordinates"]{Converts} global coordinates to window
Converts global coordinates to window local coordinates. local coordinates.
}} }
@defmethod[(focus) @defmethod[(focus)
void?]{ void?]{
@spec{
\index{keyboard focus!setting} @index['("keyboard focus" "setting")]{Moves} the keyboard focus to the
Moves the keyboard focus to the window, relative to its top-level window, relative to its top-level window, if the window ever accepts
window, if the window ever accepts the keyboard focus. the keyboard focus. If the focus is in the window's top-level
If the focus is in the window's top-level window, then the window, then the focus is immediately moved to this
focus is immediately moved to this window. Otherwise, the focus is window. Otherwise, the focus is not immediately moved, but when the
not immediately moved, but when the window's top-level window gets window's top-level window gets the keyboard focus, the focus is
the keyboard focus, the focus is delegated to this window. delegated to this window.
See also See also
@method[window<%> on-focus]. @method[window<%> on-focus].
@ -396,39 +371,31 @@ Note that under X, keyboard focus can move to the menu bar
@MonitorMethod[@elem{The current keyboard focus window} @elem{the user} @elem{@method[window<%> on-focus]} @elem{focus}] @MonitorMethod[@elem{The current keyboard focus window} @elem{the user} @elem{@method[window<%> on-focus]} @elem{focus}]
}} }
@defmethod[(has-focus?) @defmethod[(has-focus?)
boolean?]{ boolean?]{
@spec{
Indicates whether the window currently has the keyboard focus. See Indicates whether the window currently has the keyboard focus. See
also also
@method[window<%> on-focus]. @method[window<%> on-focus].
}} }
@defmethod[(popup-menu [menu (is-a/c popup-menu%)] @defmethod[(popup-menu [menu (is-a/c popup-menu%)]
[x (integer-in 0 10000)] [x (integer-in 0 10000)]
[y (integer-in 0 10000)]) [y (integer-in 0 10000)])
void?]{ void?]{
@spec{
\popupmenuinfo{window}{window}{} @popupmenuinfo["window" "window" ""]
}
@impl{
The @scheme[menu] is popped up within the window at position The @scheme[menu] is popped up within the window at position
(@scheme[x], @scheme[y]). (@scheme[x], @scheme[y]).
}
}}
@defmethod[(set-cursor [cursor (or/c (is-a/c cursor%) false/c)]) @defmethod[(set-cursor [cursor (or/c (is-a/c cursor%) false/c)])
void?]{ void?]{
@spec{
Sets the window's cursor. Providing @scheme[#f] instead of a cursor Sets the window's cursor. Providing @scheme[#f] instead of a cursor
value removes the window's cursor. value removes the window's cursor.
@ -438,39 +405,31 @@ If a window does not have a cursor, it uses the cursor of its parent.
fields start with an I-beam cursor. All other windows are created fields start with an I-beam cursor. All other windows are created
without a cursor. without a cursor.
}} }
@defmethod[(get-cursor) @defmethod[(get-cursor)
(or/c (is-a/c cursor%) false/c)]{ (or/c (is-a/c cursor%) false/c)]{
@spec{
Returns the window's cursor, or @scheme[#f] if this window's cursor Returns the window's cursor, or @scheme[#f] if this window's cursor
defaults to the parent's cursor. See defaults to the parent's cursor. See
@method[window<%> set-cursor] for more information. @method[window<%> set-cursor] for more information.
}} }
@defmethod[(show [show? any/c]) @defmethod[(show [show? any/c])
void?]{ void?]{
@spec{
Shows or hides a window. Shows or hides a window.
@MonitorMethod[@elem{The visibility of a window} @elem{the user clicking the window's close box, for example} @elem{@method[window<%> on-superwindow-show] or @method[top-level-window<%> on-close]} @elem{visibility}] @MonitorMethod[@elem{The visibility of a window} @elem{the user clicking the window's close box, for example} @elem{@method[window<%> on-superwindow-show] or @method[top-level-window<%> on-close]} @elem{visibility}]
}
@impl{
If @scheme[show?] is @scheme[#f], the window is hidden. Otherwise, the If @scheme[show?] is @scheme[#f], the window is hidden. Otherwise, the
window is shown. window is shown.
}
}}
@defmethod[(is-shown?) @defmethod[(is-shown?)
boolean?]{ boolean?]{
@spec{
Indicates whether the window is currently shown or not (when Indicates whether the window is currently shown or not (when
all of its ancestors are also shown). all of its ancestors are also shown).
@ -479,11 +438,10 @@ The result is @scheme[#t] if this window is shown when its ancestors are
shown, or @scheme[#f] if this window remains hidden when its ancestors shown, or @scheme[#f] if this window remains hidden when its ancestors
are shown. are shown.
}} }
@defmethod[(on-superwindow-show [shown? any/c]) @defmethod[(on-superwindow-show [shown? any/c])
void?]{ void?]{
@spec{
Called via the event queue whenever the visibility of a window has Called via the event queue whenever the visibility of a window has
changed, either through a call to the window's changed, either through a call to the window's
@ -499,17 +457,15 @@ This method is not called when the window is initially created; it is
the window and it reverts its visibility before the event is the window and it reverts its visibility before the event is
dispatched, then the dispatch is canceled. dispatched, then the dispatch is canceled.
}} }
@defmethod[(on-drop-file [pathname path]) @defmethod[(on-drop-file [pathname path])
void?]{ void?]{
@spec{
\index{drag-and-drop} @index["drag-and-drop"]{Called} when the user drags a file onto the
Called when the user drags a file onto the window.\footnote{Under X, window. (Under X, drag-and-drop is supported via the XDND
drag-and-drop is supported via the XDND protocol.} Drag-and-drop protocol.) Drag-and-drop must first be enabled for the window with
must first be enabled for the window with @method[window<%> accept-drop-files].
@method[window<%> accept-drop-files].
Under Mac OS X, when the application is running and user Under Mac OS X, when the application is running and user
double-clicks an application-handled file or drags a file onto the double-clicks an application-handled file or drags a file onto the
@ -522,37 +478,15 @@ Under Mac OS X, when the application is running and user
thread). When the application is not running, the filenames are thread). When the application is not running, the filenames are
provided as command-line arguments. provided as command-line arguments.
}} }
@defmethod*[([(accept-drop-files) @defmethod*[([(accept-drop-files)
boolean?] boolean?]
[(accept-drop-files [accept-files? any/c]) [(accept-drop-files [accept-files? any/c])
void?])]{ void?])]{
@spec{
\index{drag-and-drop} @index["drag-and-drop"]{Enables} or disables drag-and-drop dropping
Enables or disables drag-and-drop dropping for the window, for the window, or gets the enable state. Dropping is initially
or gets the enable disabled. See also @method[window<%> on-drop-file].
state. Dropping is initially disabled. See also }}
@method[window<%> on-drop-file].
}
@impl{
First case:
Returns @scheme[#t] if file-dropping is enabled, @scheme[#f] otherwise.
Second case:
Enables file-dropping if @scheme[accept-files?] is true, disables
file-dropping otherwise.
}}}

View File

@ -7,6 +7,30 @@ The windowing toolbox.
@local-table-of-contents[] @local-table-of-contents[]
@require["area-intf.scrbl"]
@include-class[area<%>]
@require["area-container-intf.scrbl"]
@include-class[area-container<%>]
@require["area-container-window-intf.scrbl"]
@include-class[area-container-window<%>]
@require["button-class.scrbl"]
@include-class[button%]
@require["control-intf.scrbl"]
@include-class[control<%>]
@require["subarea-intf.scrbl"]
@include-class[subarea<%>]
@require["subwindow-intf.scrbl"]
@include-class[subwindow<%>]
@require["window-intf.scrbl"]
@include-class[window<%>]
@include-section["dialog-funcs.scrbl"] @include-section["dialog-funcs.scrbl"]
@include-section["eventspace-funcs.scrbl"] @include-section["eventspace-funcs.scrbl"]
@include-section["system-menu-funcs.scrbl"] @include-section["system-menu-funcs.scrbl"]