## IBusAttribute

IBusAttribute — Attributes of IBusText.

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    enum                IBusAttrType;
    enum                IBusAttrUnderline;
    struct              IBusAttribute;
    struct              IBusAttributeClass;
    IBusAttribute *     ibus_attr_background_new            (guint color,
                                                             guint start_index,
                                                             guint end_index);
    IBusAttribute *     ibus_attr_foreground_new            (guint color,
                                                             guint start_index,
                                                             guint end_index);
    IBusAttribute *     ibus_attr_underline_new             (guint underline_type,
                                                             guint start_index,
                                                             guint end_index);
    guint               ibus_attribute_get_attr_type        (IBusAttribute *attr);
    guint               ibus_attribute_get_end_index        (IBusAttribute *attr);
    guint               ibus_attribute_get_start_index      (IBusAttribute *attr);
    guint               ibus_attribute_get_value            (IBusAttribute *attr);
    IBusAttribute *     ibus_attribute_new                  (guint type,
                                                             guint value,
                                                             guint start_index,
                                                             guint end_index);

## Object Hierarchy

      GEnum
       +----IBusAttrType

      GEnum
       +----IBusAttrUnderline

      GObject
       +----GInitiallyUnowned
             +----IBusObject
                   +----IBusSerializable
                         +----IBusAttribute

## Description

An IBusAttribute represents an attribute that associate to IBusText. It decorates preedit buffer and auxiliary text with underline, foreground and background colors.

## Details

### enum IBusAttrType

    typedef enum {
        IBUS_ATTR_TYPE_UNDERLINE    = 1,
        IBUS_ATTR_TYPE_FOREGROUND   = 2,
        IBUS_ATTR_TYPE_BACKGROUND   = 3,
    } IBusAttrType;

Type enumeration of IBusText attribute.

`IBUS_ATTR_TYPE_UNDERLINE` | Decorate with underline.
`IBUS_ATTR_TYPE_FOREGROUND` | Foreground color.
`IBUS_ATTR_TYPE_BACKGROUND` | Background color.

### enum IBusAttrUnderline

    typedef enum {
        IBUS_ATTR_UNDERLINE_NONE    = 0,
        IBUS_ATTR_UNDERLINE_SINGLE  = 1,
        IBUS_ATTR_UNDERLINE_DOUBLE  = 2,
        IBUS_ATTR_UNDERLINE_LOW     = 3,
        IBUS_ATTR_UNDERLINE_ERROR   = 4,
    } IBusAttrUnderline;

Type of IBusText attribute.

`IBUS_ATTR_UNDERLINE_NONE` | No underline.
`IBUS_ATTR_UNDERLINE_SINGLE` | Single underline.
`IBUS_ATTR_UNDERLINE_DOUBLE` | Double underline.
`IBUS_ATTR_UNDERLINE_LOW` | Low underline ? `FIXME`
`IBUS_ATTR_UNDERLINE_ERROR` | Error underline

### struct IBusAttribute

    struct IBusAttribute {
        guint type;
        guint value;
        guint start_index;
        guint end_index;
    };

Signify the type, value and scope of the attribute. The scope starts from `start_index` till the `end_index`-1.

guint `type`; | IBusAttributeType
guint `value`; | Value for the type.
guint `start_index`; | The starting index, inclusive.
guint `end_index`; | The ending index, exclusive.

### struct IBusAttributeClass

    struct IBusAttributeClass {
        IBusSerializableClass parent;
    };

### ibus_attr_background_new ()

    IBusAttribute *     ibus_attr_background_new            (guint color,
                                                             guint start_index,
                                                             guint end_index);

New an background IBusAttribute.

`color` : | Color in RGB.
`start_index` : | Where attribute starts.
`end_index` : | Where attribute ends.
Returns : | A newly allocated IBusAttribute. [transfer none]

### ibus_attr_foreground_new ()

    IBusAttribute *     ibus_attr_foreground_new            (guint color,
                                                             guint start_index,
                                                             guint end_index);

New an foreground IBusAttribute.

`color` : | Color in RGB.
`start_index` : | Where attribute starts.
`end_index` : | Where attribute ends.
Returns : | A newly allocated IBusAttribute. [transfer none]

### ibus_attr_underline_new ()

    IBusAttribute *     ibus_attr_underline_new             (guint underline_type,
                                                             guint start_index,
                                                             guint end_index);

New an underline IBusAttribute.

`underline_type` : | Type of underline.
`start_index` : | Where attribute starts.
`end_index` : | Where attribute ends.
Returns : | A newly allocated IBusAttribute. [transfer none]

### ibus_attribute_get_attr_type ()

    guint               ibus_attribute_get_attr_type        (IBusAttribute *attr);

Returns an enum of IBusAttrType.

Returns : | An enum of IBusAttrType.

### ibus_attribute_get_end_index ()

    guint               ibus_attribute_get_end_index        (IBusAttribute *attr);

Returns a end unsigned index

Returns : | A end unsigned index

### ibus_attribute_get_start_index ()

    guint               ibus_attribute_get_start_index      (IBusAttribute *attr);

Returns a start unsigned index

Returns : | A start unsigned index

### ibus_attribute_get_value ()

    guint               ibus_attribute_get_value            (IBusAttribute *attr);

Returns an unsigned int value relative with IBusAttrType. If the type is `IBUS_ATTR_TYPE_UNDERLINE`, the return value is IBusAttrUnderline. If the type is `IBUS_ATTR_TYPE_FOREGROUND`, the return value is the color RGB.

Returns : | An unsigned int value relative with IBusAttrType.

### ibus_attribute_new ()

    IBusAttribute *     ibus_attribute_new                  (guint type,
                                                             guint value,
                                                             guint start_index,
                                                             guint end_index);

New an IBusAttribute.

`type` : | Type of the attribute.
`value` : | Value of the attribute.
`start_index` : | Where attribute starts.
`end_index` : | Where attribute ends.
Returns : | A newly allocated IBusAttribute. [transfer none]

## See Also

IBusText