CDialogInstall* CDialogInstall::Create() { auto dialog = new CDialogInstall(); dialog->ShowDialogWindow( L"Installer", 0, 0, 350, 210, DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME, WS_EX_APPWINDOW | WS_EX_CONTROLPARENT, nullptr, false); return dialog; }
static int DoXOPAlert(short dlogID, const char* title, const char* message) { DialogPtr theDialog; WindowRef theWindow; short hit; unsigned char temp[256]; int result = 0; ArrowCursor(); paramtext(message, "", "", ""); theDialog = GetNewDialog(dlogID, NULL, (WindowPtr)-1L); // This must access Igor's data fork which contains the DLOG resources for these dialogs. if (theDialog == NULL) return -1; theWindow = GetDialogWindow(theDialog); if (theWindow == NULL) return -1; CopyCStringToPascal(title, temp); SetWTitle(theWindow, temp); ShowDialogWindow(theDialog); do { ModalDialog(NULL, &hit); switch(hit) { case 1: // OK or Yes. result = 1; break; case 2: // No or Cancel. if (dlogID == IGOR_OK_CANCEL_DLOG) result = -1; // Cancel result is -1. else result = 2; break; case 3: // Cancel. result = -1; break; } } while(result == 0); DisposeDialog(theDialog); return result; }
/* GBScalingDialog() GBScalingDialog is called when user clicks the Scaling button in the GBLoadWave dialog. offsetPtr and multiplierPtr are used as both inputs and outputs. If the user cancels, they are not changed. Returns 0 if user clicks OK, -1 if user clicks cancel, or an error code. */ int GBScalingDialog(double* offsetPtr, double* multiplierPtr) { DialogPtr theDialog; DialogStorage ds; short itemHit; GrafPtr savePort; int err; if (err = InitDialogStorage(&ds, offsetPtr, multiplierPtr)) return err; theDialog = GetXOPDialog(DIALOG_TEMPLATE_ID); savePort = SetDialogPort(theDialog); if (err = InitDialogSettings(theDialog, &ds)) { DisposeDialogStorage(&ds); DisposeXOPDialog(theDialog); SetPort(savePort); return err; } ShowDialogWindow(theDialog); do { DoXOPDialog(&itemHit); switch (itemHit) { default: HandleItemHit(theDialog, itemHit, &ds); break; } } while (itemHit!=OK_BUTTON && itemHit!=CANCEL_BUTTON); ShutdownDialogSettings(theDialog, &ds); DisposeDialogStorage(&ds); DisposeXOPDialog(theDialog); SetPort(savePort); if (itemHit == OK_BUTTON) return 0; return -1; // Cancel. }