annotation GObject::Property

Overview

This annotation install a Crystal property as a GObject property, so it can be recognized by GObject

It accepts the following parameters:

name: Canonical name of the property specified, default to the variable name. nick: Nick name for the property specified, default to nil. default: The default value for this property when created from C world (impossible at the moment). min: Minimum value for this property, only valid for numeric or Char properties. max: Maximum value for this property, only valid for numeric or Char properties. blurb: Description of the property specified, default to nil.

Example:

private class PropObject < GObject::Object
  @[GObject::Property(nick: "INTEGER", blurb: "An Int32", default: 42, min: 40, max: 50)]
  property int : Int32 = 42

  def initialize
    super()
  end
end

Defined in:

lib/gi-crystal/src/bindings/g_object/object.cr