From 71a9ddc5f4c0ba3955ace71d4ede6dd6f915ce72 Mon Sep 17 00:00:00 2001
From: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Date: Thu, 26 May 2022 12:41:03 +1200
Subject: [PATCH] Verb icon tiling (#8457)
---
Content.Client/ContextMenu/UI/ContextMenuPopup.xaml.cs | 3 ++-
Content.Client/Verbs/UI/VerbMenuPresenter.cs | 3 +--
Content.Shared/Verbs/VerbCategory.cs | 8 +++++++-
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/Content.Client/ContextMenu/UI/ContextMenuPopup.xaml.cs b/Content.Client/ContextMenu/UI/ContextMenuPopup.xaml.cs
index 063535819d..dffb2505f4 100644
--- a/Content.Client/ContextMenu/UI/ContextMenuPopup.xaml.cs
+++ b/Content.Client/ContextMenu/UI/ContextMenuPopup.xaml.cs
@@ -29,7 +29,7 @@ namespace Content.Client.ContextMenu.UI
///
/// This is the main body of the menu. The menu entries should be added to this object.
///
- public BoxContainer MenuBody = new() { Orientation = LayoutOrientation.Vertical };
+ public GridContainer MenuBody = new();
private ContextMenuPresenter _presenter;
@@ -41,6 +41,7 @@ namespace Content.Client.ContextMenu.UI
_presenter = presenter;
ParentElement = parentElement;
+ // TODO xaml controls now have the access options -> re-xamlify all this.
//XAML controls are private. So defining and adding MenuBody here instead.
Scroll.AddChild(MenuBody);
diff --git a/Content.Client/Verbs/UI/VerbMenuPresenter.cs b/Content.Client/Verbs/UI/VerbMenuPresenter.cs
index 65b2132f3e..15f83a208c 100644
--- a/Content.Client/Verbs/UI/VerbMenuPresenter.cs
+++ b/Content.Client/Verbs/UI/VerbMenuPresenter.cs
@@ -129,8 +129,7 @@ namespace Content.Client.Verbs.UI
AddElement(element.SubMenu, subElement);
}
- if (category.IconsOnly)
- element.SubMenu.MenuBody.Orientation = LayoutOrientation.Horizontal;
+ element.SubMenu.MenuBody.Columns = category.Columns;
}
///
diff --git a/Content.Shared/Verbs/VerbCategory.cs b/Content.Shared/Verbs/VerbCategory.cs
index eaa6b7521f..26905d8815 100644
--- a/Content.Shared/Verbs/VerbCategory.cs
+++ b/Content.Shared/Verbs/VerbCategory.cs
@@ -13,6 +13,12 @@ namespace Content.Shared.Verbs
public readonly SpriteSpecifier? Icon;
+ ///
+ /// Columns for the grid layout that shows the verbs in this category. If is false,
+ /// this should very likely be set to 1.
+ ///
+ public int Columns = 1;
+
///
/// If true, the members of this verb category will be shown in the context menu as a row of icons without
/// any text.
@@ -51,7 +57,7 @@ namespace Content.Shared.Verbs
new("verb-categories-unbuckle", "/Textures/Interface/VerbIcons/unbuckle.svg.192dpi.png");
public static readonly VerbCategory Rotate =
- new("verb-categories-rotate", "/Textures/Interface/VerbIcons/refresh.svg.192dpi.png", iconsOnly: true);
+ new("verb-categories-rotate", "/Textures/Interface/VerbIcons/refresh.svg.192dpi.png", iconsOnly: true) { Columns = 5};
public static readonly VerbCategory SetTransferAmount =
new("verb-categories-transfer", "/Textures/Interface/VerbIcons/spill.svg.192dpi.png");