§
    ”Õ*jG  ã                   óÄ   — d Z ddlT  G d„ d¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Zd	„ Zed
k    r'ddlmZ  eddd¬¦  «         ddl	m
Z
  e
e¦  «         dS dS )zŽTools for displaying tool-tips.

This includes:
 * an abstract base-class for different kinds of tooltips
 * a simple text-only Tooltip class
é    )Ú*c                   ó<   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	S )
ÚTooltipBasez abstract base class for tooltipsc                 ó"   — || _         d| _        dS )z®Create a tooltip.

        anchor_widget: the widget next to which the tooltip will be shown

        Note that a widget will only be shown when showtip() is called.
        N)Úanchor_widgetÚ	tipwindow)Úselfr   s     ú!lib/python3.11/idlelib/tooltip.pyÚ__init__zTooltipBase.__init__   s   € ð +ˆÔØˆŒˆˆó    c                 ó.   — |                       ¦   «          d S ©N©Úhidetip©r	   s    r
   Ú__del__zTooltipBase.__del__   s   € Ø�Š‰Œˆˆˆr   c                 ó–  — | j         rdS t          | j        ¦  «        x| _         }|                     d¦  «         	 |j                             dd|j        dd¦  «         n# t          $ r Y nw xY w|                      ¦   «          |  	                    ¦   «          | j          
                    ¦   «          | j                              ¦   «          dS )zdisplay the tooltipNé   z!::tk::unsupported::MacWindowStyleÚstyleÚhelpÚnoActivates)r   ÚToplevelr   Úwm_overrideredirectÚtkÚcallÚ_wÚTclErrorÚposition_windowÚshowcontentsÚupdate_idletasksÚlift©r	   Útws     r
   ÚshowtipzTooltipBase.showtip   sâ   € àŒ>ð 	ØˆFÝ& tÔ'9Ñ:Ô:Ð:ˆŒ˜à
×Ò˜qÑ!Ô!Ð!ð	ð ŒE�JŠJÐ:¸GÀRÄUØ˜}ñ.ô .ð .ð .øåð 	ð 	ð 	ØˆDð	øøøð 	×ÒÑÔÐØ×ÒÑÔÐØŒ×'Ò'Ñ)Ô)Ð)ØŒ×ÒÑÔÐÐÐs   »#A Á
A,Á+A,c                 óâ   — |                       ¦   «         \  }}| j                             ¦   «         |z   }| j                             ¦   «         |z   }| j                             d||fz  ¦  «         dS )z&(re)-set the tooltip's screen positionú+%d+%dN)Úget_positionr   Úwinfo_rootxÚwinfo_rootyr   Úwm_geometry)r	   ÚxÚyÚroot_xÚroot_ys        r
   r   zTooltipBase.position_window/   so   € à× Ò Ñ"Ô"‰ˆˆ1ØÔ#×/Ò/Ñ1Ô1°AÑ5ˆØÔ#×/Ò/Ñ1Ô1°AÑ5ˆØŒ×"Ò" 8¨v°vÐ.>Ñ#>Ñ?Ô?Ð?Ð?Ð?r   c                 ó>   — d| j                              ¦   «         dz   fS )z(choose a screen position for the tooltipé   r   )r   Úwinfo_heightr   s    r
   r'   zTooltipBase.get_position6   s#   € ð �4Ô%×2Ò2Ñ4Ô4°qÑ8Ð8Ð8r   c                 ó   — t           ‚)z$content display hook for sub-classes)ÚNotImplementedErrorr   s    r
   r   zTooltipBase.showcontentsA   s
   € õ "Ð!r   c                 óv   — | j         }d| _         |r(	 |                     ¦   «          dS # t          $ r Y dS w xY wdS ©zhide the tooltipN)r   Údestroyr   r"   s     r
   r   zTooltipBase.hidetipF   s\   € ð Œ^ˆØˆŒØð 	ðØ—
’
‘”���øÝð ð ð Ø��ðøøøð	ð 	s   ’( ¨
6µ6N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r$   r   r'   r   r   © r   r
   r   r   
   s†   € € € € € Ø*Ð*ðð ð ðð ð ðð ð ð*@ð @ð @ð	9ð 	9ð 	9ð"ð "ð "ð
	ð 	ð 	ð 	ð 	r   r   c                   óT   ‡ — e Zd ZdZdˆ fd„	Zˆ fd„Zdd„Zdd„Zd„ Zd	„ Z	ˆ fd
„Z
ˆ xZS )ÚOnHoverTooltipBasez?abstract base class for tooltips, with delayed on-hover displayéè  c                 óD  •— t          ¦   «                              |¦  «         || _        d| _        | j                             d| j        ¦  «        | _        | j                             d| j        ¦  «        | _	        | j                             d| j        ¦  «        | _
        dS )aq  Create a tooltip with a mouse hover delay.

        anchor_widget: the widget next to which the tooltip will be shown
        hover_delay: time to delay before showing the tooltip, in milliseconds

        Note that a widget will only be shown when showtip() is called,
        e.g. after hovering over the anchor widget with the mouse for enough
        time.
        Nú<Enter>ú<Leave>ú<Button>)Úsuperr   Úhover_delayÚ	_after_idr   ÚbindÚ_show_eventÚ_id1Ú_hide_eventÚ_id2Ú_id3)r	   r   rD   Ú	__class__s      €r
   r   zOnHoverTooltipBase.__init__U   s‡   ø€ õ 	‰Œ×Ò˜Ñ'Ô'Ð'Ø&ˆÔàˆŒØÔ&×+Ò+¨I°tÔ7GÑHÔHˆŒ	ØÔ&×+Ò+¨I°tÔ7GÑHÔHˆŒ	ØÔ&×+Ò+¨J¸Ô8HÑIÔIˆŒ	ˆ	ˆ	r   c                 ó,  •— 	 | j                              d| j        ¦  «         | j                              d| j        ¦  «         | j                              d| j        ¦  «         n# t
          $ r Y nw xY wt          ¦   «                              ¦   «          d S )Nr@   rA   rB   )r   ÚunbindrH   rJ   rK   r   rC   r   ©r	   rL   s    €r
   r   zOnHoverTooltipBase.__del__g   s–   ø€ ð	ØÔ×%Ò% i°´Ñ;Ô;Ð;ØÔ×%Ò% i°´Ñ;Ô;Ð;ØÔ×%Ò% j°$´)Ñ<Ô<Ð<Ð<øÝð 	ð 	ð 	ØˆDð	øøøå‰Œ�ŠÑÔÐÐÐs   ƒA A$ Á$
A1Á0A1Nc                 óh   — | j         r|                      ¦   «          dS |                      ¦   «          dS )z$event handler to display the tooltipN)rD   Úscheduler$   ©r	   Úevents     r
   rG   zOnHoverTooltipBase._show_eventp   s/   € àÔð 	Ø�MŠM‰OŒOˆOˆOˆOà�LŠL‰NŒNˆNˆNˆNr   c                 ó.   — |                       ¦   «          dS )z!event handler to hide the tooltipNr   rR   s     r
   rI   zOnHoverTooltipBase._hide_eventw   s   € à�Š‰Œˆˆˆr   c                 ó‚   — |                       ¦   «          | j                             | j        | j        ¦  «        | _        dS )z*schedule the future display of the tooltipN)Ú
unscheduler   ÚafterrD   r$   rE   r   s    r
   rQ   zOnHoverTooltipBase.schedule{   s<   € à�ŠÑÔÐØÔ+×1Ò1°$Ô2BØ26´,ñ@ô @ˆŒˆˆr   c                 ó^   — | j         }d| _         |r| j                             |¦  «         dS dS )z(cancel the future display of the tooltipN)rE   r   Úafter_cancel)r	   Úafter_ids     r
   rV   zOnHoverTooltipBase.unschedule�   s?   € à”>ˆØˆŒØð 	6ØÔ×+Ò+¨HÑ5Ô5Ð5Ð5Ð5ð	6ð 	6r   c                 ó”   •— 	 |                       ¦   «          n# t          $ r Y nw xY wt          ¦   «                              ¦   «          dS r5   )rV   r   rC   r   rO   s    €r
   r   zOnHoverTooltipBase.hidetipˆ   sU   ø€ ð	Ø�OŠOÑÔÐÐøÝð 	ð 	ð 	ØˆDð	øøøå‰Œ�ŠÑÔÐÐÐs   ƒ ˜
%¤%©r>   r   )r7   r8   r9   r:   r   r   rG   rI   rQ   rV   r   Ú__classcell__©rL   s   @r
   r=   r=   R   sÄ   ø€ € € € € ØIÐIðJð Jð Jð Jð Jð Jð$ð ð ð ð ðð ð ð ðð ð ð ð@ð @ð @ð6ð 6ð 6ðð ð ð ð ð ð ð ð r   r=   c                   ó*   ‡ — e Zd ZdZdˆ fd„	Zd„ Zˆ xZS )ÚHovertipzAA tooltip that pops up when a mouse hovers over an anchor widget.r>   c                 ó\   •— t          ¦   «                              ||¬¦  «         || _        dS )av  Create a text tooltip with a mouse hover delay.

        anchor_widget: the widget next to which the tooltip will be shown
        hover_delay: time to delay before showing the tooltip, in milliseconds

        Note that a widget will only be shown when showtip() is called,
        e.g. after hovering over the anchor widget with the mouse for enough
        time.
        ©rD   N)rC   r   Útext)r	   r   rc   rD   rL   s       €r
   r   zHovertip.__init__“   s-   ø€ õ 	‰Œ×Ò˜°KÐÑ@Ô@Ð@ØˆŒ	ˆ	ˆ	r   c                 ó€   — t          | j        | j        t          dt          d¬¦  «        }|                     ¦   «          d S )Nz#ffffe0r   )rc   ÚjustifyÚ
backgroundÚreliefÚborderwidth)ÚLabelr   rc   ÚLEFTÚSOLIDÚpack)r	   Úlabels     r
   r   zHovertip.showcontents    s;   € Ý�d”n¨4¬9½dØ!*µ5ÀaðIñ Iô Iˆà�
Š
‰Œˆˆˆr   r\   )r7   r8   r9   r:   r   r   r]   r^   s   @r
   r`   r`   ‘   sR   ø€ € € € € ØGÐGðð ð ð ð ð ðð ð ð ð ð ð r   r`   c                 ó8  — t          | ¦  «        }|                     d¦  «         t          t          |                      ¦   «                              d¦  «        dd …         ¦  «        \  }}|                     d||dz   fz  ¦  «         t          |d¬¦  «        }|                     ¦   «          t          |d¬¦  «        }|                     ¦   «          t          |d	d
¬¦  «         t          |d¬¦  «        }|                     ¦   «          t          |dd ¬¦  «         d S )NzTest tooltipú+r   r&   é–   zPlace your mouse over buttons)rc   z"Button 1 -- 1/2 second hover delayz!This is tooltip text for button1.iô  rb   zButton 2 -- no hover delayz!This is tooltip
text for button2.)
r   ÚtitleÚmapÚintÚgeometryÚsplitri   rl   ÚButtonr`   )ÚparentÚtopr+   r,   rm   Úbutton1Úbutton2s          r
   Ú_tooltipr{   ¦   s  € Ý
�6Ñ
Ô
€CØ‡I‚IˆnÑÔÐÝ�s�F—O’OÑ%Ô%×+Ò+¨CÑ0Ô0°°°Ô4Ñ5Ô5�D€A€qØ‡L‚L�˜Q  C¡˜LÑ(Ñ)Ô)Ð)Ý�#Ð;Ð<Ñ<Ô<€EØ	‡J‚J�L„L€LÝ�SÐCÐDÑDÔD€GØ‡L‚L�N„N€NÝˆWÐ9ÀsÐKÑKÔKÐKÝ�SÐ;Ð<Ñ<Ô<€GØ‡L‚L�N„N€NÝˆWÐ:ÈÐMÑMÔMÐMÐMÐMr   Ú__main__)Úmainzidlelib.idle_test.test_tooltipé   F)Ú	verbosityÚexit)ÚrunN)r:   Útkinterr   r=   r`   r{   r7   Úunittestr}   Úidlelib.idle_test.htestr�   r;   r   r
   ú<module>r…      s  ððð ð Ð Ð Ð ðEð Eð Eð Eð Eñ Eô Eð EðP<ð <ð <ð <ð <˜ñ <ô <ð <ð~ð ð ð ð Ð!ñ ô ð ð*Nð Nð Nð ˆzÒÐØÐÐÐÐÐØ€DÐ	)°Q¸UÐCÑCÔCÐCà+Ð+Ð+Ð+Ð+Ð+Ø€Cˆ�M„M€M€M€Mð Ðr   