mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-07-15 00:25:06 +01:00
(svn r20466) -Codechange: USe NWID_SELECTION to hide the scrollbar in dropdowns.
This commit is contained in:
parent
419c269e56
commit
28048826f8
@ -70,14 +70,17 @@ static void DeleteDropDownList(DropDownList *list)
|
|||||||
/** Widget numbers of the dropdown menu. */
|
/** Widget numbers of the dropdown menu. */
|
||||||
enum DropdownMenuWidgets {
|
enum DropdownMenuWidgets {
|
||||||
DDM_ITEMS, ///< Panel showing the dropdown items.
|
DDM_ITEMS, ///< Panel showing the dropdown items.
|
||||||
|
DDM_SHOW_SCROLL, ///< Hide scrollbar if too few items.
|
||||||
DDM_SCROLL, ///< Scrollbar.
|
DDM_SCROLL, ///< Scrollbar.
|
||||||
};
|
};
|
||||||
|
|
||||||
static const NWidgetPart _nested_dropdown_menu_widgets[] = {
|
static const NWidgetPart _nested_dropdown_menu_widgets[] = {
|
||||||
NWidget(NWID_HORIZONTAL),
|
NWidget(NWID_HORIZONTAL),
|
||||||
NWidget(WWT_PANEL, COLOUR_END, DDM_ITEMS), SetMinimalSize(1, 1), SetScrollbar(DDM_SCROLL), EndContainer(),
|
NWidget(WWT_PANEL, COLOUR_END, DDM_ITEMS), SetMinimalSize(1, 1), SetScrollbar(DDM_SCROLL), EndContainer(),
|
||||||
|
NWidget(NWID_SELECTION, INVALID_COLOUR, DDM_SHOW_SCROLL),
|
||||||
NWidget(NWID_VSCROLLBAR, COLOUR_END, DDM_SCROLL),
|
NWidget(NWID_VSCROLLBAR, COLOUR_END, DDM_SCROLL),
|
||||||
EndContainer(),
|
EndContainer(),
|
||||||
|
EndContainer(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const WindowDesc _dropdown_desc(
|
const WindowDesc _dropdown_desc(
|
||||||
@ -128,11 +131,9 @@ struct DropdownWindow : Window {
|
|||||||
nwi->colour = wi_colour;
|
nwi->colour = wi_colour;
|
||||||
|
|
||||||
nwi = this->GetWidget<NWidgetCore>(DDM_SCROLL);
|
nwi = this->GetWidget<NWidgetCore>(DDM_SCROLL);
|
||||||
if (scroll) {
|
|
||||||
nwi->colour = wi_colour;
|
nwi->colour = wi_colour;
|
||||||
} else {
|
|
||||||
nwi->min_x = 0; // Make scrollbar invisible.
|
this->GetWidget<NWidgetStacked>(DDM_SHOW_SCROLL)->SetDisplayedPlane(scroll ? 0 : SZSP_NONE);
|
||||||
}
|
|
||||||
|
|
||||||
this->FinishInitNested(&_dropdown_desc, 0);
|
this->FinishInitNested(&_dropdown_desc, 0);
|
||||||
this->flags4 &= ~WF_WHITE_BORDER_MASK;
|
this->flags4 &= ~WF_WHITE_BORDER_MASK;
|
||||||
|
Loading…
Reference in New Issue
Block a user