aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2001-07-01 10:04:46 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2001-07-01 10:04:46 +0800
commit915c3e0e0cfa6ca8751455c19fd509ac0855652d (patch)
treec9172a3c0546182cc23b9c440e945fef3ec7808c /calendar/gui
parent1a5710ebc0c786cb102578c0eb5ee82a979c3065 (diff)
downloadgsoc2013-evolution-915c3e0e0cfa6ca8751455c19fd509ac0855652d.tar
gsoc2013-evolution-915c3e0e0cfa6ca8751455c19fd509ac0855652d.tar.gz
gsoc2013-evolution-915c3e0e0cfa6ca8751455c19fd509ac0855652d.tar.bz2
gsoc2013-evolution-915c3e0e0cfa6ca8751455c19fd509ac0855652d.tar.lz
gsoc2013-evolution-915c3e0e0cfa6ca8751455c19fd509ac0855652d.tar.xz
gsoc2013-evolution-915c3e0e0cfa6ca8751455c19fd509ac0855652d.tar.zst
gsoc2013-evolution-915c3e0e0cfa6ca8751455c19fd509ac0855652d.zip
draw icons per category
2001-07-01 Rodrigo Moya <rodrigo@ximian.com> * gui/e-day-view-main-item.c (e_day_view_main_item_draw_day_event): draw icons per category * gui/e-day-view-top-item.c (e_day_view_top_item_draw_long_event): draw icons per category * gui/e-day-view.c (e_day_view_reshape_long_event): (e_day_view_reshape_day_event): calculate space for category icons * gui/e-week-view-event-item.c (e_week_view_event_item_draw_icons): draw icons per category * gui/e-week-view.c (e_week_view_reshape_event_span): calculate space for category icons svn path=/trunk/; revision=10646
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/e-day-view-main-item.c41
-rw-r--r--calendar/gui/e-day-view-top-item.c28
-rw-r--r--calendar/gui/e-day-view.c12
-rw-r--r--calendar/gui/e-week-view-event-item.c29
-rw-r--r--calendar/gui/e-week-view.c7
5 files changed, 117 insertions, 0 deletions
diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c
index 0f5f37ce52..6c7d47c911 100644
--- a/calendar/gui/e-day-view-main-item.c
+++ b/calendar/gui/e-day-view-main-item.c
@@ -465,6 +465,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
gint num_icons, icon_x, icon_y, icon_x_inc, icon_y_inc;
gint max_icon_w, max_icon_h;
gboolean draw_reminder_icon, draw_recurrence_icon;
+ GSList *categories_list, *elem;
day_view = dvmitem->day_view;
@@ -574,6 +575,9 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
num_icons++;
}
+ cal_component_get_categories_list (comp, &categories_list);
+ num_icons += g_slist_length (categories_list);
+
if (num_icons != 0) {
if (item_h >= (E_DAY_VIEW_ICON_HEIGHT + E_DAY_VIEW_ICON_Y_PAD)
* num_icons) {
@@ -620,9 +624,46 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem,
max_icon_w),
MIN (E_DAY_VIEW_ICON_HEIGHT,
max_icon_h));
+
+ icon_x += icon_x_inc;
+ icon_y += icon_y_inc;
+ }
+
+ /* draw icons per category */
+ for (elem = categories_list; elem; elem = elem->next) {
+ char *category;
+ GdkPixmap *pixmap;
+ GdkBitmap *mask;
+
+ category = (char *) elem->data;
+ /* FIXME: get icon for this category */
+ pixmap = day_view->recurrence_icon;
+ mask = day_view->recurrence_mask;
+
+ max_icon_w = item_x + item_w - icon_x
+ - E_DAY_VIEW_EVENT_BORDER_WIDTH;
+ max_icon_h = item_y + item_h - icon_y
+ - E_DAY_VIEW_EVENT_BORDER_HEIGHT;
+
+ gdk_gc_set_clip_origin (gc, icon_x, icon_y);
+ gdk_gc_set_clip_mask (gc, mask);
+ gdk_draw_pixmap (drawable, gc,
+ pixmap,
+ 0, 0, icon_x, icon_y,
+ MIN (E_DAY_VIEW_ICON_WIDTH,
+ max_icon_w),
+ MIN (E_DAY_VIEW_ICON_HEIGHT,
+ max_icon_h));
+
+ icon_x += icon_x_inc;
+ icon_y += icon_y_inc;
}
+
gdk_gc_set_clip_mask (gc, NULL);
}
+
+ /* free memory */
+ cal_component_free_categories_list (categories_list);
}
diff --git a/calendar/gui/e-day-view-top-item.c b/calendar/gui/e-day-view-top-item.c
index d608e68c04..cf89ba06ba 100644
--- a/calendar/gui/e-day-view-top-item.c
+++ b/calendar/gui/e-day-view-top-item.c
@@ -359,6 +359,7 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
gchar *suffix;
gboolean draw_start_triangle, draw_end_triangle;
GdkRectangle clip_rect;
+ GSList *categories_list, *elem;
day_view = dvtitem->day_view;
@@ -567,6 +568,33 @@ e_day_view_top_item_draw_long_event (EDayViewTopItem *dvtitem,
E_DAY_VIEW_ICON_HEIGHT);
icon_x -= icon_x_inc;
}
+
+ /* draw categories icons */
+ cal_component_get_categories_list (comp, &categories_list);
+ for (elem = categories_list; elem; elem = elem->next) {
+ char *category;
+ GdkPixmap *pixmap;
+ GdkBitmap *mask;
+
+ category = (char *) elem->data;
+ /* FIXME: get icon for this category */
+ pixmap = day_view->recurrence_icon;
+ mask = day_view->recurrence_mask;
+
+ if (icon_x <= max_icon_x) {
+ gdk_gc_set_clip_origin (gc, icon_x, icon_y);
+ gdk_gc_set_clip_mask (gc, mask);
+ gdk_draw_pixmap (drawable, gc,
+ pixmap,
+ 0, 0, icon_x, icon_y,
+ E_DAY_VIEW_ICON_WIDTH,
+ E_DAY_VIEW_ICON_HEIGHT);
+ icon_x -= icon_x_inc;
+ }
+ }
+
+ cal_component_free_categories_list (categories_list);
+
gdk_gc_set_clip_mask (gc, NULL);
}
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index b8564647d0..38623cdc6d 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -4431,10 +4431,16 @@ e_day_view_reshape_long_event (EDayView *day_view,
}
if (show_icons) {
+ GSList *categories_list, *elem;
+
if (cal_component_has_alarms (comp))
num_icons++;
if (cal_component_has_recurrences (comp))
num_icons++;
+
+ cal_component_get_categories_list (comp, &categories_list);
+ num_icons += g_slist_length (categories_list);
+ cal_component_free_categories_list (categories_list);
}
if (!event->canvas_item) {
@@ -4562,10 +4568,16 @@ e_day_view_reshape_day_event (EDayView *day_view,
if (day_view->resize_drag_pos == E_DAY_VIEW_POS_NONE
|| day_view->resize_event_day != day
|| day_view->resize_event_num != event_num) {
+ GSList *categories_list;
+
if (cal_component_has_alarms (comp))
num_icons++;
if (cal_component_has_recurrences (comp))
num_icons++;
+
+ cal_component_get_categories_list (comp, &categories_list);
+ num_icons += g_slist_length (categories_list);
+ cal_component_free_categories_list (categories_list);
}
if (num_icons > 0) {
diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c
index ec0d5b8795..023b297992 100644
--- a/calendar/gui/e-week-view-event-item.c
+++ b/calendar/gui/e-week-view-event-item.c
@@ -558,6 +558,7 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem,
GdkGC *gc;
gint num_icons = 0, icon_x_inc;
gboolean draw_reminder_icon = FALSE, draw_recurrence_icon = FALSE;
+ GSList *categories_list, *elem;
week_view = E_WEEK_VIEW (GTK_WIDGET (GNOME_CANVAS_ITEM (wveitem)->canvas)->parent);
@@ -579,6 +580,9 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem,
num_icons++;
}
+ cal_component_get_categories_list (comp, &categories_list);
+ num_icons += g_slist_length (categories_list);
+
icon_x_inc = E_WEEK_VIEW_ICON_WIDTH + E_WEEK_VIEW_ICON_X_PAD;
if (right_align)
@@ -606,6 +610,31 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem,
icon_x += icon_x_inc;
}
+ /* draw categories icons */
+ for (elem = categories_list; elem; elem = elem->next) {
+ char *category;
+ GdkPixmap *pixmap;
+ GdkBitmap *mask;
+
+ category = (char *) elem->data;
+ /* FIXME: get icon for this category */
+ pixmap = week_view->recurrence_icon;
+ mask = week_view->recurrence_mask;
+
+ if (icon_x + E_WEEK_VIEW_ICON_WIDTH <= x2) {
+ gdk_gc_set_clip_origin (gc, icon_x, icon_y);
+ gdk_gc_set_clip_mask (gc, mask);
+ gdk_draw_pixmap (drawable, gc,
+ pixmap,
+ 0, 0, icon_x, icon_y,
+ E_WEEK_VIEW_ICON_WIDTH,
+ E_WEEK_VIEW_ICON_HEIGHT);
+ icon_x += icon_x_inc;
+ }
+ }
+
+ cal_component_free_categories_list (categories_list);
+
gdk_gc_set_clip_mask (gc, NULL);
}
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index c620560227..fbe9ee435a 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -2392,10 +2392,17 @@ e_week_view_reshape_event_span (EWeekView *week_view,
/* Calculate how many icons we need to show. */
num_icons = 0;
if (show_icons) {
+ GSList *categories_list;
+
if (cal_component_has_alarms (comp))
num_icons++;
if (cal_component_has_recurrences (comp))
num_icons++;
+
+ cal_component_get_categories_list (comp, &categories_list);
+ num_icons += g_slist_length (categories_list);
+
+ cal_component_free_categories_list (categories_list);
}
/* Create the background canvas item if necessary. */