You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
3.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Text;
namespace Mesnac.PlugIn.View
{
/// <summary>
/// 建立所有视图窗口的基础接口
/// 窗体设计器、代码编辑器、对象查看器等窗口的基础接口
/// </summary>
public interface IViewContent : IDisposable
{
/// <summary>
/// 标识号
/// </summary>
string ViewContentID { get; set; }
/// <summary>
/// 对象所有者
/// </summary>
object MyOwner { get; set; }
/// <summary>
/// 视图窗口的标题文本
/// </summary>
string TitleName { get; set; }
/// <summary>
/// 是否真是关闭
/// </summary>
bool IsRealClose { get; set; }
/// <summary>
/// 可见属性
/// </summary>
bool Visible { get; set; }
/// <summary>
/// 返回视图窗口中对应的Windows控件
/// </summary>
Control Control { get; }
/// <summary>
/// 视图窗口操作项集合
/// </summary>
List<ActionItem> ActionList { get; }
/// <summary>
/// 向操作集合中添加一个操作项
/// </summary>
/// <param name="actionItem"></param>
void AddActionItem(ActionItem actionItem);
/// <summary>
/// 向操作集合中添加一个操作项
/// </summary>
/// <param name="actionName">操作名称</param>
/// <param name="control">功能控件</param>
void AddActionItem(string actionName, Control control);
/// <summary>
/// 移除一个控件对应的操作
/// </summary>
/// <param name="control"></param>
void RemoveActionItem(Control control);
/// <summary>
/// 清空操作集合
/// </summary>
void ClearActionList();
/// <summary>
/// 触发重新载入事件
/// </summary>
/// <param name="e">事件对象</param>
void TriggerReloadEvent(System.EventArgs e);
/// <summary>
/// 重绘视图窗口中的所有组件
/// </summary>
void RedrawContent();
/// <summary>
/// 标题名称更改时触发的事件
/// </summary>
event EventHandler TitleNameChanged;
/// <summary>
/// 重新载入事件
/// </summary>
event EventHandler Reload;
}
/// <summary>
/// 操作项类的封装
/// </summary>
[Serializable]
public class ActionItem
{
private string _actionName;
private Control _control;
public ActionItem() { }
public ActionItem(string actionName, Control control)
{
this._actionName = actionName;
this._control = control;
}
/// <summary>
/// 操作名称
/// </summary>
public string ActionName
{
get { return _actionName; }
set { _actionName = value; }
}
/// <summary>
/// 功能控件
/// </summary>
public Control Control
{
get { return _control; }
set { _control = value; }
}
}
}