SharpDevelop IDE IViewContent.cs类

文件位置:IViewContent.cs

csharp 复制代码
/// <summary>
	/// IViewContent is the base interface for "windows" in the document area of SharpDevelop.
	/// A view content is a view onto multiple files, or other content that opens like a document
	/// (e.g. the start page).
	/// </summary>
	public interface IViewContent : IDisposable, ICanBeDirty, IServiceProvider
	{
		/// <summary>
		/// This is the UI element for the view.
		/// You can use both Windows.Forms and WPF controls.
		/// </summary>
		object Control {
			get;
		}
		
		/// <summary>
		/// Gets the control which has focus initially.
		/// </summary>
		object InitiallyFocusedControl {
			get;
		}
		
		/// <summary>
		/// The workbench window in which this view is displayed.
		/// </summary>
		IWorkbenchWindow WorkbenchWindow {
			get;
			set;
		}
		
		/// <summary>
		/// Is raised when the value of the TabPageText property changes.
		/// </summary>
		event EventHandler TabPageTextChanged;
		
		/// <summary>
		/// The text on the tab page when more than one view content
		/// is attached to a single window.
		/// </summary>
		string TabPageText {
			get;
		}
		
		/// <summary>
		/// The title of the view content. This normally is the title of the primary file being edited.
		/// </summary>
		string TitleName {
			get;
		}
		
		/// <summary>
		/// Is called each time the name for the content has changed.
		/// </summary>
		event EventHandler TitleNameChanged;
		
		/// <summary>
		/// The tooltip that will be shown when you hover the mouse over the title
		/// </summary>
		string InfoTip {
			get;
		}

		/// <summary>
		/// Is called each time the info tip for the content has changed.
		/// </summary>
		event EventHandler InfoTipChanged;

		/// <summary>
		/// Saves the content to the location <code>fileName</code>
		/// </summary>
		/// <remarks>
		/// When the user switches between multiple views editing the same file, a view
		/// change will trigger one view content to save that file into a memory stream
		/// and the other view content will load the file from that memory stream.
		/// </remarks>
		void Save(OpenedFile file, Stream stream);
		
		/// <summary>
		/// Load or reload the content of the specified file from the stream.
		/// </summary>
		/// <remarks>
		/// When the user switches between multiple views editing the same file, a view
		/// change will trigger one view content to save that file into a memory stream
		/// and the other view content will load the file from that memory stream.
		/// </remarks>
		void Load(OpenedFile file, Stream stream);
		
		/// <summary>
		/// Gets the list of files that are being edited using this view content.
		/// The returned collection usually is read-only.
		/// </summary>
		IList<OpenedFile> Files { get; }
		
		/// <summary>
		/// Gets the primary file being edited. Might return null if no file is edited.
		/// </summary>
		OpenedFile PrimaryFile { get; }
		
		/// <summary>
		/// Gets the name of the primary file being edited. Might return null if no file is edited.
		/// </summary>
		FileName PrimaryFileName { get; }
		
		/// <summary>
		/// Builds an <see cref="INavigationPoint"/> for the current position.
		/// </summary>
		INavigationPoint BuildNavPoint();
		
		bool IsDisposed { get; }
		
		event EventHandler Disposed;
		
		/// <summary>
		/// Gets if the view content is read-only (can be saved only when choosing another file name).
		/// </summary>
		bool IsReadOnly { get; }
		
		/// <summary>
		/// Gets if the view content is view-only (cannot be saved at all).
		/// </summary>
		bool IsViewOnly { get; }
		
		/// <summary>
		/// Gets whether this view content should be closed when the solution is closed.
		/// </summary>
		bool CloseWithSolution { get; }
		
		#region Secondary view content support
		/// <summary>
		/// Gets the collection that stores the secondary view contents.
		/// </summary>
		ICollection<IViewContent> SecondaryViewContents { get; }
		
		
		/// <summary>
		/// Gets switching without a Save/Load cycle for <paramref name="file"/> is supported
		/// when switching from this view content to <paramref name="newView"/>.
		/// </summary>
		bool SupportsSwitchFromThisWithoutSaveLoad(OpenedFile file, IViewContent newView);
		
		/// <summary>
		/// Gets switching without a Save/Load cycle for <paramref name="file"/> is supported
		/// when switching from <paramref name="oldView"/> to this view content.
		/// </summary>
		bool SupportsSwitchToThisWithoutSaveLoad(OpenedFile file, IViewContent oldView);
		
		/// <summary>
		/// Executes an action before switching from this view content to the new view content.
		/// </summary>
		void SwitchFromThisWithoutSaveLoad(OpenedFile file, IViewContent newView);
		
		/// <summary>
		/// Executes an action before switching from the old view content to this view content.
		/// </summary>
		void SwitchToThisWithoutSaveLoad(OpenedFile file, IViewContent oldView);
		#endregion
	}

IViewContent 是一个接口,定义了视图内容的基本行为和属性。在 SharpDevelop IDE 中,视图内容是文档区域中的"窗口",可以是一个编辑器窗口,也可以是其他类型的窗口,如起始页。

以下是 IViewContent 接口的主要功能:

  1. 获取和设置视图内容的 UI 元素 :通过 Control 属性,可以获取和设置视图内容的 UI 元素。这个 UI 元素可以是 Windows.Forms 控件,也可以是 WPF 控件。

  2. 获取和设置视图内容的标题 :通过 TitleName 属性,可以获取和设置视图内容的标题。这个标题通常是正在编辑的主要文件的标题。

  3. 获取和设置视图内容的标签页文本 :通过 TabPageText 属性,可以获取和设置视图内容的标签页文本。这个文本在多个视图内容附加到同一个窗口时使用。

  4. 保存和加载视图内容 :通过 SaveLoad 方法,可以保存和加载视图内容。这些方法接受一个 OpenedFile 对象和一个 Stream 对象,用于保存和加载文件。

  5. 获取正在编辑的文件列表 :通过 Files 属性,可以获取正在编辑的文件列表。这个列表通常是一个只读的集合。

  6. 获取正在编辑的主要文件 :通过 PrimaryFile 属性,可以获取正在编辑的主要文件。如果没有任何文件正在编辑,这个属性可能返回 null

  7. 获取正在编辑的主要文件的名称 :通过 PrimaryFileName 属性,可以获取正在编辑的主要文件的名称。如果没有任何文件正在编辑,这个属性可能返回 null

  8. 构建导航点 :通过 BuildNavPoint 方法,可以构建一个导航点,用于表示当前的位置。

  9. 获取视图内容的关闭行为 :通过 CloseWithSolution 属性,可以获取视图内容的关闭行为。这个属性表示当解决方案关闭时,视图内容是否应该关闭。

  10. 获取视图内容的只读和只读状态 :通过 IsReadOnlyIsViewOnly 属性,可以获取视图内容的只读和只读状态。如果视图内容是只读的,那么它只能保存到另一个文件名,不能保存到原始文件。如果视图内容是只读的,那么它不能保存到任何文件。

  11. 获取和设置视图内容的上下文帮助提供者 :通过 ContextHelpProvider 属性,可以获取和设置视图内容的上下文帮助提供者。上下文帮助提供者用于提供上下文相关的帮助信息。

  12. 获取和设置视图内容的工具宿主 :通过 ToolsHost 属性,可以获取和设置视图内容的工具宿主。工具宿主用于显示和管理工具。

  13. 获取和设置视图内容的属性容器 :通过 PropertyContainer 属性,可以获取和设置视图内容的属性容器。属性容器用于存储和显示对象的属性。

  14. 获取和设置视图内容的剪贴板处理程序 :通过 ClipboardHandler 属性,可以获取和设置视图内容的剪贴板处理程序。剪贴板处理程序用于处理剪贴板操作,如复制、粘贴、剪切等。

  15. 获取和设置视图内容的撤销处理程序 :通过 UndoHandler 属性,可以获取和设置视图内容的撤销处理程序。撤销处理程序用于处理撤销和重做操作。

  16. 获取和设置视图内容的文件文档提供程序 :通过 FileDocumentProvider 属性,可以获取和设置视图内容的文件文档提供程序。文件文档提供程序用于提供文件文档。

  17. 获取和设置视图内容的组件变更服务 :通过 ComponentChangeService 属性,可以获取和设置视图内容的组件变更服务。组件变更服务用于通知组件的变更。

  18. **获取和设置视图内容的

相关推荐
钢铁男儿1 小时前
C#结构体性能暴击指南:从内存陷阱到零损耗实战
开发语言·c#
MZZ骏马2 小时前
C#接受文件
开发语言·c#
ou.cs2 小时前
wpf 控件开发中,OnApplyTemplate 和 OnContentRendered区别
c#·.net·wpf
忧郁的蛋~4 小时前
.NET Core 实现缓存的预热的方式
缓存·c#·.net·.netcore
csdn_aspnet1 天前
C# .NET Core 源代码生成器(dotnet source generators)
c#·.netcore
时光追逐者1 天前
C#/.NET/.NET Core技术前沿周刊 | 第 42 期(2025年6.9-6.15)
c#·.net·.netcore
z2014z2 天前
第3章 C#编程概述 笔记
笔记·c#
葡萄城技术团队2 天前
基于 C# 和 .NET 的 Spread.NET 数据处理实战
c#
ou.cs2 天前
wpf 解决DataGridTemplateColumn中width绑定失效问题
c#·wpf
程序猿小D2 天前
第27节 Node.js Buffer
linux·开发语言·vscode·node.js·c#·编辑器·vim