~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Open Mash Cross Reference
mash/compat/win32x.c

Component: ~ [ mash ] ~ [ apps ] ~ [ gsm ] ~ [ lib ] ~ [ otcl ] ~ [ srm ] ~ [ tcl8.3 ] ~ [ tclcl ] ~ [ tk8.3 ] ~ [ tutorials ] ~

  1 /*
  2  * win32x.c --
  3  *
  4  *      FIXME: This file needs a description here.
  5  *
  6  * Copyright (c) 1996-2002 The Regents of the University of California.
  7  * All rights reserved.
  8  *
  9  * Redistribution and use in source and binary forms, with or without
 10  * modification, are permitted provided that the following conditions are met:
 11  *
 12  * A. Redistributions of source code must retain the above copyright notice,
 13  *    this list of conditions and the following disclaimer.
 14  * B. Redistributions in binary form must reproduce the above copyright notice,
 15  *    this list of conditions and the following disclaimer in the documentation
 16  *    and/or other materials provided with the distribution.
 17  * C. Neither the names of the copyright holders nor the names of its
 18  *    contributors may be used to endorse or promote products derived from this
 19  *    software without specific prior written permission.
 20  *
 21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
 22  * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 23  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 24  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
 25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 31  * POSSIBILITY OF SUCH DAMAGE.
 32  *
 33  * This module contributed by John Brezak <brezak@apollo.hp.com>.
 34  * January 31, 1996
 35  */
 36 
 37 #ifndef lint
 38 static char rcsid[] =
 39     "@(#) $Header: /usr/mash/src/repository/mash/mash-1/compat/win32x.c,v 1.8 2002/02/03 03:14:22 lim Exp $";
 40 #endif
 41 
 42 #include "tkWinInt.h"
 43 #include "assert.h"
 44 
 45 XImage *
 46 XGetSubImage(
 47     Display*            display,
 48     Drawable            d,
 49     int                 x,
 50     int                 y,
 51     unsigned int        width,
 52     unsigned int        height,
 53     unsigned long       plane_mask,
 54     int                 format,
 55     XImage*             dest_image,
 56     int                 dest_x,
 57     int                 dest_y
 58 )
 59 {
 60     printf("XGetSubImage: not implemented!\n");
 61     return(NULL);
 62 }
 63 
 64 unsigned long *win32Colors;
 65 int win32NColors = 0;
 66 
 67 /*
 68  * These functions belong in the TkWin port code
 69  */
 70 
 71 /*
 72  *----------------------------------------------------------------------
 73  *
 74  * XClearArea --
 75  *
 76  *      Clears the specified area in the window to the current
 77  *      background color.
 78  *
 79  * Results:
 80  *      None.
 81  *
 82  * Side effects:
 83  *      Erases the specified area of the window.
 84  *
 85  *----------------------------------------------------------------------
 86  */
 87 void
 88 XClearArea(display, w, x ,y, width, height, exposures)
 89     Display* display;
 90     Window w;
 91     int x;
 92     int y;
 93     unsigned int width;
 94     unsigned int height;
 95     Bool exposures;
 96 {
 97     RECT rc;
 98     HBRUSH brush;
 99     HPALETTE oldPalette, palette;
100     TkWindow *winPtr;
101     HWND hwnd = TkWinGetHWND(w);
102     HDC dc = GetDC(hwnd);
103 
104     palette = TkWinGetPalette(display->screens[0].cmap);
105     oldPalette = SelectPalette(dc, palette, FALSE);
106 
107     display->request++;
108 
109     winPtr = TkWinGetWinPtr(w);
110     brush = CreateSolidBrush(winPtr->atts.background_pixel);
111     GetWindowRect(hwnd, &rc);
112     rc.right = rc.right - rc.left;
113     rc.bottom = rc.bottom - rc.top;
114     rc.left = rc.top = 0;
115 
116     if (width!=0) {
117         rc.left=(LONG)x;
118         rc.right=(LONG)(x + width + 1);
119     }
120 
121     if (height !=0) {
122         rc.top=(LONG)y;
123         rc.bottom=(LONG)(y + height + 1);
124     }
125 
126     FillRect(dc, &rc, brush);
127 
128     DeleteObject(brush);
129     SelectPalette(dc, oldPalette, TRUE);
130     ReleaseDC(hwnd, dc);
131 }
132 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.