]>
Commit | Line | Data |
---|---|---|
d14a1e28 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: _ditctrl.i | |
3 | // Purpose: SWIG interface file for wxGenericDirCtrl | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 10-June-1998 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2002 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | // Not a %module | |
14 | ||
15 | ||
16 | //--------------------------------------------------------------------------- | |
17 | ||
18 | %{ | |
19 | DECLARE_DEF_STRING(DirDialogDefaultFolderStr); | |
20 | %} | |
21 | ||
22 | //--------------------------------------------------------------------------- | |
23 | %newgroup | |
24 | ||
25 | // Extra styles for wxGenericDirCtrl | |
26 | enum | |
27 | { | |
28 | // Only allow directory viewing/selection, no files | |
29 | wxDIRCTRL_DIR_ONLY = 0x0010, | |
30 | // When setting the default path, select the first file in the directory | |
31 | wxDIRCTRL_SELECT_FIRST = 0x0020, | |
32 | // Show the filter list | |
33 | wxDIRCTRL_SHOW_FILTERS = 0x0040, | |
34 | // Use 3D borders on internal controls | |
35 | wxDIRCTRL_3D_INTERNAL = 0x0080, | |
36 | // Editable labels | |
37 | wxDIRCTRL_EDIT_LABELS = 0x0100 | |
38 | }; | |
39 | ||
40 | ||
41 | ||
42 | #if 0 | |
43 | class wxDirItemData : public wxObject // wxTreeItemData | |
44 | { | |
45 | public: | |
46 | wxDirItemData(const wxString& path, const wxString& name, bool isDir); | |
47 | // ~wxDirItemDataEx(); | |
48 | void SetNewDirName( wxString path ); | |
49 | wxString m_path, m_name; | |
50 | bool m_isHidden; | |
51 | bool m_isExpanded; | |
52 | bool m_isDir; | |
53 | }; | |
54 | #endif | |
55 | ||
56 | ||
57 | ||
58 | ||
59 | class wxGenericDirCtrl: public wxControl | |
60 | { | |
61 | public: | |
62 | %addtofunc wxGenericDirCtrl "self._setOORInfo(self)" | |
63 | %addtofunc wxGenericDirCtrl() "" | |
64 | ||
65 | wxGenericDirCtrl(wxWindow *parent, const wxWindowID id = -1, | |
66 | const wxString& dir = wxPyDirDialogDefaultFolderStr, | |
67 | const wxPoint& pos = wxDefaultPosition, | |
68 | const wxSize& size = wxDefaultSize, | |
69 | long style = wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, | |
70 | const wxString& filter = wxPyEmptyString, | |
71 | int defaultFilter = 0, | |
72 | const wxString& name = wxPy_TreeCtrlNameStr); | |
73 | %name(PreGenericDirCtrl)wxGenericDirCtrl(); | |
74 | ||
75 | ||
76 | bool Create(wxWindow *parent, const wxWindowID id = -1, | |
77 | const wxString& dir = wxPyDirDialogDefaultFolderStr, | |
78 | const wxPoint& pos = wxDefaultPosition, | |
79 | const wxSize& size = wxDefaultSize, | |
80 | long style = wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, | |
81 | const wxString& filter = wxPyEmptyString, | |
82 | int defaultFilter = 0, | |
83 | const wxString& name = wxPy_TreeCtrlNameStr); | |
84 | ||
85 | ||
86 | ||
87 | // Try to expand as much of the given path as possible. | |
88 | virtual bool ExpandPath(const wxString& path); | |
89 | ||
90 | ||
91 | virtual inline wxString GetDefaultPath() const; | |
92 | virtual void SetDefaultPath(const wxString& path); | |
93 | ||
94 | // Get dir or filename | |
95 | virtual wxString GetPath() const; | |
96 | ||
97 | // Get selected filename path only (else empty string). | |
98 | // I.e. don't count a directory as a selection | |
99 | virtual wxString GetFilePath() const; | |
100 | virtual void SetPath(const wxString& path); | |
101 | ||
102 | virtual void ShowHidden( bool show ); | |
103 | virtual bool GetShowHidden(); | |
104 | ||
105 | virtual wxString GetFilter() const; | |
106 | virtual void SetFilter(const wxString& filter); | |
107 | ||
108 | virtual int GetFilterIndex() const; | |
109 | virtual void SetFilterIndex(int n); | |
110 | ||
111 | virtual wxTreeItemId GetRootId(); | |
112 | ||
113 | virtual wxTreeCtrl* GetTreeCtrl() const; | |
114 | virtual wxDirFilterListCtrl* GetFilterListCtrl() const; | |
115 | ||
116 | ||
117 | // Parse the filter into an array of filters and an array of descriptions | |
118 | // virtual int ParseFilter(const wxString& filterStr, wxArrayString& filters, wxArrayString& descriptions); | |
119 | ||
322913ce RD |
120 | DocDeclAStr( |
121 | virtual wxTreeItemId, FindChild(wxTreeItemId parentId, const wxString& path, bool& OUTPUT), | |
122 | "FindChild(wxTreeItemId parentId, wxString path) -> (item, done)", | |
123 | "Find the child that matches the first part of 'path'. E.g. if a child path is\n" | |
124 | "\"/usr\" and 'path' is \"/usr/include\" then the child for /usr is returned.\n" | |
125 | "If the path string has been used (we're at the leaf), done is set to True\n"); | |
126 | ||
d14a1e28 RD |
127 | |
128 | // Resize the components of the control | |
129 | virtual void DoResize(); | |
130 | ||
131 | // Collapse & expand the tree, thus re-creating it from scratch: | |
132 | virtual void ReCreateTree(); | |
133 | ||
134 | }; | |
135 | ||
136 | ||
137 | ||
138 | ||
139 | class wxDirFilterListCtrl: public wxChoice | |
140 | { | |
141 | public: | |
142 | %addtofunc wxDirFilterListCtrl "self._setOORInfo(self)" | |
143 | %addtofunc wxDirFilterListCtrl() "" | |
144 | ||
145 | wxDirFilterListCtrl(wxGenericDirCtrl* parent, const wxWindowID id = -1, | |
146 | const wxPoint& pos = wxDefaultPosition, | |
147 | const wxSize& size = wxDefaultSize, | |
148 | long style = 0); | |
149 | %name(PreDirFilterListCtrl)wxDirFilterListCtrl(); | |
150 | ||
151 | bool Create(wxGenericDirCtrl* parent, const wxWindowID id = -1, | |
152 | const wxPoint& pos = wxDefaultPosition, | |
153 | const wxSize& size = wxDefaultSize, | |
154 | long style = 0); | |
155 | ||
156 | //// Operations | |
157 | void FillFilterList(const wxString& filter, int defaultFilter); | |
158 | }; | |
159 | ||
160 | ||
161 | //--------------------------------------------------------------------------- | |
162 | //--------------------------------------------------------------------------- | |
163 | //--------------------------------------------------------------------------- |