
    ^jq                    L    d Z ddlmZ  G d d          Zdd	Zd
ZdZdZdZdZ	dS )z0Mouse constants and utilities for pyglet.window.    )annotationsc                  R    e Zd ZdZddZdd
ZddZddZddZddZ	ddZ
ddZdS )MouseStateHandlera8  Simple handler that tracks the state of buttons and coordinates from the mouse.

    If a button is pressed then this handler holds a ``True`` value for it.
    If the window loses focus, all values will be reset to ``False`` in order
    to avoid a "sticky" state.

    For example::

        >>> win = window.Window()
        >>> mouse_state = mouse.MouseStateHandler()
        >>> win.push_handlers(mouse_state)

        # Hold down the "left" button...

        >>> mouse_state[mouse.LEFT]
        True
        >>> mouse_state[mouse.RIGHT]
        False


    Mouse coordinates can be retrieved by using the ``'x'`` and ``'y'`` strings
    or by using ``'mouse_state.x'`` and ``'mouse_state.y`` attributes.

    For example::

        >>> win = window.Window()
        >>> mouse_state = mouse.MouseStateHandler()
        >>> win.push_handlers(mouse_state)

        # Move the mouse around...

        >>> mouse_state['x']
        20
        >>> mouse_state['y']
        50
        
        # Or...
        >>> mouse_state.x
        20
        >>> mouse_state.y
        50
    returnNonec                    ddd| _         d S )Nr   )xydataselfs    N/home/agentuser/manim-venv/lib/python3.11/site-packages/pyglet/window/mouse.py__init__zMouseStateHandler.__init__1   s    
 
			    r	   intr
   button	modifiersc                    d| j         |<   d S )NTr   r   r	   r
   r   r   s        r   on_mouse_pressz MouseStateHandler.on_mouse_press7   s     	&r   c                    d| j         |<   d S NFr   r   s        r   on_mouse_releasez"MouseStateHandler.on_mouse_release:   s    !	&r   c                8    | j                                          d S N)r   clearr   s    r   on_deactivatezMouseStateHandler.on_deactivate=   s    	r   dxdyc                .    || j         d<   || j         d<   d S Nr	   r
   r   )r   r	   r
   r   r    s        r   on_mouse_motionz!MouseStateHandler.on_mouse_motion@       	#	#r   buttonsc                .    || j         d<   || j         d<   d S r"   r   )r   r	   r
   r   r    r%   r   s          r   on_mouse_dragzMouseStateHandler.on_mouse_dragD   r$   r   keystr
int | boolc                8    | j                             |d          S r   )r   get)r   r(   s     r   __getitem__zMouseStateHandler.__getitem__H   s    y}}S%(((r   itemc                    | j         |         S r   r   )r   r.   s     r   __getattr__zMouseStateHandler.__getattr__K   s    yr   N)r   r   )
r	   r   r
   r   r   r   r   r   r   r   )
r	   r   r
   r   r   r   r    r   r   r   )r	   r   r
   r   r   r   r    r   r%   r   r   r   r   r   )r(   r)   r   r*   )r.   r)   r   r   )__name__
__module____qualname____doc__r   r   r   r   r#   r'   r-   r0    r   r   r   r      s        ) )V
 
 
 
! ! ! !" " " "         ) ) ) )     r   r   r%   r   r   r)   c                f   g }| t           z  r|                    d           | t          z  r|                    d           | t          z  r|                    d           | t          z  r|                    d           | t
          z  r|                    d           d                    |          S )zReturn a string describing a set of active mouse buttons.

    Example::

        >>> buttons_string(LEFT | RIGHT)
        'LEFT|RIGHT'

    Args:
        buttons:
            Bitwise combination of mouse button constants.
    LEFTMIDDLERIGHTMOUSE4MOUSE5|)r7   appendr8   r9   r:   r;   join)r%   button_namess     r   buttons_stringr@   O   s     L~ $F### &H%%% %G$$$ &H%%% &H%%%88L!!!r                  N)r%   r   r   r)   )
r4   
__future__r   r   r@   r7   r8   r9   r:   r;   r5   r   r   <module>rG      s    6 6 " " " " " "G G G G G G G GT" " " ":  
 	 
 
r   