home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / evbl0627.zip / everblue_20010627.zip / x11 / Xom_ImText.c < prev    next >
C/C++ Source or Header  |  1999-11-02  |  3KB  |  107 lines

  1. /* $XConsortium: omImText.c,v 1.2 94/01/20 18:08:09 rws Exp $ */
  2. /*
  3.  * Copyright 1992, 1993 by TOSHIBA Corp.
  4.  *
  5.  * Permission to use, copy, modify, and distribute this software and its
  6.  * documentation for any purpose and without fee is hereby granted, provided
  7.  * that the above copyright notice appear in all copies and that both that
  8.  * copyright notice and this permission notice appear in supporting
  9.  * documentation, and that the name of TOSHIBA not be used in advertising
  10.  * or publicity pertaining to distribution of the software without specific,
  11.  * written prior permission. TOSHIBA make no representations about the
  12.  * suitability of this software for any purpose.  It is provided "as is"
  13.  * without express or implied warranty.
  14.  *
  15.  * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  16.  * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  17.  * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  18.  * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  19.  * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  20.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21.  * SOFTWARE.
  22.  *
  23.  * Author: Katsuhisa Yano    TOSHIBA Corp.
  24.  *                   mopi@osa.ilab.toshiba.co.jp
  25.  */
  26.  
  27. #include "Xlib_private.h"
  28. #include "XomGeneric.h"
  29.  
  30. extern int _XomGenericTextExtents(), _XomGenericDrawString();
  31.  
  32. #define GET_VALUE_MASK    (GCFunction | GCForeground | GCBackground | GCFillStyle)
  33. #define SET_VALUE_MASK    (GCFunction | GCForeground | GCFillStyle)
  34.  
  35. static void
  36. _XomGenericDrawImageString(dpy, d, oc, gc, x, y, type, text, length)
  37.     Display *dpy;
  38.     Drawable d;
  39.     XOC oc;
  40.     GC gc;
  41.     int x, y;
  42.     XOMTextType type;
  43.     XPointer text;
  44.     int length;
  45. {
  46.     DBUG_ENTER("_XomGenericDrawImageString")
  47.     XGCValues values;
  48.     XRectangle extent;
  49.  
  50.     XGetGCValues(dpy, gc, GET_VALUE_MASK, &values);
  51.  
  52.     XSetFunction(dpy, gc, GXcopy);
  53.     XSetForeground(dpy, gc, values.background);
  54.     XSetFillStyle(dpy, gc, FillSolid);
  55.  
  56.     _XomGenericTextExtents(oc, type, text, length, 0, &extent);
  57.     XFillRectangle(dpy, d, gc, x + extent.x, y + extent.y, extent.width,
  58.            extent.height);
  59.  
  60.     XChangeGC(dpy, gc, SET_VALUE_MASK, &values);
  61.  
  62.     _XomGenericDrawString(dpy, d, oc, gc, x, y, type, text, length);
  63.     DBUG_VOID_RETURN;
  64. }
  65.  
  66. void
  67. #if NeedFunctionPrototypes
  68. _XmbGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
  69.                int y, _Xconst char *text, int length)
  70. #else
  71. _XmbGenericDrawImageString(dpy, d, oc, gc, x, y, text, length)
  72.     Display *dpy;
  73.     Drawable d;
  74.     XOC oc;
  75.     GC gc;
  76.     int x, y;
  77.     char *text;
  78.     int length;
  79. #endif
  80. {
  81.     DBUG_ENTER("_XmbGenericDrawImageString")
  82.     _XomGenericDrawImageString(dpy, d, oc, gc, x, y, XOMMultiByte,
  83.                    (XPointer) text, length);
  84.     DBUG_VOID_RETURN;
  85. }
  86.  
  87. void
  88. #if NeedFunctionPrototypes
  89. _XwcGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x,
  90.                int y, _Xconst wchar_t *text, int length)
  91. #else
  92. _XwcGenericDrawImageString(dpy, d, oc, gc, x, y, text, length)
  93.     Display *dpy;
  94.     Drawable d;
  95.     XOC oc;
  96.     GC gc;
  97.     int x, y;
  98.     wchar_t *text;
  99.     int length;
  100. #endif
  101. {
  102.     DBUG_ENTER("_XwcGenericDrawImageString")
  103.     _XomGenericDrawImageString(dpy, d, oc, gc, x, y, XOMWideChar,
  104.                    (XPointer) text, length);
  105.     DBUG_VOID_RETURN;
  106. }
  107.