|
Packit |
3ff832 |
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
|
Packit |
3ff832 |
/* vim:set et sts=4: */
|
|
Packit |
3ff832 |
/* IBus - The Input Bus
|
|
Packit |
3ff832 |
* Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
|
|
Packit |
3ff832 |
* Copyright (C) 2008-2013 Red Hat, Inc.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
3ff832 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
3ff832 |
* License as published by the Free Software Foundation; either
|
|
Packit |
3ff832 |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
3ff832 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
3ff832 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
3ff832 |
* Lesser General Public License for more details.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
3ff832 |
* License along with this library; if not, write to the Free Software
|
|
Packit |
3ff832 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
|
Packit |
3ff832 |
* USA
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
#if !defined (__IBUS_H_INSIDE__) && !defined (IBUS_COMPILATION)
|
|
Packit |
3ff832 |
#error "Only <ibus.h> can be included directly"
|
|
Packit |
3ff832 |
#endif
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
#ifndef __IBUS_ATTRIBUTE_H_
|
|
Packit |
3ff832 |
#define __IBUS_ATTRIBUTE_H_
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* SECTION: ibusattribute
|
|
Packit |
3ff832 |
* @short_description: Attributes of IBusText.
|
|
Packit |
3ff832 |
* @see_also: #IBusText
|
|
Packit |
3ff832 |
* @stability: Stable
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* An IBusAttribute represents an attribute that associate to IBusText.
|
|
Packit |
3ff832 |
* It decorates preedit buffer and auxiliary text with underline, foreground
|
|
Packit |
3ff832 |
* and background colors.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
#include "ibusserializable.h"
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
G_BEGIN_DECLS
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/*
|
|
Packit |
3ff832 |
* Type macros.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
/* define IBusAttribute macros */
|
|
Packit |
3ff832 |
#define IBUS_TYPE_ATTRIBUTE \
|
|
Packit |
3ff832 |
(ibus_attribute_get_type ())
|
|
Packit |
3ff832 |
#define IBUS_ATTRIBUTE(obj) \
|
|
Packit |
3ff832 |
(G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_ATTRIBUTE, IBusAttribute))
|
|
Packit |
3ff832 |
#define IBUS_ATTRIBUTE_CLASS(klass) \
|
|
Packit |
3ff832 |
(G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_ATTRIBUTE, IBusAttributeClass))
|
|
Packit |
3ff832 |
#define IBUS_IS_ATTRIBUTE(obj) \
|
|
Packit |
3ff832 |
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_ATTRIBUTE))
|
|
Packit |
3ff832 |
#define IBUS_IS_ATTRIBUTE_CLASS(klass) \
|
|
Packit |
3ff832 |
(G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_ATTRIBUTE))
|
|
Packit |
3ff832 |
#define IBUS_ATTRIBUTE_GET_CLASS(obj) \
|
|
Packit |
3ff832 |
(G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_ATTRIBUTE, IBusAttributeClass))
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* IBusAttrType:
|
|
Packit |
3ff832 |
* @IBUS_ATTR_TYPE_UNDERLINE: Decorate with underline.
|
|
Packit |
3ff832 |
* @IBUS_ATTR_TYPE_FOREGROUND: Foreground color.
|
|
Packit |
3ff832 |
* @IBUS_ATTR_TYPE_BACKGROUND: Background color.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Type enumeration of IBusText attribute.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
typedef enum {
|
|
Packit |
3ff832 |
IBUS_ATTR_TYPE_UNDERLINE = 1,
|
|
Packit |
3ff832 |
IBUS_ATTR_TYPE_FOREGROUND = 2,
|
|
Packit |
3ff832 |
IBUS_ATTR_TYPE_BACKGROUND = 3,
|
|
Packit |
3ff832 |
} IBusAttrType;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* IBusAttrUnderline:
|
|
Packit |
3ff832 |
* @IBUS_ATTR_UNDERLINE_NONE: No underline.
|
|
Packit |
3ff832 |
* @IBUS_ATTR_UNDERLINE_SINGLE: Single underline.
|
|
Packit |
3ff832 |
* @IBUS_ATTR_UNDERLINE_DOUBLE: Double underline.
|
|
Packit |
3ff832 |
* @IBUS_ATTR_UNDERLINE_LOW: Low underline ? FIXME
|
|
Packit |
3ff832 |
* @IBUS_ATTR_UNDERLINE_ERROR: Error underline
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Type of IBusText attribute.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
typedef enum {
|
|
Packit |
3ff832 |
IBUS_ATTR_UNDERLINE_NONE = 0,
|
|
Packit |
3ff832 |
IBUS_ATTR_UNDERLINE_SINGLE = 1,
|
|
Packit |
3ff832 |
IBUS_ATTR_UNDERLINE_DOUBLE = 2,
|
|
Packit |
3ff832 |
IBUS_ATTR_UNDERLINE_LOW = 3,
|
|
Packit |
3ff832 |
IBUS_ATTR_UNDERLINE_ERROR = 4,
|
|
Packit |
3ff832 |
} IBusAttrUnderline;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
typedef struct _IBusAttribute IBusAttribute;
|
|
Packit |
3ff832 |
typedef struct _IBusAttributeClass IBusAttributeClass;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* IBusAttribute:
|
|
Packit |
3ff832 |
* @type: IBusAttributeType
|
|
Packit |
3ff832 |
* @value: Value for the type.
|
|
Packit |
3ff832 |
* @start_index: The starting index, inclusive.
|
|
Packit |
3ff832 |
* @end_index: The ending index, exclusive.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Signify the type, value and scope of the attribute.
|
|
Packit |
3ff832 |
* The scope starts from @start_index till the @end_index-1.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
struct _IBusAttribute {
|
|
Packit |
3ff832 |
IBusSerializable parent;
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/*< public >*/
|
|
Packit |
3ff832 |
guint type;
|
|
Packit |
3ff832 |
guint value;
|
|
Packit |
3ff832 |
guint start_index;
|
|
Packit |
3ff832 |
guint end_index;
|
|
Packit |
3ff832 |
};
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
struct _IBusAttributeClass {
|
|
Packit |
3ff832 |
IBusSerializableClass parent;
|
|
Packit |
3ff832 |
};
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* ibus_attribute_get_type:
|
|
Packit |
3ff832 |
* @returns: GType of IBusAttribute.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Returns GType of IBusAttribute.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
GType ibus_attribute_get_type ();
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* ibus_attribute_new:
|
|
Packit |
3ff832 |
* @type: Type of the attribute.
|
|
Packit |
3ff832 |
* @value: Value of the attribute.
|
|
Packit |
3ff832 |
* @start_index: Where attribute starts.
|
|
Packit |
3ff832 |
* @end_index: Where attribute ends.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Creates a new IBusAttribute.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Returns: (transfer none): A newly allocated IBusAttribute.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
IBusAttribute *ibus_attribute_new (guint type,
|
|
Packit |
3ff832 |
guint value,
|
|
Packit |
3ff832 |
guint start_index,
|
|
Packit |
3ff832 |
guint end_index);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* ibus_attribute_get_attr_type:
|
|
Packit |
3ff832 |
* @attr: An #IBusAttribute
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Gets an enum of #IBusAttrType.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Returns: An enum of #IBusAttrType.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
guint ibus_attribute_get_attr_type
|
|
Packit |
3ff832 |
(IBusAttribute *attr);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* ibus_attribute_get_value:
|
|
Packit |
3ff832 |
* @attr: An #IBusAttribute
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Gets an unsigned int value relative with #IBusAttrType.
|
|
Packit |
3ff832 |
* If the type is %IBUS_ATTR_TYPE_UNDERLINE, the return value is
|
|
Packit |
3ff832 |
* #IBusAttrUnderline. If the type is %IBUS_ATTR_TYPE_FOREGROUND,
|
|
Packit |
3ff832 |
* the return value is the color RGB.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Returns: An unsigned int value relative with #IBusAttrType.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
guint ibus_attribute_get_value (IBusAttribute *attr);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* ibus_attribute_get_start_index:
|
|
Packit |
3ff832 |
* @attr: An #IBusAttribute
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Gets a start unsigned index
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Returns: A start unsigned index
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
guint ibus_attribute_get_start_index
|
|
Packit |
3ff832 |
(IBusAttribute *attr);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* ibus_attribute_get_end_index:
|
|
Packit |
3ff832 |
* @attr: An #IBusAttribute
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Gets an end unsigned index
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Returns: A end unsigned index
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
guint ibus_attribute_get_end_index
|
|
Packit |
3ff832 |
(IBusAttribute *attr);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* ibus_attr_underline_new:
|
|
Packit |
3ff832 |
* @underline_type: Type of underline.
|
|
Packit |
3ff832 |
* @start_index: Where attribute starts.
|
|
Packit |
3ff832 |
* @end_index: Where attribute ends.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Creates a new underline #IBusAttribute.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Returns: (transfer none): A newly allocated #IBusAttribute.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
IBusAttribute *ibus_attr_underline_new (guint underline_type,
|
|
Packit |
3ff832 |
guint start_index,
|
|
Packit |
3ff832 |
guint end_index);
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* ibus_attr_foreground_new:
|
|
Packit |
3ff832 |
* @color: Color in RGB.
|
|
Packit |
3ff832 |
* @start_index: Where attribute starts.
|
|
Packit |
3ff832 |
* @end_index: Where attribute ends.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Creates a new foreground #IBusAttribute.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Returns: (transfer none): A newly allocated #IBusAttribute.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
IBusAttribute *ibus_attr_foreground_new (guint color,
|
|
Packit |
3ff832 |
guint start_index,
|
|
Packit |
3ff832 |
guint end_index);
|
|
Packit |
3ff832 |
/**
|
|
Packit |
3ff832 |
* ibus_attr_background_new:
|
|
Packit |
3ff832 |
* @color: Color in RGB.
|
|
Packit |
3ff832 |
* @start_index: Where attribute starts.
|
|
Packit |
3ff832 |
* @end_index: Where attribute ends.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Creates a new background #IBusAttribute.
|
|
Packit |
3ff832 |
*
|
|
Packit |
3ff832 |
* Returns: (transfer none): A newly allocated #IBusAttribute.
|
|
Packit |
3ff832 |
*/
|
|
Packit |
3ff832 |
IBusAttribute *ibus_attr_background_new (guint color,
|
|
Packit |
3ff832 |
guint start_index,
|
|
Packit |
3ff832 |
guint end_index);
|
|
Packit |
3ff832 |
|
|
Packit |
3ff832 |
G_END_DECLS
|
|
Packit |
3ff832 |
#endif
|
|
Packit |
3ff832 |
|