Version: 2.9.4
Public Member Functions
wxFileCtrl Class Reference

#include </home/zeitlin/src/wx/github/interface/wx/filectrl.h>

Inheritance diagram for wxFileCtrl:

Detailed Description

This control allows the user to select a file.

Two implementations of this class exist, one for Gtk and another generic one for all the other ports.

This class is only available if wxUSE_FILECTRL is set to 1.

Styles

This class supports the following styles:

Events emitted by this class

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxFileCtrlEvent& event)

Event macros for events emitted by this class:

Library:  wxCore
Category:  Controls

Appearance:
wxMSW appearancewxGTK appearancewxMac appearance
wxMSW appearancewxGTK appearancewxMac appearance
Implementations:  native under wxGTK port; a generic implementation is used elsewhere.
参照:
wxGenericDirCtrl

Public Member Functions

 wxFileCtrl ()
 wxFileCtrl (wxWindow *parent, wxWindowID id, const wxString &defaultDirectory=wxEmptyString, const wxString &defaultFilename=wxEmptyString, const wxString &wildCard=wxFileSelectorDefaultWildcardStr, long style=wxFC_DEFAULT_STYLE, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, const wxString &name=wxFileCtrlNameStr)
 Constructs the window.
bool Create (wxWindow *parent, wxWindowID id, const wxString &defaultDirectory=wxEmptyString, const wxString &defaultFilename=wxEmptyString, const wxString &wildCard=wxFileSelectorDefaultWildcardStr, long style=wxFC_DEFAULT_STYLE, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, const wxString &name=wxFileCtrlNameStr)
 Create function for two-step construction.
virtual wxString GetDirectory () const
 Returns the current directory of the file control (i.e.
virtual wxString GetFilename () const
 Returns the currently selected filename.
virtual void GetFilenames (wxArrayString &filenames) const
 Fills the array filenames with the filenames only of selected items.
virtual int GetFilterIndex () const
 Returns the zero-based index of the currently selected filter.
virtual wxString GetPath () const
 Returns the full path (directory and filename) of the currently selected file.
virtual void GetPaths (wxArrayString &paths) const
 Fills the array paths with the full paths of the files chosen.
virtual wxString GetWildcard () const
 Returns the current wildcard.
virtual bool SetDirectory (const wxString &directory)
 Sets(changes) the current directory displayed in the control.
virtual bool SetFilename (const wxString &filename)
 Selects a certain file.
virtual bool SetPath (const wxString &path)
 Changes to a certain directory and selects a certain file.
virtual void SetFilterIndex (int filterIndex)
 Sets the current filter index, starting from zero.
virtual void SetWildcard (const wxString &wildCard)
 Sets the wildcard, which can contain multiple file types, for example: "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif".
virtual void ShowHidden (bool show)
 Sets whether hidden files and folders are shown or not.

List of all members.


Constructor & Destructor Documentation

wxFileCtrl::wxFileCtrl ( )
wxFileCtrl::wxFileCtrl ( wxWindow parent,
wxWindowID  id,
const wxString defaultDirectory = wxEmptyString,
const wxString defaultFilename = wxEmptyString,
const wxString wildCard = wxFileSelectorDefaultWildcardStr,
long  style = wxFC_DEFAULT_STYLE,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
const wxString name = wxFileCtrlNameStr 
)

Constructs the window.

Parameters:
parentParent window, must not be non-NULL.
idThe identifier for the control.
defaultDirectoryThe initial directory shown in the control. Must be a valid path to a directory or the empty string. In case it is the empty string, the current working directory is used.
defaultFilenameThe default filename, or the empty string.
wildCardA wildcard specifying which files can be selected, such as "*.*" or "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif".
styleThe window style, see wxFC_* flags.
posInitial position.
sizeInitial size.
nameControl name.
Returns:
true if the control was successfully created or false if creation failed.

Member Function Documentation

bool wxFileCtrl::Create ( wxWindow parent,
wxWindowID  id,
const wxString defaultDirectory = wxEmptyString,
const wxString defaultFilename = wxEmptyString,
const wxString wildCard = wxFileSelectorDefaultWildcardStr,
long  style = wxFC_DEFAULT_STYLE,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
const wxString name = wxFileCtrlNameStr 
)

Create function for two-step construction.

See wxFileCtrl() for details.

virtual wxString wxFileCtrl::GetDirectory ( ) const [virtual]

Returns the current directory of the file control (i.e.

the directory shown by it).

virtual wxString wxFileCtrl::GetFilename ( ) const [virtual]

Returns the currently selected filename.

For the controls having the wxFC_MULTIPLE style, use GetFilenames() instead.

virtual void wxFileCtrl::GetFilenames ( wxArrayString filenames) const [virtual]

Fills the array filenames with the filenames only of selected items.

This function should only be used with the controls having the wxFC_MULTIPLE style, use GetFilename() for the others.

注意:
filenames is emptied first.
virtual int wxFileCtrl::GetFilterIndex ( ) const [virtual]

Returns the zero-based index of the currently selected filter.

virtual wxString wxFileCtrl::GetPath ( ) const [virtual]

Returns the full path (directory and filename) of the currently selected file.

For the controls having the wxFC_MULTIPLE style, use GetPaths() instead.

virtual void wxFileCtrl::GetPaths ( wxArrayString paths) const [virtual]

Fills the array paths with the full paths of the files chosen.

This function should be used with the controls having the wxFC_MULTIPLE style, use GetPath() otherwise.

注意:
paths is emptied first.
virtual wxString wxFileCtrl::GetWildcard ( ) const [virtual]

Returns the current wildcard.

virtual bool wxFileCtrl::SetDirectory ( const wxString directory) [virtual]

Sets(changes) the current directory displayed in the control.

Returns:
Returns true on success, false otherwise.
virtual bool wxFileCtrl::SetFilename ( const wxString filename) [virtual]

Selects a certain file.

Returns:
Returns true on success, false otherwise
virtual void wxFileCtrl::SetFilterIndex ( int  filterIndex) [virtual]

Sets the current filter index, starting from zero.

virtual bool wxFileCtrl::SetPath ( const wxString path) [virtual]

Changes to a certain directory and selects a certain file.

In case the filename specified isn't found/couldn't be shown with currently selected filter, false is returned.

Returns:
Returns true on success, false otherwise
virtual void wxFileCtrl::SetWildcard ( const wxString wildCard) [virtual]

Sets the wildcard, which can contain multiple file types, for example: "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif".

virtual void wxFileCtrl::ShowHidden ( bool  show) [virtual]

Sets whether hidden files and folders are shown or not.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines