1 /****************************************************************************/
3 /* ALLIANCE CAD FRAMEWORK */
5 /* Tool : libXal Version 1.01 */
6 /* File : PixmapLabel.c */
8 /* (c) copyright 1993 MASI Laboratory. CAO & VLSI CAD Team */
9 /* All rights reserved. */
10 /* Support : e-mail cao-vlsi@masi.ibp.fr */
12 /* Author(s) : Nizar ABDALLAH Date : 02/02/1993 */
14 /* Modified by : Date : ../../.... */
15 /* Modified by : Date : ../../.... */
16 /* Modified by : Date : ../../.... */
18 /****************************************************************************/
20 /* This function is to be called by all ALLIANCE tools in order to present */
21 /* the same iconic image. */
23 /****************************************************************************/
30 /*-----------------------------*/
31 /* Motif for Alliance includes */
32 /*-----------------------------*/
37 /*---------------------------------------------------------------------------*/
39 /* FUNCTION : XalCreatePixmapLabel */
41 /* IN ARGS : .LabelWidget : set a pixmap on a label widget */
43 /* OUT ARGS : ( void ) */
45 /* OBJECT : Forces the WM to execute the set icon. */
47 /*---------------------------------------------------------------------------*/
48 Widget
XalCreatePixmapLabel(LabelWidget
, Normal
, Insensitive
)
57 unsigned int PixmapHeight
, PixmapWidth
, PixmapBorder
, PixmapDepth
;
59 Pixmap NormalPixmap
, InsensitivePixmap
;
60 XpmAttributes XpmAttr
;
61 Boolean RecomputeSize
;
66 XpmColorSymbol XpmTransparentColor
[1] = {{ NULL
, "none", 0 }};
67 static char StippleBitmap
[8] = { 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA };
69 Dsp
= XtDisplayOfObject(LabelWidget
);
70 Scr
= XtScreenOfObject(LabelWidget
);
71 XtVaGetValues(XtIsSubclass(LabelWidget
, coreWidgetClass
) ? LabelWidget
: XtParent(LabelWidget
),
73 XmNbackground
, &Background
,
76 XpmTransparentColor
[0].pixel
= Background
;
77 XpmAttr
.valuemask
= XpmColorSymbols
| XpmCloseness
| XpmDepth
;
78 XpmAttr
.colorsymbols
= XpmTransparentColor
;
79 XpmAttr
.numsymbols
= 1;
80 XpmAttr
.closeness
= 65535;
81 XpmAttr
.depth
= Depth
;
83 if ((XpmCreatePixmapFromData(Dsp
, RootWindowOfScreen(Scr
),
84 Normal
, &NormalPixmap
, NULL
, &XpmAttr
)) != XpmSuccess
){
88 Stipple
= XCreateBitmapFromData(Dsp
, RootWindowOfScreen(Scr
),
90 GCValues
.foreground
= Background
;
91 GCValues
.fill_style
= FillStippled
;
92 GCValues
.stipple
= Stipple
;
93 gc
= XtGetGC(LabelWidget
,
94 GCForeground
| GCFillStyle
| GCStipple
,
96 XGetGeometry(Dsp
, NormalPixmap
, &RootWindow
, &PixmapX
, &PixmapY
,
97 &PixmapWidth
, &PixmapHeight
, &PixmapBorder
, &PixmapDepth
);
98 InsensitivePixmap
= XCreatePixmap(Dsp
, RootWindowOfScreen(Scr
),
99 PixmapWidth
, PixmapHeight
, PixmapDepth
);
100 XCopyArea(Dsp
, NormalPixmap
, InsensitivePixmap
, gc
, 0, 0, PixmapWidth
, PixmapHeight
, 0, 0);
101 XFillRectangle(Dsp
, InsensitivePixmap
, gc
, 0, 0, PixmapWidth
, PixmapHeight
);
103 XtReleaseGC(LabelWidget
, gc
);
104 XFreePixmap(Dsp
, Stipple
);
106 XtVaGetValues(LabelWidget
, XmNrecomputeSize
, &RecomputeSize
, NULL
);
107 XtVaSetValues(LabelWidget
, XmNrecomputeSize
, True
, NULL
);
108 XtVaSetValues(LabelWidget
,
109 XmNlabelType
, XmPIXMAP
,
110 XmNlabelPixmap
, NormalPixmap
,
111 XmNlabelInsensitivePixmap
, InsensitivePixmap
,
113 XtVaSetValues(LabelWidget
, XmNrecomputeSize
, RecomputeSize
, NULL
);
114 return ( LabelWidget
);
116 } /* XalCreatePixmapLabel */