///
/// 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.Windows.Forms;
namespace JetBrains.Omea.OpenAPI
{
///
/// Interface for panes used in the resource selector dialog.
///
public interface IResourceSelectPane
{
///
/// Prepares the pane for selecting a single resource from the specified list.
///
/// Obsolete; please don't use.
/// The list from which the resources are selected.
/// The resource which is initially selected in the list.
void SelectResource( string[] resTypes, IResourceList baseList, IResource selection );
///
/// Prepares the pane for selecting multiple resources from the specified list.
///
/// Obsolete; please don't use.
/// The list from which the resources are selected.
/// The resources which are initially selected in the list.
void SelectResources( string[] resTypes, IResourceList baseList, IResourceList selection );
///
/// Returns the list of resources currently selected by the user.
///
/// The list of selected resources.
IResourceList GetSelection();
///
/// Occurs when the user accepts the selection, for example, by double-clicking the selection
/// list.
///
event EventHandler Accept;
}
///
/// Extended interface for IResourceSelectPane allowing to show the "New..." button
/// in the selector dialog.
///
/// 2.0
public interface IResourceSelectPane2: IResourceSelectPane
{
///
/// Returns true if the "New..." button should be shown or false otherwise.
///
bool ShowNewButton { get; }
///
/// Called when the "New..." button is clicked in the selector dialog.
///
void HandleNewButtonClicked();
}
///
/// Base class for panes used in the resource selector dialog.
///
public class AbstractResourceSelectPane: UserControl, IResourceSelectPane2
{
///
/// Prepares the pane for selecting a single resource from the specified list.
///
/// Obsolete; please don't use.
/// The list from which the resources are selected.
/// The resource which is initially selected in the list.
public virtual void SelectResource( string[] resTypes, IResourceList baseList, IResource selection )
{
}
///
/// Prepares the pane for selecting multiple resources from the specified list.
///
/// Obsolete; please don't use.
/// The list from which the resources are selected.
/// The resources which are initially selected in the list.
public virtual void SelectResources( string[] resTypes, IResourceList baseList, IResourceList selection )
{
}
///
/// Returns the list of resources currently selected by the user.
///
/// The list of selected resources.
public virtual IResourceList GetSelection()
{
return null;
}
///
/// Occurs when the user accepts the selection, for example, by double-clicking the selection
/// list.
///
public event EventHandler Accept;
///
/// Fires the event.
///
protected void OnAccept()
{
if ( Accept != null )
{
Accept( this, EventArgs.Empty );
}
}
///
/// Returns true if the "New..." button should be shown or false otherwise.
///
/// 2.0
public virtual bool ShowNewButton
{
get { return false; }
}
///
/// Called when the "New..." button is clicked in the selector dialog.
///
/// 2.0
public virtual void HandleNewButtonClicked()
{
}
}
}