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 ///////////////////////////////////////////////////////////////////////////////
13 #ifndef _WX_GTK_FILECTRL_H_
14 #define _WX_GTK_FILECTRL_H_
16 #include "wx/control.h"
17 #include "wx/filectrl.h"
19 extern WXDLLEXPORT_DATA(const wxChar
) wxFileSelectorDefaultWildcardStr
[];
21 typedef struct _GtkFileChooser GtkFileChooser
;
23 // [GTK] current problems:
24 // All methods(e.g. SetFilename(), SetPath(), etc) which change the state of
25 // the control result in events fired, such events should be suppressed.
27 // Sometimes a selection event(with 0 files) is fired before
28 // wxEVT_FILECTRL_FOLDERCHANGED, unfortunately this can hardly be detected!
30 // A wx wrapper for any Gtk object implementing the interface GtkFileChooser
32 class WXDLLIMPEXP_CORE wxGtkFileChooser
37 void SetWidget(GtkFileChooser
*w
);
39 wxString
GetPath() const;
40 void GetPaths( wxArrayString
& paths
) const;
41 wxString
GetDirectory() const;
42 wxString
GetFilename() const;
43 void GetFilenames( wxArrayString
& files
) const;
44 int GetFilterIndex() const;
46 bool SetPath( const wxString
& path
);
47 bool SetDirectory( const wxString
& dir
);
48 void SetWildcard( const wxString
& wildCard
);
49 void SetFilterIndex( int filterIndex
);
52 GtkFileChooser
*m_widget
;
57 class WXDLLIMPEXP_CORE wxGtkFileCtrl
: public wxControl
,
61 wxGtkFileCtrl () { Init(); }
63 wxGtkFileCtrl ( wxWindow
*parent
,
65 const wxString
& defaultDirectory
= wxEmptyString
,
66 const wxString
& defaultFilename
= wxEmptyString
,
67 const wxString
& wildCard
= wxFileSelectorDefaultWildcardStr
,
68 long style
= wxFC_DEFAULT_STYLE
,
69 const wxPoint
& pos
= wxDefaultPosition
,
70 const wxSize
& size
= wxDefaultSize
,
71 const wxString
& name
= wxFileCtrlNameStr
)
74 Create( parent
, id
, defaultDirectory
, defaultFilename
, wildCard
, style
, pos
, size
, name
);
77 virtual ~wxGtkFileCtrl() {};
80 bool Create( wxWindow
*parent
,
82 const wxString
& defaultDirectory
= wxEmptyString
,
83 const wxString
& defaultFileName
= wxEmptyString
,
84 const wxString
& wildCard
= wxFileSelectorDefaultWildcardStr
,
85 long style
= wxFC_DEFAULT_STYLE
,
86 const wxPoint
& pos
= wxDefaultPosition
,
87 const wxSize
& size
= wxDefaultSize
,
88 const wxString
& name
= wxFileCtrlNameStr
);
90 virtual void SetWildcard( const wxString
& wildCard
);
91 virtual void SetFilterIndex( int filterIndex
);
92 virtual bool SetDirectory( const wxString
& dir
);
93 virtual bool SetFilename( const wxString
& name
);
94 virtual bool SetPath( const wxString
& path
);
96 virtual wxString
GetFilename() const;
97 virtual wxString
GetDirectory() const;
98 virtual wxString
GetWildcard() const { return this->m_wildCard
; }
99 virtual wxString
GetPath() const;
100 virtual void GetPaths( wxArrayString
& paths
) const;
101 virtual void GetFilenames( wxArrayString
& files
) const;
102 virtual int GetFilterIndex() const { return m_fc
.GetFilterIndex(); }
104 virtual bool HasMultipleFileSelection() const { return HasFlag( wxFC_MULTIPLE
); }
105 virtual void ShowHidden(bool show
);
107 bool m_checkNextSelEvent
;
108 bool m_ignoreNextFolderChangeEvent
;
111 GtkFileChooser
*m_fcWidget
;
112 wxGtkFileChooser m_fc
;
115 DECLARE_DYNAMIC_CLASS( wxGtkFileCtrl
)
118 #endif // wxUSE_FILECTRL
120 #endif // _WX_GTK_FILECTRL_H_