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 typedef struct _GtkFileChooser GtkFileChooser
;
17 // [GTK] current problems:
18 // All methods(e.g. SetFilename(), SetPath(), etc) which change the state of
19 // the control result in events fired, such events should be suppressed.
21 // Sometimes a selection event(with 0 files) is fired before
22 // wxEVT_FILECTRL_FOLDERCHANGED, unfortunately this can hardly be detected!
24 // A wx wrapper for any Gtk object implementing the interface GtkFileChooser
26 class WXDLLIMPEXP_CORE wxGtkFileChooser
31 void SetWidget(GtkFileChooser
*w
);
33 wxString
GetPath() const;
34 void GetPaths( wxArrayString
& paths
) const;
35 wxString
GetDirectory() const;
36 wxString
GetFilename() const;
37 void GetFilenames( wxArrayString
& files
) const;
38 int GetFilterIndex() const;
40 bool SetPath( const wxString
& path
);
41 bool SetDirectory( const wxString
& dir
);
42 void SetWildcard( const wxString
& wildCard
);
43 void SetFilterIndex( int filterIndex
);
46 GtkFileChooser
*m_widget
;
51 class WXDLLIMPEXP_CORE wxGtkFileCtrl
: public wxControl
,
55 wxGtkFileCtrl () { Init(); }
57 wxGtkFileCtrl ( wxWindow
*parent
,
59 const wxString
& defaultDirectory
= wxEmptyString
,
60 const wxString
& defaultFilename
= wxEmptyString
,
61 const wxString
& wildCard
= wxFileSelectorDefaultWildcardStr
,
62 long style
= wxFC_DEFAULT_STYLE
,
63 const wxPoint
& pos
= wxDefaultPosition
,
64 const wxSize
& size
= wxDefaultSize
,
65 const wxString
& name
= wxFileCtrlNameStr
)
68 Create( parent
, id
, defaultDirectory
, defaultFilename
, wildCard
, style
, pos
, size
, name
);
71 virtual ~wxGtkFileCtrl() {};
74 bool Create( wxWindow
*parent
,
76 const wxString
& defaultDirectory
= wxEmptyString
,
77 const wxString
& defaultFileName
= wxEmptyString
,
78 const wxString
& wildCard
= wxFileSelectorDefaultWildcardStr
,
79 long style
= wxFC_DEFAULT_STYLE
,
80 const wxPoint
& pos
= wxDefaultPosition
,
81 const wxSize
& size
= wxDefaultSize
,
82 const wxString
& name
= wxFileCtrlNameStr
);
84 virtual void SetWildcard( const wxString
& wildCard
);
85 virtual void SetFilterIndex( int filterIndex
);
86 virtual bool SetDirectory( const wxString
& dir
);
87 virtual bool SetFilename( const wxString
& name
);
88 virtual bool SetPath( const wxString
& path
);
90 virtual wxString
GetFilename() const;
91 virtual wxString
GetDirectory() const;
92 virtual wxString
GetWildcard() const { return this->m_wildCard
; }
93 virtual wxString
GetPath() const;
94 virtual void GetPaths( wxArrayString
& paths
) const;
95 virtual void GetFilenames( wxArrayString
& files
) const;
96 virtual int GetFilterIndex() const { return m_fc
.GetFilterIndex(); }
98 virtual bool HasMultipleFileSelection() const { return HasFlag( wxFC_MULTIPLE
); }
99 virtual void ShowHidden(const bool show
);
101 bool m_checkNextSelEvent
;
102 bool m_ignoreNextFolderChangeEvent
;
105 GtkFileChooser
*m_fcWidget
;
106 wxGtkFileChooser m_fc
;
109 DECLARE_DYNAMIC_CLASS( wxGtkFileCtrl
)
112 #endif // wxUSE_FILECTRL