///
/// 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;
namespace JetBrains.Omea.OpenAPI
{
///
/// Manage the rules which control switching of tray icon (in the taskbar
/// area) upon some conditions.
///
/// 437
public interface IFormattingRuleManager
{
///
/// Register a formatting rule which changes the appearance of a resource in the
/// list whenever it matches the condition(s) of the rule.
///
/// Name of a formatting rule.
/// A list of resource types valid for a watcher.
/// Conditions necessary to be matched for a resource.
/// Exceptions necessary to be matched for a resource.
///
///
///
///
///
///
IResource RegisterRule( string name, string[] resTypes, IResource[] conditions, IResource[] exceptions,
bool isBold, bool isItalic, bool isUnderlined, bool isStrikeout,
string foreColor, string backColor );
///
/// Reregister a formatting rule - do not create new resource but rather
/// reset the parameters of the existing one. Required by IFilteringForms API behavior.
///
/// Resource of an existing rule.
/// Name of a formatting rule.
/// A list of resource types valid for a watcher.
/// Conditions necessary to be matched for a resource.
/// Exceptions necessary to be matched for a resource.
///
///
///
///
///
///
/// 539
IResource ReregisterRule( IResource baseRes, string name, string[] resTypes, IResource[] conditions, IResource[] exceptions,
bool isBold, bool isItalic, bool isUnderlined, bool isStrikeout, string foreColor, string backColor );
///
/// Unregister a formatting rule.
///
/// Name of a formatting rule.
void UnregisterRule( string name );
///
/// Check whether there exists (registered) a formatting rule with the given name.
///
/// Name of a formatting rule.
/// True if the a rule with the given name is registered already.
bool IsRuleRegistered( string name );
///
/// Find a resource corresponding to the formatting rule with the given name.
///
/// Name of a formatting rule.
/// A resource corresponding to the formatting rule name.
/// Null if there is no such formatting rule.
IResource FindRule( string name );
///
/// Rename a rule.
///
/// A resource representing a rule (returned by RegisterRule method).
/// New name for a resource.
/// Throws ArgumentException object if the rule with the new name already exists.
/// 548
void RenameRule( IResource rule, string newName );
///
/// Creates new Formatting rule and clones all necessary information into
/// the new destination.
///
/// Resource from which the information will be cloned.
/// Name of a new Formatting rule.
/// 501
/// A resource for a new rule.
IResource CloneRule( IResource sourceRule, string newName );
///
/// Copies formatting information from one formatting rule to the other.
///
/// Source rule from which the formatting information is taken.
/// Destination rule to which the formatting information is written.
void CloneFormatting( IResource fromRule, IResource toRule );
///
/// Applies the formatting rules to the specified resource and returns the
/// item format.
///
/// The resource for which the formatting rules are applied.
/// The format, or null if the default format should be used.
ItemFormat GetFormattingInfo( IResource res );
///
/// Occurs when the set of formatting rules in the system has changed.
///
event EventHandler FormattingRulesChanged;
}
///
/// Describes an item format set by a formatting rule.
///
public class ItemFormat
{
private FontStyle _fontStyle;
private Color _foreColor, _backColor;
///
/// Create a new formatting item with default font and colour characteristics.
///
public ItemFormat()
{
_fontStyle = FontStyle.Regular;
_foreColor = SystemColors.WindowText;
_backColor = SystemColors.Window;
}
///
/// Create a new formatting item with defined font and colour characteristics.
///
public ItemFormat( FontStyle fontStyle, Color foreColor, Color backColor )
{
_fontStyle = fontStyle;
_foreColor = foreColor;
_backColor = backColor;
}
///
/// Set or get the FontStyle attribute for the formatting.
///
public FontStyle FontStyle
{
get { return _fontStyle; }
set { _fontStyle = value; }
}
///
/// Set or get the foreground color for the formatting.
///
public Color ForeColor
{
get { return _foreColor; }
set { _foreColor = value; }
}
///
/// Set or get the background color for the formatting.
///
public Color BackColor
{
get { return _backColor; }
set { _backColor = value; }
}
}
}