mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Change: Hide bevel for resizeable sparse layout windows. (#11572)
When clicked, the button is still highlighted to show that it is active. The bevel is controlled with widget_data by RWV_SHOW_BEVEL or RWV_HIDE_BEVEL values.
This commit is contained in:
parent
a3d56e2c6e
commit
6e8c27b8e5
@ -67,7 +67,7 @@ static const NWidgetPart _nested_gs_config_widgets[] = {
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_MAUVE),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_MAUVE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
};
|
||||
|
@ -647,7 +647,7 @@ static const NWidgetPart _nested_operating_profit_widgets[] = {
|
||||
NWidget(WWT_EMPTY, COLOUR_BROWN, WID_CV_GRAPH), SetMinimalSize(576, 160), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
@ -698,7 +698,7 @@ static const NWidgetPart _nested_income_graph_widgets[] = {
|
||||
NWidget(WWT_EMPTY, COLOUR_BROWN, WID_CV_GRAPH), SetMinimalSize(576, 128), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
@ -747,7 +747,7 @@ static const NWidgetPart _nested_delivered_cargo_graph_widgets[] = {
|
||||
NWidget(WWT_EMPTY, COLOUR_BROWN, WID_CV_GRAPH), SetMinimalSize(576, 128), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
@ -803,7 +803,7 @@ static const NWidgetPart _nested_performance_history_widgets[] = {
|
||||
NWidget(WWT_EMPTY, COLOUR_BROWN, WID_PHG_GRAPH), SetMinimalSize(576, 224), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_PHG_RESIZE),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_PHG_RESIZE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
@ -852,7 +852,7 @@ static const NWidgetPart _nested_company_value_graph_widgets[] = {
|
||||
NWidget(WWT_EMPTY, COLOUR_BROWN, WID_CV_GRAPH), SetMinimalSize(576, 224), SetFill(1, 1), SetResize(1, 1),
|
||||
NWidget(NWID_VERTICAL),
|
||||
NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CV_RESIZE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
@ -1089,7 +1089,7 @@ static const NWidgetPart _nested_cargo_payment_rates_widgets[] = {
|
||||
NWidget(NWID_SPACER), SetMinimalSize(12, 0), SetFill(1, 0), SetResize(1, 0),
|
||||
NWidget(WWT_TEXT, COLOUR_BROWN, WID_CPR_FOOTER), SetMinimalSize(0, 6), SetPadding(2, 0, 2, 0), SetDataTip(STR_GRAPH_CARGO_PAYMENT_RATES_X_LABEL, STR_NULL),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CPR_RESIZE),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_BROWN, WID_CPR_RESIZE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
};
|
||||
|
@ -1105,7 +1105,7 @@ static const NWidgetPart _nested_network_content_list_widgets[] = {
|
||||
/* Resize button. */
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_LIGHT_BLUE),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_LIGHT_BLUE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
};
|
||||
|
@ -936,7 +936,7 @@ static const NWidgetPart _nested_network_game_widgets[] = {
|
||||
/* Resize button. */
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_LIGHT_BLUE),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_LIGHT_BLUE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
};
|
||||
|
@ -1152,7 +1152,7 @@ static const NWidgetPart _nested_sprite_aligner_widgets[] = {
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_GREY), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
};
|
||||
|
@ -1963,7 +1963,7 @@ static const NWidgetPart _nested_newgrf_widgets[] = {
|
||||
/* Resize button. */
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_MAUVE),
|
||||
NWidget(WWT_RESIZEBOX, COLOUR_MAUVE), SetDataTip(RWV_HIDE_BEVEL, STR_TOOLTIP_RESIZE),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
};
|
||||
|
@ -154,7 +154,7 @@ const WidgetDimensions WidgetDimensions::unscaled = {
|
||||
{20, 10, 20, 10}, ///< modalpopup
|
||||
{3, 3, 3, 3}, ///< picker
|
||||
{10, 8, 10, 8}, ///< sparse window padding
|
||||
{10, 8, 10, 1}, ///< resizable sparse window padding
|
||||
{10, 8, 10, 0}, ///< resizable sparse window padding
|
||||
1, ///< vsep_picker
|
||||
WD_PAR_VSEP_NORMAL, ///< vsep_normal
|
||||
4, ///< vsep_sparse
|
||||
@ -777,10 +777,15 @@ static inline void DrawDebugBox(const Rect &r, Colours colour, bool clicked)
|
||||
* @param colour Colour of the resize box.
|
||||
* @param at_left Resize box is at left-side of the window,
|
||||
* @param clicked Box is lowered.
|
||||
* @param bevel Draw bevel iff set.
|
||||
*/
|
||||
static inline void DrawResizeBox(const Rect &r, Colours colour, bool at_left, bool clicked)
|
||||
static inline void DrawResizeBox(const Rect &r, Colours colour, bool at_left, bool clicked, bool bevel)
|
||||
{
|
||||
DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, (clicked) ? FR_LOWERED : FR_NONE);
|
||||
if (bevel) {
|
||||
DrawFrameRect(r.left, r.top, r.right, r.bottom, colour, (clicked) ? FR_LOWERED : FR_NONE);
|
||||
} else if (clicked) {
|
||||
GfxFillRect(r.Shrink(WidgetDimensions::scaled.bevel), _colour_gradient[colour][6]);
|
||||
}
|
||||
DrawSpriteIgnorePadding(at_left ? SPR_WINDOW_RESIZE_LEFT : SPR_WINDOW_RESIZE_RIGHT, PAL_NONE, r.Shrink(ScaleGUITrad(2)), at_left ? (SA_LEFT | SA_BOTTOM | SA_FORCE) : (SA_RIGHT | SA_BOTTOM | SA_FORCE));
|
||||
}
|
||||
|
||||
@ -2774,7 +2779,7 @@ NWidgetLeaf::NWidgetLeaf(WidgetType tp, Colours colour, int index, uint32_t data
|
||||
case WWT_RESIZEBOX:
|
||||
this->SetFill(0, 0);
|
||||
this->SetMinimalSize(WD_RESIZEBOX_WIDTH, 12);
|
||||
this->SetDataTip(STR_NULL, STR_TOOLTIP_RESIZE);
|
||||
this->SetDataTip(RWV_SHOW_BEVEL, STR_TOOLTIP_RESIZE);
|
||||
break;
|
||||
|
||||
case WWT_CLOSEBOX:
|
||||
@ -3072,8 +3077,7 @@ void NWidgetLeaf::Draw(const Window *w)
|
||||
break;
|
||||
|
||||
case WWT_RESIZEBOX:
|
||||
assert(this->widget_data == 0);
|
||||
DrawResizeBox(r, this->colour, this->pos_x < (w->width / 2), !!(w->flags & WF_SIZING));
|
||||
DrawResizeBox(r, this->colour, this->pos_x < (w->width / 2), !!(w->flags & WF_SIZING), this->widget_data == 0);
|
||||
break;
|
||||
|
||||
case WWT_CLOSEBOX:
|
||||
|
@ -36,6 +36,12 @@ enum ArrowWidgetValues {
|
||||
AWV_RIGHT, ///< Force the arrow to the right
|
||||
};
|
||||
|
||||
/** WidgetData values for a resize box widget. */
|
||||
enum ResizeWidgetValues {
|
||||
RWV_SHOW_BEVEL, ///< Bevel of resize box is shown.
|
||||
RWV_HIDE_BEVEL, ///< Bevel of resize box is hidden.
|
||||
};
|
||||
|
||||
/**
|
||||
* Window widget types, nested widget types, and nested widget part types.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user