forked from e16/e16
1
0
Fork 0

Expose bevels for theming.

SVN revision: 38628
This commit is contained in:
Kim Woelders 2009-01-18 11:17:28 +00:00
parent d5335ecd46
commit e9ac46b3de
3 changed files with 47 additions and 12 deletions

View File

@ -198,6 +198,15 @@
#define __FLIP_VERTICAL 6 #define __FLIP_VERTICAL 6
#define __FLIP_270 7 #define __FLIP_270 7
#define __BEVEL 374
#define __BEVEL_AMIGA 1
#define __BEVEL_MOTIF 2
#define __BEVEL_NEXT 3
#define __BEVEL_DOUBLE 4
#define __BEVEL_WIDEDOUBLE 5
#define __BEVEL_THINPOINT 6
#define __BEVEL_THICKPOINT 7
#define __KEEP_ON_TOP 453 #define __KEEP_ON_TOP 453
#define __FLAGS 454 #define __FLAGS 454
#define __IS_A_REGION 455 #define __IS_A_REGION 455

View File

@ -77,6 +77,7 @@
#define ICLASS_FILLRULE 371 #define ICLASS_FILLRULE 371
#define ICLASS_TRANSPARENT 372 #define ICLASS_TRANSPARENT 372
#define ICLASS_ROTATE 373 #define ICLASS_ROTATE 373
#define ICLASS_BEVEL 374
#define DESKTOP_DRAGDIR 400 #define DESKTOP_DRAGDIR 400
#define DESKTOP_DRAGBAR_WIDTH 401 #define DESKTOP_DRAGBAR_WIDTH 401

View File

@ -584,6 +584,27 @@ ImageclassConfigLoad(FILE * fs)
case ICLASS_ROTATE: /* flip goes here too */ case ICLASS_ROTATE: /* flip goes here too */
is->rotate = strtoul(s2, NULL, 0); is->rotate = strtoul(s2, NULL, 0);
continue; continue;
case ICLASS_BEVEL:
#define _R(x) (((x) >> 16) & 0xff)
#define _G(x) (((x) >> 8) & 0xff)
#define _B(x) (((x) ) & 0xff)
#define INT_TO_COLOR(xc, rgb) \
do { (&(xc))->red = _R(rgb); (&(xc))->green = _G(rgb); (&(xc))->blue = _B(rgb); } while(0)
{
int n, bevel, hihi, hi, bg, lo, lolo;
n = sscanf(p2, "%i %i %i %i %i %i",
&bevel, &hihi, &hi, &bg, &lo, &lolo);
if (n < 6)
goto not_ok;
is->bevelstyle = bevel;
INT_TO_COLOR(is->hihi, hihi);
INT_TO_COLOR(is->hi, hi);
INT_TO_COLOR(is->bg, bg);
INT_TO_COLOR(is->lo, lo);
INT_TO_COLOR(is->lolo, lolo);
}
break;
default: default:
goto not_ok; goto not_ok;
} }
@ -1122,7 +1143,7 @@ ITApply(Win win, ImageClass * ic, ImageState * is,
{ {
Pixmap pmap = pmm.pmap; Pixmap pmap = pmm.pmap;
if (ts && text) if ((ts && text) || (is->bevelstyle != BEVEL_NONE))
{ {
if (pmm.type != 0) if (pmm.type != 0)
{ {
@ -1130,9 +1151,20 @@ ITApply(Win win, ImageClass * ic, ImageState * is,
EXCopyAreaTiled(pmm.pmap, None, pmap, 0, 0, w, h, 0, 0); EXCopyAreaTiled(pmm.pmap, None, pmap, 0, 0, w, h, 0, 0);
} }
TextstateTextDraw(ts, win, pmap, text, 0, 0, w, h, if (is->bevelstyle != BEVEL_NONE)
&(ic->padding), 0, {
TextclassGetJustification(tc), flags); GC gc;
gc = EXCreateGC(WinGetXwin(win), 0, NULL);
Eprintf("%s: bevel=%d\n", __func__, is->bevelstyle);
ImagestateDrawBevel(is, pmap, gc, 0, 0, w, h);
EXFreeGC(gc);
}
if (ts && text)
TextstateTextDraw(ts, win, pmap, text, 0, 0, w, h,
&(ic->padding), 0,
TextclassGetJustification(tc), flags);
} }
/* Set window pixmap */ /* Set window pixmap */
@ -1167,20 +1199,13 @@ ITApply(Win win, ImageClass * ic, ImageState * is,
else else
{ {
Pixmap pmap; Pixmap pmap;
GC gc;
pmap = EGetWindowBackgroundPixmap(win); pmap = EGetWindowBackgroundPixmap(win);
gc = EXCreateGC(WinGetXwin(win), 0, NULL); ImagestateDrawNoImg(is, pmap, 0, 0, w, h);
XSetFillStyle(disp, gc, FillSolid);
XSetForeground(disp, gc, is->bg.pixel);
XFillRectangle(disp, pmap, gc, 0, 0, w, h);
if (is->bevelstyle != BEVEL_NONE)
ImagestateDrawBevel(is, pmap, gc, 0, 0, w, h);
if (ts && text) if (ts && text)
TextstateTextDraw(ts, win, pmap, text, 0, 0, w, h, TextstateTextDraw(ts, win, pmap, text, 0, 0, w, h,
&(ic->padding), 0, &(ic->padding), 0,
TextclassGetJustification(tc), flags); TextclassGetJustification(tc), flags);
EXFreeGC(gc);
} }
} }
EClearWindow(win); EClearWindow(win);