Skip to content

Commit 809b60c

Browse files
committed
Add more XML documentation.
1 parent e37b73c commit 809b60c

21 files changed

Lines changed: 460 additions & 147 deletions

src/Modern.Forms/Cursor.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
namespace Modern.Forms
77
{
8+
/// <summary>
9+
/// Represents a mouse cursor.
10+
/// </summary>
811
public class Cursor
912
{
1013
internal Avalonia.Input.Cursor cursor;
@@ -14,6 +17,9 @@ internal Cursor (StandardCursorType type)
1417
cursor = new Avalonia.Input.Cursor (type);
1518
}
1619

20+
/// <summary>
21+
/// The default cursor provided by the operating system.
22+
/// </summary>
1723
public static Cursor Default => Cursors.Arrow;
1824
}
1925
}

src/Modern.Forms/Cursors.cs

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
namespace Modern.Forms
66
{
7+
/// <summary>
8+
/// Represents a collection of system provided mouse cursors.
9+
/// </summary>
710
public static class Cursors
811
{
912
private static Cursor? app_starting;
@@ -30,28 +33,119 @@ public static class Cursors
3033
private static Cursor? up_arrow;
3134
private static Cursor? wait;
3235

36+
/// <summary>
37+
/// The default app starting cursor provided by the operating system.
38+
/// </summary>
3339
public static Cursor AppStarting => app_starting ??= new Cursor (Avalonia.Input.StandardCursorType.AppStarting);
40+
41+
/// <summary>
42+
/// The default arrow cursor provided by the operating system.
43+
/// </summary>
3444
public static Cursor Arrow => arrow ??= new Cursor (Avalonia.Input.StandardCursorType.Arrow);
45+
46+
/// <summary>
47+
/// The default bottom left corner cursor provided by the operating system.
48+
/// </summary>
3549
public static Cursor BottomLeftCorner => bottom_left_corner ??= new Cursor (Avalonia.Input.StandardCursorType.BottomLeftCorner);
50+
51+
/// <summary>
52+
/// The default bottom right corner cursor provided by the operating system.
53+
/// </summary>
3654
public static Cursor BottomRightCorner => bottom_right_corner ??= new Cursor (Avalonia.Input.StandardCursorType.BottomRightCorner);
55+
56+
/// <summary>
57+
/// The default bottom cursor provided by the operating system.
58+
/// </summary>
3759
public static Cursor BottomSide => bottom_side ??= new Cursor (Avalonia.Input.StandardCursorType.BottomSide);
60+
61+
/// <summary>
62+
/// The default cross cursor provided by the operating system.
63+
/// </summary>
3864
public static Cursor Cross => cross ??= new Cursor (Avalonia.Input.StandardCursorType.Cross);
65+
66+
/// <summary>
67+
/// The default drag copy cursor provided by the operating system.
68+
/// </summary>
3969
public static Cursor DragCopy => drag_copy ??= new Cursor (Avalonia.Input.StandardCursorType.DragCopy);
70+
71+
/// <summary>
72+
/// The default drag link cursor provided by the operating system.
73+
/// </summary>
4074
public static Cursor DragLink => drag_link ??= new Cursor (Avalonia.Input.StandardCursorType.DragLink);
75+
76+
/// <summary>
77+
/// The default drag move cursor provided by the operating system.
78+
/// </summary>
4179
public static Cursor DragMove => drag_move ??= new Cursor (Avalonia.Input.StandardCursorType.DragMove);
80+
81+
/// <summary>
82+
/// The default hand cursor provided by the operating system.
83+
/// </summary>
4284
public static Cursor Hand => hand ??= new Cursor (Avalonia.Input.StandardCursorType.Hand);
85+
86+
/// <summary>
87+
/// The default help cursor provided by the operating system.
88+
/// </summary>
4389
public static Cursor Help => help ??= new Cursor (Avalonia.Input.StandardCursorType.Help);
90+
91+
/// <summary>
92+
/// The default ibeam cursor provided by the operating system.
93+
/// </summary>
4494
public static Cursor IBeam => ibeam ??= new Cursor (Avalonia.Input.StandardCursorType.Ibeam);
95+
96+
/// <summary>
97+
/// The default left side cursor provided by the operating system.
98+
/// </summary>
4599
public static Cursor LeftSide => left_side ??= new Cursor (Avalonia.Input.StandardCursorType.LeftSide);
100+
101+
/// <summary>
102+
/// The default no cursor provided by the operating system.
103+
/// </summary>
46104
public static Cursor No => no ??= new Cursor (Avalonia.Input.StandardCursorType.No);
105+
106+
/// <summary>
107+
/// The default right side cursor provided by the operating system.
108+
/// </summary>
47109
public static Cursor RightSide => right_side ??= new Cursor (Avalonia.Input.StandardCursorType.RightSide);
110+
111+
/// <summary>
112+
/// The default size all cursor provided by the operating system.
113+
/// </summary>
48114
public static Cursor SizeAll => size_all ??= new Cursor (Avalonia.Input.StandardCursorType.SizeAll);
115+
116+
/// <summary>
117+
/// The default size north-south cursor provided by the operating system.
118+
/// </summary>
49119
public static Cursor SizeNorthSouth => size_north_south ??= new Cursor (Avalonia.Input.StandardCursorType.SizeNorthSouth);
120+
121+
/// <summary>
122+
/// The default size west-east cursor provided by the operating system.
123+
/// </summary>
50124
public static Cursor SizeWestEast => size_west_east ??= new Cursor (Avalonia.Input.StandardCursorType.SizeWestEast);
125+
126+
/// <summary>
127+
/// The default top left corner cursor provided by the operating system.
128+
/// </summary>
51129
public static Cursor TopLeftCorner => top_left_corner ??= new Cursor (Avalonia.Input.StandardCursorType.TopLeftCorner);
130+
131+
/// <summary>
132+
/// The default top right corner cursor provided by the operating system.
133+
/// </summary>
52134
public static Cursor TopRightCorner => top_right_corner ??= new Cursor (Avalonia.Input.StandardCursorType.TopRightCorner);
135+
136+
/// <summary>
137+
/// The default top side cursor provided by the operating system.
138+
/// </summary>
53139
public static Cursor TopSide => top_side ??= new Cursor (Avalonia.Input.StandardCursorType.TopSide);
140+
141+
/// <summary>
142+
/// The default up arrow cursor provided by the operating system.
143+
/// </summary>
54144
public static Cursor UpArrow => up_arrow ??= new Cursor (Avalonia.Input.StandardCursorType.UpArrow);
145+
146+
/// <summary>
147+
/// The default wait cursor provided by the operating system.
148+
/// </summary>
55149
public static Cursor Wait => wait ??= new Cursor (Avalonia.Input.StandardCursorType.Wait);
56150
}
57151
}

src/Modern.Forms/FileDialog.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@
55

66
namespace Modern.Forms
77
{
8+
/// <summary>
9+
/// Represents a base class for file dialogs.
10+
/// </summary>
811
public abstract class FileDialog : FileSystemDialog
912
{
1013
internal List<FileDialogFilter> filters = new List<FileDialogFilter> ();
1114

15+
/// <summary>
16+
/// Adds a file filter choice to the dialog.
17+
/// </summary>
18+
/// <param name="name">Name of the filter, for example: "Text Files".</param>
19+
/// <param name="extensions">File extensions to filter for, for example: "txt", "log".</param>
1220
public void AddFilter (string name, params string[] extensions)
1321
{
1422
var filter = new FileDialogFilter {
@@ -19,6 +27,9 @@ public void AddFilter (string name, params string[] extensions)
1927
filters.Add (filter);
2028
}
2129

30+
/// <summary>
31+
/// Gets or sets the selected files. If there are multiple files selected, the first one is returned.
32+
/// </summary>
2233
public string? FileName {
2334
get => FileNames.Count > 0 ? Path.GetFullPath (FileNames[0]) : null;
2435
set {
@@ -29,6 +40,9 @@ public string? FileName {
2940
}
3041
}
3142

43+
/// <summary>
44+
/// Gets or sets the selected files.
45+
/// </summary>
3246
public List<string> FileNames { get; } = new List<string> ();
3347
}
3448
}

src/Modern.Forms/FileSystemDialog.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,19 @@
22

33
namespace Modern.Forms
44
{
5+
/// <summary>
6+
/// Represents a base class for file system dialogs.
7+
/// </summary>
58
public abstract class FileSystemDialog
69
{
10+
/// <summary>
11+
/// Gets or sets the initial directory for the dialog.
12+
/// </summary>
713
public string? InitialDirectory { get; set; }
814

15+
/// <summary>
16+
/// Gets or sets the title for the dialog.
17+
/// </summary>
918
public string Title { get; set; } = string.Empty;
1019
}
1120
}

src/Modern.Forms/FolderBrowserDialog.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,28 @@
33

44
namespace Modern.Forms
55
{
6+
/// <summary>
7+
/// Represents a dialog for choosing a file system directory.
8+
/// </summary>
69
public class FolderBrowserDialog : FileSystemDialog
710
{
11+
/// <summary>
12+
/// Gets or sets the selected folder path.
13+
/// </summary>
814
public string? SelectedPath { get; set; }
915

10-
public async Task<DialogResult> ShowDialog (Window window)
16+
/// <summary>
17+
/// Shows the dialog to the user.
18+
/// </summary>
19+
/// <param name="owner">The window that owns this dialog.</param>
20+
public async Task<DialogResult> ShowDialog (Window owner)
1121
{
1222
var dialog = new Avalonia.Controls.OpenFolderDialog {
1323
Directory = InitialDirectory,
1424
Title = Title,
1525
};
1626

17-
SelectedPath = await dialog.ShowAsync (window.window);
27+
SelectedPath = await dialog.ShowAsync (owner.window);
1828

1929
return SelectedPath is null ? DialogResult.Cancel : DialogResult.OK;
2030
}

src/Modern.Forms/ILayoutable.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,25 @@
55

66
namespace Modern.Forms
77
{
8+
/// <summary>
9+
/// Provides functionality needed to be laid out by a LayoutEngine.
10+
/// </summary>
811
public interface ILayoutable
912
{
13+
/// <summary>
14+
/// Gets the size the control would prefer to be.
15+
/// </summary>
16+
/// <param name="proposedSize">A size the layout engine is proposing for the control.</param>
1017
Size GetPreferredSize (Size proposedSize);
11-
void SetBounds (int x, int y, int width, int height, BoundsSpecified specified = BoundsSpecified.All);
18+
19+
/// <summary>
20+
/// Gets or sets how much space there should be between the control and other controls.
21+
/// </summary>
1222
Padding Margin { get; }
23+
24+
/// <summary>
25+
/// Sets the unscaled bounds of the control.
26+
/// </summary>
27+
void SetBounds (int x, int y, int width, int height, BoundsSpecified specified = BoundsSpecified.All);
1328
}
1429
}

src/Modern.Forms/KeyEventArgs.cs

Lines changed: 59 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,88 @@
1-
// Permission is hereby granted, free of charge, to any person obtaining
2-
// a copy of this software and associated documentation files (the
3-
// "Software"), to deal in the Software without restriction, including
4-
// without limitation the rights to use, copy, modify, merge, publish,
5-
// distribute, sublicense, and/or sell copies of the Software, and to
6-
// permit persons to whom the Software is furnished to do so, subject to
7-
// the following conditions:
8-
//
9-
// The above copyright notice and this permission notice shall be
10-
// included in all copies or substantial portions of the Software.
11-
//
12-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13-
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14-
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15-
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16-
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17-
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18-
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19-
//
20-
// Copyright (c) 2004-2005 Novell, Inc.
21-
//
22-
// Authors:
23-
// Peter Bartok pbartok@novell.com
24-
//
25-
//
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for more information.
264

275
using System;
286
using Avalonia.Input;
297

308
namespace Modern.Forms
319
{
10+
/// <summary>
11+
/// Provides data for the KeyDown or KeyUp event.
12+
/// </summary>
3213
public class KeyEventArgs : EventArgs
3314
{
34-
private bool supress_key_press;
15+
private bool _suppressKeyPress = false;
3516

17+
/// <summary>
18+
/// Initializes a new instance of the KeyEventArgs class.
19+
/// </summary>
3620
public KeyEventArgs (Keys keyData)
3721
{
3822
KeyData = keyData;
39-
Handled = false;
4023
}
4124

42-
public virtual bool Alt => KeyData.HasFlag (Keys.Alt);
25+
/// <summary>
26+
/// Gets a value indicating whether the ALT key was pressed.
27+
/// </summary>
28+
public virtual bool Alt => (KeyData & Keys.Alt) == Keys.Alt;
4329

44-
public virtual bool Control => KeyData.HasFlag (Keys.Control);
30+
/// <summary>
31+
/// Gets a value indicating whether the CTRL key was pressed.
32+
/// </summary>
33+
public bool Control => (KeyData & Keys.Control) == Keys.Control;
4534

35+
/// <summary>
36+
/// Gets or sets a value indicating whether the event was handled.
37+
/// </summary>
4638
public bool Handled { get; set; }
4739

48-
public Keys KeyCode => KeyData & Keys.KeyCode;
40+
/// <summary>
41+
/// Gets the keyboard code for a KeyDown or KeyUp event.
42+
/// </summary>
43+
public Keys KeyCode {
44+
get {
45+
var keyGenerated = KeyData & Keys.KeyCode;
4946

50-
public Keys KeyData { get; }
47+
// since Keys can be discontiguous, keeping Enum.IsDefined.
48+
if (!Enum.IsDefined (typeof (Keys), (int)keyGenerated)) {
49+
return Keys.None;
50+
}
51+
return keyGenerated;
52+
}
53+
}
5154

52-
public int KeyValue => Convert.ToInt32 (KeyData);
55+
/// <summary>
56+
/// Gets the keyboard value for a <see cref='Forms.Control.KeyDown'/> or
57+
/// <see cref='Forms.Control.KeyUp'/> event.
58+
/// </summary>
59+
public int KeyValue => (int)(KeyData & Keys.KeyCode);
60+
61+
/// <summary>
62+
/// Gets the key data for a <see cref='Forms.Control.KeyDown'/> or
63+
/// <see cref='Forms.Control.KeyUp'/> event.
64+
/// </summary>
65+
public Keys KeyData { get; }
5366

67+
/// <summary>
68+
/// Gets the modifier flags for a <see cref='Forms.Control.KeyDown'/> or
69+
/// <see cref='Forms.Control.KeyUp'/> event.
70+
/// This indicates which modifier keys (CTRL, SHIFT, and/or ALT) were pressed.
71+
/// </summary>
5472
public Keys Modifiers => KeyData & Keys.Modifiers;
5573

56-
public virtual bool Shift => KeyData.HasFlag (Keys.Shift);
74+
/// <summary>
75+
/// Gets a value indicating whether the SHIFT key was pressed.
76+
/// </summary>
77+
public virtual bool Shift => (KeyData & Keys.Shift) == Keys.Shift;
5778

79+
/// <summary>
80+
/// Gets or sets a value indicating the key press should be suppressed.
81+
/// </summary>
5882
public bool SuppressKeyPress {
59-
get => supress_key_press;
83+
get => _suppressKeyPress;
6084
set {
61-
supress_key_press = value;
85+
_suppressKeyPress = value;
6286
Handled = value;
6387
}
6488
}

0 commit comments

Comments
 (0)