Window.h
declares the API that this chapter describes. For more information on windows, see the section "Forms, Windows, and Dialogs" in the Palm OS Programmer's Companion.
CustomPatternType
type holds an 8-by-8 bit pattern that is one bit deep. Each byte specifies a row of the pattern. When drawing, a pattern is tiled to fill a specified region. This pattern is used by
WinFillLine
and
WinFillRectangle
.
PatternType
specifies the name of the current pattern.
typedef UInt8 CustomPatternType [8];
CustomPatternType
is an array of 4 16-bit words. Note the size of this data type has not changed.
DrawStateType
structure defines the current drawing state, which is the Palm OS® implementation of a pen. This drawing state is saved with
WinPushDrawState
and restored with
WinPopDrawState
.
WARNING!Palm Computing® does not support or provide backward compatibility for theDrawStateType
structure. Access it only through the functions described below. Never access its structure members directly, or your code may break in future versions. Use the information below for debugging purposes only.
typedef struct DrawStateType {
    WinDrawOperation transferMode;
    PatternType pattern;
    UnderlineModeType underlineMode;
    FontID fontId;
    FontPtr font;
    CustomPatternType patternData;
    IndexedColorType foreColor;
    IndexedColorType backColor;
    IndexedColorType textColor;
} DrawStateType;
FrameBitsType
structure specifies attributes of a window's frame.
WARNING!Palm Computing does not support or provide backward compatibility for theFrameBitsType
bit field. Never access its bit field members directly, or your code may break in future versions. Use the information below for debugging purposes only.
typedef union FrameBitsType {
    struct {
    UInt16 cornerDiam : 8;
    UInt16 reserved_3 : 3;
    UInt16 threeD : 1;
    UInt16 shadowWidth : 2;
    UInt16 width : 2;
    } bits;
    UInt16 word;
} FrameBitsType;
FrameType
type specifies a window frame style.
typedef UInt16 FrameType;
FrameType
can be set to one of the defined frame types shown in the table below, or a custom frame type as defined by a
FrameBitsType
structure.
IndexedColorType
type is used to specify a color by its index value; that is, by its location in a color table. Color tables are defined by the
ColorTableType
structure, which is declared in Bitmap.h
. The IndexedColorType
can hold a 1, 2, 4, or 8-bit index.
typedef UInt8 IndexedColorType;
PatternType
enumerated type specifies a pattern for drawing. This type is returned by WinGetPatternType and is used as a parameter to the WinSetPatternType function.
typedef enum { blackPattern, whitePattern, grayPattern, customPattern } PatternType;
blackPattern
| Pattern with all bits on. |
whitePattern
| Pattern with all bits off. |
grayPattern
| Pattern with alternating on and off bits. |
customPattern
|
Custom pattern specified by CustomPatternType .
|
blackPattern
is only black if the current foreground color is black.
UnderlineModeType
enumerated type specifies possible values for the underline mode stored in
DrawStateType
.
typedef enum { noUnderline, grayUnderline, solidUnderline, colorUnderline } UnderlineModeType;
solidUnderline
and colorUnderline
options are only available in Palm OS 3.1 and higher.
WindowFlagsType
specifies different window attributes.
WARNING!Palm Computing does not support or provide backward compatibility for theWindowFlagsType
bit field. Access it only through the functions described below. Never access its bit field members directly, or your code may break in future versions. Use the information below for debugging purposes only.
typedef struct WindowFlagsType {
    UInt16 format:1;
    UInt16 offscreen:1;
    UInt16 modal:1;
    UInt16 focusable:1;
    UInt16 enabled:1;
    UInt16 visible:1;
    UInt16 dialog:1;
    UInt16 freeBitmap:1;
    UInt16 reserved :8;
} WindowFlagsType;
freeBitmap
flag was not present. Instead, a compressed
flag was present, where 0 specified uncompressed and 1 specified compressed. This compressed flag is now part of the
BitmapType
.
WindowType
structure represents a window.
WARNING!Palm Computing does not support or provide backward compatibility for theWindowType
structure. Access it only through the functions described below. Never access its structure members directly, or your code may break in future versions. Use the information below for debugging purposes only.
typedef struct WindowType {
Coord displayWidthV20;
Coord displayHeightV20;
void * displayAddrV20;
WindowFlagsType windowFlags;
RectangleType windowBounds;
AbsRectType clippingBounds;
BitmapPtr bitmapP;
FrameBitsType frameType;
DrawStateType * drawStateP;
struct WindowType * nextWindow;
} WindowType;
bitmapP
field is instead a viewOrigin
field of type PointType
and specified the window origin point on the display. The drawStateP
was named gstate
and was of type GraphicStatePtr
. The complete definition is shown below:
typedef struct WinTypeStruct {
    Word displayWidth;
    Word displayHeight;
    VoidPtr displayAddr;
    WindowFlagsType windowFlags;
    RectangleType windowBounds;
    AbsRectType clippingBounds;
    PointType viewOrigin;
    FrameBitsType frameType;
    GraphicStatePtr gstate;
    struct WinTypeStruct* nextWindow;
} WindowType;
WinDrawOperation
enumerated type specifies the transfer mode for color drawing. This type is used as a parameter to the WinCopyRectangle and WinSetDrawMode functions.
typedef enum {winPaint, winErase, winMask, winInvert, winOverlay, winPaintInverse, winSwap} WinDrawOperation;
ScrOperation
and its values begin with the prefix scr
rather than win
. WinDrawOperation
is fully compatible with ScrOperation
.
WinHandle
type is a pointer to a
WindowType
structure. Note that this may change.
typedef WindowType * WinHandle;
WinLineType
structure defines a line.
typedef struct WinLineType {
    Coord x1;
    Coord y1;
    Coord x2;
    Coord y2;
} WinLineType;
WinPtr
type is a pointer to a
WindowType
structure.
typedef WindowType * WinPtr;
void WinClipRectangle (RectangleType *rP)
  |
|
Pointer to a structure holding the rectangle to clip. The rectangle returned is the intersection of the rectangle passed and the clipping bounds of the draw window. |
WinGetDrawWindow
.
void WinCopyRectangle (WinHandle srcWin, WinHandle dstWin, RectangleType *srcRect, Coord destX, Coord destY, WinDrawOperation mode)
  |
|
Window from which the rectangle is copied. If NULL , use the draw window. |
  |
|
Window to which the rectangle is copied. If NULL , use the draw window. |
  |
|
Bounds of the region to copy. |
  |
|
Top bound of the rectangle in destination window. |
  |
|
Left bound of the rectangle in destination window. |
  |
|
The method of transfer from the source to the destination window (see WinDrawOperation ). |
winPaint
, and the destination coordinates must be (0,0). If the width of the destination rectangle is less than 16 pixels or if the destination coordinates are not (0,0), then this function turns off compression for the destination bitmap. Normally, you do not copy to a compressed bitmap. Instead, you copy to an uncompressed bitmap and compress it afterwards.
mode
parameter was defined as type ScrOperation
. It is defined as type WinDrawOperation
only if 3.5 New Feature Set is present. ScrOperation
and WinDrawOperation
are fully compatible with each other.
WinCopyRectangle
to draw it on the screen. In version 3.5 and higher, the preferred method of doing this is to use
WinDrawBitmap
or
WinPaintBitmap
.
WinDrawBitmap
WinHandle WinCreateBitmapWindow (BitmapType *bitmapP, UInt16 *error)
  |
|
Pointer to a bitmap to associate with the window. (See BitmapType .) |
  |
|
Pointer to any error this function encounters. |
NULL
if an error occurs. The error
parameter contains one of the following:
  |
|
No error. |
  |
|
The bitmapP parameter is invalid. The bitmap must be uncompressed and it must have a valid pixel size (1, 2, 4, or 8). It must not be the screen bitmap. |
  |
|
There is not enough memory to allocate a new window structure. |
WinCreateBitmapWindow
if you want to draw into a previously created bitmap, such as a bitmap created using
BmpCreate
.
WinSetDrawWindow
to make it the draw window, and then use the window drawing functions to modify the bitmap.
WinDeleteWindow
, the bitmap is not freed when the window is freed.
WinCreateOffscreenWindow
uses this function to create its offscreen window. If you call WinCreateOffscreenWindow
instead of using this function, the bitmap is freed when WinDeleteWindow
is called.
WinHandle WinCreateOffscreenWindow (Coord width, Coord height, WindowFormatType format, UInt16 *error)
  |
|
Width of the window in pixels. |
  |
|
Height of the window in pixels. |
  |
|
Either screenFormat or genericFormat . In general, you should use genericFormat for offscreen windows. |
  |
|
Pointer to any error this function encounters. |
NULL
if an error occurs. The error
parameter contains one of the following:
  |
|
No error. |
  |
|
The width or height parameter is NULL or the current color table is invalid. |
  |
|
There is not enough memory to complete the function. |
WinCreateBitmapWindow
in the following ways:
WinCreateOffscreenWindow
creates a new bitmap in the same depth as the current screen. WinCreateBitmapWindow
uses the bitmap you pass in, which may or may not be in the same depth as the current screen. WinCreateOffscreenWindow
uses the screen format you specify. WinCreateBitmapWindow
always uses generic format. WinCreateOffscreenWindow
, its bitmap is freed along with the window. The bitmap used in the WinCreateBitmapWindow
is not freed when the window is freed. WinHandle WinCreateWindow (RectangleType *bounds, FrameType frame, Boolean modal, Boolean focusable, UInt16 *error)
  |
|
Display-relative bounds of the window. |
  |
|
Type of frame around the window (see FrameType ). |
  |
|
true if the window is modal. |
  |
|
true if the window can be the active window. |
  |
|
Pointer to any error encountered by this function. |
FrmInitForm
to create form windows from a resource. Forms are much more flexible and have better system support. All forms are windows, but not all windows are forms.
WinSetActiveWindow
.
WinDeleteWindow
void WinDeleteWindow (WinHandle winHandle, Boolean eraseIt)
  |
|
Handle of window to delete. |
  |
|
If true , the window is erased before it is deleted. If false , the window is not erased. |
WinCreateOffscreenWindow
have their bitmaps freed; windows created using
WinCreateWindow
or
WinCreateBitmapWindow
do not.
eraseIt
parameter affects onscreen windows only; offscreen windows are never erased. As a performance optimization, you might set eraseIt
to false
for an onscreen window if you know that you are going to immediately redraw the area anyway. For example, when the form manager closes a form dialog, it restores the area with the save-behind bits it had stored for that form. For this reason, when the form manager deletes the dialog window, it passes false
for eraseIt
because the entire area will be redrawn.
void WinDisplayToWindowPt (Coord *extentX, Coord *extentY)
  |
|
Pointer to x coordinate to convert. |
  |
|
Pointer to y coordinate to convert. |
WinWindowToDisplayPt
winPaint
mode (see
WinDrawOperation
for mode details).
void WinDrawBitmap (BitmapPtr bitmapP, Coord x, Coord y)
  |
|
Pointer to a bitmap. |
  |
|
The x coordinate of the top-left corner. |
  |
|
The y coordinate of the top-left corner. |
WinPalette
to change the system color table, draw the bitmap, and then change the system color table back when the bitmap is no longer visible.
WinPaintBitmap
in that this function always uses winPaint
mode (copy mode) as the transfer mode. WinPaintBitmap
uses the current drawing state transfer mode.
WinEraseRectangle
void WinDrawChar (WChar theChar, Coord x, Coord y)
  |
|
The character to draw. This may be either a single-byte character or a multi-byte character. |
  |
|
x coordinate of the location where the character is to be drawn (left bound). |
  |
|
y coordinate of the location where the character is to be drawn (top bound). |
FntSetFont
to set the desired underline and font to draw the characters.
winPaint
mode (see
WinDrawOperation
). This means the on bits are drawn in the text color, the off bits are in the background color, and underlines are in the foreground color. WinPaintChar
uses the current drawing state transfer mode instead of winPaint
.
void WinDrawChars (const Char *chars, Int16 len, Coord x, Coord y)
  |
|
Pointer to the characters to draw. |
  |
|
Length in bytes of the characters to draw. |
  |
|
x coordinate of the first character to draw (left bound). |
  |
|
y coordinate of the first character to draw (top bound). |
FntSetFont
to set the desired underline and font to draw the characters.
winPaint
mode (see
WinDrawOperation
). This means the on bits are drawn in the text color, the off bits are in the background color, and underlines are in the foreground color. WinPaintChar
uses the current drawing state transfer mode instead of winPaint
.
void WinDrawGrayLine (Coord x1, Coord y1, Coord x2, Coord y2)
  |
|
x coordinate of line start point. |
  |
|
y coordinate of line start point. |
  |
|
x coordinate of line endpoint. |
  |
|
y coordinate of line endpoint. |
grayPattern
pattern type.
void WinDrawGrayRectangleFrame (FrameType frame, RectangleType *rP)
  |
|
Type of frame to draw (see FrameType ). |
  |
|
Pointer to the rectangle to frame. |
void WinDrawInvertedChars (const Char *chars, Int16 len, Coord x, Coord y)
  |
|
Pointer to the characters to draw. |
  |
|
Length in bytes of the characters to draw. |
  |
|
x coordinate of the first character to draw (left bound). |
  |
|
y coordinate of the first character to draw (top bound). |
FntSetFont
.
void WinDrawLine (Coord x1, Coord y1, Coord x2, Coord y2)
  |
|
x coordinate of line start point. |
  |
|
y coordinate of line start point. |
  |
|
x coordinate of line endpoint. |
  |
|
y coordinate of line endpoint. |
winPaint
mode (see
WinDrawOperation
). WinPaintLine
uses the current drawing state transfer mode instead of winPaint
.
void WinDrawPixel (Coord x, Coord y)
  |
|
Pointer to the x coordinate of a pixel. |
  |
|
Pointer to the y coordinate of a pixel. |
void WinDrawRectangle (RectangleType *rP, UInt16 cornerDiam)
  |
|
Pointer to the rectangle to draw. |
  |
|
Radius of rounded corners. Specify zero for square corners. |
cornerDiam
parameter specifies the radius of four imaginary circles used to form the rounded corners. An imaginary circle is placed within each corner tangent to the rectangle on two sides.
winPaint
mode (see
WinDrawOperation
). WinPaintRectangle
uses the current drawing state transfer mode instead of winPaint
.
void WinDrawRectangleFrame (FrameType frame, RectangleType *rP)
  |
|
Type of frame to draw (see FrameType ). |
  |
|
Pointer to the rectangle to frame. |
winPaint
mode (see
WinDrawOperation
). WinPaintRectangleFrame
uses the current drawing state transfer mode instead of winPaint
.
void WinDrawTruncChars (const Char *chars, Int16 len, Coord x, Coord y, Coord maxWidth)
  |
|
Pointer to the characters to draw. |
  |
|
Length in bytes of the characters to draw. |
  |
|
x coordinate of the first character to draw (left bound). |
  |
|
y coordinate of the first character to draw (top bound). |
  |
|
Maximum width in pixels of the characters that are to be drawn. |
FntSetFont
.
maxWidth
allows, WinDrawTruncChars
draws one less than the number of characters that can fit in maxWidth
and then draws an ellipsis (...) in the remaining space. (If the boundary characters are narrower than the ellipsis, more than one character may be dropped to make room.) If maxWidth
is narrower than the width of an ellipsis, nothing is drawn.
void WinEraseChars (const Char *chars, Int16 len, Coord x, Coord y)
  |
|
Pointer to the characters to erase. |
  |
|
Length in bytes of the characters to erase. |
  |
|
x coordinate of the first character to erase (left bound). |
  |
|
y coordinate of the first character to erase (top bound). |
winMask
transfer mode is used to erase the characters. See
WinDrawOperation
for more information. This has the effect of erasing only the on bits for the characters rather than the entire text rectangle. This function only works if the foreground color is black and the background color is white.
void WinEraseLine (Coord x1, Coord y1, Coord x2, Coord y2)
  |
|
x coordinate of line start point. |
  |
|
y coordinate of line start point. |
  |
|
x coordinate of line endpoint. |
  |
|
y coordinate of line endpoint. |
void WinErasePixel (Coord x, Coord y)
  |
|
Pointer to the x coordinate of a pixel. |
  |
|
Pointer to the y coordinate of a pixel. |
void WinEraseRectangle (RectangleType *rP, UInt16 cornerDiam)
  |
|
Pointer to the rectangle to erase. |
  |
|
Radius of rounded corners. Specify zero for square corners. |
cornerDiam
parameter specifies the radius of four imaginary circles used to form the rounded corners. An imaginary circle is placed within each corner tangent to the rectangle on two sides.
void WinEraseRectangleFrame (FrameType frame, RectangleType *rP)
  |
|
Type of frame to draw (see FrameType ). |
  |
|
Pointer to the rectangle to frame. |
void WinEraseWindow (void)
WinEraseRectangle
is used to erase the window. This routine doesn't erase the frame around the draw window. See
WinEraseRectangleFrame
and
WinGetWindowFrameRect
.
void WinFillLine (Coord x1, Coord y1, Coord x2, Coord y2)
  |
|
x coordinate of line start point. |
  |
|
y coordinate of line start point. |
  |
|
x coordinate of line endpoint. |
  |
|
y coordinate of line endpoint. |
void WinFillRectangle (RectangleType *rP, UInt16 cornerDiam)
  |
|
Pointer to the rectangle to draw. |
  |
|
Radius of rounded corners. Specify zero for square corners. |
cornerDiam
parameter specifies the radius of four imaginary circles used to form the rounded corners. An imaginary circle is placed within each corner tangent to the rectangle on two sides.
WinHandle WinGetActiveWindow (void)
BitmapType *WinGetBitmap (WinHandle winHandle)
NULL
if winHandle
is invalid.
void WinGetClip (RectangleType *rP)
WinSetClip
void WinGetDisplayExtent (Coord *extentX, Coord *extentY)
  |
|
Pointer to the width of the display in pixels. |
  |
|
Pointer to the height of the display in pixels. |
WinHandle WinGetDisplayWindow (void)
WinHandle WinGetDrawWindow (void)
WinHandle WinGetFirstWindow (void)
void WinGetFramesRectangle (FrameType frame, RectangleType *rP, RectangleType *obscuredRectP)
  |
|
Type of rectangle frame (see FrameType ). |
  |
|
Pointer to the rectangle to frame. |
  |
|
Pointer to the rectangle that includes both the specified rectangle and its frame. |
WinGetWindowFrameRect
,
WinGetWindowBounds
void WinGetPattern (CustomPatternType *patternP)
patternData
in the current drawing state. (See
DrawStateType
.) The patternData
field is only set if the pattern field is customPattern
. Therefore, it's a good idea to use
WinGetPatternType
instead of this function on systems that support
WinGetPatternType
.
WinSetPattern
PatternType WinGetPatternType (void)
PatternType
). If the return value is customPattern
, you can retrieve the pattern with
WinGetPattern
.
WinSetPatternType
IndexedColorType WinGetPixel (Coord x, Coord y)
  |
|
Pointer to the x coordinate of a pixel. |
  |
|
Pointer to the y coordinate of a pixel. |
IndexedColorType
. A return value of 0 means either that the coordinates do not lie in the current draw window or that they do and the color of that pixel is index 0 (typically white).
WinIndexToRGB
void WinGetWindowBounds (RectangleType *rP)
WinGetWindowExtent
,
WinSetWindowBounds
void WinGetWindowExtent (Coord *extentX, Coord *extentY)
  |
|
Pointer to the width in pixels of the draw window. |
  |
|
Pointer to the height in pixels of the draw window. |
WinGetWindowBounds
,
WinGetWindowFrameRect
,
void WinGetWindowFrameRect (WinHandle winHandle, RectangleType *r)
  |
|
Handle of window whose coordinates are desired. |
  |
|
Pointer to the coordinates of the window. |
WinGetWindowBounds
void WinIndexToRGB (IndexedColorType i, RGBColorType *rgbP)
  |
|
A color index value. See IndexedColorType . |
  |
|
Pointer to an RGB color value corresponding to the index value i . See RGBColorType . |
WinRGBToIndex
void WinInvertChars (const Char *chars, Int16 len, Coord x, Coord y)
  |
|
Pointer to the characters to invert. |
  |
|
Length in bytes of the characters to invert. |
  |
|
x coordinate of the first character to invert (left bound). |
  |
|
y coordinate of the first character to invert (top bound). |
winInvert
operation of
WinDrawOperation
to the characters in the draw window.
WinSetDrawMode
to set the current draw mode to winSwap
, and then use
WinPaintChars
to draw the characters.
WinDrawOperation
winInvert
).
void WinInvertLine (Coord x1, Coord y1, Coord x2, Coord y2)
  |
|
x coordinate of line start point. |
  |
|
y coordinate of line start point. |
  |
|
x coordinate of line endpoint. |
  |
|
y coordinate of line endpoint. |
WinDrawOperation
winInvert
).
void WinInvertPixel (Coord x, Coord y)
  |
|
Pointer to the x coordinate of a pixel. |
  |
|
Pointer to the y coordinate of a pixel. |
WinDrawOperation
winInvert
).
void WinInvertRectangle (RectangleType *rP, UInt16 cornerDiam)
  |
|
Pointer to the rectangle to invert. |
  |
|
Radius of rounded corners. Specify zero for square corners. |
cornerDiam
parameter specifies the radius of four imaginary circles used to form the rounded corners. An imaginary circle is placed within each corner tangent to the rectangle on two sides.
winSwap
transfer mode, or it changes the color selection and uses the WinPaint...
routines.
WinDrawOperation
winInvert
).
void WinInvertRectangleFrame (FrameType frame, RectangleType *rP)
  |
|
Type of frame to draw (see FrameType ). |
  |
|
Pointer to the rectangle to frame. |
true
if the specified window is modal.
Boolean WinModal (WinHandle winHandle)
true
if the window is modal, otherwise false
.
FrmAlert
,
FrmCustomAlert
,
FrmDoDialog
void WinPaintBitmap (BitmapType *bitmapP, Coord x, Coord y)
  |
|
Pointer to a bitmap. |
  |
|
The x coordinate of the top-left corner. |
  |
|
The y coordinate of the top-left corner. |
WinPaintBitmap
is now recommended instead of the previous practice of rendering bitmaps into an offscreen window and then using
WinCopyRectangle
to draw them on screen.
WinSetDrawMode
.
WinPalette
to change the system color table, draw the bitmap, and then change the system color table back when the bitmap is no longer visible.
WinDrawBitmap
,
WinEraseRectangle
void WinPaintChar (WChar theChar, Coord x, Coord y)
  |
|
The character to draw. This may be either a single-byte character or a multi-byte character. |
  |
|
x coordinate of the location where the character is to be drawn (left bound). |
  |
|
y coordinate of the location where the character is to be drawn (top bound). |
WinPaintChar
draws the on bits in the text color and the off bits in the background color, with underlines (if any) drawn in the foreground color using the current drawing mode.
DrawStateType
structure. See the description of that structure to learn the functions you can call to set the drawing state to the values you want.
void WinPaintChars (const Char *chars, Int16 len, Coord x, Coord y)
  |
|
Pointer to the characters to draw. |
  |
|
Length in bytes of the characters to draw. |
  |
|
x coordinate of the first character to draw (left bound). |
  |
|
y coordinate of the first character to draw (top bound). |
WinPaintChars
draws the on bits in the text color and the off bits in the background color, with underlines (if any) drawn in the foreground color using the current drawing mode.
DrawStateType
structure. See the description of that structure to learn the functions you can call to set the drawing state to the state you want.
FntSetFont
.
void WinPaintLine (Coord x1, Coord y1, Coord x2, Coord y2)
  |
|
x coordinate of line beginning point. |
  |
|
y coordinate of line beginning point. |
  |
|
x coordinate of line endpoint. |
  |
|
y coordinate of line endpoint. |
DrawStateType
structure. See the description of that structure to learn the functions you can call to set the drawing state to the state you want.
void WinPaintLines (UInt16 numLines, WinLineType lines[])
  |
|
Number of lines to paint. |
  |
|
Array of lines. See WinLineType . |
DrawStateType
structure. See the description of that structure to learn the functions you can call to set the drawing state to the state you want.
void WinPaintPixel (Coord x, Coord y)
  |
|
Pointer to the x coordinate of a pixel. |
  |
|
Pointer to the y coordinate of a pixel. |
DrawStateType
structure. See the description of that structure to learn the functions you can call to set the drawing state to the state you want.
void WinPaintPixels (UInt16 numPoints, PointType pts[])
DrawStateType
structure. See the description of that structure to learn the functions you can call to set the drawing state to the state you want.
void WinPaintRectangle (RectangleType *rP, UInt16 cornerDiam)
  |
|
Pointer to the rectangle to draw. |
  |
|
Radius of rounded corners. Specify zero for square corners. |
cornerDiam
parameter specifies the radius of four imaginary circles used to form the rounded corners. An imaginary circle is placed within each corner tangent to the rectangle on two sides.
DrawStateType
structure. See the description of that structure to learn the functions you can call to set the drawing state to the state you want.
void WinPaintRectangleFrame (FrameType frame, RectangleType *rP)
  |
|
Type of frame to draw (see FrameType ). |
  |
|
Pointer to the rectangle to frame. |
DrawStateType
structure. See the description of that structure to learn the functions you can call to set the drawing state to the state you want.
Err WinPalette (UInt8 operation, Int16 startIndex, UInt16 paletteEntries, RGBColorType *tableP)
  |
|
Specify one of the following values: |
  |
|
Retrieve the palette. Entries are read from the palette beginning at startIndex and placed into tableP beginning at index 0. |
  |
|
Set the palette. Entries from tableP (beginning at index 0) are set into the palette beginning at startIndex in the palette. |
  |
|
Set the palette to the default system palette. |
  |
|
Number of palette entries to get or set. |
startIndex
is 0 and paletteEntries
is 10, the first 10 elements of the palette will be set from tableP
or will be copied into tableP
. startIndex
is 10 and paletteEntries
is 5, then entries 10, 11, 12, 13, and 14 in the palette will be set from or copied to elements 0, 1, 2, 3, and 4 in tableP
. startIndex
is WinUseTableIndexes
and paletteEntries
is 1, then the index value in the RGBColorType
of element 0 of tableP
will be read from or copied to tableP
; in this case, the index
field of the RGBColorType
will not change.sysNotifyDisplayChangeEvent
to notify any interested observer that the color palette has changed. For information on this and other notifications, see Chapter 36, "Notification Manager."
WinPalette
to change the system color table to match that used by the bitmap, display the bitmap, and use WinPalette
to reset the color table when the bitmap is no longer visible.
void WinPopDrawState (void)
drawStateP
field points to the restored drawing state.
void WinPushDrawState (void)
DrawStateType
structure's description. Call WinPopDrawState to restore the saved settings.
void WinResetClip (void)
WinSetClip
void WinRestoreBits (WinHandle winHandle, Coord destX, Coord destY)
  |
|
Handle of window to copy and delete. |
  |
|
x coordinate in the draw window to copy to. |
  |
|
y coordinate in the draw window to copy to. |
WinSaveBits
.
WinSaveBits
IndexedColorType WinRGBToIndex (const RGBColorType *rgbP)
rgbP
. If there is no exact RGB match, then a luminance best-fit is used if the color lookup table is entirely gray scale (red, green, and blue values for each entry are identical), or a shortest-distance fit in RGB space is used if the palette contains colors. RGB shortest distance may not always produce the actual closest perceptible color, but it's relatively fast and works for the system palette.
WinIndexToRGB
WinHandle WinSaveBits (RectangleType *sourceP, UInt16 *error)
  |
|
Pointer to the bounds of the region to save, relative to the display. |
  |
|
Pointer to any error encountered by this function. |
WinRestoreBits
UInt8* WinScreenLock (WinLockInitType initMode)
  |
|
Indicates how to initialize the new screen area. Specify one of the following values: |
  |
|
Copy old screen to new. |
  |
|
Erase new screen to white. |
  |
|
Don't do anything |
NULL
if this routine fails.
WinScreenUnlock
to unlock the display and cause it to be updated with any changes. The screen must be unlocked as many times as it is locked to actually update the display.
Err WinScreenMode (WinScreenModeOperation operation, UInt32 *widthP, UInt32 *heightP, UInt32 *depthP, Boolean *enableColorP)
widthP
, heightP
, depthP
, and enableColorP
parameters are used in different ways for different operations. See Comments at the end of this description for details.
  |
-> operation |
The work this function is to perform, as specified by one of the following selectors: |
  |
|
Return the current settings for the display. |
  |
|
Return the default settings for the display. |
  |
|
Return in depthP a hexadecimal value indicating the supported screen depths. The binary representation of this value defines a bitfield in which the value 1 indicates support for a particular display depth. The position representing a particular bit depth corresponds to the value 2 (bitDepth-1) . See the Example at the end of this function description for more information. |
  |
|
Return true as the value of the enableColorP parameter when color mode can be enabled. |
  |
|
Change display settings to the values specified by the other arguments to the WinScreenMode function. |
  |
|
Change display settings to default values. |
  |
<-> widthP |
Pointer to new/old screen width. |
  |
<-> heightP |
Pointer to new/old screen height. |
  |
<-> |
Pointer to new/old/available screen depth. |
  |
<-> enableColorP |
Pass true to enable color drawing mode. |
operation
argument. Various invalid arguments may cause this function to return a sysErrParamErr
result code. In rare cases, a failed allocation can cause this function to return a memErrNotEnoughSpace
error.
widthP
, heightP
, depthP
, and enableColorP
parameters are used in different ways for different operations. All "get" operations overwrite these values with a result when the function returns. The winScreenModeSet
operation changes current display parameters when passed valid argument values that are not NULL
pointers. The winScreenModeSetToDefaults
operation ignores values passed for all of these parameters.
NULL
pointer arguments to the widthP
, heightP
, depthP
, and enableColorP
parameters; thus, you can pass a NULL
pointer for any of these values to leave the current value unchanged. Similarly, when getting values, this function does not return a value for any NULL
pointer argument.
winScreenModeGetSupportedDepths
does. For example, to set the display depth to 8-bit mode, you use 8 (decimal) for the display depth, not 0x08 (128 decimal).
ScrDisplayMode
. The prototype for ScrDisplayMode
is similar to WinScreenMode
:
Err ScrDisplayMode ( ScrDisplayModeOperation operation, DWordPtr widthP, DWordPtr heightP, DWordPtr depthP, BooleanPtr enableColorP)
ScrDisplayMode
and WinScreenMode
is that the ScrDisplayModeOperation
constants begin with the prefix scrDisplayMode
rather than winScreenMode
.
winScreenModeGetSupportedDepths
mode of the WinScreenMode
function.
0x08
, or 23, which corresponds to a binary value of 1000
. Support for bit depths of 2 and 1 is indicated by a return value of 0x03
. Support for bit depths of 4, 2, and 1 is indicated by 0x0B
, which is a binary value of 1011
. Support for bit depths of 24, 8, 4 and 2 is indicated by 0x80008A
. The figure immediately following depicts this final example graphically.
void WinScreenUnlock (void)
WinScreenLock
void WinScrollRectangle (RectangleType *rP, WinDirectionType direction, Coord distance, RectangleType *vacatedP)
  |
|
Pointer to the rectangle to scroll. |
  |
|
Direction to scroll (winUp , winDown , winLeft , or winRight ). |
  |
|
Distance to scroll in pixels. |
  |
|
Pointer to the rectangle that needs to be redrawn because it has been vacated as a result of the scroll. |
void WinSetActiveWindow (WinHandle winHandle)
EvtGetEvent
sends a winExitEvent and a winEnterEvent when it detects these flags. The active window is set by EvtGetEvent
when it sends the winEnterEvent
. The draw window is also set to the new active window when the active window is changed.
WinGetActiveWindow
,
EvtGetEvent
IndexedColorType WinSetBackColor (IndexedColorType backColor)
WinPushDrawState
to preserve the current drawing state before you set this function and use
WinPopDrawState
to restore it later.
UIColorGetTableEntryIndex
as an input to this function. For example:
curColor = WinSetBackColor (UIColorGetTableEntryIndex(UIFieldBackground
));
WinSetForeColor
,
WinSetTextColor
void WinSetClip (RectangleType *rP)
WinDrawOperation WinSetDrawMode (WinDrawOperation newMode)
WinPushDrawState
to preserve the current drawing state before you set this function and use
WinPopDrawState
to restore it later.
WinHandle WinSetDrawWindow (WinHandle winHandle)
NULL
as a parameter to this function to set the draw window to the display window (or screen window). In version 3.5 and higher, this practice is discouraged. If winHandle
is NULL
, the debug ROM sets the draw window to badDrawWindowValue
, and you are warned if you try to draw to it.
WinGetDrawWindow
,
WinSetActiveWindow
IndexedColorType WinSetForeColor (IndexedColorType foreColor)
WinPushDrawState
to preserve the current drawing state before you set this function and use
WinPopDrawState
to restore it later.
UIColorGetTableEntryIndex
as an input to this function. For example:
curColor = WinSetForeColor
(UIColorGetTableEntryIndex
(UIObjectForeground));
WinSetBackColor
,
WinSetTextColor
void WinSetPattern (const CustomPatternType *patternP)
WinPushDrawState
to preserve the current drawing state before you set this function and use
WinPopDrawState
to restore it later.
WinGetPattern
void WinSetPatternType (PatternType newPattern)
pattern
field of the drawing state to newPattern
and sets the patternData
field to NULL
. To set patternData
to a custom pattern use
WinSetPattern
.
WinPushDrawState
to preserve the current drawing state before you set this function and use
WinPopDrawState
to restore it later.
WinGetPatternType
IndexedColorType WinSetTextColor (IndexedColorType textColor)
WinPushDrawState
to preserve the current drawing state before you set this function and use
WinPopDrawState
to restore it later.
UIColorGetTableEntryIndex
as an input to this function. For example:
curColor = WinSetTextColor
    (UIColorGetTableEntryIndex(UIFieldText));
WinSetBackColor
,
WinSetForeColor
UnderlineModeType WinSetUnderlineMode (UnderlineModeType mode)
WinPushDrawState
to preserve the current drawing state before you set this function and use
WinPopDrawState
to restore it later.
WinDrawChars
void WinSetWindowBounds (WinHandle winHandle, RectangleType *rP)
  |
|
Handle for the window for which to set the bounds. |
  |
|
Pointer to a rectangle to use for bounds. |
WinGetWindowBounds
true
if the specified handle references a valid window object.
Boolean WinValidateHandle (WinHandle winHandle)
true
if the specified handle references a non-NULL
pointer to a window in the active window list, false
if the handle references a window whose values are out of sync with the current system state.
FrmValidatePtr
,
FrmRemoveObject
void WinWindowToDisplayPt (Coord *extentX, Coord *extentY)
  |
|
Pointer to x coordinate to convert. |
  |
|
Pointer to y coordinate to convert. |
WinDisplayToWindowPt
  |   |