⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tkwin3d.c

📁 linux系统下的音频通信
💻 C
📖 第 1 页 / 共 2 页
字号:
/*  * tkWin3d.c -- * *	This file contains the platform specific routines for *	drawing 3d borders in the Windows 95 style. * * Copyright (c) 1996 by Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * SCCS: @(#) tkWin3d.c 1.6 97/08/12 14:28:54 */#include <tk3d.h>#include <tkWinInt.h>/* * This structure is used to keep track of the extra colors used by * Windows 3d borders. */typedef struct {    TkBorder info;    XColor *light2ColorPtr; /* System3dLight */    XColor *dark2ColorPtr;  /* System3dDarkShadow */} WinBorder;/* *---------------------------------------------------------------------- * * TkpGetBorder -- * *	This function allocates a new TkBorder structure. * * Results: *	Returns a newly allocated TkBorder. * * Side effects: *	None. * *---------------------------------------------------------------------- */TkBorder *TkpGetBorder(){    WinBorder *borderPtr = (WinBorder *) ckalloc(sizeof(WinBorder));    borderPtr->light2ColorPtr = NULL;    borderPtr->dark2ColorPtr = NULL;    return (TkBorder *) borderPtr;}/* *---------------------------------------------------------------------- * * TkpFreeBorder -- * *	This function frees any colors allocated by the platform *	specific part of this module. * * Results: *	None. * * Side effects: *	May deallocate some colors. * *---------------------------------------------------------------------- */voidTkpFreeBorder(borderPtr)    TkBorder *borderPtr;{    WinBorder *winBorderPtr = (WinBorder *) borderPtr;    if (winBorderPtr->light2ColorPtr) {	Tk_FreeColor(winBorderPtr->light2ColorPtr);    }    if (winBorderPtr->dark2ColorPtr) {	Tk_FreeColor(winBorderPtr->dark2ColorPtr);    }}/* *-------------------------------------------------------------- * * Tk_3DVerticalBevel -- * *	This procedure draws a vertical bevel along one side of *	an object.  The bevel is always rectangular in shape: *			||| *			||| *			||| *			||| *			||| *			||| *	An appropriate shadow color is chosen for the bevel based *	on the leftBevel and relief arguments.  Normally this *	procedure is called first, then Tk_3DHorizontalBevel is *	called next to draw neat corners. * * Results: *	None. * * Side effects: *	Graphics are drawn in drawable. * *-------------------------------------------------------------- */voidTk_3DVerticalBevel(tkwin, drawable, border, x, y, width, height,	leftBevel, relief)    Tk_Window tkwin;		/* Window for which border was allocated. */    Drawable drawable;		/* X window or pixmap in which to draw. */    Tk_3DBorder border;		/* Token for border to draw. */    int x, y, width, height;	/* Area of vertical bevel. */    int leftBevel;		/* Non-zero means this bevel forms the				 * left side of the object;  0 means it				 * forms the right side. */    int relief;			/* Kind of bevel to draw.  For example,				 * TK_RELIEF_RAISED means interior of				 * object should appear higher than				 * exterior. */{    TkBorder *borderPtr = (TkBorder *) border;    int left, right;#ifdef FILLRECTGC    GC leftgc=None;     GC rightgc=None;#endif    Display *display = Tk_Display(tkwin);    TkWinDCState state;    HDC dc = TkWinGetDrawableDC(display, drawable, &state);    int half;    if ((borderPtr->lightGC == None) && (relief != TK_RELIEF_FLAT)) {	TkpGetShadows(borderPtr, tkwin);    }    switch (relief) {	case TK_RELIEF_RAISED:	    left = (leftBevel)		? borderPtr->lightGC->foreground		: borderPtr->darkGC->foreground;#ifdef FILLRECTGC	    leftgc = (leftBevel)		? borderPtr->lightGC		: borderPtr->darkGC;#endif	    right = (leftBevel)		? ((WinBorder *)borderPtr)->light2ColorPtr->pixel		: ((WinBorder *)borderPtr)->dark2ColorPtr->pixel;	    break;	case TK_RELIEF_SUNKEN:	    left = (leftBevel)		? ((WinBorder *)borderPtr)->dark2ColorPtr->pixel		: ((WinBorder *)borderPtr)->light2ColorPtr->pixel;	    right = (leftBevel)		? borderPtr->darkGC->foreground		: borderPtr->lightGC->foreground;#ifdef FILLRECTGC	    rightgc = (leftBevel)		? borderPtr->darkGC		: borderPtr->lightGC;#endif	    break;	case TK_RELIEF_RIDGE:	    left = borderPtr->lightGC->foreground;	    right = borderPtr->darkGC->foreground;#ifdef FILLRECTGC	    leftgc = borderPtr->lightGC;	    rightgc = borderPtr->darkGC;#endif	    break;	case TK_RELIEF_GROOVE:	    left = borderPtr->darkGC->foreground;	    right = borderPtr->lightGC->foreground;#ifdef FILLRECTGC	    leftgc = borderPtr->darkGC;	    rightgc = borderPtr->lightGC;#endif	    break;	case TK_RELIEF_FLAT:#ifdef FILLRECTGC	    left = right = borderPtr->bgGC->foreground;	    leftgc = rightgc = borderPtr->bgGC;#endif	    break;	case TK_RELIEF_SOLID:	    left = right = RGB(0,0,0);	    break;    }    half = width/2;    if (leftBevel && (width & 1)) {	half++;    }#ifdef FILLRECTGC    (leftgc!=None)?      TkWinFillRectGC(dc, x, y, half, height, left,leftgc):#endif      TkWinFillRect(dc, x, y, half, height, left);#ifdef FILLRECTGC    (rightgc!=None)?      TkWinFillRectGC(dc, x+half, y, width-half, height, right,rightgc):#endif      TkWinFillRect(dc, x+half, y, width-half, height, right);    TkWinReleaseDrawableDC(drawable, dc, &state);}/* *-------------------------------------------------------------- * * Tk_3DHorizontalBevel -- * *	This procedure draws a horizontal bevel along one side of *	an object.  The bevel has mitered corners (depending on *	leftIn and rightIn arguments). * * Results: *	None. * * Side effects: *	None. * *-------------------------------------------------------------- */voidTk_3DHorizontalBevel(tkwin, drawable, border, x, y, width, height,	leftIn, rightIn, topBevel, relief)    Tk_Window tkwin;		/* Window for which border was allocated. */    Drawable drawable;		/* X window or pixmap in which to draw. */    Tk_3DBorder border;		/* Token for border to draw. */    int x, y, width, height;	/* Bounding box of area of bevel.  Height				 * gives width of border. */    int leftIn, rightIn;	/* Describes whether the left and right				 * edges of the bevel angle in or out as				 * they go down.  For example, if "leftIn"				 * is true, the left side of the bevel				 * looks like this:				 *	___________				 *	 __________				 *	  _________				 *	   ________				 */    int topBevel;		/* Non-zero means this bevel forms the				 * top side of the object;  0 means it				 * forms the bottom side. */    int relief;			/* Kind of bevel to draw.  For example,				 * TK_RELIEF_RAISED means interior of				 * object should appear higher than				 * exterior. */{    TkBorder *borderPtr = (TkBorder *) border;    Display *display = Tk_Display(tkwin);    int bottom, halfway, x1, x2, x1Delta, x2Delta;    TkWinDCState state;    HDC dc = TkWinGetDrawableDC(display, drawable, &state);    int topColor, bottomColor;    if ((borderPtr->lightGC == None) && (relief != TK_RELIEF_FLAT)) {	TkpGetShadows(borderPtr, tkwin);    }    /*     * Compute a GC for the top half of the bevel and a GC for the     * bottom half (they're the same in many cases).     */    switch (relief) {	case TK_RELIEF_RAISED:	    topColor = (topBevel)		? borderPtr->lightGC->foreground		: borderPtr->darkGC->foreground;	    bottomColor = (topBevel)		? ((WinBorder *)borderPtr)->light2ColorPtr->pixel		: ((WinBorder *)borderPtr)->dark2ColorPtr->pixel;	    break;	case TK_RELIEF_SUNKEN:	    topColor = (topBevel)		? ((WinBorder *)borderPtr)->dark2ColorPtr->pixel		: ((WinBorder *)borderPtr)->light2ColorPtr->pixel;	    bottomColor = (topBevel)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -