|
@@ -122,12 +122,13 @@ enum WidgetType {
|
|
|
NWID_VIEWPORT, ///< Nested widget containing a viewport.
|
|
|
NWID_BUTTON_DRPDOWN, ///< Button with a drop-down.
|
|
|
|
|
|
/* Nested widget part types. */
|
|
|
WPT_RESIZE, ///< Widget part for specifying resizing.
|
|
|
WPT_MINSIZE, ///< Widget part for specifying minimal size.
|
|
|
WPT_MINTEXTLINES, ///< Widget part for specifying minimal number of lines of text.
|
|
|
WPT_FILL, ///< Widget part for specifying fill.
|
|
|
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_ENDCONTAINER, ///< Widget part to denote end of a container.
|
|
|
WPT_FUNCTION, ///< Widget part for calling a user function.
|
|
@@ -245,12 +246,13 @@ inline uint NWidgetBase::GetVerticalStep
|
|
|
* @ingroup NestedWidgets */
|
|
|
class NWidgetResizeBase : public NWidgetBase {
|
|
|
public:
|
|
|
NWidgetResizeBase(WidgetType tp, bool fill_x, bool fill_y);
|
|
|
|
|
|
void SetMinimalSize(uint min_x, uint min_y);
|
|
|
void SetMinimalTextLines(uint8 min_lines, uint8 spacing, FontSize size);
|
|
|
void SetFill(bool fill_x, bool fill_y);
|
|
|
void SetResize(uint resize_x, uint resize_y);
|
|
|
|
|
|
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool allow_resize_x, bool allow_resize_y, bool rtl);
|
|
|
|
|
|
uint min_x; ///< Minimal horizontal size of only this widget.
|
|
@@ -587,12 +589,20 @@ struct NWidgetPartPaddings {
|
|
|
/** Widget part for storing pre/inter/post spaces.
|
|
|
* @ingroup NestedWidgetParts */
|
|
|
struct NWidgetPartPIP {
|
|
|
uint8 pre, inter, post; ///< Amount of space before/between/after child widgets.
|
|
|
};
|
|
|
|
|
|
/** Widget part for storing minimal text line data.
|
|
|
* @ingroup NestedWidgetParts */
|
|
|
struct NWidgetPartTextLines {
|
|
|
uint8 lines; ///< Number of text lines.
|
|
|
uint8 spacing; ///< Extra spacing around lines.
|
|
|
FontSize size; ///< Font size of text lines.
|
|
|
};
|
|
|
|
|
|
/** Pointer to function returning a nested widget.
|
|
|
* @param biggest_index Pointer to storage for collecting the biggest index used in the nested widget.
|
|
|
* @return Nested widget (tree).
|
|
|
* @postcond \c *biggest_index must contain the value of the biggest index in the returned tree.
|
|
|
*/
|
|
|
typedef NWidgetBase *NWidgetFunctionType(int *biggest_index);
|
|
@@ -604,12 +614,13 @@ struct NWidgetPart {
|
|
|
union {
|
|
|
Point xy; ///< Part with an x/y size.
|
|
|
NWidgetPartDataTip data_tip; ///< Part with a data/tooltip.
|
|
|
NWidgetPartWidget widget; ///< Part with a start of a widget.
|
|
|
NWidgetPartPaddings padding; ///< Part with paddings.
|
|
|
NWidgetPartPIP pip; ///< Part with pre/inter/post spaces.
|
|
|
NWidgetPartTextLines text_lines; ///< Part with text line data.
|
|
|
NWidgetFunctionType *func_ptr; ///< Part with a function call.
|
|
|
NWidContainerFlags cont_flags; ///< Part with container flags.
|
|
|
} u;
|
|
|
};
|
|
|
|
|
|
/**
|
|
@@ -644,12 +655,31 @@ static inline NWidgetPart SetMinimalSize
|
|
|
part.u.xy.y = y;
|
|
|
|
|
|
return part;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Widget part function for setting the minimal text lines.
|
|
|
* @param lines Number of text lines.
|
|
|
* @param spacing Extra spacing required.
|
|
|
* @param size Font size of text.
|
|
|
* @ingroup NestedWidgetParts
|
|
|
*/
|
|
|
static inline NWidgetPart SetMinimalTextLines(uint8 lines, uint8 spacing, FontSize size = FS_NORMAL)
|
|
|
{
|
|
|
NWidgetPart part;
|
|
|
|
|
|
part.type = WPT_MINTEXTLINES;
|
|
|
part.u.text_lines.lines = lines;
|
|
|
part.u.text_lines.spacing = spacing;
|
|
|
part.u.text_lines.size = size;
|
|
|
|
|
|
return part;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Widget part function for setting filling.
|
|
|
* @param x_fill Allow horizontal filling from minimal size.
|
|
|
* @param y_fill Allow vertical filling from minimal size.
|
|
|
* @ingroup NestedWidgetParts
|
|
|
*/
|
|
|
static inline NWidgetPart SetFill(bool x_fill, bool y_fill)
|