File diff r8106:01dbd10fde05 → r8107:82461791b7a2
src/window_gui.h
Show inline comments
 
@@ -16,14 +16,12 @@
 

	
 
/**
 
 * The maximum number of windows that can be opened.
 
 */
 
static const int MAX_NUMBER_OF_WINDOWS = 25;
 

	
 
struct WindowEvent;
 

	
 
typedef void WindowProc(Window *w, WindowEvent *e);
 

	
 
/* How the resize system works:
 
    First, you need to add a WWT_RESIZEBOX to the widgets, and you need
 
     to add the flag WDF_RESIZABLE to the window. Now the window is ready
 
     to resize itself.
 
@@ -225,26 +223,13 @@ enum WindowDefaultPosition {
 
	WDP_AUTO      = -1, ///< Find a place automatically
 
	WDP_CENTER    = -2, ///< Center the window (left/right or top/bottom)
 
	WDP_ALIGN_TBR = -3, ///< Align the right side of the window with the right side of the main toolbar
 
	WDP_ALIGN_TBL = -4, ///< Align the left side of the window with the left side of the main toolbar
 
};
 

	
 
struct Textbuf {
 
	char *buf;                  ///< buffer in which text is saved
 
	uint16 maxlength, maxwidth; ///< the maximum size of the buffer. Maxwidth specifies screensize in pixels, maxlength is in bytes
 
	uint16 length, width;       ///< the current size of the string. Width specifies screensize in pixels, length is in bytes
 
	bool caret;                 ///< is the caret ("_") visible or not
 
	uint16 caretpos;            ///< the current position of the caret in the buffer, in bytes
 
	uint16 caretxoffs;          ///< the current position of the caret in pixels
 
};
 

	
 
#define WP(ptr, str) (*(str*)(ptr)->custom)
 
/* You cannot 100% reliably calculate the biggest custom struct as
 
 * the number of pointers in it and alignment will have a huge impact.
 
 * 96 is the largest window-size for 64-bit machines currently */
 
#define WINDOW_CUSTOM_SIZE 96
 

	
 
struct Scrollbar {
 
	uint16 count, cap, pos;
 
};
 

	
 
struct ResizeInfo {
 
@@ -304,26 +289,12 @@ struct Window {
 
	void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets, ...);
 
	void CDECL SetWidgetsHiddenState(bool hidden_stat, int widgets, ...);
 
	void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets, ...);
 
	void InvalidateWidget(byte widget_index) const;
 
};
 

	
 
struct querystr_d {
 
	StringID caption;
 
	Textbuf text;
 
	const char *orig;
 
	CharSetFilter afilter;
 
	bool handled;
 
};
 
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(querystr_d));
 

	
 
struct chatquerystr_d : public querystr_d {
 
	int dest;
 
};
 
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(chatquerystr_d));
 

	
 
struct menu_d {
 
	byte item_count;      ///< follow_vehicle
 
	byte sel_index;       ///< scrollpos_x
 
	byte main_button;     ///< scrollpos_y
 
	byte action_id;
 
	StringID string_id;   ///< unk30
 
@@ -634,13 +605,12 @@ void UnInitWindowSystem();
 
void ResetWindowSystem();
 
int GetMenuItemIndex(const Window *w, int x, int y);
 
void InputLoop();
 
void InvalidateThisWindowData(Window *w);
 
void InvalidateWindowData(WindowClass cls, WindowNumber number);
 
void RelocateAllWindows(int neww, int newh);
 
int PositionMainToolbar(Window *w);
 

	
 
/* misc_gui.cpp */
 
void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint64 params[]);
 
static inline void GuiShowTooltips(StringID str)
 
{
 
	GuiShowTooltipsWithArgs(str, 0, NULL);