Pararena2/Sources/Abandoned Routines.c

1 line
3.1 KiB
C
Executable File

/*======================================================== ShowMenuBar */
void ShowMenuBar (WindowPtr theWindow)
{
Rect theRect;
RgnHandle worldRgn, menuBarRgn;
GrafPtr wasPort;
Point originPt;
if (GetMBarHeight() == 0)
{
GetPort((GrafPtr)&wasPort);
SetPort((GrafPtr)theWindow);
GetOrigin(&originPt);
SetOrigin(0, 0);
MBarHeight = wasMenuBarHeight;
theRect = (**GetGrayRgn()).rgnBBox;
UnionRect(&theRect, &screenBits.bounds, &theRect);
worldRgn = NewRgn();
OpenRgn();
FrameRoundRect(&theRect, 16, 16);
CloseRgn(worldRgn);
theRect = screenBits.bounds;
theRect.bottom = theRect.top + wasMenuBarHeight;
menuBarRgn = NewRgn();
RectRgn(menuBarRgn, &theRect);
SectRgn(worldRgn, menuBarRgn, menuBarRgn); /* /------------------\ */
DisposeRgn(worldRgn); /* |__________________| */
UnionRgn(theWindow->visRgn, menuBarRgn, theWindow->visRgn);
DiffRgn(theWindow->visRgn, menuBarRgn, theWindow->visRgn);
DisposeRgn(menuBarRgn);
DrawMenuBar();
SetOrigin(originPt.h, originPt.v);
SetPort((GrafPtr)wasPort);
}
}
/*======================================================== HideMenuBar */
void HideMenuBar (WindowPtr theWindow)
{
Rect theRect;
RgnHandle worldRgn, menuBarRgn;
GrafPtr wasPort;
Point originPt;
short nowMBarHeight;
nowMBarHeight = GetMBarHeight();
if (nowMBarHeight != 0)
{
GetPort((GrafPtr)&wasPort);
SetPort((GrafPtr)theWindow);
GetOrigin(&originPt);
SetOrigin(0, 0);
wasMenuBarHeight = GetMBarHeight();
MBarHeight = 0;
theRect = (**GetGrayRgn()).rgnBBox;
UnionRect(&theRect, &screenBits.bounds, &theRect);
worldRgn = NewRgn(); // /-----------\
OpenRgn(); // | whole |
FrameRoundRect(&theRect, 16, 16); // | desktop |
CloseRgn(worldRgn); // \___________/
theRect = screenBits.bounds;
theRect.bottom = theRect.top + wasMenuBarHeight;
menuBarRgn = NewRgn();
RectRgn(menuBarRgn, &theRect);
SectRgn(worldRgn, menuBarRgn, menuBarRgn); // /------------------\
DisposeRgn(worldRgn); // |__________________|
UnionRgn(theWindow->visRgn, menuBarRgn, theWindow->visRgn);
DisposeRgn(menuBarRgn);
SetOrigin(originPt.h, originPt.v);
SetPort((GrafPtr)wasPort);
}
}
/*======================================================== ShowMenuBar */
void ShowMenuBar (WindowPtr theWindow)
{
Rect theRect;
short nowMBarHeight;
nowMBarHeight = GetMBarHeight();
if (nowMBarHeight == 0)
{
MBarHeight = wasMenuBarHeight;
DiffRgn(GrayRgn, menuBarRgn, GrayRgn);
DisposeRgn(menuBarRgn);
// DrawMenuBar();
}
}
/*======================================================== HideMenuBar */
void HideMenuBar (WindowPtr theWindow)
{
Rect theRect;
short nowMBarHeight;
nowMBarHeight = GetMBarHeight();
if (nowMBarHeight != 0)
{
wasMenuBarHeight = GetMBarHeight();
MBarHeight = 0;
theRect = screenBits.bounds;
theRect.bottom = theRect.top + wasMenuBarHeight;
menuBarRgn = NewRgn();
RectRgn(menuBarRgn, &theRect);
UnionRgn(GrayRgn, menuBarRgn, GrayRgn);
PaintOne(kNilPointer, menuBarRgn);
}
}