/// /// Copyright © 2003-2008 JetBrains s.r.o. /// You may distribute under the terms of the GNU General Public License, as published by the Free Software Foundation, version 2 (see License.txt in the repository root folder). /// using System; using System.Drawing; using System.Windows.Forms; namespace JetBrains.Omea.OpenAPI { /// /// The base class for the panes which support editing resources in separate /// windows. /// public class AbstractEditPane: UserControl { /// /// Called when the edit window for the specified resource is opened. /// /// The resource to edit in the pane. public virtual void EditResource( IResource res ) { } /// /// Called when the Save button is pressed in the edit window. /// public virtual void Save() { } /// /// Called when the Cancel button is pressed in the edit window. /// public virtual void Cancel() { } /// /// Returns the minimum size to which the edit pane can be shrunk. /// /// The minimum size value. public virtual Size GetMinimumSize() { return new Size( 0, 0 ); } /// /// Can be fired by the pane when the valid state of the form controls changes. /// public event ValidStateEventHandler ValidStateChanged; /// /// Fires the event. /// /// The event arguments. protected void OnValidStateChanged( ValidStateEventArgs e ) { if ( ValidStateChanged != null ) { ValidStateChanged( this, e ); } } } /// /// Provides data for the ValidStateChanged /// event. /// public class ValidStateEventArgs: EventArgs { private bool _isValid; private bool _isWarning; private string _message; /// /// Initializes the instance of the class with the specified validity flag and an empty message. /// /// The validity flag. public ValidStateEventArgs( bool isValid ) : this( isValid, false, "" ) {} /// /// Initializes the instance of the class with the specified validity flag and message. /// /// The validity flag. /// The message to be shown to the user if the form state is not valid. public ValidStateEventArgs( bool isValid, string message ) : this( isValid, false, message ) {} public ValidStateEventArgs( bool isValid, bool isWarning, string message ) { _isValid = isValid; _isWarning = isWarning; _message = message; } /// /// Gets the flag signifying whether the current form state is valid. /// public bool IsValid { get { return _isValid; } } /// /// Gets the flag signifying whether the message correspond to fatal case. /// public bool IsWarning { get { return _isWarning; } } /// /// Gets the message that is shown to the user to inform him that the form /// state is not valid. /// public string Message { get { return _message; } } } /// /// Represents the method that will handle the /// ValidStateChanged event of an . /// public delegate void ValidStateEventHandler( object sender, ValidStateEventArgs e ); }