1
- using System ;
2
-
1
+ #nullable enable
3
2
namespace Terminal . Gui ;
4
3
5
4
public partial class View
@@ -8,11 +7,11 @@ public partial class View
8
7
// TODO: See https://github.com/gui-cs/Terminal.Gui/issues/457
9
8
10
9
#region ColorScheme
11
-
12
- private ColorScheme _colorScheme ;
10
+
11
+ private ColorScheme ? _colorScheme ;
13
12
14
13
/// <summary>The color scheme for this view, if it is not defined, it returns the <see cref="SuperView"/>'s color scheme.</summary>
15
- public virtual ColorScheme ColorScheme
14
+ public virtual ColorScheme ? ColorScheme
16
15
{
17
16
get
18
17
{
@@ -29,6 +28,7 @@ public virtual ColorScheme ColorScheme
29
28
{
30
29
_colorScheme = value ;
31
30
31
+ // BUGBUG: This should be in Border.cs somehow
32
32
if ( Border is { } && Border . LineStyle != LineStyle . None && Border . ColorScheme is { } )
33
33
{
34
34
Border . ColorScheme = _colorScheme ;
@@ -47,7 +47,7 @@ public virtual ColorScheme ColorScheme
47
47
/// </returns>
48
48
public virtual Attribute GetFocusColor ( )
49
49
{
50
- ColorScheme cs = ColorScheme ;
50
+ ColorScheme ? cs = ColorScheme ;
51
51
52
52
if ( cs is null )
53
53
{
@@ -65,20 +65,20 @@ public virtual Attribute GetFocusColor ()
65
65
/// </returns>
66
66
public virtual Attribute GetHotFocusColor ( )
67
67
{
68
- ColorScheme cs = ColorScheme ?? new ( ) ;
68
+ ColorScheme ? cs = ColorScheme ?? new ( ) ;
69
69
70
70
return Enabled ? GetColor ( cs . HotFocus ) : cs . Disabled ;
71
71
}
72
72
73
73
/// <summary>Determines the current <see cref="ColorScheme"/> based on the <see cref="Enabled"/> value.</summary>
74
74
/// <returns>
75
- /// <see cref="Terminal.Gui. ColorScheme.HotNormal"/> if <see cref="Enabled"/> is <see langword="true"/> or
76
- /// <see cref="Terminal.Gui. ColorScheme.Disabled"/> if <see cref="Enabled"/> is <see langword="false"/>. If it's
75
+ /// <see cref="ColorScheme.HotNormal"/> if <see cref="Enabled"/> is <see langword="true"/> or
76
+ /// <see cref="ColorScheme.Disabled"/> if <see cref="Enabled"/> is <see langword="false"/>. If it's
77
77
/// overridden can return other values.
78
78
/// </returns>
79
79
public virtual Attribute GetHotNormalColor ( )
80
80
{
81
- ColorScheme cs = ColorScheme ;
81
+ ColorScheme ? cs = ColorScheme ;
82
82
83
83
if ( cs is null )
84
84
{
@@ -90,13 +90,13 @@ public virtual Attribute GetHotNormalColor ()
90
90
91
91
/// <summary>Determines the current <see cref="ColorScheme"/> based on the <see cref="Enabled"/> value.</summary>
92
92
/// <returns>
93
- /// <see cref="Terminal.Gui. ColorScheme.Normal"/> if <see cref="Enabled"/> is <see langword="true"/> or
94
- /// <see cref="Terminal.Gui. ColorScheme.Disabled"/> if <see cref="Enabled"/> is <see langword="false"/>. If it's
93
+ /// <see cref="ColorScheme.Normal"/> if <see cref="Enabled"/> is <see langword="true"/> or
94
+ /// <see cref="ColorScheme.Disabled"/> if <see cref="Enabled"/> is <see langword="false"/>. If it's
95
95
/// overridden can return other values.
96
96
/// </returns>
97
97
public virtual Attribute GetNormalColor ( )
98
98
{
99
- ColorScheme cs = ColorScheme ;
99
+ ColorScheme ? cs = ColorScheme ;
100
100
101
101
if ( cs is null )
102
102
{
@@ -132,16 +132,11 @@ private Attribute GetColor (Attribute inputAttribute)
132
132
/// <summary>Selects the specified attribute as the attribute to use for future calls to AddRune and AddString.</summary>
133
133
/// <remarks></remarks>
134
134
/// <param name="attribute">THe Attribute to set.</param>
135
- public Attribute SetAttribute ( Attribute attribute )
136
- {
137
- return Driver ? . SetAttribute ( attribute ) ?? Attribute . Default ;
138
- }
135
+ public Attribute SetAttribute ( Attribute attribute ) { return Driver ? . SetAttribute ( attribute ) ?? Attribute . Default ; }
139
136
140
137
/// <summary>Gets the current <see cref="Attribute"/>.</summary>
141
138
/// <returns>The current attribute.</returns>
142
- public Attribute GetAttribute ( )
143
- {
144
- return Driver ? . GetAttribute ( ) ?? Attribute . Default ;
145
- }
139
+ public Attribute GetAttribute ( ) { return Driver ? . GetAttribute ( ) ?? Attribute . Default ; }
140
+
146
141
#endregion Attribute
147
142
}
0 commit comments