X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0cf3e587a2ec542ba1eb6e03a84c54edefae1881..ab67e8874db324fab5223cc8d5dff8a8de3e2b77:/include/wx/filectrl.h diff --git a/include/wx/filectrl.h b/include/wx/filectrl.h index b12a666d05..d741ae2ab1 100644 --- a/include/wx/filectrl.h +++ b/include/wx/filectrl.h @@ -25,17 +25,11 @@ enum wxFC_OPEN = 0x0001, wxFC_SAVE = 0x0002, wxFC_MULTIPLE = 0x0004, - wxFC_NOSHOWHIDDEN = 0x0008, + wxFC_NOSHOWHIDDEN = 0x0008 }; #define wxFC_DEFAULT_STYLE wxFC_OPEN -extern WXDLLEXPORT_DATA( const wxChar ) wxFileCtrlNameStr[]; - -BEGIN_DECLARE_EVENT_TYPES() - DECLARE_EXPORTED_EVENT_TYPE( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_SELECTIONCHANGED, 1150 ) - DECLARE_EXPORTED_EVENT_TYPE( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_FILEACTIVATED, 1151 ) - DECLARE_EXPORTED_EVENT_TYPE( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_FOLDERCHANGED, 1152 ) -END_DECLARE_EVENT_TYPES() +extern WXDLLIMPEXP_DATA_CORE(const char) wxFileCtrlNameStr[]; // in filectrlcmn.cpp class WXDLLIMPEXP_CORE wxFileCtrlBase { @@ -66,14 +60,15 @@ public: virtual int GetFilterIndex() const = 0; virtual bool HasMultipleFileSelection() const = 0; - virtual void ShowHidden(const bool show) = 0; + virtual void ShowHidden(bool show) = 0; }; +void GenerateFilterChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); void GenerateFolderChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); void GenerateSelectionChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ); void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const wxString filename = wxEmptyString ); -#if defined(__WXGTK24__) && !defined(__WXUNIVERSAL__) +#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__) #define wxFileCtrl wxGtkFileCtrl #include "wx/gtk/filectrl.h" #else @@ -82,6 +77,8 @@ void GenerateFileActivatedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd, const #endif // Some documentation +// On wxEVT_FILECTRL_FILTERCHANGED, only the value returned by GetFilterIndex is +// valid and it represents the (new) current filter index for the wxFileCtrl. // On wxEVT_FILECTRL_FOLDERCHANGED, only the value returned by GetDirectory is // valid and it represents the (new) current directory for the wxFileCtrl. // On wxEVT_FILECTRL_FILEACTIVATED, GetDirectory returns the current directory @@ -104,25 +101,33 @@ public: // no need for the copy constructor as the default one will be fine. virtual wxEvent *Clone() const { return new wxFileCtrlEvent( *this ); } - void SetFiles( const wxArrayString &files ) { this->files = files; } - void SetDirectory( const wxString &directory ) { this->directory = directory; } + void SetFiles( const wxArrayString &files ) { m_files = files; } + void SetDirectory( const wxString &directory ) { m_directory = directory; } + void SetFilterIndex( int filterIndex ) { m_filterIndex = filterIndex; } - wxArrayString GetFiles() const { return files; } - wxString GetDirectory() const { return directory; } + wxArrayString GetFiles() const { return m_files; } + wxString GetDirectory() const { return m_directory; } + int GetFilterIndex() const { return m_filterIndex; } wxString GetFile() const; protected: - wxString directory; - wxArrayString files; + int m_filterIndex; + wxString m_directory; + wxArrayString m_files; DECLARE_DYNAMIC_CLASS_NO_ASSIGN( wxFileCtrlEvent ) }; typedef void ( wxEvtHandler::*wxFileCtrlEventFunction )( wxFileCtrlEvent& ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_SELECTIONCHANGED, wxFileCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_FILEACTIVATED, wxFileCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_FOLDERCHANGED, wxFileCtrlEvent ); +wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_CORE, wxEVT_FILECTRL_FILTERCHANGED, wxFileCtrlEvent ); + #define wxFileCtrlEventHandler(func) \ - (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFileCtrlEventFunction, &func) + wxEVENT_HANDLER_CAST( wxFileCtrlEventFunction, func ) #define EVT_FILECTRL_FILEACTIVATED(id, fn) \ wx__DECLARE_EVT1(wxEVT_FILECTRL_FILEACTIVATED, id, wxFileCtrlEventHandler(fn)) @@ -133,6 +138,9 @@ typedef void ( wxEvtHandler::*wxFileCtrlEventFunction )( wxFileCtrlEvent& ); #define EVT_FILECTRL_FOLDERCHANGED(id, fn) \ wx__DECLARE_EVT1(wxEVT_FILECTRL_FOLDERCHANGED, id, wxFileCtrlEventHandler(fn)) +#define EVT_FILECTRL_FILTERCHANGED(id, fn) \ + wx__DECLARE_EVT1(wxEVT_FILECTRL_FILTERCHANGED, id, wxFileCtrlEventHandler(fn)) + #endif // wxUSE_FILECTRL #endif // _WX_FILECTRL_H_BASE_