4
* Copyright (c) 2006 Ryo Dairiki <ryo-dairiki@users.sourceforge.net>
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation and
10
* appearing in the file LICENSE.LGPL included in the package of this file.
11
* You can also redistribute it and/or modify it under the terms of
12
* the GNU General Public License as published by the Free Software Foundation and
13
* appearing in the file LICENSE.GPL included in the package of this file.
15
* This library is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22
* @author Ryo Dairiki <ryo-dairiki@users.sourceforge.net>
23
* @brief This header describes about attributes.
25
* Attributes are used to give the clients some hints how the preedit strings should be shown.\n
26
* They are used to highlight the current segment in the convertion mode,
27
* or to underline the newly-input-strings.
30
#ifndef SCIMBRIDGEATTRIBUTE_H_
31
#define SCIMBRIDGEATTRIBUTE_H_
33
#include "scim-bridge.h"
35
enum _scim_bridge_attribute_type_t
44
* This is enumeration type for the type of attributes.
46
typedef enum _scim_bridge_attribute_type_t scim_bridge_attribute_type_t;
49
* This is type for the value or the color of attributes.
51
typedef unsigned int scim_bridge_attribute_value_t;
54
* This is the type of attribute.
56
typedef struct _ScimBridgeAttribute ScimBridgeAttribute;
59
* The attribute type, which means that the attribute is invalid.
61
static const scim_bridge_attribute_value_t SCIM_BRIDGE_ATTRIBUTE_DECORATE_NONE = 0x1000000;
64
* The attribute type, which means that the attribute provides an underline.
66
static const scim_bridge_attribute_value_t SCIM_BRIDGE_ATTRIBUTE_DECORATE_UNDERLINE = 0x2000000;
69
* The attribute type, which means that the attribute provides an highlight.
71
static const scim_bridge_attribute_value_t SCIM_BRIDGE_ATTRIBUTE_DECORATE_HIGHLIGHT = 0x4000000;
74
* The attribute type, which means that the attribute provides an reversed highlight.
76
static const scim_bridge_attribute_value_t SCIM_BRIDGE_ATTRIBUTE_DECORATE_REVERSE = 0x8000000;
84
* Allocate an attribute.
86
* @return a new attribute.
88
ScimBridgeAttribute *scim_bridge_alloc_attribute ();
93
* @param attribute The attribute to free.
94
* @note Do not use free (). It will cause memleaks.
96
void scim_bridge_free_attribute (ScimBridgeAttribute *attribute);
99
* Copy an attribute into another.
101
* @param src The attribute to duplicate.
102
* @param dst The destination to copy in.
104
void scim_bridge_copy_attribute (ScimBridgeAttribute *dst, const ScimBridgeAttribute *src);
107
* See if one attribute equals the other.
109
* @param atr1 The attribute.
110
* @param atr2 Another attribute.
111
* @return true if the two attributes are the same.
113
boolean scim_bridge_attribute_equals (const ScimBridgeAttribute *atr1, const ScimBridgeAttribute *atr2);
116
* Get the type of an attribute.
118
* @param attribute The attribute.
119
* @return The type of the attribute.
121
scim_bridge_attribute_type_t scim_bridge_attribute_get_type (const ScimBridgeAttribute *attribute);
124
* Set the type of an attribute.
126
* @param attribute The attribute.
128
void scim_bridge_attribute_set_type (ScimBridgeAttribute *attribute, scim_bridge_attribute_type_t type);
131
* Get the begining index of the attribute.
133
* @param attribute The attribute.
134
* @return The index of the first wide-character to apply this attribute.
136
size_t scim_bridge_attribute_get_begin (const ScimBridgeAttribute *attribute);
139
* Set the begining index of the attribute.
141
* @param attribute The attribute.
142
* @param begin The index of the first wide-character to apply this attribute.
144
void scim_bridge_attribute_set_begin (ScimBridgeAttribute *attribute, size_t begin);
147
* Get the ending index of the attribute.
149
* @param attribute The attribute.
150
* @return The index of the end wide-character to apply this attribute.
152
size_t scim_bridge_attribute_get_end (const ScimBridgeAttribute *attribute);
155
* Set the ending index of the attribute.
157
* @param attribute The attribute.
158
* @param end The index of the end wide-character to apply this attribute.
160
void scim_bridge_attribute_set_end (ScimBridgeAttribute *attribute, size_t end);
163
* Get the type of the attribute.
165
* @param attribute The attribute.
166
* @return The type of the attribute.
168
scim_bridge_attribute_type_t scim_bridge_attribute_get_type (const ScimBridgeAttribute *attribute);
171
* Set the type of the attribute.
173
* @param attribute The attribute.
174
* @param type The type of the attribute.
176
void scim_bridge_attribute_set_type (ScimBridgeAttribute *attribute, scim_bridge_attribute_type_t type);
179
* Get the value of the attribute.\n
180
* Notice, the value stands for RGB color from 0x000000 to 0xFFFFFF\n
181
* if the attribute type is ATTRIBUTE_FOREGROUND or ATTRIBUTE_BACKGROUND.
183
* @param attribute The attribute.
184
* @return The value of the attribute.
186
scim_bridge_attribute_value_t scim_bridge_attribute_get_value (const ScimBridgeAttribute *attribute);
189
* Set the value of the attribute.\n
190
* Notice, the value stands for RGB color from 0x000000 to 0xFFFFFF\n
191
* if the attribute type is ATTRIBUTE_FOREGROUND or ATTRIBUTE_BACKGROUND.
193
* @param attribute The attribute.
194
* @param value The value of the attribute.
196
void scim_bridge_attribute_set_value (ScimBridgeAttribute *attribute, scim_bridge_attribute_value_t value);
199
* Set the color of the attribute.\n
200
* The color value will be ignored
201
* when the attribute type is not ATTRIBUTE_FOREGROUND nor ATTRIBUTE_BACKGROUND.
203
* @param attribute The attribute.
204
* @param red The red value, from 0x0 to 0xFF.
205
* @param green The green value, from 0x0 to 0xFF.
206
* @param blue The blue value, from 0x0 to 0xFF.
208
void scim_bridge_attribute_set_color (ScimBridgeAttribute *attribute, unsigned int red, unsigned int green, unsigned int blue);
211
* Get the red value of the attribute.\n
212
* The color value has no meanings
213
* when the attribute type is not ATTRIBUTE_FOREGROUND nor ATTRIBUTE_BACKGROUND.
215
* @param attribute The attribute.
216
* @return The red value, from 0x0 to 0xFF.
218
unsigned int scim_bridge_attribute_get_red (const ScimBridgeAttribute *attribute);
221
* Set the red value of the attribute.\n
222
* The color value has no meanings
223
* when the attribute type is not ATTRIBUTE_FOREGROUND nor ATTRIBUTE_BACKGROUND.
225
* @param attribute The attribute.
226
* @param red The red value, from 0x0 to 0xFF.
228
void scim_bridge_attribute_set_red (ScimBridgeAttribute *attribute, unsigned int red);
231
* Get the green value of the attribute.\n
232
* The color value has no meanings
233
* when the attribute type is not ATTRIBUTE_FOREGROUND nor ATTRIBUTE_BACKGROUND.
235
* @param attribute The attribute.
236
* @return The green value, from 0x0 to 0xFF.
238
unsigned int scim_bridge_attribute_get_green (const ScimBridgeAttribute *attribute);
241
* Set the green value of the attribute.\n
242
* The color value has no meanings
243
* when the attribute type is not ATTRIBUTE_FOREGROUND nor ATTRIBUTE_BACKGROUND.
245
* @param attribute The attribute.
246
* @param green The green value, from 0x0 to 0xFF.
248
void scim_bridge_attribute_set_green (ScimBridgeAttribute *attribute, unsigned int green);
251
* Get the blue value of the attribute.\n
252
* The color value has no meanings
253
* when the attribute type is not ATTRIBUTE_FOREGROUND nor ATTRIBUTE_BACKGROUND.
255
* @param attribute The attribute.
256
* @return The blue value, from 0x0 to 0xFF.
258
unsigned int scim_bridge_attribute_get_blue (const ScimBridgeAttribute *attribute);
261
* Set the blue value of the attribute.\n
262
* The color value has no meanings
263
* when the attribute type is not ATTRIBUTE_FOREGROUND nor ATTRIBUTE_BACKGROUND.
265
* @param attribute The attribute.
266
* @param blue The blue value, from 0x0 to 0xFF.
268
void scim_bridge_attribute_set_blue (ScimBridgeAttribute *attribute, unsigned int blue);
273
#endif /*SCIMBRIDGEATTRIBUTE_H_*/