2022-08-29 00:47:01 -07:00
|
|
|
|
// Copyright (c) 2016-2017 Nicolas Musset. All rights reserved.
|
|
|
|
|
|
// Copyright (c) 2022, John Lewin
|
|
|
|
|
|
// This file is licensed under the MIT license.
|
|
|
|
|
|
// See the LICENSE.md file in the project root for more information.
|
|
|
|
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using Markdig.Renderers.Agg.Inlines;
|
|
|
|
|
|
using MatterHackers.Agg;
|
|
|
|
|
|
using MatterHackers.Agg.UI;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Markdig.Renderers.Agg
|
|
|
|
|
|
{
|
2022-08-29 08:20:32 -07:00
|
|
|
|
public class AggTableRow: FlowLayoutWidget
|
2022-08-29 00:47:01 -07:00
|
|
|
|
{
|
2022-08-29 08:20:32 -07:00
|
|
|
|
public AggTableRow()
|
2022-08-29 00:47:01 -07:00
|
|
|
|
{
|
|
|
|
|
|
this.VAnchor = VAnchor.Fit;
|
|
|
|
|
|
this.Margin = new BorderDouble(3, 4, 0, 12);
|
2022-08-29 08:20:32 -07:00
|
|
|
|
|
|
|
|
|
|
// Hack to force content on-screen (seemingly not working when set late/after constructor)
|
|
|
|
|
|
VAnchor = VAnchor.Absolute;
|
|
|
|
|
|
Height = 25;
|
2022-08-29 00:47:01 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-08-29 08:20:32 -07:00
|
|
|
|
public bool IsHeadingRow { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
// Override AddChild to push styles to child elements when table rows are resolved to the tree
|
2022-08-29 00:47:01 -07:00
|
|
|
|
public override GuiWidget AddChild(GuiWidget childToAdd, int indexInChildrenList = -1)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (childToAdd is TextWidget textWidget)
|
|
|
|
|
|
{
|
|
|
|
|
|
// textWidget.TextColor = new Color("#036ac3");
|
2022-08-29 08:20:32 -07:00
|
|
|
|
if (this.IsHeadingRow)
|
|
|
|
|
|
{
|
|
|
|
|
|
textWidget.Bold = true;
|
|
|
|
|
|
}
|
2022-08-29 00:47:01 -07:00
|
|
|
|
}
|
|
|
|
|
|
else if (childToAdd is TextLinkX textLink)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var childTextWidget in childToAdd.Children.OfType<TextWidget>())
|
|
|
|
|
|
{
|
2022-08-29 08:20:32 -07:00
|
|
|
|
if (this.IsHeadingRow)
|
|
|
|
|
|
{
|
|
|
|
|
|
childTextWidget.Bold = true;
|
|
|
|
|
|
}
|
2022-08-29 00:47:01 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return base.AddChild(childToAdd, indexInChildrenList);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|