1 #include "clearlooks_draw.h"
2 #include "clearlooks_style.h"
7 FASTER GRADIENT FILL FUNCTION, POSSIBLY USING XRENDER. **/
9 static void cl_draw_borders (GdkWindow
*window
, GtkWidget
*widget
, GtkStyle
*style
,
10 int x
, int y
, int width
, int height
, CLRectangle
*r
);
12 static void cl_draw_line (GdkWindow
*window
, GtkWidget
*widget
, GtkStyle
*style
,
13 int x1
, int y1
, int x2
, int y2
, CLBorderType border
,
16 static void cl_draw_corner (GdkWindow
*window
, GtkWidget
*widget
, GtkStyle
*style
,
17 int x
, int y
, int width
, int height
,
18 CLRectangle
*r
, CLCornerSide corner
);
20 static void cl_draw_fill (GdkWindow
*window
, GtkWidget
*widget
, GtkStyle
*style
,
21 int x
, int y
, int width
, int height
, CLRectangle
*r
);
23 void cl_draw_rectangle (GdkWindow
*window
, GtkWidget
*widget
, GtkStyle
*style
,
24 int x
, int y
, int width
, int height
, CLRectangle
*r
)
28 cl_draw_fill(window
, widget
, style
, x
, y
, width
, height
, r
);
33 cl_draw_borders(window
, widget
, style
, x
, y
, width
, height
, r
);
38 static void cl_get_coords ( CLBorderType border
,
39 int x
, int y
, int width
, int height
,
40 CLRectangle
*r
, int *x1
, int *y1
, int *x2
, int *y2
)
45 *x1
= x
+ r
->corners
[CL_CORNER_TOPLEFT
];
46 *x2
= *x1
+ width
- r
->corners
[CL_CORNER_TOPLEFT
] - r
->corners
[CL_CORNER_TOPRIGHT
] - 1;
49 case CL_BORDER_BOTTOM
:
50 *x1
= x
+ r
->corners
[CL_CORNER_BOTTOMLEFT
];
51 *x2
= *x1
+ width
- r
->corners
[CL_CORNER_BOTTOMLEFT
] - r
->corners
[CL_CORNER_BOTTOMRIGHT
] - 1;
52 *y1
= *y2
= y
+ height
- 1;
56 *y1
= y
+ r
->corners
[CL_CORNER_TOPLEFT
];
57 *y2
= *y1
+ height
- r
->corners
[CL_CORNER_TOPLEFT
] - r
->corners
[CL_CORNER_BOTTOMLEFT
] - 1;
60 *x1
= *x2
= x
+ width
- 1;
61 *y1
= y
+ r
->corners
[CL_CORNER_TOPRIGHT
];
62 *y2
= *y1
+ height
- r
->corners
[CL_CORNER_TOPRIGHT
] - r
->corners
[CL_CORNER_BOTTOMRIGHT
] - 1;
67 void cl_draw_borders (GdkWindow
*window
, GtkWidget
*widget
, GtkStyle
*style
,
68 int x
, int y
, int width
, int height
, CLRectangle
*r
)
70 int x1
, y1
, x2
, y2
, i
;
72 if (r
->bordergc
== NULL
)
75 for ( i
=0; i
<4; i
++) /* draw all four borders + corners */
77 cl_get_coords (i
, x
, y
, width
, height
, r
, &x1
, &y1
, &x2
, &y2
);
78 cl_draw_line (window
, widget
, style
, x1
, y1
, x2
, y2
, i
, r
);
79 cl_draw_corner (window
, widget
, style
, x
, y
, width
, height
, r
, i
);
84 static GdkColor
cl_gc_get_foreground(GdkGC
*gc
)
87 gdk_gc_get_values (gc
, &values
);
88 return values
.foreground
;
91 static void cl_draw_line (GdkWindow
*window
, GtkWidget
*widget
, GtkStyle
*style
,
92 int x1
, int y1
, int x2
, int y2
, CLBorderType border
,
95 if (r
->gradient_type
== CL_GRADIENT_NONE
||
96 r
->border_gradient
.from
== NULL
|| r
->border_gradient
.to
== NULL
)
98 gdk_draw_line (window
, r
->bordergc
, x1
, y1
, x2
, y2
);
100 else if (r
->gradient_type
== CL_GRADIENT_HORIZONTAL
&& (border
== CL_BORDER_TOP
|| border
== CL_BORDER_BOTTOM
))
102 draw_vgradient (window
, r
->bordergc
, style
,
104 r
->border_gradient
.from
, r
->border_gradient
.to
);
106 else if (r
->gradient_type
== CL_GRADIENT_VERTICAL
&& (border
== CL_BORDER_LEFT
|| border
== CL_BORDER_RIGHT
))
108 draw_hgradient (window
, r
->bordergc
, style
,
110 r
->border_gradient
.from
, r
->border_gradient
.to
);
114 GdkColor tmp_color
= cl_gc_get_foreground (r
->bordergc
);
116 if (r
->gradient_type
== CL_GRADIENT_HORIZONTAL
&& border
== CL_BORDER_LEFT
||
117 r
->gradient_type
== CL_GRADIENT_VERTICAL
&& border
== CL_BORDER_TOP
)
118 gdk_gc_set_foreground (r
->bordergc
, r
->border_gradient
.from
);
120 gdk_gc_set_foreground (r
->bordergc
, r
->border_gradient
.to
);
122 gdk_draw_line (window
, r
->bordergc
, x1
, y1
, x2
, y2
);
124 gdk_gc_set_foreground (r
->bordergc
, &tmp_color
);
128 static GdkColor
*cl_get_gradient_corner_color (CLRectangle
*r
, CLCornerSide corner
)
132 if (r
->border_gradient
.from
== NULL
|| r
->border_gradient
.to
== NULL
)
136 else if ((r
->gradient_type
== CL_GRADIENT_HORIZONTAL
&& (corner
== CL_CORNER_TOPLEFT
|| corner
== CL_CORNER_BOTTOMLEFT
)) ||
137 (r
->gradient_type
== CL_GRADIENT_VERTICAL
&& (corner
== CL_CORNER_TOPLEFT
|| corner
== CL_CORNER_TOPRIGHT
)))
139 color
= r
->border_gradient
.from
;
141 else /* no gradient or other corner */
143 color
= r
->border_gradient
.to
;
149 static void cl_draw_corner (GdkWindow
*window
, GtkWidget
*widget
, GtkStyle
*style
,
150 int x
, int y
, int width
, int height
,
151 CLRectangle
*r
, CLCornerSide corner
)
154 GdkColor aacolor
; /* anti-aliasing color */
162 if (r
->corners
[corner
] == CL_CORNER_NONE
)
165 color
= cl_get_gradient_corner_color (r
, corner
);
166 gdk_gc_get_values (r
->bordergc
, &values
);
170 tmp
= values
.foreground
;
171 gdk_colormap_query_color (gtk_widget_get_colormap(widget
), values
.foreground
.pixel
, &tmp
);
175 bgcolor
= get_parent_bgcolor(widget
);
182 blend (style
->colormap
, bgcolor
, color
, &aacolor
, 70);
184 if (r
->corners
[corner
] == CL_CORNER_ROUND
)
186 x1
= (corner
== CL_CORNER_TOPLEFT
||
187 corner
== CL_CORNER_BOTTOMLEFT
) ? x
+1 : x
+width
- 2;
189 y1
= (corner
== CL_CORNER_TOPLEFT
||
190 corner
== CL_CORNER_TOPRIGHT
) ? y
+1 : y
+height
- 2;
192 gdk_gc_set_foreground (r
->bordergc
, color
);
193 gdk_draw_point (window
, r
->bordergc
, x1
, y1
);
195 gdk_gc_set_foreground (r
->bordergc
, &aacolor
);
197 x1
= (corner
== CL_CORNER_TOPLEFT
||
198 corner
== CL_CORNER_BOTTOMLEFT
) ? x
+1 : x
+width
-2;
200 y1
= (corner
== CL_CORNER_TOPLEFT
||
201 corner
== CL_CORNER_TOPRIGHT
) ? y
: y
+height
-1;
203 gdk_draw_point (window
, r
->bordergc
, x1
, y1
);
205 x1
= (corner
== CL_CORNER_TOPLEFT
||
206 corner
== CL_CORNER_BOTTOMLEFT
) ? x
: x
+width
-1;
208 y1
= (corner
== CL_CORNER_TOPLEFT
||
209 corner
== CL_CORNER_TOPRIGHT
) ? y
+1 : y
+height
-2;
211 gdk_draw_point (window
, r
->bordergc
, x1
, y1
);
214 else if (r
->corners
[corner
] == CL_CORNER_NARROW
)
216 x1
= (corner
== CL_CORNER_TOPLEFT
||
217 corner
== CL_CORNER_BOTTOMLEFT
) ? x
: x
+width
-1;
219 y1
= (corner
== CL_CORNER_TOPLEFT
||
220 corner
== CL_CORNER_TOPRIGHT
) ? y
: y
+height
-1;
222 gdk_gc_set_foreground (r
->bordergc
, &aacolor
);
223 gdk_draw_point (window
, r
->bordergc
, x1
, y1
);
226 gdk_gc_set_foreground (r
->bordergc
, &values
.foreground
);
229 static void cl_draw_fill (GdkWindow
*window
, GtkWidget
*widget
, GtkStyle
*style
,
230 int x
, int y
, int width
, int height
, CLRectangle
*r
)
232 if (r
->gradient_type
== CL_GRADIENT_NONE
||
233 r
->fill_gradient
.from
== NULL
|| r
->fill_gradient
.to
== NULL
)
235 gdk_draw_rectangle (window
, r
->fillgc
, TRUE
,
236 x
+1, y
+1, width
-2, height
-2);
238 else if (r
->gradient_type
== CL_GRADIENT_HORIZONTAL
)
240 draw_vgradient (window
, r
->fillgc
, gtk_widget_get_style(widget
),
241 x
+1, y
+1, width
-2, height
-2,
242 r
->fill_gradient
.from
, r
->fill_gradient
.to
);
244 else if (r
->gradient_type
== CL_GRADIENT_VERTICAL
)
246 draw_hgradient (window
, r
->fillgc
, gtk_widget_get_style(widget
),
247 x
+1, y
+1, width
-2, height
-2,
248 r
->fill_gradient
.from
, r
->fill_gradient
.to
);
252 void cl_rectangle_set_button(CLRectangle
*r
, GtkStyle
*style
,
253 GtkStateType state_type
, gboolean has_default
,
255 CLBorderType tl
, CLBorderType tr
,
256 CLBorderType bl
, CLBorderType br
)
258 ClearlooksStyle
*clearlooks_style
= CLEARLOOKS_STYLE (style
);
259 int my_state_type
= (state_type
== GTK_STATE_ACTIVE
) ? 2 : 0;
260 GdkGC
*border_gc
= clearlooks_style
->border_gc
[CL_BORDER_UPPER
+my_state_type
];
263 cl_rectangle_init (r
, style
->bg_gc
[state_type
],
264 clearlooks_style
->border_gc
[CL_BORDER_UPPER
+my_state_type
],
267 if (state_type
!= GTK_STATE_INSENSITIVE
&& !has_default
)
269 cl_rectangle_set_gradient (&r
->border_gradient
,
270 &clearlooks_style
->border
[CL_BORDER_UPPER
+my_state_type
],
271 &clearlooks_style
->border
[CL_BORDER_LOWER
+my_state_type
]);
273 else if (has_default
)
274 r
->bordergc
= style
->black_gc
;
276 r
->bordergc
= clearlooks_style
->shade_gc
[4];
278 r
->gradient_type
= CL_GRADIENT_VERTICAL
;
280 r
->topleft
= (state_type
!= GTK_STATE_ACTIVE
) ? style
->light_gc
[state_type
] : clearlooks_style
->shade_gc
[4];
281 r
->bottomright
= (state_type
!= GTK_STATE_ACTIVE
) ? clearlooks_style
->shade_gc
[1] : NULL
;
283 shade (&style
->bg
[state_type
], &r
->tmp_color
, 0.93);
286 cl_rectangle_set_gradient (&r
->fill_gradient
,
287 &style
->bg
[state_type
],
291 void cl_rectangle_set_entry (CLRectangle
*r
, GtkStyle
*style
,
292 GtkStateType state_type
,
293 CLBorderType tl
, CLBorderType tr
,
294 CLBorderType bl
, CLBorderType br
,
297 ClearlooksStyle
*clearlooks_style
= CLEARLOOKS_STYLE (style
);
301 bordergc
= clearlooks_style
->spot3_gc
;
302 else if (state_type
!= GTK_STATE_INSENSITIVE
)
303 bordergc
= clearlooks_style
->border_gc
[CL_BORDER_LOWER
];
305 bordergc
= clearlooks_style
->shade_gc
[3];
307 cl_rectangle_init (r
, style
->base_gc
[state_type
], bordergc
,
310 if (state_type
!= GTK_STATE_INSENSITIVE
)
311 r
->topleft
= (has_focus
) ? clearlooks_style
->spot1_gc
312 : style
->bg_gc
[GTK_STATE_NORMAL
];
315 r
->bottomright
= clearlooks_style
->spot1_gc
;
316 else if (state_type
== GTK_STATE_INSENSITIVE
)
317 r
->bottomright
= style
->base_gc
[state_type
];
320 void cl_draw_shadow(GdkWindow
*window
, GtkWidget
*widget
, GtkStyle
*style
,
321 int x
, int y
, int width
, int height
, CLRectangle
*r
)
323 ClearlooksStyle
*clearlooks_style
= CLEARLOOKS_STYLE (style
);
326 if (r
->bottomright
!= NULL
)
328 x1
= x
+1+(r
->corners
[CL_CORNER_BOTTOMLEFT
]/2);
329 y1
= y2
= y
+height
-2;
330 x2
= x
+width
- 1 - (1+r
->corners
[CL_CORNER_BOTTOMRIGHT
]/2);
332 gdk_draw_line (window
, r
->bottomright
, x1
, y1
, x2
, y2
);
335 y1
= y
+1+(r
->corners
[CL_CORNER_TOPRIGHT
]/2);
336 y2
= y
+height
- 1 - (1+r
->corners
[CL_CORNER_BOTTOMRIGHT
]/2);
338 gdk_draw_line (window
, r
->bottomright
, x1
, y1
, x2
, y2
);
341 if (r
->topleft
!= NULL
)
343 x1
= x
+1+(r
->corners
[CL_CORNER_TOPLEFT
]/2);
345 x2
= x
+width
-1-(1+r
->corners
[CL_CORNER_TOPRIGHT
]/2);
347 gdk_draw_line (window
, r
->topleft
, x1
, y1
, x2
, y2
);
350 y1
= y
+1+(r
->corners
[CL_CORNER_TOPLEFT
]/2);
351 y2
= y
+height
-1-(1+r
->corners
[CL_CORNER_BOTTOMLEFT
]/2);
353 gdk_draw_line (window
, r
->topleft
, x1
, y1
, x2
, y2
);
357 void cl_rectangle_set_color (CLGradient
*g
, GdkColor
*color
)
363 void cl_rectangle_set_gradient (CLGradient
*g
, GdkColor
*from
, GdkColor
*to
)
369 void cl_rectangle_init (CLRectangle
*r
,
370 GdkGC
*fillgc
, GdkGC
*bordergc
,
371 int tl
, int tr
, int bl
, int br
)
373 r
->gradient_type
= CL_GRADIENT_NONE
;
375 r
->border_gradient
.from
= r
->border_gradient
.to
= NULL
;
376 r
->fill_gradient
.from
= r
->fill_gradient
.to
= NULL
;
379 r
->bordergc
= bordergc
;
382 r
->bottomright
= NULL
;
384 r
->corners
[CL_CORNER_TOPLEFT
] = tl
;
385 r
->corners
[CL_CORNER_TOPRIGHT
] = tr
;
386 r
->corners
[CL_CORNER_BOTTOMLEFT
] = bl
;
387 r
->corners
[CL_CORNER_BOTTOMRIGHT
] = br
;
390 void cl_rectangle_set_corners (CLRectangle
*r
, int tl
, int tr
, int bl
, int br
)
392 r
->corners
[CL_CORNER_TOPLEFT
] = tl
;
393 r
->corners
[CL_CORNER_TOPRIGHT
] = tr
;
394 r
->corners
[CL_CORNER_BOTTOMLEFT
] = bl
;
395 r
->corners
[CL_CORNER_BOTTOMRIGHT
] = br
;
398 void cl_set_corner_sharpness (const gchar
*detail
, GtkWidget
*widget
, CLRectangle
*r
)
400 if (widget
->parent
&& GTK_IS_COMBO_BOX_ENTRY (widget
->parent
) || GTK_IS_COMBO (widget
->parent
))
402 gboolean rtl
= get_direction (widget
->parent
) == GTK_TEXT_DIR_RTL
;
403 int cl
= rtl
? CL_CORNER_ROUND
: CL_CORNER_NONE
;
404 int cr
= rtl
? CL_CORNER_NONE
: CL_CORNER_ROUND
;
406 cl_rectangle_set_corners (r
, cl
, cr
, cl
, cr
);
408 else if (detail
&& !strcmp (detail
, "spinbutton_up"))
410 gboolean rtl
= get_direction (widget
->parent
) == GTK_TEXT_DIR_RTL
;
411 int tl
= rtl
? CL_CORNER_ROUND
: CL_CORNER_NONE
;
412 int tr
= rtl
? CL_CORNER_NONE
: CL_CORNER_ROUND
;
414 cl_rectangle_set_corners (r
, tl
, tr
,
415 CL_CORNER_NONE
, CL_CORNER_NONE
);
417 else if (detail
&& !strcmp (detail
, "spinbutton_down"))
419 gboolean rtl
= get_direction (widget
->parent
) == GTK_TEXT_DIR_RTL
;
420 int bl
= rtl
? CL_CORNER_ROUND
: CL_CORNER_NONE
;
421 int br
= rtl
? CL_CORNER_NONE
: CL_CORNER_ROUND
;
423 cl_rectangle_set_corners (r
, CL_CORNER_NONE
, CL_CORNER_NONE
,
428 cl_rectangle_set_corners (r
, CL_CORNER_ROUND
, CL_CORNER_ROUND
,
429 CL_CORNER_ROUND
, CL_CORNER_ROUND
);
433 void cl_rectangle_set_clip_rectangle (CLRectangle
*r
, GdkRectangle
*area
)
439 gdk_gc_set_clip_rectangle (r
->fillgc
, area
);
442 gdk_gc_set_clip_rectangle (r
->bordergc
, area
);
445 gdk_gc_set_clip_rectangle (r
->topleft
, area
);
448 gdk_gc_set_clip_rectangle (r
->bottomright
, area
);
451 void cl_rectangle_reset_clip_rectangle (CLRectangle
*r
)
454 gdk_gc_set_clip_rectangle (r
->fillgc
, NULL
);
457 gdk_gc_set_clip_rectangle (r
->bordergc
, NULL
);
460 gdk_gc_set_clip_rectangle (r
->topleft
, NULL
);
463 gdk_gc_set_clip_rectangle (r
->bottomright
, NULL
);
466 void cl_rectangle_reset (CLRectangle
*r
, GtkStyle
*style
)
468 cl_rectangle_init (r
,
470 CL_CORNER_ROUND
, CL_CORNER_ROUND
,
471 CL_CORNER_ROUND
, CL_CORNER_ROUND
);
474 static void cl_progressbar_points_transform (GdkPoint
*points
, int npoints
,
475 int offset
, gboolean is_horizontal
)
478 for ( i
=0; i
<npoints
; i
++) {
480 points
[i
].x
+= offset
;
482 points
[i
].y
+= offset
;
486 GdkPixmap
* cl_progressbar_tile_new (GdkDrawable
*drawable
, GtkWidget
*widget
,
487 GtkStyle
*style
, gint height
, gint offset
)
489 ClearlooksStyle
*clearlooks_style
= CLEARLOOKS_STYLE (style
);
492 int center
= width
/2;
496 int stripe_width
= height
/2;
497 int topright
= height
+ stripe_width
;
498 int topright_div_2
= topright
/2;
503 GtkProgressBarOrientation orientation
= gtk_progress_bar_get_orientation (GTK_PROGRESS_BAR (widget
));
504 gboolean is_horizontal
= (orientation
== GTK_PROGRESS_LEFT_TO_RIGHT
|| orientation
== GTK_PROGRESS_RIGHT_TO_LEFT
) ? 1 : 0;
506 GdkPixmap
*tmp
= gdk_pixmap_new (widget
->window
, width
, height
, -1);
509 shade (&clearlooks_style
->spot2
, &tmp_color
, 0.90);
512 draw_hgradient (tmp
, style
->black_gc
, style
, 0, 0, width
, height
,
513 &clearlooks_style
->spot2
, &tmp_color
);
515 draw_vgradient (tmp
, style
->black_gc
, style
, 0, 0, width
, height
,
516 &tmp_color
, &clearlooks_style
->spot2
); /* TODO: swap for RTL */
518 if (orientation
== GTK_PROGRESS_RIGHT_TO_LEFT
||
519 orientation
== GTK_PROGRESS_BOTTOM_TO_TOP
)
525 if (get_direction (widget
) == GTK_TEXT_DIR_RTL
)
530 points
[0] = (GdkPoint
){xdir
*(topright
- stripe_width
- topright_div_2
), 0}; /* topleft */
531 points
[1] = (GdkPoint
){xdir
*(topright
- topright_div_2
), 0}; /* topright */
532 points
[2] = (GdkPoint
){xdir
*(stripe_width
- topright_div_2
), height
}; /* bottomright */
533 points
[3] = (GdkPoint
){xdir
*(-topright_div_2
), height
}; /* bottomleft */
537 points
[0] = (GdkPoint
){height
, xdir
*(topright
- stripe_width
- topright_div_2
)}; /* topleft */
538 points
[1] = (GdkPoint
){height
, xdir
*(topright
- topright_div_2
)}; /* topright */
539 points
[2] = (GdkPoint
){0, xdir
*(stripe_width
- topright_div_2
)}; /* bottomright */
540 points
[3] = (GdkPoint
){0, xdir
*(-topright_div_2
)}; /* bottomleft */
544 shift
= (stripe_width
*2)/(double)10;
545 cl_progressbar_points_transform (points
, 4, (offset
*shift
), is_horizontal
);
547 trans
= (width
/2)-1-(stripe_width
*2);
548 cl_progressbar_points_transform (points
, 4, trans
, is_horizontal
);
549 gdk_draw_polygon (tmp
, clearlooks_style
->spot2_gc
, TRUE
, points
, 4);
550 cl_progressbar_points_transform (points
, 4, -trans
, is_horizontal
);
553 cl_progressbar_points_transform (points
, 4, trans
, is_horizontal
);
554 gdk_draw_polygon (tmp
, clearlooks_style
->spot2_gc
, TRUE
, points
, 4);
555 cl_progressbar_points_transform (points
, 4, -trans
, is_horizontal
);
557 trans
= (width
/2)-1+(stripe_width
*2);
558 cl_progressbar_points_transform (points
, 4, trans
, is_horizontal
);
559 gdk_draw_polygon (tmp
, clearlooks_style
->spot2_gc
, TRUE
, points
, 4);
564 /* could be improved, I think. */
565 void cl_progressbar_fill (GdkDrawable
*drawable
, GtkWidget
*widget
,
566 GtkStyle
*style
, GdkGC
*gc
,
568 gint width
, gint height
,
569 guint8 offset
, GdkRectangle
*area
)
571 GtkProgressBarOrientation orientation
= gtk_progress_bar_get_orientation (GTK_PROGRESS_BAR (widget
));
572 gint size
= (orientation
== GTK_PROGRESS_LEFT_TO_RIGHT
|| orientation
== GTK_PROGRESS_RIGHT_TO_LEFT
) ? height
: width
;
573 GdkPixmap
*tile
= cl_progressbar_tile_new (widget
->window
, widget
, style
, size
, offset
);
580 gdk_gc_set_clip_rectangle (gc
, area
);
584 case GTK_PROGRESS_LEFT_TO_RIGHT
:
586 while (nx
<= x
+ width
)
588 if (nx
+ nwidth
> x
+width
) nwidth
= (x
+width
) - nx
;
589 gdk_draw_drawable (drawable
, gc
, tile
, 0, 0, nx
, y
, nwidth
, height
);
593 nx
+= (height
-1 + !(height
% 2));
597 case GTK_PROGRESS_RIGHT_TO_LEFT
:
599 gint src_x
= 0, dst_x
;
609 gdk_draw_drawable (drawable
, gc
, tile
, src_x
, 0, dst_x
, y
, nwidth
, height
);
613 nx
-= (height
-1 + !(height
% 2));
617 case GTK_PROGRESS_TOP_TO_BOTTOM
:
619 while (ny
<= y
+ height
)
621 if (ny
+ nheight
> y
+height
) nheight
= (y
+height
) - ny
;
622 gdk_draw_drawable (drawable
, gc
, tile
, 0, 0, x
, ny
, width
, nheight
);
626 ny
+= (width
-1 + !(width
% 2));
630 case GTK_PROGRESS_BOTTOM_TO_TOP
:
632 gint src_y
= 0, dst_y
;
642 gdk_draw_drawable (drawable
, gc
, tile
, 0, src_y
, x
, dst_y
, width
, width
);
646 ny
-= (width
-1 + !(width
% 2));
652 gdk_gc_set_clip_rectangle (gc
, NULL
);
654 g_object_unref (tile
);
657 GdkColor
cl_gc_set_fg_color_shade (GdkGC
*gc
, GdkColormap
*colormap
,
658 GdkColor
*from
, gfloat s
)
663 shade (from
, &tmp_color
, s
);
664 gdk_gc_get_values (gc
, &values
);
665 gdk_rgb_find_color (colormap
, &tmp_color
);
666 gdk_gc_set_foreground (gc
, &tmp_color
);
668 return values
.foreground
;
671 /* #warning MOVE THIS TO SUPPORT.C/H SO THE DRAW_CORNER FUNCTION CAN USE IT. OR, MAKE DRAW_CORNER USE IT SOME OTHER WAY. */
673 static void cl_get_window_style_state (GtkWidget
*widget
, GtkStyle
**style
, GtkStateType
*state_type
)
675 GtkStyle
*windowstyle
= NULL
;
676 GtkWidget
*tmpwidget
= widget
;
677 GtkStateType windowstate
;
679 if (widget
&& GTK_IS_ENTRY (widget
))
680 tmpwidget
= tmpwidget
->parent
;
682 while (tmpwidget
&& GTK_WIDGET_NO_WINDOW (tmpwidget
) && !GTK_IS_NOTEBOOK(tmpwidget
))
684 tmpwidget
= tmpwidget
->parent
;
687 *style
= tmpwidget
->style
;
688 *state_type
= GTK_WIDGET_STATE(tmpwidget
);
691 static GdkGC
*cl_get_window_bg_gc (GtkWidget
*widget
)
694 GtkStateType state_type
;
696 cl_get_window_style_state (widget
, &style
, &state_type
);
698 return style
->bg_gc
[state_type
];
701 /******************************************************************************
702 * DRAW THE MIGHTY WIDGETS! *
703 ******************************************************************************/
705 void cl_draw_inset (GtkStyle
*style
, GdkWindow
*window
, GtkWidget
*widget
,
707 gint x
, gint y
, gint width
, gint height
,
708 int tl
, int tr
, int bl
, int br
)
710 ClearlooksStyle
*clearlooks_style
= CLEARLOOKS_STYLE(style
);
711 ClearlooksStyle
*clwindowstyle
; /* style of the window this widget is on */
712 GtkStateType windowstate
;
715 cl_rectangle_init (&r
, NULL
, style
->black_gc
,
718 r
.gradient_type
= CL_GRADIENT_VERTICAL
;
720 cl_get_window_style_state(widget
, (GtkStyle
**)&clwindowstyle
, &windowstate
);
722 g_assert (clwindowstyle
!= NULL
);
724 if (GTK_WIDGET_HAS_DEFAULT (widget
))
726 r
.bordergc
= style
->mid_gc
[GTK_STATE_NORMAL
];
730 cl_rectangle_set_gradient (&r
.border_gradient
,
731 &clwindowstyle
->inset_dark
[windowstate
],
732 &clwindowstyle
->inset_light
[windowstate
]);
734 cl_rectangle_set_clip_rectangle (&r
, area
);
735 cl_draw_rectangle (window
, widget
, style
, x
, y
, width
, height
, &r
);
736 cl_rectangle_reset_clip_rectangle (&r
);
739 /* Draw a normal (toggle)button. Not spinbuttons.*/
740 void cl_draw_button(GtkStyle
*style
, GdkWindow
*window
,
741 GtkStateType state_type
, GtkShadowType shadow_type
,
743 GtkWidget
*widget
, const gchar
*detail
,
744 gint x
, gint y
, gint width
, gint height
)
746 ClearlooksStyle
*clearlooks_style
= CLEARLOOKS_STYLE(style
);
747 int my_state_type
= (state_type
== GTK_STATE_ACTIVE
) ? 2 : 0;
749 gboolean is_active
= FALSE
;
752 /* Get the background color of the window we're on */
753 bg_gc
= cl_get_window_bg_gc(widget
);
755 cl_rectangle_set_button (&r
, style
, state_type
,
756 GTK_WIDGET_HAS_DEFAULT (widget
),
757 GTK_WIDGET_HAS_FOCUS (widget
),
758 CL_CORNER_ROUND
, CL_CORNER_ROUND
,
759 CL_CORNER_ROUND
, CL_CORNER_ROUND
);
761 if (state_type
== GTK_STATE_ACTIVE
)
764 if (GTK_IS_TOGGLE_BUTTON(widget
) &&
765 gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(widget
)) &&
766 state_type
== GTK_STATE_PRELIGHT
)
768 cl_rectangle_set_gradient (&r
.fill_gradient
, &clearlooks_style
->shade
[1], &clearlooks_style
->shade
[1]);
769 r
.topleft
= clearlooks_style
->shade_gc
[3];
770 r
.bottomright
= clearlooks_style
->shade_gc
[1];
778 if (!GTK_IS_NOTEBOOK (widget
->parent
))
780 gdk_draw_rectangle (window
, bg_gc
, FALSE
, x
, y
, width
-1, height
-1);
782 /* Draw "sunken" look when border thickness is more than 2 pixels. */
783 if (style
->xthickness
> 2 && style
->ythickness
> 2)
784 cl_draw_inset (style
, window
, widget
, area
, x
, y
, width
, height
,
785 CL_CORNER_ROUND
, CL_CORNER_ROUND
,
786 CL_CORNER_ROUND
, CL_CORNER_ROUND
);
789 /* Draw "sunken" look when border thickness is more than 2 pixels.*/
790 if (style
->xthickness
> 2 && style
->ythickness
> 2)
798 /* Don't draw the normal gradient for normal buttons. */
800 cl_rectangle_set_clip_rectangle (&r
, area
);
801 cl_draw_rectangle (window
, widget
, style
, x
, y
, width
, height
, &r
);
806 int tmp_height
= (float)height
*0.25;
808 gdk_gc_set_clip_rectangle (style
->bg_gc
[state_type
], area
);
810 draw_hgradient (window
, style
->bg_gc
[state_type
], style
,
811 x
+2,y
+2,width
-4,tmp_height
,
812 &clearlooks_style
->button_g1
[state_type
],
813 &clearlooks_style
->button_g2
[state_type
]);
815 draw_hgradient (window
, style
->bg_gc
[state_type
], style
,
816 x
+2, y
+2+tmp_height
, width
-4, height
-3-tmp_height
*2,
817 &clearlooks_style
->button_g2
[state_type
],
818 &clearlooks_style
->button_g3
[state_type
]);
820 draw_hgradient (window
, style
->bg_gc
[state_type
], style
,
821 x
+2,y
+height
-tmp_height
-1,width
-4,tmp_height
,
822 &clearlooks_style
->button_g3
[state_type
],
823 &clearlooks_style
->button_g4
[state_type
]);
825 gdk_gc_set_clip_rectangle (style
->bg_gc
[state_type
], NULL
);
828 cl_draw_shadow (window
, widget
, style
, x
, y
, width
, height
, &r
);
829 cl_rectangle_reset_clip_rectangle (&r
);
832 /* Draw spinbuttons. */
833 void cl_draw_spinbutton(GtkStyle
*style
, GdkWindow
*window
,
834 GtkStateType state_type
, GtkShadowType shadow_type
,
836 GtkWidget
*widget
, const gchar
*detail
,
837 gint x
, gint y
, gint width
, gint height
)
840 GdkRectangle new_area
;
842 int tl
= CL_CORNER_NONE
, tr
= CL_CORNER_NONE
,
843 bl
= CL_CORNER_NONE
, br
= CL_CORNER_NONE
;
849 new_area
.width
= width
;
850 new_area
.height
= height
;
854 if (!strcmp (detail
, "spinbutton")) /* draws the 'back' of the spinbutton */
856 GdkGC
*bg_gc
= cl_get_window_bg_gc(widget
);
858 gdk_gc_set_clip_rectangle (bg_gc
, area
);
859 gdk_draw_rectangle (window
, bg_gc
, FALSE
, x
, y
, width
-1, height
-1);
860 gdk_gc_set_clip_rectangle (bg_gc
, NULL
);
862 if (style
->xthickness
> 2 && style
->ythickness
> 2)
863 cl_draw_inset (style
, window
, widget
, area
, x
, y
, width
, height
,
864 CL_CORNER_NONE
, CL_CORNER_ROUND
,
865 CL_CORNER_NONE
, CL_CORNER_ROUND
);
870 if (!strcmp (detail
, "spinbutton_up"))
872 tr
= CL_CORNER_ROUND
;
874 (style
->xthickness
> 2 && style
->ythickness
> 2) ? y
++ : height
++;
877 if (!strcmp (detail
, "spinbutton_down"))
879 br
= CL_CORNER_ROUND
;
881 if (style
->xthickness
> 2 && style
->ythickness
> 2)
885 cl_rectangle_set_button (&r
, style
, state_type
,
886 GTK_WIDGET_HAS_DEFAULT (widget
),
887 GTK_WIDGET_HAS_FOCUS (widget
),
892 cl_rectangle_set_clip_rectangle (&r
, area
);
893 cl_draw_rectangle (window
, widget
, style
, x
, y
, width
, height
, &r
);
894 cl_draw_shadow (window
, widget
, style
, x
, y
, width
, height
, &r
);
895 cl_rectangle_reset_clip_rectangle (&r
);
898 void cl_draw_combobox_entry (GtkStyle
*style
, GdkWindow
*window
,
899 GtkStateType state_type
, GtkShadowType shadow_type
,
901 GtkWidget
*widget
, const gchar
*detail
,
902 gint x
, gint y
, gint width
, gint height
)
906 gboolean rtl
= get_direction (widget
->parent
) == GTK_TEXT_DIR_RTL
;
907 gboolean has_focus
= GTK_WIDGET_HAS_FOCUS (widget
);
909 int cl
= rtl
? CL_CORNER_NONE
: CL_CORNER_ROUND
,
910 cr
= rtl
? CL_CORNER_ROUND
: CL_CORNER_NONE
;
912 GdkGC
*bg_gc
= cl_get_window_bg_gc(widget
);
925 if (has_focus
) width
--; /* this gives us a 2px focus line at the right side. */
928 cl_rectangle_set_entry (&r
, style
, state_type
,
932 gdk_gc_set_clip_rectangle (bg_gc
, area
);
933 gdk_draw_rectangle (window
, bg_gc
, FALSE
, x
, y
, width
-1, height
-1);
934 gdk_gc_set_clip_rectangle (bg_gc
, NULL
);
936 /* Draw "sunken" look when border thickness is more than 2 pixels. */
937 if (style
->xthickness
> 2 && style
->ythickness
> 2)
939 cl_draw_inset (style
, window
, widget
, area
, x
, y
, width
, height
,
948 cl_rectangle_set_clip_rectangle (&r
, area
);
950 cl_draw_rectangle (window
, widget
, style
, x
, y
, width
, height
, &r
);
951 cl_draw_shadow (window
, widget
, style
, x
, y
, width
, height
, &r
);
953 cl_rectangle_reset_clip_rectangle (&r
);
956 void cl_draw_combobox_button (GtkStyle
*style
, GdkWindow
*window
,
957 GtkStateType state_type
, GtkShadowType shadow_type
,
959 GtkWidget
*widget
, const gchar
*detail
,
960 gint x
, gint y
, gint width
, gint height
)
962 ClearlooksStyle
*clearlooks_style
= CLEARLOOKS_STYLE(style
);
963 gboolean is_active
= FALSE
;
964 gboolean draw_inset
= FALSE
;
967 cl_rectangle_set_button (&r
, style
, state_type
,
968 GTK_WIDGET_HAS_DEFAULT (widget
),
969 GTK_WIDGET_HAS_FOCUS (widget
),
970 CL_CORNER_NONE
, CL_CORNER_ROUND
,
971 CL_CORNER_NONE
, CL_CORNER_ROUND
);
973 if (state_type
== GTK_STATE_ACTIVE
)
978 /* Seriously, why can't non-gtk-apps at least try to be decent citizens?
979 Take this fscking OpenOffice.org 1.9 for example. The morons responsible
980 for this utter piece of crap give the clip size wrong values! :'( */
987 area
->height
= height
;
993 /* Draw "sunken" look when border thickness is more than 2 pixels. */
994 if (GTK_IS_COMBO(widget
->parent
))
995 draw_inset
= (widget
->parent
->style
->xthickness
> 2 &&
996 widget
->parent
->style
->ythickness
> 2);
998 draw_inset
= (style
->xthickness
> 2 && style
->ythickness
> 2);
1002 cl_draw_inset (style
, window
, widget
, area
, x
, y
, width
, height
,
1003 CL_CORNER_NONE
, CL_CORNER_ROUND
,
1004 CL_CORNER_NONE
, CL_CORNER_ROUND
);
1018 cl_rectangle_set_clip_rectangle (&r
, area
);
1020 cl_draw_rectangle (window
, widget
, style
, x
, y
, width
, height
, &r
);
1024 int tmp_height
= (float)height
*0.25;
1026 gdk_gc_set_clip_rectangle (style
->bg_gc
[state_type
], area
);
1028 draw_hgradient (window
, style
->bg_gc
[state_type
], style
,
1029 x
+2,y
+2,width
-4,tmp_height
,
1030 &clearlooks_style
->button_g1
[state_type
],
1031 &clearlooks_style
->button_g2
[state_type
]);
1033 draw_hgradient (window
, style
->bg_gc
[state_type
], style
,
1034 x
+2, y
+2+tmp_height
, width
-4, height
-3-tmp_height
*2,
1035 &clearlooks_style
->button_g2
[state_type
],
1036 &clearlooks_style
->button_g3
[state_type
]);
1038 draw_hgradient (window
, style
->bg_gc
[state_type
], style
,
1039 x
+2,y
+height
-tmp_height
-1,width
-4,tmp_height
,
1040 &clearlooks_style
->button_g3
[state_type
],
1041 &clearlooks_style
->button_g4
[state_type
]);
1043 gdk_gc_set_clip_rectangle (style
->bg_gc
[state_type
], NULL
);
1046 cl_draw_shadow (window
, widget
, style
, x
, y
, width
, height
, &r
);
1049 cl_rectangle_reset_clip_rectangle (&r
);
1052 /* Draw text Entry */
1053 void cl_draw_entry (GtkStyle
*style
, GdkWindow
*window
,
1054 GtkStateType state_type
, GtkShadowType shadow_type
,
1056 GtkWidget
*widget
, const gchar
*detail
,
1057 gint x
, gint y
, gint width
, gint height
)
1060 gboolean has_focus
= GTK_WIDGET_HAS_FOCUS(widget
);
1061 GdkGC
*bg_gc
= cl_get_window_bg_gc(widget
);
1063 gdk_draw_rectangle (window
, bg_gc
, FALSE
, x
, y
, width
-1, height
-1);
1065 gtk_style_apply_default_background (style
, window
, TRUE
, state_type
,
1066 area
, x
+1, y
+1, width
-2, height
-2);
1069 cl_rectangle_set_entry (&r
, style
, state_type
,
1070 CL_CORNER_ROUND
, CL_CORNER_ROUND
,
1071 CL_CORNER_ROUND
, CL_CORNER_ROUND
,
1074 /* Draw "sunken" look when border thickness is more than 2 pixels. */
1075 if (style
->xthickness
> 2 && style
->ythickness
> 2)
1077 cl_draw_inset (style
, window
, widget
, area
, x
, y
, width
, height
,
1078 CL_CORNER_ROUND
, CL_CORNER_ROUND
,
1079 CL_CORNER_ROUND
, CL_CORNER_ROUND
);
1087 cl_rectangle_set_clip_rectangle (&r
, area
);
1088 cl_draw_rectangle (window
, widget
, style
, x
, y
, width
, height
, &r
);
1089 cl_draw_shadow (window
, widget
, style
, x
, y
, width
, height
, &r
);
1090 cl_rectangle_reset_clip_rectangle (&r
);
1093 void cl_draw_optionmenu(GtkStyle
*style
, GdkWindow
*window
,
1094 GtkStateType state_type
, GtkShadowType shadow_type
,
1095 GdkRectangle
*area
, GtkWidget
*widget
,
1096 const gchar
*detail
,
1097 gint x
, gint y
, gint width
, gint height
)
1099 ClearlooksStyle
*clearlooks_style
= CLEARLOOKS_STYLE(style
);
1100 GtkRequisition indicator_size
;
1101 GtkBorder indicator_spacing
;
1104 option_menu_get_props (widget
, &indicator_size
, &indicator_spacing
);
1106 if (get_direction (widget
) == GTK_TEXT_DIR_RTL
)
1107 line_pos
= x
+ (indicator_size
.width
+ indicator_spacing
.left
+ indicator_spacing
.right
) + style
->xthickness
;
1109 line_pos
= x
+ width
- (indicator_size
.width
+ indicator_spacing
.left
+ indicator_spacing
.right
) - style
->xthickness
;
1111 cl_draw_button (style
, window
, state_type
, shadow_type
, area
, widget
, detail
, x
, y
, width
, height
);
1113 gdk_draw_line (window
, clearlooks_style
->shade_gc
[3],
1114 line_pos
, y
+ style
->ythickness
- 1, line_pos
,
1115 y
+ height
- style
->ythickness
);
1117 gdk_draw_line (window
, style
->light_gc
[state_type
],
1118 line_pos
+1, y
+ style
->ythickness
- 1, line_pos
+1,
1119 y
+ height
- style
->ythickness
);
1123 void cl_draw_menuitem_button (GdkDrawable
*window
, GtkWidget
*widget
, GtkStyle
*style
,
1124 GdkRectangle
*area
, GtkStateType state_type
,
1125 int x
, int y
, int width
, int height
, CLRectangle
*r
)
1127 ClearlooksStyle
*clearlooks_style
= (ClearlooksStyle
*)style
;
1128 gboolean menubar
= (widget
->parent
&& GTK_IS_MENU_BAR(widget
->parent
)) ? TRUE
: FALSE
;
1129 int corner
= CL_CORNER_NARROW
;
1130 GdkColor lower_color
;
1132 shade (&style
->base
[GTK_STATE_SELECTED
], &lower_color
, 0.85);
1137 corner
= CL_CORNER_NONE
;
1138 r
->bordergc
= clearlooks_style
->border_gc
[CL_BORDER_UPPER
];
1142 r
->bordergc
= clearlooks_style
->spot3_gc
;
1145 cl_rectangle_set_corners (r
, corner
, corner
, corner
, corner
);
1147 cl_rectangle_set_gradient (&r
->fill_gradient
,
1148 &style
->base
[GTK_STATE_SELECTED
], &lower_color
);
1150 r
->gradient_type
= CL_GRADIENT_VERTICAL
;
1152 r
->fillgc
= clearlooks_style
->spot2_gc
;
1153 r
->topleft
= clearlooks_style
->spot1_gc
;
1155 cl_rectangle_set_clip_rectangle (r
, area
);
1156 cl_draw_rectangle (window
, widget
, style
, x
, y
, width
, height
, r
);
1157 cl_draw_shadow (window
, widget
, style
, x
, y
, width
, height
, r
);
1158 cl_rectangle_reset_clip_rectangle (r
);
1161 void cl_draw_menuitem_flat (GdkDrawable
*window
, GtkWidget
*widget
, GtkStyle
*style
,
1162 GdkRectangle
*area
, GtkStateType state_type
,
1163 int x
, int y
, int width
, int height
, CLRectangle
*r
)
1165 ClearlooksStyle
*clearlooks_style
= (ClearlooksStyle
*)style
;
1166 gboolean menubar
= (widget
->parent
&& GTK_IS_MENU_BAR(widget
->parent
)) ? TRUE
: FALSE
;
1169 cl_rectangle_set_corners (r
, CL_CORNER_NARROW
, CL_CORNER_NARROW
,
1170 CL_CORNER_NARROW
, CL_CORNER_NARROW
);
1172 tmp
= cl_gc_set_fg_color_shade (style
->black_gc
, style
->colormap
,
1173 &style
->base
[GTK_STATE_PRELIGHT
], 0.8);
1175 r
->bordergc
= style
->black_gc
;
1176 r
->fillgc
= style
->base_gc
[GTK_STATE_PRELIGHT
];
1178 if (menubar
) height
++;
1180 cl_rectangle_set_clip_rectangle (r
, area
);
1181 cl_draw_rectangle (window
, widget
, style
, x
, y
, width
, height
, r
);
1182 cl_rectangle_reset_clip_rectangle (r
);
1184 gdk_gc_set_foreground (style
->black_gc
, &tmp
);
1187 void cl_draw_menuitem_gradient (GdkDrawable
*window
, GtkWidget
*widget
, GtkStyle
*style
,
1188 GdkRectangle
*area
, GtkStateType state_type
,
1189 int x
, int y
, int width
, int height
, CLRectangle
*r
)
1191 ClearlooksStyle
*clearlooks_style
= (ClearlooksStyle
*)style
;
1192 gboolean menubar
= (widget
->parent
&& GTK_IS_MENU_BAR(widget
->parent
)) ? TRUE
: FALSE
;
1194 GdkColor lower_color
;
1196 shade (&style
->base
[GTK_STATE_SELECTED
], &lower_color
, 0.8);
1198 cl_rectangle_set_corners (r
, CL_CORNER_NARROW
, CL_CORNER_NARROW
,
1199 CL_CORNER_NARROW
, CL_CORNER_NARROW
);
1201 cl_rectangle_set_gradient (&r
->fill_gradient
,
1202 &style
->base
[GTK_STATE_SELECTED
], &lower_color
);
1204 r
->gradient_type
= CL_GRADIENT_VERTICAL
;
1206 tmp
= cl_gc_set_fg_color_shade (style
->black_gc
, style
->colormap
,
1207 &style
->base
[GTK_STATE_PRELIGHT
], 0.8);
1209 r
->bordergc
= style
->black_gc
;
1210 r
->fillgc
= style
->base_gc
[GTK_STATE_PRELIGHT
];
1212 if (menubar
) height
++;
1214 cl_rectangle_set_clip_rectangle (r
, area
);
1215 cl_draw_rectangle (window
, widget
, style
, x
, y
, width
, height
, r
);
1216 cl_rectangle_reset_clip_rectangle (r
);
1218 gdk_gc_set_foreground (style
->black_gc
, &tmp
);
1221 void cl_draw_treeview_header (GtkStyle
*style
, GdkWindow
*window
,
1222 GtkStateType state_type
, GtkShadowType shadow_type
,
1224 GtkWidget
*widget
, const gchar
*detail
,
1225 gint x
, gint y
, gint width
, gint height
)
1227 ClearlooksStyle
*clearlooks_style
= CLEARLOOKS_STYLE (style
);
1228 gint columns
= 0, column_index
= -1, fill_width
= width
;
1229 gboolean is_etree
= strcmp("ETree", G_OBJECT_TYPE_NAME(widget
->parent
)) == 0;
1230 gboolean resizable
= TRUE
;
1232 GdkGC
*bottom
= clearlooks_style
->shade_gc
[5];
1234 if ( width
< 2 || height
< 2 )
1237 if (GTK_IS_TREE_VIEW (widget
->parent
))
1239 gtk_treeview_get_header_index (GTK_TREE_VIEW(widget
->parent
),
1240 widget
, &column_index
, &columns
,
1243 else if (GTK_IS_CLIST (widget
->parent
))
1245 gtk_clist_get_header_index (GTK_CLIST(widget
->parent
),
1246 widget
, &column_index
, &columns
);
1251 gdk_gc_set_clip_rectangle (clearlooks_style
->shade_gc
[0], area
);
1252 gdk_gc_set_clip_rectangle (clearlooks_style
->shade_gc
[4], area
);
1253 gdk_gc_set_clip_rectangle (style
->bg_gc
[state_type
], area
);
1254 gdk_gc_set_clip_rectangle (clearlooks_style
->shade_gc
[5], area
);
1257 if (state_type
!= GTK_STATE_NORMAL
)
1260 gdk_draw_rectangle (window
, style
->bg_gc
[state_type
], TRUE
, x
, y
, fill_width
, height
-(height
/3)+1);
1262 draw_hgradient (window
, style
->bg_gc
[state_type
], style
,
1263 x
, 1+y
+height
-(height
/3), fill_width
, height
/3,
1264 &style
->bg
[state_type
], &clearlooks_style
->inset_dark
[state_type
]);
1266 if (resizable
|| (column_index
!= columns
-1))
1268 gdk_draw_line (window
, clearlooks_style
->shade_gc
[4], x
+width
-2, y
+4, x
+width
-2, y
+height
-5);
1269 gdk_draw_line (window
, clearlooks_style
->shade_gc
[0], x
+width
-1, y
+4, x
+width
-1, y
+height
-5);
1272 /* left light line */
1273 if (column_index
== 0)
1274 gdk_draw_line (window
, clearlooks_style
->shade_gc
[0], x
, y
+1, x
, y
+height
-2);
1276 /* top light line */
1277 gdk_draw_line (window
, clearlooks_style
->shade_gc
[0], x
, y
, x
+width
-1, y
);
1279 /* bottom dark line */
1280 if (state_type
== GTK_STATE_INSENSITIVE
)
1281 bottom
= clearlooks_style
->shade_gc
[3];
1284 gdk_draw_line (window
, bottom
, x
, y
+height
-1, x
+width
-1, y
+height
-1);
1288 gdk_gc_set_clip_rectangle (clearlooks_style
->shade_gc
[0], NULL
);
1289 gdk_gc_set_clip_rectangle (clearlooks_style
->shade_gc
[4], NULL
);
1290 gdk_gc_set_clip_rectangle (style
->bg_gc
[state_type
], NULL
);
1291 gdk_gc_set_clip_rectangle (clearlooks_style
->shade_gc
[5], NULL
);