wxGenericDirCtrl

This control can be used to place a directory listing (with optional files) on an arbitrary window.
The control contains a wxTreeCtrl window representing the directory hierarchy, and optionally, a wxChoice window containing a list of filters.

Derived from

wxControl
wxWindow
wxEvtHandler
wxObject

Include files

<wx/dirctrl.h>

Window styles

wxDIRCTRL_DIR_ONLY
Only show directories, and not files.
wxDIRCTRL_3D_INTERNAL
Use 3D borders for internal controls.
wxDIRCTRL_SELECT_FIRST
When setting the default path, select the first file in the directory.
wxDIRCTRL_SHOW_FILTERS
Show the drop-down filter list.
wxDIRCTRL_EDIT_LABELS
Allow the folder and file labels to be editable.
See also Generic window styles.

Data structures

Members


wxGenericDirCtrl::wxGenericDirCtrl

wxGenericDirCtrl()
Default constructor.
wxGenericDirCtrl(wxWindow* parent, const wxWindowID id = -1, const wxString& dir = wxDirDialogDefaultFolderStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, const wxString& filter = wxEmptyString, int defaultFilter = 0, const wxString& name = wxTreeCtrlNameStr)
Main constructor.

Parameters

parent
Parent window.
id
Window identifier.
dir
Initial folder.
pos
Position.
size
Size.
style
Window style. Please see wxGenericDirCtrl for a list of possible styles.
filter
A filter string, using the same syntax as that for wxFileDialog. This may be empty if filters are not being used.
Example: "All files (*.*)|*.*|JPEG files (*.jpg)|*.jpg"
defaultFilter
The zero-indexed default filter setting.
name
The window name.

wxGenericDirCtrl::~wxGenericDirCtrl

~wxGenericDirCtrl()
Destructor.

wxGenericDirCtrl::Create

bool Create(wxWindow* parent, const wxWindowID id = -1, const wxString& dir = wxDirDialogDefaultFolderStr, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDIRCTRL_3D_INTERNAL|wxSUNKEN_BORDER, const wxString& filter = wxEmptyString, int defaultFilter = 0, const wxString& name = wxTreeCtrlNameStr)
Create function for two-step construction. See wxGenericDirCtrl::wxGenericDirCtrl for details.

wxGenericDirCtrl::Init

void Init()
Initializes variables.

wxGenericDirCtrl::CollapseTree

void CollapseTree()
Collapses the entire tree.

wxGenericDirCtrl::ExpandPath

bool ExpandPath(const wxString& path)
Tries to expand as much of the given path as possible, so that the filename or directory is visible in the tree control.

wxGenericDirCtrl::CollapsePath

bool CollapsePath(const wxString& path)
Collapse the given path.

wxGenericDirCtrl::GetDefaultPath

wxString GetDefaultPath() const
Gets the default path.

wxGenericDirCtrl::GetPath

wxString GetPath() const
Gets the currently-selected directory or filename.

wxGenericDirCtrl::GetFilePath

wxString GetFilePath() const
Gets selected filename path only (else empty string).
This function doesn't count a directory as a selection.

wxGenericDirCtrl::GetFilter

wxString GetFilter() const
Returns the filter string.

wxGenericDirCtrl::GetFilterIndex

int GetFilterIndex() const
Returns the current filter index (zero-based).

wxGenericDirCtrl::GetFilterListCtrl

wxDirFilterListCtrl* GetFilterListCtrl() const
Returns a pointer to the filter list control (if present).

wxGenericDirCtrl::GetRootId

wxTreeItemId GetRootId()
Returns the root id for the tree control.

wxGenericDirCtrl::GetTreeCtrl

wxTreeCtrl* GetTreeCtrl() const
Returns a pointer to the tree control.

wxGenericDirCtrl::ReCreateTree

void ReCreateTree()
Collapse and expand the tree, thus re-creating it from scratch. May be used to update the displayed directory content.

wxGenericDirCtrl::SetDefaultPath

void SetDefaultPath(const wxString& path)
Sets the default path.

wxGenericDirCtrl::SetFilter

void SetFilter(const wxString& filter)
Sets the filter string.

wxGenericDirCtrl::SetFilterIndex

void SetFilterIndex(int n)
Sets the current filter index (zero-based).

wxGenericDirCtrl::SetPath

void SetPath(const wxString& path)
Sets the current path.

wxGenericDirCtrl::ShowHidden

void ShowHidden(bool show)

Parameters

show
If true, hidden folders and files will be displayed by the control. If false, they will not be displayed.