Ë
    #´˜j	  ã                   ó¢   — d Z ddl­  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«       yy)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
y	)
ÚTooltipBasez abstract base class for tooltipsc                 ó    — || _         d| _        y)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.12/idlelib/tooltip.pyÚ__init__zTooltipBase.__init__   s   € ð +ˆÔØˆ�ó    c                 ó$   — | j                  «        y ©N©Úhidetip©r	   s    r
   Ú__del__zTooltipBase.__del__   s   € Ø�‰�r   c                 ó’  — | j                   ryt        | j                  «      x| _         }|j                  d«       	 |j                  j                  dd|j                  dd«       | j                  «        | j                  «        | j                   j                  «        | j                   j                  «        y# t        $ r Y Œ`w xY w)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¦   € à�>Š>ØÜ& t×'9Ñ'9Ó:Ð:ˆŒ˜à
×Ñ˜qÔ!ð	ð �E‰E�J‰JÐ:¸GÀRÇUÁUØ˜}ô.ð
 	×ÑÔØ×ÑÔØ�‰×'Ñ'Ô)Ø�‰×ÑÕøô ò 	Ùð	ús   ¼)B: Â:	CÃCc                 óÞ   — | j                  «       \  }}| j                  j                  «       |z   }| j                  j                  «       |z   }| j                  j                  d||fz  «       y)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/   sb   € à× Ñ Ó"‰ˆˆ1Ø×#Ñ#×/Ñ/Ó1°AÑ5ˆØ×#Ñ#×/Ñ/Ó1°AÑ5ˆØ�‰×"Ñ" 8¨v°vÐ.>Ñ#>Õ?r   c                 ó@   — d| j                   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°qÑ8Ð8Ð8r   c                 ó   — t         ‚)z$content display hook for sub-classes)ÚNotImplementedErrorr   s    r
   r   zTooltipBase.showcontentsA   s
   € ô "Ð!r   c                 óp   — | j                   }d| _         |r	 |j                  «        yy# t        $ r Y yw xY w©zhide the tooltipN)r   Údestroyr   r"   s     r
   r   zTooltipBase.hidetipF   s>   € ð �^‰^ˆØˆŒÙðØ—
‘
•ð øô ò Ùðús   —) ©	5´5N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r$   r   r'   r   r   © r   r
   r   r   
   s)   „ Ù*òòòò*@ò	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 displayc                 óB  •— t         ‰| �  |«       || _        d| _        | j                  j                  d| j                  «      | _        | j                  j                  d| j                  «      | _	        | j                  j                  d| j                  «      | _
        y)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   rC   Ú	__class__s      €r
   r   zOnHoverTooltipBase.__init__U   s�   ø€ ô 	‰Ñ˜Ô'Ø&ˆÔàˆŒØ×&Ñ&×+Ñ+¨I°t×7GÑ7GÓHˆŒ	Ø×&Ñ&×+Ñ+¨I°t×7GÑ7GÓHˆŒ	Ø×&Ñ&×+Ñ+¨J¸×8HÑ8HÓIˆ�	r   c                 ó&  •— 	 | j                   j                  d| j                  «       | j                   j                  d| j                  «       | j                   j                  d| j                  «       t        ‰| �  «        y # t
        $ r Y Œw xY w)Nr?   r@   rA   )r   ÚunbindrG   rI   rJ   r   rB   r   ©r	   rK   s    €r
   r   zOnHoverTooltipBase.__del__g   sv   ø€ ð	Ø×Ñ×%Ñ% i°·±Ô;Ø×Ñ×%Ñ% i°·±Ô;Ø×Ñ×%Ñ% j°$·)±)Ô<ô 	‰‰Õøô ò 	Ùð	ús   ƒA2B Â	BÂBc                 ó^   — | j                   r| j                  «        y| j                  «        y)z$event handler to display the tooltipN)rC   Úscheduler$   ©r	   Úevents     r
   rF   zOnHoverTooltipBase._show_eventp   s   € à×ÒØ�M‰M�Oà�L‰L�Nr   c                 ó$   — | j                  «        y)z!event handler to hide the tooltipNr   rQ   s     r
   rH   zOnHoverTooltipBase._hide_eventw   s   € à�‰�r   c                 óŽ   — | j                  «        | j                  j                  | j                  | j                  «      | _        y)z*schedule the future display of the tooltipN)Ú
unscheduler   ÚafterrC   r$   rD   r   s    r
   rP   zOnHoverTooltipBase.schedule{   s4   € à�‰ÔØ×+Ñ+×1Ñ1°$×2BÑ2BØ26·,±,ó@ˆ�r   c                 óf   — | j                   }d| _         |r| j                  j                  |«       yy)z(cancel the future display of the tooltipN)rD   r   Úafter_cancel)r	   Úafter_ids     r
   rU   zOnHoverTooltipBase.unschedule�   s.   € à—>‘>ˆØˆŒÙØ×Ñ×+Ñ+¨HÕ5ð r   c                 ób   •— 	 | j                  «        t        ‰| �  «        y# t        $ r Y Œw xY wr5   )rU   r   rB   r   rN   s    €r
   r   zOnHoverTooltipBase.hidetipˆ   s2   ø€ ð	Ø�O‰OÔô 	‰‰Õøô ò 	Ùð	ús   ƒ" ¢	.­.)éè  r   )r7   r8   r9   r:   r   r   rF   rH   rP   rU   r   Ú__classcell__©rK   s   @r
   r=   r=   R   s0   ø„ ÙIõJô$óóò@ò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.c                 óR   •— t         ‰| �  ||¬«       || _        || _        || _        y)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.
        ©rC   N)rB   r   ÚtextÚ
foregroundÚ
background)r	   r   rb   rC   rc   rd   rK   s         €r
   r   zHovertip.__init__“   s,   ø€ ô 	‰Ñ˜°KÐÔ@ØˆŒ	Ø$ˆŒØ$ˆ�r   c           	      ó¨   — t        | j                  | j                  t        t        d| j
                  | j                  ¬«      }|j                  «        y )Nr   )rb   ÚjustifyÚreliefÚborderwidthrc   rd   )ÚLabelr   rb   ÚLEFTÚSOLIDrc   rd   Úpack)r	   Úlabels     r
   r   zHovertip.showcontents£   s8   € Ü�d—n‘n¨4¯9©9¼dÜ#°!Ø"&§/¡/¸d¿o¹oôOˆð 	�
‰
�r   )r[   z#000000z#ffffe0)r7   r8   r9   r:   r   r   r\   r]   s   @r
   r_   r_   ‘   s   ø„ ÙGØ8<Ø2;õ%ö r   r_   c                 óº  — t        | «      }|j                  d«       t        t        | j	                  «       j                  d«      dd  «      \  }}|j	                  d||dz   fz  «       t        |d¬«      }|j                  «        t        |d¬«      }|j                  «        t        |d	d
¬«       t        |d¬«      }|j                  «        t        |dd ¬«       y )NzTest tooltipÚ+r   r&   é–   zPlace your mouse over buttons)rb   z"Button 1 -- 1/2 second hover delayz!This is tooltip text for button1.iô  ra   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°°Ð4Ó5�D€A€qØ‡L�L�˜Q  C¡˜LÑ(Ô)Ü�#Ð;Ô<€EØ	‡J�J„LÜ�SÐCÔD€GØ‡L�L„NÜˆWÐ9ÀsÕKÜ�SÐ;Ô<€GØ‡L�L„NÜˆWÐ:ÈÖ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…      se   ðñô ÷Eñ EôP<˜ô <ô~Ð!ô ò2Nð ˆzÒÝÙÐ	)°Q¸UÕCå+Ùˆ…Mð r   