]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/src/_control.i
Applied patch [ 845171 ] Use transparancy mask in wxBitmapShape
[wxWidgets.git] / wxPython / src / _control.i
... / ...
CommitLineData
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
18%{
19 DECLARE_DEF_STRING(ControlNameStr);
20%}
21
22//---------------------------------------------------------------------------
23%newgroup;
24
25
26// This is the base class for a control or 'widget'.
27//
28// A control is generally a small window which processes user input and/or
29// displays one or more item of data.
30class wxControl : public wxWindow
31{
32public:
33 %addtofunc wxControl "self._setOORInfo(self)"
34 %addtofunc wxControl() ""
35
36 wxControl(wxWindow *parent,
37 wxWindowID id,
38 const wxPoint& pos=wxDefaultPosition,
39 const wxSize& size=wxDefaultSize,
40 long style=0,
41 const wxValidator& validator=wxDefaultValidator,
42 const wxString& name=wxPyControlNameStr);
43
44 %name(PreControl)wxControl();
45
46 bool Create(wxWindow *parent,
47 wxWindowID id,
48 const wxPoint& pos=wxDefaultPosition,
49 const wxSize& size=wxDefaultSize,
50 long style=0,
51 const wxValidator& validator=wxDefaultValidator,
52 const wxString& name=wxPyControlNameStr);
53
54
55 // Simulates the effect of the user issuing a command to the item. See
56 // wxCommandEvent.
57 void Command(wxCommandEvent& event);
58
59 // Return a control's text.
60 wxString GetLabel();
61
62 // Sets the item's text.
63 void SetLabel(const wxString& label);
64
65};
66
67
68//---------------------------------------------------------------------------
69%newgroup;
70
71
72// wxItemContainer defines an interface which is implemented by all controls
73// which have string subitems each of which may be selected.
74//
75// Examples: wxListBox, wxCheckListBox, wxChoice and wxComboBox (which
76// implements an extended interface deriving from this one)
77class wxItemContainer
78{
79public:
80 // wxItemContainer() { m_clientDataItemsType = wxClientData_None; } ** It's an ABC
81
82
83 // int Append(const wxString& item)
84 // int Append(const wxString& item, void *clientData)
85 // int Append(const wxString& item, wxClientData *clientData)
86 %extend {
87 // Adds the item to the control, associating the given data with the
88 // item if not None.
89 int Append(const wxString& item, PyObject* clientData=NULL) {
90 if (clientData) {
91 wxPyClientData* data = new wxPyClientData(clientData);
92 return self->Append(item, data);
93 } else
94 return self->Append(item);
95 }
96 }
97
98 // append several items at once to the control
99 %name(AppendItems) void Append(const wxArrayString& strings);
100
101 // int Insert(const wxString& item, int pos)
102 // int Insert(const wxString& item, int pos, void *clientData);
103 // int Insert(const wxString& item, int pos, wxClientData *clientData);
104 %extend {
105 int Insert(const wxString& item, int pos, PyObject* clientData=NULL) {
106 if (clientData) {
107 wxPyClientData* data = new wxPyClientData(clientData);
108 return self->Insert(item, pos, data);
109 } else
110 return self->Insert(item, pos);
111 }
112 }
113
114
115 // deleting items
116 virtual void Clear();
117 virtual void Delete(int n);
118
119
120 // accessing strings
121 virtual int GetCount() const;
122 bool IsEmpty() const;
123 virtual wxString GetString(int n) const;
124 wxArrayString GetStrings() const;
125 virtual void SetString(int n, const wxString& s);
126 virtual int FindString(const wxString& s) const;
127
128
129 // selection
130 virtual void Select(int n);
131 virtual int GetSelection() const;
132
133 wxString GetStringSelection() const;
134
135
136 // client data stuff
137 %extend {
138 // Returns the client data associated with the given item, (if any.)
139 PyObject* GetClientData(int n) {
140 wxPyClientData* data = (wxPyClientData*)self->GetClientObject(n);
141 if (data) {
142 Py_INCREF(data->m_obj);
143 return data->m_obj;
144 } else {
145 Py_INCREF(Py_None);
146 return Py_None;
147 }
148 }
149
150 // Associate the given client data with the item at position n.
151 void SetClientData(int n, PyObject* clientData) {
152 wxPyClientData* data = new wxPyClientData(clientData);
153 self->SetClientObject(n, data);
154 }
155 }
156
157};
158
159
160//---------------------------------------------------------------------------
161%newgroup;
162
163class wxControlWithItems : public wxControl, public wxItemContainer
164{
165public:
166};
167
168//---------------------------------------------------------------------------
169