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 Rectangle
27 void InitRectangle(struct XObj
*xobj
)
30 XSetWindowAttributes Attr
;
32 /* Enregistrement des couleurs et de la police */
33 if (xobj
->colorset
>= 0) {
34 xobj
->TabColor
[fore
] = Colorset
[xobj
->colorset
].fg
;
35 xobj
->TabColor
[back
] = Colorset
[xobj
->colorset
].bg
;
36 xobj
->TabColor
[hili
] = Colorset
[xobj
->colorset
].hilite
;
37 xobj
->TabColor
[shad
] = Colorset
[xobj
->colorset
].shadow
;
39 xobj
->TabColor
[fore
] = GetColor(xobj
->forecolor
);
40 xobj
->TabColor
[back
] = GetColor(xobj
->backcolor
);
41 xobj
->TabColor
[hili
] = GetColor(xobj
->hilicolor
);
42 xobj
->TabColor
[shad
] = GetColor(xobj
->shadcolor
);
45 xobj
->gc
=fvwmlib_XCreateGC(dpy
,*xobj
->ParentWin
,0,NULL
);
46 XSetForeground(dpy
,xobj
->gc
,xobj
->TabColor
[fore
]);
47 XSetBackground(dpy
,xobj
->gc
,xobj
->TabColor
[back
]);
48 XSetLineAttributes(dpy
,xobj
->gc
,1,LineSolid
,CapRound
,JoinMiter
);
51 xobj
->win
=XCreateWindow(dpy
,*xobj
->ParentWin
,
52 -1000,-1000,xobj
->width
,xobj
->height
,0,
53 CopyFromParent
,InputOutput
,CopyFromParent
,
57 void DestroyRectangle(struct XObj
*xobj
)
59 XFreeGC(dpy
,xobj
->gc
);
60 XDestroyWindow(dpy
,xobj
->win
);
63 void DrawRectangle(struct XObj
*xobj
, XEvent
*evp
)
69 segm
[0].x2
=xobj
->width
+xobj
->x
-1;
75 segm
[1].y2
=xobj
->height
+xobj
->y
-1;
78 segm
[2].y1
=xobj
->height
-2+xobj
->y
;
79 segm
[2].x2
=xobj
->width
-2+xobj
->x
;
80 segm
[2].y2
=xobj
->height
-2+xobj
->y
;
82 segm
[3].x1
=xobj
->width
-2+xobj
->x
;
84 segm
[3].x2
=xobj
->width
-2+xobj
->x
;
85 segm
[3].y2
=xobj
->height
-2+xobj
->y
;
87 XSetForeground(dpy
,xobj
->gc
,xobj
->TabColor
[shad
]);
88 XDrawSegments(dpy
,*xobj
->ParentWin
,xobj
->gc
,segm
,4);
93 segm
[0].x2
=xobj
->width
-1+xobj
->x
;
99 segm
[1].y2
=xobj
->height
-1+xobj
->y
;
101 segm
[2].x1
=1+xobj
->x
;
102 segm
[2].y1
=xobj
->height
-1+xobj
->y
;
103 segm
[2].x2
=xobj
->width
-1+xobj
->x
;
104 segm
[2].y2
=xobj
->height
-1+xobj
->y
;
106 segm
[3].x1
=xobj
->width
-1+xobj
->x
;
107 segm
[3].y1
=1+xobj
->y
;
108 segm
[3].x2
=xobj
->width
-1+xobj
->x
;
109 segm
[3].y2
=xobj
->height
-1+xobj
->y
;
111 XSetForeground(dpy
,xobj
->gc
,xobj
->TabColor
[hili
]);
112 XDrawSegments(dpy
,*xobj
->ParentWin
,xobj
->gc
,segm
,4);
116 void EvtMouseRectangle(struct XObj
*xobj
,XButtonEvent
*EvtButton
)
120 void EvtKeyRectangle(struct XObj
*xobj
,XKeyEvent
*EvtKey
)
124 void ProcessMsgRectangle(
125 struct XObj
*xobj
,unsigned long type
,unsigned long *body
)