2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: filectrl.h
|
2008-03-10 15:24:38 +00:00
|
|
|
// Purpose: interface of wxFileCtrl
|
2008-03-08 13:52:38 +00:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
/**
|
|
|
|
@class wxFileCtrl
|
|
|
|
@wxheader{filectrl.h}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
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 @c wxUSE_FILECTRL is set to 1.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@beginStyleTable
|
|
|
|
@style{wxFC_DEFAULT_STYLE}:
|
|
|
|
The default style: wxFC_OPEN
|
|
|
|
@style{wxFC_OPEN}:
|
|
|
|
Creates an file control suitable for opening files. Cannot be
|
|
|
|
combined with wxFC_SAVE.
|
|
|
|
@style{wxFC_SAVE}:
|
|
|
|
Creates an file control suitable for saving files. Cannot be
|
|
|
|
combined with wxFC_OPEN.
|
|
|
|
@style{wxFC_MULTIPLE}:
|
|
|
|
For open control only, Allows selecting multiple files. Cannot be
|
|
|
|
combined with wxFC_SAVE
|
|
|
|
@style{wxFC_NOSHOWHIDDEN}:
|
|
|
|
Hides the "Show Hidden Files" checkbox (Generic only)
|
|
|
|
@endStyleTable
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxbase}
|
|
|
|
@category{FIXME}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
@see wxGenericDirCtrl
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
class wxFileCtrl : public wxWindow
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
//@{
|
|
|
|
/**
|
2008-03-08 14:43:31 +00:00
|
|
|
@param parent
|
2008-03-09 12:33:59 +00:00
|
|
|
Parent window, must not be non-@NULL.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param id
|
2008-03-09 12:33:59 +00:00
|
|
|
The identifier for the control.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param defaultDirectory
|
2008-03-09 12:33:59 +00:00
|
|
|
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.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param defaultFilename
|
2008-03-09 12:33:59 +00:00
|
|
|
The default filename, or the empty string.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param wildcard
|
2008-03-09 12:33:59 +00:00
|
|
|
A wildcard specifying which files can be selected,
|
|
|
|
such as "*.*" or "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif".
|
2008-03-08 14:43:31 +00:00
|
|
|
@param style
|
2008-03-09 12:33:59 +00:00
|
|
|
The window style, see wxFC_* flags.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param pos
|
2008-03-09 12:33:59 +00:00
|
|
|
Initial position.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param size
|
2008-03-09 12:33:59 +00:00
|
|
|
Initial size.
|
2008-03-08 14:43:31 +00:00
|
|
|
@param name
|
2008-03-09 12:33:59 +00:00
|
|
|
Control name.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@returns @true if the control was successfully created or @false if
|
2008-03-09 12:33:59 +00:00
|
|
|
creation failed.
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
|
|
|
wxFileCtrl();
|
2008-03-09 12:33:59 +00:00
|
|
|
wxFileCtrl(wxWindow* parent, wxWindowID id,
|
2008-03-08 14:43:31 +00:00
|
|
|
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 = "filectrl");
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/**
|
|
|
|
Create function for two-step construction. See wxFileCtrl() for details.
|
|
|
|
*/
|
2008-03-09 12:33:59 +00:00
|
|
|
bool Create(wxWindow* parent, wxWindowID id,
|
2008-03-08 13:52:38 +00:00
|
|
|
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 = "filectrl");
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the current directory of the file control (i.e. the directory shown by
|
|
|
|
it).
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxString GetDirectory() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the currently selected filename.
|
|
|
|
For the controls having the @c wxFC_MULTIPLE style, use GetFilenames()
|
|
|
|
instead
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxString GetFilename() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-09 12:33:59 +00:00
|
|
|
Fills the array @a filenames with the filenames only of selected items. This
|
2008-03-08 13:52:38 +00:00
|
|
|
function should only be used with the controls having the @c wxFC_MULTIPLE
|
|
|
|
style,
|
|
|
|
use GetFilename() for the others.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@remarks filenames is emptied first.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
void GetFilenames(wxArrayString& filenames) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the zero-based index of the currently selected filter.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
int GetFilterIndex() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the full path (directory and filename) of the currently selected file.
|
|
|
|
For the controls having the @c wxFC_MULTIPLE style, use GetPaths()
|
|
|
|
instead
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxString GetPath() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
2008-03-09 12:33:59 +00:00
|
|
|
Fills the array @a paths with the full paths of the files chosen. This
|
2008-03-08 13:52:38 +00:00
|
|
|
function should be used with the controls having the @c wxFC_MULTIPLE style,
|
|
|
|
use GetPath() otherwise.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@remarks paths is emptied first.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
void GetPaths(wxArrayString& paths) const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the current wildcard.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxString GetWildcard() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets(changes) the current directory displayed in the control.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@returns Returns @true on success, @false otherwise.
|
|
|
|
*/
|
|
|
|
bool SetDirectory(const wxString& directory);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Selects a certain file.
|
2008-03-20 13:45:17 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@returns Returns @true on success, @false otherwise
|
|
|
|
*/
|
|
|
|
bool SetFilename(const wxString& filename);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the current filter index, starting from zero.
|
|
|
|
*/
|
|
|
|
void SetFilterIndex(int filterIndex);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the wildcard, which can contain multiple file types, for example:
|
|
|
|
"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
|
|
|
|
*/
|
|
|
|
void SetWildcard(const wxString& wildCard);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets whether hidden files and folders are shown or not.
|
|
|
|
*/
|
|
|
|
void ShowHidden(const bool show);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 15:24:38 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
|
|
|
@class wxFileCtrlEvent
|
|
|
|
@wxheader{filectrl.h}
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
A file control event holds information about events associated with
|
|
|
|
wxFileCtrl objects.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@library{wxbase}
|
|
|
|
@category{FIXME}
|
|
|
|
*/
|
|
|
|
class wxFileCtrlEvent : public wxCommandEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructor.
|
|
|
|
*/
|
|
|
|
wxFileCtrlEvent(wxEventType type, wxObject evtObject, int id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the current directory.
|
|
|
|
In case of a @b EVT_FILECTRL_FOLDERCHANGED, this method returns the new
|
|
|
|
directory.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxString GetDirectory() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the file selected(assuming it is only one file).
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxString GetFile() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the files selected.
|
|
|
|
In case of a @b EVT_FILECTRL_SELECTIONCHANGED, this method returns the
|
|
|
|
files selected after the event.
|
|
|
|
*/
|
2008-03-09 16:24:26 +00:00
|
|
|
wxArrayString GetFiles() const;
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the files changed by this event.
|
|
|
|
*/
|
2008-03-08 14:43:31 +00:00
|
|
|
wxFileCtrlEvent::SetFiles(const wxArrayString files);
|
2008-03-08 13:52:38 +00:00
|
|
|
};
|
2008-03-10 15:24:38 +00:00
|
|
|
|