X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/adaaa68635b4c8a4d8c5284add40366ea3eefb07..9e9574fe45b176ee74bba8fad7574cf9906145d1:/interface/wx/filectrl.h?ds=inline diff --git a/interface/wx/filectrl.h b/interface/wx/filectrl.h index 55a6214b73..a56f8023a5 100644 --- a/interface/wx/filectrl.h +++ b/interface/wx/filectrl.h @@ -2,17 +2,28 @@ // Name: filectrl.h // Purpose: interface of wxFileCtrl // Author: wxWidgets team -// RCS-ID: $Id$ -// Licence: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +enum +{ + wxFC_OPEN = 0x0001, + wxFC_SAVE = 0x0002, + wxFC_MULTIPLE = 0x0004, + wxFC_NOSHOWHIDDEN = 0x0008 +}; + +#define wxFC_DEFAULT_STYLE wxFC_OPEN + /** @class wxFileCtrl 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} @@ -30,24 +41,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 + @event{EVT_FILECTRL_FILTERCHANGED(id, func)} + The current file filter of the file control has been changed. + @since 2.9.1. + @endEventTable - @nativeimpl{wxgtk} + @library{wxcore} + @category{ctrl} + @appearance{filectrl} - @library{wxbase} - @category{miscwnd} + @nativeimpl{wxgtk} @see wxGenericDirCtrl */ -class wxFileCtrl : public wxWindow +class wxFileCtrl : public wxControl { public: wxFileCtrl(); @@ -60,12 +75,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 @@ -84,11 +99,11 @@ public: wxFileCtrl(wxWindow* parent, wxWindowID id, const wxString& defaultDirectory = wxEmptyString, const wxString& defaultFilename = wxEmptyString, - const wxPoint& wildCard = wxFileSelectorDefaultWildcardStr, + 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); /** Create function for two-step construction. See wxFileCtrl() for details. @@ -96,14 +111,13 @@ 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). + Returns the current directory of the file control (i.e.\ the directory shown by it). */ virtual wxString GetDirectory() const; @@ -164,6 +178,16 @@ public: */ virtual bool SetFilename(const wxString& filename); + /** + 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. + + @return Returns @true on success, @false otherwise + */ + virtual bool SetPath(const wxString& path); + /** Sets the current filter index, starting from zero. */ @@ -178,10 +202,15 @@ public: /** Sets whether hidden files and folders are shown or not. */ - void ShowHidden(const bool show); + virtual void ShowHidden(bool show); }; +wxEventType wxEVT_FILECTRL_SELECTIONCHANGED; +wxEventType wxEVT_FILECTRL_FILEACTIVATED; +wxEventType wxEVT_FILECTRL_FOLDERCHANGED; +wxEventType wxEVT_FILECTRL_FILTERCHANGED; + /** @class wxFileCtrlEvent @@ -196,9 +225,11 @@ 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} + @library{wxcore} @category{events} */ class wxFileCtrlEvent : public wxCommandEvent @@ -207,7 +238,7 @@ public: /** Constructor. */ - wxFileCtrlEvent(wxEventType type, wxObject evtObject, int id); + wxFileCtrlEvent(wxEventType type, wxObject *evtObject, int id); /** Returns the current directory. @@ -230,15 +261,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); };