Skip to content

Commit

Permalink
Crossing Challenge: add tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
Regynate committed Feb 11, 2025
1 parent e767262 commit dff3d01
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
22 changes: 15 additions & 7 deletions ConfigApp/Tabs/ChaosGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void SetRowHeight(GridLength gridLength)
m_RowDefinitions[m_CurrentRow].Height = gridLength;
}

private void PushRow(string? text, UIElement? control)
private void PushRow(string? text, FrameworkElement? control, string? tooltip = null)
{
if (text != null)
{
Expand All @@ -70,6 +70,10 @@ private void PushRow(string? text, UIElement? control)

textBlock.SetValue(Grid.ColumnProperty, m_CurrentColumn);
textBlock.SetValue(Grid.RowProperty, m_CurrentRow);
if (tooltip != null)
{
textBlock.ToolTip = new ToolTip { Content = tooltip };
}
Grid.Children.Add(textBlock);

m_CurrentColumn++;
Expand All @@ -89,6 +93,10 @@ private void PushRow(string? text, UIElement? control)

control.SetValue(Grid.ColumnProperty, m_CurrentColumn);
control.SetValue(Grid.RowProperty, m_CurrentRow);
if (tooltip != null)
{
control.ToolTip = new ToolTip { Content = tooltip };
}
Grid.Children.Add(control);

m_CurrentColumn++;
Expand Down Expand Up @@ -122,12 +130,12 @@ public void PushRowEmptyPair()
m_CurrentColumn += 3;
}

public void PushRowElement(UIElement element)
public void PushRowElement(FrameworkElement element)
{
PushRow(null, element);
}

public void PushRowExpandElement(UIElement element)
public void PushRowExpandElement(FrameworkElement element)
{
element.ClipToBounds = false;

Expand All @@ -136,20 +144,20 @@ public void PushRowExpandElement(UIElement element)
PushRow(null, canvas);
}

public void PushRowPair(string text, UIElement element)
public void PushRowPair(string text, FrameworkElement element)
{
PushRow(text, element);
}

public void PushRowSpacedPair(string text, UIElement element)
public void PushRowSpacedPair(string text, FrameworkElement element, string? tooltip = null)
{
PushRow(text, null);
PushRow(text, null, tooltip);
PushRowEmpty();

element.SetValue(FrameworkElement.HorizontalAlignmentProperty, HorizontalAlignment.Left);
element.SetValue(FrameworkElement.VerticalAlignmentProperty, VerticalAlignment.Center);

PushRow(null, element);
PushRow(null, element, tooltip);
}

public void PushRowTextBlock(string text)
Expand Down
2 changes: 1 addition & 1 deletion ConfigApp/Tabs/Settings/ModesTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ static ChaosGrid createCommonGrid()
body.Children.Add(m_DistanceGrid.Grid);

var footerGrid = createCommonGrid();
footerGrid.PushRowSpacedPair("Enable Crossing Challenge™", m_EnableCrossingChallenge = Utils.GenerateCommonCheckBox());
footerGrid.PushRowSpacedPair("Enable Crossing Challenge™", m_EnableCrossingChallenge = Utils.GenerateCommonCheckBox(), "Set respawn and finish points on the map. Reach the finish point without dying to win.");
grid.PushRowElement(footerGrid.Grid);

scrollViewer.Content = grid.Grid;
Expand Down

0 comments on commit dff3d01

Please sign in to comment.