|
Packit Service |
1d8f1c |
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
|
|
Packit Service |
1d8f1c |
/* vim:set et sts=4: */
|
|
Packit Service |
1d8f1c |
/* IBus - The Input Bus
|
|
Packit Service |
1d8f1c |
* Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
|
|
Packit Service |
1d8f1c |
* Copyright (C) 2008-2013 Red Hat, Inc.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* This library is free software; you can redistribute it and/or
|
|
Packit Service |
1d8f1c |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
1d8f1c |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
1d8f1c |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* This library is distributed in the hope that it will be useful,
|
|
Packit Service |
1d8f1c |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
1d8f1c |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
1d8f1c |
* Lesser General Public License for more details.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
1d8f1c |
* License along with this library; if not, write to the Free Software
|
|
Packit Service |
1d8f1c |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
|
Packit Service |
1d8f1c |
* USA
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
#if !defined (__IBUS_H_INSIDE__) && !defined (IBUS_COMPILATION)
|
|
Packit Service |
1d8f1c |
#error "Only <ibus.h> can be included directly"
|
|
Packit Service |
1d8f1c |
#endif
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
#ifndef __IBUS_TEXT_H_
|
|
Packit Service |
1d8f1c |
#define __IBUS_TEXT_H_
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* SECTION: ibustext
|
|
Packit Service |
1d8f1c |
* @short_description: Text with decorating information.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* An IBusText is the main text object in IBus.
|
|
Packit Service |
1d8f1c |
* The text is decorated according to associated IBusAttribute,
|
|
Packit Service |
1d8f1c |
* e.g. the foreground/background color, underline, and
|
|
Packit Service |
1d8f1c |
* applied scope.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* see_also: #IBusAttribute
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
#include "ibusserializable.h"
|
|
Packit Service |
1d8f1c |
#include "ibusattrlist.h"
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/*
|
|
Packit Service |
1d8f1c |
* Type macros.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
/* define IBusText macros */
|
|
Packit Service |
1d8f1c |
#define IBUS_TYPE_TEXT \
|
|
Packit Service |
1d8f1c |
(ibus_text_get_type ())
|
|
Packit Service |
1d8f1c |
#define IBUS_TEXT(obj) \
|
|
Packit Service |
1d8f1c |
(G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_TEXT, IBusText))
|
|
Packit Service |
1d8f1c |
#define IBUS_TEXT_CLASS(klass) \
|
|
Packit Service |
1d8f1c |
(G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_TEXT, IBusTextClass))
|
|
Packit Service |
1d8f1c |
#define IBUS_IS_TEXT(obj) \
|
|
Packit Service |
1d8f1c |
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_TEXT))
|
|
Packit Service |
1d8f1c |
#define IBUS_IS_TEXT_CLASS(klass) \
|
|
Packit Service |
1d8f1c |
(G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_TEXT))
|
|
Packit Service |
1d8f1c |
#define IBUS_TEXT_GET_CLASS(obj) \
|
|
Packit Service |
1d8f1c |
(G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_TEXT, IBusTextClass))
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
G_BEGIN_DECLS
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
typedef struct _IBusText IBusText;
|
|
Packit Service |
1d8f1c |
typedef struct _IBusTextClass IBusTextClass;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* IBusText:
|
|
Packit Service |
1d8f1c |
* @is_static: Whether @text is static, i.e., no need and will not be freed. Only TRUE if IBusText is newed from ibus_text_new_from_static_string().
|
|
Packit Service |
1d8f1c |
* @text: The string content of IBusText in UTF-8.
|
|
Packit Service |
1d8f1c |
* @attrs: Associated IBusAttributes.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* A text object in IBus.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
struct _IBusText {
|
|
Packit Service |
1d8f1c |
IBusSerializable parent;
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/* members */
|
|
Packit Service |
1d8f1c |
/*< public >*/
|
|
Packit Service |
1d8f1c |
gboolean is_static;
|
|
Packit Service |
1d8f1c |
gchar *text;
|
|
Packit Service |
1d8f1c |
IBusAttrList *attrs;
|
|
Packit Service |
1d8f1c |
};
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
struct _IBusTextClass {
|
|
Packit Service |
1d8f1c |
IBusSerializableClass parent;
|
|
Packit Service |
1d8f1c |
};
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
GType ibus_text_get_type (void);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* ibus_text_new_from_string:
|
|
Packit Service |
1d8f1c |
* @str: An text string to be set.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Creates a new #IBusText from a string.
|
|
Packit Service |
1d8f1c |
* @str will be duplicated in #IBusText, so feel free to free @str after this
|
|
Packit Service |
1d8f1c |
* function.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Returns: A newly allocated #IBusText.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
IBusText *ibus_text_new_from_string (const gchar *str);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* ibus_text_new_from_ucs4:
|
|
Packit Service |
1d8f1c |
* @str: An text string to be set.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Creates a new #IBusText from an UCS-4 encoded string.
|
|
Packit Service |
1d8f1c |
* @str will be duplicated in IBusText, so feel free to free @str after this
|
|
Packit Service |
1d8f1c |
* function.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Returns: A newly allocated #IBusText.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
IBusText *ibus_text_new_from_ucs4 (const gunichar *str);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* ibus_text_new_from_static_string: (skip)
|
|
Packit Service |
1d8f1c |
* @str: An text string to be set.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Creates a new #IBusText from a static string.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Since @str is a static string which won't be freed.
|
|
Packit Service |
1d8f1c |
* This function will NOT duplicate @str.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Returns: A newly allocated #IBusText.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
IBusText *ibus_text_new_from_static_string (const gchar *str);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* ibus_text_new_from_printf:
|
|
Packit Service |
1d8f1c |
* @fmt: printf format string.
|
|
Packit Service |
1d8f1c |
* @...: arguments for @fmt.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Creates a new #IBusText from a printf expression.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* The result of printf expression is stored in the new IBusText instance.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Returns: A newly allocated #IBusText.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
IBusText *ibus_text_new_from_printf (const gchar *fmt,
|
|
Packit Service |
1d8f1c |
...) G_GNUC_PRINTF (1, 2);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* ibus_text_new_from_unichar:
|
|
Packit Service |
1d8f1c |
* @c: A single UCS4-encoded character.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Creates a new #IBusText from a single UCS4-encoded character.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Returns: A newly allocated #IBusText.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
IBusText *ibus_text_new_from_unichar (gunichar c);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* ibus_text_append_attribute:
|
|
Packit Service |
1d8f1c |
* @text: an IBusText
|
|
Packit Service |
1d8f1c |
* @type: IBusAttributeType for @text.
|
|
Packit Service |
1d8f1c |
* @value: Value for the type.
|
|
Packit Service |
1d8f1c |
* @start_index: The starting index, inclusive.
|
|
Packit Service |
1d8f1c |
* @end_index: The ending index, exclusive.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Append an IBusAttribute for IBusText.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
void ibus_text_append_attribute (IBusText *text,
|
|
Packit Service |
1d8f1c |
guint type,
|
|
Packit Service |
1d8f1c |
guint value,
|
|
Packit Service |
1d8f1c |
guint start_index,
|
|
Packit Service |
1d8f1c |
gint end_index);
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* ibus_text_get_length:
|
|
Packit Service |
1d8f1c |
* @text: An #IBusText.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Return number of characters in an #IBusText.
|
|
Packit Service |
1d8f1c |
* This function is based on g_utf8_strlen(), so unlike strlen(),
|
|
Packit Service |
1d8f1c |
* it does not count by bytes but characters instead.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Returns: Number of character in @text, not counted by bytes.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
guint ibus_text_get_length (IBusText *text);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* ibus_text_get_is_static: (skip)
|
|
Packit Service |
1d8f1c |
* @text: An #IBusText.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Return the is_static in an #IBusText.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Returns: the is_static in @text.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
gboolean ibus_text_get_is_static (IBusText *text);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* ibus_text_get_text:
|
|
Packit Service |
1d8f1c |
* @text: An #IBusText.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Return the text in an #IBusText. Should not be freed.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Returns: the text in @text.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
const gchar * ibus_text_get_text (IBusText *text);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* ibus_text_get_attributes:
|
|
Packit Service |
1d8f1c |
* @text: An #IBusText.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Return the attributes in an #IBusText. Should not be freed.
|
|
Packit Service |
1d8f1c |
*
|
|
Packit Service |
1d8f1c |
* Returns: (transfer none): the attrs in @text.
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
IBusAttrList * ibus_text_get_attributes (IBusText *text);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
/**
|
|
Packit Service |
1d8f1c |
* ibus_text_set_attributes:
|
|
Packit Service |
1d8f1c |
* @text: An IBusText.
|
|
Packit Service |
1d8f1c |
* @attrs: An IBusAttrList
|
|
Packit Service |
1d8f1c |
*/
|
|
Packit Service |
1d8f1c |
void ibus_text_set_attributes (IBusText *text,
|
|
Packit Service |
1d8f1c |
IBusAttrList *attrs);
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
|
|
Packit Service |
1d8f1c |
G_END_DECLS
|
|
Packit Service |
1d8f1c |
#endif
|
|
Packit Service |
1d8f1c |
|