added wx{Colour|File|Dir|Font}PickerCtrl (patch 1472329 by Francesco)
[wxWidgets.git] / include / wx / gtk / filepicker.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/filedirpicker.h
3 // Purpose: wxFileButton, wxDirButton header
4 // Author: Francesco Montorsi
5 // Modified by:
6 // Created: 14/4/2006
7 // Copyright: (c) Francesco Montorsi
8 // RCS-ID: $Id$
9 // Licence: wxWindows Licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_GTK_FILEPICKER_H_
13 #define _WX_GTK_FILEPICKER_H_
14
15 // since GtkColorButton is available only for GTK+ >= 2.4,
16 // we need to use generic versions if we detect (at runtime)
17 // that GTK+ < 2.4
18 #include "wx/generic/filepickerg.h"
19
20 //-----------------------------------------------------------------------------
21 // wxFileButton
22 //-----------------------------------------------------------------------------
23
24 class WXDLLIMPEXP_CORE wxFileButton : public wxGenericFileButton
25 {
26 public:
27 wxFileButton() {}
28 wxFileButton(wxWindow *parent,
29 wxWindowID id,
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)
39 {
40 Create(parent, id, label, path, message, wildcard,
41 pos, size, style, validator, name);
42 }
43
44 virtual ~wxFileButton() ;
45
46
47 public: // overrides
48
49 bool Create(wxWindow *parent,
50 wxWindowID id,
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,
57 long style = 0,
58 const wxValidator& validator = wxDefaultValidator,
59 const wxString& name = wxFilePickerWidgetNameStr);
60
61 // event handler for the click
62 void OnDialogOK(wxCommandEvent &);
63
64
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
68 {
69 return (wxGenericFileButton::GetDialogStyle() & ~wxFD_SAVE) | wxFD_OPEN;
70 }
71
72
73 private:
74 DECLARE_DYNAMIC_CLASS(wxFileButton)
75 };
76
77
78 //-----------------------------------------------------------------------------
79 // wxDirButton
80 //-----------------------------------------------------------------------------
81
82 class WXDLLIMPEXP_CORE wxDirButton : public wxGenericDirButton
83 {
84 public:
85 wxDirButton() {}
86 wxDirButton(wxWindow *parent,
87 wxWindowID id,
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)
96 {
97 Create(parent, id, label, path, message, wxEmptyString,
98 pos, size, style, validator, name);
99 }
100
101 virtual ~wxDirButton();
102
103
104 public: // overrides
105
106 bool Create(wxWindow *parent,
107 wxWindowID id,
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,
114 long style = 0,
115 const wxValidator& validator = wxDefaultValidator,
116 const wxString& name = wxFilePickerWidgetNameStr);
117
118 // used by the GTK callback only
119 void UpdatePath(char *gtkpath)
120 { m_path = wxString::FromAscii(gtkpath); }
121
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
125 {
126 return (wxGenericDirButton::GetDialogStyle() | wxDD_DIR_MUST_EXIST);
127 }
128
129 private:
130 DECLARE_DYNAMIC_CLASS(wxDirButton)
131 };
132
133 #endif // _WX_GTK_FILEPICKER_H_
134