All (GUI):
-- Added wxTextCtrl::AutoComplete()
+- Added {wxTextCtrl,wxComboBox}::AutoComplete() and AutoCompleteFileNames()
- Added wxH[V]ScrolledWindow (Brad Anderson, Bryan Petty).
- Added wxDC::StretchBlit() for wxMac and wxMSW (Vince Harron).
- Added support for drop down toolbar buttons (Tim Kosse).
\newsince{2.9.0}
+\wxheading{Return value}
+
+\true if the auto-completion was enabled or \false if the operation failed,
+typically because auto-completion is not supported by the current platform.
+
+\wxheading{See also}
+
+\helpref{AutoCompleteFileNames}{wxtextctrlautocompletefilenames}
+
+
+\membersection{wxTextCtrl::AutoCompleteFileNames}\label{wxtextctrlautocompletefilenames}
+
+\func{bool}{AutoCompleteFileNames}{\void}
+
+Call this function to enable auto-completion of the text typed in a single-line
+text control using all valid file system paths.
+
+Notice that currently this function is only implemented in wxGTK2 port and does
+nothing under the other platforms.
+
+\newsince{2.9.0}
+
+\wxheading{Return value}
+
+\true if the auto-completion was enabled or \false if the operation failed,
+typically because auto-completion is not supported by the current platform.
+
+\wxheading{See also}
+
+\helpref{AutoComplete}{wxtextctrlautocomplete}
+
\membersection{wxTextCtrl::CanCopy}\label{wxtextctrlcancopy}
{ DoSetSelection(from, to); }\r
virtual void GetSelection(long *from, long *to) const;\r
\r
+ virtual bool AutoCompleteFileNames();\r
+\r
virtual bool IsEditable() const;\r
virtual void SetEditable(bool editable);\r
\r
// auto-completion
// ---------------
- virtual void AutoComplete(const wxArrayString& WXUNUSED(choices)) { }
+ // these functions allow to auto-complete the text already entered into the
+ // control using either the given fixed list of strings, the paths from the
+ // file system or, in the future, an arbitrary user-defined completer
+ //
+ // they all return true if completion was enabled or false on error (most
+ // commonly meaning that this functionality is not available under the
+ // current platform)
+
+ virtual bool AutoComplete(const wxArrayString& WXUNUSED(choices))
+ {
+ return false;
+ }
+
+ virtual bool AutoCompleteFileNames() { return false; }
// status
#if wxUSE_TEXTCTRL || wxUSE_COMBOBOX
#include "wx/textentry.h"
+#include "wx/dynlib.h"
#include "wx/msw/private.h"
+#ifndef SHACF_FILESYS_ONLY
+ #define SHACF_FILESYS_ONLY 0x00000010
+#endif
+
#define GetEditHwnd() ((HWND)(GetEditHWND()))
// ============================================================================
*to = dwEnd;
}
+bool wxTextEntry::AutoCompleteFileNames()
+{
+ typedef HRESULT (WINAPI *SHAutoComplete_t)(HWND, DWORD);
+ static SHAutoComplete_t s_pfnSHAutoComplete = (SHAutoComplete_t)-1;
+ static wxDynamicLibrary s_dllShlwapi;
+ if ( s_pfnSHAutoComplete == (SHAutoComplete_t)-1 )
+ {
+ wxLogNull noLog;
+
+ if ( !s_dllShlwapi.Load(_T("shlwapi.dll"), wxDL_VERBATIM) )
+ {
+ s_pfnSHAutoComplete = NULL;
+ }
+ else
+ {
+ wxDL_INIT_FUNC(s_pfn, SHAutoComplete, s_dllShlwapi);
+ }
+ }
+
+ if ( !s_pfnSHAutoComplete )
+ return false;
+
+ HRESULT hr = (*s_pfnSHAutoComplete)(GetEditHwnd(), SHACF_FILESYS_ONLY);
+ if ( FAILED(hr) )
+ {
+ wxLogApiError(_T("SHAutoComplete()"), hr);
+
+ return false;
+ }
+
+ return true;
+}
+
bool wxTextEntry::IsEditable() const
{
return !(::GetWindowLong(GetEditHwnd(), GWL_STYLE) & ES_READONLY);