Commit 10119bbc authored by Martin Tvarožek's avatar Martin Tvarožek
Browse files

docs: add documentation to converters

parent dc5e99ce
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -5,6 +5,11 @@ using Avalonia.Data.Converters;

namespace GarrigueGamesLauncher.Converters;

/// <summary>
/// A multi-value converter that calculates the width of columns in a responsive grid
/// based on the total available width and gutter spacing.
/// Automatically adjusts the number of columns depending on the container width.
/// </summary>
public class ColumnConverter : IMultiValueConverter
{
    public object Convert(IList<object?> values, Type targetType, object? parameter, CultureInfo culture)
+5 −0
Original line number Diff line number Diff line
@@ -5,6 +5,11 @@ using Avalonia.Data.Converters;

namespace GarrigueGamesLauncher.Converters;

/// <summary>
/// Converts a long text description into a shortened version with an ellipsis,
/// breaking at common separators (space, punctuation) near a specified maximum length.
/// If no description is available, provides a fallback text.
/// </summary>
public partial class DescriptionConverter : IValueConverter
{
    private const string DefaultDescription =
+5 −0
Original line number Diff line number Diff line
@@ -4,6 +4,11 @@ using Avalonia.Data.Converters;

namespace GarrigueGamesLauncher.Converters;

/// <summary>
/// Converts an enum value to a boolean by comparing it with a provided parameter.
/// Returns <c>true</c> if the enum's string representation matches the parameter; otherwise, <c>false</c>.
/// Used to display the appropriate popup type.
/// </summary>
public class EnumToBoolConverter : IValueConverter
{
    public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+5 −0
Original line number Diff line number Diff line
@@ -4,6 +4,11 @@ using Avalonia.Data.Converters;

namespace GarrigueGamesLauncher.Converters;

/// <summary>
/// Converts a width value to half of the provided value.
/// If the parameter is the width of the parent, effectively simulates
/// the width: 50%; CSS selector.
/// </summary>
public class HalfWidthConverter : IValueConverter
{
    public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
+4 −0
Original line number Diff line number Diff line
@@ -4,6 +4,10 @@ using Avalonia.Data.Converters;

namespace GarrigueGamesLauncher.Converters;

/// <summary>
/// Converts a width value to a height value maintaining a 16:9 aspect ratio.
/// Used in game card and gallery grids for uniform appearance.
/// </summary>
public class SixteenByNineConverter : IValueConverter
{
    public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)