Skip to content
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

Fixes #2489. Build scrolling into View. #3254

Closed
wants to merge 158 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
63e7cea
Add ContentArea and fix layout related with frame to screen and vice …
BDisp Feb 21, 2024
d154533
Propagate BeginInit and EndInit to Adornments.
BDisp Feb 21, 2024
4b88190
Clip only to the ContentArea.
BDisp Feb 21, 2024
5d8c24a
Allow DrawContentComplete event to be called before an overridden met…
BDisp Feb 21, 2024
c69e424
Add DrawAdornments event.
BDisp Feb 21, 2024
5bf7f94
Manage needs display for adornments.
BDisp Feb 21, 2024
37dd28c
Allow adornments handle key bindings-
BDisp Feb 21, 2024
a026324
Add ViewScrollBar.cs to manage a built-in scroll bar on Padding.
BDisp Feb 21, 2024
a533466
Add built-in scroll bar on TableView.
BDisp Feb 21, 2024
809aa08
Prefix private fields with underscore.
BDisp Feb 21, 2024
55993f3
Add built-in scroll bar in TreeView.
BDisp Feb 21, 2024
7e4dc56
Prefix private fields with underscore.
BDisp Feb 21, 2024
07ac230
Add built-in scroll bar on ComboBox for the ListView.
BDisp Feb 21, 2024
9325536
Add built-in scroll bar in ListView.
BDisp Feb 21, 2024
95c4cc2
Apply changes for use scroll bar in adornments.
BDisp Feb 21, 2024
d4926ac
Make the ScrollView mirror the ScrollBarView properties.
BDisp Feb 21, 2024
13ac716
Rename private field to _boundsWidth.
BDisp Feb 21, 2024
da1632a
Add built-in scroll bar in TextView. Add improvement to the word wrap…
BDisp Feb 21, 2024
8390ead
Add feature to manage subviews on adornments for mouse handling.
BDisp Feb 21, 2024
f6db34d
Fix CharacterMap scenario.
BDisp Feb 21, 2024
1e2b225
Fixes scenarios to use the built-in scroll bar.
BDisp Feb 21, 2024
c0d1dad
Add ScrollBarBuiltIn scenario. Need to be improvement.
BDisp Feb 21, 2024
0282586
Fixes and added unit tests to handle the built-in scroll bars.
BDisp Feb 21, 2024
00a94c3
Merge branch 'v2_develop' into v2_view-scrollbar-on-padding_2489
tig Feb 21, 2024
f164521
Remove the hack BottomOffset and RightOffset used by the old scroll …
BDisp Feb 21, 2024
8124601
Rename to AddEventHandlersForScrollBars.
BDisp Feb 21, 2024
1f47285
Replace '== null' to 'is null'.
BDisp Feb 21, 2024
7fc326b
Replace to AddKeyBindingsForScrolling.
BDisp Feb 21, 2024
270229e
Rename to KeepContentAlwaysInViewPort.
BDisp Feb 21, 2024
77dcc5e
Replace with "virtual space".
BDisp Feb 21, 2024
9f71513
Remove VisibleChanged.
BDisp Feb 21, 2024
845c8dc
Revert "Remove VisibleChanged."
BDisp Feb 21, 2024
2496f6e
Remove VisibleChanged.
BDisp Feb 21, 2024
22db0d9
Rename ScrollBarView to ScrollBar.
BDisp Feb 21, 2024
97402ea
Add scroll bar to the WizardStep.
BDisp Feb 21, 2024
2d385b5
Make IsBuiltIn as private.
BDisp Feb 21, 2024
5e3be5f
Decouples the scroll bar from the adornments.
BDisp Feb 21, 2024
2cd5faf
Rename to ScrollBars.
BDisp Feb 22, 2024
f8738e1
Rename to AdornmentSubViewHandledMouseEvent.
BDisp Feb 22, 2024
511df4b
Decouple FrameToScreen from the Adornment base-class.
BDisp Feb 22, 2024
53b3e81
Fix broken scroll bar in the ComboBox list.
BDisp Feb 22, 2024
4ce9a9c
Resolving merge conflicts.
BDisp Feb 22, 2024
a04a555
Fix merge errors.
BDisp Feb 22, 2024
2d99a12
Resolving merge conflicts.
BDisp Feb 22, 2024
566c675
Fix merge errors.
BDisp Feb 23, 2024
33861c3
Add ContentOffset property.
BDisp Feb 24, 2024
64b7f2e
Allow all adornments handle mouse events on subviews.
BDisp Feb 24, 2024
294b0eb
Testing ScrollBar on all adornments and content area.
BDisp Feb 24, 2024
c783928
Add more unit tests and fixes.
BDisp Feb 24, 2024
383fc16
Fix issue ScrollBar not be ungrab if the mouse is over another view.
BDisp Feb 24, 2024
930260a
Decouples BoundsToScreen method from Adornments by make the GetAdornm…
BDisp Feb 24, 2024
743baa7
Rename ScrollBar to ScrollBarView.
BDisp Feb 24, 2024
6196b04
Resolving reverted conflicts.
BDisp Feb 24, 2024
9d401ff
Rename to UseContentOffset.
BDisp Feb 24, 2024
9f5b499
Rename to GetVisibleContentArea as method.
BDisp Feb 24, 2024
c80964c
Rename Bounds to ContentArea.
BDisp Feb 25, 2024
498fdab
Fix unit tests when rename Bounds to ContentArea.
BDisp Feb 25, 2024
824c3cf
Replace ScrollLeftOffset and ScrollTopOffset with ContentOffset.
BDisp Feb 25, 2024
f933f84
Replace ScrollColsSize and ScrollRowsSize with ContentSize.
BDisp Feb 25, 2024
a847cf7
Remove ScrollPosition supersede by ContentOffset.
BDisp Feb 25, 2024
ed7ce89
Replace ScrollBarView IsVertical bool type with Orientation type.
BDisp Feb 25, 2024
903248f
Remove unnecessary _superViewContentOffset private field.
BDisp Feb 25, 2024
c3c17e0
Resolving merge conflicts.
BDisp Feb 26, 2024
6ffdf19
Replace KeyCode with Key.
BDisp Feb 26, 2024
1443fae
Remove unnecessary code.
BDisp Feb 26, 2024
9400c83
Auto-hide only set the Visible property and not the ShowScrollIndicator.
BDisp Feb 27, 2024
01e5b52
Rename to ShowBothScrollIndicator.
BDisp Feb 27, 2024
d9ab5a9
Improving scenario to manage auto-hide properly.
BDisp Feb 27, 2024
32515fd
Only set _ignoreEnsureSelectedCellIsVisible to false after process th…
BDisp Feb 27, 2024
733a918
Fix a code style where object type name were added after the 'new' st…
BDisp Feb 28, 2024
022e715
Cleanup code.
BDisp Feb 28, 2024
f39aecf
Resolving merge conflicts.
BDisp Mar 6, 2024
4751fc5
Resolving merge conflicts.
BDisp Mar 6, 2024
7c96a68
Fix window 2 name title.
BDisp Mar 6, 2024
d7a70f5
Resolving merge conflicts.
BDisp Mar 7, 2024
d627055
Fix GetVisibleContentArea.
BDisp Mar 9, 2024
d8df336
Fix Adornments sub-classes.
BDisp Mar 9, 2024
4ff9403
Fix FindDeepestView.
BDisp Mar 9, 2024
06c402b
Fix FrameToScreen.
BDisp Mar 9, 2024
8abebd4
Make GetAdornmentsThickness virtual.
BDisp Mar 9, 2024
52ef1ea
Fix format.
BDisp Mar 9, 2024
853fb4b
Remove duplicate commentary.
BDisp Mar 9, 2024
054f34b
Fix merge conflicts.
BDisp Mar 9, 2024
82ffb4f
Invoke DrawContentComplete in the Draw method as the DrawContent.
BDisp Mar 9, 2024
f8f55c1
Fix SetNeedsDisplay on Adornments.
BDisp Mar 9, 2024
fc0f25e
Fixes 3310. A view where CanFocus is true must be able to set focus o…
BDisp Mar 9, 2024
27600c4
Fix SetBoundsByPosition.
BDisp Mar 9, 2024
26be309
Fix merge conflicts.
BDisp Mar 9, 2024
61740c3
Fix issues in ScrollBarView.
BDisp Mar 9, 2024
7e9a76d
Fix merge conflicts.
BDisp Mar 9, 2024
fff8998
Fix OnMouseEvent working with adornments.
BDisp Mar 9, 2024
9bb6f5f
Change button text to alert to tab or click on the views.
BDisp Mar 9, 2024
e274237
Fix unit tests.
BDisp Mar 9, 2024
8bd301e
Remove ScrollBarType enum and replaced by the EnableScrollBars bool.
BDisp Mar 9, 2024
222c213
Rename to ParentView, fix some key binding issue and add more unit te…
BDisp Mar 10, 2024
64d36fb
Resolving merge conflicts.
BDisp Mar 10, 2024
95f60e6
Fix merge errors.
BDisp Mar 10, 2024
e1e689e
Enable scrolling without scroll bars.
BDisp Mar 11, 2024
0c9bc3d
Resolving merge conflicts.
BDisp Mar 14, 2024
933420b
Fix merge conflicts.
BDisp Mar 14, 2024
167222c
Merge branch 'v2_develop' into v2_view-scrollbar-on-padding_2489
BDisp Mar 16, 2024
7dd4760
Remove nullable check.
BDisp Mar 16, 2024
f1ddca4
Replacing with original code.
BDisp Mar 16, 2024
49ee62a
Replace with original.
BDisp Mar 16, 2024
22145a5
Change Bounds to ContentArea.
BDisp Mar 16, 2024
97299e2
Merge branch 'v2_mousegrabview-fix_3333' into v2_view-scrollbar-on-pa…
BDisp Mar 17, 2024
3f13027
Remove unnecessary code.
BDisp Mar 17, 2024
bce4969
Allow scroll bars using key bindings.
BDisp Mar 17, 2024
1aafb64
Sometimes setting the visibility may require layout subviews.
BDisp Mar 17, 2024
f7dea46
Fix some bugs and improving the ScrollBarView.
BDisp Mar 17, 2024
8e4efcf
Add scroll bar to the ClassExplorer scenario.
BDisp Mar 17, 2024
89e1bf9
Fix and add more unit tests.
BDisp Mar 17, 2024
2e1c2cd
Change the AllViewsTests unit test to handle ScrollBarView differently.
BDisp Mar 17, 2024
ac1d9ca
Merge branch 'v2_develop' into v2_view-scrollbar-on-padding_2489
BDisp Mar 17, 2024
b7c838f
Replacing with original code as possible.
BDisp Mar 17, 2024
7e3c611
Change Bounds to ContentArea.
BDisp Mar 17, 2024
16214c8
Break the loop if the superview is found.
BDisp Mar 17, 2024
5d4b811
Resolving merge conflicts.
BDisp Mar 18, 2024
c44cf39
Set properties on both scroll bars at once.
BDisp Mar 18, 2024
f0109bb
Improves ShowScrollIndicator iteration with the AutoHideScrollBars.
BDisp Mar 18, 2024
33b3ee4
Resolving merge conflicts.
BDisp Mar 21, 2024
c93fd2b
Merge branch 'v2_wheeledleft-wheeledright-fix_3340' into v2_view-scro…
BDisp Mar 21, 2024
730fa86
Implementing mouse support for scrolling including wheeling.
BDisp Mar 21, 2024
db09ea8
Resolving merge conflicts.
BDisp Mar 28, 2024
85e1e6c
Fixes #3356. SetupFakeDriver isn't disposing Application.Top if Appli…
BDisp Mar 28, 2024
d82b1f1
Merge branch 'v2_SetupFakeDriver-Application.Top-dispose_3356' into v…
BDisp Mar 28, 2024
84c5f86
Fix merge errors.
BDisp Mar 28, 2024
efb0799
Fixes #3362. SetRelativeLayout doesn't handled with positive/negative…
BDisp Mar 30, 2024
489befc
Merge branch 'v2_develop' into v2_view-scrollbar-on-padding_2489
BDisp Mar 30, 2024
866952f
Resolving merge conflicts.
BDisp Mar 30, 2024
12ff016
Allowing location offset in the LayoutSubviews.
BDisp Mar 30, 2024
c3aa859
Fix some bugs and adjust unit tests.
BDisp Mar 30, 2024
3c18344
Add horizontal, vertical, auto-hide and keep contents on the ScrollBa…
BDisp Mar 30, 2024
238fdcf
Apply @tig changes.
BDisp Mar 30, 2024
d24de8a
Apply a changed @tig VirtualScrolling scenario.
BDisp Mar 30, 2024
ad6f45b
Merge branch 'v2_develop' into v2_view-scrollbar-on-padding_2489
BDisp Mar 30, 2024
527dd77
Fix KeepContentAlwaysInViewport on all adornments and content area.
BDisp Mar 30, 2024
98b1d79
Merge branch 'v2_develop' into v2_SetRelativeLayout-location_3362
BDisp Apr 1, 2024
0fa4770
Fix PosCombine and PosView with handling location offset.
BDisp Apr 1, 2024
05c7b8e
Merge branch 'v2_develop' into v2_view-scrollbar-on-padding_2489
BDisp Apr 1, 2024
47d3473
Revert "Fixes #3356. SetupFakeDriver isn't disposing Application.Top …
BDisp Apr 1, 2024
e3eabc8
Disposing top on unit tests.
BDisp Apr 1, 2024
1e6c396
Fix PosCombine and PosView with handling location offset.
BDisp Apr 1, 2024
1fdd583
Add two more labels to test vertical and PosFunction.
BDisp Apr 1, 2024
ae34321
Merge branch 'v2_develop' into v2_SetRelativeLayout-location_3362
BDisp Apr 4, 2024
713d0b1
Merge branch 'v2_WindowsDriver-input-fix_3380' into v2_SetRelativeLay…
BDisp Apr 4, 2024
521cfcb
Fix location and dimension with DimFill and PosFunc.
BDisp Apr 4, 2024
ad56b42
Resolving merge conflicts.
BDisp Apr 4, 2024
663c4c7
Merge branch 'v2_SetRelativeLayout-location_3362' into v2_view-scroll…
BDisp Apr 4, 2024
15640f6
Improving and add more features to ViewScrollBar.
BDisp Apr 4, 2024
381d6be
Fix and improve ScrollBarView.
BDisp Apr 4, 2024
405c96a
Implement a @tig version to handle mouse upward.
BDisp Apr 4, 2024
384be82
Improve scenarios.
BDisp Apr 4, 2024
c60b217
Remove unused ScrollBarType name from methods.
BDisp Apr 8, 2024
8800bf5
Merge branch 'v2_develop' into v2_view-scrollbar-on-padding_2489
BDisp Apr 8, 2024
25cea9c
Correcting xml doc.
BDisp Apr 8, 2024
3d9a5d2
Resolving merge conflicts.
BDisp Apr 10, 2024
452a9f0
Formatting.
BDisp Apr 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 38 additions & 6 deletions Terminal.Gui/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1441,12 +1441,12 @@
/// </para>
/// <para>The <see cref="MouseEvent.View"/> will contain the <see cref="View"/> that contains the mouse coordinates.</para>
/// </remarks>
public static event EventHandler<MouseEvent> MouseEvent;

Check warning on line 1444 in Terminal.Gui/Application.cs

View workflow job for this annotation

GitHub Actions / build_and_test

Non-nullable event 'MouseEvent' must contain a non-null value when exiting constructor. Consider declaring the event as nullable.

/// <summary>Called when a mouse event occurs. Raises the <see cref="MouseEvent"/> event.</summary>
/// <remarks>This method can be used to simulate a mouse event, e.g. in unit tests.</remarks>
/// <param name="a">The mouse event with coordinates relative to the screen.</param>

Check warning on line 1448 in Terminal.Gui/Application.cs

View workflow job for this annotation

GitHub Actions / build_and_test

XML comment has a param tag for 'a', but there is no parameter by that name
internal static void OnMouseEvent (MouseEvent mouseEvent)

Check warning on line 1449 in Terminal.Gui/Application.cs

View workflow job for this annotation

GitHub Actions / build_and_test

Parameter 'mouseEvent' has no matching param tag in the XML comment for 'Application.OnMouseEvent(MouseEvent)' (but other parameters do)
{
if (IsMouseDisabled)
{
Expand Down Expand Up @@ -1483,7 +1483,7 @@
View = MouseGrabView
};

if (MouseGrabView.Bounds.Contains (viewRelativeMouseEvent.X, viewRelativeMouseEvent.Y) is false)
if (MouseGrabView.ContentArea.Contains (viewRelativeMouseEvent.X, viewRelativeMouseEvent.Y) is false)
{
// The mouse has moved outside the bounds of the view that grabbed the mouse
_mouseEnteredView?.NewMouseLeaveEvent (mouseEvent);
Expand All @@ -1492,6 +1492,11 @@
//System.Diagnostics.Debug.WriteLine ($"{nme.Flags};{nme.X};{nme.Y};{mouseGrabView}");
if (MouseGrabView?.NewMouseEvent (viewRelativeMouseEvent) == true)
{
if (MouseGrabView is { WantContinuousButtonPressed: true })
{
WantContinuousButtonPressedView = MouseGrabView;
}

return;
}
}
Expand Down Expand Up @@ -1521,7 +1526,7 @@

if (view is { } && view != OverlappedTop && top != Current)
{
MoveCurrent ((Toplevel)top);

Check warning on line 1529 in Terminal.Gui/Application.cs

View workflow job for this annotation

GitHub Actions / build_and_test

Converting null literal or possible null value to non-nullable type.
}
}
}
Expand All @@ -1546,7 +1551,7 @@
View = view
};
}
else if (view.BoundsToScreen (view.Bounds).Contains (mouseEvent.X, mouseEvent.Y))
else if (view.BoundsToScreen (view.GetVisibleContentArea()).Contains (mouseEvent.X, mouseEvent.Y))
{
Point boundsPoint = view.ScreenToBounds (mouseEvent.X, mouseEvent.Y);

Expand Down Expand Up @@ -1584,12 +1589,39 @@

WantContinuousButtonPressedView = view.WantContinuousButtonPressed ? view : null;

//Debug.WriteLine ($"OnMouseEvent: ({a.MouseEvent.X},{a.MouseEvent.Y}) - {a.MouseEvent.Flags}");
//Debug.WriteLine ($"OnMouseEvent: ({mouseEvent.X},{mouseEvent.Y}) - {mouseEvent.Flags}");

if (view.NewMouseEvent (me) == false)
while (view.NewMouseEvent (me) == false)
{
// Should we bubble up the event, if it is not handled?
//return;
if (MouseGrabView is { })
{
break;
}

if (view is Adornment adornmentView)
{
view = adornmentView.Parent.SuperView;
}
else
{
view = view.SuperView;
}

if (view is null)
{
break;
}

Point boundsPoint = view.ScreenToBounds (mouseEvent.X, mouseEvent.Y);

me = new ()
{
X = boundsPoint.X,
Y = boundsPoint.Y,
Flags = mouseEvent.Flags,
ScreenPosition = new (mouseEvent.X, mouseEvent.Y),
View = view
};
}

BringOverlappedTopToFront ();
Expand Down
6 changes: 3 additions & 3 deletions Terminal.Gui/Input/Mouse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ public class MouseEvent
/// <summary>The View at the location for the mouse event.</summary>
public View View { get; set; }

/// <summary>The X position of the mouse in <see cref="View.Bounds"/>-relative coordinates.</summary>
/// <summary>The X position of the mouse in <see cref="Gui.View.ContentArea"/>-relative coordinates.</summary>
public int X { get; set; }

/// <summary>The Y position of the mouse in <see cref="View.Bounds"/>-relative coordinates.</summary>
/// <summary>The Y position of the mouse in <see cref="Gui.View.ContentArea"/>-relative coordinates.</summary>
public int Y { get; set; }

/// <summary>
Expand All @@ -133,7 +133,7 @@ public class MouseEvent
/// </summary>
/// <remarks>
/// <para>
/// The <see cref="X"/> and <see cref="Y"/> properties are always <see cref="View.Bounds"/>-relative. When the mouse is grabbed by a view,
/// The <see cref="X"/> and <see cref="Y"/> properties are always <see cref="Gui.View.ContentArea"/>-relative. When the mouse is grabbed by a view,
/// <see cref="ScreenPosition"/> provides the mouse position screen-relative coordinates, enabling the grabbed view to know how much the
/// mouse has moved.
/// </para>
Expand Down
2 changes: 1 addition & 1 deletion Terminal.Gui/Text/Autocomplete/AppendAutocomplete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public override void RenderOverlay (Point renderAt)
Suggestion suggestion = Suggestions.ElementAt (SelectedIdx);
string fragment = suggestion.Replacement.Substring (suggestion.Remove);

int spaceAvailable = textField.Bounds.Width - textField.Text.GetColumns ();
int spaceAvailable = textField.ContentArea.Width - textField.Text.GetColumns ();
int spaceRequired = fragment.EnumerateRunes ().Sum (c => c.GetColumns ());

if (spaceAvailable < spaceRequired)
Expand Down
22 changes: 11 additions & 11 deletions Terminal.Gui/Text/Autocomplete/PopupAutocomplete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,13 @@ public override void RenderOverlay (Point renderAt)
if (PopupInsideContainer)
{
// don't overspill vertically
height = Math.Min (HostControl.Bounds.Height - renderAt.Y, MaxHeight);
height = Math.Min (HostControl.ContentArea.Height - renderAt.Y, MaxHeight);

// There is no space below, lets see if can popup on top
if (height < Suggestions.Count && HostControl.Bounds.Height - renderAt.Y >= height)
if (height < Suggestions.Count && HostControl.ContentArea.Height - renderAt.Y >= height)
{
// Verifies that the upper limit available is greater than the lower limit
if (renderAt.Y > HostControl.Bounds.Height - renderAt.Y)
if (renderAt.Y > HostControl.ContentArea.Height - renderAt.Y)
{
renderAt.Y = Math.Max (renderAt.Y - Math.Min (Suggestions.Count + 1, MaxHeight + 1), 0);
height = Math.Min (Math.Min (Suggestions.Count, MaxHeight), LastPopupPos.Value.Y - 1);
Expand All @@ -287,13 +287,13 @@ public override void RenderOverlay (Point renderAt)
else
{
// don't overspill vertically
height = Math.Min (Math.Min (top.Bounds.Height - HostControl.Frame.Bottom, MaxHeight), Suggestions.Count);
height = Math.Min (Math.Min (top.ContentArea.Height - HostControl.Frame.Bottom, MaxHeight), Suggestions.Count);

// There is no space below, lets see if can popup on top
if (height < Suggestions.Count && HostControl.Frame.Y - top.Frame.Y >= height)
{
// Verifies that the upper limit available is greater than the lower limit
if (HostControl.Frame.Y > top.Bounds.Height - HostControl.Frame.Y)
if (HostControl.Frame.Y > top.ContentArea.Height - HostControl.Frame.Y)
{
renderAt.Y = Math.Max (HostControl.Frame.Y - Math.Min (Suggestions.Count, MaxHeight), 0);
height = Math.Min (Math.Min (Suggestions.Count, MaxHeight), HostControl.Frame.Y);
Expand Down Expand Up @@ -323,34 +323,34 @@ public override void RenderOverlay (Point renderAt)
if (PopupInsideContainer)
{
// don't overspill horizontally, let's see if can be displayed on the left
if (width > HostControl.Bounds.Width - renderAt.X)
if (width > HostControl.ContentArea.Width - renderAt.X)
{
// Verifies that the left limit available is greater than the right limit
if (renderAt.X > HostControl.Bounds.Width - renderAt.X)
if (renderAt.X > HostControl.ContentArea.Width - renderAt.X)
{
renderAt.X -= Math.Min (width, LastPopupPos.Value.X);
width = Math.Min (width, LastPopupPos.Value.X);
}
else
{
width = Math.Min (width, HostControl.Bounds.Width - renderAt.X);
width = Math.Min (width, HostControl.ContentArea.Width - renderAt.X);
}
}
}
else
{
// don't overspill horizontally, let's see if can be displayed on the left
if (width > top.Bounds.Width - (renderAt.X + HostControl.Frame.X))
if (width > top.ContentArea.Width - (renderAt.X + HostControl.Frame.X))
{
// Verifies that the left limit available is greater than the right limit
if (renderAt.X + HostControl.Frame.X > top.Bounds.Width - (renderAt.X + HostControl.Frame.X))
if (renderAt.X + HostControl.Frame.X > top.ContentArea.Width - (renderAt.X + HostControl.Frame.X))
{
renderAt.X -= Math.Min (width, LastPopupPos.Value.X);
width = Math.Min (width, LastPopupPos.Value.X);
}
else
{
width = Math.Min (width, top.Bounds.Width - renderAt.X);
width = Math.Min (width, top.ContentArea.Width - renderAt.X);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Terminal.Gui/Text/TextFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public TextAlignment Alignment

/// <summary>Gets or sets whether the <see cref="Size"/> should be automatically changed to fit the <see cref="Text"/>.</summary>
/// <remarks>
/// <para>Used by <see cref="View.AutoSize"/> to resize the view's <see cref="View.Bounds"/> to fit <see cref="Size"/>.</para>
/// <para>Used by <see cref="View.AutoSize"/> to resize the view's <see cref="View.ContentArea"/> to fit <see cref="Size"/>.</para>
/// <para>
/// AutoSize is ignored if <see cref="TextAlignment.Justified"/> and
/// <see cref="VerticalTextAlignment.Justified"/> are used.
Expand Down
16 changes: 12 additions & 4 deletions Terminal.Gui/View/Adornment/Adornment.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace Terminal.Gui;

/// <summary>
/// Adornments are a special form of <see cref="View"/> that appear outside the <see cref="View.Bounds"/>:
/// Adornments are a special form of <see cref="View"/> that appear outside of the <see cref="View.ContentArea"/>:
/// <see cref="Margin"/>, <see cref="Border"/>, and <see cref="Padding"/>. They are defined using the
/// <see cref="Thickness"/> class, which specifies the thickness of the sides of a rectangle.
/// </summary>
Expand Down Expand Up @@ -107,10 +107,18 @@ internal override void LayoutAdornments ()
/// Gets the rectangle that describes the area of the Adornment. The Location is always (0,0).
/// The size is the size of the <see cref="View.Frame"/>.
/// </summary>
public override Rectangle Bounds
public override Rectangle ContentArea
{
get => Frame with { Location = Point.Empty };
set => throw new InvalidOperationException ("It makes no sense to set Bounds of a Thickness.");
set => throw new InvalidOperationException ("It makes no sense to set ContentArea of a Thickness.");
}

/// <summary>
/// Gets the rectangle that describes the inner area of the Adornment. The Location is always (0,0).
/// </summary>
public override Rectangle GetVisibleContentArea ()
{
return ContentArea;
}

/// <inheritdoc/>
Expand Down Expand Up @@ -230,7 +238,7 @@ public override bool Contains (int x, int y)
/// <summary>Called when a mouse event occurs within the Adornment.</summary>
/// <remarks>
/// <para>
/// The coordinates are relative to <see cref="View.Bounds"/>.
/// The coordinates are relative to <see cref="View.ContentArea"/>.
/// </para>
/// <para>
/// A mouse click on the Adornment will cause the Parent to focus.
Expand Down
2 changes: 1 addition & 1 deletion Terminal.Gui/View/Adornment/Padding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public override ColorScheme ColorScheme
/// <summary>Called when a mouse event occurs within the Padding.</summary>
/// <remarks>
/// <para>
/// The coordinates are relative to <see cref="View.Bounds"/>.
/// The coordinates are relative to <see cref="View.ContentArea"/>.
/// </para>
/// <para>
/// A mouse click on the Padding will cause the Parent to focus.
Expand Down
Loading
Loading