Refactor wxTextEntry::AutoComplete() to simply call DoAutoCompleteXXX().
[wxWidgets.git] / include / wx / msw / textentry.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/textentry.h
3 // Purpose: wxMSW-specific wxTextEntry implementation
4 // Author: Vadim Zeitlin
5 // Created: 2007-09-26
6 // RCS-ID: $Id$
7 // Copyright: (c) 2007 Vadim Zeitlin <vadim@wxwindows.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_MSW_TEXTENTRY_H_
12 #define _WX_MSW_TEXTENTRY_H_
13
14 // ----------------------------------------------------------------------------
15 // wxTextEntry: common part of wxComboBox and (single line) wxTextCtrl
16 // ----------------------------------------------------------------------------
17
18 class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase
19 {
20 public:
21 wxTextEntry()
22 {
23 #if wxUSE_OLE
24 m_enumStrings = NULL;
25 #endif // wxUSE_OLE
26 }
27
28 // implement wxTextEntryBase pure virtual methods
29 virtual void WriteText(const wxString& text);
30 virtual void Remove(long from, long to);
31
32 virtual void Copy();
33 virtual void Cut();
34 virtual void Paste();
35
36 virtual void Undo();
37 virtual void Redo();
38 virtual bool CanUndo() const;
39 virtual bool CanRedo() const;
40
41 virtual void SetInsertionPoint(long pos);
42 virtual long GetInsertionPoint() const;
43 virtual long GetLastPosition() const;
44
45 virtual void SetSelection(long from, long to)
46 { DoSetSelection(from, to); }
47 virtual void GetSelection(long *from, long *to) const;
48
49 virtual bool IsEditable() const;
50 virtual void SetEditable(bool editable);
51
52 virtual void SetMaxLength(unsigned long len);
53
54 #if wxUSE_UXTHEME
55 virtual bool SetHint(const wxString& hint);
56 virtual wxString GetHint() const;
57 #endif // wxUSE_UXTHEME
58
59 protected:
60 virtual wxString DoGetValue() const;
61
62 // this is really a hook for multiline text controls as the single line
63 // ones don't need to ever scroll to show the selection but having it here
64 // allows us to put Remove() in the base class
65 enum
66 {
67 SetSel_NoScroll = 0, // don't do anything special
68 SetSel_Scroll = 1 // default: scroll to make the selection visible
69 };
70 virtual void DoSetSelection(long from, long to, int flags = SetSel_Scroll);
71
72 // margins functions
73 virtual bool DoSetMargins(const wxPoint& pt);
74 virtual wxPoint DoGetMargins() const;
75
76 // auto-completion uses COM under Windows so they won't work without
77 // wxUSE_OLE as OleInitialize() is not called then
78 #if wxUSE_OLE
79 virtual bool DoAutoCompleteStrings(const wxArrayString& choices);
80 virtual bool DoAutoCompleteFileNames();
81 #endif // wxUSE_OLE
82
83 private:
84 // implement this to return the HWND of the EDIT control
85 virtual WXHWND GetEditHWND() const = 0;
86
87 #if wxUSE_OLE
88 // enumerator for strings currently used for auto-completion or NULL
89 class wxIEnumString *m_enumStrings;
90 #endif // wxUSE_OLE
91 };
92
93 #endif // _WX_MSW_TEXTENTRY_H_
94