Add wxGrid::Render() for drawing the grid to any wxDC.
[wxWidgets.git] / src / msw / textentry.cpp
index 0ccc7aacf17717ee59e4a447875572e1a9f45913..e993654d249529ed037ec6991b675cb5037a4cc4 100644 (file)
@@ -34,6 +34,8 @@
 #include "wx/textcompleter.h"
 #include "wx/dynlib.h"
 
+#include <initguid.h>
+
 #include "wx/msw/private.h"
 
 #if wxUSE_UXTHEME
 #if defined(__MINGW32__) || defined (__WATCOMC__) || defined(__CYGWIN__)
     // needed for IID_IAutoComplete, IID_IAutoComplete2 and ACO_AUTOSUGGEST
     #include <shlguid.h>
+
+    #ifndef ACO_AUTOAPPEND
+        #define ACO_AUTOAPPEND 0x02
+    #endif
 #endif
 
 #ifndef ACO_UPDOWNKEYDROPSLIST
     #define SHACF_FILESYS_ONLY 0x00000010
 #endif
 
+#ifndef SHACF_FILESYS_DIRS
+    #define SHACF_FILESYS_DIRS 0x00000020
+#endif
+
 namespace
 {
 
@@ -84,10 +94,10 @@ public:
     virtual HRESULT wxSTDCALL ResetEnumerator() = 0;
 };
 
-DEFINE_GUID(IID_IAutoCompleteDropDown,
+DEFINE_GUID(wxIID_IAutoCompleteDropDown,
     0x3cd141f4, 0x3c6a, 0x11d2, 0xbc, 0xaa, 0x00, 0xc0, 0x4f, 0xd9, 0x29, 0xdb);
 
-DEFINE_GUID(CLSID_AutoComplete,
+DEFINE_GUID(wxCLSID_AutoComplete,
     0x00bb2763, 0x6a77, 0x11d0, 0xa5, 0x35, 0x00, 0xc0, 0x4f, 0xd7, 0xd0, 0x62);
 
 // Small helper class which can be used to ensure thread safety even when
@@ -363,7 +373,7 @@ public:
         // apparently.
         HRESULT hr = CoCreateInstance
                      (
-                        CLSID_AutoComplete,
+                        wxCLSID_AutoComplete,
                         NULL,
                         CLSCTX_INPROC_SERVER,
                         IID_IAutoComplete,
@@ -398,7 +408,7 @@ public:
         // provided IAutoComplete always implements IAutoCompleteDropDown too.
         hr = m_autoComplete->QueryInterface
                              (
-                               IID_IAutoCompleteDropDown,
+                               wxIID_IAutoCompleteDropDown,
                                reinterpret_cast<void **>(&m_autoCompleteDropDown)
                              );
         if ( FAILED(hr) )
@@ -734,7 +744,7 @@ void wxTextEntry::GetSelection(long *from, long *to) const
 
 #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;
@@ -754,7 +764,18 @@ bool wxTextEntry::DoAutoCompleteFileNames()
     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);
@@ -827,9 +848,9 @@ bool wxTextEntry::DoAutoCompleteCustom(wxTextCompleter *completer)
 
 // 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)