1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/filedirpicker.h
3 // Purpose: wxFileButton, wxDirButton header
4 // Author: Francesco Montorsi
7 // Copyright: (c) Francesco Montorsi
9 // Licence: wxWindows Licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_GTK_FILEPICKER_H_
13 #define _WX_GTK_FILEPICKER_H_
15 // since GtkColorButton is available only for GTK+ >= 2.4,
16 // we need to use generic versions if we detect (at runtime)
18 #include "wx/generic/filepickerg.h"
20 //-----------------------------------------------------------------------------
22 //-----------------------------------------------------------------------------
24 class WXDLLIMPEXP_CORE wxFileButton
: public wxGenericFileButton
28 wxFileButton(wxWindow
*parent
,
30 const wxString
& label
= wxFilePickerWidgetLabel
,
31 const wxString
&path
= wxEmptyString
,
32 const wxString
&message
= wxFileSelectorPromptStr
,
33 const wxString
&wildcard
= wxFileSelectorDefaultWildcardStr
,
34 const wxPoint
& pos
= wxDefaultPosition
,
35 const wxSize
& size
= wxDefaultSize
,
36 long style
= wxFILEBTN_DEFAULT_STYLE
,
37 const wxValidator
& validator
= wxDefaultValidator
,
38 const wxString
& name
= wxFilePickerWidgetNameStr
)
40 Create(parent
, id
, label
, path
, message
, wildcard
,
41 pos
, size
, style
, validator
, name
);
44 virtual ~wxFileButton() ;
49 bool Create(wxWindow
*parent
,
51 const wxString
& label
= wxFilePickerWidgetLabel
,
52 const wxString
&path
= wxEmptyString
,
53 const wxString
&message
= wxFileSelectorPromptStr
,
54 const wxString
&wildcard
= wxFileSelectorDefaultWildcardStr
,
55 const wxPoint
& pos
= wxDefaultPosition
,
56 const wxSize
& size
= wxDefaultSize
,
58 const wxValidator
& validator
= wxDefaultValidator
,
59 const wxString
& name
= wxFilePickerWidgetNameStr
);
61 // event handler for the click
62 void OnDialogOK(wxCommandEvent
&);
65 // GtkFileChooserButton does not support GTK_FILE_CHOOSER_ACTION_SAVE
66 // so we replace it with GTK_FILE_CHOOSER_ACTION_OPEN
67 long GetDialogStyle() const
69 return (wxGenericFileButton::GetDialogStyle() & ~wxFD_SAVE
) | wxFD_OPEN
;
74 DECLARE_DYNAMIC_CLASS(wxFileButton
)
78 //-----------------------------------------------------------------------------
80 //-----------------------------------------------------------------------------
82 class WXDLLIMPEXP_CORE wxDirButton
: public wxGenericDirButton
86 wxDirButton(wxWindow
*parent
,
88 const wxString
& label
= wxFilePickerWidgetLabel
,
89 const wxString
&path
= wxEmptyString
,
90 const wxString
&message
= wxFileSelectorPromptStr
,
91 const wxPoint
& pos
= wxDefaultPosition
,
92 const wxSize
& size
= wxDefaultSize
,
93 long style
= wxDIRBTN_DEFAULT_STYLE
,
94 const wxValidator
& validator
= wxDefaultValidator
,
95 const wxString
& name
= wxFilePickerWidgetNameStr
)
97 Create(parent
, id
, label
, path
, message
, wxEmptyString
,
98 pos
, size
, style
, validator
, name
);
101 virtual ~wxDirButton();
106 bool Create(wxWindow
*parent
,
108 const wxString
& label
= wxFilePickerWidgetLabel
,
109 const wxString
&path
= wxEmptyString
,
110 const wxString
&message
= wxFileSelectorPromptStr
,
111 const wxString
&wildcard
= wxFileSelectorDefaultWildcardStr
,
112 const wxPoint
& pos
= wxDefaultPosition
,
113 const wxSize
& size
= wxDefaultSize
,
115 const wxValidator
& validator
= wxDefaultValidator
,
116 const wxString
& name
= wxFilePickerWidgetNameStr
);
118 // used by the GTK callback only
119 void UpdatePath(char *gtkpath
)
120 { m_path
= wxString::FromAscii(gtkpath
); }
122 // GtkFileChooserButton does not support GTK_FILE_CHOOSER_CREATE_FOLDER
123 // thus we must ensure that the wxDD_DIR_MUST_EXIST style was given
124 long GetDialogStyle() const
126 return (wxGenericDirButton::GetDialogStyle() | wxDD_DIR_MUST_EXIST
);
130 DECLARE_DYNAMIC_CLASS(wxDirButton
)
133 #endif // _WX_GTK_FILEPICKER_H_