init member variables properly (patch 1156088)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -48,15 +48,27 @@ extern WXDLLEXPORT_DATA(const wxChar*) wxFileSelectorDefaultWildcardStr;
|
|||||||
class WXDLLEXPORT wxFileDialogBase: public wxDialog
|
class WXDLLEXPORT wxFileDialogBase: public wxDialog
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxFileDialogBase () {}
|
wxFileDialogBase () { Init(); }
|
||||||
|
|
||||||
wxFileDialogBase(wxWindow *parent,
|
wxFileDialogBase(wxWindow *parent,
|
||||||
const wxString& message = wxFileSelectorPromptStr,
|
const wxString& message = wxFileSelectorPromptStr,
|
||||||
const wxString& defaultDir = wxEmptyString,
|
const wxString& defaultDir = wxEmptyString,
|
||||||
const wxString& defaultFile = wxEmptyString,
|
const wxString& defaultFile = wxEmptyString,
|
||||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||||
long style = 0,
|
long style = 0,
|
||||||
const wxPoint& pos = wxDefaultPosition);
|
const wxPoint& pos = wxDefaultPosition) : wxDialog()
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
Create(parent, message, defaultDir, defaultFile, wildCard, style, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Create(wxWindow *parent,
|
||||||
|
const wxString& message = wxFileSelectorPromptStr,
|
||||||
|
const wxString& defaultDir = wxEmptyString,
|
||||||
|
const wxString& defaultFile = wxEmptyString,
|
||||||
|
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||||
|
long style = 0,
|
||||||
|
const wxPoint& pos = wxDefaultPosition);
|
||||||
|
|
||||||
virtual void SetMessage(const wxString& message) { m_message = message; }
|
virtual void SetMessage(const wxString& message) { m_message = message; }
|
||||||
virtual void SetPath(const wxString& path) { m_path = path; }
|
virtual void SetPath(const wxString& path) { m_path = path; }
|
||||||
@@ -107,6 +119,7 @@ protected:
|
|||||||
int m_filterIndex;
|
int m_filterIndex;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void Init();
|
||||||
DECLARE_DYNAMIC_CLASS(wxFileDialogBase)
|
DECLARE_DYNAMIC_CLASS(wxFileDialogBase)
|
||||||
DECLARE_NO_COPY_CLASS(wxFileDialogBase)
|
DECLARE_NO_COPY_CLASS(wxFileDialogBase)
|
||||||
};
|
};
|
||||||
|
@@ -45,23 +45,26 @@ class WXDLLEXPORT wxTextCtrl;
|
|||||||
class WXDLLEXPORT wxGenericFileDialog: public wxFileDialogBase
|
class WXDLLEXPORT wxGenericFileDialog: public wxFileDialogBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxGenericFileDialog() { }
|
wxGenericFileDialog() : wxFileDialogBase() { Init(); }
|
||||||
|
|
||||||
wxGenericFileDialog(wxWindow *parent,
|
wxGenericFileDialog(wxWindow *parent,
|
||||||
const wxString& message = wxFileSelectorPromptStr,
|
const wxString& message = wxFileSelectorPromptStr,
|
||||||
const wxString& defaultDir = wxEmptyString,
|
const wxString& defaultDir = wxEmptyString,
|
||||||
const wxString& defaultFile = wxEmptyString,
|
const wxString& defaultFile = wxEmptyString,
|
||||||
|
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||||
|
long style = 0,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
bool bypassGenericImpl = false );
|
||||||
|
|
||||||
|
bool Create( wxWindow *parent,
|
||||||
|
const wxString& message = wxFileSelectorPromptStr,
|
||||||
|
const wxString& defaultDir = wxEmptyString,
|
||||||
|
const wxString& defaultFile = wxEmptyString,
|
||||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
||||||
long style = 0,
|
long style = 0,
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
bool bypassGenericImpl = false );
|
bool bypassGenericImpl = false );
|
||||||
bool Create( wxWindow *parent,
|
|
||||||
const wxString& message = wxFileSelectorPromptStr,
|
|
||||||
const wxString& defaultDir = wxEmptyString,
|
|
||||||
const wxString& defaultFile = wxEmptyString,
|
|
||||||
const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
|
|
||||||
long style = 0,
|
|
||||||
const wxPoint& pos = wxDefaultPosition );
|
|
||||||
virtual ~wxGenericFileDialog();
|
virtual ~wxGenericFileDialog();
|
||||||
|
|
||||||
virtual void SetMessage(const wxString& message) { SetTitle(message); }
|
virtual void SetMessage(const wxString& message) { SetTitle(message); }
|
||||||
@@ -114,6 +117,7 @@ protected:
|
|||||||
wxBitmapButton *m_newDirButton;
|
wxBitmapButton *m_newDirButton;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void Init();
|
||||||
DECLARE_DYNAMIC_CLASS(wxGenericFileDialog)
|
DECLARE_DYNAMIC_CLASS(wxGenericFileDialog)
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
|
|
||||||
|
@@ -36,18 +36,25 @@
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxFileDialogBase, wxDialog)
|
IMPLEMENT_DYNAMIC_CLASS(wxFileDialogBase, wxDialog)
|
||||||
|
|
||||||
wxFileDialogBase::wxFileDialogBase(wxWindow *parent,
|
void wxFileDialogBase::Init()
|
||||||
const wxString& message,
|
{
|
||||||
const wxString& defaultDir,
|
m_filterIndex = m_dialogStyle = 0;
|
||||||
const wxString& defaultFile,
|
m_parent = NULL;
|
||||||
const wxString& wildCard,
|
}
|
||||||
long style,
|
|
||||||
const wxPoint& WXUNUSED(pos))
|
bool wxFileDialogBase::Create(wxWindow *parent,
|
||||||
: m_message(message),
|
const wxString& message,
|
||||||
m_dir(defaultDir),
|
const wxString& defaultDir,
|
||||||
m_fileName(defaultFile),
|
const wxString& defaultFile,
|
||||||
m_wildCard(wildCard)
|
const wxString& wildCard,
|
||||||
|
long style,
|
||||||
|
const wxPoint& WXUNUSED(pos))
|
||||||
{
|
{
|
||||||
|
m_message = message;
|
||||||
|
m_dir = defaultDir;
|
||||||
|
m_fileName = defaultFile;
|
||||||
|
m_wildCard = wildCard;
|
||||||
|
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
m_dialogStyle = style;
|
m_dialogStyle = style;
|
||||||
m_filterIndex = 0;
|
m_filterIndex = 0;
|
||||||
@@ -78,6 +85,8 @@ wxFileDialogBase::wxFileDialogBase(wxWindow *parent,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY_2_4
|
#if WXWIN_COMPATIBILITY_2_4
|
||||||
|
@@ -878,32 +878,54 @@ END_EVENT_TABLE()
|
|||||||
long wxGenericFileDialog::ms_lastViewStyle = wxLC_LIST;
|
long wxGenericFileDialog::ms_lastViewStyle = wxLC_LIST;
|
||||||
bool wxGenericFileDialog::ms_lastShowHidden = false;
|
bool wxGenericFileDialog::ms_lastShowHidden = false;
|
||||||
|
|
||||||
|
void wxGenericFileDialog::Init()
|
||||||
|
{
|
||||||
|
m_bypassGenericImpl = false;
|
||||||
|
|
||||||
|
m_choice = NULL;
|
||||||
|
m_text = NULL;
|
||||||
|
m_list = NULL;
|
||||||
|
m_check = NULL;
|
||||||
|
m_static = NULL;
|
||||||
|
m_upDirButton = NULL;
|
||||||
|
m_newDirButton = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
wxGenericFileDialog::wxGenericFileDialog(wxWindow *parent,
|
wxGenericFileDialog::wxGenericFileDialog(wxWindow *parent,
|
||||||
const wxString& message,
|
const wxString& message,
|
||||||
const wxString& defaultDir,
|
const wxString& defaultDir,
|
||||||
const wxString& defaultFile,
|
const wxString& defaultFile,
|
||||||
const wxString& wildCard,
|
const wxString& wildCard,
|
||||||
long style,
|
long style,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
bool bypassGenericImpl )
|
bool bypassGenericImpl ) : wxFileDialogBase()
|
||||||
:wxFileDialogBase(parent, message, defaultDir, defaultFile, wildCard, style, pos)
|
|
||||||
{
|
{
|
||||||
m_bypassGenericImpl = bypassGenericImpl;
|
Init();
|
||||||
|
Create( parent, message, defaultDir, defaultFile, wildCard, style, pos, bypassGenericImpl );
|
||||||
if (!m_bypassGenericImpl)
|
|
||||||
Create( parent, message, defaultDir, defaultFile, wildCard, style, pos );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGenericFileDialog::Create( wxWindow *parent,
|
bool wxGenericFileDialog::Create( wxWindow *parent,
|
||||||
const wxString& message,
|
const wxString& message,
|
||||||
const wxString& WXUNUSED(defaultDir),
|
const wxString& defaultDir,
|
||||||
const wxString& defaultFile,
|
const wxString& defaultFile,
|
||||||
const wxString& wildCard,
|
const wxString& wildCard,
|
||||||
long WXUNUSED(style),
|
long style,
|
||||||
const wxPoint& pos )
|
const wxPoint& pos,
|
||||||
|
bool bypassGenericImpl )
|
||||||
{
|
{
|
||||||
|
m_bypassGenericImpl = bypassGenericImpl;
|
||||||
|
|
||||||
|
if (!wxFileDialogBase::Create(parent, message, defaultDir, defaultFile,
|
||||||
|
wildCard, style, pos))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_bypassGenericImpl)
|
||||||
|
return true;
|
||||||
|
|
||||||
if (!wxDialog::Create( parent, wxID_ANY, message, pos, wxDefaultSize,
|
if (!wxDialog::Create( parent, wxID_ANY, message, pos, wxDefaultSize,
|
||||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ))
|
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1129,8 +1151,13 @@ void wxGenericFileDialog::SetWildcard(const wxString& wildCard)
|
|||||||
wildFilters);
|
wildFilters);
|
||||||
wxCHECK_RET( count, wxT("wxFileDialog: bad wildcard string") );
|
wxCHECK_RET( count, wxT("wxFileDialog: bad wildcard string") );
|
||||||
|
|
||||||
m_choice->Clear();
|
size_t n, old_count = m_choice->GetCount();
|
||||||
for ( size_t n = 0; n < count; n++ )
|
for ( n = 0; n < count; n++ )
|
||||||
|
{
|
||||||
|
delete (wxString *)m_choice->GetClientData(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
for ( n = 0; n < count; n++ )
|
||||||
{
|
{
|
||||||
m_choice->Append( wildDescriptions[n], new wxString( wildFilters[n] ) );
|
m_choice->Append( wildDescriptions[n], new wxString( wildFilters[n] ) );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user