Merge branch 'master' into jgrpp
# Conflicts: # src/build_vehicle_gui.cpp # src/cheat_gui.cpp # src/company_gui.cpp # src/error_gui.cpp # src/fios_gui.cpp # src/gfx_func.h # src/graph_gui.cpp # src/group_gui.cpp # src/misc_gui.cpp # src/newgrf_debug_gui.cpp # src/order_gui.cpp # src/road_gui.cpp # src/roadveh_gui.cpp # src/settings_gui.cpp # src/ship_gui.cpp # src/station_gui.cpp # src/statusbar_gui.cpp # src/subsidy_gui.cpp # src/timetable_gui.cpp # src/town_gui.cpp # src/train_gui.cpp # src/tree_gui.cpp # src/vehicle_gui.cpp # src/widget.cpp # src/widgets/dropdown.cpp # src/window_gui.h
This commit is contained in:
@@ -160,10 +160,20 @@ 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();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set additional space (padding) around the widget.
|
||||
* @param padding Amount of padding around the widget.
|
||||
*/
|
||||
inline void SetPadding(const RectPadding &padding)
|
||||
{
|
||||
this->uz_padding = padding;
|
||||
this->AdjustPaddingForZoom();
|
||||
}
|
||||
|
||||
@@ -205,15 +215,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.
|
||||
|
||||
inline bool IsOutsideDrawArea() const
|
||||
{
|
||||
@@ -946,8 +949,7 @@ struct NWidgetPartWidget {
|
||||
* Widget part for storing padding.
|
||||
* @ingroup NestedWidgetParts
|
||||
*/
|
||||
struct NWidgetPartPaddings {
|
||||
uint8 top, right, bottom, left; ///< Paddings for all directions.
|
||||
struct NWidgetPartPaddings : RectPadding {
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1177,6 +1179,24 @@ static inline NWidgetPart SetPadding(uint8 top, uint8 right, uint8 bottom, uint8
|
||||
return part;
|
||||
}
|
||||
|
||||
/**
|
||||
* Widget part function for setting additional space around a widget.
|
||||
* @param r The padding around the widget.
|
||||
* @ingroup NestedWidgetParts
|
||||
*/
|
||||
static inline NWidgetPart SetPadding(const RectPadding &padding)
|
||||
{
|
||||
NWidgetPart part;
|
||||
|
||||
part.type = WPT_PADDING;
|
||||
part.u.padding.left = padding.left;
|
||||
part.u.padding.top = padding.top;
|
||||
part.u.padding.right = padding.right;
|
||||
part.u.padding.bottom = padding.bottom;
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
/**
|
||||
* Widget part function for setting a padding.
|
||||
* @param padding The padding to use for all directions.
|
||||
|
Reference in New Issue
Block a user