/// /// 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.Windows.Forms; using JetBrains.Annotations; namespace JetBrains.Omea.OpenAPI { /// /// Base class for options panes displayed in the options dialog. /// /// /// Inherit a user control from this abstract base class if you wish to add a page to Omea options dialog. /// Settings should be loaded in and saved in via the Setting Store. /// To register a pane for the Options dialog, use . The panes are created through calling the delegate you supply rather than directly instantiating the class object. /// public class AbstractOptionsPane : UserControl { /// /// Called when the pane is initially shown in the dialog. /// /// /// Typically, this method would fill the form with settings data. /// public virtual void ShowPane() { } /// /// Called always when the pane is entered in the dialog. /// public virtual void EnterPane() { } /// /// Called always when the pane is left in the dialog. /// public virtual void LeavePane() { } /// /// Called when the Options dialog or the Startup Wizard is closed with the OK button. /// /// Typically, this method would save the settings data. public virtual void OK() { } /// /// Called when the dialog is closed by pressing the "Cancel" button. /// /// Settings should not be saved in this case. public virtual void Cancel() { } /// /// Called before calling OK() when the dialog is being closed by pressing either "OK" or button, /// or the "Apply" button is pressed to check if the control values are valid. /// /// Set error string if validation failed. /// Set focus to specified control. /// Returns true if options pane is valid. /// If returns False, error message should be set. Control to select can be unspecified. /// 1.0.3 public virtual bool IsValid( ref string errorMessage, [CanBeNull] ref Control controlToSelect ) { return true; } /// /// Gets or sets the flag signifying that the pane is currently being shown /// in the Startup Wizard and not in the Options dialog. /// public bool IsStartupPane { get; set; } /// /// Gets or sets the flag whether restart of the application is needed. Should be used if an /// AbstractOptionsPane implementor wishes to restart the application after settings are submitted. /// /// 2.2 public bool NeedRestart { get; set; } /// /// Retrieves the keyword in the help file that should be activated when help is /// requested for this options pane. /// /// Help index keyword. [CanBeNull] public virtual string GetHelpKeyword() { return null; } } /// /// Represents the method which creates an instance of the options pane. /// public delegate AbstractOptionsPane OptionsPaneCreator(); }