pascalabcnet/VisualPascalABCNETLinux/OptionsContent/OptionsContentEngine.cs
Mikhalkovich Stanislav 3072383106 Для Linux-версии исправлен DockContent, редактор (показ всплывающего окна)
Сделан новый проект VisualPABCLinux
И пришлось склонировать PluginsSupport, поскольку он вносит зависимость по редактору
Компоненты WeifenLuo для Linux надо после перекомпиляции скопировать в Libraries - подшить их к основному проекту просто не получилось
2022-06-30 09:47:11 +03:00

61 lines
1.9 KiB
C#

// Copyright (c) Ivan Bondarev, Stanislav Mikhalkovich (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
namespace VisualPascalABC.OptionsContent
{
public class OptionsContentEngine
{
List<IOptionsContent> contentList = new List<IOptionsContent>();
List<IOptionsContent> showedContent = new List<IOptionsContent>();
public List<IOptionsContent> ContentList
{
get
{
return contentList;
}
}
OptionsForm optionsWindow;
Form ownerForm;
public OptionsContentEngine(Form ownerForm)
{
this.ownerForm = ownerForm;
}
public void AddContent(IOptionsContent content)
{
contentList.Add(content);
}
public void ShowDialog()
{
if (optionsWindow == null)
{
optionsWindow = new OptionsForm(this);
optionsWindow.Owner = ownerForm;
}
optionsWindow.ShowDialog();
}
public void UpdateOptionsForm()
{
if (optionsWindow != null)
optionsWindow.UpdateOptionsForm();
}
internal void Action(IOptionsContent content, OptionsContentAction action)
{
content.Action(action);
if (action == OptionsContentAction.Show)
showedContent.Add(content);
}
internal void Action(OptionsContentAction action)
{
foreach (IOptionsContent c in showedContent)
c.Action(action);
if (action == OptionsContentAction.Ok || action == OptionsContentAction.Cancel)
showedContent.Clear();
}
}
}