Logical markup.

Fix a few things for the conversion to structured markup.

Removed texinfo special cases, since there's likely a new info
process.
This commit is contained in:
Fred Drake 1998-11-25 22:38:24 +00:00
parent f65e323101
commit 4471f20ed4

View file

@ -15,16 +15,16 @@ under X11, Win32 for Windows and Windows NT, and a collection of
native toolkit interfaces for the Macintosh. native toolkit interfaces for the Macintosh.
\section{\module{stdwin} --- \section{\module{stdwin} ---
None} Platform-independent GUI System}
\declaremodule{builtin}{stdwin} \declaremodule{builtin}{stdwin}
\modulesynopsis{None} \modulesynopsis{Older GUI system for X11 and Macintosh}
This module defines several new object types and functions that This module defines several new object types and functions that
provide access to the functionality of STDWIN. provide access to the functionality of STDWIN.
On \UNIX{} running X11, it can only be used if the \code{DISPLAY} On \UNIX{} running X11, it can only be used if the \envvar{DISPLAY}
environment variable is set or an explicit \samp{-display environment variable is set or an explicit \samp{-display
\var{displayname}} argument is passed to the Python interpreter. \var{displayname}} argument is passed to the Python interpreter.
@ -38,7 +38,7 @@ of STDWIN for C programmers (aforementioned CWI report).
\subsection{Functions Defined in Module \module{stdwin}} \subsection{Functions Defined in Module \module{stdwin}}
\nodename{STDWIN Functions} \nodename{STDWIN Functions}
The following functions are defined in the \code{stdwin} module: The following functions are defined in the \module{stdwin} module:
\begin{funcdesc}{open}{title} \begin{funcdesc}{open}{title}
Open a new window whose initial title is given by the string argument. Open a new window whose initial title is given by the string argument.
@ -56,8 +56,7 @@ the event applies, or
if it applies to no window in particular; if it applies to no window in particular;
the third element is type-dependent. the third element is type-dependent.
Names for event types and command codes are defined in the standard Names for event types and command codes are defined in the standard
module module \module{stdwinevent}.
\code{stdwinevent}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{pollevent}{} \begin{funcdesc}{pollevent}{}
@ -154,10 +153,10 @@ Return the pixel value of the current default background color.
\begin{funcdesc}{setfont}{fontname} \begin{funcdesc}{setfont}{fontname}
Set the current default font. Set the current default font.
This will become the default font for windows opened subsequently, This will become the default font for windows opened subsequently,
and is also used by the text measuring functions \code{textwidth}, and is also used by the text measuring functions \function{textwidth()},
\code{textbreak}, \code{lineheight} and \code{baseline} below. \function{textbreak()}, \function{lineheight()} and
This accepts two more optional parameters, size and style: \function{baseline()} below. This accepts two more optional
Size is the font size (in `points'). parameters, size and style: Size is the font size (in `points').
Style is a single character specifying the style, as follows: Style is a single character specifying the style, as follows:
\code{'b'} = bold, \code{'b'} = bold,
\code{'i'} = italic, \code{'i'} = italic,
@ -173,7 +172,7 @@ Create a menu object referring to a global menu (a menu that appears in
all windows). all windows).
Methods of menu objects are described below. Methods of menu objects are described below.
Note: normally, menus are created locally; see the window method Note: normally, menus are created locally; see the window method
\code{menucreate} below. \method{menucreate()} below.
\strong{Warning:} the menu only appears in a window as long as the object \strong{Warning:} the menu only appears in a window as long as the object
returned by this call exists. returned by this call exists.
\end{funcdesc} \end{funcdesc}
@ -196,78 +195,53 @@ The user must click OK before the function returns.
\begin{funcdesc}{askync}{prompt, default} \begin{funcdesc}{askync}{prompt, default}
Display a dialog that prompts the user to answer a question with yes or Display a dialog that prompts the user to answer a question with yes or
no. no. Return 0 for no, 1 for yes. If the user hits the Return key, the
Return 0 for no, 1 for yes. default (which must be 0 or 1) is returned. If the user cancels the
If the user hits the Return key, the default (which must be 0 or 1) is dialog, \exception{KeyboardInterrupt} is raised.
returned.
If the user cancels the dialog, the
\code{KeyboardInterrupt}
exception is raised.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{askstr}{prompt, default} \begin{funcdesc}{askstr}{prompt, default}
Display a dialog that prompts the user for a string. Display a dialog that prompts the user for a string.
If the user hits the Return key, the default string is returned. If the user hits the Return key, the default string is returned.
If the user cancels the dialog, the If the user cancels the dialog, \exception{KeyboardInterrupt} is
\code{KeyboardInterrupt} raised.
exception is raised.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{askfile}{prompt, default, new} \begin{funcdesc}{askfile}{prompt, default, new}
Ask the user to specify a filename. Ask the user to specify a filename. If \var{new} is zero it must be
If an existing file; otherwise, it must be a new file. If the user
\var{new} cancels the dialog, \exception{KeyboardInterrupt} is raised.
is zero it must be an existing file; otherwise, it must be a new file.
If the user cancels the dialog, the
\code{KeyboardInterrupt}
exception is raised.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{setcutbuffer}{i, string} \begin{funcdesc}{setcutbuffer}{i, string}
Store the string in the system's cut buffer number Store the string in the system's cut buffer number \var{i}, where it
\var{i}, can be found (for pasting) by other applications. On X11, there are 8
where it can be found (for pasting) by other applications. cut buffers (numbered 0..7). Cut buffer number 0 is the `clipboard'
On X11, there are 8 cut buffers (numbered 0..7). on the Macintosh.
Cut buffer number 0 is the `clipboard' on the Macintosh.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getcutbuffer}{i} \begin{funcdesc}{getcutbuffer}{i}
Return the contents of the system's cut buffer number Return the contents of the system's cut buffer number \var{i}.
\var{i}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{rotatecutbuffers}{n} \begin{funcdesc}{rotatecutbuffers}{n}
On X11, rotate the 8 cut buffers by On X11, rotate the 8 cut buffers by \var{n}. Ignored on the
\var{n}. Macintosh.
Ignored on the Macintosh.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{getselection}{i} \begin{funcdesc}{getselection}{i}
Return X11 selection number Return X11 selection number \var{i.} Selections are not cut buffers.
\var{i.} Selection numbers are defined in module \module{stdwinevents}.
Selections are not cut buffers. Selection \constant{WS_PRIMARY} is the \dfn{primary} selection (used
Selection numbers are defined in module by \program{xterm}, for instance); selection \constant{WS_SECONDARY}
\code{stdwinevents}. is the \dfn{secondary} selection; selection \constant{WS_CLIPBOARD} is
Selection \code{WS_PRIMARY} is the the \dfn{clipboard} selection (used by \program{xclipboard}). On the
\dfn{primary} Macintosh, this always returns an empty string.
selection (used by
xterm,
for instance);
selection \code{WS_SECONDARY} is the
\dfn{secondary}
selection; selection \code{WS_CLIPBOARD} is the
\dfn{clipboard}
selection (used by
xclipboard).
On the Macintosh, this always returns an empty string.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{resetselection}{i} \begin{funcdesc}{resetselection}{i}
Reset selection number Reset selection number \var{i}, if this process owns it. (See window
\var{i}, method \method{setselection()}).
if this process owns it.
(See window method
\code{setselection()}).
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{baseline}{} \begin{funcdesc}{baseline}{}
@ -295,129 +269,116 @@ Return the width in bits of the string when drawn in the current font.
(X11 under \UNIX{} only) Return the ``connection number'' used by the (X11 under \UNIX{} only) Return the ``connection number'' used by the
underlying X11 implementation. (This is normally the file number of underlying X11 implementation. (This is normally the file number of
the socket.) Both functions return the same value; the socket.) Both functions return the same value;
\code{connectionnumber()} is named after the corresponding function in \method{connectionnumber()} is named after the corresponding function in
X11 and STDWIN, while \code{fileno()} makes it possible to use the X11 and STDWIN, while \method{fileno()} makes it possible to use the
\code{stdwin} module as a ``file'' object parameter to \module{stdwin} module as a ``file'' object parameter to
\code{select.select()}. Note that if \code{select()} implies that \function{select.select()}. Note that if \constant{select()} implies that
input is possible on \code{stdwin}, this does not guarantee that an input is possible on \module{stdwin}, this does not guarantee that an
event is ready --- it may be some internal communication going on event is ready --- it may be some internal communication going on
between the X server and the client library. Thus, you should call between the X server and the client library. Thus, you should call
\code{stdwin.pollevent()} until it returns \code{None} to check for \function{stdwin.pollevent()} until it returns \code{None} to check for
events if you don't want your program to block. Because of internal events if you don't want your program to block. Because of internal
buffering in X11, it is also possible that \code{stdwin.pollevent()} buffering in X11, it is also possible that \function{stdwin.pollevent()}
returns an event while \code{select()} does not find \code{stdwin} to returns an event while \function{select()} does not find \module{stdwin} to
be ready, so you should read any pending events with be ready, so you should read any pending events with
\code{stdwin.pollevent()} until it returns \code{None} before entering \function{stdwin.pollevent()} until it returns \code{None} before entering
a blocking \code{select()} call. a blocking \function{select()} call.
\ttindex{select} \withsubitem{(in module select)}{\ttindex{select()}}
\end{funcdesc} \end{funcdesc}
\subsection{Window Objects} \subsection{Window Objects}
\nodename{STDWIN Window Objects} \nodename{STDWIN Window Objects}
Window objects are created by \code{stdwin.open()}. They are closed Window objects are created by \function{stdwin.open()}. They are closed
by their \code{close()} method or when they are garbage-collected. by their \method{close()} method or when they are garbage-collected.
Window objects have the following methods: Window objects have the following methods:
\setindexsubitem{(window method)} \begin{methoddesc}[window]{begindrawing}{}
\begin{funcdesc}{begindrawing}{}
Return a drawing object, whose methods (described below) allow drawing Return a drawing object, whose methods (described below) allow drawing
in the window. in the window.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{change}{rect} \begin{methoddesc}[window]{change}{rect}
Invalidate the given rectangle; this may cause a draw event. Invalidate the given rectangle; this may cause a draw event.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{gettitle}{} \begin{methoddesc}[window]{gettitle}{}
Returns the window's title string. Returns the window's title string.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{getdocsize}{} \begin{methoddesc}[window]{getdocsize}{}
\begin{sloppypar} \begin{sloppypar}
Return a pair of integers giving the size of the document as set by Return a pair of integers giving the size of the document as set by
\code{setdocsize()}. \method{setdocsize()}.
\end{sloppypar} \end{sloppypar}
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{getorigin}{} \begin{methoddesc}[window]{getorigin}{}
Return a pair of integers giving the origin of the window with respect Return a pair of integers giving the origin of the window with respect
to the document. to the document.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{gettitle}{} \begin{methoddesc}[window]{gettitle}{}
Return the window's title string. Return the window's title string.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{getwinsize}{} \begin{methoddesc}[window]{getwinsize}{}
Return a pair of integers giving the size of the window. Return a pair of integers giving the size of the window.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{getwinpos}{} \begin{methoddesc}[window]{getwinpos}{}
Return a pair of integers giving the position of the window's upper Return a pair of integers giving the position of the window's upper
left corner (relative to the upper left corner of the screen). left corner (relative to the upper left corner of the screen).
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{menucreate}{title} \begin{methoddesc}[window]{menucreate}{title}
Create a menu object referring to a local menu (a menu that appears Create a menu object referring to a local menu (a menu that appears
only in this window). only in this window).
Methods of menu objects are described below. Methods of menu objects are described below.
\strong{Warning:} the menu only appears as long as the object \strong{Warning:} the menu only appears as long as the object
returned by this call exists. returned by this call exists.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{scroll}{rect, point} \begin{methoddesc}[window]{scroll}{rect, point}
Scroll the given rectangle by the vector given by the point. Scroll the given rectangle by the vector given by the point.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{setdocsize}{point} \begin{methoddesc}[window]{setdocsize}{point}
Set the size of the drawing document. Set the size of the drawing document.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{setorigin}{point} \begin{methoddesc}[window]{setorigin}{point}
Move the origin of the window (its upper left corner) Move the origin of the window (its upper left corner)
to the given point in the document. to the given point in the document.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{setselection}{i, str} \begin{methoddesc}[window]{setselection}{i, str}
Attempt to set X11 selection number Attempt to set X11 selection number \var{i} to the string \var{str}.
\var{i} (See \module{stdwin} function \function{getselection()} for the
to the string meaning of \var{i}.) Return true if it succeeds.
\var{str}.
(See stdwin method
\code{getselection()}
for the meaning of
\var{i}.)
Return true if it succeeds.
If succeeds, the window ``owns'' the selection until If succeeds, the window ``owns'' the selection until
(a) another application takes ownership of the selection; or (a) another application takes ownership of the selection; or
(b) the window is deleted; or (b) the window is deleted; or
(c) the application clears ownership by calling (c) the application clears ownership by calling
\code{stdwin.resetselection(\var{i})}. \function{stdwin.resetselection(\var{i})}. When another application
When another application takes ownership of the selection, a takes ownership of the selection, a \constant{WE_LOST_SEL} event is
\code{WE_LOST_SEL} received for no particular window and with the selection number as
event is received for no particular window and with the selection number detail. Ignored on the Macintosh.
as detail. \end{methoddesc}
Ignored on the Macintosh.
\end{funcdesc}
\begin{funcdesc}{settimer}{dsecs} \begin{methoddesc}[window]{settimer}{dsecs}
Schedule a timer event for the window in Schedule a timer event for the window in \code{\var{dsecs}/10}
\code{\var{dsecs}/10}
seconds. seconds.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{settitle}{title} \begin{methoddesc}[window]{settitle}{title}
Set the window's title string. Set the window's title string.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{setwincursor}{name} \begin{methoddesc}[window]{setwincursor}{name}
\begin{sloppypar} \begin{sloppypar}
Set the window cursor to a cursor of the given name. Set the window cursor to a cursor of the given name. It raises
It raises the \exception{RuntimeError} if no cursor of the given name exists.
\code{RuntimeError}
exception if no cursor of the given name exists.
Suitable names include Suitable names include
\code{'ibeam'}, \code{'ibeam'},
\code{'arrow'}, \code{'arrow'},
@ -427,151 +388,144 @@ and
\code{'plus'}. \code{'plus'}.
On X11, there are many more (see \code{<X11/cursorfont.h>}). On X11, there are many more (see \code{<X11/cursorfont.h>}).
\end{sloppypar} \end{sloppypar}
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{setwinpos}{h, v} \begin{methoddesc}[window]{setwinpos}{h, v}
Set the the position of the window's upper left corner (relative to Set the the position of the window's upper left corner (relative to
the upper left corner of the screen). the upper left corner of the screen).
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{setwinsize}{width, height} \begin{methoddesc}[window]{setwinsize}{width, height}
Set the window's size. Set the window's size.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{show}{rect} \begin{methoddesc}[window]{show}{rect}
Try to ensure that the given rectangle of the document is visible in Try to ensure that the given rectangle of the document is visible in
the window. the window.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{textcreate}{rect} \begin{methoddesc}[window]{textcreate}{rect}
Create a text-edit object in the document at the given rectangle. Create a text-edit object in the document at the given rectangle.
Methods of text-edit objects are described below. Methods of text-edit objects are described below.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{setactive}{} \begin{methoddesc}[window]{setactive}{}
Attempt to make this window the active window. If successful, this Attempt to make this window the active window. If successful, this
will generate a WE_ACTIVATE event (and a WE_DEACTIVATE event in case will generate a WE_ACTIVATE event (and a WE_DEACTIVATE event in case
another window in this application became inactive). another window in this application became inactive).
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{close}{} \begin{methoddesc}[window]{close}{}
Discard the window object. It should not be used again. Discard the window object. It should not be used again.
\end{funcdesc} \end{methoddesc}
\subsection{Drawing Objects} \subsection{Drawing Objects}
Drawing objects are created exclusively by the window method Drawing objects are created exclusively by the window method
\code{begindrawing()}. \method{begindrawing()}. Only one drawing object can exist at any
Only one drawing object can exist at any given time; the drawing object given time; the drawing object must be deleted to finish drawing. No
must be deleted to finish drawing. drawing object may exist when \function{stdwin.getevent()} is called.
No drawing object may exist when
\code{stdwin.getevent()}
is called.
Drawing objects have the following methods: Drawing objects have the following methods:
\setindexsubitem{(drawing method)} \begin{methoddesc}[drawing]{box}{rect}
\begin{funcdesc}{box}{rect}
Draw a box just inside a rectangle. Draw a box just inside a rectangle.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{circle}{center, radius} \begin{methoddesc}[drawing]{circle}{center, radius}
Draw a circle with given center point and radius. Draw a circle with given center point and radius.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{elarc}{center, \(rh, rv\), \(a1, a2\)} \begin{methoddesc}[drawing]{elarc}{center, (rh, rv), (a1, a2)}
Draw an elliptical arc with given center point. Draw an elliptical arc with given center point.
\code{(\var{rh}, \var{rv})} \code{(\var{rh}, \var{rv})}
gives the half sizes of the horizontal and vertical radii. gives the half sizes of the horizontal and vertical radii.
\code{(\var{a1}, \var{a2})} \code{(\var{a1}, \var{a2})}
gives the angles (in degrees) of the begin and end points. gives the angles (in degrees) of the begin and end points.
0 degrees is at 3 o'clock, 90 degrees is at 12 o'clock. 0 degrees is at 3 o'clock, 90 degrees is at 12 o'clock.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{erase}{rect} \begin{methoddesc}[drawing]{erase}{rect}
Erase a rectangle. Erase a rectangle.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{fillcircle}{center, radius} \begin{methoddesc}[drawing]{fillcircle}{center, radius}
Draw a filled circle with given center point and radius. Draw a filled circle with given center point and radius.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{fillelarc}{center, \(rh, rv\), \(a1, a2\)} \begin{methoddesc}[drawing]{fillelarc}{center, (rh, rv), (a1, a2)}
Draw a filled elliptical arc; arguments as for \code{elarc}. Draw a filled elliptical arc; arguments as for \method{elarc()}.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{fillpoly}{points} \begin{methoddesc}[drawing]{fillpoly}{points}
Draw a filled polygon given by a list (or tuple) of points. Draw a filled polygon given by a list (or tuple) of points.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{invert}{rect} \begin{methoddesc}[drawing]{invert}{rect}
Invert a rectangle. Invert a rectangle.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{line}{p1, p2} \begin{methoddesc}[drawing]{line}{p1, p2}
Draw a line from point Draw a line from point
\var{p1} \var{p1}
to to
\var{p2}. \var{p2}.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{paint}{rect} \begin{methoddesc}[drawing]{paint}{rect}
Fill a rectangle. Fill a rectangle.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{poly}{points} \begin{methoddesc}[drawing]{poly}{points}
Draw the lines connecting the given list (or tuple) of points. Draw the lines connecting the given list (or tuple) of points.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{shade}{rect, percent} \begin{methoddesc}[drawing]{shade}{rect, percent}
Fill a rectangle with a shading pattern that is about Fill a rectangle with a shading pattern that is about
\var{percent} \var{percent}
percent filled. percent filled.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{text}{p, str} \begin{methoddesc}[drawing]{text}{p, str}
Draw a string starting at point p (the point specifies the Draw a string starting at point p (the point specifies the
top left coordinate of the string). top left coordinate of the string).
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{xorcircle}{center, radius} \begin{methoddesc}[drawing]{xorcircle}{center, radius}
\funcline{xorelarc}{center, \(rh, rv\), \(a1, a2\)} \funcline{xorelarc}{center, (rh, rv), (a1, a2)}
\funcline{xorline}{p1, p2} \funcline{xorline}{p1, p2}
\funcline{xorpoly}{points} \funcline{xorpoly}{points}
Draw a circle, an elliptical arc, a line or a polygon, respectively, Draw a circle, an elliptical arc, a line or a polygon, respectively,
in XOR mode. in XOR mode.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{setfgcolor}{} \begin{methoddesc}[drawing]{setfgcolor}{}
\funcline{setbgcolor}{} \funcline{setbgcolor}{}
\funcline{getfgcolor}{} \funcline{getfgcolor}{}
\funcline{getbgcolor}{} \funcline{getbgcolor}{}
These functions are similar to the corresponding functions described These functions are similar to the corresponding functions described
above for the above for the \module{stdwin}
\code{stdwin}
module, but affect or return the colors currently used for drawing module, but affect or return the colors currently used for drawing
instead of the global default colors. instead of the global default colors.
When a drawing object is created, its colors are set to the window's When a drawing object is created, its colors are set to the window's
default colors, which are in turn initialized from the global default default colors, which are in turn initialized from the global default
colors when the window is created. colors when the window is created.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{setfont}{} \begin{methoddesc}[drawing]{setfont}{}
\funcline{baseline}{} \funcline{baseline}{}
\funcline{lineheight}{} \funcline{lineheight}{}
\funcline{textbreak}{} \funcline{textbreak}{}
\funcline{textwidth}{} \funcline{textwidth}{}
These functions are similar to the corresponding functions described These functions are similar to the corresponding functions described
above for the above for the \module{stdwin}
\code{stdwin}
module, but affect or use the current drawing font instead of module, but affect or use the current drawing font instead of
the global default font. the global default font.
When a drawing object is created, its font is set to the window's When a drawing object is created, its font is set to the window's
default font, which is in turn initialized from the global default default font, which is in turn initialized from the global default
font when the window is created. font when the window is created.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{bitmap}{point, bitmap, mask} \begin{methoddesc}[drawing]{bitmap}{point, bitmap, mask}
Draw the \var{bitmap} with its top left corner at \var{point}. Draw the \var{bitmap} with its top left corner at \var{point}.
If the optional \var{mask} argument is present, it should be either If the optional \var{mask} argument is present, it should be either
the same object as \var{bitmap}, to draw only those bits that are set the same object as \var{bitmap}, to draw only those bits that are set
@ -579,9 +533,9 @@ in the bitmap, in the foreground color, or \code{None}, to draw all
bits (ones are drawn in the foreground color, zeros in the background bits (ones are drawn in the foreground color, zeros in the background
color). color).
Not available on the Macintosh. Not available on the Macintosh.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{cliprect}{rect} \begin{methoddesc}[drawing]{cliprect}{rect}
Set the ``clipping region'' to a rectangle. Set the ``clipping region'' to a rectangle.
The clipping region limits the effect of all drawing operations, until The clipping region limits the effect of all drawing operations, until
it is changed again or until the drawing object is closed. When a it is changed again or until the drawing object is closed. When a
@ -590,16 +544,16 @@ window. When an object to be drawn falls partly outside the clipping
region, the set of pixels drawn is the intersection of the clipping region, the set of pixels drawn is the intersection of the clipping
region and the set of pixels that would be drawn by the same operation region and the set of pixels that would be drawn by the same operation
in the absence of a clipping region. in the absence of a clipping region.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{noclip}{} \begin{methoddesc}[drawing]{noclip}{}
Reset the clipping region to the entire window. Reset the clipping region to the entire window.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{close}{} \begin{methoddesc}[drawing]{close}{}
\funcline{enddrawing}{} \funcline{enddrawing}{}
Discard the drawing object. It should not be used again. Discard the drawing object. It should not be used again.
\end{funcdesc} \end{methoddesc}
\subsection{Menu Objects} \subsection{Menu Objects}
@ -607,147 +561,132 @@ A menu object represents a menu.
The menu is destroyed when the menu object is deleted. The menu is destroyed when the menu object is deleted.
The following methods are defined: The following methods are defined:
\setindexsubitem{(menu method)}
\begin{funcdesc}{additem}{text, shortcut} \begin{methoddesc}[menu]{additem}{text, shortcut}
Add a menu item with given text. Add a menu item with given text.
The shortcut must be a string of length 1, or omitted (to specify no The shortcut must be a string of length 1, or omitted (to specify no
shortcut). shortcut).
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{setitem}{i, text} \begin{methoddesc}[menu]{setitem}{i, text}
Set the text of item number Set the text of item number \var{i}.
\var{i}. \end{methoddesc}
\end{funcdesc}
\begin{funcdesc}{enable}{i, flag} \begin{methoddesc}[menu]{enable}{i, flag}
Enable or disables item Enable or disables item \var{i}.
\var{i}. \end{methoddesc}
\end{funcdesc}
\begin{funcdesc}{check}{i, flag} \begin{methoddesc}[menu]{check}{i, flag}
Set or clear the Set or clear the \dfn{check mark} for item \var{i}.
\dfn{check mark} \end{methoddesc}
for item
\var{i}.
\end{funcdesc}
\begin{funcdesc}{close}{} \begin{methoddesc}[menu]{close}{}
Discard the menu object. It should not be used again. Discard the menu object. It should not be used again.
\end{funcdesc} \end{methoddesc}
\subsection{Bitmap Objects} \subsection{Bitmap Objects}
A bitmap represents a rectangular array of bits. A bitmap represents a rectangular array of bits.
The top left bit has coordinate (0, 0). The top left bit has coordinate (0, 0).
A bitmap can be drawn with the \code{bitmap} method of a drawing object. A bitmap can be drawn with the \method{bitmap()} method of a drawing object.
Bitmaps are currently not available on the Macintosh. Bitmaps are currently not available on the Macintosh.
The following methods are defined: The following methods are defined:
\setindexsubitem{(bitmap method)}
\begin{funcdesc}{getsize}{} \begin{methoddesc}[bitmap]{getsize}{}
Return a tuple representing the width and height of the bitmap. Return a tuple representing the width and height of the bitmap.
(This returns the values that have been passed to the \code{newbitmap} (This returns the values that have been passed to the
function.) \function{newbitmap()} function.)
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{setbit}{point, bit} \begin{methoddesc}[bitmap]{setbit}{point, bit}
Set the value of the bit indicated by \var{point} to \var{bit}. Set the value of the bit indicated by \var{point} to \var{bit}.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{getbit}{point} \begin{methoddesc}[bitmap]{getbit}{point}
Return the value of the bit indicated by \var{point}. Return the value of the bit indicated by \var{point}.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{close}{} \begin{methoddesc}[bitmap]{close}{}
Discard the bitmap object. It should not be used again. Discard the bitmap object. It should not be used again.
\end{funcdesc} \end{methoddesc}
\subsection{Text-edit Objects} \subsection{Text-edit Objects}
A text-edit object represents a text-edit block. A text-edit object represents a text-edit block.
For semantics, see the STDWIN documentation for C programmers. For semantics, see the STDWIN documentation for \C{} programmers.
The following methods exist: The following methods exist:
\setindexsubitem{(text-edit method)}
\begin{funcdesc}{arrow}{code} \begin{methoddesc}[text-edit]{arrow}{code}
Pass an arrow event to the text-edit block. Pass an arrow event to the text-edit block.
The The \var{code} must be one of \constant{WC_LEFT}, \constant{WC_RIGHT},
\var{code} \constant{WC_UP} or \constant{WC_DOWN} (see module
must be one of \module{stdwinevents}).
\code{WC_LEFT}, \end{methoddesc}
\code{WC_RIGHT},
\code{WC_UP}
or
\code{WC_DOWN}
(see module
\code{stdwinevents}).
\end{funcdesc}
\begin{funcdesc}{draw}{rect} \begin{methoddesc}[text-edit]{draw}{rect}
Pass a draw event to the text-edit block. Pass a draw event to the text-edit block.
The rectangle specifies the redraw area. The rectangle specifies the redraw area.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{event}{type, window, detail} \begin{methoddesc}[text-edit]{event}{type, window, detail}
Pass an event gotten from Pass an event gotten from
\code{stdwin.getevent()} \function{stdwin.getevent()}
to the text-edit block. to the text-edit block.
Return true if the event was handled. Return true if the event was handled.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{getfocus}{} \begin{methoddesc}[text-edit]{getfocus}{}
Return 2 integers representing the start and end positions of the Return 2 integers representing the start and end positions of the
focus, usable as slice indices on the string returned by focus, usable as slice indices on the string returned by
\code{gettext()}. \method{gettext()}.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{getfocustext}{} \begin{methoddesc}[text-edit]{getfocustext}{}
Return the text in the focus. Return the text in the focus.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{getrect}{} \begin{methoddesc}[text-edit]{getrect}{}
Return a rectangle giving the actual position of the text-edit block. Return a rectangle giving the actual position of the text-edit block.
(The bottom coordinate may differ from the initial position because (The bottom coordinate may differ from the initial position because
the block automatically shrinks or grows to fit.) the block automatically shrinks or grows to fit.)
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{gettext}{} \begin{methoddesc}[text-edit]{gettext}{}
Return the entire text buffer. Return the entire text buffer.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{move}{rect} \begin{methoddesc}[text-edit]{move}{rect}
Specify a new position for the text-edit block in the document. Specify a new position for the text-edit block in the document.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{replace}{str} \begin{methoddesc}[text-edit]{replace}{str}
Replace the text in the focus by the given string. Replace the text in the focus by the given string.
The new focus is an insert point at the end of the string. The new focus is an insert point at the end of the string.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{setfocus}{i, j} \begin{methoddesc}[text-edit]{setfocus}{i, j}
Specify the new focus. Specify the new focus.
Out-of-bounds values are silently clipped. Out-of-bounds values are silently clipped.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{settext}{str} \begin{methoddesc}[text-edit]{settext}{str}
Replace the entire text buffer by the given string and set the focus Replace the entire text buffer by the given string and set the focus
to \code{(0, 0)}. to \code{(0, 0)}.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{setview}{rect} \begin{methoddesc}[text-edit]{setview}{rect}
Set the view rectangle to \var{rect}. If \var{rect} is \code{None}, Set the view rectangle to \var{rect}. If \var{rect} is \code{None},
viewing mode is reset. In viewing mode, all output from the text-edit viewing mode is reset. In viewing mode, all output from the text-edit
object is clipped to the viewing rectangle. This may be useful to object is clipped to the viewing rectangle. This may be useful to
implement your own scrolling text subwindow. implement your own scrolling text subwindow.
\end{funcdesc} \end{methoddesc}
\begin{funcdesc}{close}{} \begin{methoddesc}[text-edit]{close}{}
Discard the text-edit object. It should not be used again. Discard the text-edit object. It should not be used again.
\end{funcdesc} \end{methoddesc}
\subsection{Example} \subsection{Example}
\nodename{STDWIN Example} \nodename{STDWIN Example}
@ -776,17 +715,17 @@ def main():
main() main()
\end{verbatim} \end{verbatim}
%
\section{\module{stdwinevents} --- \section{\module{stdwinevents} ---
None} Constants for use with \module{stdwin}}
\declaremodule{standard}{stdwinevents} \declaremodule{standard}{stdwinevents}
\modulesynopsis{None} \modulesynopsis{Constant definitions for use with \module{stdwin}}
This module defines constants used by STDWIN for event types This module defines constants used by STDWIN for event types
(\code{WE_ACTIVATE} etc.), command codes (\code{WC_LEFT} etc.) (\constant{WE_ACTIVATE} etc.), command codes (\constant{WC_LEFT} etc.)
and selection types (\code{WS_PRIMARY} etc.). and selection types (\constant{WS_PRIMARY} etc.).
Read the file for details. Read the file for details.
Suggested usage is Suggested usage is
@ -794,36 +733,33 @@ Suggested usage is
>>> from stdwinevents import * >>> from stdwinevents import *
>>> >>>
\end{verbatim} \end{verbatim}
%
\section{\module{rect} --- \section{\module{rect} ---
None} Functions for use with \module{stdwin}}
\declaremodule{standard}{rect} \declaremodule{standard}{rect}
\modulesynopsis{None} \modulesynopsis{Geometry-related utility function for use with \module{stdwin}}
This module contains useful operations on rectangles. This module contains useful operations on rectangles.
A rectangle is defined as in module A rectangle is defined as in module \module{stdwin}:
\code{stdwin}:
a pair of points, where a point is a pair of integers. a pair of points, where a point is a pair of integers.
For example, the rectangle For example, the rectangle
\begin{verbatim} \begin{verbatim}
(10, 20), (90, 80) (10, 20), (90, 80)
\end{verbatim} \end{verbatim}
%
is a rectangle whose left, top, right and bottom edges are 10, 20, 90 is a rectangle whose left, top, right and bottom edges are 10, 20, 90
and 80, respectively. and 80, respectively. Note that the positive vertical axis points
Note that the positive vertical axis points down (as in down (as in \module{stdwin}).
\code{stdwin}).
The module defines the following objects: The module defines the following objects:
\begin{excdesc}{error} \begin{excdesc}{error}
The exception raised by functions in this module when they detect an The exception raised by functions in this module when they detect an
error. error. The exception argument is a string describing the problem in
The exception argument is a string describing the problem in more more detail.
detail.
\end{excdesc} \end{excdesc}
\begin{datadesc}{empty} \begin{datadesc}{empty}
@ -846,74 +782,37 @@ Returns true if the given rectangle is empty.
A rectangle A rectangle
\code{(\var{left}, \var{top}), (\var{right}, \var{bottom})} \code{(\var{left}, \var{top}), (\var{right}, \var{bottom})}
is empty if is empty if
%begin{latexonly} \begin{math}\var{left} \geq \var{right}\end{math} or
\iftexi \begin{math}\var{top} \geq \var{bottom}\end{math}.
%end{latexonly}
\code{\var{left} >= \var{right}} or \code{\var{top} => \var{bottom}}.
%begin{latexonly}
\else
$\var{left} \geq \var{right}$ or $\var{top} \geq \var{bottom}$.
%%JHXXX\emph{left~$\geq$~right} or \emph{top~$\leq$~bottom}.
\fi
%end{latexonly}
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{intersect}{list} \begin{funcdesc}{intersect}{list}
Returns the intersection of all rectangles in the list argument. Returns the intersection of all rectangles in the list argument.
It may also be called with a tuple argument. It may also be called with a tuple argument. Raises
Raises \exception{rect.error} if the list is empty. Returns
\code{rect.error} \constant{rect.empty} if the intersection of the rectangles is empty.
if the list is empty.
Returns
\code{rect.empty}
if the intersection of the rectangles is empty.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{union}{list} \begin{funcdesc}{union}{list}
Returns the smallest rectangle that contains all non-empty rectangles in Returns the smallest rectangle that contains all non-empty rectangles in
the list argument. the list argument. It may also be called with a tuple argument or
It may also be called with a tuple argument or with two or more with two or more rectangles as arguments. Returns
rectangles as arguments. \constant{rect.empty} if the list is empty or all its rectangles are
Returns empty.
\code{rect.empty}
if the list is empty or all its rectangles are empty.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{pointinrect}{point, rect} \begin{funcdesc}{pointinrect}{point, rect}
Returns true if the point is inside the rectangle. Returns true if the point is inside the rectangle. By definition, a
By definition, a point point \code{(\var{h}, \var{v})} is inside a rectangle
\code{(\var{h}, \var{v})}
is inside a rectangle
\code{(\var{left}, \var{top}), (\var{right}, \var{bottom})} if \code{(\var{left}, \var{top}), (\var{right}, \var{bottom})} if
%begin{latexonly} \begin{math}\var{left} \leq \var{h} < \var{right}\end{math} and
\iftexi \begin{math}\var{top} \leq \var{v} < \var{bottom}\end{math}.
%end{latexonly}
\code{\var{left} <= \var{h} < \var{right}} and
\code{\var{top} <= \var{v} < \var{bottom}}.
%begin{latexonly}
\else
$\var{left} \leq \var{h} < \var{right}$ and
$\var{top} \leq \var{v} < \var{bottom}$.
\fi
%end{latexonly}
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{inset}{rect, \(dh, dv\)} \begin{funcdesc}{inset}{rect, (dh, dv)}
Returns a rectangle that lies inside the Returns a rectangle that lies inside the \var{rect} argument by
\code{rect} \var{dh} pixels horizontally and \var{dv} pixels vertically. If
argument by \var{dh} or \var{dv} is negative, the result lies outside \var{rect}.
\var{dh}
pixels horizontally
and
\var{dv}
pixels
vertically.
If
\var{dh}
or
\var{dv}
is negative, the result lies outside
\var{rect}.
\end{funcdesc} \end{funcdesc}
\begin{funcdesc}{rect2geom}{rect} \begin{funcdesc}{rect2geom}{rect}