def create_combobox ( self, parent, editable = False ): """ Returns an adapted wx.Choice or wx.ComboBox control. """ if editable: return control_adapter( wx.ComboBox( as_toolkit_control( parent ), -1, '', wx.Point( 0, 0 ), wx.Size( -1, -1 ), [], style = wx.CB_DROPDOWN ) ) return control_adapter( wx.Choice( as_toolkit_control( parent ), -1, wx.Point( 0, 0 ), wx.Size( -1, -1 ), [] ) )
def create_separator ( self, parent, is_vertical = True ): """ Returns an adapted separator line control. """ return control_adapter( wx.StaticLine( as_toolkit_control( parent ), -1, style = separator_map[ is_vertical ] ) )
def create_label ( self, parent, label = '', align = 'left' ): """ Returns an adapted label control. """ return control_adapter( wx.StaticText( as_toolkit_control( parent ), -1, label, style = horizontal_alignment_styles[ align ] ) )
def create_text_input ( self, parent, read_only = False, password = False, handle_enter = False, multi_line = False, align = 'left' ): """ Returns an adapted single or mutli line text input control. """ style = input_horizontal_alignment_styles[ align ] if read_only: style |= wx.TE_READONLY if password: style |= wx.TE_PASSWORD if handle_enter: style |= wx.TE_PROCESS_ENTER if multi_line: style |= wx.TE_MULTILINE if read_only and multi_line: style |= wx.NO_BORDER return control_adapter( wx.TextCtrl( as_toolkit_control( parent ), -1, '', style = style ) )
def create_scrolled_panel ( self, parent ): """ Returns a panel that can scroll its contents. """ tuisp = FacetsUIScrolledPanel( as_toolkit_control( parent ) ) tuisp.SetScrollRate( 1, 1 ) return control_adapter( tuisp )
def create_panel ( self, parent ): """ Returns an adapted panel control. """ return control_adapter( FacetsUIPanel( as_toolkit_control( parent ), -1, style = wx.CLIP_CHILDREN ) )
def as_toolkit_adapter ( self, control ): """ Returns the GUI toolkit specific control adapter associated with *control*. """ if ((control is None) or isinstance( control, ( Control, tuple ) )): return control return control_adapter( control )
def create_control ( self, parent, tab_stop = False, handle_keys = False ): """ Returns an adapted control suitable for use as a base for creating custom controls. """ style = wx.FULL_REPAINT_ON_RESIZE if tab_stop: style |= wx.TAB_TRAVERSAL if handle_keys: style |= wx.WANTS_CHARS control = WxControl( as_toolkit_control( parent ), -1, style = style ) control.accepts_focus = tab_stop or handle_keys return control_adapter( control )
def create_frame ( self, parent, style, title = '' ): """ Returns an adapted top-level window frame/dialog control. The *style* parameter is a set containing values from the following list: - 'frame': The result should be a normal top-level window. - 'dialog': The result should be a dialog window. - 'resizable': The window should have a resize border. - 'simple': The window should have a simple border. - 'none': The window should not have any border. - 'min_max': The window should have minimize/maximize buttons. - 'float': The window should float on top of its parent. - 'no_taskbar': The window should not appear on the system taskbar. """ flags = (wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX) if 'frame' in style: flags |= (wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX | wx.RESIZE_BORDER) elif 'min_max' in style: flags |= (wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX) if 'resizable' in style: flags |= wx.RESIZE_BORDER elif 'simple' in style: flags = wx.SIMPLE_BORDER elif 'none' in style: flags = wx.BORDER_NONE if 'float' in style: flags |= wx.FRAME_FLOAT_ON_PARENT if 'no_taskbar' in style: flags |= wx.FRAME_NO_TASKBAR klass = wx.Dialog if 'dialog' not in style: klass = wx.Frame flags |= wx.CLIP_CHILDREN return control_adapter( klass( as_toolkit_control( parent ), -1, title, style = flags ) )
def create_checkbox ( self, parent, label = '' ): """ Returns an adapted checkbox control. """ return control_adapter( wx.CheckBox( as_toolkit_control( parent ), -1, label ) )
def create_button ( self, parent, label = '' ): """ Returns an adapted button. """ return control_adapter( wx.Button( as_toolkit_control( parent ), -1, label ) )