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::~wxGenericDirCtrl
wxGenericDirCtrl::Create
wxGenericDirCtrl::Init
wxGenericDirCtrl::ExpandPath
wxGenericDirCtrl::GetDefaultPath
wxGenericDirCtrl::GetPath
wxGenericDirCtrl::GetFilePath
wxGenericDirCtrl::GetFilter
wxGenericDirCtrl::GetFilterIndex
wxGenericDirCtrl::GetFilterListCtrl
wxGenericDirCtrl::GetRootId
wxGenericDirCtrl::GetTreeCtrl
wxGenericDirCtrl::SetDefaultPath
wxGenericDirCtrl::SetFilter
wxGenericDirCtrl::SetFilterIndex
wxGenericDirCtrl::SetPath
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
id
dir
pos
size
style
filter
Example: "All files (*.*)|*.*|JPEG files (*.jpg)|*.jpg"
defaultFilter
name
~wxGenericDirCtrl()
Destructor.
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.
void Init()
Initializes variables.
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.
wxString GetDefaultPath() const
Gets the default path.
wxString GetPath() const
Gets the currently-selected directory or filename.
wxString GetFilePath() const
Gets selected filename path only (else empty string).
This function doesn't count a directory as a selection.
wxString GetFilter() const
Returns the filter string.
int GetFilterIndex() const
Returns the current filter index (zero-based).
wxDirFilterListCtrl* GetFilterListCtrl() const
Returns a pointer to the filter list control (if present).
wxTreeItemId GetRootId()
Returns the root id for the tree control.
wxTreeCtrl* GetTreeCtrl() const
Returns a pointer to the tree control.
void SetDefaultPath(const wxString& path)
Sets the default path.
void SetFilter(const wxString& filter)
Sets the filter string.
void SetFilterIndex(int n)
Sets the current filter index (zero-based).
void SetPath(const wxString& path)
Sets the current path.