]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/cmndlgs.i
fixed crash in OnSize() handler
[wxWidgets.git] / wxPython / src / cmndlgs.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cmndlgs.i
3 // Purpose: SWIG definitions for the Common Dialog Classes
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 7/25/98
8 // RCS-ID: $Id$
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 %module cmndlgs
14
15 %{
16 #include "helpers.h"
17 #include <wx/colordlg.h>
18 #include <wx/dirdlg.h>
19 #include <wx/fontdlg.h>
20 #include <wx/progdlg.h>
21 %}
22
23 //----------------------------------------------------------------------
24
25 %include typemaps.i
26 %include my_typemaps.i
27
28 // Import some definitions of other classes, etc.
29 %import _defs.i
30 %import misc.i
31 %import gdi.i
32 %import windows.i
33 %import frames.i
34
35 %pragma(python) code = "import wx"
36
37 //----------------------------------------------------------------------
38
39 class wxColourData : public wxObject {
40 public:
41 wxColourData();
42 ~wxColourData();
43
44 bool GetChooseFull();
45 wxColour GetColour();
46 wxColour GetCustomColour(int i);
47 void SetChooseFull(int flag);
48 void SetColour(const wxColour& colour);
49 void SetCustomColour(int i, const wxColour& colour);
50 };
51
52
53 class wxColourDialog : public wxDialog {
54 public:
55 wxColourDialog(wxWindow* parent, wxColourData* data = NULL);
56
57 wxColourData& GetColourData();
58 int ShowModal();
59 };
60
61
62 //----------------------------------------------------------------------
63
64 class wxDirDialog : public wxDialog {
65 public:
66 wxDirDialog(wxWindow* parent,
67 char* message = "Choose a directory",
68 char* defaultPath = "",
69 long style = 0,
70 const wxPoint& pos = wxDefaultPosition);
71
72 wxString GetPath();
73 wxString GetMessage();
74 long GetStyle();
75 void SetMessage(const wxString& message);
76 void SetPath(const wxString& path);
77 int ShowModal();
78 };
79
80 //----------------------------------------------------------------------
81
82 class wxFileDialog : public wxDialog {
83 public:
84 wxFileDialog(wxWindow* parent,
85 char* message = "Choose a file",
86 char* defaultDir = "",
87 char* defaultFile = "",
88 char* wildcard = "*.*",
89 long style = 0,
90 const wxPoint& pos = wxDefaultPosition);
91
92 wxString GetDirectory();
93 wxString GetFilename();
94 int GetFilterIndex();
95 wxString GetMessage();
96 wxString GetPath();
97 long GetStyle();
98 wxString GetWildcard();
99 void SetDirectory(const wxString& directory);
100 void SetFilename(const wxString& setfilename);
101 void SetFilterIndex(int filterIndex);
102 void SetMessage(const wxString& message);
103 void SetPath(const wxString& path);
104 void SetStyle(long style);
105 void SetWildcard(const wxString& wildCard);
106 int ShowModal();
107
108 %addmethods {
109 PyObject* GetFilenames() {
110 wxArrayString arr;
111 self->GetFilenames(arr);
112 size_t count = arr.GetCount();
113 PyObject* listObj = PyList_New(0);
114 for(size_t x=0; x<count; x++) {
115 PyObject* name = PyString_FromString(arr[x]);
116 PyList_Append(listObj, name);
117 }
118 return listObj;
119 }
120
121 PyObject* GetPaths() {
122 wxArrayString arr;
123 self->GetPaths(arr);
124 size_t count = arr.GetCount();
125 PyObject* listObj = PyList_New(0);
126 for(size_t x=0; x<count; x++) {
127 PyObject* name = PyString_FromString(arr[x]);
128 PyList_Append(listObj, name);
129 }
130 return listObj;
131 }
132 }
133 };
134
135
136 //----------------------------------------------------------------------
137
138 //TODO: wxMultipleChoiceDialog
139
140 //----------------------------------------------------------------------
141
142 class wxSingleChoiceDialog : public wxDialog {
143 public:
144 %addmethods {
145 // TODO: ignoring clientData for now...
146 // SWIG is messing up the &/*'s for some reason.
147 wxSingleChoiceDialog(wxWindow* parent,
148 wxString* message,
149 wxString* caption,
150 int LCOUNT, wxString* choices,
151 //char** clientData = NULL,
152 long style = wxOK | wxCANCEL | wxCENTRE,
153 wxPoint* pos = &wxDefaultPosition) {
154 return new wxSingleChoiceDialog(parent, *message, *caption,
155 LCOUNT, choices, NULL, style, *pos);
156 }
157
158 }
159
160 int GetSelection();
161 wxString GetStringSelection();
162 void SetSelection(int sel);
163 int ShowModal();
164 };
165
166
167 //----------------------------------------------------------------------
168
169 class wxTextEntryDialog : public wxDialog {
170 public:
171 wxTextEntryDialog(wxWindow* parent,
172 char* message,
173 char* caption = "Input Text",
174 char* defaultValue = "",
175 long style = wxOK | wxCANCEL | wxCENTRE,
176 const wxPoint& pos = wxDefaultPosition);
177
178 wxString GetValue();
179 void SetValue(const wxString& value);
180 int ShowModal();
181 };
182
183 //----------------------------------------------------------------------
184
185 class wxFontData : public wxObject {
186 public:
187 wxFontData();
188 ~wxFontData();
189
190 void EnableEffects(bool enable);
191 bool GetAllowSymbols();
192 wxColour GetColour();
193 wxFont GetChosenFont();
194 bool GetEnableEffects();
195 wxFont GetInitialFont();
196 bool GetShowHelp();
197 void SetAllowSymbols(bool allowSymbols);
198 void SetChosenFont(const wxFont& font);
199 void SetColour(const wxColour& colour);
200 void SetInitialFont(const wxFont& font);
201 void SetRange(int min, int max);
202 void SetShowHelp(bool showHelp);
203 };
204
205
206 class wxFontDialog : public wxDialog {
207 public:
208 wxFontDialog(wxWindow* parent, wxFontData* data);
209
210 wxFontData& GetFontData();
211 int ShowModal();
212 };
213
214
215 //----------------------------------------------------------------------
216
217 class wxMessageDialog : public wxDialog {
218 public:
219 wxMessageDialog(wxWindow* parent,
220 char* message,
221 char* caption = "Message box",
222 long style = wxOK | wxCANCEL | wxCENTRE,
223 const wxPoint& pos = wxDefaultPosition);
224
225 int ShowModal();
226 };
227
228 //----------------------------------------------------------------------
229
230 class wxProgressDialog : public wxFrame {
231 public:
232 wxProgressDialog(const wxString& title,
233 const wxString& message,
234 int maximum = 100,
235 wxWindow* parent = NULL,
236 int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL );
237
238
239 bool Update(int value = -1, const char* newmsg = NULL);
240 void Resume();
241 }
242
243 //----------------------------------------------------------------------