<s> import wx <EOL> from atom . api import Typed <EOL> from enaml . widgets . widget import ProxyWidget <EOL> from . wx_layout_request import wxEvtLayoutRequested <EOL> from . wx_resource_helpers import get_cached_wxcolor , get_cached_wxfont <EOL> from . wx_toolkit_object import WxToolkitObject <EOL> class WxWidget ( WxToolkitObject , ProxyWidget ) : <EOL> """<STR_LIT>""" <EOL> widget = Typed ( wx . Window ) <EOL> def create_widget ( self ) : <EOL> """<STR_LIT>""" <EOL> self . widget = wx . Window ( self . parent_widget ( ) ) <EOL> def init_widget ( self ) : <EOL> """<STR_LIT>""" <EOL> super ( WxWidget , self ) . init_widget ( ) <EOL> d = self . declaration <EOL> if d . background : <EOL> self . set_background ( d . background ) <EOL> if d . foreground : <EOL> self . set_foreground ( d . foreground ) <EOL> if d . font : <EOL> self . set_font ( d . font ) <EOL> if - <NUM_LIT:1> not in d . minimum_size : <EOL> self . set_minimum_size ( d . minimum_size ) <EOL> if - <NUM_LIT:1> not in d . maximum_size : <EOL> self . set_maximum_size ( d . maximum_size ) <EOL> if d . tool_tip : <EOL> self . set_tool_tip ( d . tool_tip ) <EOL> if d . status_tip : <EOL> self . set_status_tip ( d . status_tip ) <EOL> self . set_enabled ( d . enabled ) <EOL> self . set_visible ( d . visible ) <EOL> def update_geometry ( self ) : <EOL> """<STR_LIT>""" <EOL> widget = self . widget <EOL> if widget : <EOL> parent = widget . GetParent ( ) <EOL> if parent : <EOL> event = wxEvtLayoutRequested ( widget . GetId ( ) ) <EOL> wx . PostEvent ( parent , event ) <EOL> def set_minimum_size ( self , min_size ) : <EOL> """<STR_LIT>""" <EOL> self . widget . SetMinSize ( wx . Size ( * min_size ) ) <EOL> def set_maximum_size ( self , max_size ) : <EOL> """<STR_LIT>""" <EOL> self . widget . SetMaxSize ( wx . Size ( * max_size ) ) <EOL> def set_enabled ( self , enabled ) : <EOL> """<STR_LIT>""" <EOL> self . widget . Enable ( enabled ) <EOL> def set_visible ( self , visible ) : <EOL> """<STR_LIT>""" <EOL> self . widget . Show ( visible ) <EOL> def set_background ( self , background ) : <EOL> """<STR_LIT>""" <EOL> if background is None : <EOL> wxcolor = wx . NullColour <EOL> else : <EOL> wxcolor = get_cached_wxcolor ( background ) <EOL> widget = self . widget <EOL> widget . SetBackgroundColour ( wxcolor ) <EOL> widget . Refresh ( ) <EOL> def set_foreground ( self , foreground ) : <EOL> """<STR_LIT>""" <EOL> if foreground is None : <EOL> wxcolor = wx . NullColour <EOL> else : <EOL> wxcolor = get_cached_wxcolor ( foreground ) <EOL> widget = self . widget <EOL> widget . SetForegroundColour ( wxcolor ) <EOL> widget . Refresh ( ) <EOL> def set_font ( self , font ) : <EOL> """<STR_LIT>""" <EOL> wxfont = get_cached_wxfont ( font ) <EOL> widget = self . widget <EOL> widget . SetFont ( wxfont ) <EOL> widget . Refresh ( ) <EOL> def set_show_focus_rect ( self , show ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def set_tool_tip ( self , tool_tip ) : <EOL> """<STR_LIT>""" <EOL> self . widget . SetToolTipString ( tool_tip ) <EOL> def set_status_tip ( self , status_tip ) : <EOL> """<STR_LIT>""" <EOL> pass <EOL> def ensure_visible ( self ) : <EOL> """<STR_LIT>""" <EOL> self . widget . Show ( True ) <EOL> def ensure_hidden ( self ) : <EOL> """<STR_LIT>""" <EOL> self . widget . Show ( False ) </s>
