]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/cmdproc.cpp
Add missing WXK constants for the control keys
[wxWidgets.git] / src / common / cmdproc.cpp
index 7de08c279063d0ab5ad45ff89b823c2d0b4d5c3b..5e8a253ccbbeea631ee1ebc20eebcab533c600f0 100644 (file)
@@ -328,4 +328,28 @@ void wxCommandProcessor::ClearCommands()
     m_lastSavedCommand = wxList::compatibility_iterator();
 }
 
+bool wxCommandProcessor::IsDirty() const
+{
+    if ( m_commands.empty() )
+    {
+        // If we have never been modified, we can't be dirty.
+        return false;
+    }
+
+    if ( !m_lastSavedCommand )
+    {
+        // If we have been modified but have never been saved, we're dirty.
+        return true;
+    }
+
+    if ( !m_currentCommand )
+    {
+        // This only happens if all commands were undone after saving the
+        // document: we're dirty then.
+        return true;
+    }
+
+    // Finally if both iterators are valid, we may just compare them.
+    return m_currentCommand != m_lastSavedCommand;
+}