1 #ifndef __POPUP_BOX
2 #define __POPUP_BOX
3 
4 #include "JA2Types.h"
5 
6 #include <string_theory/string>
7 
8 
9 #define MAX_POPUP_BOX_STRING_COUNT 50		// worst case = 45: move menu with 20 soldiers, each on different squad + overhead
10 
11 // PopUpBox Flags
12 #define POPUP_BOX_FLAG_CENTER_TEXT 2
13 #define POPUP_BOX_FLAG_RESIZE 4
14 
15 #define NO_POPUP_BOX NULL
16 
17 PopUpBox* CreatePopUpBox(SGPPoint Position, UINT32 uiFlags, SGPVSurface*, const SGPVObject* border, SGPVSurface* background, UINT32 margin_l, UINT32 margin_t, UINT32 margin_b, UINT32 margin_r, UINT32 line_space);
18 
19 UINT32 GetTopMarginSize(const PopUpBox*);
20 UINT32 GetLineSpace(const PopUpBox*);
21 void SetBoxXY(PopUpBox*, INT16 x, INT16 y);
22 void SetBoxX(PopUpBox*, INT16 x);
23 void SetBoxY(PopUpBox*, INT16 y);
24 UINT32 GetNumberOfLinesOfTextInBox(const PopUpBox*);
25 SGPBox const& GetBoxArea(PopUpBox const*);
26 void AddMonoString(PopUpBox* box, const ST::string& str);
27 void SetBoxFont(PopUpBox*, SGPFont);
28 SGPFont GetBoxFont(const PopUpBox*);
29 void SetBoxForeground(PopUpBox*, UINT8 colour);
30 void SetBoxBackground(PopUpBox*, UINT8 colour);
31 void SetBoxHighLight(PopUpBox*, UINT8 colour);
32 void SetBoxShade(PopUpBox*, UINT8 colour);
33 
34 void ShadeStringInBox(PopUpBox*, INT32 line, bool shade);
35 
36 enum PopUpShade
37 {
38 	POPUP_SHADE_NONE,
39 	POPUP_SHADE,
40 	POPUP_SHADE_SECONDARY
41 };
42 void ShadeStringInBox(PopUpBox*, INT32 line, PopUpShade);
43 
44 void HighLightBoxLine(PopUpBox*, INT32 iLineNumber);
45 void UnHighLightBox(PopUpBox*);
46 void RemoveAllBoxStrings(PopUpBox*);
47 void RemoveBox(PopUpBox*);
48 void ShowBox(PopUpBox*);
49 void HideBox(PopUpBox*);
50 void DisplayBoxes(SGPVSurface* buffer);
51 void DisplayOnePopupBox(PopUpBox*, SGPVSurface* buffer);
52 
53 // resize this box to the text it contains
54 void ResizeBoxToText(PopUpBox*);
55 
56 // force update/redraw of this boxes background
57 void ForceUpDateOfBox(PopUpBox*);
58 
59 // force redraw of ALL boxes
60 void MarkAllBoxesAsAltered( void );
61 
62 // is the box being displayed?
63 BOOLEAN IsBoxShown(const PopUpBox*);
64 
65 // is this line in the current box set to a shaded state ?
66 BOOLEAN GetBoxShadeFlag(const PopUpBox*, INT32 iLineNumber);
67 
68 // set boxes foreground color
69 void SetBoxLineForeground(PopUpBox*, INT32 iStringValue, UINT8 ubColor);
70 
71 // hide all visible boxes
72 void HideAllBoxes( void );
73 
74 // add a second column monochrome string
75 void AddSecondColumnMonoString(PopUpBox* box, const ST::string& str);
76 
77 // set the minimum offset
78 void SetBoxSecondColumnMinimumOffset(PopUpBox*, UINT32 uiWidth);
79 
80 // now on a box wide basis, one if recomened to use this function after adding all the strings..rather than on an individual basis
81 void SetBoxSecondColumnForeground(PopUpBox*, UINT8 colour);
82 void SetBoxSecondColumnBackground(PopUpBox*, UINT8 colour);
83 void SetBoxSecondColumnHighLight(PopUpBox*, UINT8 colour);
84 void SetBoxSecondColumnShade(PopUpBox*, UINT8 colour);
85 
86 // secondary shades for boxes
87 void SetBoxSecondaryShade(PopUpBox*, UINT8 colour);
88 
89 // min width for box
90 void SpecifyBoxMinWidth(PopUpBox*, INT32 iMinWidth);
91 
92 #endif
93