X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/fa2f57be4db838388659fe48dbf5546daf5364f8..1f0acb435592470b421b80df854fbbb08cd2853f:/include/wx/msw/textctrl.h diff --git a/include/wx/msw/textctrl.h b/include/wx/msw/textctrl.h index f5fc2fb35b..888ea4c76b 100644 --- a/include/wx/msw/textctrl.h +++ b/include/wx/msw/textctrl.h @@ -12,7 +12,7 @@ #ifndef _WX_TEXTCTRL_H_ #define _WX_TEXTCTRL_H_ -class WXDLLEXPORT wxTextCtrl : public wxTextCtrlBase +class WXDLLIMPEXP_CORE wxTextCtrl : public wxTextCtrlBase { public: // creation @@ -71,8 +71,6 @@ public: // implement base class pure virtuals // ---------------------------------- - virtual bool DoLoadFile(const wxString& file, int fileType); - virtual bool IsModified() const; virtual void MarkDirty(); virtual void DiscardEdits(); @@ -110,7 +108,7 @@ public: // Implementation from now on // -------------------------- - + #if wxUSE_DRAG_AND_DROP && wxUSE_RICHEDIT virtual void SetDropTarget(wxDropTarget *dropTarget); #endif // wxUSE_DRAG_AND_DROP && wxUSE_RICHEDIT @@ -127,10 +125,11 @@ public: int GetRichVersion() const { return m_verRichEdit; } bool IsRich() const { return m_verRichEdit != 0; } - // rich edit controls are not compatible with normal ones and wem ust set - // the colours for them otherwise + // rich edit controls are not compatible with normal ones and we must set + // the colours and font for them otherwise virtual bool SetBackgroundColour(const wxColour& colour); virtual bool SetForegroundColour(const wxColour& colour); + virtual bool SetFont(const wxFont& font); #else bool IsRich() const { return false; } #endif // wxUSE_RICHEDIT @@ -181,12 +180,13 @@ public: virtual bool MSWShouldPreProcessMessage(WXMSG* pMsg); virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; - virtual wxVisualAttributes GetDefaultAttributes() const; protected: // common part of all ctors void Init(); + virtual bool DoLoadFile(const wxString& file, int fileType); + // creates the control of appropriate class (plain or rich edit) with the // styles corresponding to m_windowStyle // @@ -198,10 +198,6 @@ protected: virtual void DoSetValue(const wxString &value, int flags = 0); - // implement wxTextEntry pure virtual: it implements all the operations for - // the simple EDIT controls - virtual WXHWND GetEditHWND() const { return m_hWnd; } - // return true if this control has a user-set limit on amount of text (i.e. // the limit is due to a previous call to SetMaxLength() and not built in) bool HasSpaceLimit(unsigned int *len) const; @@ -230,9 +226,6 @@ protected: // set the selection (possibly without scrolling the caret into view) void DoSetSelection(long from, long to, int flags); - // return true if there is a non empty selection in the control - bool HasSelection() const; - // get the length of the line containing the character at the given // position long GetLengthOfLineContainingPos(long pos) const; @@ -243,9 +236,23 @@ protected: virtual wxSize DoGetBestSize() const; #if wxUSE_RICHEDIT + // Apply the character-related parts of wxTextAttr to the given selection + // or the entire control if start == end == -1. + // + // This function is private and should only be called for rich edit + // controls and with (from, to) already in correct order, i.e. from <= to. + bool MSWSetCharFormat(const wxTextAttr& attr, long from = -1, long to = -1); + + // Same as above for paragraph-related parts of wxTextAttr. Note that this + // can only be applied to the selection as RichEdit doesn't support setting + // the paragraph styles globally. + bool MSWSetParaFormat(const wxTextAttr& attr, long from, long to); + + // we're using RICHEDIT (and not simple EDIT) control if this field is not - // 0, it also gives the version of the RICHEDIT control being used (1, 2 or - // 3 so far) + // 0, it also gives the version of the RICHEDIT control being used + // (although not directly: 1 is for 1.0, 2 is for either 2.0 or 3.0 as we + // can't nor really need to distinguish between them and 4 is for 4.1) int m_verRichEdit; #endif // wxUSE_RICHEDIT @@ -253,12 +260,18 @@ protected: // text ourselves: we want this to be exactly 1 int m_updatesCount; +private: virtual void EnableTextChangedEvents(bool enable) { m_updatesCount = enable ? -1 : -2; } -private: + // implement wxTextEntry pure virtual: it implements all the operations for + // the simple EDIT controls + virtual WXHWND GetEditHWND() const { return m_hWnd; } + + void OnKeyDown(wxKeyEvent& event); + DECLARE_EVENT_TABLE() DECLARE_DYNAMIC_CLASS_NO_COPY(wxTextCtrl)