//----------------------------------------------------------------------
+%{
+ // Put some wx default wxChar* values into wxStrings.
+ DECLARE_DEF_STRING(FileSelectorPromptStr);
+ DECLARE_DEF_STRING(DirSelectorPromptStr);
+ DECLARE_DEF_STRING(DirDialogNameStr);
+ DECLARE_DEF_STRING(FileSelectorDefaultWildcardStr);
+ DECLARE_DEF_STRING(GetTextFromUserPromptStr);
+ DECLARE_DEF_STRING(MessageBoxCaptionStr);
+ static const wxString wxPyEmptyString(wxT(""));
+
+%}
+
+//----------------------------------------------------------------------
+
class wxColourData : public wxObject {
public:
wxColourData();
class wxDirDialog : public wxDialog {
public:
wxDirDialog(wxWindow* parent,
- char* message = "Choose a directory",
- char* defaultPath = "",
+ const wxString& message = wxPyDirSelectorPromptStr,
+ const wxString& defaultPath = wxPyEmptyString,
long style = 0,
- const wxPoint& pos = wxDefaultPosition);
+ const wxPoint& pos = wxDefaultPosition,
+ const wxSize& size = wxDefaultSize,
+ const wxString& name = wxPyDirDialogNameStr);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
int ShowModal();
};
+
//----------------------------------------------------------------------
class wxFileDialog : public wxDialog {
public:
wxFileDialog(wxWindow* parent,
- char* message = "Choose a file",
- char* defaultDir = "",
- char* defaultFile = "",
- char* wildcard = "*.*",
+ const wxString& message = wxPyFileSelectorPromptStr,
+ const wxString& defaultDir = wxPyEmptyString,
+ const wxString& defaultFile = wxPyEmptyString,
+ const wxString& wildcard = wxPyFileSelectorDefaultWildcardStr,
long style = 0,
const wxPoint& pos = wxDefaultPosition);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
- wxString GetDirectory();
- wxString GetFilename();
- int GetFilterIndex();
- wxString GetMessage();
- wxString GetPath();
- long GetStyle();
- wxString GetWildcard();
- void SetDirectory(const wxString& directory);
- void SetFilename(const wxString& setfilename);
- void SetFilterIndex(int filterIndex);
void SetMessage(const wxString& message);
void SetPath(const wxString& path);
- void SetStyle(long style);
+ void SetDirectory(const wxString& dir);
+ void SetFilename(const wxString& name);
void SetWildcard(const wxString& wildCard);
- int ShowModal();
+ void SetStyle(long style);
+ void SetFilterIndex(int filterIndex);
+
+ wxString GetMessage() const;
+ wxString GetPath() const;
+ wxString GetDirectory() const;
+ wxString GetFilename() const;
+ wxString GetWildcard() const;
+ long GetStyle() const;
+ int GetFilterIndex() const;
%addmethods {
PyObject* GetFilenames() {
wxArrayString arr;
self->GetFilenames(arr);
- size_t count = arr.GetCount();
- PyObject* listObj = PyList_New(0);
- for(size_t x=0; x<count; x++) {
- PyObject* name = PyString_FromString(arr[x]);
- PyList_Append(listObj, name);
- }
- return listObj;
+ return wxArrayString2PyList_helper(arr);
}
PyObject* GetPaths() {
wxArrayString arr;
self->GetPaths(arr);
- size_t count = arr.GetCount();
- PyObject* listObj = PyList_New(0);
- for(size_t x=0; x<count; x++) {
- PyObject* name = PyString_FromString(arr[x]);
- PyList_Append(listObj, name);
- }
- return listObj;
+ return wxArrayString2PyList_helper(arr);
}
}
+
+// TODO
+// // Utility functions
+
+// // Parses the wildCard, returning the number of filters.
+// // Returns 0 if none or if there's a problem,
+// // The arrays will contain an equal number of items found before the error.
+// // wildCard is in the form:
+// // "All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
+// static int ParseWildcard(const wxString& wildCard,
+// wxArrayString& descriptions,
+// wxArrayString& filters);
+
+// // Append first extension to filePath from a ';' separated extensionList
+// // if filePath = "path/foo.bar" just return it as is
+// // if filePath = "foo[.]" and extensionList = "*.jpg;*.png" return "foo.jpg"
+// // if the extension is "*.j?g" (has wildcards) or "jpg" then return filePath
+// static wxString AppendExtension(const wxString &filePath,
+// const wxString &extensionList);
+
+
};
//----------------------------------------------------------------------
-//TODO: wxMultipleChoiceDialog
+enum { wxCHOICEDLG_STYLE };
+
+class wxMultiChoiceDialog : public wxDialog
+{
+public:
+ wxMultiChoiceDialog(wxWindow *parent,
+ const wxString& message,
+ const wxString& caption,
+ int LCOUNT, wxString *choices,
+ long style = wxCHOICEDLG_STYLE,
+ const wxPoint& pos = wxDefaultPosition);
+
+ %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
+
+ void SetSelections(const wxArrayInt& selections);
+
+ // wxArrayInt GetSelections() const;
+ %addmethods {
+ PyObject* GetSelections() {
+ return wxArrayInt2PyList_helper(self->GetSelections());
+ }
+ }
+};
+
//----------------------------------------------------------------------
wxString* caption,
int LCOUNT, wxString* choices,
//char** clientData = NULL,
- long style = wxOK | wxCANCEL | wxCENTRE,
+ long style = wxCHOICEDLG_STYLE,
wxPoint* pos = &wxDefaultPosition) {
return new wxSingleChoiceDialog(parent, *message, *caption,
LCOUNT, choices, NULL, style, *pos);
class wxTextEntryDialog : public wxDialog {
public:
wxTextEntryDialog(wxWindow* parent,
- char* message,
- char* caption = "Input Text",
- char* defaultValue = "",
+ const wxString& message,
+ const wxString& caption = wxPyGetTextFromUserPromptStr,
+ const wxString& defaultValue = wxPyEmptyString,
long style = wxOK | wxCANCEL | wxCENTRE,
const wxPoint& pos = wxDefaultPosition);
class wxFontDialog : public wxDialog {
public:
- wxFontDialog(wxWindow* parent, wxFontData* data);
+ wxFontDialog(wxWindow* parent, const wxFontData& data);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
wxFontData& GetFontData();
class wxMessageDialog : public wxDialog {
public:
wxMessageDialog(wxWindow* parent,
- char* message,
- char* caption = "Message box",
+ const wxString& message,
+ const wxString& caption = wxPyMessageBoxCaptionStr,
long style = wxOK | wxCANCEL | wxCENTRE,
const wxPoint& pos = wxDefaultPosition);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
int style = wxPD_AUTO_HIDE | wxPD_APP_MODAL );
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
- bool Update(int value = -1, const char* newmsg = NULL);
+ bool Update(int value, const wxString& newmsg = wxPyEmptyString);
void Resume();
}
int style = 0);
%pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
- %pragma(python) addtomethod = "wxPreFindReplaceDialog:val._setOORInfo(self)"
+ %pragma(python) addtomethod = "wxPreFindReplaceDialog:val._setOORInfo(val)"
const wxFindReplaceData *GetData();
void SetData(wxFindReplaceData *data);