-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Make internal types used by MAUI Toolkit public #29443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
#nullable disable | ||
namespace Microsoft.Maui.Controls | ||
namespace Microsoft.Maui.Controls; | ||
|
||
/// <summary> | ||
/// Defines properties for elements that can have rounded corners. | ||
/// </summary> | ||
/// <remarks> | ||
/// This interface is implemented by UI elements that support corner radius customization, | ||
/// allowing for consistent styling of corners across different controls. | ||
/// </remarks> | ||
public interface ICornerElement | ||
{ | ||
interface ICornerElement | ||
{ | ||
//note to implementor: implement this property publicly | ||
CornerRadius CornerRadius { get; } | ||
} | ||
} | ||
/// <summary> | ||
/// Gets the radius for the corners of the element. | ||
/// </summary> | ||
/// <value>A <see cref="CornerRadius"/> value that specifies the radius for each corner of the element. The default value depends on the implementing control.</value> | ||
/// <remarks>Implementors should implement this property publicly.</remarks> | ||
CornerRadius CornerRadius { get; } | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
#nullable disable | ||
using System.ComponentModel; | ||
namespace Microsoft.Maui.Controls; | ||
|
||
namespace Microsoft.Maui.Controls.Internals | ||
/// <summary> | ||
/// Defines properties and methods for elements that support line height customization. | ||
/// </summary> | ||
/// <remarks> | ||
/// This interface is implemented by UI elements that need to control the spacing between lines of text, | ||
/// providing consistent line height behavior across different text-based controls. | ||
/// </remarks> | ||
public interface ILineHeightElement | ||
{ | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
interface ILineHeightElement | ||
{ | ||
double LineHeight { get; } | ||
/// <summary> | ||
/// Gets the line height for text displayed by this element. | ||
/// </summary> | ||
/// <value>A multiplier that determines the spacing between lines of text. A value of 1.0 represents standard line height.</value> | ||
double LineHeight { get; } | ||
|
||
void OnLineHeightChanged(double oldValue, double newValue); | ||
} | ||
} | ||
/// <summary> | ||
/// Called when the <see cref="LineHeight"/> property changes. | ||
/// </summary> | ||
/// <param name="oldValue">The old value of the property.</param> | ||
/// <param name="newValue">The new value of the property.</param> | ||
/// <remarks>Implementors should implement this method explicitly.</remarks> | ||
void OnLineHeightChanged(double oldValue, double newValue); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#nullable disable | ||
using System; | ||
using System.ComponentModel; | ||
|
||
namespace Microsoft.Maui.Controls.Internals | ||
{ | ||
[EditorBrowsable(EditorBrowsableState.Never)] | ||
[Obsolete("This interface is obsolete and will be removed in a future version. Use Microsoft.Maui.Controls.ILineHeightElement instead.")] | ||
interface ILineHeightElement | ||
{ | ||
double LineHeight { get; } | ||
|
||
void OnLineHeightChanged(double oldValue, double newValue); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,33 @@ | ||
#nullable disable | ||
namespace Microsoft.Maui.Controls | ||
namespace Microsoft.Maui.Controls; | ||
|
||
/// <summary> | ||
/// Defines properties and methods for elements that support text alignment. | ||
/// </summary> | ||
/// <remarks> | ||
/// This interface is implemented by UI elements that need to control the horizontal and vertical | ||
/// alignment of displayed text. | ||
/// </remarks> | ||
public interface ITextAlignmentElement | ||
{ | ||
interface ITextAlignmentElement | ||
{ | ||
//note to implementor: implement the properties publicly | ||
TextAlignment HorizontalTextAlignment { get; } | ||
/// <summary> | ||
/// Gets the horizontal alignment of the text. | ||
/// </summary> | ||
/// <value>A <see cref="TextAlignment"/> value that specifies how the text is horizontally aligned. The default value depends on the implementing control.</value> | ||
/// <remarks>Implementors should implement this property publicly.</remarks> | ||
TextAlignment HorizontalTextAlignment { get; } | ||
|
||
TextAlignment VerticalTextAlignment { get; } | ||
/// <summary> | ||
/// Gets the vertical alignment of the text. | ||
/// </summary> | ||
/// <value>A <see cref="TextAlignment"/> value that specifies how the text is vertically aligned. The default value depends on the implementing control.</value> | ||
/// <remarks>Implementors should implement this property publicly.</remarks> | ||
TextAlignment VerticalTextAlignment { get; } | ||
|
||
//note to implementor: but implement the methods explicitly | ||
void OnHorizontalTextAlignmentPropertyChanged(TextAlignment oldValue, TextAlignment newValue); | ||
} | ||
} | ||
/// <summary> | ||
/// Called when the <see cref="HorizontalTextAlignment"/> property changes. | ||
/// </summary> | ||
/// <param name="oldValue">The old value of the property.</param> | ||
/// <param name="newValue">The new value of the property.</param> | ||
/// <remarks>Implementors should implement this method explicitly.</remarks> | ||
void OnHorizontalTextAlignmentPropertyChanged(TextAlignment oldValue, TextAlignment newValue); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,64 @@ | ||
#nullable disable | ||
using System; | ||
using Microsoft.Maui.Controls.Internals; | ||
using Microsoft.Maui.Graphics; | ||
|
||
namespace Microsoft.Maui.Controls | ||
namespace Microsoft.Maui.Controls; | ||
|
||
/// <summary> | ||
/// Defines properties and methods for elements that display text. | ||
/// </summary> | ||
/// <remarks> | ||
/// This interface is implemented by UI elements that can display text and allows consistent | ||
/// text styling and formatting across different controls. | ||
/// </remarks> | ||
public interface ITextElement | ||
{ | ||
interface ITextElement | ||
{ | ||
//note to implementor: implement this property publicly | ||
Color TextColor { get; } | ||
/// <summary> | ||
/// Gets the color of the text. | ||
/// </summary> | ||
/// <value>The <see cref="Color"/> of the text. The default value depends on the implementing control.</value> | ||
/// <remarks>Implementors should implement this property publicly.</remarks> | ||
Color TextColor { get; } | ||
|
||
//note to implementor: but implement this method explicitly | ||
void OnTextColorPropertyChanged(Color oldValue, Color newValue); | ||
/// <summary> | ||
/// Called when the <see cref="TextColor"/> property changes. | ||
/// </summary> | ||
/// <param name="oldValue">The old value of the property.</param> | ||
/// <param name="newValue">The new value of the property.</param> | ||
/// <remarks>Implementors should implement this method explicitly.</remarks> | ||
void OnTextColorPropertyChanged(Color oldValue, Color newValue); | ||
|
||
double CharacterSpacing { get; } | ||
/// <summary> | ||
/// Gets the character spacing. | ||
/// </summary> | ||
/// <value>The spacing between characters in the text, in device-independent units. The default is 0.</value> | ||
double CharacterSpacing { get; } | ||
|
||
//note to implementor: but implement these methods explicitly | ||
void OnCharacterSpacingPropertyChanged(double oldValue, double newValue); | ||
/// <summary> | ||
/// Called when the <see cref="CharacterSpacing"/> property changes. | ||
/// </summary> | ||
/// <param name="oldValue">The old value of the property.</param> | ||
/// <param name="newValue">The new value of the property.</param> | ||
/// <remarks>Implementors should implement this method explicitly.</remarks> | ||
void OnCharacterSpacingPropertyChanged(double oldValue, double newValue); | ||
|
||
TextTransform TextTransform { get; set; } | ||
/// <summary> | ||
/// Gets or sets the text transformation. | ||
/// </summary> | ||
/// <value>A <see cref="TextTransform"/> value that indicates how the text is transformed. The default is <see cref="TextTransform.None"/>.</value> | ||
TextTransform TextTransform { get; set; } | ||
|
||
void OnTextTransformChanged(TextTransform oldValue, TextTransform newValue); | ||
/// <summary> | ||
/// Called when the <see cref="TextTransform"/> property changes. | ||
/// </summary> | ||
/// <param name="oldValue">The old value of the property.</param> | ||
/// <param name="newValue">The new value of the property.</param> | ||
void OnTextTransformChanged(TextTransform oldValue, TextTransform newValue); | ||
|
||
string UpdateFormsText(string original, TextTransform transform); | ||
} | ||
} | ||
/// <summary> | ||
/// Updates the text according to the specified transformation. | ||
/// </summary> | ||
/// <param name="original">The original text to transform.</param> | ||
/// <param name="transform">The transformation to apply.</param> | ||
/// <returns>The transformed text.</returns> | ||
string UpdateFormsText(string original, TextTransform transform); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have duplicated this one. I wanted to get rid of the "Internals" in the namespace, but since we need to provide a transition path, we want to keep the one that is available right now, and provide the new public one in the new namespace.
Once we remove
InternalsVisibleTo
we can remove this one as well. I will make sure to note that in the issue to track this.