static void Initialize(void) { Controls[0] = CreateLabel("You have pressed the key to stop the", DIALOGFORCOLOR, DIALOGBACKCOLOR, TEXT_X, DIALOG_Y+1); Controls[1] = CreateLabel("defragmentation process.", DIALOGFORCOLOR, DIALOGBACKCOLOR, TEXT_X, DIALOG_Y+2); Controls[2] = CreateLabel("Are you sure you want to stop?", DIALOGFORCOLOR, DIALOGBACKCOLOR, TEXT_X, DIALOG_Y+4); Controls[3] = CreateCommandButton(&YesButton, BUTTONFORCOLOR, BUTTONBACKCOLOR, BUTTON_X1, BUTTON_Y, TRUE, FALSE, FALSE); Controls[4] = CreateCommandButton(&NoButton, BUTTONFORCOLOR, BUTTONBACKCOLOR, BUTTON_X2, BUTTON_Y, FALSE, TRUE, FALSE); }
static void Initialize(void) { controls[0] = CreateLabel("Recommended optimization method:", DIALOGFORCOLOR, DIALOGBACKCOLOR, TEXT_X, DIALOG_Y+4); controls[1] = CreateCommandButton(&OptimizeButton, BUTTONFORCOLOR, BUTTONBACKCOLOR, BUTTON_X1, BUTTON_Y, FALSE, FALSE, FALSE); controls[2] = CreateCommandButton(&ConfigureButton, BUTTONFORCOLOR, BUTTONBACKCOLOR, BUTTON_X2, BUTTON_Y, FALSE, FALSE, FALSE); }
static void Initialize(void) { controls[0] = CreateLabel("Your drive has been optimized.", DIALOGFORCOLOR, DIALOGBACKCOLOR, FRAME_X, DIALOG_Y+1); controls[1] = CreateFrame(&ActionsFrame, DIALOGFORCOLOR, DIALOGBACKCOLOR, FRAME_X, DIALOG_Y+3); controls[2] = CreateSelectionButton(&SelectButtons[0], DIALOGFORCOLOR, DIALOGBACKCOLOR, TEXT_X, DIALOG_Y+4); controls[3] = CreateSelectionButton(&SelectButtons[1], DIALOGFORCOLOR, DIALOGBACKCOLOR, TEXT_X, DIALOG_Y+5); controls[4] = CreateSelectionButton(&SelectButtons[2], DIALOGFORCOLOR, DIALOGBACKCOLOR, TEXT_X, DIALOG_Y+6); controls[5] = CreateCommandButton(&OkButton, BUTTONFORCOLOR, BUTTONBACKCOLOR, BUTTON_X, BUTTON_Y, TRUE, FALSE, FALSE); }
static int MessageBox(char* msg, int btncount, char** buttons, int forcolor, int backcolor, int btnforc, int btnbackc, int btnhighc, char* caption) { int slen, dwidth, btnarea, dialog_x, text_x, i, btn_x, result; /* Calculate dialog width. */ slen = strlen(msg); btnarea = ((btncount-1) * (BUTTON_LENGTH+2)) + BUTTON_LENGTH+1; dwidth = max(btnarea, slen) + 4; dialog_x = (MAX_X / 2) - (dwidth / 2); GenericMsgBxs.caption = caption; GenericMsgBxs.x = dialog_x; GenericMsgBxs.xlen = dwidth; GenericMsgBxs.SurfaceColor = backcolor; GenericMsgBxs.FrameColor = forcolor; GenericMsgBxs.AmofControls = btncount+1; /* Put the text in the dialog. */ text_x = (slen > btnarea) ? dialog_x + 2 : dialog_x + ((btnarea / 2) - (slen / 2)) + 2; Controls[0] = CreateLabel(msg, forcolor, backcolor, text_x, TEXT_Y); /* Put the buttons on the screen. */ btn_x = dialog_x + (dwidth / 2) - (btnarea / 2); for (i = 0; i < btncount; i++) { CmdButtons[i].caption = buttons[i]; CmdButtons[i].highcolor = btnhighc; Controls[i+1] = CreateCommandButton(&CmdButtons[i], btnforc, btnbackc, btn_x, BUTTON_Y, FALSE, FALSE, FALSE); btn_x += BUTTON_LENGTH + 2; } OpenWindow(&GenericMsgBxs); result = ControlWindow(&GenericMsgBxs); CloseWindow(); return result; }
static void Initialize(void) { controls[0] = CreateLabel("Choose drive to optimize.", DIALOGFORCOLOR, DIALOGBACKCOLOR, TEXT_X, DIALOG_Y + 2); controls[1] = CreateDriveSelectionBox(&DBox, &LBox, &VBox, SELBOX_X, SELBOX_Y, BLUE, DIALOGBACKCOLOR); controls[2] = CreateCommandButton(&OkButton, BUTTONFORCOLOR, BUTTONBACKCOLOR, BUTTON_X, BUTTON_Y1, TRUE, FALSE, FALSE); controls[3] = CreateCommandButton(&CancelButton, BUTTONFORCOLOR, BUTTONBACKCOLOR, BUTTON_X, BUTTON_Y2, FALSE, TRUE, FALSE); }