GtkSharp

From Wiki Maui Linux NET
Revision as of 13:17, 20 October 2025 by Ten (talk | contribs) (See also)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
GtkSharp
Developer(s) GNOME Project, Xamarin, and community contributors
Initial release

2002

Latest version 3.24
Programming language C#
Operating system Cross-platform
Platform .NET, Mono
Type GUI toolkit bindings
License GNU Lesser General Public License
Website GitHub repository


GtkSharp is a set of C# bindings for the GTK graphical user interface toolkit. It allows developers to build cross-platform desktop applications using GTK within the .NET or Mono environments.

Overview of GTK

GTK (originally "GIMP Toolkit") is an open-source, cross-platform widget toolkit for creating graphical user interfaces. It is written in C and widely used in Linux desktop environments such as GNOME, as well as in applications for Windows and macOS. GTK provides a comprehensive set of widgets (buttons, text boxes, menus, trees, etc.), along with a powerful signal system and support for accessibility and internationalization.

GtkSharp

GtkSharp is the official binding layer that connects GTK's native C libraries with the managed .NET world. It provides an object-oriented API that closely mirrors GTK's structure, enabling developers to use GTK features directly from C# or any other .NET language.

GtkSharp wraps the native GTK libraries using the GObject introspection system and a set of automatically generated bindings. Applications written with GtkSharp can run on Windows, macOS, and Linux without modification, as long as the GTK runtime and .NET runtime are available.

Components

GtkSharp is not limited to GTK itself; it also includes bindings for several related GNOME platform libraries. Each component corresponds to a part of the GTK ecosystem and provides managed access to additional functionality:

  • GdkSharp – Bindings for GDK, the underlying drawing and windowing library used by GTK.
  • AtkSharp – Bindings for ATK (Accessibility Toolkit), providing accessibility interfaces for assistive technologies.
  • PangoSharp – Bindings for Pango, the text layout and rendering library used by GTK.
  • CairoSharp – Bindings for the Cairo 2D graphics library used for custom drawing.
  • GLibSharp – Bindings for GLib, providing low-level utilities, data types, and the main event loop used throughout the GNOME platform.

Each of these submodules has its own namespace and API surface, designed to match its native counterpart as closely as possible while offering idiomatic C# integration.

Version history

GtkSharp has evolved alongside GTK:

  • **GtkSharp 2.x** – Based on GTK 2; used by MonoDevelop and other early .NET/Mono applications.
  • **GtkSharp 3.x** – Targets GTK 3 and provides updated bindings compatible with modern .NET versions.
  • **GtkSharp 4.x (in development)** – Aims to provide bindings for GTK 4 with improved tooling and introspection-based code generation.

See also