home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
macintosh-pascal
/
macintoshp-1.2-demos.sit.hqx
/
chap23pascal_demo
/
chap20pascal_demoPPC
/
WDEFPascalPPC
/
WDEFPascalPPC.p
next >
Wrap
Text File
|
1997-01-09
|
19KB
|
685 lines
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊
// WDEFPascalPPC.p Custom Window Definition Function for Floating Windows
// ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊
//
// This WDEF creates a utility window whose appearance conforms to that specified in the
// document titled Apple Grayscale Appearance for System 7.5 and published by Apple
// Computer, Inc. On black-and-white displays, the WDEF is drawn in black-and-white with
// an appearance similar to the black-and-white floating windows found in many commercial
// applications. The WDEF supports only one variation code. It provides for a close box
// but not for a zoom box or window title.
//
// The WDEF utilises three 'cicn' resources (nonpurgeable), one for the close box in the
// normal state, one for the close box in the pressed state, and one to paint the
// checkered pattern in the title bar.
//
// ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ }
unit WDEFPascal;
{ ……………………………………………………………………………………………………………………………………………………………………… unit interface section }
interface
{ ………………………………………………………………………………………………………………… include the following Universal Interfaces }
uses
Types, Windows;
{ ………………………………………………………………………………………………………………………………………………… define the following constants }
const
rCloseEnabledIcon = 128;
rClosePressedIcon = 129;
rCheckPatternIcon = 130;
{ ………………………………………………………………………………………………………………………………………………………………… main procedure interface }
{$MAIN}
function main(varCode : integer; theWindowPeek : WindowPeek; message : integer;
param : longint) : longint;
{ ………………………………………………………………………………………………………………………………………………………… unit implementation section }
implementation
{ ………………………………………………………………………………………………………………… include the following Universal Interfaces }
uses
Windows, Fonts, Menus, Quickdraw, ToolUtils, OSUtils, Devices, LowMem,
GestaltEqu;
{ ………………………………………………………………………………………………………………………………………………………………………………… user-defined types }
type
Globals = record
gColourQuickDrawPresent : boolean;
gColourDisplay : boolean;
gBlackPattern : Pattern;
gCloseEnabledHdl : CIconHandle;
gClosePressedHdl : CIconHandle;
gCheckPatternHdl : CIconHandle;
gWhite : RGBColor;
gGray1 : RGBColor;
gGray2 : RGBColor;
gGray3 : RGBColor;
gGray4 : RGBColor;
gGray6 : RGBColor;
gGray7 : RGBColor;
gGray8 : RGBColor;
gGray10 : RGBColor;
gBlack : RGBColor;
gToggle : boolean;
end;
GlobalsPointer = ^Globals;
GlobalsHandle = ^GlobalsPointer;
{ ……………………………………………………………………………………………………………………………………………procedure and function interfaces }
procedure DoInitMessage(theWindowPeek : WindowPeek); forward;
procedure DoDrawMessage(theWindowPeek : WindowPeek; param : longint); forward;
function DoHitMessage(theWindowPeek : WindowPeek; param : longint) : longint; forward;
procedure DoCalcRgnsMessage(theWindowPeek : WindowPeek); forward;
procedure DrawWindowColour(theWindowPeek : WindowPeek); forward;
procedure DrawWindowMono(theWindowPeek : WindowPeek); forward;
procedure ToggleGoAway(theWindowPeek : WindowPeek); forward;
procedure DrawGoAwayBox(theWindowPeek : WindowPeek); forward;
procedure DrawGoAwayBoxPressed(theWindowPeek : WindowPeek); forward;
procedure GetGoAwayRect(theWindowPeek : WindowPeek; var theRect : Rect); forward;
procedure GetContentRect(theWindowPeek : WindowPeek; var theRect : Rect); forward;
procedure GetStructRect(theWindowPeek : WindowPeek; var theRect : Rect); forward;
procedure SyncPorts; forward;
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ main }
function main(varCode : integer; theWindowPeek : WindowPeek; message : integer;
param : longint) : longint;
var
result : longint;
oldPort : GrafPtr;
oldPenState : PenState;
{$IFC GENERATING68k} { For PowerPC }
oldA4, ignored : longint;
{$ENDC} { For PowerPC }
begin
{$IFC GENERATING68K } { For PowerPC }
oldA4 := SetCurrentA4;
{$ENDC} { For PowerPC }
GetPenState(oldPenState);
GetPort(oldPort);
if (theWindowPeek^.dataHandle <> nil) then
if (GlobalsHandle(theWindowPeek^.dataHandle)^^.gColourQuickDrawPresent) then
SyncPorts;
result := 0;
case (message) of
wNew: begin
DoInitMessage(theWindowPeek);
end;
wDraw: begin
if (theWindowPeek^.visible) then
DoDrawMessage(theWindowPeek, param);
end;
wHit: begin
result := DoHitMessage(theWindowPeek, param);
end;
wCalcRgns: begin
DoCalcRgnsMessage(theWindowPeek);
end;
end;
{of case statement}
SetPenState(oldPenState);
SetPort(oldPort);
main := result;
{$IFC GENERATING68K } { For PowerPC }
ignored := SetA4(oldA4);
{$ENDC} { For PowerPC }
end;
{of function main}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ DoInitMessage }
procedure DoInitMessage(theWindowPeek : WindowPeek);
var
theErr : OSErr;
response : longint;
mainDeviceHdl : GDHandle;
bitsPerPixel, a : integer;
dataHdl : GlobalsHandle;
begin
dataHdl := GlobalsHandle(NewHandleClear(sizeof(Globals)));
if (dataHdl <> nil) then
begin
dataHdl^^.gWhite.red := $FFFF;
dataHdl^^.gWhite.blue := $FFFF;
dataHdl^^.gWhite.green := $FFFF;
dataHdl^^.gGray1.red := $EEEE;
dataHdl^^.gGray1.blue := $EEEE;
dataHdl^^.gGray1.green := $EEEE;
dataHdl^^.gGray2.red := $DDDD;
dataHdl^^.gGray2.blue := $DDDD;
dataHdl^^.gGray2.green := $DDDD;
dataHdl^^.gGray3.red := $CCCC;
dataHdl^^.gGray3.blue := $CCCC;
dataHdl^^.gGray3.green := $CCCC;
dataHdl^^.gGray4.red := $BBBB;
dataHdl^^.gGray4.blue := $BBBB;
dataHdl^^.gGray4.green := $BBBB;
dataHdl^^.gGray6.red := $9999;
dataHdl^^.gGray6.blue := $9999;
dataHdl^^.gGray6.green := $9999;
dataHdl^^.gGray7.red := $8888;
dataHdl^^.gGray7.blue := $8888;
dataHdl^^.gGray7.green := $8888;
dataHdl^^.gGray8.red := $7777;
dataHdl^^.gGray8.blue := $7777;
dataHdl^^.gGray8.green := $7777;
dataHdl^^.gGray10.red := $5555;
dataHdl^^.gGray10.blue := $5555;
dataHdl^^.gGray10.green := $5555;
dataHdl^^.gBlack.red := $0000;
dataHdl^^.gBlack.blue := $0000;
dataHdl^^.gBlack.green := $0000;
dataHdl^^.gColourQuickDrawPresent := false;
dataHdl^^.gColourDisplay := false;
dataHdl^^.gCloseEnabledHdl := nil;
dataHdl^^.gClosePressedHdl := nil;
dataHdl^^.gCheckPatternHdl := nil;
theErr := Gestalt(gestaltQuickdrawVersion, response);
if (response >= gestalt8BitQD) then
begin
dataHdl^^.gColourQuickDrawPresent := true;
mainDeviceHdl := LMGetMainDevice;
bitsPerPixel := mainDeviceHdl^^.gdPMap^^.pixelSize;
if (bitsPerPixel > 1) then
dataHdl^^.gColourDisplay := true;
end;
for a := 0 to 7 do
dataHdl^^.gBlackPattern.pat[a] := -1;
if (dataHdl^^.gColourQuickDrawPresent) then
begin
dataHdl^^.gCloseEnabledHdl := GetCIcon(rCloseEnabledIcon);
dataHdl^^.gClosePressedHdl := GetCIcon(rClosePressedIcon);
dataHdl^^.gCheckPatternHdl := GetCIcon(rCheckPatternIcon);
end;
dataHdl^^.gToggle := false;
theWindowPeek^.dataHandle := Handle(dataHdl);
end;
end;
{of procedure DoInitMessage}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ DoDrawMessage }
procedure DoDrawMessage(theWindowPeek : WindowPeek; param : longint);
var
tempLong : longint;
dataHdl : GlobalsHandle;
begin
dataHdl := GlobalsHandle(theWindowPeek^.dataHandle);
tempLong := BAnd(param, $0000FFFF);
param := tempLong;
case (param) of
wNoHit: begin
if (dataHdl^^.gColourQuickDrawPresent and dataHdl^^.gColourDisplay) then
DrawWindowColour(theWindowPeek)
else
DrawWindowMono(theWindowPeek);
end;
wInGoAway: begin
ToggleGoAway(theWindowPeek);
end;
otherwise begin
end;
end;
{of case statement}
end;
{of procedure DoDrawMessage}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ DoHitMessage }
function DoHitMessage(theWindowPeek : WindowPeek; param : longint) : longint;
var
where : Point;
goAwayRect : Rect;
begin
where.v := HiWord(param);
where.h := LoWord(param);
if (PtInRgn(where, theWindowPeek^.contRgn)) then
begin
DoHitMessage := wInContent;
Exit(DoHitMessage);
end
else if (PtInRgn(where, theWindowPeek^.strucRgn)) then
begin
if (theWindowPeek^.goAwayFlag) then
begin
GetGoAwayRect(theWindowPeek, goAwayRect);
if (PtInRect(where, goAwayRect)) then
begin
DoHitMessage := wInGoAway;
Exit(DoHitMessage);
end;
end;
DoHitMessage := wInDrag;
Exit(DoHitMessage);
end;
DoHitMessage := wNoHit;
end;
{of procedure DoHitMessage}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ DoCalcRgnsMessage }
procedure DoCalcRgnsMessage(theWindowPeek : WindowPeek);
var
tempRgn : RgnHandle;
theRect : Rect;
begin
tempRgn := NewRgn;
GetContentRect(theWindowPeek, theRect);
RectRgn(theWindowPeek^.contRgn, theRect);
GetStructRect(theWindowPeek, theRect);
RectRgn(theWindowPeek^.strucRgn, theRect);
OffsetRect(theRect, 1, 1);
theRect.left := theRect.left + 1;
theRect.top := theRect.top + 1;
RectRgn(tempRgn, theRect);
UnionRgn(tempRgn, theWindowPeek^.strucRgn, theWindowPeek^.strucRgn);
DisposeRgn(tempRgn);
end;
{of procedure DoCalcRgnsMessage}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ DrawWindowColour }
procedure DrawWindowColour(theWindowPeek : WindowPeek);
var
oldForeColour : RGBColor;
oldBackColour : RGBColor;
contentRect, structRect, theRect : Rect;
a, b : integer;
dataHdl : GlobalsHandle;
begin
dataHdl := GlobalsHandle(theWindowPeek^.dataHandle);
GetForeColor(oldForeColour);
GetBackColor(oldBackColour);
PenSize(1, 1);
PenPat(dataHdl^^.gBlackPattern);
PenMode(patCopy);
if (theWindowPeek^.hilited) then
begin
GetContentRect(theWindowPeek, contentRect);
RGBForeColor(dataHdl^^.gBlack);
InsetRect(contentRect, -1, -1);
FrameRect(contentRect);
GetStructRect(theWindowPeek, structRect);
RGBForeColor(dataHdl^^.gGray3);
SetRect(theRect, structRect.left + 2, structRect.top + 2, structRect.right - 2,
structRect.top + 12);
PaintRect(theRect);
SetRect(theRect, structRect.left + 14, structRect.top + 3, structRect.left + 22,
structRect.top + 11);
b := (((structRect.right - 4) - (structRect.left + 14)) div 9) + 1;
a := 0;
while a < b + 1 do
begin
PlotCIcon(theRect, dataHdl^^.gCheckPatternHdl);
OffsetRect(theRect, 9, 0);
a := a + 1;
end;
if (theWindowPeek^.goAwayFlag) then
DrawGoAwayBox(theWindowPeek);
RGBForeColor(dataHdl^^.gBlack);
FrameRect(structRect);
MoveTo(structRect.left + 2, structRect.bottom);
LineTo(structRect.right, structRect.bottom);
LineTo(structRect.right, structRect.top + 2);
RGBForeColor(dataHdl^^.gWhite);
MoveTo(structRect.left + 1, structRect.bottom - 3);
LineTo(structRect.left + 1, structRect.top + 1);
LineTo(structRect.right - 3, structRect.top + 1);
MoveTo(structRect.left + 3, structRect.top + 11);
LineTo(structRect.left + 11, structRect.top + 11);
LineTo(structRect.left + 11, structRect.top + 3);
RGBForeColor(dataHdl^^.gGray1);
MoveTo(structRect.left + 2, structRect.bottom - 3);
LineTo(structRect.right - 3, structRect.bottom - 3);
LineTo(structRect.right - 3, structRect.top + 13);
RGBForeColor(dataHdl^^.gGray3);
MoveTo(structRect.right - 2, structRect.top + 1);
LineTo(structRect.right - 2, structRect.top + 1);
RGBForeColor(dataHdl^^.gGray4);
MoveTo(structRect.left + 1, structRect.bottom - 2);
LineTo(structRect.left + 1, structRect.bottom - 2);
RGBForeColor(dataHdl^^.gGray6);
MoveTo(structRect.left + 2, structRect.bottom - 2);
LineTo(structRect.right - 2, structRect.bottom - 2);
LineTo(structRect.right - 2, structRect.top + 2);
MoveTo(structRect.right - 3, structRect.top + 12);
LineTo(structRect.left + 2, structRect.top + 12);
LineTo(structRect.left + 2, structRect.bottom - 4);
RGBForeColor(dataHdl^^.gGray7);
MoveTo(structRect.left + 2, structRect.top + 10);
LineTo(structRect.left + 2, structRect.top + 2);
LineTo(structRect.left + 10, structRect.top + 2);
end
else begin
RGBForeColor(dataHdl^^.gGray10);
GetContentRect(theWindowPeek, contentRect);
InsetRect(contentRect, -1, -1);
FrameRect(contentRect);
GetStructRect(theWindowPeek, structRect);
FrameRect(structRect);
MoveTo(structRect.left + 2, structRect.bottom);
LineTo(structRect.right, structRect.bottom);
LineTo(structRect.right, structRect.top + 2);
RGBForeColor(dataHdl^^.gGray2);
InsetRect(structRect, 1, 1);
PenSize(2, 2);
FrameRect(structRect);
structRect.bottom := structRect.top + 12;
PaintRect(structRect);
end;
RGBForeColor(oldForeColour);
RGBBackColor(oldBackColour);
end;
{of procedure DrawWindowColour}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ DrawWindowMono }
procedure DrawWindowMono(theWindowPeek : WindowPeek);
var
contentRect, structRect, theRect : Rect;
a, b : integer;
pattern : UInt8;
checkPattern : Pattern;
dataHdl : GlobalsHandle;
begin
dataHdl := GlobalsHandle(theWindowPeek^.dataHandle);
PenSize(1, 1);
PenPat(dataHdl^^.gBlackPattern);
PenMode(patCopy);
if (theWindowPeek^.goAwayFlag and theWindowPeek^.hilited) then
begin
ForeColor(blackColor);
BackColor(whiteColor);
GetContentRect(theWindowPeek, contentRect);
InsetRect(contentRect, -1, -1);
FrameRect(contentRect);
GetStructRect(theWindowPeek, structRect);
FrameRect(structRect);
MoveTo(structRect.left + 2, structRect.bottom);
LineTo(structRect.right, structRect.bottom);
LineTo(structRect.right, structRect.top + 2);
SetRect(theRect, structRect.left + 1, structRect.top + 1, structRect.right - 1,
structRect.top + 10);
EraseRect(theRect);
for a := 0 to 7 do
checkPattern.pat[a] := $00;
if (BAnd(structRect.left, 1) <> 0) then
pattern := $AA
else
pattern := $55;
if (BAnd(structRect.top, 1) <> 0) then
b := 1
else
b := 0;
a := b;
while(a < 8) do
begin
checkPattern.pat[a] := pattern;
a := a + 2;
end;
PenPat(checkPattern);
SetRect(theRect, structRect.left + 11, structRect.top + 2, structRect.right - 2,
structRect.top + 9);
PaintRect(theRect);
PenPat(dataHdl^^.gBlackPattern);
if (theWindowPeek^.goAwayFlag) then
DrawGoAwayBox(theWindowPeek);
end
else begin
SetRect(theRect, structRect.left + 1, structRect.top + 1, structRect.right - 1,
structRect.top + 13);
EraseRect(theRect);
end;
end;
{of procedure DrawWindowMono}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ ToggleGoAway }
procedure ToggleGoAway(theWindowPeek : WindowPeek);
var
dataHdl : GlobalsHandle;
begin
dataHdl := GlobalsHandle(theWindowPeek^.dataHandle);
dataHdl^^.gToggle := not (dataHdl^^.gToggle);
if (dataHdl^^.gToggle) then
DrawGoAwayBoxPressed(theWindowPeek)
else
DrawGoAwayBox(theWindowPeek);
end;
{of procedure ToggleGoAway}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ DrawGoAwayBox }
procedure DrawGoAwayBox(theWindowPeek : WindowPeek);
var
theRect : Rect;
dataHdl : GlobalsHandle;
begin
dataHdl := GlobalsHandle(theWindowPeek^.dataHandle);
GetGoAwayRect(theWindowPeek, theRect);
if (dataHdl^^.gColourQuickDrawPresent and dataHdl^^.gColourDisplay) then
PlotCIcon(theRect, dataHdl^^.gCloseEnabledHdl)
else begin
EraseRect(theRect);
PenSize(1, 1);
FrameRect(theRect);
end;
end;
{of procedure DrawGoAwayBox}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ DrawGoAwayBoxPressed }
procedure DrawGoAwayBoxPressed(theWindowPeek : WindowPeek);
var
theRect : Rect;
dataHdl : GlobalsHandle;
begin
dataHdl := GlobalsHandle(theWindowPeek^.dataHandle);
GetGoAwayRect(theWindowPeek, theRect);
if (dataHdl^^.gColourQuickDrawPresent and dataHdl^^.gColourDisplay) then
PlotCIcon(theRect, dataHdl^^.gClosePressedHdl)
else begin
PenSize(2, 2);
FrameRect(theRect);
end;
end;
{of procedure DrawGoAwayBox}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ GetGoAwayRect }
procedure GetGoAwayRect(theWindowPeek : WindowPeek; var theRect : Rect);
var
dataHdl : GlobalsHandle;
begin
dataHdl := GlobalsHandle(theWindowPeek^.dataHandle);
GetStructRect(theWindowPeek, theRect);
if (dataHdl^^.gColourQuickDrawPresent and dataHdl^^.gColourDisplay) then
begin
theRect.top := theRect.top + 3;
theRect.left := theRect.left + 3;
theRect.bottom := theRect.top + 8;
theRect.right := theRect.left + 8;
end
else begin
theRect.top := theRect.top + 2;
theRect.left := theRect.left + 2;
theRect.bottom := theRect.top + 7;
theRect.right := theRect.left + 7;
end;
end;
{of procedure GetGoAwayRect}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ GetContentRect }
procedure GetContentRect(theWindowPeek : WindowPeek; var theRect : Rect);
var
oldPort : GrafPtr;
begin
theRect := theWindowPeek^.port.portRect;
GetPort(oldPort);
SetPort(GrafPtr(theWindowPeek));
LocalToGlobal(theRect.topLeft);
LocalToGlobal(theRect.botRight);
SetPort(oldPort);
end;
{of procedure GetContentRect}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ GetStructRect }
procedure GetStructRect(theWindowPeek : WindowPeek; var theRect : Rect);
var
dataHdl : GlobalsHandle;
begin
dataHdl := GlobalsHandle(theWindowPeek^.dataHandle);
GetContentRect(theWindowPeek, theRect);
if (dataHdl^^.gColourQuickDrawPresent and dataHdl^^.gColourDisplay) then
begin
InsetRect(theRect, -4, -4);
theRect.top := theRect.top - 10;
end
else begin
theRect.top := theRect.top - 10;
InsetRect(theRect, -1, -1);
end;
end;
{of procedure GetStructRect}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ SyncPorts }
procedure SyncPorts;
var
bwPort : GrafPtr;
colourPort : CGrafPtr;
begin
GetWMgrPort(bwPort);
GetCWMgrPort(colourPort);
SetPort(GrafPtr(colourPort));
BlockMoveData(@bwPort^.pnLoc, @colourPort^.pnLoc, 10);
BlockMoveData(@bwPort^.pnVis, @colourPort^.pnVis, 14);
PenPat(bwPort^.pnPat);
BackPat(bwPort^.bkPat);
end;
{of procedure SyncPorts}
end.
{of unit WDEFPascal}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ }