]>
Commit | Line | Data |
---|---|---|
0cf3e587 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/gtk/filectrl.h | |
3 | // Purpose: wxGtkFileCtrl Header | |
4 | // Author: Diaa M. Sami | |
5 | // Modified by: | |
6 | // Created: Aug-10-2007 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Diaa M. Sami | |
9 | // Licence: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef FILECTRL_H | |
13 | #define FILECTRL_H | |
14 | ||
15 | typedef struct _GtkFileChooser GtkFileChooser; | |
16 | ||
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. | |
20 | // ------ | |
21 | // Sometimes a selection event(with 0 files) is fired before | |
22 | // wxEVT_FILECTRL_FOLDERCHANGED, unfortunately this can hardly be detected! | |
23 | ||
24 | // A wx wrapper for any Gtk object implementing the interface GtkFileChooser | |
25 | ||
26 | class WXDLLIMPEXP_CORE wxGtkFileChooser | |
27 | { | |
28 | public: | |
29 | wxGtkFileChooser() {} | |
30 | ||
31 | void SetWidget(GtkFileChooser *w); | |
32 | ||
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; | |
39 | ||
40 | bool SetPath( const wxString& path ); | |
41 | bool SetDirectory( const wxString& dir ); | |
42 | void SetWildcard( const wxString& wildCard ); | |
43 | void SetFilterIndex( int filterIndex ); | |
44 | ||
45 | private: | |
46 | GtkFileChooser *m_widget; | |
47 | }; | |
48 | ||
49 | #if wxUSE_FILECTRL | |
50 | ||
51 | class WXDLLIMPEXP_CORE wxGtkFileCtrl: public wxControl, | |
52 | public wxFileCtrlBase | |
53 | { | |
54 | public: | |
55 | wxGtkFileCtrl () { Init(); } | |
56 | ||
57 | wxGtkFileCtrl ( wxWindow *parent, | |
58 | wxWindowID id, | |
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 ) | |
66 | { | |
67 | Init(); | |
68 | Create( parent, id, defaultDirectory, defaultFilename, wildCard, style, pos, size, name ); | |
69 | } | |
70 | ||
71 | virtual ~wxGtkFileCtrl() {}; | |
72 | ||
73 | void Init(); | |
74 | bool Create( wxWindow *parent, | |
75 | wxWindowID id, | |
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 ); | |
83 | ||
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 ); | |
89 | ||
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(); } | |
97 | ||
98 | virtual bool HasMultipleFileSelection() const { return HasFlag( wxFC_MULTIPLE ); } | |
99 | virtual void ShowHidden(const bool show); | |
100 | ||
101 | bool m_checkNextSelEvent; | |
102 | bool m_ignoreNextFolderChangeEvent; | |
103 | ||
104 | protected: | |
105 | GtkFileChooser *m_fcWidget; | |
106 | wxGtkFileChooser m_fc; | |
107 | wxString m_wildCard; | |
108 | ||
109 | DECLARE_DYNAMIC_CLASS( wxGtkFileCtrl ) | |
110 | }; | |
111 | ||
112 | #endif // wxUSE_FILECTRL | |
113 | ||
114 | #endif // FILECTRL_H | |
115 |