wxFileCtrl Class Reference
[Controls]

#include <wx/filectrl.h>

Inheritance diagram for wxFileCtrl:
Inheritance graph
[legend]

Detailed Description

This control allows the user to select a file.

Two implemetations exist, one for Gtk and another generic one for anything other than Gtk. It 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:  wxBase
Category:  Controls

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

Public Member Functions

 wxFileCtrl ()
 wxFileCtrl (wxWindow *parent, wxWindowID id, const wxString &defaultDirectory=wxEmptyString, const wxString &defaultFilename=wxEmptyString, const wxPoint &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 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 wxPoint wildCard = wxFileSelectorDefaultWildcardStr,
long  style = wxFC_DEFAULT_STYLE,
const wxPoint pos = wxDefaultPosition,
const wxSize size = wxDefaultSize,
const wxString name = wxFileCtrlNameStr 
)

Constructs the window.

Parameters:
parent Parent window, must not be non-NULL.
id The identifier for the control.
defaultDirectory The 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.
defaultFilename The default filename, or the empty string.
wildCard A wildcard specifying which files can be selected, such as "*.*" or "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif".
style The window style, see wxFC_* flags.
pos Initial position.
size Initial size.
name Control 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.

Remarks:
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.

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



wxWidgets logo

[ top ]