Refactor wxTextEntry::AutoComplete() to simply call DoAutoCompleteXXX().
No real changes, just make the public AutoComplete() non-virtual and add virtual DoAutoCompleteXXX() methods to make it easier to add new public AutoComplete() overloads in the upcoming commits. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67509 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -43,8 +43,6 @@ public:
|
|||||||
virtual void SetSelection(long from, long to);
|
virtual void SetSelection(long from, long to);
|
||||||
virtual void GetSelection(long *from, long *to) const;
|
virtual void GetSelection(long *from, long *to) const;
|
||||||
|
|
||||||
virtual bool AutoComplete(const wxArrayString& choices);
|
|
||||||
|
|
||||||
virtual bool IsEditable() const;
|
virtual bool IsEditable() const;
|
||||||
virtual void SetEditable(bool editable);
|
virtual void SetEditable(bool editable);
|
||||||
|
|
||||||
@@ -60,6 +58,8 @@ protected:
|
|||||||
virtual bool DoSetMargins(const wxPoint& pt);
|
virtual bool DoSetMargins(const wxPoint& pt);
|
||||||
virtual wxPoint DoGetMargins() const;
|
virtual wxPoint DoGetMargins() const;
|
||||||
|
|
||||||
|
virtual bool DoAutoCompleteStrings(const wxArrayString& choices);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// implement this to return the associated GtkEntry or another widget
|
// implement this to return the associated GtkEntry or another widget
|
||||||
// implementing GtkEditable
|
// implementing GtkEditable
|
||||||
|
@@ -46,13 +46,6 @@ public:
|
|||||||
{ DoSetSelection(from, to); }
|
{ DoSetSelection(from, to); }
|
||||||
virtual void GetSelection(long *from, long *to) const;
|
virtual void GetSelection(long *from, long *to) const;
|
||||||
|
|
||||||
// auto-completion uses COM under Windows so they won't work without
|
|
||||||
// wxUSE_OLE as OleInitialize() is not called then
|
|
||||||
#if wxUSE_OLE
|
|
||||||
virtual bool AutoComplete(const wxArrayString& choices);
|
|
||||||
virtual bool AutoCompleteFileNames();
|
|
||||||
#endif // wxUSE_OLE
|
|
||||||
|
|
||||||
virtual bool IsEditable() const;
|
virtual bool IsEditable() const;
|
||||||
virtual void SetEditable(bool editable);
|
virtual void SetEditable(bool editable);
|
||||||
|
|
||||||
@@ -80,6 +73,13 @@ protected:
|
|||||||
virtual bool DoSetMargins(const wxPoint& pt);
|
virtual bool DoSetMargins(const wxPoint& pt);
|
||||||
virtual wxPoint DoGetMargins() const;
|
virtual wxPoint DoGetMargins() const;
|
||||||
|
|
||||||
|
// auto-completion uses COM under Windows so they won't work without
|
||||||
|
// wxUSE_OLE as OleInitialize() is not called then
|
||||||
|
#if wxUSE_OLE
|
||||||
|
virtual bool DoAutoCompleteStrings(const wxArrayString& choices);
|
||||||
|
virtual bool DoAutoCompleteFileNames();
|
||||||
|
#endif // wxUSE_OLE
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// implement this to return the HWND of the EDIT control
|
// implement this to return the HWND of the EDIT control
|
||||||
virtual WXHWND GetEditHWND() const = 0;
|
virtual WXHWND GetEditHWND() const = 0;
|
||||||
|
@@ -112,12 +112,11 @@ public:
|
|||||||
// commonly meaning that this functionality is not available under the
|
// commonly meaning that this functionality is not available under the
|
||||||
// current platform)
|
// current platform)
|
||||||
|
|
||||||
virtual bool AutoComplete(const wxArrayString& WXUNUSED(choices))
|
bool AutoComplete(const wxArrayString& choices)
|
||||||
{
|
{ return DoAutoCompleteStrings(choices); }
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual bool AutoCompleteFileNames() { return false; }
|
bool AutoCompleteFileNames()
|
||||||
|
{ return DoAutoCompleteFileNames(); }
|
||||||
|
|
||||||
|
|
||||||
// status
|
// status
|
||||||
@@ -218,6 +217,14 @@ protected:
|
|||||||
virtual bool DoSetMargins(const wxPoint& pt);
|
virtual bool DoSetMargins(const wxPoint& pt);
|
||||||
virtual wxPoint DoGetMargins() const;
|
virtual wxPoint DoGetMargins() const;
|
||||||
|
|
||||||
|
// the derived classes should override these virtual methods to implement
|
||||||
|
// auto-completion, they do the same thing as their public counterparts but
|
||||||
|
// have different names to allow overriding just one of them without hiding
|
||||||
|
// the other one(s)
|
||||||
|
virtual bool DoAutoCompleteStrings(const wxArrayString& WXUNUSED(choices))
|
||||||
|
{ return false; }
|
||||||
|
virtual bool DoAutoCompleteFileNames() { return false; }
|
||||||
|
|
||||||
|
|
||||||
// class which should be used to temporarily disable text change events
|
// class which should be used to temporarily disable text change events
|
||||||
//
|
//
|
||||||
|
@@ -58,7 +58,7 @@ public:
|
|||||||
|
|
||||||
@see AutoCompleteFileNames()
|
@see AutoCompleteFileNames()
|
||||||
*/
|
*/
|
||||||
virtual bool AutoComplete(const wxArrayString& choices);
|
bool AutoComplete(const wxArrayString& choices);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Call this function to enable auto-completion of the text typed in a
|
Call this function to enable auto-completion of the text typed in a
|
||||||
@@ -76,7 +76,7 @@ public:
|
|||||||
|
|
||||||
@see AutoComplete()
|
@see AutoComplete()
|
||||||
*/
|
*/
|
||||||
virtual bool AutoCompleteFileNames();
|
bool AutoCompleteFileNames();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Returns @true if the selection can be copied to the clipboard.
|
Returns @true if the selection can be copied to the clipboard.
|
||||||
|
@@ -237,7 +237,7 @@ void wxTextEntry::GetSelection(long *from, long *to) const
|
|||||||
// auto completion
|
// auto completion
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
bool wxTextEntry::AutoComplete(const wxArrayString& choices)
|
bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices)
|
||||||
{
|
{
|
||||||
GtkEntry * const entry = GTK_ENTRY(GetEditable());
|
GtkEntry * const entry = GTK_ENTRY(GetEditable());
|
||||||
wxCHECK_MSG(entry, false, "auto completion doesn't work with this control");
|
wxCHECK_MSG(entry, false, "auto completion doesn't work with this control");
|
||||||
|
@@ -303,7 +303,7 @@ void wxTextEntry::GetSelection(long *from, long *to) const
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#if wxUSE_OLE
|
#if wxUSE_OLE
|
||||||
bool wxTextEntry::AutoCompleteFileNames()
|
bool wxTextEntry::DoAutoCompleteFileNames()
|
||||||
{
|
{
|
||||||
#ifdef HAS_AUTOCOMPLETE
|
#ifdef HAS_AUTOCOMPLETE
|
||||||
typedef HRESULT (WINAPI *SHAutoComplete_t)(HWND, DWORD);
|
typedef HRESULT (WINAPI *SHAutoComplete_t)(HWND, DWORD);
|
||||||
@@ -337,7 +337,7 @@ bool wxTextEntry::AutoCompleteFileNames()
|
|||||||
#endif // HAS_AUTOCOMPLETE/!HAS_AUTOCOMPLETE
|
#endif // HAS_AUTOCOMPLETE/!HAS_AUTOCOMPLETE
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTextEntry::AutoComplete(const wxArrayString& choices)
|
bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices)
|
||||||
{
|
{
|
||||||
#ifdef HAS_AUTOCOMPLETE
|
#ifdef HAS_AUTOCOMPLETE
|
||||||
// if we had an old enumerator we must reuse it as IAutoComplete doesn't
|
// if we had an old enumerator we must reuse it as IAutoComplete doesn't
|
||||||
|
Reference in New Issue
Block a user