Change: Use RectPadding for widget padding/uz_padding.

This commit is contained in:
2022-09-28 19:05:36 +01:00
committed by PeterN
parent 75b222b0d9
commit 04cbe57d2a
5 changed files with 96 additions and 104 deletions

View File

@@ -149,10 +149,10 @@ public:
*/
inline void SetPadding(uint8 top, uint8 right, uint8 bottom, uint8 left)
{
this->uz_padding_top = top;
this->uz_padding_right = right;
this->uz_padding_bottom = bottom;
this->uz_padding_left = left;
this->uz_padding.top = top;
this->uz_padding.right = right;
this->uz_padding.bottom = bottom;
this->uz_padding.left = left;
this->AdjustPaddingForZoom();
}
@@ -192,15 +192,8 @@ public:
NWidgetBase *next; ///< Pointer to next widget in container. Managed by parent container widget.
NWidgetBase *prev; ///< Pointer to previous widget in container. Managed by parent container widget.
uint8 padding_top; ///< Paddings added to the top of the widget. Managed by parent container widget.
uint8 padding_right; ///< Paddings added to the right of the widget. Managed by parent container widget. (parent container may swap this with padding_left for RTL)
uint8 padding_bottom; ///< Paddings added to the bottom of the widget. Managed by parent container widget.
uint8 padding_left; ///< Paddings added to the left of the widget. Managed by parent container widget. (parent container may swap this with padding_right for RTL)
uint8 uz_padding_top; ///< Unscaled top padding, for resize calculation.
uint8 uz_padding_right; ///< Unscaled right padding, for resize calculation.
uint8 uz_padding_bottom; ///< Unscaled bottom padding, for resize calculation.
uint8 uz_padding_left; ///< Unscaled left padding, for resize calculation.
RectPadding padding; ///< Padding added to the widget. Managed by parent container widget. (parent container may swap left and right for RTL)
RectPadding uz_padding; ///< Unscaled padding, for resize calculation.
protected:
inline void StoreSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height);
@@ -920,8 +913,7 @@ struct NWidgetPartWidget {
* Widget part for storing padding.
* @ingroup NestedWidgetParts
*/
struct NWidgetPartPaddings {
uint8 top, right, bottom, left; ///< Paddings for all directions.
struct NWidgetPartPaddings : RectPadding {
};
/**