From 3a9fa0d6b59c5c299766b3ed71ccadeeebf3dbb8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Sep 2003 00:09:18 +0000 Subject: [PATCH] added wxTextCtrl::MarkDirty() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23845 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + include/wx/cocoa/textctrl.h | 1 + include/wx/gtk/textctrl.h | 3 ++- include/wx/gtk1/textctrl.h | 3 ++- include/wx/mac/textctrl.h | 3 ++- include/wx/motif/textctrl.h | 1 + include/wx/msw/textctrl.h | 1 + include/wx/os2/textctrl.h | 1 + include/wx/textctrl.h | 3 ++- include/wx/univ/textctrl.h | 3 ++- src/cocoa/textctrl.mm | 4 ++++ src/gtk/textctrl.cpp | 5 +++++ src/gtk1/textctrl.cpp | 5 +++++ src/mac/carbon/textctrl.cpp | 7 ++++++- src/mac/textctrl.cpp | 7 ++++++- src/motif/textctrl.cpp | 7 ++++++- src/msw/textctrl.cpp | 6 +++++- src/os2/textctrl.cpp | 5 +++++ src/univ/textctrl.cpp | 5 +++++ 19 files changed, 62 insertions(+), 9 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 2e22f46982..f44fd0cefb 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -53,6 +53,7 @@ All (GUI): - added some support for C++ exceptions in the library (do read the manual!) - added wxListCtrl::GetViewRect() +- added wxTextCtrl::MarkDirty() wxMSW: diff --git a/include/wx/cocoa/textctrl.h b/include/wx/cocoa/textctrl.h index 5205ed9f64..322fb99b48 100644 --- a/include/wx/cocoa/textctrl.h +++ b/include/wx/cocoa/textctrl.h @@ -76,6 +76,7 @@ public: virtual void Remove(long from, long to); // clears the dirty flag + virtual void MarkDirty(); virtual void DiscardEdits(); // writing text inserts it at the current position, appending always diff --git a/include/wx/gtk/textctrl.h b/include/wx/gtk/textctrl.h index a8730f89fd..88ebbb41af 100644 --- a/include/wx/gtk/textctrl.h +++ b/include/wx/gtk/textctrl.h @@ -65,7 +65,8 @@ public: virtual void Replace(long from, long to, const wxString& value); virtual void Remove(long from, long to); - // clears the dirty flag + // sets/clears the dirty flag + virtual void MarkDirty(); virtual void DiscardEdits(); virtual void SetMaxLength(unsigned long len); diff --git a/include/wx/gtk1/textctrl.h b/include/wx/gtk1/textctrl.h index a8730f89fd..88ebbb41af 100644 --- a/include/wx/gtk1/textctrl.h +++ b/include/wx/gtk1/textctrl.h @@ -65,7 +65,8 @@ public: virtual void Replace(long from, long to, const wxString& value); virtual void Remove(long from, long to); - // clears the dirty flag + // sets/clears the dirty flag + virtual void MarkDirty(); virtual void DiscardEdits(); virtual void SetMaxLength(unsigned long len); diff --git a/include/wx/mac/textctrl.h b/include/wx/mac/textctrl.h index 03c218b04c..df3a964339 100644 --- a/include/wx/mac/textctrl.h +++ b/include/wx/mac/textctrl.h @@ -76,7 +76,8 @@ public: // load the controls contents from the file virtual bool LoadFile(const wxString& file); - // clears the dirty flag + // sets/clears the dirty flag + virtual void MarkDirty(); virtual void DiscardEdits(); // set the max number of characters which may be entered in a single line diff --git a/include/wx/motif/textctrl.h b/include/wx/motif/textctrl.h index 201d5e7e26..c8037713c7 100644 --- a/include/wx/motif/textctrl.h +++ b/include/wx/motif/textctrl.h @@ -86,6 +86,7 @@ public: virtual void WriteText(const wxString& text); virtual void AppendText(const wxString& text); + virtual void MarkDirty(); virtual void DiscardEdits(); virtual bool IsModified() const; diff --git a/include/wx/msw/textctrl.h b/include/wx/msw/textctrl.h index 2c66ed228e..dfc07966c5 100644 --- a/include/wx/msw/textctrl.h +++ b/include/wx/msw/textctrl.h @@ -74,6 +74,7 @@ public: virtual bool LoadFile(const wxString& file); // clears the dirty flag + virtual void MarkDirty(); virtual void DiscardEdits(); virtual void SetMaxLength(unsigned long len); diff --git a/include/wx/os2/textctrl.h b/include/wx/os2/textctrl.h index 836bd5f438..5e3c487683 100644 --- a/include/wx/os2/textctrl.h +++ b/include/wx/os2/textctrl.h @@ -74,6 +74,7 @@ public: virtual bool LoadFile(const wxString& rsFile); + virtual void MarkDirty(); virtual void DiscardEdits(void); virtual void WriteText(const wxString& rsText); diff --git a/include/wx/textctrl.h b/include/wx/textctrl.h index eb69adfdc4..df004c9479 100644 --- a/include/wx/textctrl.h +++ b/include/wx/textctrl.h @@ -262,7 +262,8 @@ public: virtual bool LoadFile(const wxString& file); virtual bool SaveFile(const wxString& file = wxEmptyString); - // clears the dirty flag + // sets/clears the dirty flag + virtual void MarkDirty() = 0; virtual void DiscardEdits() = 0; // set the max number of characters which may be entered in a single line diff --git a/include/wx/univ/textctrl.h b/include/wx/univ/textctrl.h index 85b1717f61..adcbc90209 100644 --- a/include/wx/univ/textctrl.h +++ b/include/wx/univ/textctrl.h @@ -152,7 +152,8 @@ public: virtual void Replace(wxTextPos from, wxTextPos to, const wxString& value); virtual void Remove(wxTextPos from, wxTextPos to); - // clears the dirty flag + // sets/clears the dirty flag + virtual void MarkDirty(); virtual void DiscardEdits(); // writing text inserts it at the current position, appending always diff --git a/src/cocoa/textctrl.mm b/src/cocoa/textctrl.mm index 1036882df4..1d858a32b0 100644 --- a/src/cocoa/textctrl.mm +++ b/src/cocoa/textctrl.mm @@ -72,6 +72,10 @@ void wxTextCtrl::SetEditable(bool) { } +void wxTextCtrl::MarkDirty() +{ +} + void wxTextCtrl::DiscardEdits() { } diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index fda2c96595..119b1bf57d 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -905,6 +905,11 @@ void wxTextCtrl::OnParentEnable( bool enable ) } } +void wxTextCtrl::MarkDirty() +{ + m_modified = TRUE; +} + void wxTextCtrl::DiscardEdits() { m_modified = FALSE; diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index fda2c96595..119b1bf57d 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -905,6 +905,11 @@ void wxTextCtrl::OnParentEnable( bool enable ) } } +void wxTextCtrl::MarkDirty() +{ + m_modified = TRUE; +} + void wxTextCtrl::DiscardEdits() { m_modified = FALSE; diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index 8e397f8618..97588b198b 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -1433,7 +1433,12 @@ bool wxTextCtrl::CanRedo() const return FALSE ; } -// Makes 'unmodified' +// Makes modifie or unmodified +void wxTextCtrl::MarkDirty() +{ + m_dirty = true; +} + void wxTextCtrl::DiscardEdits() { m_dirty = false; diff --git a/src/mac/textctrl.cpp b/src/mac/textctrl.cpp index 8e397f8618..97588b198b 100644 --- a/src/mac/textctrl.cpp +++ b/src/mac/textctrl.cpp @@ -1433,7 +1433,12 @@ bool wxTextCtrl::CanRedo() const return FALSE ; } -// Makes 'unmodified' +// Makes modifie or unmodified +void wxTextCtrl::MarkDirty() +{ + m_dirty = true; +} + void wxTextCtrl::DiscardEdits() { m_dirty = false; diff --git a/src/motif/textctrl.cpp b/src/motif/textctrl.cpp index 0177cb2b2f..97b5521972 100644 --- a/src/motif/textctrl.cpp +++ b/src/motif/textctrl.cpp @@ -420,7 +420,12 @@ bool wxTextCtrl::IsModified() const return m_modified; } -// Makes 'unmodified' +// Makes modified or unmodified +void wxTextCtrl::MarkDirty() +{ + m_modified = FALSE; +} + void wxTextCtrl::DiscardEdits() { m_modified = FALSE; diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 9730fe9992..559508e9d4 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -1261,7 +1261,11 @@ bool wxTextCtrl::IsModified() const return SendMessage(GetHwnd(), EM_GETMODIFY, 0, 0) != 0; } -// Makes 'unmodified' +void wxTextCtrl::MarkDirty() +{ + SendMessage(GetHwnd(), EM_SETMODIFY, TRUE, 0L); +} + void wxTextCtrl::DiscardEdits() { SendMessage(GetHwnd(), EM_SETMODIFY, FALSE, 0L); diff --git a/src/os2/textctrl.cpp b/src/os2/textctrl.cpp index 679d0fa248..9efd84b6e8 100644 --- a/src/os2/textctrl.cpp +++ b/src/os2/textctrl.cpp @@ -710,6 +710,11 @@ bool wxTextCtrl::IsModified() const return bRc; } // end of wxTextCtrl::IsModified +void wxTextCtrl::MarkDirty() +{ + wxFAIL_MSG( _T("not implemented") ); +} + // // Makes 'unmodified' // diff --git a/src/univ/textctrl.cpp b/src/univ/textctrl.cpp index 911934d6a1..1538bcefd0 100644 --- a/src/univ/textctrl.cpp +++ b/src/univ/textctrl.cpp @@ -1585,6 +1585,11 @@ bool wxTextCtrl::IsEditable() const return m_isEditable && IsEnabled(); } +void wxTextCtrl::MarkDirty() +{ + m_isModified = TRUE; +} + void wxTextCtrl::DiscardEdits() { m_isModified = FALSE;