
    3j1                     >    S r SSKrSSKrSSKJrJr   " S S\5      rg)z.Base class for GLU callback-caching structures    N)longinteger_typesc                   R    \ rS rSrSrS r\" \5      rSrSr	Sr
S rS rS rS rS	rg)
	GLUStruct   a  Mix-in class for GLU Structures that want to retain references to callbacks

Also provides original-object-return for the "datapointer" style paremters

Each sub-class must override:
    CALLBACK_TYPES -- maps a "which" constant to a function type 
    CALLBACK_FUNCTION_REGISTRARS -- maps a "which" constant to the 
        registration function for functions of that type
    WRAPPER_METHODS -- maps a "which" consant to a method of the structure 
        that produces a callable around the function which takes care of 
        input/output arguments, data conversions, error handling and the 
        like.
Creates a dictionary member dataPointers if original-object-return is used
Creates a dictionary member callbacks if callback registration is used
c                 .    [         R                  " U 5      $ )z4Gets as a ctypes pointer to the underlying structure)ctypespointer)selfs    N/home/wildlama/miniconda3/lib/python3.13/site-packages/OpenGL/GLU/glustruct.py
getAsParamGLUStruct.getAsParam   s    ~~t%%    Nc                 z    [        U5      n XR                  U'   U$ ! [         a  nX!0U l         SnAU$ SnAff = f)zNote object for later retrieval as a Python object pointer

This is the registration point for "original object return", returns 
a void pointer to the Python object, though this is, effectively, an 
opaque value.
N)iddataPointersAttributeError)r   objectidentityerrs       r   
noteObjectGLUStruct.noteObject   sL     f:	5,2x)   	5"* 4D	5s    
:5:c                     [        U[        5      (       a  UnOUc  g UR                  n U R                  U   $ ! [         a  nUS   n SnAN$SnAff = f! [
        [        4 a  nUs SnA$ SnAff = f)z<Given a void-pointer, try to find our original Python objectNr   )
isinstancer   valuer   r   KeyError)r   voidPointerr   r   s       r   originalObjectGLUStruct.originalObject*   sz    {M22"H *&,,	$$h00 " *&q>* ( 		s2   : A 
AAAA2&A-'A2-A2c                    U R                   R                  U5      nU(       d  [        SU< 35      eU R                  R                  U5      nUb  [	        X5      " U5      nU" U5      n U R
                  U   " XU5        [	        U SS5      c  0 U l	        XPR                  U'   U$ ! [        R                   a  nU=R                  X4-  sl        e SnAff = f)z-Register a callback for this structure objectz*Don't have a registered callback type for N	callbacks)
CALLBACK_TYPESget
ValueErrorWRAPPER_METHODSgetattrCALLBACK_FUNCTION_REGISTRARSr	   ArgumentErrorargsr!   )r   whichfunctioncallbackTypewrapperMethod	cCallbackr   s          r   addCallbackGLUStruct.addCallback9   s    **..7 
 ,,00%9$t2H>H (,		--e4d9N D+t-5DN"+ ## 	HH))H	s   *B% %C9CCc                 Z    UR                  U45      n[        U5       H	  nX   XE'   M     U$ )z8Copy length values from ptr into new array of given type)zerosrange)r   ptrlengthtyperesultis         r   
ptrAsArrayGLUStruct.ptrAsArrayR   s.    fY(vAFI r   )r!   r   )__name__
__module____qualname____firstlineno____doc__r   property_as_parameter_r"   r'   r%   r   r   r/   r9   __static_attributes__ r   r   r   r      s<    & z+NN#' O2r   r   )r?   r	   weakrefOpenGL._bytesr   r   r   r   rC   r   r   <module>rF      s    4   -Q Qr   