]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/textentry.h
511797d90ff097f65c76432c0528410fed566553
[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 class wxTextAutoCompleteData; // private class used only by wxTextEntry itself
15
16 // ----------------------------------------------------------------------------
17 // wxTextEntry: common part of wxComboBox and (single line) wxTextCtrl
18 // ----------------------------------------------------------------------------
19
20 class WXDLLIMPEXP_CORE wxTextEntry : public wxTextEntryBase
21 {
22 public:
23 wxTextEntry();
24 virtual ~wxTextEntry();
25
26 // implement wxTextEntryBase pure virtual methods
27 virtual void WriteText(const wxString& text);
28 virtual void Remove(long from, long to);
29
30 virtual void Copy();
31 virtual void Cut();
32 virtual void Paste();
33
34 virtual void Undo();
35 virtual void Redo();
36 virtual bool CanUndo() const;
37 virtual bool CanRedo() const;
38
39 virtual void SetInsertionPoint(long pos);
40 virtual long GetInsertionPoint() const;
41 virtual long GetLastPosition() const;
42
43 virtual void SetSelection(long from, long to)
44 { DoSetSelection(from, to); }
45 virtual void GetSelection(long *from, long *to) const;
46
47 virtual bool IsEditable() const;
48 virtual void SetEditable(bool editable);
49
50 virtual void SetMaxLength(unsigned long len);
51
52 #if wxUSE_UXTHEME
53 virtual bool SetHint(const wxString& hint);
54 virtual wxString GetHint() const;
55 #endif // wxUSE_UXTHEME
56
57 protected:
58 virtual wxString DoGetValue() const;
59
60 // this is really a hook for multiline text controls as the single line
61 // ones don't need to ever scroll to show the selection but having it here
62 // allows us to put Remove() in the base class
63 enum
64 {
65 SetSel_NoScroll = 0, // don't do anything special
66 SetSel_Scroll = 1 // default: scroll to make the selection visible
67 };
68 virtual void DoSetSelection(long from, long to, int flags = SetSel_Scroll);
69
70 // margins functions
71 virtual bool DoSetMargins(const wxPoint& pt);
72 virtual wxPoint DoGetMargins() const;
73
74 // auto-completion uses COM under Windows so they won't work without
75 // wxUSE_OLE as OleInitialize() is not called then
76 #if wxUSE_OLE
77 virtual bool DoAutoCompleteStrings(const wxArrayString& choices);
78 #if wxUSE_DYNLIB_CLASS
79 virtual bool DoAutoCompleteFileNames(int flags);
80 #endif // wxUSE_DYNLIB_CLASS
81 virtual bool DoAutoCompleteCustom(wxTextCompleter *completer);
82 #endif // wxUSE_OLE
83
84 private:
85 // implement this to return the HWND of the EDIT control
86 virtual WXHWND GetEditHWND() const = 0;
87
88 #if wxUSE_OLE
89 // Get the auto-complete object creating it if necessary. Returns NULL if
90 // creating it failed.
91 wxTextAutoCompleteData *GetOrCreateCompleter();
92
93 // Various auto-completion-related stuff, only used if any of AutoComplete()
94 // methods are called. Use the function above to access it.
95 wxTextAutoCompleteData *m_autoCompleteData;
96
97 // It needs to call our GetEditableWindow() and GetEditHWND() methods.
98 friend class wxTextAutoCompleteData;
99 #endif // wxUSE_OLE
100 };
101
102 #endif // _WX_MSW_TEXTENTRY_H_
103