1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
# include <wx/wx.h>
#endif
#include "../FileDialog.h"
#include <cassert>
#include "wx/event.h"
#include "wx/filedlg.h"
#include "wx/window.h"
FileDialog::FileDialog(wxWindow *parent,
const wxString& message,
const wxString& defaultDir,
const wxString& defaultFile,
const wxString& wildCard,
long style,
const wxPoint& pos,
const wxSize& sz,
const wxString& name)
: wxFileDialog(parent, message, defaultDir, defaultFile, wildCard, style, pos, sz, name)
{
}
FileDialog::~FileDialog()
{
// intentionally left blank; it's just there to make sure
// we have a virtual destructor (in case of subclassing)
}
int FileDialog::ShowModal()
{
assert (SupportsExtraControl());
if (!m_buttonlabel.IsEmpty()) {
SetExtraControlCreator(&FileDialog::CreateButton);
}
return wxFileDialog::ShowModal();
}
wxWindow * FileDialog::CreateButton(wxWindow *fileDialogGeneric)
{
FileDialog *fileDialog = (FileDialog *) fileDialogGeneric;
wxButton *button = new wxButton(fileDialog, wxID_ANY, fileDialog->m_buttonlabel);
fileDialog->Bind(wxEVT_BUTTON, &FileDialog::OnButton, fileDialog, button->GetId());
return button;
}
void FileDialog::OnButton(wxCommandEvent& WXUNUSED(event))
{
ClickButton(GetFilterIndex());
}
|