a
    §c  ć                   @   s~   d Z ddlZddlmZmZmZmZmZmZ ddl	m
Z
mZ ddlmZ ddlmZ ddlmZ ee
G d	d
 d
eeZdS )z$ Enthought pyface package component
é    N)ŚEventŚPropertyŚTupleŚStrŚVetoableEventŚprovides)ŚIWindowŚMWindow)ŚKeyPressedEventé   )ŚSystemMetrics)ŚWidgetc                       sź   e Zd ZdZeeZeeZe Z	e
 Ze Ze
 Ze
 Ze Ze
 Ze
eZeeZedZedZdd Zdd Z f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d Z dd Z!dd Z"dd Z#dd  Z$  Z%S )!ŚWindowzp The toolkit specific implementation of a Window.  See the IWindow
    interface for the API documentation.
    )é’’’’r   c                 C   s   | j  d” | j  ”  d S )NF)ŚcontrolZIconizeŚRaise©Śself© r   śV/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/pyface/ui/wx/window.pyŚactivateO   s    zWindow.activatec                 C   s   | j  |” d S ©N)r   ŚShow)r   Śvisibler   r   r   ŚshowS   s    zWindow.showc                    sz   t   ”  | j tj| j” | j tj| j” | j tj	| j
” | j tj| j” | j tj| j” | j tj| j” d S r   )ŚsuperŚ_add_event_listenersr   ZBindŚwxZEVT_ACTIVATEŚ_wx_on_activateZEVT_SHOWŚ_wx_on_showZ	EVT_CLOSEŚ_wx_on_closeZEVT_SIZEŚ_wx_on_control_sizeZEVT_MOVEŚ_wx_on_control_moveZEVT_CHARŚ_wx_on_charr   ©Ś	__class__r   r   r   Z   s    
zWindow._add_event_listenersc                 C   sX   t jt jB t jB }t j|d| j|| j| jd}| t	 j
” | | j” | | j” |S )Nr   )ŚstyleŚsizeŚpos)r   ZDEFAULT_FRAME_STYLEZFRAME_NO_WINDOW_MENUZCLIP_CHILDRENZFrameŚtitler'   ŚpositionZSetBackgroundColourr   Zdialog_background_colorZEnableZenabledr   r   )r   Śparentr&   r   r   r   r   Ś_create_controlg   s    ’śzWindow._create_controlc                 C   s   | j S )z Property getter for position. )Ś	_positionr   r   r   r   Ś_get_position   s    zWindow._get_positionc                 C   s4   | j dur| j  |” | j}|| _|  d||” dS )z Property setter for position. Nr*   )r   ZSetPositionr-   Śtrait_property_changed)r   r*   Śoldr   r   r   Ś_set_position   s
    
zWindow._set_positionc                 C   s   | j S )z Property getter for size. )Ś_sizer   r   r   r   Ś	_get_size   s    zWindow._get_sizec                 C   s4   | j dur| j  |” | j}|| _|  d||” dS )z Property setter for size. Nr'   )r   ZSetSizer2   r/   )r   r'   r0   r   r   r   Ś	_set_size   s
    
zWindow._set_sizec                 C   s   | j dur| j  |” dS )z Static trait change handler. N)r   ZSetTitle)r   r)   r   r   r   Ś_title_changed”   s    
zWindow._title_changedc                 C   s"   |  ” r| | _n| | _| ”  dS ©z: Called when the frame is being activated or deactivated. N)Z	GetActiveŚ	activatedŚdeactivatedŚSkip©r   Śeventr   r   r   r   ©   s    zWindow._wx_on_activatec                 C   s   |  ” | _| ”  dS r6   )ZIsShownr   r9   r:   r   r   r   r   ³   s    
zWindow._wx_on_showc                 C   s   |   ”  dS )z( Called when the frame is being closed. N)Ścloser:   r   r   r   r    ŗ   s    zWindow._wx_on_closec                 C   s0   z|  ”  ”  ” | _W n   Y n0 | ”  dS ©z$ Called when the window is resized. N)ZGetEventObjectZGetPositionZGetr-   r9   r:   r   r   r   r"   æ   s    ’zWindow._wx_on_control_movec                 C   s&   |  ” }| ” | ” f| _| ”  dS r=   )ZGetSizeZGetWidthZ	GetHeightr2   r9   )r   r;   Zwxsizer   r   r   r!   Ņ   s    zWindow._wx_on_control_sizec                 C   s(   t |j|j|j|j|d| _| ”  dS )z7 Called when a key is pressed when the tree has focus. )Zalt_downZcontrol_downZ
shift_downZkey_coder;   N)r
   ZaltDownZcontrolDownZ	shiftDownZKeyCodeŚkey_pressedr9   r:   r   r   r   r#   Ż   s    ūzWindow._wx_on_char)&Ś__name__Ś
__module__Ś__qualname__Ś__doc__r   r   r*   r'   r   r)   r   Zopenedr   Zopeningr7   ŚclosedŚclosingr8   r
   r>   r-   r2   r   r   r   r,   r.   r1   r3   r4   r5   r   r   r    r"   r!   r#   Ś__classcell__r   r   r$   r   r      s:   
r   )rB   r   Z
traits.apir   r   r   r   r   r   Zpyface.i_windowr   r	   Zpyface.key_pressed_eventr
   Zsystem_metricsr   Zwidgetr   r   r   r   r   r   Ś<module>
   s    