Skip to content

Commit 6e89a47

Browse files
committed
xml docs and typo
1 parent b7d854a commit 6e89a47

11 files changed

+61
-12
lines changed

src/ArrayExtensions.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ public static class ArrayExtensions
3131
return toReturn;
3232
}
3333

34+
/// <summary>
35+
/// Converts an enumerable to a <see cref="IListDataSource"/>
36+
/// </summary>
37+
/// <param name="enumerable"></param>
38+
/// <returns></returns>
39+
/// <exception cref="Exception"></exception>
3440
public static IListDataSource ToListDataSource(this IEnumerable enumerable)
3541
{
3642
// Get the type of the elements

src/Operations/IOperation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public interface IOperation
3333
/// <summary>
3434
/// Gets the number of times this <see cref="IOperation"/> has been executed successfully
3535
/// </summary>
36-
ref int TimesDone { get; }
36+
int TimesDone { get; }
3737

3838
/// <summary>
3939
/// Performs the operation.

src/Operations/Operation.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ namespace TerminalGuiDesigner.Operations;
88
/// </summary>
99
public abstract class Operation : IOperation
1010
{
11-
protected int _timesDone;
11+
/// <summary>
12+
/// The number of times the operation has been performed.
13+
/// </summary>
14+
private int _timesDone;
1215

1316
/// <summary>
1417
/// The name to give to all objects which do not have a title/text etc.
@@ -23,7 +26,7 @@ public abstract class Operation : IOperation
2326
public bool SupportsUndo { get; protected set; } = true;
2427

2528
/// <inheritdoc />
26-
public ref int TimesDone => ref _timesDone;
29+
public int TimesDone => _timesDone;
2730

2831
/// <inheritdoc/>
2932
/// <remarks>Defaults to <see cref="Guid.NewGuid"/>.</remarks>
@@ -66,6 +69,7 @@ public void Undo()
6669
UndoImpl();
6770
}
6871

72+
/// <inheritdoc cref="Undo"/>
6973
protected abstract void UndoImpl();
7074

7175
/// <inheritdoc/>
@@ -75,6 +79,7 @@ public void Redo()
7579
RedoImpl();
7680
}
7781

82+
/// <inheritdoc cref="Redo"/>
7883
protected abstract void RedoImpl();
7984

8085
/// <inheritdoc cref="IOperation.Do"/>

src/StatusBarExtensions.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,23 @@ public static int CountShortcuts(this StatusBar bar)
6868
return bar.Subviews.OfType<Shortcut>().Count();
6969
}
7070

71+
/// <summary>
72+
/// Returns the items on the <see cref="StatusBar"/> (previously
73+
/// called StatusBarItems now called just <see cref="Shortcut"/>)
74+
/// </summary>
75+
/// <param name="bar"></param>
76+
/// <returns></returns>
7177
public static Shortcut[] GetShortcuts(this StatusBar bar)
7278
{
7379
return bar.Subviews.OfType<Shortcut>().ToArray();
7480
}
7581

82+
/// <summary>
83+
/// Replaces all items on the <paramref name="bar"/> with the new
84+
/// <paramref name="shortcuts"/>.
85+
/// </summary>
86+
/// <param name="bar"></param>
87+
/// <param name="shortcuts"></param>
7688
public static void SetShortcuts(this StatusBar bar, Shortcut[] shortcuts)
7789
{
7890
foreach(var old in bar.GetShortcuts())

src/ToCode/EnumToCode.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,31 @@
22

33
namespace TerminalGuiDesigner.ToCode;
44

5+
/// <summary>
6+
/// Code generation methods for writing out enum values
7+
/// using CodeDom.
8+
/// </summary>
59
public class EnumToCode : ToCodeBase
610
{
711
private readonly Enum value;
812
private readonly Type enumType;
913

10-
14+
/// <summary>
15+
/// Creates a new instance of the class, primed to generate code
16+
/// for the supplied <paramref name="value"/>
17+
/// </summary>
18+
/// <param name="value"></param>
1119
public EnumToCode(Enum value)
1220
{
1321
this.value = value;
1422
this.enumType = value.GetType();
1523
}
1624

25+
/// <summary>
26+
/// <para>Returns code expression similar to <c>MyEnum.SomeValue</c>.</para>
27+
/// <para>Supports Flags enums e.g. generating things like <c>MyEnum.ValA | MyEnum.ValB</c></para>
28+
/// </summary>
29+
/// <returns></returns>
1730
public CodeExpression ToCode()
1831
{
1932
var isFlags = enumType.IsDefined(typeof(FlagsAttribute), false);

src/ToCode/InstanceOfProperty.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,25 @@ namespace TerminalGuiDesigner.ToCode;
1111
/// </summary>
1212
public class InstanceOfProperty : Property
1313
{
14-
public Type MustBeDerrivedFrom { get; }
14+
/// <summary>
15+
/// Places a restriction on the <see cref="Property.SetValue"/> that
16+
/// can be supplied. When setting the value must be a class derrived
17+
/// from this <see cref="Type"/>.
18+
/// </summary>
19+
public Type MustBeDerivedFrom { get; }
1520

21+
/// <summary>
22+
/// Creates a new instance of designable property <paramref name="property"/>.
23+
/// In which values set <see cref="MustBeDerivedFrom"/> the supplied
24+
/// <see cref="PropertyInfo.PropertyType"/>
25+
/// </summary>
26+
/// <param name="design"></param>
27+
/// <param name="property"></param>
28+
/// <exception cref="Exception"></exception>
1629
public InstanceOfProperty(Design design, PropertyInfo property)
1730
: base(design, property)
1831
{
19-
this.MustBeDerrivedFrom = property.PropertyType
32+
this.MustBeDerivedFrom = property.PropertyType
2033
?? throw new Exception("Unable to determine property type");
2134
}
2235

src/UI/KeyMap.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,7 @@ public KeyMap( )
176176
public string ToggleDragging { get; init; } = ToggleDragging;
177177

178178
/// <summary>
179-
/// Gets the string to toggle showing dotted borders around views that otherwise do not have visible borders (e.g.
180-
/// <see cref="ScrollView" />).
179+
/// Gets the string to toggle showing dotted borders around views that otherwise do not have visible borders.
181180
/// </summary>
182181
public string ToggleShowBorders { get; init; } = ToggleShowBorders;
183182

src/UI/KeyboardManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public KeyboardManager(KeyMap keyMap)
3030
/// to the rest of the regular Terminal.Gui API layer.
3131
/// </summary>
3232
/// <param name="focusedView">The <see cref="View"/> that currently holds focus in <see cref="Editor"/>.</param>
33-
/// <param name="keystroke">The key that has been reported by <see cref="Application.RootKey"/>.</param>
33+
/// <param name="keystroke">The key that has been reported by <see cref="Application.KeyDown"/>.</param>
3434
/// <returns><see langword="true"/> if <paramref name="keystroke"/> should be suppressed.</returns>
3535
public bool HandleKey(View focusedView, Key keystroke)
3636
{

src/UI/MouseManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class MouseManager
3434
/// Responds to <see cref="Application.MouseEvent"/>(by changing a 'drag a box' selection area
3535
/// or starting a resize etc).
3636
/// </summary>
37-
/// <param name="m">The <see cref="MouseEventArgs"/> reported by <see cref="Application.RootMouseEvent"/>.</param>
37+
/// <param name="m">The <see cref="MouseEventArgs"/> reported by <see cref="Application.MouseEvent"/>.</param>
3838
/// <param name="viewBeingEdited">The root <see cref="Design"/> that is open in the <see cref="Editor"/>.</param>
3939
public void HandleMouse(MouseEventArgs m, Design viewBeingEdited)
4040
{

src/UI/ValueFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ internal static bool GetNewValue(Design design, Property property, object? oldVa
246246
if (Modals.Get<Type>(
247247
property.PropertyInfo.Name,
248248
"New Value",
249-
typeof(Label).Assembly.GetTypes().Where(inst.MustBeDerrivedFrom.IsAssignableFrom).ToArray(),
249+
typeof(Label).Assembly.GetTypes().Where(inst.MustBeDerivedFrom.IsAssignableFrom).ToArray(),
250250
inst.GetValue()?.GetType(),
251251
out Type? typeChosen))
252252
{

0 commit comments

Comments
 (0)