textentry.h 3.4 KB

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