Back to index

im-sdk  12.3.91
guiIM.h
Go to the documentation of this file.
00001 /*
00002 Copyright 1990-2001 Sun Microsystems, Inc. All Rights Reserved.
00003 
00004 Permission is hereby granted, free of charge, to any person obtaining a
00005 copy of this software and associated documentation files (the
00006 "Software"), to deal in the Software without restriction, including
00007 without limitation the rights to use, copy, modify, merge, publish,
00008 distribute, sublicense, and/or sell copies of the Software, and to
00009 permit persons to whom the Software is furnished to do so, subject to
00010 the following conditions: The above copyright notice and this
00011 permission notice shall be included in all copies or substantial
00012 portions of the Software.
00013 
00014 
00015 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00016 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
00017 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
00018 IN NO EVENT SHALL THE OPEN GROUP OR SUN MICROSYSTEMS, INC. BE LIABLE
00019 FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
00020 CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
00021 THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE EVEN IF
00022 ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES.
00023 
00024 
00025 Except as contained in this notice, the names of The Open Group and/or
00026 Sun Microsystems, Inc. shall not be used in advertising or otherwise to
00027 promote the sale, use or other dealings in this Software without prior
00028 written authorization from The Open Group and/or Sun Microsystems,
00029 Inc., as applicable.
00030 
00031 
00032 X Window System is a trademark of The Open Group
00033 
00034 OSF/1, OSF/Motif and Motif are registered trademarks, and OSF, the OSF
00035 logo, LBX, X Window System, and Xinerama are trademarks of the Open
00036 Group. All other trademarks and registered trademarks mentioned herein
00037 are the property of their respective owners. No right, title or
00038 interest in or to any trademark, service mark, logo or trade name of
00039 Sun Microsystems, Inc. or its licensors is granted.
00040 
00041 */
00042 
00043 /*
00044  * $Id: guiIM.h,v 1.3 2004/01/28 21:42:43 tajima Exp $
00045  */
00046 
00047 #ifndef _guiIM_H
00048 #define _guiIM_H
00049 
00050 #include "commonIM.h"
00051 #include "xiiimp.h"
00052 #include <X11/X.h>
00053 #include <X11/Xlib.h>
00054 
00055 typedef struct _CacheRec {
00056   int         win_x;
00057   int         win_y;
00058   int         win_width;
00059   int         win_height;
00060   XFontSet    font_set;
00061   unsigned long   foreground;
00062   unsigned long   background;
00063 } CacheRec;
00064 
00065 typedef enum {
00066   STATUS_CREATE = 0,        /* allocate IMstatus data */
00067   STATUS_WIN = 1,           /* create IMstatus window */
00068   STATUS_FG = 2,            /* set IMstatus foreground color */
00069   STATUS_BG = 3,            /* set IMstatus background color */
00070   STATUS_FONT = 4,          /* set IMstatus fontset */
00071   STATUS_START = 5,         /* start IMstatus */
00072   STATUS_DRAW = 6,          /* draw IMstatus */
00073   STATUS_DONE = 7,          /* done IMstatus */
00074   STATUS_DESTROY = 8,              /* destroy IMstatus data */
00075   STATUS_HIDE = 9           /* hide status window */
00076 } StatusAttr;
00077 
00078 typedef enum {
00079   PREEDIT_CREATE = 0,              /* allocate IMpreedit data */
00080   PREEDIT_WIN = 1,          /* create IMPreedit window */
00081   PREEDIT_FG = 2,           /* set IMpreedit foreground color */
00082   PREEDIT_BG = 3,           /* set IMpreedit background color */
00083   PREEDIT_FONT = 4,         /* set IMpreedit fontset */
00084   PREEDIT_MOVE = 5,         /* move IMpreedit window */
00085   PREEDIT_START = 6,        /* start IMpreedit */
00086   PREEDIT_DRAW = 7,         /* draw IMpreedit */
00087   PREEDIT_CARET = 8,        /* set caret of IMpreedit */
00088   PREEDIT_DONE= 9,          /* done IMpreedit */
00089   PREEDIT_DESTROY = 10             /* destroy IMpreedit data */
00090 } PreeditAttr;
00091 
00092 typedef enum {
00093   LOOKUP_CREATE = 0,        /* allocate IMlookup data */
00094   LOOKUP_START = 1,         /* start IMlookup */
00095   LOOKUP_DRAW = 2,          /* draw IMlookup*/
00096   LOOKUP_PROCESS = 3,              /* process IMlookup */
00097   LOOKUP_DONE = 4,          /* done IMlookup */
00098   LOOKUP_MOVE = 5,          /* move IMlookup window */
00099   LOOKUP_DESTROY = 6,              /* destroy IMlookup data */
00100   LOOKUP_SETFOCUS = 7              /* setfocus for lookup window */
00101 } LookupAttr;
00102 
00103 typedef void (*ChangeStatusProc)(XIC, StatusAttr, XPointer);
00104 typedef void (*ChangePreeditProc)(XIC, PreeditAttr, XPointer);
00105 typedef void (*ChangeLookupProc)(XIC, LookupAttr, XPointer);
00106 typedef void (*RegisterForwardEventProc)(XIC, Bool(*)(XIC, XEvent*));
00107 
00108 typedef struct _PreeditWinRec *PreeditWin;
00109 typedef struct _StatusWinRec  *StatusWin;
00110 typedef struct _LookupWinRec  *LookupWin;
00111 
00112 typedef struct _XICGUIRec {
00113   ChangeStatusProc   change_status;
00114   ChangePreeditProc  change_preedit;
00115   ChangeLookupProc   change_lookup;
00116   PreeditWin preedit;
00117   StatusWin  status;
00118   LookupWin  lookup;
00119   int         screen_number;       /* screen number of IC */
00120   void               *dl_icpart;   /* for dl gui object */
00121 } XICGUIRec;
00122 
00123 #define DEFAULT_FONT_NAME   "-*-*-medium-r-normal--*-*-*-*-c-*-*-*"
00124 #define DEFAULT_FONT_NAME_CDE      "-dt-interface user-*-*-14-*-*"
00125 #define MAX_STATUS_CHARNUM 20
00126 #define MAX_PREEDIT_CHARNUM 20
00127 
00128 typedef struct {
00129   int type;
00130   Bool (*filter)(Display*, Window, XEvent*, XPointer);
00131   XPointer client_data;
00132 } XIMFilterRec, *XIMFilter;
00133 
00134 /* Public functions for rendering preedit/status/lookup */
00135 
00136 extern XICGUI CreateGUI(XicCommon ic, XIMArg *arg);
00137 extern void DestroyGUI(XicCommon);
00138 extern void SetScreenNumber(XicCommon ic);
00139 
00140 extern void ChangeStatusArea(XIC, StatusAttr, XPointer);
00141 extern void ChangeStatusNothing(XIC, StatusAttr, XPointer);
00142 
00143 extern void ChangePreeditArea(XIC, PreeditAttr, XPointer);
00144 extern void ChangePreeditPosition(XIC, PreeditAttr, XPointer);
00145 extern void ChangePreeditNothing(XIC, PreeditAttr, XPointer);
00146 
00147 extern void ChangeLookup(XIC, LookupAttr, XPointer);
00148 
00149 /* this might be called from dl object, so need to take XIC as an 
00150    argument type, instead of Xic  */
00151 extern Bool IMForwardEvent(XicCommon, XEvent*);
00152 
00153 /* guiIMClbk.c */
00154 extern int    CallPreeditStartCallback(XicCommon ic, XPointer p);
00155 extern Bool   CallPreeditDrawCallback(XicCommon ic,
00156                                    XIMPreeditDrawCallbackStruct *p,
00157                                    IMFeedbackList *feedback_list);
00158 extern Bool   CallPreeditCaretCallback(XicCommon ic, XPointer p);
00159 extern Bool   CallPreeditDoneCallback(XicCommon ic, XPointer p);
00160 extern Bool   CallStatusStartCallback(XicCommon ic, XPointer p);
00161 extern Bool   CallStatusDrawCallback(XicCommon ic,
00162                                    XIMStatusDrawCallbackStruct *call_data,
00163                                    IMFeedbackList *feedback_list);
00164 extern Bool   CallStatusDoneCallback(XicCommon ic, XPointer p);
00165 
00166 /* IMSettings */
00167 extern Bool IsIMEnabled ();
00168 extern Bool IsIMStatusEnabled ();
00169 extern Bool IsIMStatusAttached ();
00170 extern Bool IsIMLookupEnabled ();
00171 #endif