Merge branch 'master' into jgrpp
# Conflicts: # src/articulated_vehicles.cpp # src/articulated_vehicles.h # src/base_media_base.h # src/base_media_func.h # src/build_vehicle_gui.cpp # src/dock_gui.cpp # src/main_gui.cpp # src/music_gui.cpp # src/network/network_chat_gui.cpp # src/network/network_content.cpp # src/newgrf.cpp # src/newgrf_roadstop.cpp # src/os/windows/string_uniscribe.h # src/os/windows/win32.cpp # src/rail_gui.cpp # src/road.cpp # src/road_gui.cpp # src/settings.cpp # src/settings_gui.cpp # src/smallmap_gui.cpp # src/strings.cpp # src/terraform_gui.cpp # src/tests/test_script_admin.cpp # src/tests/test_window_desc.cpp # src/timer/timer_game_calendar.h # src/vehicle.cpp # src/vehicle_base.h # src/viewport.cpp # src/widget_type.h # src/window.cpp # src/window_gui.h
This commit is contained in:
@@ -90,6 +90,7 @@ 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_PIPRATIO, ///< Widget part for specifying pre/inter/post ratio for containers.
|
||||
WPT_TEXTSTYLE, ///< 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.
|
||||
@@ -138,7 +139,7 @@ public:
|
||||
|
||||
virtual void AdjustPaddingForZoom();
|
||||
virtual void SetupSmallestSize(Window *w, bool init_array) = 0;
|
||||
virtual void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) = 0;
|
||||
virtual void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) = 0;
|
||||
|
||||
virtual void FillNestedArray(NWidgetBase **array, uint length) = 0;
|
||||
|
||||
@@ -224,7 +225,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
inline void StoreSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height);
|
||||
inline void StoreSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -253,7 +254,7 @@ inline uint NWidgetBase::GetVerticalStepSize(SizingType sizing) const
|
||||
* @param given_width Width allocated to the widget.
|
||||
* @param given_height Height allocated to the widget.
|
||||
*/
|
||||
inline void NWidgetBase::StoreSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height)
|
||||
inline void NWidgetBase::StoreSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height)
|
||||
{
|
||||
this->pos_x = x;
|
||||
this->pos_y = y;
|
||||
@@ -283,7 +284,7 @@ public:
|
||||
|
||||
bool UpdateVerticalSize(uint min_y);
|
||||
|
||||
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
|
||||
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override;
|
||||
|
||||
uint min_x; ///< Minimal horizontal size of only this widget.
|
||||
uint min_y; ///< Minimal vertical size of only this widget.
|
||||
@@ -472,7 +473,7 @@ public:
|
||||
|
||||
void AdjustPaddingForZoom() override;
|
||||
void SetupSmallestSize(Window *w, bool init_array) override;
|
||||
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
|
||||
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override;
|
||||
void FillNestedArray(NWidgetBase **array, uint length) override;
|
||||
|
||||
void Draw(const Window *w) override;
|
||||
@@ -503,17 +504,23 @@ public:
|
||||
NWidgetPIPContainer(WidgetType tp, NWidContainerFlags flags = NC_NONE);
|
||||
|
||||
void AdjustPaddingForZoom() override;
|
||||
void SetPIP(uint8 pip_pre, uint8 pip_inter, uint8 pip_post);
|
||||
void SetPIP(uint8_t pip_pre, uint8_t pip_inter, uint8_t pip_post);
|
||||
void SetPIPRatio(uint8_t pip_ratio_pre, uint8_t pip_ratio_inter, uint8_t pip_rato_post);
|
||||
|
||||
protected:
|
||||
NWidContainerFlags flags; ///< Flags of the container.
|
||||
uint8 pip_pre; ///< Amount of space before first widget.
|
||||
uint8 pip_inter; ///< Amount of space between widgets.
|
||||
uint8 pip_post; ///< Amount of space after last widget.
|
||||
uint8_t pip_pre; ///< Amount of space before first widget.
|
||||
uint8_t pip_inter; ///< Amount of space between widgets.
|
||||
uint8_t pip_post; ///< Amount of space after last widget.
|
||||
uint8_t pip_ratio_pre; ///< Ratio of remaining space before first widget.
|
||||
uint8_t pip_ratio_inter; ///< Ratio of remaining space between widgets.
|
||||
uint8_t pip_ratio_post; ///< Ratio of remaining space after last widget.
|
||||
|
||||
uint8 uz_pip_pre; ///< Unscaled space before first widget.
|
||||
uint8 uz_pip_inter; ///< Unscaled space between widgets.
|
||||
uint8 uz_pip_post; ///< Unscaled space after last widget.
|
||||
uint8_t uz_pip_pre; ///< Unscaled space before first widget.
|
||||
uint8_t uz_pip_inter; ///< Unscaled space between widgets.
|
||||
uint8_t uz_pip_post; ///< Unscaled space after last widget.
|
||||
|
||||
uint8_t gaps; ///< Number of gaps between widgets.
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -525,7 +532,7 @@ public:
|
||||
NWidgetHorizontal(NWidContainerFlags flags = NC_NONE);
|
||||
|
||||
void SetupSmallestSize(Window *w, bool init_array) override;
|
||||
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
|
||||
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -536,7 +543,7 @@ class NWidgetHorizontalLTR : public NWidgetHorizontal {
|
||||
public:
|
||||
NWidgetHorizontalLTR(NWidContainerFlags flags = NC_NONE);
|
||||
|
||||
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
|
||||
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -548,7 +555,7 @@ public:
|
||||
NWidgetVertical(NWidContainerFlags flags = NC_NONE);
|
||||
|
||||
void SetupSmallestSize(Window *w, bool init_array) override;
|
||||
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
|
||||
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -570,7 +577,7 @@ public:
|
||||
void SetScrollbar(Scrollbar *sb);
|
||||
|
||||
void SetupSmallestSize(Window *w, bool init_array) override;
|
||||
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
|
||||
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override;
|
||||
void FillNestedArray(NWidgetBase **array, uint length) override;
|
||||
|
||||
NWidgetCore *GetWidgetFromPos(int x, int y) override;
|
||||
@@ -619,11 +626,12 @@ public:
|
||||
~NWidgetBackground();
|
||||
|
||||
void Add(NWidgetBase *nwid);
|
||||
void SetPIP(uint8 pip_pre, uint8 pip_inter, uint8 pip_post);
|
||||
void SetPIP(uint8_t pip_pre, uint8_t pip_inter, uint8_t pip_post);
|
||||
void SetPIPRatio(uint8_t pip_ratio_pre, uint8_t pip_ratio_inter, uint8_t pip_ratio_post);
|
||||
|
||||
void AdjustPaddingForZoom() override;
|
||||
void SetupSmallestSize(Window *w, bool init_array) override;
|
||||
void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) override;
|
||||
void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override;
|
||||
|
||||
void FillNestedArray(NWidgetBase **array, uint length) override;
|
||||
|
||||
@@ -1273,6 +1281,25 @@ static inline NWidgetPart SetPIP(uint8 pre, uint8 inter, uint8 post)
|
||||
return part;
|
||||
}
|
||||
|
||||
/**
|
||||
* Widget part function for setting a pre/inter/post ratio.
|
||||
* @param pre The ratio of space before the first widget.
|
||||
* @param inter The ratio of space between widgets.
|
||||
* @param post The ratio of space after the last widget.
|
||||
* @ingroup NestedWidgetParts
|
||||
*/
|
||||
static inline NWidgetPart SetPIPRatio(uint8_t ratio_pre, uint8_t ratio_inter, uint8_t ratio_post)
|
||||
{
|
||||
NWidgetPart part;
|
||||
|
||||
part.type = WPT_PIPRATIO;
|
||||
part.u.pip.pre = ratio_pre;
|
||||
part.u.pip.inter = ratio_inter;
|
||||
part.u.pip.post = ratio_post;
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach a scrollbar to a widget.
|
||||
* The scrollbar is controlled when using the mousewheel on the widget.
|
||||
@@ -1341,6 +1368,7 @@ static inline NWidgetPart NWidgetFunction(NWidgetFunctionType *func_ptr)
|
||||
return part;
|
||||
}
|
||||
|
||||
bool IsContainerWidgetType(WidgetType tp);
|
||||
NWidgetContainer *MakeNWidgets(const NWidgetPart *nwid_begin, const NWidgetPart *nwid_end, int *biggest_index, NWidgetContainer *container);
|
||||
NWidgetContainer *MakeWindowNWidgetTree(const NWidgetPart *nwid_begin, const NWidgetPart *nwid_end, int *biggest_index, NWidgetStacked **shade_select);
|
||||
|
||||
|
Reference in New Issue
Block a user