add category headers in editor

This commit is contained in:
Chris Forbes
2012-06-26 19:58:04 +12:00
parent 9966b4efd1
commit f10eb9e082
2 changed files with 73 additions and 0 deletions

View File

@@ -148,6 +148,23 @@ namespace OpenRA.Editor
foreach (var tc in tileset.Templates.GroupBy(t => t.Value.Category))
{
var category = tc.Key ?? "(Uncategorized)";
var categoryHeader = new Label
{
BackColor = SystemColors.Highlight,
ForeColor = SystemColors.HighlightText,
Text = category,
AutoSize = false,
Height = 24,
TextAlign = ContentAlignment.MiddleLeft,
Width = tilePalette.ClientSize.Width,
};
// hook this manually, anchoring inside FlowLayoutPanel is flaky.
tilePalette.Resize += (_,e) => categoryHeader.Width = tilePalette.ClientSize.Width;
if (tilePalette.Controls.Count > 0)
tilePalette.SetFlowBreak(
tilePalette.Controls[tilePalette.Controls.Count - 1], true);
tilePalette.Controls.Add(categoryHeader);
foreach( var t in tc )
{