## IBusAttribute IBusAttribute — Attributes of IBusText. |

## Stability Level

Stable, unless otherwise indicated

## Functions

IBusAttribute * | ibus_attribute_new ()
guint | ibus_attribute_get_attr_type ()
guint | ibus_attribute_get_value ()
guint | ibus_attribute_get_start_index ()
guint | ibus_attribute_get_end_index ()
IBusAttribute * | ibus_attr_underline_new ()
IBusAttribute * | ibus_attr_foreground_new ()
IBusAttribute * | ibus_attr_background_new ()

## Types and Values

enum | IBusAttrType
enum | IBusAttrUnderline
struct | IBusAttribute

## Object Hierarchy

        GEnum
        ├── IBusAttrType
        ╰── 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.

## Functions

### ibus_attribute_new ()

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

Creates a new IBusAttribute.

#### Parameters

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]

### ibus_attribute_get_attr_type ()

    guint
    ibus_attribute_get_attr_type (IBusAttribute *attr);

Gets an enum of IBusAttrType.

#### Parameters

attr | An IBusAttribute |

#### Returns

An enum of IBusAttrType.

### ibus_attribute_get_value ()

    guint
    ibus_attribute_get_value (IBusAttribute *attr);

Gets 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.

#### Parameters

attr | An IBusAttribute |

#### Returns

An unsigned int value relative with IBusAttrType.

### ibus_attribute_get_start_index ()

    guint
    ibus_attribute_get_start_index (IBusAttribute *attr);

Gets a start unsigned index

#### Parameters

attr | An IBusAttribute |

#### Returns

A start unsigned index

### ibus_attribute_get_end_index ()

    guint
    ibus_attribute_get_end_index (IBusAttribute *attr);

Gets an end unsigned index

#### Parameters

attr | An IBusAttribute |

#### Returns

A end unsigned index

### ibus_attr_underline_new ()

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

Creates a new underline IBusAttribute.

#### Parameters

underline_type | Type of underline. |
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);

Creates a new foreground IBusAttribute.

#### Parameters

color | Color in RGB. |
start_index | Where attribute starts. |
end_index | Where attribute ends. |

#### Returns

A newly allocated IBusAttribute.

[transfer none]

### ibus_attr_background_new ()

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

Creates a new background IBusAttribute.

#### Parameters

color | Color in RGB. |
start_index | Where attribute starts. |
end_index | Where attribute ends. |

#### Returns

A newly allocated IBusAttribute.

[transfer none]

## Types and Values

### enum IBusAttrType

Type enumeration of IBusText attribute.

#### Members

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

### enum IBusAttrUnderline

Type of IBusText attribute.

#### Members

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.

#### Members

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

## See Also

IBusText