X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f68586e51b20dccee3fd5645aeaca7cc8ff298c2..973983be622fcfa9e4387d9eb96f5adf03f2fc7b:/include/wx/msw/textctrl.h diff --git a/include/wx/msw/textctrl.h b/include/wx/msw/textctrl.h index 4290b207c9..3e0174e66e 100644 --- a/include/wx/msw/textctrl.h +++ b/include/wx/msw/textctrl.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: textctrl.h +// Name: wx/msw/textctrl.h // Purpose: wxTextCtrl class // Author: Julian Smart // Modified by: @@ -16,13 +16,6 @@ #pragma interface "textctrl.h" #endif -// can we use RICHEDIT class for wxTextCtrl implementation? -#if defined(__WIN95__) && !defined(__TWIN32__) && !defined(__WXWINE__) - #define wxUSE_RICHEDIT 1 -#else - #define wxUSE_RICHEDIT 0 -#endif - class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase { public: @@ -62,8 +55,8 @@ public: virtual bool IsModified() const; virtual bool IsEditable() const; - // If the return values from and to are the same, there is no selection. virtual void GetSelection(long* from, long* to) const; + virtual wxString GetSelection() const; // operations // ---------- @@ -79,11 +72,19 @@ public: // clears the dirty flag virtual void DiscardEdits(); + virtual void SetMaxLength(unsigned long len); + // writing text inserts it at the current position, appending always // inserts it at the end virtual void WriteText(const wxString& text); virtual void AppendText(const wxString& text); +#if wxUSE_RICHEDIT + // apply text attribute to the range of text (only works with richedit + // controls) + virtual bool SetStyle(long start, long end, const wxTextAttr& style); +#endif // wxUSE_RICHEDIT + // translate between the position (which is just an index in the text ctrl // considering all its contents as a single strings) and (x, y) coordinates // which represent column and line. @@ -122,18 +123,28 @@ public: virtual void Command(wxCommandEvent& event); virtual bool MSWCommand(WXUINT param, WXWORD id); + virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, + WXUINT message, WXWPARAM wParam, WXLPARAM lParam); + + // In WIN16, need to override normal erasing because + // Ctl3D doesn't use the wxWindows background colour. +#ifdef __WIN16__ + void OnEraseBackground(wxEraseEvent& event); +#endif #if wxUSE_RICHEDIT + virtual bool MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result); + bool IsRich() const { return m_isRich; } void SetRichEdit(bool isRich) { m_isRich = isRich; } -#endif // wxUSE_RICHEDIT - virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, - WXLPARAM lParam); + // rich edit controls are not compatible with normal ones and wem ust set + // the colours for them otherwise + virtual bool SetBackgroundColour(const wxColour& colour); + virtual bool SetForegroundColour(const wxColour& colour); +#endif // wxUSE_RICHEDIT virtual void AdoptAttributesFromHWND(); - virtual void SetupColours(); virtual bool AcceptsFocus() const; @@ -154,16 +165,21 @@ public: void OnUpdateRedo(wxUpdateUIEvent& event); protected: -#if wxUSE_RICHEDIT - bool m_isRich; // Are we using rich text edit to implement this? -#endif - // call this to increase the size limit (will do nothing if the current // limit is big enough) - void AdjustSpaceLimit(); + // + // returns true if we increased the limit to allow entering more text, + // false if we hit the limit set by SetMaxLength() and so didn't change it + bool AdjustSpaceLimit(); + // override some base class virtuals + virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg); virtual wxSize DoGetBestSize() const; +#if wxUSE_RICHEDIT + bool m_isRich; // Are we using rich text edit to implement this? +#endif + private: DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS(wxTextCtrl)