1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/generic/filepickerg.cpp
3 // Purpose: wxGenericFileDirButton class implementation
4 // Author: Francesco Montorsi
8 // Copyright: (c) Francesco Montorsi
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
27 #if wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL
29 #include "wx/filepicker.h"
32 // ============================================================================
34 // ============================================================================
36 IMPLEMENT_DYNAMIC_CLASS(wxGenericFileButton
, wxButton
)
37 IMPLEMENT_DYNAMIC_CLASS(wxGenericDirButton
, wxButton
)
39 // ----------------------------------------------------------------------------
40 // wxGenericFileButton
41 // ----------------------------------------------------------------------------
43 bool wxGenericFileDirButton::Create(wxWindow
*parent
,
45 const wxString
& label
,
47 const wxString
& message
,
48 const wxString
& wildcard
,
52 const wxValidator
& validator
,
56 if ( !wxButton::Create(parent
, id
, label
, pos
, size
, 0, validator
, name
) )
58 wxFAIL_MSG( wxT("wxGenericFileButton creation failed") );
62 // and handle user clicks on it
63 Connect(GetId(), wxEVT_COMMAND_BUTTON_CLICKED
,
64 wxCommandEventHandler(wxGenericFileDirButton::OnButtonClick
),
67 // create the dialog associated with this button
70 m_wildcard
= wildcard
;
75 void wxGenericFileDirButton::OnButtonClick(wxCommandEvent
& WXUNUSED(ev
))
77 wxDialog
*p
= CreateDialog();
78 if (p
->ShowModal() == wxID_OK
)
80 // save updated path in m_path
81 UpdatePathFromDialog(p
);
84 wxFileDirPickerEvent
event(GetEventType(), this, GetId(), m_path
);
85 GetEventHandler()->ProcessEvent(event
);
91 #endif // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL