1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
5
using System.Collections.Generic;
7
using System.Windows.Forms;
9
using ICSharpCode.Core;
11
namespace ICSharpCode.SharpDevelop.Gui
13
public delegate void SaveEventHandler(object sender, SaveEventArgs e);
15
public class SaveEventArgs : System.EventArgs
19
public bool Successful {
25
public SaveEventArgs(bool successful)
27
this.successful = successful;
32
/// IViewContent is the base interface for "windows" in the document area of SharpDevelop.
33
/// A view content is a view onto multiple files, or other content that opens like a document
34
/// (e.g. the start page).
36
public interface IViewContent : IDisposable, ICanBeDirty, IServiceProvider
39
/// This is the UI element for the view.
40
/// You can use both Windows.Forms and WPF controls.
47
/// Gets the control which has focus initially.
49
object InitiallyFocusedControl {
54
/// The workbench window in which this view is displayed.
56
IWorkbenchWindow WorkbenchWindow {
62
/// Is raised when the value of the TabPageText property changes.
64
event EventHandler TabPageTextChanged;
67
/// The text on the tab page when more than one view content
68
/// is attached to a single window.
75
/// The title of the view content. This normally is the title of the primary file being edited.
82
/// Is called each time the name for the content has changed.
84
event EventHandler TitleNameChanged;
87
/// The tooltip that will be shown when you hover the mouse over the title
94
/// Is called each time the info tip for the content has changed.
96
event EventHandler InfoTipChanged;
99
/// Saves the content to the location <code>fileName</code>
102
/// When the user switches between multiple views editing the same file, a view
103
/// change will trigger one view content to save that file into a memory stream
104
/// and the other view content will load the file from that memory stream.
106
void Save(OpenedFile file, Stream stream);
109
/// Load or reload the content of the specified file from the stream.
112
/// When the user switches between multiple views editing the same file, a view
113
/// change will trigger one view content to save that file into a memory stream
114
/// and the other view content will load the file from that memory stream.
116
void Load(OpenedFile file, Stream stream);
119
/// Gets the list of files that are being edited using this view content.
120
/// The returned collection usually is read-only.
122
IList<OpenedFile> Files { get; }
125
/// Gets the primary file being edited. Might return null if no file is edited.
127
OpenedFile PrimaryFile { get; }
130
/// Gets the name of the primary file being edited. Might return null if no file is edited.
132
FileName PrimaryFileName { get; }
135
/// Builds an <see cref="INavigationPoint"/> for the current position.
137
INavigationPoint BuildNavPoint();
139
bool IsDisposed { get; }
141
event EventHandler Disposed;
144
/// Gets if the view content is read-only (can be saved only when choosing another file name).
146
bool IsReadOnly { get; }
149
/// Gets if the view content is view-only (cannot be saved at all).
151
bool IsViewOnly { get; }
154
/// Gets whether this view content should be closed when the solution is closed.
156
bool CloseWithSolution { get; }
158
#region Secondary view content support
160
/// Gets the collection that stores the secondary view contents.
162
ICollection<IViewContent> SecondaryViewContents { get; }
166
/// Gets switching without a Save/Load cycle for <paramref name="file"/> is supported
167
/// when switching from this view content to <paramref name="newView"/>.
169
bool SupportsSwitchFromThisWithoutSaveLoad(OpenedFile file, IViewContent newView);
172
/// Gets switching without a Save/Load cycle for <paramref name="file"/> is supported
173
/// when switching from <paramref name="oldView"/> to this view content.
175
bool SupportsSwitchToThisWithoutSaveLoad(OpenedFile file, IViewContent oldView);
178
/// Executes an action before switching from this view content to the new view content.
180
void SwitchFromThisWithoutSaveLoad(OpenedFile file, IViewContent newView);
183
/// Executes an action before switching from the old view content to this view content.
185
void SwitchToThisWithoutSaveLoad(OpenedFile file, IViewContent oldView);