IBusAttribute

## IBusAttribute IBusAttribute — Attributes of IBusText. |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    enum                IBusAttrType;
    enum                IBusAttrUnderline;
                        IBusAttribute;
                        IBusAttributeClass;
    IBusAttribute *     ibus_attribute_new                  (guint type,
                                                             guint value,
                                                             guint start_index,
                                                             guint end_index);
    IBusAttribute *     ibus_attr_underline_new             (guint underline_type,
                                                             guint start_index,
                                                             guint end_index);
    IBusAttribute *     ibus_attr_foreground_new            (guint color,
                                                             guint start_index,
                                                             guint end_index);
    IBusAttribute *     ibus_attr_background_new            (guint color,
                                                             guint start_index,
                                                             guint end_index);

## Object Hierarchy

      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

### IBusAttribute

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

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.

### IBusAttributeClass

    typedef struct {
        IBusSerializableClass parent;
    } IBusAttributeClass;

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

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

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

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

## See Also

IBusText