1 #ifndef MESSAGEBOXSCREEN_H 2 #define MESSAGEBOXSCREEN_H 3 4 #include "Button_System.h" 5 #include "JA2Types.h" 6 #include "MouseSystem.h" 7 #include "ScreenIDs.h" 8 9 #include <string_theory/string> 10 11 12 // Message box flags 13 enum MessageBoxFlags 14 { 15 MSG_BOX_FLAG_OK, // Displays OK button 16 MSG_BOX_FLAG_YESNO, // Displays YES NO buttons 17 MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS, // Displays four numbered buttons, 1-4 18 MSG_BOX_FLAG_OKCONTRACT, // ok and contract buttons 19 MSG_BOX_FLAG_YESNOLIE, // ok and contract buttons 20 MSG_BOX_FLAG_CONTINUESTOP, // continue stop box 21 MSG_BOX_FLAG_OKSKIP, // Displays ok or skip (meanwhile) buttons 22 MSG_BOX_FLAG_GENERICCONTRACT, // displays contract buttoin + 2 user-defined text buttons 23 MSG_BOX_FLAG_GENERIC // 2 user-defined text buttons 24 }; 25 26 // message box return codes 27 enum MessageBoxReturnValue 28 { 29 MSG_BOX_RETURN_NONE = 0, 30 MSG_BOX_RETURN_OK = 1, // ENTER or on OK button 31 MSG_BOX_RETURN_YES = 2, // ENTER or YES button 32 MSG_BOX_RETURN_NO = 3, // ESC, Right Click or NO button 33 MSG_BOX_RETURN_CONTRACT = 4, // contract button 34 MSG_BOX_RETURN_LIE = 5, // LIE BUTTON 35 36 MSG_BOX_RETURN_1 = 1, 37 MSG_BOX_RETURN_2 = 2, 38 MSG_BOX_RETURN_3 = 3, 39 MSG_BOX_RETURN_4 = 4 40 }; 41 42 typedef void (*MSGBOX_CALLBACK)(MessageBoxReturnValue); 43 44 // message box style flags 45 enum MessageBoxStyleID 46 { 47 MSG_BOX_BASIC_STYLE, // We'll have other styles, like in laptop, etc 48 // Graphics are all that are required here... 49 MSG_BOX_RED_ON_WHITE, 50 MSG_BOX_BLUE_ON_GREY, 51 MSG_BOX_BASIC_SMALL_BUTTONS, 52 MSG_BOX_IMP_STYLE, 53 MSG_BOX_LAPTOP_DEFAULT 54 }; 55 56 57 struct MESSAGE_BOX_STRUCT 58 { 59 MessageBoxFlags usFlags; 60 ScreenID uiExitScreen; 61 MSGBOX_CALLBACK ExitCallback; 62 UINT16 uX; 63 UINT16 uY; 64 SGPVSurface* uiSaveBuffer; 65 MOUSE_REGION BackRegion; 66 UINT16 usWidth; 67 UINT16 usHeight; 68 BUTTON_PICS* iButtonImages; 69 GUIButtonRef uiOKButton; 70 GUIButtonRef uiYESButton; 71 GUIButtonRef uiNOButton; 72 GUIButtonRef uiButton[4]; 73 BOOLEAN fRenderBox; 74 MessageBoxReturnValue bHandled; 75 MercPopUpBox* box; 76 }; 77 78 79 extern MESSAGE_BOX_STRUCT gMsgBox; 80 extern BOOLEAN fRestoreBackgroundForMessageBox; 81 82 //this variable can be unset if ur in a non gamescreen and DONT want the msg box to use the save buffer 83 extern BOOLEAN gfDontOverRideSaveBuffer; 84 85 extern ST::string gzUserDefinedButton1; 86 extern ST::string gzUserDefinedButton2; 87 88 /* ubStyle: Determines the look of graphics including buttons 89 * zString: 16-bit string 90 * uiExitScreen The screen to exit to 91 * ubFlags Some flags for button style 92 * ReturnCallback Callback for return. Can be NULL. Returns any above return value 93 * pCenteringRect Rect to center in. Can be NULL */ 94 void DoMessageBox(MessageBoxStyleID ubStyle, const ST::string str, ScreenID uiExitScreen, MessageBoxFlags usFlags, MSGBOX_CALLBACK ReturnCallback, const SGPBox* centering_rect); 95 void DoScreenIndependantMessageBox(const ST::string& msg, MessageBoxFlags flags, MSGBOX_CALLBACK callback); 96 97 //wrappers for other screens 98 void DoMapMessageBoxWithRect(MessageBoxStyleID ubStyle, const ST::string& str, ScreenID uiExitScreen, MessageBoxFlags usFlags, MSGBOX_CALLBACK ReturnCallback, const SGPBox* centering_rect); 99 void DoOptionsMessageBoxWithRect(const ST::string& str, ScreenID uiExitScreen, MessageBoxFlags usFlags, MSGBOX_CALLBACK ReturnCallback, const SGPBox* centering_rect); 100 void DoSaveLoadMessageBoxWithRect(const ST::string& str, ScreenID uiExitScreen, MessageBoxFlags usFlags, MSGBOX_CALLBACK ReturnCallback, const SGPBox* centering_rect); 101 102 extern BOOLEAN gfInMsgBox; 103 104 ScreenID MessageBoxScreenHandle(void); 105 void MessageBoxScreenShutdown(); 106 107 #endif 108