home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-08-03 | 1.1 KB | 70 lines | [TEXT/CWIE] |
- #include "BSDMenubarLib.h"
-
- Boolean mbar = true;
-
- void FrameDialogItem (DialogPtr theDialog, short theItem);
- void ToggleMenuBar (void);
-
- void FrameDialogItem (DialogPtr theDialog, short theItem) {
- GrafPtr savePort;
- short iType;
- Handle iHandle;
- Rect iRect;
- PenState savePen;
-
- GetPort(&savePort);
- SetPort(theDialog);
- GetPenState(&savePen);
-
- GetDialogItem(theDialog, theItem, &iType, &iHandle, &iRect);
- InsetRect(&iRect, -4, -4);
- PenSize(3, 3);
- FrameRoundRect(&iRect, 16, 16);
-
- SetPenState(&savePen);
- SetPort(savePort);
- }
-
- void ToggleMenuBar (void) {
- if (mbar) HideMenuBar();
- else ShowMenuBar();
- mbar = !mbar;
- }
-
- void main (void) {
- InitGraf(&qd.thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- InitDialogs(nil);
- InitCursor();
- TEInit();
- MaxApplZone();
-
- DialogPtr dialog = GetNewDialog(128, nil, (WindowPtr)-1L);
- ShowWindow(dialog);
-
- FrameDialogItem(dialog, 1);
-
- Boolean flag = false;
- short item;
-
- while (!flag) {
- ModalDialog(nil, &item);
-
- switch (item) {
- case 1:
- flag = true;
- break;
- case 2:
- ToggleMenuBar();
- break;
- }
- }
-
- CloseWindow(dialog);
-
- if (!mbar) ShowMenuBar();
- }
-
-