Extensions for GTK4 with cairo Graphics Library in mind
$ dotnet add package gfoidl.Gtk4.ExtensionsWorking with .NET and GTK 4 is done via GirCore.
GirCore has it's own build of cairo, but that cairo-wrapper
Thus these extensions package for GTK 4 uses CairoSharp.
These properties are optional, and by default (false) they do nothing.
<PropertyGroup>
<GtkWinNativeDir>C:\Program Files\msys64\ucrt64\bin</GtkWinNativeDir>
<GtkWinCopyNativeLibs>false</GtkWinCopyNativeLibs>
</PropertyGroup>
When GtkWinCopyNativeLibs is set to true, then the native binaries are copied from the directory given by GtkWinNativeDir to the output directory.
This is for convenience when you want to package the application.
Help with registering actions in the form of
public sealed class MainWindow : ApplicationWindow
{
public MainWindow(/* ... */)
{
this.AddAction("saveAsPng", this.SaveAsPng);
}
private void SaveAsPng()
{
// ...
}
}
SaveAsPng to save the drawing area as PNG fileSaveAsPngWithFileDialog similar to the previous, just with a file dialog to choose the filenameAddContextMenuForFontChooser adds a context menu ("right-click menu") to allow choosing a (Pango) fontOnNotifySelected registers a signal the is triggered when the selected properrty is changedSetExpression set an expression with a Func<IntPtr, string> propertyAccessorProvides some constants for GTK 4. See Gtk4Constants for the values.
HintAlignToParent tries to dock the windows to a parent on the given side (note: this won't work on Wayland, as there's no such functionality)GetSurface gets the surface associated with the window