2008-04-19 Ivan N. Zlatev <contact@i-nz.net>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / Form.cs
index 16332dd8c50eeba8588840ccf265634f8880ad26..351ed4f5c4a7909655023992a56e87945c1ab148 100644 (file)
@@ -1776,6 +1776,34 @@ namespace System.Windows.Forms {
                {
                        return base.ValidateChildren (validationConstraints);
                }
+#else
+               private bool ValidateChildren ()
+               {
+                       return ValidateChildren (this);
+               }
+
+               private bool ValidateChildren (Control c)
+               {
+                       if (!ValidateControl (c))
+                               return false;
+
+                       foreach (Control child in c.Controls) {
+                               if (!ValidateChildren (child))
+                                       return false;
+                       }
+
+                       return true;
+               }
+
+               private bool ValidateControl (Control c)
+               {
+                       CancelEventArgs e = new CancelEventArgs ();
+                       c.FireValidating (e);
+                       if (e.Cancel)
+                               return false;
+                       c.FireValidated ();
+                       return true;
+               }
 #endif
                #endregion      // Public Instance Methods