X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0cf3e587a2ec542ba1eb6e03a84c54edefae1881..cc4d5638c66a409e421420ed7110917755a66788:/src/common/filectrlcmn.cpp?ds=sidebyside diff --git a/src/common/filectrlcmn.cpp b/src/common/filectrlcmn.cpp index d6b4adb044..f4c8fd27aa 100644 --- a/src/common/filectrlcmn.cpp +++ b/src/common/filectrlcmn.cpp @@ -4,7 +4,6 @@ // platform-specific wxFileCtrl's // Author: Diaa M. Sami // Created: 2007-07-07 -// RCS-ID: $Id$ // Copyright: (c) Diaa M. Sami // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -23,16 +22,26 @@ # include "wx/debug.h" #endif -const wxChar wxFileCtrlNameStr[] = wxT( "wxfilectrl" ); +const char wxFileCtrlNameStr[] = "wxfilectrl"; -DEFINE_EVENT_TYPE( wxEVT_FILECTRL_SELECTIONCHANGED ); -DEFINE_EVENT_TYPE( wxEVT_FILECTRL_FILEACTIVATED ); -DEFINE_EVENT_TYPE( wxEVT_FILECTRL_FOLDERCHANGED ); +wxDEFINE_EVENT( wxEVT_FILECTRL_SELECTIONCHANGED, wxFileCtrlEvent ); +wxDEFINE_EVENT( wxEVT_FILECTRL_FILEACTIVATED, wxFileCtrlEvent ); +wxDEFINE_EVENT( wxEVT_FILECTRL_FOLDERCHANGED, wxFileCtrlEvent ); +wxDEFINE_EVENT( wxEVT_FILECTRL_FILTERCHANGED, wxFileCtrlEvent ); IMPLEMENT_DYNAMIC_CLASS( wxFileCtrlEvent, wxCommandEvent ) // some helper functions +void GenerateFilterChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ) +{ + wxFileCtrlEvent event( wxEVT_FILECTRL_FILTERCHANGED, wnd, wnd->GetId() ); + + event.SetFilterIndex( fileCtrl->GetFilterIndex() ); + + wnd->GetEventHandler()->ProcessEvent( event ); +} + void GenerateFolderChangedEvent( wxFileCtrlBase *fileCtrl, wxWindow *wnd ) { wxFileCtrlEvent event( wxEVT_FILECTRL_FOLDERCHANGED, wnd, wnd->GetId() ); @@ -84,10 +93,10 @@ wxString wxFileCtrlEvent::GetFile() const wxASSERT_MSG( !wxDynamicCast( GetEventObject(), wxFileCtrl )->HasMultipleFileSelection(), wxT( "Please use GetFiles() to get all files instead of this function" ) ); - if ( files.Count() == 0 ) - return wxEmptyString; - else - return files[0]; + wxString string; + if (m_files.Count() != 0) + string = m_files[0]; + return string; } #endif // wxUSE_FILECTRL