]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_control.i
Clean out the old stuff
[wxWidgets.git] / wxPython / src / _control.i
CommitLineData
d14a1e28
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: _control.i
3// Purpose: SWIG interface defs for wxControl and other base classes
4//
5// Author: Robin Dunn
6//
7// Created: 10-June-1998
8// RCS-ID: $Id$
9// Copyright: (c) 2003 by Total Control Software
10// Licence: wxWindows license
11/////////////////////////////////////////////////////////////////////////////
12
13// Not a %module
14
15
16//---------------------------------------------------------------------------
17
b2dc1044 18MAKE_CONST_WXSTRING(ControlNameStr);
d14a1e28
RD
19
20//---------------------------------------------------------------------------
21%newgroup;
22
23
24// This is the base class for a control or 'widget'.
25//
26// A control is generally a small window which processes user input and/or
27// displays one or more item of data.
28class wxControl : public wxWindow
29{
30public:
31 %addtofunc wxControl "self._setOORInfo(self)"
32 %addtofunc wxControl() ""
33
34 wxControl(wxWindow *parent,
35 wxWindowID id,
36 const wxPoint& pos=wxDefaultPosition,
37 const wxSize& size=wxDefaultSize,
38 long style=0,
39 const wxValidator& validator=wxDefaultValidator,
40 const wxString& name=wxPyControlNameStr);
41
42 %name(PreControl)wxControl();
43
44 bool Create(wxWindow *parent,
45 wxWindowID id,
46 const wxPoint& pos=wxDefaultPosition,
47 const wxSize& size=wxDefaultSize,
48 long style=0,
49 const wxValidator& validator=wxDefaultValidator,
50 const wxString& name=wxPyControlNameStr);
51
52
53 // Simulates the effect of the user issuing a command to the item. See
54 // wxCommandEvent.
55 void Command(wxCommandEvent& event);
56
57 // Return a control's text.
58 wxString GetLabel();
59
60 // Sets the item's text.
61 void SetLabel(const wxString& label);
62
63};
64
65
66//---------------------------------------------------------------------------
67%newgroup;
68
69
70// wxItemContainer defines an interface which is implemented by all controls
71// which have string subitems each of which may be selected.
72//
73// Examples: wxListBox, wxCheckListBox, wxChoice and wxComboBox (which
74// implements an extended interface deriving from this one)
75class wxItemContainer
76{
77public:
78 // wxItemContainer() { m_clientDataItemsType = wxClientData_None; } ** It's an ABC
79
80
81 // int Append(const wxString& item)
82 // int Append(const wxString& item, void *clientData)
83 // int Append(const wxString& item, wxClientData *clientData)
84 %extend {
85 // Adds the item to the control, associating the given data with the
86 // item if not None.
87 int Append(const wxString& item, PyObject* clientData=NULL) {
88 if (clientData) {
89 wxPyClientData* data = new wxPyClientData(clientData);
90 return self->Append(item, data);
91 } else
92 return self->Append(item);
93 }
94 }
95
96 // append several items at once to the control
97 %name(AppendItems) void Append(const wxArrayString& strings);
98
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);
102 %extend {
103 int Insert(const wxString& item, int pos, PyObject* clientData=NULL) {
104 if (clientData) {
105 wxPyClientData* data = new wxPyClientData(clientData);
106 return self->Insert(item, pos, data);
107 } else
108 return self->Insert(item, pos);
109 }
110 }
111
112
113 // deleting items
114 virtual void Clear();
115 virtual void Delete(int n);
116
117
118 // accessing strings
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;
125
126
127 // selection
128 virtual void Select(int n);
129 virtual int GetSelection() const;
130
131 wxString GetStringSelection() const;
132
133
134 // client data stuff
135 %extend {
136 // Returns the client data associated with the given item, (if any.)
137 PyObject* GetClientData(int n) {
138 wxPyClientData* data = (wxPyClientData*)self->GetClientObject(n);
139 if (data) {
140 Py_INCREF(data->m_obj);
141 return data->m_obj;
142 } else {
143 Py_INCREF(Py_None);
144 return Py_None;
145 }
146 }
147
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);
152 }
153 }
154
155};
156
157
158//---------------------------------------------------------------------------
159%newgroup;
160
161class wxControlWithItems : public wxControl, public wxItemContainer
162{
163public:
164};
165
166//---------------------------------------------------------------------------
167