Add a min sizing for viewports.

This commit is contained in:
Juanjo
2013-08-09 09:32:52 +00:00
committed by pelya
parent 97e285fee5
commit 923bb00c09
4 changed files with 7 additions and 3 deletions

View File

@@ -166,7 +166,7 @@ static const NWidgetPart _nested_thin_news_widgets[] = {
EndContainer(),
EndContainer(),
NWidget(WWT_EMPTY, COLOUR_WHITE, WID_N_MESSAGE), SetMinimalSize(428, 48), SetFill(1, 0), SetPadding(0, 5, 0, 5),
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_N_VIEWPORT), SetMinimalSize(426, 70), SetPadding(1, 2, 2, 2),
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_N_VIEWPORT), SetSizingType(NWST_VIEWPORT), SetMinimalSize(426, 70), SetPadding(1, 2, 2, 2),
EndContainer(),
};
@@ -188,7 +188,7 @@ static const NWidgetPart _nested_small_news_widgets[] = {
/* Main part */
NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, WID_N_HEADLINE),
NWidget(WWT_INSET, COLOUR_LIGHT_BLUE, WID_N_INSET), SetPadding(2, 2, 2, 2),
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_N_VIEWPORT), SetPadding(1, 1, 1, 1), SetMinimalSize(274, 47), SetFill(1, 0),
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_N_VIEWPORT), SetSizingType(NWST_VIEWPORT), SetPadding(1, 1, 1, 1), SetMinimalSize(274, 47), SetFill(1, 0),
EndContainer(),
NWidget(WWT_EMPTY, COLOUR_WHITE, WID_N_MESSAGE), SetMinimalSize(275, 20), SetFill(1, 0), SetPadding(0, 5, 0, 5),
EndContainer(),

View File

@@ -32,7 +32,7 @@ static const NWidgetPart _nested_extra_view_port_widgets[] = {
NWidget(WWT_STICKYBOX, COLOUR_GREY),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_GREY),
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_EV_VIEWPORT), SetPadding(2, 2, 2, 2), SetResize(1, 1), SetFill(1, 1),
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_EV_VIEWPORT), SetSizingType(NWST_VIEWPORT), SetPadding(2, 2, 2, 2), SetResize(1, 1), SetFill(1, 1),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_EV_ZOOM_IN), SetDataTip(SPR_IMG_ZOOMIN, STR_TOOLBAR_TOOLTIP_ZOOM_THE_VIEW_IN),

View File

@@ -770,6 +770,9 @@ void NWidgetResizeBase::SetMinimalSize(uint min_x, uint min_y)
case NWST_STEP:
min_size = _settings_client.gui.min_step;
break;
case NWST_VIEWPORT:
min_size = 3 * _settings_client.gui.min_button;
break;
default: NOT_REACHED();
}

View File

@@ -49,6 +49,7 @@ enum NWidSizingType {
NWST_STEP, ///< Size will be set at least _settings_client.gui.min_step (scrollbars and dropdowns).
NWST_KEYBOARD, ///< Size for keyboard keys.
NWST_WINDOW_LENGTH, ///< Width for command errors, message windows and statusbar middle part.
NWST_VIEWPORT, ///< Sizing type for viewports.
NWST_OVERRIDE, ///< Avoid widgets to use automatic minimal sizing.
NWST_END
};