mirror of
https://github.com/cyanfish/naps2.git
synced 2024-09-11 15:26:55 +03:00
39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using Eto.Forms;
|
|
using NAPS2.EtoForms.Layout;
|
|
|
|
namespace NAPS2.EtoForms;
|
|
|
|
public abstract class EtoFormBase : Form, IFormBase
|
|
{
|
|
private IFormFactory? _formFactory;
|
|
|
|
protected EtoFormBase(Naps2Config config)
|
|
{
|
|
EtoPlatform.Current.UpdateRtl(this);
|
|
Config = config;
|
|
FormStateController = new FormStateController(this, config);
|
|
Resizable = true;
|
|
LayoutController.Bind(this);
|
|
LayoutController.Invalidated += (_, _) => FormStateController.UpdateLayoutSize(LayoutController);
|
|
}
|
|
|
|
protected abstract void BuildLayout();
|
|
|
|
protected override void OnPreLoad(EventArgs e)
|
|
{
|
|
BuildLayout();
|
|
base.OnPreLoad(e);
|
|
}
|
|
|
|
public FormStateController FormStateController { get; }
|
|
|
|
public LayoutController LayoutController { get; } = new();
|
|
|
|
public IFormFactory FormFactory
|
|
{
|
|
get => _formFactory ?? throw new InvalidOperationException();
|
|
set => _formFactory = value;
|
|
}
|
|
|
|
public Naps2Config Config { get; set; }
|
|
} |