openDecal/Managed/Decal.DecalControls/LayoutImpl.cs
erik d1442e3747 Initial commit: Complete open-source Decal rebuild
All 5 phases of the open-source Decal rebuild:

Phase 1: 14 decompiled .NET projects (Interop.*, Adapter, FileService, DecalUtil)
Phase 2: 10 native DLLs rewritten as C# COM servers with matching GUIDs
  - DecalDat, DHS, SpellFilter, DecalInput, DecalNet, DecalFilters
  - Decal.Core, DecalControls, DecalRender, D3DService
Phase 3: C++ shims for Inject.DLL (D3D9 hooking) and LauncherHook.DLL
Phase 4: DenAgent WinForms tray application
Phase 5: WiX installer and build script

25 C# projects building with 0 errors.
Native C++ projects require VS 2022 + Windows SDK (x86).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 18:27:56 +01:00

92 lines
2.9 KiB
C#

using System.Runtime.InteropServices;
using Decal.Interop.Controls;
using Decal.Interop.Core;
using Decal.Interop.Inject;
namespace Decal.DecalControls
{
[ComVisible(true)]
[Guid("CD6556CD-F8D9-4CB0-AB7C-7C33058294E4")]
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces("Decal.Interop.Inject.IControlEvents\0\0")]
[ProgId("DecalControls.FixedLayout")]
public class FixedLayoutImpl : ControlBase, ILayout
{
public event IControlEvents_DestroyEventHandler Destroy;
private IImageCache _background;
public IImageCache Background { get => _background; set { _background = value; Invalidate(); } }
public void CreateChild(ref LayerParams @params, ILayer pSink)
{
if (_site != null)
((ILayerSite)(object)_site).CreateChild(ref @params, pSink);
}
public void PositionChild(int nID, ref tagRECT prcNew) { }
protected override void OnDestroy() => Destroy?.Invoke(ID);
}
[ComVisible(true)]
[Guid("CA121762-31BB-4073-8597-33BAB4BDCAA3")]
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces("Decal.Interop.Inject.IControlEvents\0\0")]
[ProgId("DecalControls.BorderLayout")]
public class BorderLayoutImpl : ControlBase, ILayout
{
public event IControlEvents_DestroyEventHandler Destroy;
private IImageCache _background;
public IImageCache Background { get => _background; set { _background = value; Invalidate(); } }
public void CreateEdge(eBorderEdge eEdge, int nSize, ILayer pSink) { }
public void CreateCenter(ILayer pSink) { }
protected override void OnDestroy() => Destroy?.Invoke(ID);
}
[ComVisible(true)]
[Guid("5AD04D45-D4BF-4729-8A2E-5D37CF726CAA")]
[ClassInterface(ClassInterfaceType.None)]
[ComSourceInterfaces("Decal.Interop.Inject.IControlEvents\0\0")]
[ProgId("DecalControls.PageLayout")]
public class PageLayoutImpl : ControlBase, IPageLayout
{
public event IControlEvents_DestroyEventHandler Destroy;
private IImageCache _background;
private readonly System.Collections.Generic.List<ILayer> _pages = new System.Collections.Generic.List<ILayer>();
private int _active;
// ILayout
public IImageCache Background { get => _background; set { _background = value; Invalidate(); } }
// IPageLayoutDisp
public int Active
{
get => _active;
set
{
if (value >= 0 && value < _pages.Count)
{
_active = value;
Invalidate();
}
}
}
public int Count => _pages.Count;
// IPageLayout
public void CreatePage(ILayer pChild)
{
_pages.Add(pChild);
Invalidate();
}
protected override void OnDestroy() => Destroy?.Invoke(ID);
}
}