X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0cf3e587a2ec542ba1eb6e03a84c54edefae1881..a7689c49fe02c0c065facf736ab28b19f5997b7c:/include/wx/generic/filectrlg.h?ds=sidebyside diff --git a/include/wx/generic/filectrlg.h b/include/wx/generic/filectrlg.h index 5195b464a5..9bcc5d08d6 100644 --- a/include/wx/generic/filectrlg.h +++ b/include/wx/generic/filectrlg.h @@ -14,22 +14,23 @@ #if wxUSE_FILECTRL -#include "wx/panel.h" +#include "wx/containr.h" #include "wx/listctrl.h" #include "wx/filectrl.h" +#include "wx/filename.h" class WXDLLIMPEXP_FWD_CORE wxCheckBox; class WXDLLIMPEXP_FWD_CORE wxChoice; class WXDLLIMPEXP_FWD_CORE wxStaticText; class WXDLLIMPEXP_FWD_CORE wxTextCtrl; -extern WXDLLEXPORT_DATA(const wxChar) wxFileSelectorDefaultWildcardStr[]; +extern WXDLLIMPEXP_DATA_CORE(const char) wxFileSelectorDefaultWildcardStr[]; //----------------------------------------------------------------------------- -// wxFileData - a class to hold the file info for the wxFileList +// wxFileData - a class to hold the file info for the wxFileListCtrl //----------------------------------------------------------------------------- -class WXDLLEXPORT wxFileData +class WXDLLIMPEXP_CORE wxFileData { public: enum fileType @@ -83,7 +84,7 @@ public: // Get/Set the type of file, file/dir/drive/link int GetType() const { return m_type; } - // the wxFileList fields in report view + // the wxFileListCtrl fields in report view enum fileListFieldType { FileList_Name, @@ -96,7 +97,7 @@ public: FileList_Max }; - // Get the entry for report view of wxFileList + // Get the entry for report view of wxFileListCtrl wxString GetEntry( fileListFieldType num ) const; // Get a string representation of the file info @@ -121,14 +122,14 @@ private: }; //----------------------------------------------------------------------------- -// wxFileList +// wxFileListCtrl //----------------------------------------------------------------------------- -class WXDLLEXPORT wxFileList : public wxListCtrl +class WXDLLIMPEXP_CORE wxFileListCtrl : public wxListCtrl { public: - wxFileList(); - wxFileList( wxWindow *win, + wxFileListCtrl(); + wxFileListCtrl( wxWindow *win, wxWindowID id, const wxString &wild, bool showHidden, @@ -137,7 +138,7 @@ public: long style = wxLC_LIST, const wxValidator &validator = wxDefaultValidator, const wxString &name = wxT("filelist") ); - virtual ~wxFileList(); + virtual ~wxFileListCtrl(); virtual void ChangeToListMode(); virtual void ChangeToReportMode(); @@ -161,8 +162,8 @@ public: void OnListEndLabelEdit( wxListEvent &event ); void OnListColClick( wxListEvent &event ); - virtual void SortItems(wxFileData::fileListFieldType field, bool foward); - bool GetSortDirection() const { return m_sort_foward; } + virtual void SortItems(wxFileData::fileListFieldType field, bool forward); + bool GetSortDirection() const { return m_sort_forward; } wxFileData::fileListFieldType GetSortField() const { return m_sort_field; } protected: @@ -173,15 +174,15 @@ protected: bool m_showHidden; wxString m_wild; - bool m_sort_foward; + bool m_sort_forward; wxFileData::fileListFieldType m_sort_field; private: - DECLARE_DYNAMIC_CLASS(wxFileList) + DECLARE_DYNAMIC_CLASS(wxFileListCtrl) DECLARE_EVENT_TABLE() }; -class WXDLLIMPEXP_CORE wxGenericFileCtrl : public wxPanel, +class WXDLLIMPEXP_CORE wxGenericFileCtrl : public wxNavigationEnabled, public wxFileCtrlBase { public: @@ -201,7 +202,8 @@ public: const wxString& name = wxFileCtrlNameStr ) { m_ignoreChanges = false; - Create( parent, id, defaultDirectory, defaultFilename, wildCard, style, pos, size, name ); + Create(parent, id, defaultDirectory, defaultFilename, wildCard, + style, pos, size, name ); } virtual ~wxGenericFileCtrl() {} @@ -221,11 +223,14 @@ public: virtual bool SetDirectory( const wxString& dir ); // Selects a certain file. - // In case the filename specified isn't found/couldn't be shown with currently selected filter, false is returned and nothing happens + // In case the filename specified isn't found/couldn't be shown with + // currently selected filter, false is returned and nothing happens virtual bool SetFilename( const wxString& name ); - // chdirs 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 and if directory exists it's chdir'ed to + // 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 and if directory exists + // it's chdir'ed to virtual bool SetPath( const wxString& path ); virtual wxString GetFilename() const; @@ -236,13 +241,20 @@ public: virtual void GetFilenames( wxArrayString& files ) const; virtual int GetFilterIndex() const { return m_filterIndex; } - virtual bool HasMultipleFileSelection() const { return m_style & wxFC_MULTIPLE; } - virtual void ShowHidden(const bool show) { m_list->ShowHidden( show ); } + virtual bool HasMultipleFileSelection() const + { return HasFlag(wxFC_MULTIPLE); } + virtual void ShowHidden(bool show) { m_list->ShowHidden( show ); } void GoToParentDir(); void GoToHomeDir(); - wxFileList *GetFileList() { return m_list; } + // get the directory currently shown in the control: this can be different + // from GetDirectory() if the user entered a full path (with a path other + // than the one currently shown in the control) in the text control + // manually + wxString GetShownDirectory() const { return m_list->GetDir(); } + + wxFileListCtrl *GetFileList() { return m_list; } void ChangeToReportMode() { m_list->ChangeToReportMode(); } void ChangeToListMode() { m_list->ChangeToListMode(); } @@ -259,27 +271,29 @@ private: void DoSetFilterIndex( int filterindex ); void UpdateControls(); - wxString DoGetFilename( const bool fullPath ) const; - void DoGetFilenames( wxArrayString& filenames, const bool fullPath ) const; - wxString GetProperFileListDir() const; + + // the first of these methods can only be used for the controls with single + // selection (i.e. without wxFC_MULTIPLE style), the second one in any case + wxFileName DoGetFileName() const; + void DoGetFilenames( wxArrayString& filenames, bool fullPath ) const; int m_style; - wxString m_filterExtension; - wxChoice *m_choice; - wxTextCtrl *m_text; - wxFileList *m_list; - wxCheckBox *m_check; - wxStaticText *m_static; + wxString m_filterExtension; + wxChoice *m_choice; + wxTextCtrl *m_text; + wxFileListCtrl *m_list; + wxCheckBox *m_check; + wxStaticText *m_static; - wxString m_dir; - wxString m_fileName; - wxString m_wildCard; // wild card in one string as passed to the object previously. + wxString m_dir; + wxString m_fileName; + wxString m_wildCard; // wild card in one string as we got it int m_filterIndex; - bool m_inSelected; + bool m_inSelected; bool m_ignoreChanges; - bool m_noSelChgEvent; // suppress selection changed events. + bool m_noSelChgEvent; // suppress selection changed events. DECLARE_DYNAMIC_CLASS( wxGenericFileCtrl ) DECLARE_EVENT_TABLE()