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
,
55 m_pickerStyle
= style
;
58 if ( !wxButton::Create(parent
, id
, label
, pos
, size
, 0, validator
, name
) )
60 wxFAIL_MSG( wxT("wxGenericFileButton creation failed") );
64 // and handle user clicks on it
65 Connect(GetId(), wxEVT_COMMAND_BUTTON_CLICKED
,
66 wxCommandEventHandler(wxGenericFileDirButton::OnButtonClick
),
69 // create the dialog associated with this button
72 m_wildcard
= wildcard
;
77 void wxGenericFileDirButton::OnButtonClick(wxCommandEvent
& WXUNUSED(ev
))
79 wxDialog
*p
= CreateDialog();
80 if (p
->ShowModal() == wxID_OK
)
82 // save updated path in m_path
83 UpdatePathFromDialog(p
);
86 wxFileDirPickerEvent
event(GetEventType(), this, GetId(), m_path
);
87 GetEventHandler()->ProcessEvent(event
);
93 #endif // wxUSE_FILEPICKERCTRL || wxUSE_DIRPICKERCTRL