[Contents] [Back] [Prev] [Up] [Next] [Forward]

# Package Glib.Generic`_`Properties

Note: this package need only be used and understood by people who want to create their own new widgets and their associated properties. Normal usage of properties doesn't require any deep understanding of this package.

This package provides two generic subpackages that make it easy to declare properties. Each of these packages define two types:

- Property_RO : this type should be used for a read-only property of the given type.
- Property : This is for read-write properties

Each of these two types is associated with one or two primitive operations Get_Property and Set_Property, that allows the modification of properties of this type.

As a user and creator of new widgets, you should always use the Generic_Enumeration_Property package, since it also registers the enumeration type with gtk+ for a full compatibility with C.

- Glib.Generic_Properties Types
- Glib.Generic_Properties Subprograms

## Types

    type Discrete_Type is
        (<>);

    type Enumeration is
        (<>);

    type Property is new Properties.Property;

    type Property_RO is new Properties.Property_RO;

## Subprograms

### Generic package for discrete type properties

This package should be used to implement the Get_Property and Set_Property subprograms for all properties related to enumeration types and simple types. This should be used only for types defined in GtkAda or gtk+ themselves, not for types that you define yourself. Use Generic_Discrete_Type instead.

    procedure Set_Property
      (Object             : access Glib.Object.GObject_Record'Class;
       Name               :        Property;
       Value              :        Discrete_Type);

| Set a property of Object based on Enumeration_Type.

    function Get_Property
      (Object             : access Glib.Object.GObject_Record'Class;
       Name               :        Property)
       return Discrete_Type;

    function Get_Property
      (Object             : access Glib.Object.GObject_Record'Class;
       Name               :        Property_RO)
       return Discrete_Type;

| Get a property from Object

### Types

    function Get_Type              return Glib.GType;

| Return the internal gtk+ type associated with the Ada enumeration Enumeration. You don't need to use such a function for the types defined in standard in GtkAda. Use Glib.Type_From_Name instead.

    function Gnew_Enum
      (Name, Nick, Blurb  :        String;
       Default            :        Enumeration
                           := Enumeration'First;
       Flags              :        Param_Flags
                           := Param_Readable or Param_Writable)
       return Param_Spec;

| Create a new param_spec (to describe properties), based on the Ada enumeration type Enumeration. This function is used when creating the property with Install_Property on an object. Name, Nick and Blurb should describe the property, not its type.

### Values

    function Get_Enum
      (Value              :        Glib.Values.GValue)
       return Enumeration;

| Return the enumeration contained in Value, assuming it is of type Enumeration

    procedure Set_Enum
      (Value              : in out Glib.Values.GValue;
       Enum               :        Enumeration);

| Set the enumeration value for Value. This properly initializes the type of Value, so you don't need to call Init yourself.

### Generic package for record types properties

This package should be used to implement the Get_Property and Set_Property subprograms for all properties related to record type, like Gdk_Color and Gdk_Rectangle. This should be used only for types defined in GtkAda or gtk+ themselves, not for types that you define yourself.

    procedure Set_Property
      (Object             : access Glib.Object.GObject_Record'Class;
       Name               :        Property;
       Value              :        Boxed_Type);

| Set a property of Object based on Enumeration_Type.

    function Get_Property
      (Object             : access Glib.Object.GObject_Record'Class;
       Name               :        Property)
       return Boxed_Type;

    function Get_Property
      (Object             : access Glib.Object.GObject_Record'Class;
       Name               :        Property_RO)
       return Boxed_Type;

| Get a property from Object

[Contents] [Back] [Prev] [Up] [Next] [Forward]