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



wxGenericDirCtrl::wxGenericDirCtrl



wxGenericDirCtrl(void)

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(void)

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(void)

Initializes variables.



wxGenericDirCtrl::CollapseTree



void CollapseTree(void)

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::GetDefaultPath

wxString GetDefaultPath(void) const

Gets the default path.



wxGenericDirCtrl::GetPath

wxString GetPath(void) const

Gets the currently-selected directory or filename.



wxGenericDirCtrl::GetFilePath

wxString GetFilePath(void) const

Gets selected filename path only (else empty string).

This function doesn't count a directory as a selection.



wxGenericDirCtrl::GetFilter

wxString GetFilter(void) const

Returns the filter string.



wxGenericDirCtrl::GetFilterIndex

int GetFilterIndex(void) const

Returns the current filter index (zero-based).



wxGenericDirCtrl::GetFilterListCtrl

wxDirFilterListCtrl* GetFilterListCtrl(void) const

Returns a pointer to the filter list control (if present).



wxGenericDirCtrl::GetRootId



wxTreeItemId GetRootId(void)

Returns the root id for the tree control.



wxGenericDirCtrl::GetTreeCtrl

wxTreeCtrl* GetTreeCtrl(void) const

Returns a pointer to the tree control.



wxGenericDirCtrl::ReCreateTree



void ReCreateTree(void)

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.

ymasuda 平成17年11月19日