package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.common/Gobject/index.html

Module GobjectSource

GObject type system and object model for GTK4

Core Types

Sourcetype -'a obj

Type for GObject instances. The type parameter provides type safety.

Sourcetype g_type

GType identifier — opaque; use Type.equal to compare, Type.to_int for formatting

Sourcetype g_value

GValue container for generic values

Sourcetype g_closure

GClosure for signal callbacks

Object Operations

Sourceval get_type : 'a obj -> g_type

Get the GType of an object

Sourceval unsafe_cast : 'a obj -> 'b obj

Unsafe cast between object types

Sourceval coerce : 'a obj -> unit obj

Safe coercion to generic object

Sourceval same : 'a obj -> 'b obj -> bool

same a b is true iff a and b wrap the same underlying GObject pointer. Two extractions of the same GObject (e.g. successive Gobject.Value.get_object calls in a signal callback) allocate distinct OCaml custom blocks, so Stdlib.(==) always returns false. Use same when the intent is identity comparison.

Stdlib.(=), Stdlib.compare, and Hashtbl.hash also operate on pointer identity for obj values (the custom block installs a pointer-compare / pointer-hash); same is the explicit form.

Sourceval get_ref_count : 'a obj -> int

Get reference count (for debugging)

Type System

Sourcemodule Type : sig ... end

GValue Operations

Sourcemodule Value : sig ... end

Properties

Sourcemodule Property : sig ... end

Closures

Sourcemodule Closure : sig ... end

Signals

Sourcemodule Signal : sig ... end