2 * Copyright (C) 2000 Red Hat, Inc., Jonathan Blandford <jrb@redhat.com>
3 * Copyright (C) 2008 - 2016 The Geeqie Team
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include <gtk/gtk.h> /* To define GTK_CHECK_VERSION */
22 #include "cellrenderericon.h"
26 #define FIXED_ICON_SIZE_MAX 512
29 static void gqv_cell_renderer_icon_get_property(GObject *object,
33 static void gqv_cell_renderer_icon_set_property(GObject *object,
37 static void gqv_cell_renderer_icon_init(GQvCellRendererIcon *celltext);
38 static void gqv_cell_renderer_icon_class_init(GQvCellRendererIconClass *class);
39 static void gqv_cell_renderer_icon_finalize(GObject *object);
40 #if GTK_CHECK_VERSION(3,0,0)
41 static void gqv_cell_renderer_icon_get_size(GtkCellRenderer *cell,
43 const GdkRectangle *rectangle,
49 static void gqv_cell_renderer_icon_get_size(GtkCellRenderer *cell,
51 GdkRectangle *rectangle,
57 #if GTK_CHECK_VERSION(3,0,0)
58 static void gqv_cell_renderer_icon_render(GtkCellRenderer *cell,
61 const GdkRectangle *background_area,
62 const GdkRectangle *cell_area,
63 GtkCellRendererState flags);
65 static void gqv_cell_renderer_icon_render(GtkCellRenderer *cell,
68 GdkRectangle *background_area,
69 GdkRectangle *cell_area,
70 GdkRectangle *expose_area,
71 GtkCellRendererState flags);
75 #if GTK_CHECK_VERSION(3,0,0)
76 static gboolean gqv_cell_renderer_icon_activate(GtkCellRenderer *cell,
80 const GdkRectangle *background_area,
81 const GdkRectangle *cell_area,
82 GtkCellRendererState flags);
84 static gboolean gqv_cell_renderer_icon_activate(GtkCellRenderer *cell,
88 GdkRectangle *background_area,
89 GdkRectangle *cell_area,
90 GtkCellRendererState flags);
117 static guint toggle_cell_signals[LAST_SIGNAL] = { 0 };
119 static gpointer parent_class;
122 gqv_cell_renderer_icon_get_type(void)
124 static GType cell_icon_type = 0;
128 static const GTypeInfo cell_icon_info =
130 sizeof(GQvCellRendererIconClass), /* class_size */
131 NULL, /* base_init */
132 NULL, /* base_finalize */
133 (GClassInitFunc) gqv_cell_renderer_icon_class_init, /* class_init */
134 NULL, /* class_finalize */
135 NULL, /* class_data */
136 sizeof(GQvCellRendererIcon), /* instance_size */
138 (GInstanceInitFunc) gqv_cell_renderer_icon_init, /* instance_init */
139 NULL, /* value_table */
142 cell_icon_type = g_type_register_static(GTK_TYPE_CELL_RENDERER,
143 "GQvCellRendererIcon",
147 return cell_icon_type;
151 gqv_cell_renderer_icon_init(GQvCellRendererIcon *cellicon)
153 g_object_set(G_OBJECT(cellicon), "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL);
154 gtk_cell_renderer_set_padding(GTK_CELL_RENDERER(cellicon), 2, 2);
158 gqv_cell_renderer_icon_class_init(GQvCellRendererIconClass *class)
160 GObjectClass *object_class = G_OBJECT_CLASS(class);
161 GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS(class);
163 parent_class = g_type_class_peek_parent(class);
165 object_class->finalize = gqv_cell_renderer_icon_finalize;
167 object_class->get_property = gqv_cell_renderer_icon_get_property;
168 object_class->set_property = gqv_cell_renderer_icon_set_property;
170 cell_class->get_size = gqv_cell_renderer_icon_get_size;
171 cell_class->render = gqv_cell_renderer_icon_render;
172 cell_class->activate = gqv_cell_renderer_icon_activate;
174 g_object_class_install_property(object_class,
176 g_param_spec_object("pixbuf",
178 "The pixbuf to render",
182 g_object_class_install_property(object_class,
184 g_param_spec_string("text",
190 g_object_class_install_property(object_class,
192 g_param_spec_boxed("background_gdk",
194 "Background color as a GdkColor",
198 g_object_class_install_property(object_class,
200 g_param_spec_boxed("foreground_gdk",
202 "Foreground color as a GdkColor",
206 g_object_class_install_property(object_class,
208 g_param_spec_boolean("has_focus",
210 "Draw focus indicator",
214 g_object_class_install_property(object_class,
216 g_param_spec_int("fixed_width",
219 -1, FIXED_ICON_SIZE_MAX,
223 g_object_class_install_property(object_class,
225 g_param_spec_int("fixed_height",
227 "Height of icon excluding text",
228 -1, FIXED_ICON_SIZE_MAX,
232 g_object_class_install_property(object_class,
234 g_param_spec_boolean("background_set",
236 "Whether this tag affects the background color",
240 g_object_class_install_property(object_class,
242 g_param_spec_boolean("foreground_set",
244 "Whether this tag affects the foreground color",
248 g_object_class_install_property(object_class,
250 g_param_spec_boolean("show_text",
252 "Whether the text is displayed",
256 g_object_class_install_property(object_class,
258 g_param_spec_boolean("show_marks",
260 "Whether the marks are displayed",
264 g_object_class_install_property(object_class,
266 g_param_spec_int("num_marks",
273 g_object_class_install_property(object_class,
275 g_param_spec_uint("marks",
282 g_object_class_install_property(object_class,
284 g_param_spec_uint("toggled_mark",
290 toggle_cell_signals[TOGGLED] =
291 g_signal_new("toggled",
292 G_OBJECT_CLASS_TYPE (object_class),
294 G_STRUCT_OFFSET (GQvCellRendererIconClass, toggled),
296 g_cclosure_marshal_VOID__STRING,
303 gqv_cell_renderer_icon_finalize(GObject *object)
305 GQvCellRendererIcon *cellicon = GQV_CELL_RENDERER_ICON(object);
307 if (cellicon->pixbuf) g_object_unref(cellicon->pixbuf);
309 g_free(cellicon->text);
311 (*(G_OBJECT_CLASS(parent_class))->finalize)(object);
315 gqv_cell_renderer_icon_get_property(GObject *object,
320 GQvCellRendererIcon *cellicon = GQV_CELL_RENDERER_ICON(object);
325 g_value_set_object(value, cellicon->pixbuf ? G_OBJECT(cellicon->pixbuf) : NULL);
328 g_value_set_string(value, cellicon->text);
330 case PROP_BACKGROUND_GDK:
334 color.red = cellicon->background.red;
335 color.green = cellicon->background.green;
336 color.blue = cellicon->background.blue;
338 g_value_set_boxed(value, &color);
341 case PROP_FOREGROUND_GDK:
345 color.red = cellicon->foreground.red;
346 color.green = cellicon->foreground.green;
347 color.blue = cellicon->foreground.blue;
349 g_value_set_boxed(value, &color);
353 g_value_set_boolean(value, cellicon->focused);
355 case PROP_FIXED_WIDTH:
356 g_value_set_int(value, cellicon->fixed_width);
358 case PROP_FIXED_HEIGHT:
359 g_value_set_int(value, cellicon->fixed_height);
361 case PROP_BACKGROUND_SET:
362 g_value_set_boolean(value, cellicon->background_set);
364 case PROP_FOREGROUND_SET:
365 g_value_set_boolean(value, cellicon->foreground_set);
368 g_value_set_boolean(value, cellicon->show_text);
370 case PROP_SHOW_MARKS:
371 g_value_set_boolean(value, cellicon->show_marks);
374 g_value_set_int(value, cellicon->num_marks);
377 g_value_set_uint(value, cellicon->marks);
380 g_value_set_uint(value, cellicon->toggled_mark);
383 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
389 set_bg_color(GQvCellRendererIcon *cellicon,
394 if (!cellicon->background_set)
396 cellicon->background_set = TRUE;
397 g_object_notify(G_OBJECT(cellicon), "background_set");
400 cellicon->background.red = color->red;
401 cellicon->background.green = color->green;
402 cellicon->background.blue = color->blue;
406 if (cellicon->background_set)
408 cellicon->background_set = FALSE;
409 g_object_notify(G_OBJECT(cellicon), "background_set");
414 static void set_fg_color(GQvCellRendererIcon *cellicon,
419 if (!cellicon->foreground_set)
421 cellicon->foreground_set = TRUE;
422 g_object_notify(G_OBJECT(cellicon), "foreground_set");
425 cellicon->foreground.red = color->red;
426 cellicon->foreground.green = color->green;
427 cellicon->foreground.blue = color->blue;
431 if (cellicon->foreground_set)
433 cellicon->foreground_set = FALSE;
434 g_object_notify(G_OBJECT(cellicon), "foreground_set");
440 gqv_cell_renderer_icon_set_property(GObject *object,
445 GQvCellRendererIcon *cellicon = GQV_CELL_RENDERER_ICON(object);
453 pixbuf = (GdkPixbuf *) g_value_get_object(value);
454 if (pixbuf) g_object_ref(pixbuf);
455 if (cellicon->pixbuf) g_object_unref(cellicon->pixbuf);
456 cellicon->pixbuf = pixbuf;
463 text = cellicon->text;
464 cellicon->text = g_strdup(g_value_get_string(value));
467 g_object_notify(object, "text");
470 case PROP_BACKGROUND_GDK:
471 set_bg_color(cellicon, g_value_get_boxed(value));
473 case PROP_FOREGROUND_GDK:
474 set_fg_color(cellicon, g_value_get_boxed(value));
477 cellicon->focused = g_value_get_boolean(value);
479 case PROP_FIXED_WIDTH:
480 cellicon->fixed_width = g_value_get_int(value);
482 case PROP_FIXED_HEIGHT:
483 cellicon->fixed_height = g_value_get_int(value);
485 case PROP_BACKGROUND_SET:
486 cellicon->background_set = g_value_get_boolean(value);
488 case PROP_FOREGROUND_SET:
489 cellicon->foreground_set = g_value_get_boolean(value);
492 cellicon->show_text = g_value_get_boolean(value);
494 case PROP_SHOW_MARKS:
495 cellicon->show_marks = g_value_get_boolean(value);
498 cellicon->num_marks = g_value_get_int(value);
501 cellicon->marks = g_value_get_uint(value);
504 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
510 gqv_cell_renderer_icon_get_layout(GQvCellRendererIcon *cellicon, GtkWidget *widget, gboolean will_render)
515 width = (cellicon->fixed_width > 0) ? cellicon->fixed_width * PANGO_SCALE : -1;
517 layout = gtk_widget_create_pango_layout(widget, cellicon->text);
518 pango_layout_set_width(layout, width);
519 pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
520 pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
524 PangoAttrList *attr_list;
526 attr_list = pango_attr_list_new();
528 if (cellicon->foreground_set)
531 PangoAttribute *attr;
533 color = cellicon->foreground;
535 attr = pango_attr_foreground_new(color.red, color.green, color.blue);
537 attr->start_index = 0;
538 attr->end_index = G_MAXINT;
539 pango_attr_list_insert(attr_list, attr);
542 pango_layout_set_attributes(layout, attr_list);
543 pango_attr_list_unref(attr_list);
550 * gqv_cell_renderer_icon_new:
552 * Creates a new #GQvCellRendererIcon. Adjust rendering
553 * parameters using object properties. Object properties can be set
554 * globally (with g_object_set()). Also, with #GtkTreeViewColumn, you
555 * can bind a property to a value in a #GtkTreeModel. For example, you
556 * can bind the "pixbuf" property on the cell renderer to a pixbuf value
557 * in the model, thus rendering a different image in each row of the
560 * Return value: the new cell renderer
563 gqv_cell_renderer_icon_new(void)
565 return g_object_new(GQV_TYPE_CELL_RENDERER_ICON, NULL);
568 #if GTK_CHECK_VERSION(3,0,0)
569 static void gqv_cell_renderer_icon_get_size(GtkCellRenderer *cell,
571 const GdkRectangle *cell_area,
577 static void gqv_cell_renderer_icon_get_size(GtkCellRenderer *cell,
579 GdkRectangle *cell_area,
586 GQvCellRendererIcon *cellicon = (GQvCellRendererIcon *) cell;
590 gfloat xalign, yalign;
592 gtk_cell_renderer_get_padding(cell, &xpad, &ypad);
593 gtk_cell_renderer_get_alignment(cell, &xalign, &yalign);
595 if (cellicon->fixed_width > 0)
597 calc_width = cellicon->fixed_width;
601 calc_width = (cellicon->pixbuf) ? gdk_pixbuf_get_width(cellicon->pixbuf) : 0;
604 if (cellicon->fixed_height > 0)
606 calc_height = cellicon->fixed_height;
610 calc_height = (cellicon->pixbuf) ? gdk_pixbuf_get_height(cellicon->pixbuf) : 0;
613 if (cellicon->show_text && cellicon->text)
618 layout = gqv_cell_renderer_icon_get_layout(cellicon, widget, FALSE);
619 pango_layout_get_pixel_extents(layout, NULL, &rect);
620 g_object_unref(layout);
622 calc_width = MAX(calc_width, rect.width);
623 calc_height += rect.height;
626 if (cellicon->show_marks)
628 calc_height += TOGGLE_SPACING;
629 calc_width = MAX(calc_width, TOGGLE_SPACING * cellicon->num_marks);
632 calc_width += xpad * 2;
633 calc_height += ypad * 2;
635 if (x_offset) *x_offset = 0;
636 if (y_offset) *y_offset = 0;
638 if (cell_area && calc_width > 0 && calc_height > 0)
642 *x_offset = (xalign * (cell_area->width - calc_width - 2 * xpad));
643 *x_offset = MAX(*x_offset, 0) + xpad;
647 *y_offset = (yalign * (cell_area->height - calc_height - 2 * ypad));
648 *y_offset = MAX(*y_offset, 0) + ypad;
652 if (width) *width = calc_width;
653 if (height) *height = calc_height;
656 #if GTK_CHECK_VERSION(3,0,0)
657 static void gqv_cell_renderer_icon_render(GtkCellRenderer *cell,
660 const GdkRectangle *background_area,
661 const GdkRectangle *cell_area,
662 GtkCellRendererState flags)
665 GtkStyleContext *context = gtk_widget_get_style_context(widget);
668 gqv_cell_renderer_icon_render(GtkCellRenderer *cell,
671 GdkRectangle *background_area,
672 GdkRectangle *cell_area,
673 GdkRectangle *expose_area,
674 GtkCellRendererState flags)
677 cairo_t *cr = gdk_cairo_create(window);
679 GQvCellRendererIcon *cellicon = (GQvCellRendererIcon *) cell;
682 GdkRectangle cell_rect;
683 #if GTK_CHECK_VERSION(3,0,0)
691 pixbuf = cellicon->pixbuf;
692 text = cellicon->text;
694 if (!pixbuf && !text)
696 #if !GTK_CHECK_VERSION(3,0,0)
702 gtk_cell_renderer_get_padding(cell, &xpad, &ypad);
704 gqv_cell_renderer_icon_get_size(cell, widget, cell_area,
705 &cell_rect.x, &cell_rect.y,
706 &cell_rect.width, &cell_rect.height);
710 cell_rect.width -= xpad * 2;
711 cell_rect.height -= ypad * 2;
713 if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
715 if (gtk_widget_has_focus(widget))
716 #if GTK_CHECK_VERSION(3,0,0)
717 state = GTK_STATE_FLAG_SELECTED;
719 state = GTK_STATE_FLAG_ACTIVE;
721 state = GTK_STATE_SELECTED;
723 state = GTK_STATE_ACTIVE;
728 if (gtk_widget_get_state(widget) == GTK_STATE_INSENSITIVE)
729 #if GTK_CHECK_VERSION(3,0,0)
730 state = GTK_STATE_FLAG_INSENSITIVE;
732 state = GTK_STATE_FLAG_NORMAL;
734 state = GTK_STATE_INSENSITIVE;
736 state = GTK_STATE_NORMAL;
740 #if GTK_CHECK_VERSION(3,0,0)
741 gtk_style_context_set_state(context, state);
746 GdkRectangle pix_rect;
747 GdkRectangle draw_rect;
749 pix_rect.width = gdk_pixbuf_get_width(pixbuf);
750 pix_rect.height = gdk_pixbuf_get_height(pixbuf);
752 pix_rect.x = cell_area->x + (cell_area->width - pix_rect.width) / 2;
754 if (cellicon->fixed_height > 0)
756 pix_rect.y = cell_area->y + ypad + (cellicon->fixed_height - pix_rect.height) / 2;
760 pix_rect.y = cell_area->y + cell_rect.y;
763 if (gdk_rectangle_intersect(cell_area, &pix_rect, &draw_rect)
764 #if !GTK_CHECK_VERSION(3,0,0)
765 && gdk_rectangle_intersect(expose_area, &draw_rect, &draw_rect)
769 gdk_cairo_set_source_pixbuf(cr, pixbuf, pix_rect.x, pix_rect.y);
780 if (cellicon->show_text && text)
783 PangoRectangle text_rect;
784 GdkRectangle pix_rect;
785 GdkRectangle draw_rect;
786 layout = gqv_cell_renderer_icon_get_layout(cellicon, widget, TRUE);
787 pango_layout_get_pixel_extents(layout, NULL, &text_rect);
789 pix_rect.width = text_rect.width;
790 pix_rect.height = text_rect.height;
791 pix_rect.x = cell_area->x + xpad + (cell_rect.width - text_rect.width + 1) / 2;
792 pix_rect.y = cell_area->y + ypad + (cell_rect.height - text_rect.height);
794 if (cellicon->show_marks)
796 pix_rect.y -= TOGGLE_SPACING;
799 if (gdk_rectangle_intersect(cell_area, &pix_rect, &draw_rect)
800 #if !GTK_CHECK_VERSION(3,0,0)
801 && gdk_rectangle_intersect(expose_area, &draw_rect, &draw_rect)
805 #if GTK_CHECK_VERSION(3,0,0)
806 gtk_render_layout(context, cr, pix_rect.x - text_rect.x, pix_rect.y, layout);
809 gtk_paint_layout(gtk_widget_get_style(widget), window,
813 pix_rect.x - text_rect.x, pix_rect.y,
817 g_object_unref(layout);
820 if (cellicon->show_marks)
822 GdkRectangle pix_rect;
823 GdkRectangle draw_rect;
826 pix_rect.width = TOGGLE_SPACING * cellicon->num_marks;
827 pix_rect.height = TOGGLE_SPACING;
828 pix_rect.x = cell_area->x + xpad + (cell_rect.width - pix_rect.width + 1) / 2 + (TOGGLE_SPACING - TOGGLE_WIDTH) / 2;
829 pix_rect.y = cell_area->y + ypad + (cell_rect.height - pix_rect.height) + (TOGGLE_SPACING - TOGGLE_WIDTH) / 2;
831 if (gdk_rectangle_intersect(cell_area, &pix_rect, &draw_rect)
832 #if !GTK_CHECK_VERSION(3,0,0)
833 && gdk_rectangle_intersect(expose_area, &draw_rect, &draw_rect)
837 for (i = 0; i < cellicon->num_marks; i++)
839 #if GTK_CHECK_VERSION(3,0,0)
840 #if GTK_CHECK_VERSION(3,14,0)
841 state &= ~(GTK_STATE_FLAG_CHECKED);
843 if ((cellicon->marks & (1 << i)))
844 state |= GTK_STATE_FLAG_CHECKED;
846 state &= ~(GTK_STATE_FLAG_ACTIVE);
848 if ((cellicon->marks & (1 << i)))
849 state |= GTK_STATE_FLAG_ACTIVE;
854 pix_rect.x + i * TOGGLE_SPACING + (TOGGLE_WIDTH - TOGGLE_SPACING) / 2,
856 TOGGLE_WIDTH, TOGGLE_WIDTH);
859 gtk_style_context_save(context);
860 gtk_style_context_set_state(context, state);
862 gtk_style_context_add_class(context, GTK_STYLE_CLASS_CHECK);
864 gtk_style_context_add_class(context, "marks");
865 GtkStyleProvider *provider;
866 provider = (GtkStyleProvider *)gtk_css_provider_new();
867 gtk_css_provider_load_from_data(GTK_CSS_PROVIDER(provider),
869 "border-color: #808080;\n"
870 "border-style: solid;\n"
871 "border-width: 1px;\n"
872 "border-radius: 0px;\n"
875 gtk_style_context_add_provider(context, provider,
876 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
878 gtk_render_check(context, cr,
879 pix_rect.x + i * TOGGLE_SPACING + (TOGGLE_WIDTH - TOGGLE_SPACING) / 2,
881 TOGGLE_WIDTH, TOGGLE_WIDTH);
882 gtk_render_frame(context, cr,
883 pix_rect.x + i * TOGGLE_SPACING + (TOGGLE_WIDTH - TOGGLE_SPACING) / 2,
885 TOGGLE_WIDTH, TOGGLE_WIDTH);
887 if (cellicon->focused && gtk_widget_has_focus(widget))
889 gtk_render_focus(context, cr,
890 pix_rect.x + i * TOGGLE_SPACING + (TOGGLE_WIDTH - TOGGLE_SPACING) / 2,
891 pix_rect.y, TOGGLE_WIDTH, TOGGLE_WIDTH);
893 gtk_style_context_restore(context);
897 gtk_paint_check(gtk_widget_get_style(widget), window,
898 state, (cellicon->marks & (1 << i)) ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
899 cell_area, widget, "cellcheck",
900 pix_rect.x + i * TOGGLE_SPACING + (TOGGLE_WIDTH - TOGGLE_SPACING) / 2,
902 TOGGLE_WIDTH, TOGGLE_WIDTH);
908 #if !GTK_CHECK_VERSION(3,0,0)
909 if (cellicon->focused && gtk_widget_has_focus(widget))
911 gtk_paint_focus(gtk_widget_get_style(widget), window,
915 cell_area->x, cell_area->y,
916 cell_area->width, cell_area->height);
922 #if GTK_CHECK_VERSION(3,0,0)
923 static gboolean gqv_cell_renderer_icon_activate(GtkCellRenderer *cell,
927 const GdkRectangle *background_area,
928 const GdkRectangle *cell_area,
929 GtkCellRendererState flags)
931 static gboolean gqv_cell_renderer_icon_activate(GtkCellRenderer *cell,
935 GdkRectangle *background_area,
936 GdkRectangle *cell_area,
937 GtkCellRendererState flags)
940 GQvCellRendererIcon *cellicon = (GQvCellRendererIcon *) cell;
941 GdkEventButton *bevent = &event->button;
943 if (cellicon->show_marks &&
944 event->type == GDK_BUTTON_PRESS &&
945 !(bevent->state & GDK_SHIFT_MASK ) &&
946 !(bevent->state & GDK_CONTROL_MASK ))
949 GdkRectangle cell_rect;
953 gtk_cell_renderer_get_padding(cell, &xpad, &ypad);
955 gqv_cell_renderer_icon_get_size(cell, widget, cell_area,
956 &cell_rect.x, &cell_rect.y,
957 &cell_rect.width, &cell_rect.height);
961 cell_rect.width -= xpad * 2;
962 cell_rect.height -= ypad * 2;
964 rect.width = TOGGLE_WIDTH;
965 rect.height = TOGGLE_WIDTH;
966 rect.y = cell_area->y + ypad + (cell_rect.height - TOGGLE_SPACING) + (TOGGLE_SPACING - TOGGLE_WIDTH) / 2;
967 for (i = 0; i < cellicon->num_marks; i++)
969 rect.x = cell_area->x + xpad + (cell_rect.width - TOGGLE_SPACING * cellicon->num_marks + 1) / 2 + i * TOGGLE_SPACING;
971 if (bevent->x >= rect.x && bevent->x < rect.x + rect.width &&
972 bevent->y >= rect.y && bevent->y < rect.y + rect.height)
974 cellicon->toggled_mark = i;
975 g_signal_emit(cell, toggle_cell_signals[TOGGLED], 0, path);
982 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */