
    Cj/                    n    S r SSKJr  SSKJr  SSKJr  SSKJrJ	r	  SSK
Jr  SSKJrJr   " S S	\5      rg
)zO
`ScrollView` is a base class for [Line API](/guide/widgets#line-api) widgets.
    )annotations)RenderableType)EasingFunction)AnimationLevelCallbackType)ScrollableContainer)RegionSizec            
         \ rS rSrSrSrSr\SS j5       r\SS j5       r	SS jr
SS jrS	 rSS
 jrSS jr S         SS jjrSS jr  SSSSSSSSSS.                     SS jjjrSS jrS S!S jjrSrg)"
ScrollView   a  
A base class for a Widget that handles its own scrolling (i.e. doesn't rely
on the compositor to render children).

!!! note

    This is the typically wrong class for making something scrollable. If you want to make something scroll, set its
    `overflow` style to auto or scroll. Or use one of the pre-defined scrolling containers such as [VerticalScroll][textual.containers.VerticalScroll].
TzP
    ScrollView {
        overflow-y: auto;
        overflow-x: auto;
    }
    c                    g)zAlways scrollable.T selfs    e/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/textual/scroll_view.pyis_scrollableScrollView.is_scrollable#   s         c                    g)zhSince a ScrollView should be a line-api widget, it won't have children,
and therefore isn't a container.Fr   r   s    r   is_containerScrollView.is_container(   s     r   c                    U R                   (       a  X R                  l        [        U5      [        U5      :w  a&  U R	                  U R
                  R                  5        g g N)show_horizontal_scrollbarhorizontal_scrollbarpositionroundrefreshsizeregionr   	old_value	new_values      r   watch_scroll_xScrollView.watch_scroll_x.   sD    ))1:%%.uY//LL))* 0r   c                    U R                   (       a  X R                  l        [        U5      [        U5      :w  a&  U R	                  U R
                  R                  5        g g r   )show_vertical_scrollbarvertical_scrollbarr   r   r   r    r!   r"   s      r   watch_scroll_yScrollView.watch_scroll_y4   sD    ''/8##,uY//LL))* 0r   c                $    U R                  5         g r   )_refresh_scrollbarsr   s    r   on_mountScrollView.on_mount:   s      "r   c                .    U R                   R                  $ )zGets the width of the content area.

Args:
    container: Size of the container (immediate parent) widget.
    viewport: Size of the viewport.

Returns:
    The optimal width of the content.
)virtual_sizewidth)r   	containerviewports      r   get_content_widthScrollView.get_content_width=   s       &&&r   c                .    U R                   R                  $ )zGets the height (number of lines) in the content area.

Args:
    container: Size of the container (immediate parent) widget.
    viewport: Size of the viewport.
    width: Width of renderable.

Returns:
    The height of the content.
)r1   height)r   r3   r4   r2   s       r   get_content_heightScrollView.get_content_heightI   s       '''r   c                   U R                   U:g  =n(       a  U R                  5         U(       d  X R                  :w  d  X0R                  :w  ad  U R                  R                  5         Xl         U R                  nXR                  R                  R                  -
  U l	        U R                  U5        U=(       d    U R                  U:g  $ )zCalled when size is updated.

Args:
    size: New size.
    virtual_size: New virtual size.
    container_size: New container size.
    layout: Perform layout if required.

Returns:
    True if a resize event should be sent, otherwise False.
)_size
_set_dirtyr1   container_size_scrollbar_changesclearstylesguttertotals_container_size_scroll_update)r   r    r1   r>   layoutsize_changeds         r   _size_updatedScrollView._size_updatedV   s      ::--<-OO000!4!44##))+J,,L#'++*<*<*C*C#CD -Et33~EEr   c                P    SSK Jn  U" U R                   SU R                   35      $ )zfRender the scrollable region (if `render_lines` is not implemented).

Returns:
    Renderable object.
r   )Panel )
rich.panelrK   scroll_offsetr(   )r   rK   s     r   renderScrollView.renders   s+     	%**+1T-I-I,JKLLr   NFbasic)animatespeeddurationeasingforceon_completelevel	immediatec               2    U R                  UUUUUUUUU	S9	  g)a0  Scroll to a given (absolute) coordinate, optionally animating.

Args:
    x: X coordinate (column) to scroll to, or `None` for no change.
    y: Y coordinate (row) to scroll to, or `None` for no change.
    animate: Animate to new scroll position.
    speed: Speed of scroll if `animate` is `True`; or `None` to use `duration`.
    duration: Duration of animation, if `animate` is `True` and `speed` is `None`.
    easing: An easing method for the scrolling animation.
    force: Force scrolling even when prohibited by overflow styling.
    on_complete: A callable to invoke when the animation is finished.
    level: Minimum level required for the animation to take place (inclusive).
    immediate: If `False` the scroll will be deferred until after a screen refresh,
        set to `True` to scroll immediately.
)rR   rS   rT   rU   rV   rW   rX   N)
_scroll_to)r   xyrR   rS   rT   rU   rV   rW   rX   rY   s              r   	scroll_toScrollView.scroll_to~   s0    < 	# 	 
	
r   c           
         U R                  [        SXR                  R                  -
  [	        U R
                  R                  U R                  R                  5      S5      5        g)z9Refresh a single line.

Args:
    y: Coordinate of line.
r      N)r   r	   rN   r]   maxr1   r2   r    )r   r]   s     r   refresh_lineScrollView.refresh_line   sN     	&&(((D%%++TYY__=		
r   c                    [        SXR                  R                  -
  [        U R                  R
                  U R                  R
                  5      U5      nU R                  U5        g)zxRefresh one or more lines.

Args:
    y_start: First line to refresh.
    line_count: Total number of lines to refresh.
r   N)r	   rN   r]   rb   r1   r2   r    r   )r   y_start
line_countrefresh_regions       r   refresh_linesScrollView.refresh_lines   sR      ((***!!''9	
 	^$r   )rD   r<   )returnbool)r#   floatr$   rm   rk   None)r3   r
   r4   r
   rk   int)r3   r
   r4   r
   r2   ro   rk   ro   )T)
r    r
   r1   r
   r>   r
   rF   rl   rk   rl   )rk   r   )NN)r\   float | Noner]   rp   rR   rl   rS   rp   rT   rp   rU   zEasingFunction | str | NonerV   rl   rW   zCallbackType | NonerX   r   rY   rl   rk   rn   )r]   ro   rk   rn   )ra   )rf   ro   rg   ro   rk   rn   )__name__
__module____qualname____firstlineno____doc__ALLOW_MAXIMIZEDEFAULT_CSSpropertyr   r   r%   r*   r.   r5   r9   rH   rO   r^   rc   ri   __static_attributes__r   r   r   r   r      s>    NK    
++#
'( TXFF(,F>BFLPF	F:M (

 "!%.2+/ '(
(
 (

 (
 (
 (
 ,(
 (
 )(
 (
 (
 
(
T
% %r   r   N)ru   
__future__r   rich.consoler   textual._animatorr   textual._typesr   r   textual.containersr   textual.geometryr	   r
   r   r   r   r   <module>r      s-    # ' , 7 2 )u%$ u%r   