]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/filectrl.h
Reapply wxWeakRef patch again
[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
7// RCS-ID: $Id$
8// Copyright: (c) Diaa M. Sami
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
700d08c1
RR
12
13#ifndef _WX_GTK_FILECTRL_H_
14#define _WX_GTK_FILECTRL_H_
0cf3e587 15
7d61c83f 16#include "wx/control.h"
700d08c1 17#include "wx/filectrl.h"
7d61c83f 18
53a2db12 19extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorDefaultWildcardStr[];
7d61c83f 20
0cf3e587
VZ
21typedef struct _GtkFileChooser GtkFileChooser;
22
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.
26// ------
27// Sometimes a selection event(with 0 files) is fired before
28// wxEVT_FILECTRL_FOLDERCHANGED, unfortunately this can hardly be detected!
29
30// A wx wrapper for any Gtk object implementing the interface GtkFileChooser
31
32class WXDLLIMPEXP_CORE wxGtkFileChooser
33{
34public:
35 wxGtkFileChooser() {}
36
37 void SetWidget(GtkFileChooser *w);
38
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;
45
46 bool SetPath( const wxString& path );
47 bool SetDirectory( const wxString& dir );
48 void SetWildcard( const wxString& wildCard );
49 void SetFilterIndex( int filterIndex );
50
51private:
52 GtkFileChooser *m_widget;
53};
54
55#if wxUSE_FILECTRL
56
57class WXDLLIMPEXP_CORE wxGtkFileCtrl: public wxControl,
58 public wxFileCtrlBase
59{
60public:
61 wxGtkFileCtrl () { Init(); }
62
63 wxGtkFileCtrl ( wxWindow *parent,
64 wxWindowID id,
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 )
72 {
73 Init();
74 Create( parent, id, defaultDirectory, defaultFilename, wildCard, style, pos, size, name );
75 }
76
77 virtual ~wxGtkFileCtrl() {};
78
79 void Init();
80 bool Create( wxWindow *parent,
81 wxWindowID id,
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 );
89
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 );
95
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(); }
103
104 virtual bool HasMultipleFileSelection() const { return HasFlag( wxFC_MULTIPLE ); }
260020e3 105 virtual void ShowHidden(bool show);
0cf3e587
VZ
106
107 bool m_checkNextSelEvent;
108 bool m_ignoreNextFolderChangeEvent;
109
110protected:
111 GtkFileChooser *m_fcWidget;
112 wxGtkFileChooser m_fc;
113 wxString m_wildCard;
114
115 DECLARE_DYNAMIC_CLASS( wxGtkFileCtrl )
116};
117
118#endif // wxUSE_FILECTRL
119
700d08c1 120#endif // _WX_GTK_FILECTRL_H_
0cf3e587 121