
    R                     :    S r SSKJr  Sr " S S\5      rS rS rg)	zo
Layout dimensions are used to give the minimum, maximum and preferred
dimensions for containers and controls.
    )unicode_literals)LayoutDimensionsum_layout_dimensionsmax_layout_dimensionsc                   >    \ rS rSrSrS	S jr\S 5       rS rS r	Sr
g)
r      a  
Specified dimension (width/height) of a user control or window.

The layout engine tries to honor the preferred size. If that is not
possible, because the terminal is larger or smaller, it tries to keep in
between min and max.

:param min: Minimum size.
:param max: Maximum size.
:param weight: For a VSplit/HSplit, the actual size will be determined
               by taking the proportion of weights from all the children.
               E.g. When there are two children, one width a weight of 1,
               and the other with a weight of 2. The second will always be
               twice as big as the first, if the min/max values allow it.
:param preferred: Preferred size.
Nc                 p   [        U[        5      (       a  US:  d   eUS LU l        US LU l        US LU l        Uc  SnUc  SnUc  UnXl        X l        X@l        X0l        U R                  U R
                  :  a  U R
                  U l        U R                  U R                  :  a  U R                  U l        g g )Nr   l       73Me')	
isinstanceintmin_specifiedmax_specifiedpreferred_specifiedminmax	preferredweight)selfr   r   r   r   s        2lib/third_party/prompt_toolkit/layout/dimension.py__init__LayoutDimension.__init__   s    &#&&6A:55 _ _#,D#8 ;C;CI" >>DHH$!XXDN>>DHH$!XXDN %    c                     U " XUS9$ )zd
Return a :class:`.LayoutDimension` with an exact size. (min, max and
preferred set to ``amount``).
r   r   r    )clsamounts     r   exactLayoutDimension.exact9   s     vV<<r   c           	      x    SU R                   < SU R                  < SU R                  < SU R                  < S3	$ )NzLayoutDimension(min=z, max=z, preferred=z	, weight=))r   r   r   r   )r   s    r   __repr__LayoutDimension.__repr__A   s%    HHdhh= 	=r   c                     [        X/5      $ )N)r   )r   others     r   __add__LayoutDimension.__add__E   s    $d]33r   )r   r   r   r   r   r   r   )NN   N)__name__
__module____qualname____firstlineno____doc__r   classmethodr   r!   r%   __static_attributes__r   r   r   r   r      s*     &4 = ==4r   r   c                 N   [        U  Vs/ s H  oR                  c  M  UR                  PM     sn5      n[        U  Vs/ s H  oR                  c  M  UR                  PM     sn5      n[        U  Vs/ s H  oR                  PM     sn5      n[	        X#US9$ s  snf s  snf s  snf )z4
Sum a list of :class:`.LayoutDimension` instances.
r   )sumr   r   r   r   )
dimensionsdr   r   r   s        r   r   r   I   s}     j>jEEuquuj>
?C
j>jEEuquuj>
?C*5*Q[[*56IsyAA	 ?>5   BBBB2B"c                 N   [        U  Vs/ s H  oR                  c  M  UR                  PM     sn5      n[        U  Vs/ s H  oR                   c  M  UR                   PM     sn5      n[        U  Vs/ s H  oR                  PM     sn5      n[        X#US9$ s  snf s  snf s  snf )zD
Take the maximum of a list of :class:`.LayoutDimension` instances.
r   )r   r   r   r   )r1   r2   min_max_r   s        r   r   r   T   s~     z?z!UUz?@Dz?z!UUz?@D*5*Q[[*56ItCC	 @?5r3   N)r,   
__future__r   __all__objectr   r   r   r   r   r   <module>r:      s/    (84f 84vBDr   