IBusAttribute

IBusAttribute — Attributes of IBusText.

Stability Level

Stable, unless otherwise indicated

Synopsis

#define             IBUS_TYPE_ATTR_LIST
#define             IBUS_ATTR_LIST                      (obj)
#define             IBUS_ATTR_LIST_CLASS                (klass)
#define             IBUS_IS_ATTR_LIST                   (obj)
#define             IBUS_IS_ATTR_LIST_CLASS             (klass)
#define             IBUS_ATTR_LIST_GET_CLASS            (obj)
enum                IBusAttrType;
enum                IBusAttrUnderline;
                    IBusAttribute;
                    IBusAttrList;
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);
GType               ibus_attr_list_get_type             ();
IBusAttrList *      ibus_attr_list_new                  ();
void                ibus_attr_list_append               (IBusAttrList *attr_list,
                                                         IBusAttribute *attr);
IBusAttribute *     ibus_attr_list_get                  (IBusAttrList *attr_list,
                                                         guint index);

Object Hierarchy

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

Description

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

Details

IBUS_TYPE_ATTR_LIST

#define             IBUS_TYPE_ATTR_LIST

Return GType of IBus attribute list.


IBUS_ATTR_LIST()

#define             IBUS_ATTR_LIST(obj)

Casts an IBUS_ATTR_LIST or derived pointer into a (IBusAttrList*) pointer. Depending on the current debugging level, this function may invoke certain runtime checks to identify invalid casts.

obj :

An object which is subject to casting.

IBUS_ATTR_LIST_CLASS()

#define             IBUS_ATTR_LIST_CLASS(klass)

Casts a derived IBusAttrListClass structure into a IBusAttrListClass structure.

klass :

A class to be casted.

IBUS_IS_ATTR_LIST()

#define             IBUS_IS_ATTR_LIST(obj)

Checks whether a valid GTypeInstance pointer is of type IBUS_ATTR_LIST.

obj :

Instance to check for being a IBUS_ATTR_LIST.

IBUS_IS_ATTR_LIST_CLASS()

#define             IBUS_IS_ATTR_LIST_CLASS(klass)

Checks whether class "is a" valid IBusAttrListClass structure of type IBUS_ATTR_LIST or derived.

klass :

A class to be checked.

IBUS_ATTR_LIST_GET_CLASS()

#define             IBUS_ATTR_LIST_GET_CLASS(obj)

Get the class of a given object and cast the class to IBusAttrListClass.

obj :

An object.

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.

IBusAttrList

typedef struct {
    GArray *attributes;
} IBusAttrList;

Array of IBusAttribute.

GArray *attributes;

GArray that holds IBusAttribute.

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.

ibus_attr_list_get_type ()

GType               ibus_attr_list_get_type             ();

Returns GType of IBusAttrList.

Returns :

GType of IBusAttrList.

ibus_attr_list_new ()

IBusAttrList *      ibus_attr_list_new                  ();

New an IBusAttrList.

Returns :

A newly allocated IBusAttrList.

ibus_attr_list_append ()

void                ibus_attr_list_append               (IBusAttrList *attr_list,
                                                         IBusAttribute *attr);

Append an IBusAttribute to IBusAttrList, and increase reference.

attr_list :

An IBusAttrList instance.

attr :

The IBusAttribute instance to be appended.

ibus_attr_list_get ()

IBusAttribute *     ibus_attr_list_get                  (IBusAttrList *attr_list,
                                                         guint index);

Returns IBusAttribute at given index. Borrowed reference.

attr_list :

An IBusAttrList instance.

index :

Index of the attr_list.

Returns :

IBusAttribute at given index, NULL if no such IBusAttribute.

See Also

#IBusText