- Added wxTextCtrl::PositionToCoords() (Navaneeth).
- Added support for wxHELP button to wxMessageDialog.
- Added wxBannerWindow class.
+- Added wxTextEntry::AutoCompleteDirectories().
- Support float, double and file name values in wxGenericValidator (troelsk).
- Fix keyboard navigation in wxGrid with hidden columns (ivan_14_32).
- Add wxDataViewEvent::IsEditCancelled() (Allonii).
// wxUSE_OLE as OleInitialize() is not called then
#if wxUSE_OLE
virtual bool DoAutoCompleteStrings(const wxArrayString& choices);
- virtual bool DoAutoCompleteFileNames();
+ virtual bool DoAutoCompleteFileNames(int flags);
virtual bool DoAutoCompleteCustom(wxTextCompleter *completer);
#endif // wxUSE_OLE
class WXDLLIMPEXP_FWD_CORE wxTextEntryHintData;
class WXDLLIMPEXP_FWD_CORE wxWindow;
+#include "wx/filefn.h" // for wxFILE and wxDIR only
#include "wx/gdicmn.h" // for wxPoint
// ----------------------------------------------------------------------------
{ return DoAutoCompleteStrings(choices); }
bool AutoCompleteFileNames()
- { return DoAutoCompleteFileNames(); }
+ { return DoAutoCompleteFileNames(wxFILE); }
+
+ bool AutoCompleteDirectories()
+ { return DoAutoCompleteFileNames(wxDIR); }
// notice that we take ownership of the pointer and will delete it
//
// the other one(s)
virtual bool DoAutoCompleteStrings(const wxArrayString& WXUNUSED(choices))
{ return false; }
- virtual bool DoAutoCompleteFileNames() { return false; }
+ virtual bool DoAutoCompleteFileNames(int WXUNUSED(flags)) // wxFILE | wxDIR
+ { return false; }
virtual bool DoAutoCompleteCustom(wxTextCompleter *completer);
*/
bool AutoCompleteFileNames();
+ /**
+ Call this function to enable auto-completion of the text using the file
+ system directories.
+
+ Unlike AutoCompleteFileNames() which completes both file names and
+ directories, this function only completes the directory names.
+
+ Notice that currently this function is only implemented in wxMSW port
+ and does nothing under the other platforms.
+
+ @since 2.9.3
+
+ @return
+ @true if the auto-completion was enabled or @false if the operation
+ failed, typically because auto-completion is not supported by the
+ current platform.
+
+ @see AutoComplete()
+ */
+ bool AutoCompleteDirectories();
+
/**
Returns @true if the selection can be copied to the clipboard.
*/
TextEntry_DisableAutoComplete = TextEntry_Begin,
TextEntry_AutoCompleteFixed,
TextEntry_AutoCompleteFilenames,
+ TextEntry_AutoCompleteDirectories,
TextEntry_AutoCompleteCustom,
TextEntry_SetHint,
void OnDisableAutoComplete(wxCommandEvent& event);
void OnAutoCompleteFixed(wxCommandEvent& event);
void OnAutoCompleteFilenames(wxCommandEvent& event);
+ void OnAutoCompleteDirectories(wxCommandEvent& event);
void OnAutoCompleteCustom(wxCommandEvent& event);
void OnSetHint(wxCommandEvent& event);
EVT_MENU(TextEntry_DisableAutoComplete, WidgetsFrame::OnDisableAutoComplete)
EVT_MENU(TextEntry_AutoCompleteFixed, WidgetsFrame::OnAutoCompleteFixed)
EVT_MENU(TextEntry_AutoCompleteFilenames, WidgetsFrame::OnAutoCompleteFilenames)
+ EVT_MENU(TextEntry_AutoCompleteDirectories, WidgetsFrame::OnAutoCompleteDirectories)
EVT_MENU(TextEntry_AutoCompleteCustom, WidgetsFrame::OnAutoCompleteCustom)
EVT_MENU(TextEntry_SetHint, WidgetsFrame::OnSetHint)
wxT("Fixed-&list auto-completion"));
menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteFilenames,
wxT("&Files names auto-completion"));
+ menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteDirectories,
+ wxT("&Directories names auto-completion"));
menuTextEntry->AppendRadioItem(TextEntry_AutoCompleteCustom,
wxT("&Custom auto-completion"));
menuTextEntry->AppendSeparator();
}
}
+void WidgetsFrame::OnAutoCompleteDirectories(wxCommandEvent& WXUNUSED(event))
+{
+ wxTextEntryBase *entry = CurrentPage()->GetTextEntry();
+ wxCHECK_RET( entry, "menu item should be disabled" );
+
+ if ( entry->AutoCompleteDirectories() )
+ {
+ wxLogMessage("Enabled auto completion of directories.");
+ }
+ else
+ {
+ wxLogMessage("AutoCompleteDirectories() failed.");
+ }
+}
+
void WidgetsFrame::OnAutoCompleteCustom(wxCommandEvent& WXUNUSED(event))
{
wxTextEntryBase *entry = CurrentPage()->GetTextEntry();
#define SHACF_FILESYS_ONLY 0x00000010
#endif
+#ifndef SHACF_FILESYS_DIRS
+ #define SHACF_FILESYS_DIRS 0x00000020
+#endif
+
namespace
{
#ifdef HAS_AUTOCOMPLETE
-bool wxTextEntry::DoAutoCompleteFileNames()
+bool wxTextEntry::DoAutoCompleteFileNames(int flags)
{
typedef HRESULT (WINAPI *SHAutoComplete_t)(HWND, DWORD);
static SHAutoComplete_t s_pfnSHAutoComplete = (SHAutoComplete_t)-1;
if ( !s_pfnSHAutoComplete )
return false;
- HRESULT hr = (*s_pfnSHAutoComplete)(GetEditHwnd(), SHACF_FILESYS_ONLY);
+ DWORD dwFlags = 0;
+ if ( flags & wxFILE )
+ dwFlags |= SHACF_FILESYS_ONLY;
+ else if ( flags & wxDIR )
+ dwFlags |= SHACF_FILESYS_DIRS;
+ else
+ {
+ wxFAIL_MSG(wxS("No flags for file name auto completion?"));
+ return false;
+ }
+
+ HRESULT hr = (*s_pfnSHAutoComplete)(GetEditHwnd(), dwFlags);
if ( FAILED(hr) )
{
wxLogApiError(wxT("SHAutoComplete()"), hr);
// We still need to define stubs as we declared these overrides in the header.
-bool wxTextEntry::DoAutoCompleteFileNames()
+bool wxTextEntry::DoAutoCompleteFileNames(int flags)
{
- return wxTextEntryBase::DoAutoCompleteFileNames();
+ return wxTextEntryBase::DoAutoCompleteFileNames(flags);
}
bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices)