]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/filectrl.h
No real changes, just make wxWindow::CanScroll() virtual.
[wxWidgets.git] / include / wx / gtk / filectrl.h
CommitLineData
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
0cf3e587
VZ
7// Copyright: (c) Diaa M. Sami
8// Licence: wxWindows licence
9///////////////////////////////////////////////////////////////////////////////
10
700d08c1
RR
11
12#ifndef _WX_GTK_FILECTRL_H_
13#define _WX_GTK_FILECTRL_H_
0cf3e587 14
7d61c83f 15#include "wx/control.h"
700d08c1 16#include "wx/filectrl.h"
7d61c83f 17
53a2db12 18extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorDefaultWildcardStr[];
7d61c83f 19
0cf3e587
VZ
20typedef struct _GtkFileChooser GtkFileChooser;
21
22// [GTK] current problems:
23// All methods(e.g. SetFilename(), SetPath(), etc) which change the state of
24// the control result in events fired, such events should be suppressed.
25// ------
26// Sometimes a selection event(with 0 files) is fired before
27// wxEVT_FILECTRL_FOLDERCHANGED, unfortunately this can hardly be detected!
28
29// A wx wrapper for any Gtk object implementing the interface GtkFileChooser
30
31class WXDLLIMPEXP_CORE wxGtkFileChooser
32{
33public:
6305f044 34 wxGtkFileChooser() { m_ignoreNextFilterEvent = false; }
0cf3e587
VZ
35
36 void SetWidget(GtkFileChooser *w);
37
38 wxString GetPath() const;
39 void GetPaths( wxArrayString& paths ) const;
40 wxString GetDirectory() const;
41 wxString GetFilename() const;
42 void GetFilenames( wxArrayString& files ) const;
43 int GetFilterIndex() const;
44
45 bool SetPath( const wxString& path );
46 bool SetDirectory( const wxString& dir );
47 void SetWildcard( const wxString& wildCard );
48 void SetFilterIndex( int filterIndex );
49
6305f044
VZ
50 bool HasFilterChoice() const;
51
52 bool ShouldIgnoreNextFilterEvent() const { return m_ignoreNextFilterEvent; }
53
20380343
RR
54 wxString GetCurrentWildCard() const
55 { return m_wildcards[GetFilterIndex()]; }
56
0cf3e587
VZ
57private:
58 GtkFileChooser *m_widget;
20380343
RR
59 // First wildcard in filter, to be used when the user
60 // saves a file without giving an extension.
03647350 61 wxArrayString m_wildcards;
6305f044
VZ
62
63 // If true, ignore the next event because it was generated by us and not
64 // the user.
65 bool m_ignoreNextFilterEvent;
0cf3e587
VZ
66};
67
68#if wxUSE_FILECTRL
69
70class WXDLLIMPEXP_CORE wxGtkFileCtrl: public wxControl,
71 public wxFileCtrlBase
72{
73public:
74 wxGtkFileCtrl () { Init(); }
75
76 wxGtkFileCtrl ( wxWindow *parent,
77 wxWindowID id,
78 const wxString& defaultDirectory = wxEmptyString,
79 const wxString& defaultFilename = wxEmptyString,
80 const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
81 long style = wxFC_DEFAULT_STYLE,
82 const wxPoint& pos = wxDefaultPosition,
83 const wxSize& size = wxDefaultSize,
84 const wxString& name = wxFileCtrlNameStr )
85 {
86 Init();
87 Create( parent, id, defaultDirectory, defaultFilename, wildCard, style, pos, size, name );
88 }
89
8ab75332 90 virtual ~wxGtkFileCtrl();
0cf3e587 91
0cf3e587
VZ
92 bool Create( wxWindow *parent,
93 wxWindowID id,
94 const wxString& defaultDirectory = wxEmptyString,
95 const wxString& defaultFileName = wxEmptyString,
96 const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
97 long style = wxFC_DEFAULT_STYLE,
98 const wxPoint& pos = wxDefaultPosition,
99 const wxSize& size = wxDefaultSize,
100 const wxString& name = wxFileCtrlNameStr );
101
102 virtual void SetWildcard( const wxString& wildCard );
103 virtual void SetFilterIndex( int filterIndex );
104 virtual bool SetDirectory( const wxString& dir );
105 virtual bool SetFilename( const wxString& name );
106 virtual bool SetPath( const wxString& path );
107
108 virtual wxString GetFilename() const;
109 virtual wxString GetDirectory() const;
110 virtual wxString GetWildcard() const { return this->m_wildCard; }
111 virtual wxString GetPath() const;
112 virtual void GetPaths( wxArrayString& paths ) const;
113 virtual void GetFilenames( wxArrayString& files ) const;
114 virtual int GetFilterIndex() const { return m_fc.GetFilterIndex(); }
115
116 virtual bool HasMultipleFileSelection() const { return HasFlag( wxFC_MULTIPLE ); }
260020e3 117 virtual void ShowHidden(bool show);
0cf3e587 118
6305f044
VZ
119 virtual bool HasFilterChoice() const
120 { return m_fc.HasFilterChoice(); }
121
122
123 // Implementation only from now on.
124 bool GTKShouldIgnoreNextFilterEvent() const
125 { return m_fc.ShouldIgnoreNextFilterEvent(); }
126
0cf3e587
VZ
127 bool m_checkNextSelEvent;
128 bool m_ignoreNextFolderChangeEvent;
129
130protected:
131 GtkFileChooser *m_fcWidget;
132 wxGtkFileChooser m_fc;
133 wxString m_wildCard;
134
95dc31e0
PC
135private:
136 void Init();
137
0cf3e587
VZ
138 DECLARE_DYNAMIC_CLASS( wxGtkFileCtrl )
139};
140
141#endif // wxUSE_FILECTRL
142
700d08c1 143#endif // _WX_GTK_FILECTRL_H_
0cf3e587 144