1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: SWIG interface defs for wxControl and other base classes
7 // Created: 10-June-1998
9 // Copyright: (c) 2003 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
16 //---------------------------------------------------------------------------
18 MAKE_CONST_WXSTRING(ControlNameStr);
20 //---------------------------------------------------------------------------
24 // This is the base class for a control or 'widget'.
26 // A control is generally a small window which processes user input and/or
27 // displays one or more item of data.
28 class wxControl : public wxWindow
31 %pythonAppend wxControl "self._setOORInfo(self)"
32 %pythonAppend wxControl() ""
34 wxControl(wxWindow *parent,
36 const wxPoint& pos=wxDefaultPosition,
37 const wxSize& size=wxDefaultSize,
39 const wxValidator& validator=wxDefaultValidator,
40 const wxString& name=wxPyControlNameStr);
42 %name(PreControl)wxControl();
44 bool Create(wxWindow *parent,
46 const wxPoint& pos=wxDefaultPosition,
47 const wxSize& size=wxDefaultSize,
49 const wxValidator& validator=wxDefaultValidator,
50 const wxString& name=wxPyControlNameStr);
53 // Simulates the effect of the user issuing a command to the item. See
55 void Command(wxCommandEvent& event);
57 // Return a control's text.
60 // Sets the item's text.
61 void SetLabel(const wxString& label);
66 //---------------------------------------------------------------------------
70 // wxItemContainer defines an interface which is implemented by all controls
71 // which have string subitems each of which may be selected.
73 // Examples: wxListBox, wxCheckListBox, wxChoice and wxComboBox (which
74 // implements an extended interface deriving from this one)
78 // wxItemContainer() { m_clientDataItemsType = wxClientData_None; } ** It's an ABC
81 // int Append(const wxString& item)
82 // int Append(const wxString& item, void *clientData)
83 // int Append(const wxString& item, wxClientData *clientData)
85 // Adds the item to the control, associating the given data with the
87 int Append(const wxString& item, PyObject* clientData=NULL) {
89 wxPyClientData* data = new wxPyClientData(clientData);
90 return self->Append(item, data);
92 return self->Append(item);
96 // append several items at once to the control
97 %name(AppendItems) void Append(const wxArrayString& strings);
99 // int Insert(const wxString& item, int pos)
100 // int Insert(const wxString& item, int pos, void *clientData);
101 // int Insert(const wxString& item, int pos, wxClientData *clientData);
103 int Insert(const wxString& item, int pos, PyObject* clientData=NULL) {
105 wxPyClientData* data = new wxPyClientData(clientData);
106 return self->Insert(item, pos, data);
108 return self->Insert(item, pos);
114 virtual void Clear();
115 virtual void Delete(int n);
119 virtual int GetCount() const;
120 bool IsEmpty() const;
121 virtual wxString GetString(int n) const;
122 wxArrayString GetStrings() const;
123 virtual void SetString(int n, const wxString& s);
124 virtual int FindString(const wxString& s) const;
128 virtual void Select(int n);
129 virtual int GetSelection() const;
131 wxString GetStringSelection() const;
136 // Returns the client data associated with the given item, (if any.)
137 PyObject* GetClientData(int n) {
138 wxPyClientData* data = (wxPyClientData*)self->GetClientObject(n);
140 Py_INCREF(data->m_obj);
148 // Associate the given client data with the item at position n.
149 void SetClientData(int n, PyObject* clientData) {
150 wxPyClientData* data = new wxPyClientData(clientData);
151 self->SetClientObject(n, data);
158 //---------------------------------------------------------------------------
161 class wxControlWithItems : public wxControl, public wxItemContainer
166 //---------------------------------------------------------------------------