using System.Windows;
namespace LiveWall.Sdk;
///
/// A visual layer drawn on top of the wallpaper, inside LiveWall's desktop overlay window (the same
/// window that carries the desktop icons). Because that window is per-pixel transparent, only the
/// pixels you paint block the mouse - everything else falls through to the desktop.
///
public interface IWallpaperOverlay
{
/// Shown in the plugin's UI and the diagnostics report.
string Name { get; }
///
/// Creates the visual. Called once per display, on the UI thread. Keep it cheap and transparent.
/// The returned element is stretched to the display and is not hit-testable by default.
///
FrameworkElement CreateView(OverlayContext context);
/// Called whenever the wallpaper, playback or interaction state changes.
void Update(OverlayState state);
/// Called when the user hides the overlay or the plugin is disabled.
void OnVisibilityChanged(bool visible) { }
}
/// Display specific context handed to .
public sealed class OverlayContext
{
public int DisplayIndex { get; init; }
public string DeviceName { get; init; } = "";
public double Width { get; init; }
public double Height { get; init; }
public double DpiScale { get; init; } = 1.0;
public bool Primary { get; init; }
}
/// State handed to .
public sealed class OverlayState
{
public string Kind { get; init; } = "";
public string Source { get; init; } = "";
public string Title { get; init; } = "";
public bool IsPlaying { get; init; }
public bool IsPaused { get; init; }
public bool IsInteractive { get; init; }
public DateTime TimestampUtc { get; init; } = DateTime.UtcNow;
}
/// A page the plugin adds to the LiveWall settings window (Plugins tab).
public interface IPluginSettingsPage
{
string Title { get; }
/// One or two sentences for the page header.
string Description { get; }
/// Builds the page content. Called once, on the UI thread.
FrameworkElement CreateView();
}
///
/// Rewrites wallpaper requests before the engine applies them: resolve a URL, swap a file, pin a
/// playlist entry, or veto a change by returning the previous request.
///
public interface IWallpaperFilter
{
/// Higher runs first. 0 is a good default.
int Priority { get; }
/// Return the request to apply (return the argument unchanged to leave it alone).
WallpaperRequest Apply(WallpaperRequest request, IHostActions host);
}
///
/// Renders wallpaper sources the built-in players cannot handle. The first renderer whose
/// returns true wins (highest first), so a plugin can
/// also take over a source LiveWall would otherwise play itself.
///
public interface IWallpaperRendererPlugin
{
string Name { get; }
/// Higher wins over other plugins (built-in renderers are not in this race).
int Priority { get; }
/// Decides whether this renderer handles the source string.
bool CanRender(WallpaperRequest request);
IWallpaperRenderer Create();
}
/// The renderer instance. LiveWall owns its lifetime.
public interface IWallpaperRenderer : IDisposable
{
/// The visual shown as the wallpaper. Keep the background opaque.
FrameworkElement View { get; }
/// Loads the source. Throw to report a problem (it is shown to the user).
void Load(WallpaperRequest request);
void Play();
void Pause();
void Unload();
/// Volume is 0–100, speed 0.25–4.
void ApplyPlayback(bool muted, double volume, double speed);
/// Raised when playback fails (message is shown in the status bar and the log).
event EventHandler? Failed;
/// Raised when a non-looping source finished.
event EventHandler? Ended;
}