File diff r6178:fc8bd2bde93a → r6179:c0508e7aefec
src/window.h
Show inline comments
 
@@ -34,50 +34,49 @@ typedef void WindowProc(Window *w, Windo
 
    handle an increase of 1 pixel. So there is a step function, which
 
    let the windowsize only be changed by X pixels. You configure this
 
    after making the window, like this:
 
      w->resize.step_height = 10;
 
    Now the window will only change in height in steps of 10.
 
   You can also give a minimum width and height. The default value is
 
    the default height/width of the window itself. You can change this
 
    AFTER window-creation, with:
 
     w->resize.width or w->resize.height.
 
   That was all.. good luck, and enjoy :) -- TrueLight */
 

	
 
typedef enum ResizeFlags {
 
	RESIZE_NONE   = 0,
 
	RESIZE_NONE   = 0,  ///< no resize required
 

	
 
	RESIZE_LEFT   = 1,
 
	RESIZE_RIGHT  = 2,
 
	RESIZE_TOP    = 4,
 
	RESIZE_BOTTOM = 8,
 
	RESIZE_LEFT   = 1,  ///< left resize flag
 
	RESIZE_RIGHT  = 2,  ///< rigth resize flag
 
	RESIZE_TOP    = 4,  ///< top resize flag
 
	RESIZE_BOTTOM = 8,  ///< bottom resize flag
 

	
 
	RESIZE_LR     = RESIZE_LEFT  | RESIZE_RIGHT,
 
	RESIZE_RB     = RESIZE_RIGHT | RESIZE_BOTTOM,
 
	RESIZE_TB     = RESIZE_TOP   | RESIZE_BOTTOM,
 
	RESIZE_LRB    = RESIZE_LEFT  | RESIZE_RIGHT  | RESIZE_BOTTOM,
 
	RESIZE_LRTB   = RESIZE_LEFT  | RESIZE_RIGHT  | RESIZE_TOP | RESIZE_BOTTOM,
 
	RESIZE_RTB    = RESIZE_RIGHT | RESIZE_TOP    | RESIZE_BOTTOM,
 
	RESIZE_LR     = RESIZE_LEFT  | RESIZE_RIGHT,   ///<  combination of left and right resize flags
 
	RESIZE_RB     = RESIZE_RIGHT | RESIZE_BOTTOM,  ///<  combination of right and bottom resize flags
 
	RESIZE_TB     = RESIZE_TOP   | RESIZE_BOTTOM,  ///<  combination of top and bottom resize flags
 
	RESIZE_LRB    = RESIZE_LEFT  | RESIZE_RIGHT  | RESIZE_BOTTOM, ///< combination of left, right and bottom resize flags
 
	RESIZE_LRTB   = RESIZE_LEFT  | RESIZE_RIGHT  | RESIZE_TOP | RESIZE_BOTTOM,  ///<  combination of all resize flags
 
	RESIZE_RTB    = RESIZE_RIGHT | RESIZE_TOP    | RESIZE_BOTTOM, ///<  combination of right, top and bottom resize flag
 

	
 
	/* The following flags are used by the system to specify what is disabled, hidden, or clicked
 
	 * They are used in the same place as the above RESIZE_x flags, Widget visual_flags.
 
	 * These states are used in exceptions. If nothing is specified, they will indicate
 
	 * Enabled, visible or unclicked widgets*/
 
	WIDG_DISABLED = 4,  ///< widget is greyed out, not available
 
	WIDG_HIDDEN   = 5,  ///< widget is made invisible
 
	WIDG_LOWERED  = 6,  ///< widget is paint lowered, a pressed button in fact
 
} ResizeFlag;
 

	
 
/* used to indicate the end of widgets' list for vararg functions */
 
enum {
 
	WIDGET_LIST_END = -1,
 
	WIDGET_LIST_END = -1, ///< indicate the end of widgets' list for vararg functions
 
};
 

	
 
typedef struct Widget {
 
	byte type;                        ///< Widget type, see WindowWidgetTypes
 
	byte display_flags;               ///< Resize direction, alignment, etc. during resizing, see ResizeFlags
 
	byte color;                       ///< Widget colour, see docs/ottd-colourtext-palette.png
 
	int16 left, right, top, bottom;   ///< The position offsets inside the window
 
	uint16 data;                      ///< The String/Image or special code (list-matrixes) of a widget
 
	StringID tooltips;                ///< Tooltips that are shown when rightclicking on a widget
 
} Widget;
 

	
 
typedef enum FrameFlags {
 
@@ -228,25 +227,24 @@ typedef struct Textbuf {
 
/* 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
 

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

	
 
typedef struct ResizeInfo {
 
	uint width; ///< Minimum width and height
 
	uint height;
 

	
 
	uint step_width; ///< In how big steps the width and height go
 
	uint step_height;
 
} ResizeInfo;
 

	
 
typedef struct WindowMessage {
 
		int msg;
 
		int wparam;
 
		int lparam;
 
} WindowMessage;
 

	
 
struct Window {
 
	uint16 flags4;
 
@@ -422,25 +420,25 @@ typedef struct {
 
	uint32 background_img;
 
	int8 rank;
 
} highscore_d;
 
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(highscore_d));
 

	
 
typedef struct {
 
	int height;
 
	uint16 counter;
 
} scroller_d;
 
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(scroller_d));
 

	
 
typedef enum SortListFlags {
 
	VL_NONE    = 0x00,
 
	VL_NONE    = 0x00,  ///< no sort
 
	VL_DESC    = 0x01,  ///< sort descending or ascending
 
	VL_RESORT  = 0x02,  ///< instruct the code to resort the list in the next loop
 
	VL_REBUILD = 0x04,  ///< create sort-listing to use for qsort and friends
 
	VL_END     = 0x08
 
} SortListFlags;
 

	
 
DECLARE_ENUM_AS_BIT_SET(SortListFlags);
 

	
 
typedef struct Listing {
 
	bool order;    ///< Ascending/descending
 
	byte criteria; ///< Sorting criteria
 
} Listing;