2 /* This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #include "libs/fvwmlib.h"
20 #include "libs/ColorUtils.h"
21 #include "libs/Graphics.h"
25 * Fonction pour VDipstick
26 * Création d'une jauge verticale
29 void InitVDipstick(struct XObj
*xobj
)
32 XSetWindowAttributes Attr
;
34 /* Enregistrement des couleurs et de la police */
35 if (xobj
->colorset
>= 0) {
36 xobj
->TabColor
[fore
] = Colorset
[xobj
->colorset
].fg
;
37 xobj
->TabColor
[back
] = Colorset
[xobj
->colorset
].bg
;
38 xobj
->TabColor
[hili
] = Colorset
[xobj
->colorset
].hilite
;
39 xobj
->TabColor
[shad
] = Colorset
[xobj
->colorset
].shadow
;
41 xobj
->TabColor
[fore
] = GetColor(xobj
->forecolor
);
42 xobj
->TabColor
[back
] = GetColor(xobj
->backcolor
);
43 xobj
->TabColor
[hili
] = GetColor(xobj
->hilicolor
);
44 xobj
->TabColor
[shad
] = GetColor(xobj
->shadcolor
);
54 Attr
.background_pixel
=x11base
->TabColor
[back
];
56 xobj
->win
=XCreateWindow(dpy
,*xobj
->ParentWin
,
57 xobj
->x
,xobj
->y
,xobj
->width
,xobj
->height
,0,
58 CopyFromParent
,InputOutput
,CopyFromParent
,
60 xobj
->gc
=fvwmlib_XCreateGC(dpy
,xobj
->win
,0,NULL
);
61 if (xobj
->colorset
>= 0)
62 SetWindowBackground(dpy
, xobj
->win
, xobj
->width
, xobj
->height
,
63 &Colorset
[xobj
->colorset
], Pdepth
,
65 XSetForeground(dpy
,xobj
->gc
,xobj
->TabColor
[fore
]);
66 XSetLineAttributes(dpy
,xobj
->gc
,1,LineSolid
,CapRound
,JoinMiter
);
68 if (xobj
->value2
>xobj
->value3
)
69 xobj
->value3
=xobj
->value2
+50;
70 if (xobj
->value
<xobj
->value2
)
71 xobj
->value
=xobj
->value2
;
72 if (xobj
->value
>xobj
->value3
)
73 xobj
->value
=xobj
->value3
;
74 XSelectInput(dpy
, xobj
->win
, ExposureMask
);
77 void DestroyVDipstick(struct XObj
*xobj
)
79 XFreeGC(dpy
,xobj
->gc
);
80 XDestroyWindow(dpy
,xobj
->win
);
83 void DrawVDipstick(struct XObj
*xobj
, XEvent
*evp
)
88 (xobj
->value
-xobj
->value2
)/(xobj
->value3
-xobj
->value2
);
90 DrawReliefRect(0,0,xobj
->width
,xobj
->height
,xobj
,shad
,hili
);
94 2,xobj
->height
-i
-2,xobj
->width
-4,i
,xobj
,hili
,shad
);
95 XSetForeground(dpy
,xobj
->gc
,xobj
->TabColor
[fore
]);
97 dpy
,xobj
->win
,xobj
->gc
,4,xobj
->height
-i
,xobj
->width
-8,
103 void EvtMouseVDipstick(struct XObj
*xobj
,XButtonEvent
*EvtButton
)
107 void EvtKeyVDipstick(struct XObj
*xobj
,XKeyEvent
*EvtKey
)
111 void ProcessMsgVDipstick(
112 struct XObj
*xobj
,unsigned long type
,unsigned long *body
)