3
Copyright (c) 2003-2006 uim Project http://uim.freedesktop.org/
7
Redistribution and use in source and binary forms, with or without
8
modification, are permitted provided that the following conditions
11
1. Redistributions of source code must retain the above copyright
12
notice, this list of conditions and the following disclaimer.
13
2. Redistributions in binary form must reproduce the above copyright
14
notice, this list of conditions and the following disclaimer in the
15
documentation and/or other materials provided with the distribution.
16
3. Neither the name of authors nor the names of its contributors
17
may be used to endorse or promote products derived from this software
18
without specific prior written permission.
20
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
21
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
24
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35
#ifndef _uim_custom_h_included_
36
#define _uim_custom_h_included_
54
enum UCustomPathnameType {
55
UCustomPathnameType_RegularFile,
56
UCustomPathnameType_Directory
60
UCustomKey_Regular, /* "<Control>j" */
61
UCustomKey_Reference /* "generic-cancel-key" */
64
enum UCustomKeyEditorType {
65
UCustomKeyEditor_Basic, /* only "<Control>j" style should be available */
66
UCustomKeyEditor_Advanced /* "generic-cancel-key" style should be specifiable */
69
union uim_custom_value {
73
struct uim_custom_pathname *as_pathname;
74
struct uim_custom_choice *as_choice;
75
struct uim_custom_choice **as_olist;
76
struct uim_custom_key **as_key;
79
struct uim_custom_pathname {
81
int type; /* UCustomPathnameType */
84
struct uim_custom_choice {
90
struct uim_custom_key {
91
int type; /* UCustomKeyType */
92
int editor_type; /* UCustomKeyEditorType */
98
union uim_custom_range {
108
struct uim_custom_choice **valid_items;
112
struct uim_custom_choice **valid_items; /* contains all possible items */
117
int type; /* UCustomType */
122
union uim_custom_value *value;
123
union uim_custom_value *default_value;
124
union uim_custom_range *range;
127
struct uim_custom_group {
134
uim_bool uim_custom_enable(void);
137
uim_bool uim_custom_load(void);
138
uim_bool uim_custom_save(void);
139
uim_bool uim_custom_broadcast(void);
140
uim_bool uim_custom_broadcast_reload_request(void);
142
/* custom variable */
143
struct uim_custom *uim_custom_get(const char *custom_sym);
144
uim_bool uim_custom_set(const struct uim_custom *custom);
145
void uim_custom_free(struct uim_custom *custom);
147
/* callback function */
148
uim_bool uim_custom_cb_add(const char *custom_sym, void *ptr,
149
void (*update_cb)(void *ptr, const char *custom_sym));
150
uim_bool uim_custom_cb_remove(const char *custom_sym);
151
uim_bool uim_custom_group_cb_add(const char *group_sym, void *ptr,
152
void (*update_cb)(void *ptr, const char *group_sym));
153
uim_bool uim_custom_group_cb_remove(const char *group_sym);
154
uim_bool uim_custom_global_cb_add(void *ptr,
155
void (*group_list_update_cb)(void *ptr));
156
uim_bool uim_custom_global_cb_remove(void);
159
char *uim_custom_value_as_literal(const char *custom_sym);
160
char *uim_custom_definition_as_literal(const char *custom_sym);
163
struct uim_custom_group *uim_custom_group_get(const char *group_sym);
164
void uim_custom_group_free(struct uim_custom_group *custom_group);
166
/* custom symbol list */
167
char **uim_custom_collect_by_group(const char *group_sym);
168
/* char **uim_custom_collect_by_groups(const char *const *group_syms); */
170
/* group symbol list */
171
char **uim_custom_groups(void);
172
char **uim_custom_primary_groups(void);
173
char **uim_custom_group_subgroups(const char *group_sym);
175
void uim_custom_symbol_list_free(char **symbol_list);
177
/* custom choice (for ordered list) */
178
struct uim_custom_choice *uim_custom_choice_new(char *symbol,
181
void uim_custom_choice_list_free(struct uim_custom_choice **list);
184
struct uim_custom_key *uim_custom_key_new(int type,
189
void uim_custom_key_list_free(struct uim_custom_key **list);
194
#endif /* _uim_custom_h_included_ */