@@ -30,6 +30,10 @@ namespace SharpConsoleUI.Controls
3030 /// </summary>
3131 public class DropdownControl : IWindowControl , IInteractiveControl , IFocusableControl , IMouseAwareControl , IDOMPaintable
3232 {
33+ private int _actualX ;
34+ private int _actualY ;
35+ private int _actualWidth ;
36+ private int _actualHeight ;
3337 private readonly TimeSpan _searchResetDelay = TimeSpan . FromSeconds ( 1.5 ) ;
3438 private HorizontalAlignment _horizontalAlignment = HorizontalAlignment . Left ;
3539 private VerticalAlignment _verticalAlignment = VerticalAlignment . Top ;
@@ -184,7 +188,7 @@ public DropdownControl(string prompt)
184188 /// Gets the actual rendered height of the control based on cached content.
185189 /// </summary>
186190 /// <returns>The total number of lines including header, items, and margins, or null if not rendered.</returns>
187- public int ? ActualHeight
191+ public int ? ContentHeight
188192 {
189193 get
190194 {
@@ -198,7 +202,7 @@ public int? ActualHeight
198202 /// Gets the actual rendered width of the control based on cached content.
199203 /// </summary>
200204 /// <returns>The maximum line width in characters, or null if content has not been rendered.</returns>
201- public int ? ActualWidth
205+ public int ? ContentWidth
202206 {
203207 get
204208 {
@@ -217,6 +221,11 @@ public int? ActualWidth
217221 }
218222 }
219223
224+ public int ActualX => _actualX ;
225+ public int ActualY => _actualY ;
226+ public int ActualWidth => _actualWidth ;
227+ public int ActualHeight => _actualHeight ;
228+
220229 /// <inheritdoc/>
221230 public HorizontalAlignment HorizontalAlignment
222231 { get => _horizontalAlignment ; set { _horizontalAlignment = value ; Container ? . Invalidate ( true ) ; } }
@@ -662,8 +671,8 @@ public void Dispose()
662671 /// <inheritdoc/>
663672 public System . Drawing . Size GetLogicalContentSize ( )
664673 {
665- int width = ActualWidth ?? 0 ;
666- int height = ActualHeight ?? 1 ;
674+ int width = ContentWidth ?? 0 ;
675+ int height = ContentHeight ?? 1 ;
667676 return new System . Drawing . Size ( width , height ) ;
668677 }
669678
@@ -1116,6 +1125,11 @@ public LayoutSize MeasureDOM(LayoutConstraints constraints)
11161125 /// <inheritdoc/>
11171126 public void PaintDOM ( CharacterBuffer buffer , LayoutRect bounds , LayoutRect clipRect , Color defaultFg , Color defaultBg )
11181127 {
1128+ _actualX = bounds . X ;
1129+ _actualY = bounds . Y ;
1130+ _actualWidth = bounds . Width ;
1131+ _actualHeight = bounds . Height ;
1132+
11191133 // Store bounds for portal positioning
11201134 _lastLayoutBounds = bounds ;
11211135
@@ -1745,6 +1759,10 @@ public DropdownItem(string text, string? icon = null, Color? iconColor = null)
17451759 /// </summary>
17461760 internal class DropdownPortalContent : IWindowControl , IDOMPaintable , IMouseAwareControl
17471761 {
1762+ private int _actualX ;
1763+ private int _actualY ;
1764+ private int _actualWidth ;
1765+ private int _actualHeight ;
17481766 private readonly DropdownControl _owner ;
17491767
17501768 public DropdownPortalContent ( DropdownControl owner )
@@ -1787,8 +1805,14 @@ public bool ProcessMouseEvent(MouseEventArgs args)
17871805
17881806 #region IWindowControl Implementation
17891807
1790- public int ? ActualWidth => _owner . GetPortalBounds ( ) . Width ;
1791- public int ? ActualHeight => _owner . GetPortalBounds ( ) . Height ;
1808+ public int ? ContentWidth => _owner . GetPortalBounds ( ) . Width ;
1809+ public int ? ContentHeight => _owner . GetPortalBounds ( ) . Height ;
1810+
1811+ public int ActualX => _actualX ;
1812+ public int ActualY => _actualY ;
1813+ public int ActualWidth => _actualWidth ;
1814+ public int ActualHeight => _actualHeight ;
1815+
17921816 public HorizontalAlignment HorizontalAlignment { get ; set ; } = HorizontalAlignment . Left ;
17931817 public VerticalAlignment VerticalAlignment { get ; set ; } = VerticalAlignment . Top ;
17941818 public IContainer ? Container { get ; set ; }
@@ -1836,6 +1860,11 @@ public LayoutSize MeasureDOM(LayoutConstraints constraints)
18361860 public void PaintDOM ( CharacterBuffer buffer , LayoutRect bounds , LayoutRect clipRect ,
18371861 Color defaultFg , Color defaultBg )
18381862 {
1863+ _actualX = bounds . X ;
1864+ _actualY = bounds . Y ;
1865+ _actualWidth = bounds . Width ;
1866+ _actualHeight = bounds . Height ;
1867+
18391868 _owner . PaintDropdownListInternal ( buffer , clipRect ) ;
18401869 }
18411870
0 commit comments