[Commit]
cairo-gtk-engine/src cge-draw.c, 1.3, 1.4 cge-style.h, 1.2, 1.3
Julien Boulnois
commit at keithp.com
Sun Aug 3 07:59:49 PDT 2003
Committed by: jboulnois
Update of /local/src/CVS/cairo-gtk-engine/src
In directory home.keithp.com:/tmp/cvs-serv23948/src
Modified Files:
cge-draw.c cge-style.h
Log Message:
adding set_background (detail=background)
Index: cge-draw.c
===================================================================
RCS file: /local/src/CVS/cairo-gtk-engine/src/cge-draw.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cge-draw.c 2 Aug 2003 23:28:37 -0000 1.3
+++ cge-draw.c 3 Aug 2003 13:59:46 -0000 1.4
@@ -363,7 +363,7 @@
{
GdkDrawable *real_drawable;
- if(GDK_IS_WINDOW(window))
+ if(GDK_IS_WINDOW(window))
{
gdk_window_get_internal_paint_info (window, &real_drawable, x_off, y_off);
}
@@ -942,6 +942,7 @@
cairo_set_alpha(xrs,alpha);
cairo_set_rgb_color(xrs, r, g, b);
+
if(pattern!=NULL)
cairo_set_pattern(xrs,pattern);
@@ -1099,6 +1100,18 @@
cge_draw_rectangle(xrs,color,1,x,y,width,height);
}
+ else if(DETAIL("background"))
+ {
+ cge_draw_box(xrs,color,
+ gradient,
+ 1,
+ x,
+ y,
+ width,
+ height,
+ 0,
+ TRUE,0);
+ }
else
{
if(cstyle->line_style.line_mode==CGE_LINE_BEVEL)
@@ -1433,24 +1446,24 @@
gdk_get_off(window,&x_off,&y_off);
gradient=cge_create_gradient_from_rc(xrs,
- style,
- state_type,
- detail,
- x_off,y_off,width,height);
-
+ style,
+ state_type,
+ detail,
+ x_off,y_off,width,height);
+
if(cstyle->line_style.color_default[state_type]==TRUE)
color=style->dark[state_type];
else
color=cstyle->line_style.color[state_type];
cge_draw_box_gap(xrs,
- style->bg[state_type],
- NULL,
- 1,
- x,y,width,height,
- cstyle->fill_style.round_width,
- gap_x,gap_width,
- TRUE,0);
+ style->bg[state_type],
+ gradient,
+ 1,
+ x,y,width,height,
+ cstyle->fill_style.round_width,
+ gap_x,gap_width,
+ TRUE,0);
cge_draw_box_gap(xrs,
color,
@@ -1628,7 +1641,7 @@
cge_draw_box_gap(xrs,
style->bg[state_type],
- NULL,
+ gradient,
1,
x,y,width,height,
cstyle->fill_style.round_width,
@@ -2038,52 +2051,71 @@
}
-/*
+
static void set_background (GtkStyle *style,
GdkWindow *window,
GtkStateType state_type)
{
- gint x,y,w,h,d;
- gint x_off=0,y_off=0;
- cairo_t *xrs;
- GdkPixmap *pm;
- cairo_surface_t *gradient;
+ GdkDrawable *real_drawable;
+ gint x,y,w,h,d;
+ gint x_off=0,y_off=0;
+ cairo_t *xrs;
+ GdkPixmap *pm;
+ GdkRectangle rect;
+ gdk_window_get_geometry (window,
+ &x,
+ &y,
+ &w,
+ &h,
+ &d);
+ rect.x=x;
+ rect.y=y;
+ rect.width=w;
+ rect.height=h;
+
+ xrs=cairo_create();
- gdk_window_get_geometry (window,
- &x,
- &y,
- &w,
- &h,
- &d);
+
-
- pm = gdk_pixmap_new(window,w,h,d);
+ /*gdk_window_set_background (window,
+ &style->bg[state_type]);
- xrs=cairo_create();
+ */
- cge_gdk(xrs,pm);
+ pm = gdk_pixmap_new(window,w,h,d);
+ cge_gdk(xrs,pm);
- gdk_get_off(window,&x_off,&y_off);
+ gdk_window_begin_paint_rect (window,
+ &rect);
+ gdk_get_off(window,&x_off,&y_off);
+ gdk_window_end_paint (window);
+ cairo_translate(xrs,-(double)x_off,-(double)y_off);
+ /* cge_draw_rectangle(xrs,
+ style->bg[state_type],
+ 1,
+ x,y,w,h);
+ */
+ cge_draw_filled_box_from_rc(xrs,
+ style,
+ state_type,
+ "background",
+ x_off,
+ y_off,
+ x,
+ y,
+ w,
+ h);
- cge_draw_box(xrs,style->bg[state_type],
- NULL,
- 1,
- x,y,w,h,
- 0,
- TRUE,0);
+ gdk_window_set_back_pixmap(window,pm,FALSE);
- gdk_window_set_back_pixmap(window,pm,FALSE);
- if(gradient)
- cairo_surface_destroy(gradient);
-
+ //printf("set_background : %i %i %i %i %i %i\n",x_off,y_off,x,y,w,h);
cairo_destroy(xrs);
-
}
-*/
+
GType cge_type_style = 0;
@@ -2142,5 +2174,6 @@
//style_class->draw_polygon = draw_polygon;
//style_class->draw_diamond = draw_diamond;
//style_class->draw_layout = draw_layout;
- //style_class->set_background=set_background;
+
+ style_class->set_background=set_background;
}
Index: cge-style.h
===================================================================
RCS file: /local/src/CVS/cairo-gtk-engine/src/cge-style.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- cge-style.h 2 Aug 2003 23:28:37 -0000 1.2
+++ cge-style.h 3 Aug 2003 13:59:46 -0000 1.3
@@ -71,6 +71,26 @@
}cge_arrow_style;
+typedef enum
+ {
+ CGE_CHECK_NORMAL=0,
+ CGE_CHECK_SIMPLE,
+ CGE_CHECK_WONDERLAND,
+ /* others ... */
+ CGE_CHECK_FILE
+
+ }cge_check_style;
+
+typedef enum
+ {
+ CGE_OPTION_NORMAL=0,
+ CGE_OPTION_SIMPLE,
+ CGE_OPTION_WONDERLAND,
+ /* others ... */
+ CGE_OPTION_FILE
+
+ }cge_option_style;
+
#define MAX_GRADIENT_COLORS 10
#define MAX_STYLES 10
More information about the Commit
mailing list