X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ae3c17b4013e80b99976c750c19fca47729517f6..033b1b94130087b9a36cf8815ae42d7a347e16c0:/interface/wx/filectrl.h diff --git a/interface/wx/filectrl.h b/interface/wx/filectrl.h index dfbc382192..4681df1149 100644 --- a/interface/wx/filectrl.h +++ b/interface/wx/filectrl.h @@ -3,17 +3,18 @@ // Purpose: interface of wxFileCtrl // Author: wxWidgets team // RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// /** @class wxFileCtrl - @wxheader{filectrl.h} 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. + Two implementations of this class exist, one for Gtk and another generic + one for all the other ports. + + This class is only available if @c wxUSE_FILECTRL is set to 1. @beginStyleTable @style{wxFC_DEFAULT_STYLE} @@ -31,24 +32,28 @@ Hides the "Show Hidden Files" checkbox (Generic only) @endStyleTable - - @beginEventTable{wxFileCtrlEvent} + @beginEventEmissionTable{wxFileCtrlEvent} @event{EVT_FILECTRL_FILEACTIVATED(id, func)} The user activated a file(by double-clicking or pressing Enter) @event{EVT_FILECTRL_SELECTIONCHANGED(id, func)} The user changed the current selection(by selecting or deselecting a file) @event{EVT_FILECTRL_FOLDERCHANGED(id, func)} The current folder of the file control has been changed - @endEventTable + @event{EVT_FILECTRL_FILTERCHANGED(id, func)} + The current file filter of the file control has been changed. + @since 2.9.1. - @nativeimpl{gtk} + @endEventTable @library{wxbase} - @category{miscwnd} + @category{ctrl} + @appearance{filectrl.png} + + @nativeimpl{wxgtk} @see wxGenericDirCtrl */ -class wxFileCtrl : public wxWindow +class wxFileCtrl : public wxControl { public: wxFileCtrl(); @@ -61,12 +66,12 @@ public: @param id The identifier for the control. @param defaultDirectory - The initial directory shown in the control. Must be - a valid path to a directory or the empty string. + 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. @param defaultFilename The default filename, or the empty string. - @param wildcard + @param wildCard A wildcard specifying which files can be selected, such as "*.*" or "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif". @param style @@ -89,7 +94,7 @@ public: long style = wxFC_DEFAULT_STYLE, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - const wxString& name = "filectrl"); + const wxString& name = wxFileCtrlNameStr); /** Create function for two-step construction. See wxFileCtrl() for details. @@ -97,23 +102,22 @@ public: bool Create(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 wxString& wildCard = wxFileSelectorDefaultWildcardStr, + long style = wxFC_DEFAULT_STYLE, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, - const wxString& name = "filectrl"); + const wxString& name = wxFileCtrlNameStr); /** Returns the current directory of the file control (i.e. the directory shown by it). */ - wxString GetDirectory() const; + virtual wxString GetDirectory() const; /** Returns the currently selected filename. For the controls having the @c wxFC_MULTIPLE style, use GetFilenames() instead. */ - wxString GetFilename() const; + virtual wxString GetFilename() const; /** Fills the array @a filenames with the filenames only of selected items. @@ -123,18 +127,18 @@ public: @remarks filenames is emptied first. */ - void GetFilenames(wxArrayString& filenames) const; + virtual void GetFilenames(wxArrayString& filenames) const; /** Returns the zero-based index of the currently selected filter. */ - int GetFilterIndex() const; + virtual int GetFilterIndex() const; /** Returns the full path (directory and filename) of the currently selected file. For the controls having the @c wxFC_MULTIPLE style, use GetPaths() instead. */ - wxString GetPath() const; + virtual wxString GetPath() const; /** Fills the array @a paths with the full paths of the files chosen. @@ -144,49 +148,48 @@ public: @remarks paths is emptied first. */ - void GetPaths(wxArrayString& paths) const; + virtual void GetPaths(wxArrayString& paths) const; /** Returns the current wildcard. */ - wxString GetWildcard() const; + virtual wxString GetWildcard() const; /** Sets(changes) the current directory displayed in the control. @return Returns @true on success, @false otherwise. */ - bool SetDirectory(const wxString& directory); + virtual bool SetDirectory(const wxString& directory); /** Selects a certain file. @return Returns @true on success, @false otherwise */ - bool SetFilename(const wxString& filename); + virtual bool SetFilename(const wxString& filename); /** Sets the current filter index, starting from zero. */ - void SetFilterIndex(int filterIndex); + virtual 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); + virtual void SetWildcard(const wxString& wildCard); /** Sets whether hidden files and folders are shown or not. */ - void ShowHidden(const bool show); + virtual void ShowHidden(bool show); }; /** @class wxFileCtrlEvent - @wxheader{filectrl.h} A file control event holds information about events associated with wxFileCtrl objects. @@ -198,6 +201,8 @@ public: The user changed the current selection(by selecting or deselecting a file) @event{EVT_FILECTRL_FOLDERCHANGED(id, func)} The current folder of the file control has been changed + @event{EVT_FILECTRL_FILTERCHANGED(id, func)} + The current file filter of the file control has been changed @endEventTable @library{wxbase} @@ -209,7 +214,7 @@ public: /** Constructor. */ - wxFileCtrlEvent(wxEventType type, wxObject evtObject, int id); + wxFileCtrlEvent(wxEventType type, wxObject *evtObject, int id); /** Returns the current directory. @@ -232,15 +237,32 @@ public: */ wxArrayString GetFiles() const; + /** + Returns the current file filter index. + + For a @b EVT_FILECTRL_FILTERCHANGED event, this method returns the new + file filter index. + + @since 2.9.1 + */ + int GetFilterIndex() const; + /** Sets the files changed by this event. */ - void SetFiles(const wxArrayString files); + void SetFiles(const wxArrayString& files); /** Sets the directory of this event. */ void SetDirectory( const wxString &directory ); + + /** + Sets the filter index changed by this event. + + @since 2.9.1 + */ + void SetFilterIndex(int index); };