aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/e-calendar-view.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui/e-calendar-view.c')
-rw-r--r--calendar/gui/e-calendar-view.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 3b9c0758de..f405cd80b4 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -2261,4 +2261,52 @@ e_calendar_view_get_tooltips (ECalendarViewEventData *data)
return FALSE;
}
-
+void
+draw_curved_rectangle (cairo_t *cr, double x0, double y0,
+ double rect_width, double rect_height,
+ double radius)
+{
+ double x1, y1;
+
+ x1 = x0 + rect_width;
+ y1 = y0 + rect_height;
+
+ if (!rect_width || !rect_height)
+ return;
+ if (rect_width / 2 < radius) {
+ if (rect_height / 2 < radius) {
+ cairo_move_to (cr, x0, (y0 + y1)/2);
+ cairo_curve_to (cr, x0 ,y0, x0, y0, (x0 + x1)/2, y0);
+ cairo_curve_to (cr, x1, y0, x1, y0, x1, (y0 + y1)/2);
+ cairo_curve_to (cr, x1, y1, x1, y1, (x1 + x0)/2, y1);
+ cairo_curve_to (cr, x0, y1, x0, y1, x0, (y0 + y1)/2);
+ } else {
+ cairo_move_to (cr, x0, y0 + radius);
+ cairo_curve_to (cr, x0 ,y0, x0, y0, (x0 + x1)/2, y0);
+ cairo_curve_to (cr, x1, y0, x1, y0, x1, y0 + radius);
+ cairo_line_to (cr, x1 , y1 - radius);
+ cairo_curve_to (cr, x1, y1, x1, y1, (x1 + x0)/2, y1);
+ cairo_curve_to (cr, x0, y1, x0, y1, x0, y1- radius);
+ }
+ } else {
+ if (rect_height / 2 < radius) {
+ cairo_move_to (cr, x0, (y0 + y1)/2);
+ cairo_curve_to (cr, x0 , y0, x0 , y0, x0 + radius, y0);
+ cairo_line_to (cr, x1 - radius, y0);
+ cairo_curve_to (cr, x1, y0, x1, y0, x1, (y0 + y1)/2);
+ cairo_curve_to (cr, x1, y1, x1, y1, x1 - radius, y1);
+ cairo_line_to (cr, x0 + radius, y1);
+ cairo_curve_to (cr, x0, y1, x0, y1, x0, (y0 + y1)/2);
+ } else {
+ cairo_move_to (cr, x0, y0 + radius);
+ cairo_curve_to (cr, x0 , y0, x0 , y0, x0 + radius, y0);
+ cairo_line_to (cr, x1 - radius, y0);
+ cairo_curve_to (cr, x1, y0, x1, y0, x1, y0 + radius);
+ cairo_line_to (cr, x1 , y1 - radius);
+ cairo_curve_to (cr, x1, y1, x1, y1, x1 - radius, y1);
+ cairo_line_to (cr, x0 + radius, y1);
+ cairo_curve_to (cr, x0, y1, x0, y1, x0, y1- radius);
+ }
+ }
+ cairo_close_path (cr);
+}