3
ƒènUï  ã               @   sN   d Z ddlmZ ddlmZmZ ddlmZmZ G dd„ deƒZ	e	eej
< dS )	z´
    cairocffi.xcb
    ~~~~~~~~~~~~~

    Bindings for XCB surface objects using xcffib.

    :copyright: Copyright 2014 by Simon Sapin
    :license: BSD, see LICENSE for details.
é    )Úvisualtype_to_c_structé   )ÚcairoÚ	constants)ÚSurfaceÚSURFACE_TYPE_TO_CLASSc               @   s    e Zd ZdZdd„ Zdd„ ZdS )Ú
XCBSurfacea;  The XCB surface is used to render cairo graphics to X Window System
    windows and pixmaps using the XCB library.

    Creates a cairo surface that targets the given drawable (pixmap or window).

    .. note::

        This class works using objects and libraries in :mod:`xcffib`

    :param conn: The :class:`xcffib.Connection` for an open XCB connection
    :param drawable:
        An XID corresponding to an XCB drawable (a pixmap or a window)
    :param visual: An :class:`xcffib.xproto.VISUALTYPE` object.
    :param width: integer
    :param height: integer
    c             C   s,   t |ƒ}tj|j||||ƒ}tj| |ƒ d S )N)r   r   Zcairo_xcb_surface_createZ_connr   Ú__init__)ÚselfZconnZdrawableZvisualÚwidthÚheightZc_visualÚp© r   úM/var/www/html/enquirykeeper_venv/lib/python3.6/site-packages/cairocffi/xcb.pyr	   "   s    zXCBSurface.__init__c             C   s   t j| j||ƒ | jƒ  dS )am  
        Informs cairo of the new size of the X Drawable underlying the surface.
        For a surface created for a Window (rather than a Pixmap), this
        function must be called each time the size of the window changes (for
        a subwindow, you are normally resizing the window yourself, but for a
        toplevel window, it is necessary to listen for
        :class:`xcffib.xproto.ConfigureNotifyEvent`'s).

        A Pixmap can never change size, so it is never necessary to call this
        function on a surface created for a Pixmap.

        :param width: integer
        :param height: integer
        N)r   Zcairo_xcb_surface_set_sizeZ_pointerZ_check_status)r
   r   r   r   r   r   Úset_size)   s    zXCBSurface.set_sizeN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r	   r   r   r   r   r   r      s   r   N)r   Zxcffibr   Ú r   r   Zsurfacesr   r   r   ÚSURFACE_TYPE_XCBr   r   r   r   Ú<module>
   s
   *