xref: /trunk/main/vcl/inc/unx/XIM.h (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org 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.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 #ifndef _XIM_h
28 #define _XIM_h
29 
30 #include <X11/Xlib.h>
31 #include <X11/Xresource.h>
32 
33 #ifdef __cplusplus
34 extern "C"
35 #endif
36 XIM XvaOpenIM( Display*, XrmDatabase, char*, char*, ... );
37 
38 extern Status XCloseIM(XIM);
39 
40 #ifndef XIMCallback1
41 typedef int (*XIMProc1)(XIC, XPointer, XPointer);
42 typedef struct {
43   XPointer client_data;
44   XIMProc1 callback;
45 } XIMCallback1;
46 #endif
47 
48 typedef struct _XIMAnnotation {
49   int start_position;
50   int end_position;
51   XPointer data;
52 } XIMAnnotation;
53 
54 /*
55   XIMUText: XIMText extention for UTF16
56  */
57 typedef struct _XIMUnicodeText {
58   unsigned short length;
59   XIMFeedback *feedback;
60   Bool encoding_is_wchar;
61   union {
62     char *multi_byte;
63     wchar_t *wide_char;
64     unsigned short *utf16_char;
65   } string;
66   unsigned int   count_annotations;
67   XIMAnnotation	 *annotations;
68 } XIMUnicodeText;
69 
70 /* lookup choice */
71 typedef enum {
72   XIMDrawUpHorizontally = 0 ,
73   XIMDrawUpVertically = 1
74 } XIMDrawUpDirection ;
75 
76 typedef struct _XIMLookupStartCallbackStruct {
77   int		choice_per_window;  /* Number of choices can be display
78 				     * in the region
79 				     */
80   int		nrows;
81   int		ncolumns;
82   XIMDrawUpDirection draw_up_direction;
83 } XIMLookupStartCallbackStruct;
84 
85 typedef struct _XIMUnicodeChoiceObject {
86   XIMUnicodeText *label;
87   XIMUnicodeText *value;
88 } XIMUnicodeChoiceObject;
89 
90 typedef struct _XIMLookupDrawCallbackStruct {
91   XIMUnicodeChoiceObject *choices;       /* the lookup choices */
92   int              n_choices;      /* Total number of lookup choices */
93   int              first_index;
94   int              last_index;
95   int              current_index;
96   XIMUnicodeText   *title;
97 } XIMLookupDrawCallbackStruct;
98 
99 /* Unicode Subset */
100 typedef enum {
101   XIMKatakana, XIMHanzi
102 } XIMUnicodeCharacterSubsetID;
103 
104 typedef	struct	_XIMUncodeSubset {
105   XIMUnicodeCharacterSubsetID	index;
106   XIMUnicodeCharacterSubsetID	subset_id;
107   char			*name;
108   Bool			is_active;
109 } XIMUnicodeCharacterSubset;
110 
111 typedef	struct	_XIMUncodeSubsets {
112   unsigned short count_subsets;
113   XIMUnicodeCharacterSubset *supported_subsets;
114 } XIMUnicodeCharacterSubsets;
115 
116 typedef	struct	_XIMSwitchIMNotifyCallbackStruct {
117   XIMUnicodeCharacterSubset *from;
118   XIMUnicodeCharacterSubset *to;
119 } XIMSwitchIMNotifyCallbackStruct;
120 
121 /* XIM attributes for multilingual IM extension */
122 #define XNMultiLingualInput "multiLingualInput"
123 #define XNQueryUnicodeCharacterSubset "unicodeCharacterSubset"
124 
125 /* XIC attributes for multilingual IM extension */
126 
127 #define XNUnicodeCharacterSubset "UnicodeChararcterSubset"
128 
129 #define XNSwitchIMNotifyCallback "switchIMNotifyCallback"
130 #define XNCommitStringCallback "commitStringCallback"
131 #define XNForwardEventCallback "forwardEventCallback"
132 
133 #define XNLookupStartCallback "lookupStartCallback"
134 #define XNLookupDrawCallback "lookupDrawCallback"
135 #define XNLookupDoneCallback "lookupDoneCallback"
136 
137 #endif
138