// -------------------------------------------------------------------------------------- void OpenPrefsDialog(void) { DialogRef dialog; WindowRef dialogWindow; ControlRef control; ListHandle iconList; Cell theCell; dialog = GetNewDialog(rPrefsDialogPlatinum, NULL, kFirstWindowOfClass); if (dialog == NULL) ExitToShell(); SetPortDialogPort(dialog); dialogWindow = GetDialogWindow(dialog); SetDialogDefaultItem(dialog, kStdOkItemIndex); SetDialogCancelItem(dialog, kStdCancelItemIndex); GetDialogItemAsControl(dialog, iIconList, &control); GetControlData(control, kControlEntireControl, kControlListBoxListHandleTag, sizeof(ListHandle), &iconList, NULL); AddRowsAndDataToIconList(iconList, rIconListIconBaseID); (*iconList)->selFlags = lOnlyOne; SetPt(&theCell, 0, 0); LSetSelect(true, theCell, iconList); SetKeyboardFocus(dialogWindow, control, kControlFocusNextPart); gPanelNumber = 0; DisableMenuItem(GetMenuRef(mDemonstration), iPrefsDialog); ShowWindow(dialogWindow); } // OpenPrefsDialog
/*** INITALISE MENUBAR ***/ OSStatus InitMenubar( void ) { // set menu bar Handle menuBar; #if TARGET_API_MAC_CARBON long result; if ((Gestalt(gestaltMenuMgrAttr, &result) == noErr) && (result & gestaltMenuMgrAquaLayoutMask)) menuBar = GetNewMBar( kMenuXBaseID); else #endif menuBar = GetNewMBar( kMenuBaseID ); SetMenuBar( menuBar ); // get menu references appleMenu = GetMenuRef( kAppleMenu ); fileMenu = GetMenuRef( kFileMenu ); editMenu = GetMenuRef( kEditMenu ); findMenu = GetMenuRef( kFindMenu ); optionsMenu = GetMenuRef( kOptionsMenu ); colorMenu = GetMenuRef( kColorMenu ); windowMenu = GetMenuRef( kWindowMenu ); #if !TARGET_API_MAC_CARBON AppendResMenu( appleMenu, 'DRVR' ); #endif AppendResMenu( colorMenu, 'HEct' ); // LR: add color scheme menu DrawMenuBar(); return noErr; }
/***************************************************** * * main (argc, argv) * * Purpose: main program entry point * * Notes: You might want to change this to something more verbose * * Inputs: argc - the number of elements in the argv array * argv - an array of pointers to the parameters to this application * * Returns: int - error code (0 == no error) */ int main(int argc, char* argv[]) { OSStatus status; // Can we run this particular demo application? long response; status = Gestalt(gestaltSystemVersion, &response); Boolean ok = ((noErr == status) && (response >= 0x00001030)); if (!ok) { DialogRef theAlert; CreateStandardAlert(kAlertStopAlert, CFSTR("Mac OS X 10.3 (minimum) is required for this application"), NULL, NULL, &theAlert); RunStandardAlert(theAlert, NULL, NULL); ExitToShell(); } // Create a Nib reference passing the name of the nib file (without the .nib extension) // CreateNibReference only searches into the application bundle. status = CreateNibReference(CFSTR("main"), &gIBNibRef); require_noerr(status, CantGetNibRef); // Once the nib reference is created, set the menu bar. "MainMenu" is the name of the menu bar // object. This name is set in InterfaceBuilder when the nib is created. status = SetMenuBarFromNib(gIBNibRef, CFSTR("MenuBar")); require_noerr(status, CantSetMenuBar); // Adding a Font menu MenuRef fontMenu = GetMenuRef(3); require(fontMenu != NULL, CantSetMenuBar); status = CreateStandardFontMenu(fontMenu, 0, 0, 0, NULL); require_noerr(status, CantSetMenuBar); // Enabling Preferences menu item EnableMenuCommand(NULL, kHICommandPreferences); // Let's react to User's commands. Install_AppleEventHandlers(); EventTypeSpec eventTypeCP = {kEventClassCommand, kEventCommandProcess}; InstallEventHandler(GetApplicationEventTarget(), Handle_CommandProcess, 1, &eventTypeCP, NULL, NULL); EventTypeSpec eventTypeCUS = {kEventClassCommand, kEventCommandUpdateStatus}; InstallEventHandler(GetApplicationEventTarget(), Handle_CommandUpdateStatus, 1, &eventTypeCUS, NULL, NULL); EventTypeSpec eventTypeAA = {kEventClassApplication, kEventAppActivated}; InstallEventHandler(GetApplicationEventTarget(), Handle_AppActivated, 1, &eventTypeAA, NULL, NULL); // Call the event loop RunApplicationEventLoop(); CantSetMenuBar: CantGetNibRef: return status; } // main
// -------------------------------------------------------------------------------------- void ClosePrefsWindow(WindowRef prefsWindow) { ListHandle iconList; HideWindow(prefsWindow); DisableMenuItem(GetMenuRef(mFile), iClose); GetWindowProperty(prefsWindow, kAppSignature, kIconListTag, sizeof(ListHandle), NULL, &iconList); ReleaseIconListIcons(iconList); LDispose(iconList); #if TARGET_API_MAC_CARBON DisposeListDefUPP(gIconListDef); DisposeEventHandlerUPP(gWindowEventHandler); DisposePrefsWindowHelpTags(); #endif DisposeWindow(prefsWindow); EnableMenuItem(GetMenuRef(mDemonstration), iPrefsWindow); }
// -------------------------------------------------------------------------------------- void ClosePrefsDialog(DialogRef prefsDialog) { ControlRef listBoxControl; ListHandle iconList; HideWindow(GetDialogWindow(prefsDialog)); GetDialogItemAsControl(prefsDialog, iIconList, &listBoxControl); GetControlData(listBoxControl, kControlEntireControl, kControlListBoxListHandleTag, sizeof(ListHandle), &iconList, NULL); ReleaseIconListIcons(iconList); DisposeDialog(prefsDialog); EnableMenuItem(GetMenuRef(mDemonstration), iPrefsDialog); }
// -------------------------------------------------------------------------------------- void HandleActivate(WindowRef window, Boolean activate) { ControlRef rootControl; ListHandle iconList; SInt16 pixelDepth; Boolean isColorDevice; GetRootControl(window, &rootControl); GetWindowProperty(window, kAppSignature, kIconListTag, sizeof(ListHandle), NULL, &iconList); SetPortWindowPort(window); GetWindowDeviceDepthAndColor(window, &pixelDepth, &isColorDevice); if (activate) { SetThemeTextColor(kThemeTextColorModelessDialogActive, pixelDepth, isColorDevice); ActivateControl(rootControl); SetThemeBackground(kThemeBrushWhite, pixelDepth, isColorDevice); LActivate(true, iconList); RedrawPrefsWindowList(window); // redraw the list with the active appearance drawFrameAndFocus(iconList, true, window); EnableMenuItem(GetMenuRef(mFile), iClose); } else // deactivate { SetThemeTextColor(kThemeTextColorModelessDialogInactive, pixelDepth, isColorDevice); DeactivateControl(rootControl); SetThemeBackground(kThemeBrushWhite, pixelDepth, isColorDevice); LActivate(false, iconList); RedrawPrefsWindowList(window); // redraw the list with the inactive appearance drawFrameAndFocus(iconList, false, window); DisableMenuItem(GetMenuRef(mFile), iClose); } }
// -------------------------------------------------------------------------------------- void ClosePrefsDialog(DialogRef prefsDialog) { ControlRef listBoxControl; ListHandle iconList; HideWindow(GetDialogWindow(prefsDialog)); GetDialogItemAsControl(prefsDialog, iIconList, &listBoxControl); GetControlData(listBoxControl, kControlEntireControl, kControlListBoxListHandleTag, sizeof(ListHandle), &iconList, NULL); ReleaseIconListIcons(iconList); DisposeEventHandlerUPP(gDialogEventHandler); DisposeEventHandlerUPP(gListBoxControlEventHandler); RegisterListDefinition(kIconListLDEF, NULL); // unregister the list definition DisposeDialog(prefsDialog); EnableMenuItem(GetMenuRef(mDemonstration), iPrefsDialog); }
// -------------------------------------------------------------------------------------- void OpenPrefsDialog(void) { ListDefSpec listSpec; DialogRef dialog; WindowRef dialogWindow; EventTypeSpec dialogEvents[] = { {kEventClassControl, kEventControlHit} }; ControlID controlID = {kAppSignature, 0}; ControlRef control; EventTypeSpec listBoxControlEvents[] = { {kEventClassTextInput, kEventTextInputUnicodeForKeyEvent} }; ListHandle iconList; Cell theCell; listSpec.defType = kListDefUserProcType; listSpec.u.userProc = NewListDefUPP(IconListDef); // this is automatically disposed // when the program exits RegisterListDefinition(kIconListLDEF, &listSpec); dialog = GetNewDialog(rPrefsDialog, NULL, kFirstWindowOfClass); if (dialog == NULL) ExitToShell(); SetPortDialogPort(dialog); dialogWindow = GetDialogWindow(dialog); // install window handlers ChangeWindowAttributes(dialogWindow, kWindowStandardHandlerAttribute, kWindowNoAttributes); gDialogEventHandler = NewEventHandlerUPP(dialogEventHandler); InstallWindowEventHandler(dialogWindow, gDialogEventHandler, GetEventTypeCount(dialogEvents), dialogEvents, (void *)dialog, NULL); GetDialogItemAsControl(dialog, kStdOkItemIndex, &control); // set control IDs to controlID.id = kStdOkItemIndex; // match dialog item SetControlID(control, &controlID); // indices which are SetWindowDefaultButton(dialogWindow, control); // not tracked by any // standard handlers GetDialogItemAsControl(dialog, kStdCancelItemIndex, &control); // also set the default controlID.id = kStdCancelItemIndex; // and cancel buttons (because Mac OS 8/9 SetControlID(control, &controlID); // under CarbonLib doesn't respect the SetWindowCancelButton(dialogWindow, control); // dialog's default and cancel buttons) GetDialogItemAsControl(dialog, iIconList, &control); controlID.id = iIconList; SetControlID(control, &controlID); /* We need to postprocess keyboard events on the icon list so that we can change panels after the user changes the selected cell by using the keyboard. */ gListBoxControlEventHandler = NewEventHandlerUPP(listBoxControlEventHandler); InstallControlEventHandler(control, gListBoxControlEventHandler, GetEventTypeCount(listBoxControlEvents), listBoxControlEvents, (void *)dialog, NULL); GetControlData(control, kControlEntireControl, kControlListBoxListHandleTag, sizeof(ListHandle), &iconList, NULL); AddRowsAndDataToIconList(iconList, rIconListIconBaseID); SetListSelectionFlags(iconList, lOnlyOne); SetPt(&theCell, 0, 0); LSetSelect(true, theCell, iconList); SetKeyboardFocus(dialogWindow, control, kControlFocusNextPart); gPanelNumber = 0; SetPrefsDialogHelpTags(dialog); DisableMenuItem(GetMenuRef(mDemonstration), iPrefsDialog); ShowWindow(dialogWindow); } // OpenPrefsDialog
// -------------------------------------------------------------------------------------- static Boolean dialogFilter(EventRecord *event, DialogRef *theDialog, DialogItemIndex *itemHit) { /* See the comments for HandleKeyDown in PrefsWindow.c about why we're using virtual key codes instead of character codes. */ Boolean eventHandled = false; char charCode, keyCode; switch (event->what) { case keyDown: // handle key presses not handled by DialogSelect case autoKey: *theDialog = GetDialogFromWindow(FrontNonFloatingWindow()); SetPortDialogPort(*theDialog); charCode = event->message & charCodeMask; keyCode = (event->message & keyCodeMask) >> 8; if ((event->modifiers & cmdKey) != 0) // check to see if any menu commands { // were selected - this isn't necessarily handling the event UInt32 menuChoice; OSErr error; MenuCommand commandID; menuChoice = MenuEvent(event); error = GetMenuItemCommandID(GetMenuRef(HiWord(menuChoice)), LoWord(menuChoice), &commandID); if (error == noErr) { if (commandID == 0) // if the menu item chosen does not have a commandID = (MenuCommand)menuChoice; // command ID HandleMenuChoice(commandID); // (but they all should) } } if ( (keyCode == kEnterKeyCode) || (keyCode == kReturnKeyCode) || (keyCode == kEscapeKeyCode) || ( ((event->modifiers & cmdKey) != 0) && (charCode == '.') ) ) { ControlRef button; unsigned long finalTicks; if ( (keyCode == kEnterKeyCode) || (keyCode == kReturnKeyCode) ) { GetDialogItemAsControl(*theDialog, kStdOkItemIndex, &button); *itemHit = kStdOkItemIndex; } else { GetDialogItemAsControl(*theDialog, kStdCancelItemIndex, &button); *itemHit = kStdCancelItemIndex; } HiliteControl(button, kControlButtonPart); Delay(8, &finalTicks); HiliteControl(button, kControlNoPart); eventHandled = true; } } return eventHandled; }
// -------------------------------------------------------------------------------------- static void handleEvents(EventRecord *event) { WindowRef window; Boolean activate; WindowPartCode partCode; OSErr error; Rect tempRect, newSize; long menuChoice; MenuCommand commandID; RgnHandle grayRegion; switch (event->what) // handle events according to the priority { // determined by the system case activateEvt: window = (WindowRef)event->message; activate = (event->modifiers & activeFlag) != 0; HandleActivate(window, activate); break; case mouseDown: partCode = FindWindow(event->where, &window); switch(partCode) { case inMenuBar: menuChoice = MenuSelect(event->where); error = GetMenuItemCommandID(GetMenuRef(HiWord(menuChoice)), LoWord(menuChoice), &commandID); if (error == noErr) { if (commandID == 0) // if the menu item clicked on does not have commandID = (MenuCommand)menuChoice; // a command ID HandleMenuChoice(commandID); } break; case inSysWindow: if (window != NULL) SystemClick(event, window); break; case inContent: // the following window part codes will only be returned if (window != FrontWindow()) // for the preferences window SelectWindow(window); else HandleContentClick(window, event->where, event->modifiers); break; case inDrag: grayRegion = GetGrayRgn(); DragWindow(window, event->where, &((*grayRegion)->rgnBBox)); break; case inGrow: SetRect(&tempRect, kPrefsWindowPlatinumWidth, kPrefsWindowPlatinumHeight, SHRT_MAX, SHRT_MAX); ResizeWindow(window, event->where, &tempRect, &newSize); AdjustControls(window); break; case inGoAway: ClosePrefsWindow(window); break; } break; case keyDown: case autoKey: // a separate auto key handler would go after disk events if ((event->modifiers & cmdKey) != 0) { UInt32 keyMenuChoice; keyMenuChoice = MenuEvent(event); error = GetMenuItemCommandID(GetMenuRef(HiWord(keyMenuChoice)), LoWord(keyMenuChoice), &commandID); if (error == noErr) { if (commandID == 0) // if the menu item chosen does not have a commandID = (MenuCommand)keyMenuChoice; // command ID HandleMenuChoice(commandID); // (but they all should) } } else { window = FrontNonFloatingWindow(); if (window != NULL) { char keyCode = (event->message & keyCodeMask) >> 8; HandleKeyDown(keyCode, window); } } break; case diskEvt: if (HiWord(event->message) != noErr) { Point where; SetPt(&where, 70, 50); ShowCursor(); DIBadMount(where, event->message); } break; case updateEvt: window = (WindowRef)event->message; SetPortWindowPort(window); BeginUpdate(window); HandleDrawContent(window); EndUpdate(window); break; case kHighLevelEvent: // an OS Event handler would go before high level events AEProcessAppleEvent(event); break; }
// -------------------------------------------------------------------------------------- static pascal OSErr openApplicationAEHandler(const AppleEvent *appleEvent, AppleEvent *reply, long refcon) { OSErr error; DescType returnedType; Size actualSize; error = AEGetAttributePtr(appleEvent, keyMissedKeywordAttr, typeWildCard, &returnedType, NULL, 0, &actualSize); if (error == noErr) error = errAEParamMissed; else if (error == errAEDescNotFound) { MenuRef menu; CFStringRef aboutString; EventTypeSpec applicationEvents[] = { {kEventClassCommand, kEventCommandProcess} }; /* For our program running in Carbon, a Quit Application Apple Event handler is unnecessary because RunApplicationEventLoop installs one for us that calls QuitApplicationEventLoop. However we will leave ours here in case we ever need it to do something different so that we know where it belongs. */ gQuitAppAEHandler = NewAEEventHandlerUPP(quitApplicationAEHandler); error = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, gQuitAppAEHandler, 0, false); if (error != noErr) // if we can't allow the user a mechanism to quit { // we'd better just quit right now DisposeAEEventHandlerUPP(gOpenAppAEHandler); DisposeAEEventHandlerUPP(gQuitAppAEHandler); ExitToShell(); } gViewsFontChangedAEHandler = NewAEEventHandlerUPP(viewsFontChangedAEHandler); error = AEInstallEventHandler(kAppearanceEventClass, kAEViewsFontChanged, gViewsFontChangedAEHandler, 0, false); #if TARGET_API_MAC_OSX #pragma unused (reply, refcon) menu = GetMenuRef(mAppleApplication); aboutString = CFCopyLocalizedString(CFSTR("About Item"), NULL); SetMenuItemTextWithCFString(menu, iAbout, aboutString); // get rid of the "..." CFRelease(aboutString); // if we're running in OS X menu = GetMenuRef(mFile); ChangeMenuAttributes(menu, kMenuAttrAutoDisable, 0); DeleteMenuItem(menu, iQuit); // remove the Quit item and separator DeleteMenuItem(menu, iQuitSeparator); // if we're running in OS X #else #pragma unused (reply, refcon, menu, aboutString) #endif gAppEventHandler = NewEventHandlerUPP(appEventHandler); InstallApplicationEventHandler(gAppEventHandler, GetEventTypeCount(applicationEvents), applicationEvents, NULL, NULL); InitIconDataBrowser(); error = noErr; } return error; }
// -------------------------------------------------------------------------------------- void OpenPrefsWindow(void) { OSStatus error; SInt16 windowResourceID, visibleUserPaneResourceID, invisibleUserPaneResourceID, pixelDepth; WindowRef window; ControlRef containerControl, embeddedControl; short iconListBottom; Rect iconListRect; Boolean isColorDevice; ListHandle iconList; EventTypeSpec windowEvents[] = { {kEventClassWindow, kEventWindowActivated}, {kEventClassWindow, kEventWindowDeactivated}, {kEventClassWindow, kEventWindowHandleContentClick}, {kEventClassWindow, kEventWindowGetMinimumSize}, {kEventClassWindow, kEventWindowResizeCompleted}, {kEventClassWindow, kEventWindowClose}, {kEventClassWindow, kEventWindowDrawContent}, {kEventClassWindow, kEventWindowContextualMenuSelect}, {kEventClassControl, kEventControlClick}, {kEventClassMouse, kEventMouseWheelMoved}, {kEventClassTextInput, kEventTextInputUnicodeForKeyEvent} }; if (!RunningInMacOSX()) { windowResourceID = rPrefsWindowPlatinum; visibleUserPaneResourceID = cPlatinumWindowUserPaneVisible; invisibleUserPaneResourceID = cPlatinumWindowUserPaneInvisible; gPrefsWindowHeight = kPrefsWindowPlatinumHeight; gPrefsWindowWidth = kPrefsWindowPlatinumWidth; gMinimumSpacing = kPlatinumMinimumSpacing; gWindowEdgeSpacing = kPlatinumWindowEdgeSpacing; } else { windowResourceID = rPrefsWindowAqua; visibleUserPaneResourceID = cAquaWindowUserPaneVisible; invisibleUserPaneResourceID = cAquaWindowUserPaneInvisible; gPrefsWindowHeight = kPrefsWindowAquaHeight; gPrefsWindowWidth = kPrefsWindowAquaWidth; gMinimumSpacing = kAquaMinimumSpacing; gWindowEdgeSpacing = kAquaWindowEdgeSpacing; } error = CreateWindowFromResource(windowResourceID, &window); if (error != noErr) ExitToShell(); RepositionWindow(window, NULL, kWindowCascadeOnMainScreen); // CreateWindowFromResource // doesn't call this for you like GetNewCWindow does #if TARGET_API_MAC_CARBON // we would just set the standard handler attribute in the Carbon // Platinum 'wind' resource but that makes it not work under CarbonLib for some reason ChangeWindowAttributes(window, kWindowStandardHandlerAttribute, kWindowNoAttributes); #endif SetPortWindowPort(window); SetThemeWindowBackground(window, kThemeBrushModelessDialogBackgroundActive, true); CreateRootControl(window, &containerControl); /* Get each user pane and embed each preference panel's controls (for the demonstration there is only some static text identifying each panel number). We could just as easily have used AutoEmbedControl but why make the system figure out which control to use as the embedder when we already know? */ containerControl = GetNewControl(visibleUserPaneResourceID, window); embeddedControl = GetNewControl(cStaticText, window); EmbedControl(embeddedControl, containerControl); SetControlData(embeddedControl, kControlEntireControl, kControlStaticTextTextTag, 7, "Panel 1"); containerControl = GetNewControl(invisibleUserPaneResourceID, window); embeddedControl = GetNewControl(cStaticText, window); EmbedControl(embeddedControl, containerControl); SetControlData(embeddedControl, kControlEntireControl, kControlStaticTextTextTag, 7, "Panel 2"); containerControl = GetNewControl(invisibleUserPaneResourceID, window); embeddedControl = GetNewControl(cStaticText, window); EmbedControl(embeddedControl, containerControl); SetControlData(embeddedControl, kControlEntireControl, kControlStaticTextTextTag, 7, "Panel 3"); containerControl = GetNewControl(invisibleUserPaneResourceID, window); embeddedControl = GetNewControl(cStaticText, window); EmbedControl(embeddedControl, containerControl); SetControlData(embeddedControl, kControlEntireControl, kControlStaticTextTextTag, 7, "Panel 4"); containerControl = GetNewControl(invisibleUserPaneResourceID, window); embeddedControl = GetNewControl(cStaticText, window); EmbedControl(embeddedControl, containerControl); SetControlData(embeddedControl, kControlEntireControl, kControlStaticTextTextTag, 7, "Panel 5"); containerControl = GetNewControl(invisibleUserPaneResourceID, window); embeddedControl = GetNewControl(cStaticText, window); EmbedControl(embeddedControl, containerControl); SetControlData(embeddedControl, kControlEntireControl, kControlStaticTextTextTag, 7, "Panel 6"); containerControl = GetNewControl(invisibleUserPaneResourceID, window); embeddedControl = GetNewControl(cStaticText, window); EmbedControl(embeddedControl, containerControl); SetControlData(embeddedControl, kControlEntireControl, kControlStaticTextTextTag, 7, "Panel 7"); containerControl = GetNewControl(invisibleUserPaneResourceID, window); embeddedControl = GetNewControl(cStaticText, window); EmbedControl(embeddedControl, containerControl); SetControlData(embeddedControl, kControlEntireControl, kControlStaticTextTextTag, 7, "Panel 8"); containerControl = GetNewControl(invisibleUserPaneResourceID, window); embeddedControl = GetNewControl(cStaticText, window); EmbedControl(embeddedControl, containerControl); SetControlData(embeddedControl, kControlEntireControl, kControlStaticTextTextTag, 7, "Panel 9"); containerControl = GetNewControl(invisibleUserPaneResourceID, window); embeddedControl = GetNewControl(cStaticText, window); EmbedControl(embeddedControl, containerControl); SetControlData(embeddedControl, kControlEntireControl, kControlStaticTextTextTag, 8, "Panel 10"); gPanelNumber = 1; GetWindowDeviceDepthAndColor(window, &pixelDepth, &isColorDevice); // draw the list with a SetThemeBackground(kThemeBrushWhite, pixelDepth, isColorDevice); // white background // get the bottom-most iconListBottom = gPrefsWindowHeight - gWindowEdgeSpacing; // coordinate we can use iconListBottom -= (gPrefsWindowHeight - gWindowEdgeSpacing - gWindowEdgeSpacing) % kCellHeight; // then subtract out the partial cell height that would // be drawn on the bottom so that it's not actually drawn SetRect(&iconListRect, gWindowEdgeSpacing, gWindowEdgeSpacing, gWindowEdgeSpacing + kListWidth, iconListBottom); iconList = createIconList(window, iconListRect); SetWindowProperty(window, kAppSignature, kIconListTag, sizeof(ListHandle), &iconList); #if TARGET_API_MAC_OS8 CalculateBalloonHelpRects(window); #else gWindowEventHandler = NewEventHandlerUPP(windowEventHandler); InstallWindowEventHandler(window, gWindowEventHandler, GetEventTypeCount(windowEvents), windowEvents, NULL, NULL); InstallPrefsWindowHelpTags(window); #endif DisableMenuItem(GetMenuRef(mDemonstration), iPrefsWindow); EnableMenuItem(GetMenuRef(mFile), iClose); ShowWindow(window); } // OpenPrefsWindow