Lazy creation of the picker dialogs (Francesco).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39526 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		@@ -65,7 +65,7 @@ public:
 | 
			
		||||
 | 
			
		||||
    bool Destroy()
 | 
			
		||||
    {
 | 
			
		||||
        m_dialog->Destroy();
 | 
			
		||||
        if (m_dialog) m_dialog->Destroy();
 | 
			
		||||
        return wxButton::Destroy();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -45,6 +45,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxGenericDirButton, wxButton)
 | 
			
		||||
// wxGenericFileButton
 | 
			
		||||
// ----------------------------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
static wxString s_message, s_wildcard;
 | 
			
		||||
 | 
			
		||||
bool wxGenericFileDirButton::Create( wxWindow *parent, wxWindowID id,
 | 
			
		||||
                        const wxString &label, const wxString &path,
 | 
			
		||||
                        const wxString &message, const wxString &wildcard,
 | 
			
		||||
@@ -66,11 +68,17 @@ bool wxGenericFileDirButton::Create( wxWindow *parent, wxWindowID id,
 | 
			
		||||
 | 
			
		||||
    // create the dialog associated with this button
 | 
			
		||||
    m_path = path;
 | 
			
		||||
    return CreateDialog(message, wildcard);
 | 
			
		||||
    s_message = message;
 | 
			
		||||
    s_wildcard = wildcard;
 | 
			
		||||
 | 
			
		||||
    m_dialog = NULL;
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void wxGenericFileDirButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev))
 | 
			
		||||
{
 | 
			
		||||
    CreateDialog(s_message, s_wildcard);
 | 
			
		||||
 | 
			
		||||
    if (m_dialog->ShowModal() == wxID_OK)
 | 
			
		||||
    {
 | 
			
		||||
        // save the path
 | 
			
		||||
@@ -80,6 +88,8 @@ void wxGenericFileDirButton::OnButtonClick(wxCommandEvent& WXUNUSED(ev))
 | 
			
		||||
        wxFileDirPickerEvent event(GetEventType(), this, GetId(), m_path);
 | 
			
		||||
        GetEventHandler()->ProcessEvent(event);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    wxDELETE(m_dialog);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#endif      // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user