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