mirror of
https://github.com/goatcorp/Dalamud.git
synced 2026-02-25 22:21:49 +01:00
Add IDtrBarEntry.MinimumWidth
This commit is contained in:
parent
9dd08c3f18
commit
05969f02ad
2 changed files with 33 additions and 1 deletions
|
|
@ -397,7 +397,15 @@ internal sealed unsafe class DtrBar : IInternalDisposableService, IDtrBar
|
||||||
|
|
||||||
ushort w = 0, h = 0;
|
ushort w = 0, h = 0;
|
||||||
node->GetTextDrawSize(&w, &h, node->NodeText.StringPtr);
|
node->GetTextDrawSize(&w, &h, node->NodeText.StringPtr);
|
||||||
node->SetWidth(w);
|
|
||||||
|
if (data.MinimumWidth > 0)
|
||||||
|
{
|
||||||
|
node->SetWidth(Math.Max(data.MinimumWidth, w));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
node->SetWidth(w);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var elementWidth = data.TextNode->Width + this.configuration.DtrSpacing;
|
var elementWidth = data.TextNode->Width + this.configuration.DtrSpacing;
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,11 @@ public interface IDtrBarEntry : IReadOnlyDtrBarEntry
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public new bool Shown { get; set; }
|
public new bool Shown { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value specifying the requested minimum width to make this entry.
|
||||||
|
/// </summary>
|
||||||
|
public new ushort MinimumWidth { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets an action to be invoked when the user clicks on the dtr entry.
|
/// Gets or sets an action to be invoked when the user clicks on the dtr entry.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -128,6 +133,25 @@ internal sealed unsafe class DtrBarEntry : IDisposable, IDtrBarEntry
|
||||||
/// <inheritdoc cref="IDtrBarEntry.Tooltip" />
|
/// <inheritdoc cref="IDtrBarEntry.Tooltip" />
|
||||||
public SeString? Tooltip { get; set; }
|
public SeString? Tooltip { get; set; }
|
||||||
|
|
||||||
|
/// <inheritdoc/>
|
||||||
|
public ushort MinimumWidth
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
field = value;
|
||||||
|
if (this.TextNode is not null)
|
||||||
|
{
|
||||||
|
if (this.TextNode->GetWidth() < value)
|
||||||
|
{
|
||||||
|
this.TextNode->SetWidth(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.Dirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public Action<DtrInteractionEvent>? OnClick { get; set; }
|
public Action<DtrInteractionEvent>? OnClick { get; set; }
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue