1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/filectrl.h
3 // Purpose: wxGtkFileCtrl Header
4 // Author: Diaa M. Sami
6 // Created: Aug-10-2007
8 // Copyright: (c) Diaa M. Sami
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
15 #include "wx/control.h"
17 extern WXDLLEXPORT_DATA(const wxChar
) wxFileSelectorDefaultWildcardStr
[];
19 typedef struct _GtkFileChooser GtkFileChooser
;
21 // [GTK] current problems:
22 // All methods(e.g. SetFilename(), SetPath(), etc) which change the state of
23 // the control result in events fired, such events should be suppressed.
25 // Sometimes a selection event(with 0 files) is fired before
26 // wxEVT_FILECTRL_FOLDERCHANGED, unfortunately this can hardly be detected!
28 // A wx wrapper for any Gtk object implementing the interface GtkFileChooser
30 class WXDLLIMPEXP_CORE wxGtkFileChooser
35 void SetWidget(GtkFileChooser
*w
);
37 wxString
GetPath() const;
38 void GetPaths( wxArrayString
& paths
) const;
39 wxString
GetDirectory() const;
40 wxString
GetFilename() const;
41 void GetFilenames( wxArrayString
& files
) const;
42 int GetFilterIndex() const;
44 bool SetPath( const wxString
& path
);
45 bool SetDirectory( const wxString
& dir
);
46 void SetWildcard( const wxString
& wildCard
);
47 void SetFilterIndex( int filterIndex
);
50 GtkFileChooser
*m_widget
;
55 class WXDLLIMPEXP_CORE wxGtkFileCtrl
: public wxControl
,
59 wxGtkFileCtrl () { Init(); }
61 wxGtkFileCtrl ( wxWindow
*parent
,
63 const wxString
& defaultDirectory
= wxEmptyString
,
64 const wxString
& defaultFilename
= wxEmptyString
,
65 const wxString
& wildCard
= wxFileSelectorDefaultWildcardStr
,
66 long style
= wxFC_DEFAULT_STYLE
,
67 const wxPoint
& pos
= wxDefaultPosition
,
68 const wxSize
& size
= wxDefaultSize
,
69 const wxString
& name
= wxFileCtrlNameStr
)
72 Create( parent
, id
, defaultDirectory
, defaultFilename
, wildCard
, style
, pos
, size
, name
);
75 virtual ~wxGtkFileCtrl() {};
78 bool Create( wxWindow
*parent
,
80 const wxString
& defaultDirectory
= wxEmptyString
,
81 const wxString
& defaultFileName
= wxEmptyString
,
82 const wxString
& wildCard
= wxFileSelectorDefaultWildcardStr
,
83 long style
= wxFC_DEFAULT_STYLE
,
84 const wxPoint
& pos
= wxDefaultPosition
,
85 const wxSize
& size
= wxDefaultSize
,
86 const wxString
& name
= wxFileCtrlNameStr
);
88 virtual void SetWildcard( const wxString
& wildCard
);
89 virtual void SetFilterIndex( int filterIndex
);
90 virtual bool SetDirectory( const wxString
& dir
);
91 virtual bool SetFilename( const wxString
& name
);
92 virtual bool SetPath( const wxString
& path
);
94 virtual wxString
GetFilename() const;
95 virtual wxString
GetDirectory() const;
96 virtual wxString
GetWildcard() const { return this->m_wildCard
; }
97 virtual wxString
GetPath() const;
98 virtual void GetPaths( wxArrayString
& paths
) const;
99 virtual void GetFilenames( wxArrayString
& files
) const;
100 virtual int GetFilterIndex() const { return m_fc
.GetFilterIndex(); }
102 virtual bool HasMultipleFileSelection() const { return HasFlag( wxFC_MULTIPLE
); }
103 virtual void ShowHidden(const bool show
);
105 bool m_checkNextSelEvent
;
106 bool m_ignoreNextFolderChangeEvent
;
109 GtkFileChooser
*m_fcWidget
;
110 wxGtkFileChooser m_fc
;
113 DECLARE_DYNAMIC_CLASS( wxGtkFileCtrl
)
116 #endif // wxUSE_FILECTRL