1 /////////////////////////////////////////////////////////////////////////////
 
   3 // Purpose:     SWIG interface defs for wxComboBox
 
   7 // Created:     10-June-1998
 
   9 // Copyright:   (c) 2003 by Total Control Software
 
  10 // Licence:     wxWindows license
 
  11 /////////////////////////////////////////////////////////////////////////////
 
  16 //---------------------------------------------------------------------------
 
  18 MAKE_CONST_WXSTRING(ComboBoxNameStr);
 
  20 //---------------------------------------------------------------------------
 
  25 "A combobox is like a combination of an edit control and a
 
  26 listbox. It can be displayed as static list with editable or
 
  27 read-only text field; or a drop-down list with text field.
 
  29 A combobox permits a single selection only. Combobox items are
 
  30 numbered from zero.", "
 
  34     ================    ===============================================
 
  35     wx.CB_SIMPLE        Creates a combobox with a permanently
 
  36                         displayed list.  Windows only.
 
  38     wx.CB_DROPDOWN      Creates a combobox with a drop-down list.
 
  40     wx.CB_READONLY      Same as wxCB_DROPDOWN but only the strings
 
  41                         specified as the combobox choices can be
 
  42                         selected, it is impossible to select
 
  43                         (even from a program) a string which is
 
  44                         not in the choices list.
 
  46     wx.CB_SORT          Sorts the entries in the list alphabetically.
 
  47     ================    ===============================================
 
  51     ================    ===============================================
 
  52     EVT_COMBOBOX        Sent when an item on the list is selected.
 
  53                         Note that calling `GetValue` in this handler 
 
  54                         will return the newly selected value.
 
  55     EVT_TEXT            Sent when the combobox text changes.
 
  56     EVT_TEXT_ENTER      Sent when the RETURN/ENTER key is pressed in
 
  58     ================    ===============================================
 
  63 MustHaveApp(wxComboBox);
 
  66 class wxComboBox : public wxChoice
 
  68 class wxComboBox : public wxControl, public wxItemContainer
 
  72     %pythonAppend wxComboBox         "self._setOORInfo(self)"
 
  73     %pythonAppend wxComboBox()       ""
 
  76         wxComboBox(wxWindow* parent, wxWindowID id=-1,
 
  77                    const wxString& value = wxPyEmptyString,
 
  78                    const wxPoint& pos = wxDefaultPosition,
 
  79                    const wxSize& size = wxDefaultSize,
 
  80                    const wxArrayString& choices = wxPyEmptyStringArray,
 
  82                    const wxValidator& validator = wxDefaultValidator,
 
  83                    const wxString& name = wxPyComboBoxNameStr),
 
  84         "__init__(Window parent, int id, String value=EmptyString,
 
  85     Point pos=DefaultPosition, Size size=DefaultSize,
 
  86     List choices=[], long style=0, Validator validator=DefaultValidator,
 
  87     String name=ComboBoxNameStr) -> ComboBox",
 
  88         "Constructor, creates and shows a ComboBox control.", "");
 
  92         "Precreate a ComboBox control for 2-phase creation.", "",
 
  97         bool, Create(wxWindow *parent, wxWindowID id=-1,
 
  98                      const wxString& value = wxPyEmptyString,
 
  99                      const wxPoint& pos = wxDefaultPosition,
 
 100                      const wxSize& size = wxDefaultSize,
 
 101                      const wxArrayString& choices = wxPyEmptyStringArray,
 
 103                      const wxValidator& validator = wxDefaultValidator,
 
 104                      const wxString& name = wxPyChoiceNameStr),
 
 105         "Create(Window parent, int id, String value=EmptyString,
 
 106     Point pos=DefaultPosition, Size size=DefaultSize,
 
 107     List choices=[], long style=0, Validator validator=DefaultValidator,
 
 108     String name=ChoiceNameStr) -> bool",
 
 109         "Actually create the GUI wxComboBox control for 2-phase creation", "");
 
 113         virtual wxString , GetValue() const,
 
 114         "Returns the current value in the combobox text field.", "");
 
 117         virtual void , SetValue(const wxString& value),
 
 122         virtual void , Copy(),
 
 123         "Copies the selected text to the clipboard.", "");
 
 126         virtual void , Cut(),
 
 127         "Copies the selected text to the clipboard and removes the selection.", "");
 
 130         virtual void , Paste(),
 
 131         "Pastes text from the clipboard to the text field.", "");
 
 135         virtual void , SetInsertionPoint(long pos),
 
 136         "Sets the insertion point in the combobox text field.", "");
 
 139         virtual long , GetInsertionPoint() const,
 
 140         "Returns the insertion point for the combobox's text field.", "");
 
 143         virtual long , GetLastPosition() const,
 
 144         "Returns the last position in the combobox text field.", "");
 
 147         virtual void , Replace(long from, long to, const wxString& value),
 
 148         "Replaces the text between two positions with the given text, in the
 
 149 combobox text field.", "");
 
 152         void , SetSelection(int n),
 
 153         "Sets the item at index 'n' to be the selected item.", "");
 
 156         virtual void , SetSelection(long from, long to),
 
 157         "Selects the text between the two positions in the combobox text field.", "",
 
 162         virtual void , GetSelection(long* OUTPUT, long* OUTPUT),
 
 163         "GetMark(self) -> (from, to)",
 
 164         "Gets the positions of the begining and ending of the selection mark in
 
 165 the combobox text field.", "",
 
 170         bool , SetStringSelection(const wxString& string),
 
 171         "Select the item with the specifed string", "");
 
 174         void , SetString(int n, const wxString& string),
 
 175         "Set the label for the n'th item (zero based) in the list.", "");
 
 178         virtual void , SetEditable(bool editable),
 
 183         virtual void , SetInsertionPointEnd(),
 
 184         "Sets the insertion point at the end of the combobox text field.", "");
 
 187         virtual void , Remove(long from, long to),
 
 188         "Removes the text between the two positions in the combobox text field.", "");
 
 193         bool , IsEditable() const,
 
 194         "Returns True if the combo is ediatable (not read-only.)", "");
 
 199         "Redoes the last undo in the text field. Windows only.", "");
 
 203         "Undoes the last edit in the text field. Windows only.", "");
 
 207         "Select all the text in the combo's text field.", "");
 
 211         bool , CanCopy() const,
 
 212         "Returns True if the combobox is editable and there is a text selection
 
 213 to copy to the clipboard.  Only available on Windows.", "");
 
 216         bool , CanCut() const,
 
 217         "Returns True if the combobox is editable and there is a text selection
 
 218 to copy to the clipboard.  Only available on Windows.", "");
 
 221         bool , CanPaste() const,
 
 222         "Returns True if the combobox is editable and there is text on the
 
 223 clipboard that can be pasted into the text field. Only available on
 
 227         bool , CanUndo() const,
 
 228         "Returns True if the combobox is editable and the last edit can be
 
 229 undone.  Only available on Windows.", "");
 
 232         bool , CanRedo() const,
 
 233         "Returns True if the combobox is editable and the last undo can be
 
 234 redone.  Only available on Windows.", "");
 
 238     static wxVisualAttributes
 
 239     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 
 242 //---------------------------------------------------------------------------