1
(******************************************************************************
3
* Copyright (c) 1994-2000 Palm, Inc. or its subsidiaries.
8
* Release: Palm OS SDK 4.0 (63220)
11
* This file defines window structures and routines that support color.
14
* January 20, 1999 Created by Bob Ebert
15
* Name Date Description
16
* ---- ---- -----------
17
* bob 1/20/99 Branch off WindowNew.h
18
* BS 4/20/99 Re-design of the screen driver
19
* bob 5/26/99 Cleanup/reorg
20
* jmp 12/23/99 Fix <> vs. "" problem.
22
*****************************************************************************)
28
uses palmos, coretraps, rect, errorbase, bitmap;
33
// enum for WinScrollRectangle
35
WinDirectionType = Enum;
39
winDown = Succ(winUp);
40
winLeft = Succ(winDown);
41
winRight = Succ(winLeft);
43
// enum for WinCreateOffscreenWindow
45
WindowFormatType = Enum;
49
genericFormat = Succ(screenFormat);
51
// enum for WinLockScreen
53
WinLockInitType = Enum;
57
winLockErase = Succ(winLockCopy);
58
winLockDontCare = Succ(winLockErase);
60
// operations for the WinScreenMode function
62
WinScreenModeOperation = Enum;
65
winScreenModeGetDefaults = 0;
66
winScreenModeGet = Succ(winScreenModeGetDefaults);
67
winScreenModeSetToDefaults = Succ(winScreenModeGet);
68
winScreenModeSet = Succ(winScreenModeSetToDefaults);
69
winScreenModeGetSupportedDepths = Succ(winScreenModeSet);
70
winScreenModeGetSupportsColor = Succ(winScreenModeGetSupportedDepths);
72
// Operations for the WinPalette function
76
winPaletteSetToDefault = 2;
77
winPaletteInit = 3; // for internal use only
79
// transfer modes for color drawing
81
WinDrawOperation = Enum;
85
winErase = Succ(winPaint);
86
winMask = Succ(winErase);
87
winInvert = Succ(winMask);
88
winOverlay = Succ(winInvert);
89
winPaintInverse = Succ(winOverlay);
90
winSwap = Succ(winPaintInverse);
97
whitePattern = Succ(blackPattern);
98
grayPattern = Succ(whitePattern);
99
customPattern = Succ(grayPattern);
102
noPattern = blackPattern;
103
grayHLinePattern = $AA;
104
grayHLinePatternOdd = $55;
106
// grayUnderline means dotted current foreground color
107
// solidUnderline means solid current foreground color
108
// colorUnderline redundant, use solidUnderline instead
110
UnderlineModeType = Enum;
114
grayUnderline = Succ(noUnderline);
115
solidUnderline = Succ(grayUnderline);
116
colorUnderline = Succ(solidUnderline);
119
WinMaxSupportedDepth = 8;
120
WinNumSupportedColors = 4;
123
IndexedColorType = UInt8; // 1-, 2-, 4-, or 8-bit index
124
CustomPatternType = array [0..7] of UInt8; // 8x8 1-bit deep pattern
125
CustomPatternPtr = ^CustomPatternType;
127
// for WinPalette startIndex value, respect indexes in passed table
129
WinUseTableIndexes = -1;
131
//-----------------------------------------------
132
// Draw state structures.
133
//-----------------------------------------------
136
DrawStateType = record
137
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_WINDOWS} // These fields will not be available in the next OS release!
138
transferMode: WinDrawOperation;
139
pattern: PatternType;
140
underlineMode: UnderlineModeType;
143
patternData: CustomPatternType;
145
// These are only valid for indexed color bitmaps
147
foreColor: IndexedColorType;
148
backColor: IndexedColorType;
149
textColor: IndexedColorType;
152
// These are only valid for direct color bitmaps
153
foreColorRGB: RGBColorType;
154
backColorRGB: RGBColorType;
155
textColorRGB: RGBColorType;
160
DrawStateStackSize = 5; // enough for a control in a field in a window
162
//-----------------------------------------------
163
// The Window Structures.
164
//-----------------------------------------------
167
FrameBitsType = record
172
UInt16 cornerDiam : 8; // corner diameter, max 38
173
UInt16 reserved_3 : 3;
174
UInt16 threeD : 1; // Draw 3D button
175
UInt16 shadowWidth : 2; // Width of shadow
176
UInt16 width : 2; // Width frame
179
2: (word: UInt16); // IMPORTANT: INITIALIZE word to zero before setting bits!
184
// Standard Frame Types
189
simple3DFrame = $0012; // 3d, frame = 2
190
roundFrame = $0401; // corner = 7, frame = 1
191
boldRoundFrame = $0702; // corner = 7, frame = 2
192
popupFrame = $0205; // corner = 2, frame = 1, shadow = 1
193
dialogFrame = $0302; // corner = 3, frame = 2
194
menuFrame = popupFrame;
196
winDefaultDepthFlag = $FF;
199
WindowFlagsType = record
200
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_WINDOWS} // These fields will not be available in the next OS release!
203
UInt16 format:1; // window format: 0=screen mode; 1=generic mode
204
UInt16 offscreen:1; // offscreen flag: 0=onscreen ; 1=offscreen
205
UInt16 modal:1; // modal flag: 0=modeless window; 1=modal window
206
UInt16 focusable:1; // focusable flag: 0=non-focusable; 1=focusable
207
UInt16 enabled:1; // enabled flag: 0=disabled; 1=enabled
208
UInt16 visible:1; // visible flag: 0-invisible; 1=visible
209
UInt16 dialog:1; // dialog flag: 0=non-dialog; 1=dialog
210
UInt16 freeBitmap:1; // free bitmap w/window: 0=don't free, 1=free
217
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_WINDOWS} // These fields will not be available in the next OS release!
218
displayWidthV20: Coord; // use WinGetDisplayExtent instead
219
displayHeightV20: Coord; // use WinGetDisplayExtent instead
220
displayAddrV20: Pointer; // use the drawing functions instead
221
windowFlags: WindowFlagsType;
222
windowBounds: RectangleType;
223
clippingBounds: AbsRectType;
225
frameType: FrameBitsType;
226
drawStateP: ^DrawStateType; // was GraphicStatePtr
227
nextWindow: ^WindowType;
231
WinPtr = ^WindowType;
232
WinHandle = ^WindowType;
234
//-----------------------------------------------
235
// More graphics shapes
236
//-----------------------------------------------
244
WinLinePtr = ^WinLineType;
246
// Rectangles, Points defined in Rect.h
248
//-----------------------------------------------
249
// Low Memory Globals
250
//-----------------------------------------------
252
// This is the structure of a low memory global reserved for the Window Manager
253
// In GRAPHIC_VERSION_2, it held a single drawing state. In this version, it
254
// holds stack information for structures that are allocated from the dynamic heap
256
GraphicStateType = record
257
{$ifdef ALLOW_ACCESS_TO_INTERNALS_OF_WINDOWS} // These fields will not be available in the next OS release!
258
drawStateP: ^DrawStateType;
259
drawStateStackP: ^DrawStateType;
260
drawStateIndex: Int16;
261
unused: UInt16; //was screenLockCount
265
// ----------------------
266
// Window manager errors
267
// ----------------------
270
winErrPalette = winErrorClass or 1;
272
//-----------------------------------------------
274
//-----------------------------------------------
276
// For now, the window handle is a pointer to a window structure,
277
// this however may change, so use the following macros.
279
function WinGetWindowPointer(winHandle: WinHandle): WinPtr;
281
function WinGetWindowHandle(winPtr: WinPtr): WinHandle;
283
//-----------------------------------------------
284
// Routines relating to windows management
285
//-----------------------------------------------
287
function WinValidateHandle(winHandle: WinHandle): Boolean; syscall sysTrapWinValidateHandle;
289
function WinCreateWindow({const} var bounds: RectangleType; frame: FrameType; modal, focusable: Boolean;
290
var error: UInt16): WinHandle; syscall sysTrapWinCreateWindow;
292
function WinCreateOffscreenWindow(width, height: Coord; format: WindowFormatType; var error: UInt16): WinHandle; syscall sysTrapWinCreateOffscreenWindow;
294
function WinCreateBitmapWindow(bitmapP: BitmapPtr; var error: UInt16): WinHandle; syscall sysTrapWinCreateBitmapWindow;
296
procedure WinDeleteWindow(winHandle: WinHandle; eraseIt: Boolean); syscall sysTrapWinDeleteWindow;
298
procedure WinInitializeWindow(winHandle: WinHandle); syscall sysTrapWinInitializeWindow;
300
procedure WinAddWindow(winHandle: WinHandle); syscall sysTrapWinAddWindow;
302
procedure WinRemoveWindow(winHandle: WinHandle); syscall sysTrapWinRemoveWindow;
304
procedure WinMoveWindowAddr(oldLocationP, newLocationP: WinPtr); syscall sysTrapWinMoveWindowAddr;
306
procedure WinSetActiveWindow(winHandle: WinHandle); syscall sysTrapWinSetActiveWindow;
308
function WinSetDrawWindow(winHandle: WinHandle): WinHandle; syscall sysTrapWinSetDrawWindow;
310
function WinGetDrawWindow: WinHandle; syscall sysTrapWinGetDrawWindow;
312
function WinGetActiveWindow: WinHandle; syscall sysTrapWinGetActiveWindow;
314
function WinGetDisplayWindow: WinHandle; syscall sysTrapWinGetDisplayWindow;
316
function WinGetFirstWindow: WinHandle; syscall sysTrapWinGetFirstWindow;
318
procedure WinEnableWindow(winHandle: WinHandle); syscall sysTrapWinEnableWindow;
320
procedure WinDisableWindow(winHandle: WinHandle); syscall sysTrapWinDisableWindow;
322
procedure WinGetWindowFrameRect(winHandle: WinHandle; var r: RectangleType); syscall sysTrapWinGetWindowFrameRect;
324
procedure WinDrawWindowFrame; syscall sysTrapWinDrawWindowFrame;
326
procedure WinEraseWindow; syscall sysTrapWinEraseWindow;
328
function WinSaveBits({const} var source: RectangleType; var error: UInt16): WinHandle; syscall sysTrapWinSaveBits;
330
procedure WinRestoreBits(winHandle: WinHandle; destX, destY: Coord); syscall sysTrapWinRestoreBits;
332
procedure WinCopyRectangle(srcWin, dstWin: WinHandle; {const} var srcRect: RectangleType;
333
destX, destY: Coord; mode: WinDrawOperation); syscall sysTrapWinCopyRectangle;
335
procedure WinScrollRectangle({const} var rP: RectangleType; direction: WinDirectionType;
336
distance: Coord; var vacatedP: RectangleType); syscall sysTrapWinScrollRectangle;
338
procedure WinGetDisplayExtent(var extentX, extentY: Coord); syscall sysTrapWinGetDisplayExtent;
340
procedure WinGetDrawWindowBounds(var rP: RectangleType); syscall sysTrapWinGetDrawWindowBounds;
342
procedure WinGetBounds(winH: WinHandle; var rP: RectangleType); syscall sysTrapWinGetBounds;
344
procedure WinSetBounds(winHandle: WinHandle; {const} var rP: RectangleType); syscall sysTrapWinSetBounds;
346
{$ifdef ALLOW_OLD_API_NAMES}
347
procedure WinGetWindowBounds(var rP: RectangleType); syscall sysTrapWinGetWindowBounds;
349
procedure WinSetWindowBounds(winHandle: WinHandle; {const} var rP: RectangleType); syscall WinSetWindowBounds;
352
procedure WinGetWindowExtent(var extentX, extentY: Coord); syscall sysTrapWinGetWindowExtent;
354
procedure WinDisplayToWindowPt(var extentX, extentY: Coord); syscall sysTrapWinDisplayToWindowPt;
356
procedure WinWindowToDisplayPt(var extentX, extentY: Coord); syscall sysTrapWinWindowToDisplayPt;
358
function WinGetBitmap(winHandle: WinHandle): BitmapPtr; syscall sysTrapWinGetBitmap;
360
procedure WinGetClip(var rP: RectangleType); syscall sysTrapWinGetClip;
362
procedure WinSetClip({const} var rP: RectangleType); syscall sysTrapWinSetClip;
364
procedure WinResetClip; syscall sysTrapWinResetClip;
366
procedure WinClipRectangle(var rP: RectangleType); syscall sysTrapWinClipRectangle;
368
function WinModal(winHandle: WinHandle): Boolean; syscall sysTrapWinModal;
370
//-----------------------------------------------
371
// Routines to draw shapes or frames shapes
372
//-----------------------------------------------
375
function WinGetPixel(x, y: Coord): IndexedColorType; syscall sysTrapWinGetPixel;
377
procedure WinPaintPixel(x, y: Coord); syscall sysTrapWinPaintPixel; // uses drawing mode
379
function WinGetPixelRGB (x, y: Coord; var rgbP: RGBColorType): Err; syscall sysTrapWinGetPixelRGB; // Direct color version
381
procedure WinDrawPixel(x, y: Coord); syscall sysTrapWinDrawPixel;
383
procedure WinErasePixel(x, y: Coord); syscall sysTrapWinErasePixel;
385
procedure WinInvertPixel(x, y: Coord); syscall sysTrapWinInvertPixel;
387
procedure WinPaintPixels(numPoints: UInt16; pts: PointPtr); syscall sysTrapWinPaintPixels;
390
procedure WinPaintLines(numLines: UInt16; lines: WinLinePtr); syscall sysTrapWinPaintLines;
392
procedure WinPaintLine(x1, y1, x2, y2: Coord); syscall sysTrapWinPaintLine;
394
procedure WinDrawLine(x1, y1, x2, y2: Coord); syscall sysTrapWinDrawLine;
396
procedure WinDrawGrayLine(x1, y1, x2, y2: Coord); syscall sysTrapWinDrawGrayLine;
398
procedure WinEraseLine(x1, y1, x2, y2: Coord); syscall sysTrapWinEraseLine;
400
procedure WinInvertLine(x1, y1, x2, y2: Coord); syscall sysTrapWinInvertLine;
402
procedure WinFillLine(x1, y1, x2, y2: Coord); syscall sysTrapWinFillLine;
405
procedure WinPaintRectangle({const} var rP: RectangleType; cornerDiam: UInt16); syscall sysTrapWinPaintRectangle;
407
procedure WinDrawRectangle({const} var rP: RectangleType; cornerDiam: UInt16); syscall sysTrapWinDrawRectangle;
409
procedure WinEraseRectangle({const} var rP: RectangleType; cornerDiam: UInt16); syscall sysTrapWinEraseRectangle;
411
procedure WinInvertRectangle({const} var rP: RectangleType; cornerDiam: UInt16); syscall sysTrapWinInvertRectangle;
413
procedure WinFillRectangle({const} var rP: RectangleType; cornerDiam: UInt16); syscall sysTrapWinFillRectangle;
416
procedure WinPaintRectangleFrame(frame: FrameType; {const} var rP: RectangleType); syscall sysTrapWinPaintRectangleFrame;
418
procedure WinDrawRectangleFrame(frame: FrameType; {const} var rP: RectangleType); syscall sysTrapWinDrawRectangleFrame;
420
procedure WinDrawGrayRectangleFrame(frame: FrameType; {const} var rP: RectangleType); syscall sysTrapWinDrawGrayRectangleFrame;
422
procedure WinEraseRectangleFrame(frame: FrameType; {const} var rP: RectangleType); syscall sysTrapWinEraseRectangleFrame;
424
procedure WinInvertRectangleFrame(frame: FrameType; {const} var rP: RectangleType); syscall sysTrapWinInvertRectangleFrame;
426
procedure WinGetFramesRectangle(frame: FrameType; {const} var rP, obscuredRect: RectangleType); syscall sysTrapWinGetFramesRectangle;
429
procedure WinDrawBitmap(bitmapP: BitmapPtr; x, y: Coord); syscall sysTrapWinDrawBitmap;
431
procedure WinPaintBitmap(bitmapP: BitmapPtr; x, y: Coord); syscall sysTrapWinPaintBitmap;
434
procedure WinDrawChar(theChar: WChar; x, y: Coord); syscall sysTrapWinDrawChar;
436
procedure WinDrawChars(const chars: PChar; len: Int16; x, y: Coord); syscall sysTrapWinDrawChars;
438
procedure WinPaintChar(theChar: WChar; x, y: Coord); syscall sysTrapWinPaintChar;
440
procedure WinPaintChars(const chars: PChar; len: Int16; x, y: Coord); syscall sysTrapWinPaintChars;
442
procedure WinDrawInvertedChars(const chars: PChar; len: Int16; x, y: Coord); syscall sysTrapWinDrawInvertedChars;
444
procedure WinDrawTruncChars(const chars: PChar; len: Int16; x, y, maxWidth: Coord); syscall sysTrapWinDrawTruncChars;
446
procedure WinEraseChars(const chars: PChar; len: Int16; x, y: Coord); syscall sysTrapWinEraseChars;
448
procedure WinInvertChars(const chars: PChar; len: Int16; x, y: Coord); syscall sysTrapWinInvertChars;
450
function WinSetUnderlineMode(mode: UnderlineModeType): UnderlineModeType; syscall sysTrapWinSetUnderlineMode;
452
//-----------------------------------------------
453
// Routines for patterns and colors
454
//-----------------------------------------------
456
procedure WinPushDrawState; syscall sysTrapWinPushDrawState; // "save" fore, back, text color, pattern, underline mode, font
458
procedure WinPopDrawState; syscall sysTrapWinPopDrawState; // "restore" saved drawing variables
460
function WinSetDrawMode(newMode: WinDrawOperation): WinDrawOperation; syscall sysTrapWinSetDrawMode;
462
function WinSetForeColor(foreColor: IndexedColorType): IndexedColorType; syscall sysTrapWinSetForeColor;
464
function WinSetBackColor(backColor: IndexedColorType): IndexedColorType; syscall sysTrapWinSetBackColor;
466
function WinSetTextColor(textColor: IndexedColorType): IndexedColorType; syscall sysTrapWinSetTextColor;
468
// Direct color versions
469
procedure WinSetForeColorRGB(const newRgbP: RGBColorPtr; prevRgbP: RGBColorPtr); syscall sysTrapWinSetForeColorRGB;
471
procedure WinSetBackColorRGB(const newRgbP: RGBColorPtr; prevRgbP: RGBColorPtr); syscall sysTrapWinSetBackColorRGB;
473
procedure WinSetTextColorRGB(const newRgbP: RGBColorPtr; prevRgbP: RGBColorPtr); syscall sysTrapWinSetTextColorRGB;
475
procedure WinGetPattern(patternP: CustomPatternPtr); syscall sysTrapWinGetPattern;
477
function WinGetPatternType: PatternType; syscall sysTrapWinGetPatternType;
479
procedure WinSetPattern(const patternP: CustomPatternPtr); syscall sysTrapWinSetPattern;
481
procedure WinSetPatternType(newPattern: PatternType); syscall sysTrapWinSetPatternType;
483
function WinPalette(operation: UInt8; startIndex: Int16; paletteEntries: UInt16; tableP: RGBColorPtr): Err; syscall sysTrapWinPalette;
485
function WinRGBToIndex(const rgbP: RGBColorPtr): IndexedColorType; syscall sysTrapWinRGBToIndex;
487
procedure WinIndexToRGB(i: IndexedColorType; rgbP: RGBColorPtr); syscall sysTrapWinIndexToRGB;
489
// "obsolete" color call, supported for backwards compatibility
491
procedure WinSetColors(const newForeColorP: RGBColorPtr; oldForeColorP: RGBColorPtr;
492
const newBackColorP: RGBColorPtr; oldBackColorP: RGBColorPtr); syscall sysTrapWinSetColors;
495
//-----------------------------------------------
496
// WinScreen functions
497
//-----------------------------------------------
499
procedure WinScreenInit; syscall sysTrapWinScreenInit;
501
function WinScreenMode(operation: WinScreenModeOperation; var widthP, heightP, depthP: UInt32;
502
var enableColorP: Boolean): Err; syscall sysTrapWinScreenMode;
504
//-----------------------------------------------
505
// Screen tracking (double buffering) support
506
//-----------------------------------------------
508
function WinScreenLock(initMode: WinLockInitType): UInt8Ptr; syscall sysTrapWinScreenLock;
510
procedure WinScreenUnlock; syscall sysTrapWinScreenUnlock;
514
function WinGetWindowPointer(winHandle: WinHandle): WinPtr;
516
WinGetWindowPointer := winHandle;
519
function WinGetWindowHandle(winPtr: WinPtr): WinHandle;
521
WinGetWindowHandle := winPtr
b'\\ No newline at end of file'