Merge branch 'master' into jgrpp

# Conflicts:
#	CMakeLists.txt
#	COMPILING.md
#	src/console.cpp
#	src/console_cmds.cpp
#	src/console_internal.h
#	src/rev.cpp.in
This commit is contained in:
Jonathan G Rennison
2021-04-25 02:14:29 +01:00
85 changed files with 2756 additions and 809 deletions

View File

@@ -92,6 +92,8 @@ enum WidgetType : uint8 {
WPT_DATATIP, ///< Widget part for specifying data and tooltip.
WPT_PADDING, ///< Widget part for specifying a padding.
WPT_PIPSPACE, ///< Widget part for specifying pre/inter/post space for containers.
WPT_TEXTCOLOUR, ///< Widget part for specifying text colour.
WPT_ALIGNMENT, ///< Widget part for specifying text/image alignment.
WPT_ENDCONTAINER, ///< Widget part to denote end of a container.
WPT_FUNCTION, ///< Widget part for calling a user function.
WPT_SCROLLBAR, ///< Widget part for attaching a scrollbar.
@@ -316,6 +318,8 @@ public:
void SetIndex(int index);
void SetDataTip(uint32 widget_data, StringID tool_tip);
void SetToolTip(StringID tool_tip);
void SetTextColour(TextColour colour);
void SetAlignment(StringAlignment align);
inline void SetLowered(bool lowered);
inline bool IsLowered() const;
@@ -336,6 +340,8 @@ public:
StringID tool_tip; ///< Tooltip of the widget. @see Widget::tootips
int scrollbar_index; ///< Index of an attached scrollbar.
TextColour highlight_colour; ///< Colour of highlight.
TextColour text_colour; ///< Colour of text within widget.
StringAlignment align; ///< Alignment of text/image within widget.
};
/**
@@ -774,7 +780,8 @@ public:
}
}
int GetScrolledRowFromWidget(int clickpos, const Window * const w, int widget, int padding = 0, int line_height = -1) const;
int GetScrolledRowFromWidget(int clickpos, const Window * const w, int widget, int padding = 0) const;
EventState UpdateListPositionOnKeyPress(int &list_position, uint16 keycode) const;
};
/**
@@ -930,6 +937,22 @@ struct NWidgetPartTextLines {
FontSize size; ///< Font size of text lines.
};
/**
* Widget part for storing text colour.
* @ingroup NestedWidgetParts
*/
struct NWidgetPartTextColour {
TextColour colour; ///< TextColour for DrawString.
};
/**
* Widget part for setting text/image alignment within a widget.
* @ingroup NestedWidgetParts
*/
struct NWidgetPartAlignment {
StringAlignment align; ///< Alignment of text/image.
};
/**
* Pointer to function returning a nested widget.
* @param biggest_index Pointer to storage for collecting the biggest index used in the nested widget.
@@ -951,6 +974,8 @@ struct NWidgetPart {
NWidgetPartPaddings padding; ///< Part with paddings.
NWidgetPartPIP pip; ///< Part with pre/inter/post spaces.
NWidgetPartTextLines text_lines; ///< Part with text line data.
NWidgetPartTextColour colour; ///< Part with text colour data.
NWidgetPartAlignment align; ///< Part with internal alignment.
NWidgetFunctionType *func_ptr; ///< Part with a function call.
NWidContainerFlags cont_flags; ///< Part with container flags.
} u;
@@ -1009,6 +1034,36 @@ static inline NWidgetPart SetMinimalTextLines(uint8 lines, uint8 spacing, FontSi
return part;
}
/**
* Widget part function for setting the text colour.
* @param colour Colour to draw string within widget.
* @ingroup NestedWidgetParts
*/
static inline NWidgetPart SetTextColour(TextColour colour)
{
NWidgetPart part;
part.type = WPT_TEXTCOLOUR;
part.u.colour.colour = colour;
return part;
}
/**
* Widget part function for setting the alignment of text/images.
* @param align Alignment of text/image within widget.
* @ingroup NestedWidgetParts
*/
static inline NWidgetPart SetAlignment(StringAlignment align)
{
NWidgetPart part;
part.type = WPT_ALIGNMENT;
part.u.align.align = align;
return part;
}
/**
* Widget part function for setting filling.
* @param fill_x Horizontal filling step from minimal size.