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
/
chap20pascal_demo
/
UFloatRoutines.p
< prev
next >
Wrap
Text File
|
1997-01-23
|
21KB
|
750 lines
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊
// UFloatRoutines.p Routines to support floating windows
// ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ }
unit UFloatRoutines;
interface
{ ………………………………………………………………………………………………………………… include the following Universal Interfaces }
uses
Types, Events, Quickdraw,
{ ……………………………………………………………………………………………………………………… include the following user-defined units }
UFloaters;
{ ………………………………………………………………………………………………………………………………………… exported functions and procedures }
function NewGetNewWindow(windResourceID : integer; behind : WindowPtr;
activateHandler : ActivateProcPtr; windowType : integer) : WindowPtr;
procedure NewHideWindow(windowToHidePtr : WindowPtr);
procedure NewShowWindow(windowToShowPtr : WindowPtr);
procedure NewSelectWindow(windowToSelectPtr : WindowPtr);
procedure NewDragWindow(theWindowPtr : WindowPtr; startPoint : Point;
{$CONST} var dragBounds : Rect);
procedure NewDisposeWindow(theWindowPtr : WindowPtr);
procedure HandleSuspendEvent;
procedure HandleResumeEvent;
procedure DeactivateFloatsAndFirstDocWin;
procedure ActivateFloatsAndFirstDocWin;
function FindFrontNonFloatingWindow : WindowPtr;
function IsWindowModal(theWindowPtr : WindowPtr) : boolean;
function GetWindowVisible(theWindowPtr : WindowPtr) : boolean;
implementation
{ ………………………………………………………………………………………………………………… include the following Universal Interfaces }
uses
Windows, Fonts, Menus, TextEdit, Dialogs, QuickdrawText, Processes, LowMem,
Memory, TextUtils, ToolUtils, OSUtils, Devices, SegLoad, GestaltEqu,
{ ……………………………………………………………………………………………………………………… include the following user-defined units }
UFloaters;
{ ……………………………………………………………………………………………………………………………………… procedure and function definitions }
procedure DeactivateWindow(theWindowPtr : WindowPtr); forward;
procedure ActivateWindow(theWindowPtr : WindowPtr); forward;
procedure HighlightAndActivateWindow(theWindowPtr : WindowPtr;
activate : boolean); forward;
function FindLastFloatingWindow : WindowPtr; forward;
function GetWindowList : WindowPtr; forward;
procedure SetWindowList(theWindowPtr : WindowPtr); forward;
function GetNextWindow(theWindowPtr : WindowPtr) : WindowPtr; forward;
procedure SetNextWindow(theWindowPtr, nextWindowPtr : WindowPtr); forward;
function GetWasVisible(theWindowPtr : WindowPtr) : boolean; forward;
procedure SetWasVisible(theWindowPtr : WindowPtr; wasVisible : boolean); forward;
function GetWindowKind(theWindowPtr : WindowPtr) : integer; forward;
procedure SetWindowKind(theWindowPtr : WindowPtr; windowKind : integer); forward;
function GetStructureRegion(theWindowPtr : WindowPtr) : RgnHandle; forward;
function GetContentRegion(theWindowPtr : WindowPtr) : RgnHandle; forward;
procedure SetWindowHilite(theWindowPtr : WindowPtr; windowHilite : boolean); forward;
{ …………………………………………………………………………………………………………………………… procedure and function implementations }
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ NewGetNewWindow }
function NewGetNewWindow(windResourceID : integer; behind : WindowPtr;
activateHandler : ActivateProcPtr; windowType : integer) : WindowPtr;
var
docRecordHdl : DocRecordHandle;
theErr : OSErr;
response : longint;
newWindowPtr : WindowPtr;
lastFloatingWindowPtr : WindowPtr;
begin
docRecordHdl := DocRecordHandle(NewHandle(sizeof(DocRecord)));
theErr := Gestalt(gestaltQuickdrawVersion, response);
if (response < gestalt32BitQD) then
newWindowPtr := GetNewWindow(windResourceID, nil, WindowPtr(behind))
else
newWindowPtr := GetNewCWindow(windResourceID, nil, WindowPtr(behind));
if (newWindowPtr <> nil) then
begin
SetWRefCon(newWindowPtr, longint(docRecordHdl));
docRecordHdl := DocRecordHandle(GetWRefCon(newWindowPtr));
docRecordHdl^^.activateHandler := activateHandler;
if (windowType = kFloatingKind) then
begin
SetWindowKind(newWindowPtr, kFloatingKind);
HiliteWindow(newWindowPtr, true);
end
else begin
SetWindowKind(newWindowPtr, kDocumentKind);
if (behind = WindowPtr(-1)) then
begin
lastFloatingWindowPtr := FindLastFloatingWindow;
if (lastFloatingWindowPtr <> nil) then
SendBehind(newWindowPtr, lastFloatingWindowPtr)
else
BringToFront(newWindowPtr);
end;
end;
end
else
DisposeHandle(Handle(docRecordHdl));
NewGetNewWindow := newWindowPtr;
end;
{of function NewGetNewWindow}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ NewDisposeWindow }
procedure NewDisposeWindow(theWindowPtr : WindowPtr);
begin
if (GetWindowVisible(theWindowPtr)) then
NewHideWindow(theWindowPtr);
CloseWindow(theWindowPtr);
DisposeHandle(Handle(GetWRefCon(theWindowPtr)));
DisposePtr(Ptr(theWindowPtr));
end;
{of function NewGetNewWindow}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ NewSelectWindow }
procedure NewSelectWindow(windowToSelectPtr : WindowPtr);
var
isFloatingWindow : boolean;
currentFrontWindowPtr : WindowPtr;
lastFloatingWindowPtr : WindowPtr;
begin
if (GetWindowKind(windowToSelectPtr) = kFloatingKind) then
begin
isFloatingWindow := true;
currentFrontWindowPtr := FrontWindow;
end
else begin
isFloatingWindow := false;
currentFrontWindowPtr := FindFrontNonFloatingWindow;
lastFloatingWindowPtr := FindLastFloatingWindow;
end;
if (currentFrontWindowPtr <> windowToSelectPtr) then
begin
if (isFloatingWindow) then
BringToFront(windowToSelectPtr)
else begin
if (lastFloatingWindowPtr = nil) then
SelectWindow(windowToSelectPtr)
else begin
DeactivateWindow(currentFrontWindowPtr);
SendBehind(windowToSelectPtr, lastFloatingWindowPtr);
ActivateWindow(windowToSelectPtr);
end;
end;
end;
end;
{of procedure NewSelectWindow}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ NewHideWindow }
procedure NewHideWindow(windowToHidePtr : WindowPtr);
var
frontFloaterPtr : WindowPtr;
frontNonFloaterPtr : WindowPtr;
windowBehindPtr : WindowPtr;
lastFloaterPtr : WindowPtr;
begin
if (GetWindowVisible(windowToHidePtr) = false) then
Exit(NewHideWindow);
frontFloaterPtr := FrontWindow;
if (GetWindowKind(frontFloaterPtr) <> kFloatingKind) then
frontFloaterPtr := nil;
frontNonFloaterPtr := FindFrontNonFloatingWindow;
ShowHide(windowToHidePtr, false);
if (windowToHidePtr = frontFloaterPtr) then
begin
windowBehindPtr := GetNextWindow(windowToHidePtr);
if ((windowBehindPtr <> nil) and (GetWindowKind(windowBehindPtr) = kFloatingKind)) then
begin
SetNextWindow(windowToHidePtr, GetNextWindow(windowBehindPtr));
SetNextWindow(windowBehindPtr, windowToHidePtr);
SetWindowList(windowBehindPtr);
end;
end
else begin
if (windowToHidePtr = frontNonFloaterPtr) then
begin
windowBehindPtr := GetNextWindow(windowToHidePtr);
if (windowBehindPtr <> nil) then
begin
SetNextWindow(windowToHidePtr, GetNextWindow(windowBehindPtr));
SetNextWindow(windowBehindPtr, windowToHidePtr);
lastFloaterPtr := FindLastFloatingWindow;
if (lastFloaterPtr <> nil) then
SetNextWindow(lastFloaterPtr, windowBehindPtr)
else
SetWindowList(windowBehindPtr);
ActivateWindow(windowBehindPtr);
end;
end;
end;
end;
{of procedure NewHideWindow}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ NewShowWindow }
procedure NewShowWindow(windowToShowPtr : WindowPtr);
var
windowType : integer;
windowBehindPtr : WindowPtr;
frontNonFloatingWindowPtr : WindowPtr;
windowIsInFront : boolean;
activateHandler : ActivateProcPtr;
docRecordHdl : DocRecordHandle;
begin
windowIsInFront := false;
if (GetWindowVisible(windowToShowPtr) <> false) then
Exit(NewShowWindow);
windowType := GetWindowKind(windowToShowPtr);
if (windowType <> kFloatingKind) then
begin
windowBehindPtr := GetNextWindow(windowToShowPtr);
if (windowBehindPtr = FindFrontNonFloatingWindow) then
begin
if (windowBehindPtr <> nil) then
DeactivateWindow(windowBehindPtr);
SetWindowHilite(windowToShowPtr, true);
windowIsInFront := true;
end;
end
else begin
frontNonFloatingWindowPtr := FindFrontNonFloatingWindow;
if ((frontNonFloatingWindowPtr <> nil) and
(frontNonFloatingWindowPtr = FrontWindow) and
(IsWindowModal(frontNonFloatingWindowPtr))) then
begin
SetWindowHilite(windowToShowPtr, false);
end
else begin
SetWindowHilite(windowToShowPtr, true);
windowIsInFront := true;
end;
end;
ShowHide(windowToShowPtr, true);
if (windowIsInFront) then
begin
docRecordHdl := DocRecordHandle(GetWRefCon(windowToShowPtr));
activateHandler := docRecordHdl^^.activateHandler;
activateHandler(windowToShowPtr, true);
end;
end;
{of procedure NewShowWindow}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ NewDragWindow }
procedure NewDragWindow(theWindowPtr : WindowPtr; startPoint : Point;
{$CONST} var dragBounds : Rect);
var
topLimit : integer;
slopRect : Rect;
oldPort : GrafPtr;
windowManagerPort : GrafPtr;
theKeyMap : KeyMap;
commandKeyDown : boolean;
dragRegion : RgnHandle;
dragResult : longint;
horizOffset : integer;
vertOffset : integer;
windowContentRegion : RgnHandle;
newHorizWindowPosition : integer;
newVertWindowPosition : integer;
begin
commandKeyDown := false;
if (WaitMouseUp) then
begin
topLimit := GetMBarHeight + 4;
slopRect := dragBounds;
if (slopRect.top < topLimit) then
slopRect.top := topLimit;
GetPort(oldPort);
GetWMgrPort(windowManagerPort);
SetPort(windowManagerPort);
SetClip(GetGrayRgn);
GetKeys(theKeyMap);
if (BAnd(theKeyMap[1], $8000) <> 0) then
commandKeyDown := true;
if ((commandKeyDown = true) or
(GetWindowKind(theWindowPtr) <> kFloatingKind)) then
begin
if (commandKeyDown = false) then
ClipAbove(WindowRef(WindowPeek(FindFrontNonFloatingWindow)))
else
ClipAbove(WindowRef(WindowPeek(theWindowPtr)));
end;
dragRegion := NewRgn;
CopyRgn(GetStructureRegion(theWindowPtr), dragRegion);
dragResult := DragGrayRgn(dragRegion, startPoint, slopRect, slopRect,
noConstraint, nil);
SetPort(oldPort);
if (dragResult <> 0) then
begin
horizOffset := BAnd(dragResult, $FFFF);
vertOffset := BSR(dragResult, 16);
if (vertOffset <> -32768) then
begin
windowContentRegion := GetContentRegion(theWindowPtr);
newHorizWindowPosition := windowContentRegion^^.rgnBBox.left
+ horizOffset;
newVertWindowPosition := windowContentRegion^^.rgnBBox.top + vertOffset;
MoveWindow(theWindowPtr, newHorizWindowPosition, newVertWindowPosition,
false);
end;
end;
if (commandKeyDown = false) then
NewSelectWindow(theWindowPtr);
DisposeRgn(dragRegion);
end;
end;
{of procedure NewDragWindow}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ HandleSuspendEvent }
procedure HandleSuspendEvent;
var
currentWindowPtr : WindowPtr;
windowIsVisible : boolean;
begin
currentWindowPtr := GetWindowList;
if (GetWindowKind(currentWindowPtr) <> kFloatingKind) then
Exit(HandleSuspendEvent);
while ((currentWindowPtr <> nil) &
(GetWindowKind(currentWindowPtr) = kFloatingKind)) do
begin
windowIsVisible := GetWindowVisible(currentWindowPtr);
SetWasVisible(currentWindowPtr, windowIsVisible);
if (windowIsVisible) then
ShowHide(currentWindowPtr, false);
currentWindowPtr := GetNextWindow(currentWindowPtr);
end;
currentWindowPtr := FindFrontNonFloatingWindow;
if (currentWindowPtr <> nil) then
begin
DrawGrowIcon(currentWindowPtr);
DeactivateWindow(currentWindowPtr);
end;
end;
{of procedure HandleSuspendEvent}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ HandleResumeEvent }
procedure HandleResumeEvent;
var
currentWindowPtr : WindowPtr;
windowWasVisible : boolean;
begin
currentWindowPtr := GetWindowList;
if (GetWindowKind(currentWindowPtr) <> kFloatingKind) then
Exit(HandleResumeEvent);
while((currentWindowPtr <> nil) &
(GetWindowKind(currentWindowPtr) = kFloatingKind)) do
begin
windowWasVisible := GetWasVisible(currentWindowPtr);
if (windowWasVisible) then
begin
ShowHide(currentWindowPtr, true);
ActivateWindow(currentWindowPtr);
end;
currentWindowPtr := GetNextWindow(currentWindowPtr);
end;
currentWindowPtr := FindFrontNonFloatingWindow;
if (currentWindowPtr <> nil) then
begin
DrawGrowIcon(currentWindowPtr);
ActivateWindow(currentWindowPtr);
end;
end;
{of procedure HandleResumeEvent}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ DeactivateFloatsAndFirstDocWin }
procedure DeactivateFloatsAndFirstDocWin;
var
firstWindowPtr : WindowPtr;
secondDocumentWindowPtr : WindowPtr;
currentWindowPtr : WindowPtr;
begin
firstWindowPtr := FrontWindow;
secondDocumentWindowPtr := FindFrontNonFloatingWindow;
if (secondDocumentWindowPtr <> nil) then
secondDocumentWindowPtr := GetNextWindow(secondDocumentWindowPtr);
currentWindowPtr := firstWindowPtr;
while (currentWindowPtr <> secondDocumentWindowPtr) do
begin
if (GetWindowVisible(currentWindowPtr)) then
DeactivateWindow(currentWindowPtr);
currentWindowPtr := GetNextWindow(currentWindowPtr);
end;
end;
{of procedure DeactivateFloatsAndFirstDocWin}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ ActivateFloatsAndFirstDocWin }
procedure ActivateFloatsAndFirstDocWin;
var
getFrontProcessResult : OSErr;
getCurrentProcessResult : OSErr;
frontPSN : ProcessSerialNumber;
currentPSN : ProcessSerialNumber;
sameProcessResult : OSErr;
isSameProcess : boolean;
firstWindowPtr : WindowPtr;
secondDocumentWindowPtr : WindowPtr;
currentWindowPtr : WindowPtr;
begin
getFrontProcessResult := GetFrontProcess(frontPSN);
getCurrentProcessResult := GetCurrentProcess(currentPSN);
if ((getFrontProcessResult = noErr) and (getCurrentProcessResult = noErr)) then
sameProcessResult := SameProcess(frontPSN, currentPSN, isSameProcess);
if ((sameProcessResult = noErr) and (isSameProcess = false)) then
HandleSuspendEvent
else begin
firstWindowPtr := FrontWindow;
secondDocumentWindowPtr := FindFrontNonFloatingWindow;
if (secondDocumentWindowPtr <> nil) then
secondDocumentWindowPtr := GetNextWindow(secondDocumentWindowPtr);
currentWindowPtr := firstWindowPtr;
while(currentWindowPtr <> secondDocumentWindowPtr) do
begin
if (GetWindowVisible(currentWindowPtr)) then
ActivateWindow(currentWindowPtr);
currentWindowPtr := GetNextWindow(currentWindowPtr);
end;
end;
end;
{of procedure ActivateFloatsAndFirstDocWin}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ DeactivateWindow }
procedure DeactivateWindow(theWindowPtr : WindowPtr);
begin
HighlightAndActivateWindow(theWindowPtr, false);
end;
{of procedure DeactivateWindow}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ ActivateWindow }
procedure ActivateWindow(theWindowPtr : WindowPtr);
begin
HighlightAndActivateWindow(theWindowPtr, true);
end;
{of procedure ActivateWindow}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ HighlightAndActivateWindow }
procedure HighlightAndActivateWindow(theWindowPtr : WindowPtr; activate : boolean);
var
activateHandler : ActivateProcPtr;
docRecordHdl : DocRecordHandle;
begin
HiliteWindow(theWindowPtr, activate);
docRecordHdl := DocRecordHandle(GetWRefCon(theWindowPtr));
activateHandler := docRecordHdl^^.activateHandler;
if (activateHandler <> nil) then
activateHandler(theWindowPtr, activate);
end;
{of procedure HighlightAndActivateWindow}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ FindFrontNonFloatingWindow }
function FindFrontNonFloatingWindow : WindowPtr;
var
frontWindowPtr : WindowPtr;
begin
frontWindowPtr := FrontWindow;
while (frontWindowPtr <> nil) & ((GetWindowKind(frontWindowPtr) = kFloatingKind) or
not GetWindowVisible(frontWindowPtr)) do
frontWindowPtr := GetNextWindow(frontWindowPtr);
FindFrontNonFloatingWindow := frontWindowPtr;
end;
{of function FindFrontNonFloatingWindow}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ FindLastFloatingWindow }
function FindLastFloatingWindow : WindowPtr;
var
theWindowPtr : WindowPtr;
lastFloatingWindowPtr : WindowPtr;
begin
theWindowPtr := GetWindowList;
lastFloatingWindowPtr := nil;
while (theWindowPtr <> nil) do
begin
if (GetWindowKind(theWindowPtr) = kFloatingKind) then
lastFloatingWindowPtr := theWindowPtr;
theWindowPtr := GetNextWindow(theWindowPtr);
end;
FindLastFloatingWindow := lastFloatingWindowPtr;
end;
{of function FindLastFloatingWindow}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ IsWindowModal }
function IsWindowModal(theWindowPtr : WindowPtr) : boolean;
var
variant : integer;
begin
variant := GetWVariant(theWindowPtr);
if (theWindowPtr = nil) then
IsWindowModal := false
else if ((WindowPeek(theWindowPtr)^.windowKind = dialogKind) and
((variant = dBoxProc) or (variant = movableDBoxProc))) then
IsWindowModal := true
else
IsWindowModal := false;
end;
{of function IsWindowModal}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ GetWindowList }
function GetWindowList : WindowPtr;
begin
GetWindowList := LMGetWindowList;
end;
{of function GetWindowList}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ SetWindowList }
procedure SetWindowList(theWindowPtr : WindowPtr);
begin
LMSetWindowList(theWindowPtr);
end;
{of procedure SetWindowList}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ GetNextWindow }
function GetNextWindow(theWindowPtr : WindowPtr) : WindowPtr;
begin
GetNextWindow := WindowPtr(WindowPeek(theWindowPtr)^.nextWindow);
end;
{of function GetNextWindow}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ SetNextWindow }
procedure SetNextWindow(theWindowPtr, nextWindowPtr : WindowPtr);
begin
WindowPeek(theWindowPtr)^.nextWindow := WindowPeek(nextWindowPtr);
end;
{of procedure SetNextWindow}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ GetWasVisible }
function GetWasVisible(theWindowPtr : WindowPtr) : boolean;
var
docRecordHdl : DocRecordHandle;
begin
docRecordHdl := DocRecordHandle(GetWRefCon(theWindowPtr));
GetWasVisible := docRecordHdl^^.wasVisible;
end;
{of function GetWasVisible}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ SetWasVisible }
procedure SetWasVisible(theWindowPtr : WindowPtr; wasVisible : boolean);
var
docRecordHdl : DocRecordHandle;
begin
docRecordHdl := DocRecordHandle(GetWRefCon(theWindowPtr));
docRecordHdl^^.wasVisible := wasVisible;
end;
{of procedure SetWasVisible}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ GetWindowKind }
function GetWindowKind(theWindowPtr : WindowPtr) : integer;
var
docRecordHdl : DocRecordHandle;
begin
if (WindowPeek(theWindowPtr)^.windowKind <> dialogKind) then
begin
docRecordHdl := DocRecordHandle(GetWRefCon(theWindowPtr));
if (docRecordHdl <> nil) then
GetWindowKind := docRecordHdl^^.windowType;
end
else
GetWindowKind := 0;
end;
{of function GetWindowKind}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ SetWindowKind }
procedure SetWindowKind(theWindowPtr : WindowPtr; windowKind : integer);
var
docRecordHdl : DocRecordHandle;
begin
docRecordHdl := DocRecordHandle(GetWRefCon(theWindowPtr));
docRecordHdl^^.windowType := windowKind;
end;
{of procedure SetWindowKind}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ GetWindowVisible }
function GetWindowVisible(theWindowPtr : WindowPtr) : boolean;
begin
GetWindowVisible := WindowPeek(theWindowPtr)^.visible;
end;
{of function GetWindowVisible}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ GetStructureRegion }
function GetStructureRegion(theWindowPtr : WindowPtr) : RgnHandle;
begin
GetStructureRegion := WindowPeek(theWindowPtr)^.strucRgn;
end;
{of function GetStructureRegion}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ GetContentRegion }
function GetContentRegion(theWindowPtr : WindowPtr) : RgnHandle;
begin
GetContentRegion := WindowPeek(theWindowPtr)^.contRgn;
end;
{of function GetContentRegion}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ SetWindowHilite }
procedure SetWindowHilite(theWindowPtr : WindowPtr; windowHilite : boolean);
begin
WindowPeek(theWindowPtr)^.hilited := windowHilite;
end;
{of procedure SetWindowHilite}
end.
{of unit UFloatRoutines.p}
{ ◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊◊ }