Contents menu: use tight grid layout (#1842)

This makes extra-slot containers not block an extra row anymore. However, they might jump around a bit. It might be a good idea to set their priority lower to make them always appear first.
When they would be in front, the tight grid layout would likely not move them around.
directional-lights
David Dormagen 2016-11-05 15:34:43 +01:00
parent 8a8593e0ba
commit 12e808263b
2 changed files with 12 additions and 2 deletions

View File

@ -13,6 +13,15 @@ func Construction()
this.Style = GUI_GridLayout;
}
public func SetTightGridLayout(bool tight)
{
tight = tight ?? true;
if (tight)
this.Style = GUI_TightGridLayout;
else
this.Style = GUI_GridLayout;
}
func MakeEntryProplist(symbol, text)
{
var custom_entry = {Bottom = "+2em", Right = "+2em", desc = {Style = GUI_TextRight | GUI_TextBottom}};

View File

@ -716,6 +716,8 @@ func CreateMainMenu(object obj, int slot)
continue;
}
menu.menu_object = CreateObject(MenuStyle_Grid);
if (menu.flag == InteractionMenu_Contents)
menu.menu_object->SetTightGridLayout();
menu.menu_object.Top = "+1em";
menu.menu_object.Priority = 2;
@ -1045,8 +1047,7 @@ func FxIntRefreshContentsMenuTimer(target, effect, time)
// Use a default grid-menu entry as the base.
custom = MenuStyle_Grid->MakeEntryProplist(symbol, nil);
// Pack it into a larger frame to allow for another button below.
// The entries with contents are sorted to the back of the inventory menu. This makes for a nicer layout.
custom = {Right = custom.Right, Bottom = "4em", top = custom, Priority = 10000 + obj->GetValue()};
custom = {Right = custom.Right, Bottom = "4em", top = custom, Priority = obj->GetValue()};
// Then add a little container-symbol (that can be clicked).
custom.bottom =
{