///
/// 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;
namespace JetBrains.Omea.OpenAPI
{
///
/// Base class for view panes displayed in the sidebar.
///
/// This can't be abstract, otherwise it won't be possible to edit derived classes
/// in the forms designer.
public class AbstractViewPane: UserControl
{
///
/// Fills the pane with the data which needs to be displayed. Called when the pane is
/// displayed for the first time.
///
public virtual void Populate()
{
}
///
/// The resource which is currently selected in the pane.
///
public virtual IResource SelectedResource
{
get { return null; }
}
///
/// Whether the pane needs to show the current selection if it is not focused.
///
public virtual bool ShowSelection
{
get { return true; }
set { }
}
///
/// Adjusts the size of the pane so that it is as large as it's needed to
/// fit the content, but no larger than the specified size.
///
/// Maximum height that the pane can take.
public virtual void AutoSize( int maxHeight )
{
}
///
/// Selects the specified resource in the pane.
///
/// The resource to select.
/// If true, the selection should be set to the node,
/// but the resource list should not be updated.
/// true if the resource was selected successfully or false if it was not
/// found in the pane
public virtual bool SelectResource( IResource resource, bool highlightOnly )
{
return false;
}
///
/// Forces the pane to repeat the action which is executed when a node is selected
/// in the pane.
///
public virtual void UpdateSelection()
{
}
///
/// Forces the pane to repeat asynchronously the action which is executed when a node is selected
/// in the pane.
///
public virtual void AsyncUpdateSelection()
{
}
///
/// Sets the currently active workspace. The pane can choose to filter its
/// contents depending on the workspace.
///
/// Active workspace, or null if the main workspace is active.
public virtual void SetActiveWorkspace( IResource workspace )
{
}
///
/// Selects the previous view containing the specified resource, preceeding the specified view.
///
/// The base view for searching the previous view.
/// true if the previous view was selected successfully, false otherwise.
public virtual bool GotoPrevView( IResource view )
{
return false;
}
///
/// Selects the previous view containing the unread resource, preceeding the specified view.
///
/// The base view for searching the previous view with unread item(s).
/// true if the previous view was selected successfully, false otherwise.
public virtual bool GotoPrevUnreadView( IResource view )
{
return false;
}
///
/// Selects the next view containing the specified resource, following the specified view.
///
/// The base view for searching the next view.
/// true if the next view was selected successfully, false otherwise.
public virtual bool GotoNextView( IResource view )
{
return false;
}
///
/// Selects the next view containing the unread resource, following the specified view.
///
/// The base view for searching the next view with unread item(s).
/// true if the next view was selected successfully, false otherwise.
public virtual bool GotoNextUnreadView( IResource view )
{
return false;
}
}
}