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_wrapper(void *, void *);
38 static void gqv_cell_renderer_icon_init(GQvCellRendererIcon *celltext);
39 static void gqv_cell_renderer_icon_class_init_wrapper(void *, void *);
40 static void gqv_cell_renderer_icon_class_init(GQvCellRendererIconClass *class);
41 static void gqv_cell_renderer_icon_finalize(GObject *object);
42 #if GTK_CHECK_VERSION(3,0,0)
43 static void gqv_cell_renderer_icon_get_size(GtkCellRenderer *cell,
45 const GdkRectangle *rectangle,
51 static void gqv_cell_renderer_icon_get_size(GtkCellRenderer *cell,
53 GdkRectangle *rectangle,
59 #if GTK_CHECK_VERSION(3,0,0)
60 static void gqv_cell_renderer_icon_render(GtkCellRenderer *cell,
63 const GdkRectangle *background_area,
64 const GdkRectangle *cell_area,
65 GtkCellRendererState flags);
67 static void gqv_cell_renderer_icon_render(GtkCellRenderer *cell,
70 GdkRectangle *background_area,
71 GdkRectangle *cell_area,
72 GdkRectangle *expose_area,
73 GtkCellRendererState flags);
77 #if GTK_CHECK_VERSION(3,0,0)
78 static gboolean gqv_cell_renderer_icon_activate(GtkCellRenderer *cell,
82 const GdkRectangle *background_area,
83 const GdkRectangle *cell_area,
84 GtkCellRendererState flags);
86 static gboolean gqv_cell_renderer_icon_activate(GtkCellRenderer *cell,
90 GdkRectangle *background_area,
91 GdkRectangle *cell_area,
92 GtkCellRendererState flags);
119 static guint toggle_cell_signals[LAST_SIGNAL] = { 0 };
121 static gpointer parent_class;
124 gqv_cell_renderer_icon_get_type(void)
126 static GType cell_icon_type = 0;
130 static const GTypeInfo cell_icon_info =
132 sizeof(GQvCellRendererIconClass), /* class_size */
133 NULL, /* base_init */
134 NULL, /* base_finalize */
135 (GClassInitFunc) gqv_cell_renderer_icon_class_init_wrapper, /* class_init */
136 NULL, /* class_finalize */
137 NULL, /* class_data */
138 sizeof(GQvCellRendererIcon), /* instance_size */
140 (GInstanceInitFunc) gqv_cell_renderer_icon_init_wrapper, /* instance_init */
141 NULL, /* value_table */
144 cell_icon_type = g_type_register_static(GTK_TYPE_CELL_RENDERER,
145 "GQvCellRendererIcon",
149 return cell_icon_type;
153 gqv_cell_renderer_icon_init_wrapper(void *data, void *user_data)
155 gqv_cell_renderer_icon_init(data);
159 gqv_cell_renderer_icon_init(GQvCellRendererIcon *cellicon)
161 g_object_set(G_OBJECT(cellicon), "mode", GTK_CELL_RENDERER_MODE_ACTIVATABLE, NULL);
162 gtk_cell_renderer_set_padding(GTK_CELL_RENDERER(cellicon), 2, 2);
166 gqv_cell_renderer_icon_class_init_wrapper(void *data, void *user_data)
168 gqv_cell_renderer_icon_class_init(data);
172 gqv_cell_renderer_icon_class_init(GQvCellRendererIconClass *class)
174 GObjectClass *object_class = G_OBJECT_CLASS(class);
175 GtkCellRendererClass *cell_class = GTK_CELL_RENDERER_CLASS(class);
177 parent_class = g_type_class_peek_parent(class);
179 object_class->finalize = gqv_cell_renderer_icon_finalize;
181 object_class->get_property = gqv_cell_renderer_icon_get_property;
182 object_class->set_property = gqv_cell_renderer_icon_set_property;
184 cell_class->get_size = gqv_cell_renderer_icon_get_size;
185 cell_class->render = gqv_cell_renderer_icon_render;
186 cell_class->activate = gqv_cell_renderer_icon_activate;
188 g_object_class_install_property(object_class,
190 g_param_spec_object("pixbuf",
192 "The pixbuf to render",
196 g_object_class_install_property(object_class,
198 g_param_spec_string("text",
204 g_object_class_install_property(object_class,
206 g_param_spec_boxed("background_gdk",
208 "Background color as a GdkColor",
212 g_object_class_install_property(object_class,
214 g_param_spec_boxed("foreground_gdk",
216 "Foreground color as a GdkColor",
220 g_object_class_install_property(object_class,
222 g_param_spec_boolean("has_focus",
224 "Draw focus indicator",
228 g_object_class_install_property(object_class,
230 g_param_spec_int("fixed_width",
233 -1, FIXED_ICON_SIZE_MAX,
237 g_object_class_install_property(object_class,
239 g_param_spec_int("fixed_height",
241 "Height of icon excluding text",
242 -1, FIXED_ICON_SIZE_MAX,
246 g_object_class_install_property(object_class,
248 g_param_spec_boolean("background_set",
250 "Whether this tag affects the background color",
254 g_object_class_install_property(object_class,
256 g_param_spec_boolean("foreground_set",
258 "Whether this tag affects the foreground color",
262 g_object_class_install_property(object_class,
264 g_param_spec_boolean("show_text",
266 "Whether the text is displayed",
270 g_object_class_install_property(object_class,
272 g_param_spec_boolean("show_marks",
274 "Whether the marks are displayed",
278 g_object_class_install_property(object_class,
280 g_param_spec_int("num_marks",
287 g_object_class_install_property(object_class,
289 g_param_spec_uint("marks",
296 g_object_class_install_property(object_class,
298 g_param_spec_uint("toggled_mark",
304 toggle_cell_signals[TOGGLED] =
305 g_signal_new("toggled",
306 G_OBJECT_CLASS_TYPE (object_class),
308 G_STRUCT_OFFSET (GQvCellRendererIconClass, toggled),
310 g_cclosure_marshal_VOID__STRING,
317 gqv_cell_renderer_icon_finalize(GObject *object)
319 GQvCellRendererIcon *cellicon = GQV_CELL_RENDERER_ICON(object);
321 if (cellicon->pixbuf) g_object_unref(cellicon->pixbuf);
323 g_free(cellicon->text);
325 (*(G_OBJECT_CLASS(parent_class))->finalize)(object);
329 gqv_cell_renderer_icon_get_property(GObject *object,
334 GQvCellRendererIcon *cellicon = GQV_CELL_RENDERER_ICON(object);
339 g_value_set_object(value, cellicon->pixbuf ? G_OBJECT(cellicon->pixbuf) : NULL);
342 g_value_set_string(value, cellicon->text);
344 case PROP_BACKGROUND_GDK:
348 color.red = cellicon->background.red;
349 color.green = cellicon->background.green;
350 color.blue = cellicon->background.blue;
352 g_value_set_boxed(value, &color);
355 case PROP_FOREGROUND_GDK:
359 color.red = cellicon->foreground.red;
360 color.green = cellicon->foreground.green;
361 color.blue = cellicon->foreground.blue;
363 g_value_set_boxed(value, &color);
367 g_value_set_boolean(value, cellicon->focused);
369 case PROP_FIXED_WIDTH:
370 g_value_set_int(value, cellicon->fixed_width);
372 case PROP_FIXED_HEIGHT:
373 g_value_set_int(value, cellicon->fixed_height);
375 case PROP_BACKGROUND_SET:
376 g_value_set_boolean(value, cellicon->background_set);
378 case PROP_FOREGROUND_SET:
379 g_value_set_boolean(value, cellicon->foreground_set);
382 g_value_set_boolean(value, cellicon->show_text);
384 case PROP_SHOW_MARKS:
385 g_value_set_boolean(value, cellicon->show_marks);
388 g_value_set_int(value, cellicon->num_marks);
391 g_value_set_uint(value, cellicon->marks);
394 g_value_set_uint(value, cellicon->toggled_mark);
397 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
403 set_bg_color(GQvCellRendererIcon *cellicon,
408 if (!cellicon->background_set)
410 cellicon->background_set = TRUE;
411 g_object_notify(G_OBJECT(cellicon), "background_set");
414 cellicon->background.red = color->red;
415 cellicon->background.green = color->green;
416 cellicon->background.blue = color->blue;
420 if (cellicon->background_set)
422 cellicon->background_set = FALSE;
423 g_object_notify(G_OBJECT(cellicon), "background_set");
428 static void set_fg_color(GQvCellRendererIcon *cellicon,
433 if (!cellicon->foreground_set)
435 cellicon->foreground_set = TRUE;
436 g_object_notify(G_OBJECT(cellicon), "foreground_set");
439 cellicon->foreground.red = color->red;
440 cellicon->foreground.green = color->green;
441 cellicon->foreground.blue = color->blue;
445 if (cellicon->foreground_set)
447 cellicon->foreground_set = FALSE;
448 g_object_notify(G_OBJECT(cellicon), "foreground_set");
454 gqv_cell_renderer_icon_set_property(GObject *object,
459 GQvCellRendererIcon *cellicon = GQV_CELL_RENDERER_ICON(object);
467 pixbuf = (GdkPixbuf *) g_value_get_object(value);
468 if (pixbuf) g_object_ref(pixbuf);
469 if (cellicon->pixbuf) g_object_unref(cellicon->pixbuf);
470 cellicon->pixbuf = pixbuf;
477 text = cellicon->text;
478 cellicon->text = g_strdup(g_value_get_string(value));
481 g_object_notify(object, "text");
484 case PROP_BACKGROUND_GDK:
485 set_bg_color(cellicon, g_value_get_boxed(value));
487 case PROP_FOREGROUND_GDK:
488 set_fg_color(cellicon, g_value_get_boxed(value));
491 cellicon->focused = g_value_get_boolean(value);
493 case PROP_FIXED_WIDTH:
494 cellicon->fixed_width = g_value_get_int(value);
496 case PROP_FIXED_HEIGHT:
497 cellicon->fixed_height = g_value_get_int(value);
499 case PROP_BACKGROUND_SET:
500 cellicon->background_set = g_value_get_boolean(value);
502 case PROP_FOREGROUND_SET:
503 cellicon->foreground_set = g_value_get_boolean(value);
506 cellicon->show_text = g_value_get_boolean(value);
508 case PROP_SHOW_MARKS:
509 cellicon->show_marks = g_value_get_boolean(value);
512 cellicon->num_marks = g_value_get_int(value);
515 cellicon->marks = g_value_get_uint(value);
518 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, param_id, pspec);
524 gqv_cell_renderer_icon_get_layout(GQvCellRendererIcon *cellicon, GtkWidget *widget, gboolean will_render)
529 width = (cellicon->fixed_width > 0) ? cellicon->fixed_width * PANGO_SCALE : -1;
531 layout = gtk_widget_create_pango_layout(widget, cellicon->text);
532 pango_layout_set_width(layout, width);
533 pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER);
534 pango_layout_set_wrap(layout, PANGO_WRAP_WORD_CHAR);
538 PangoAttrList *attr_list;
540 attr_list = pango_attr_list_new();
542 if (cellicon->foreground_set)
545 PangoAttribute *attr;
547 color = cellicon->foreground;
549 attr = pango_attr_foreground_new(color.red, color.green, color.blue);
551 attr->start_index = 0;
552 attr->end_index = G_MAXINT;
553 pango_attr_list_insert(attr_list, attr);
556 pango_layout_set_attributes(layout, attr_list);
557 pango_attr_list_unref(attr_list);
564 * gqv_cell_renderer_icon_new:
566 * Creates a new #GQvCellRendererIcon. Adjust rendering
567 * parameters using object properties. Object properties can be set
568 * globally (with g_object_set()). Also, with #GtkTreeViewColumn, you
569 * can bind a property to a value in a #GtkTreeModel. For example, you
570 * can bind the "pixbuf" property on the cell renderer to a pixbuf value
571 * in the model, thus rendering a different image in each row of the
574 * Return value: the new cell renderer
577 gqv_cell_renderer_icon_new(void)
579 return g_object_new(GQV_TYPE_CELL_RENDERER_ICON, NULL);
582 #if GTK_CHECK_VERSION(3,0,0)
583 static void gqv_cell_renderer_icon_get_size(GtkCellRenderer *cell,
585 const GdkRectangle *cell_area,
591 static void gqv_cell_renderer_icon_get_size(GtkCellRenderer *cell,
593 GdkRectangle *cell_area,
600 GQvCellRendererIcon *cellicon = (GQvCellRendererIcon *) cell;
604 gfloat xalign, yalign;
606 gtk_cell_renderer_get_padding(cell, &xpad, &ypad);
607 gtk_cell_renderer_get_alignment(cell, &xalign, &yalign);
609 if (cellicon->fixed_width > 0)
611 calc_width = cellicon->fixed_width;
615 calc_width = (cellicon->pixbuf) ? gdk_pixbuf_get_width(cellicon->pixbuf) : 0;
618 if (cellicon->fixed_height > 0)
620 calc_height = cellicon->fixed_height;
624 calc_height = (cellicon->pixbuf) ? gdk_pixbuf_get_height(cellicon->pixbuf) : 0;
627 if (cellicon->show_text && cellicon->text)
632 layout = gqv_cell_renderer_icon_get_layout(cellicon, widget, FALSE);
633 pango_layout_get_pixel_extents(layout, NULL, &rect);
634 g_object_unref(layout);
636 calc_width = MAX(calc_width, rect.width);
637 calc_height += rect.height;
640 if (cellicon->show_marks)
642 calc_height += TOGGLE_SPACING;
643 calc_width = MAX(calc_width, TOGGLE_SPACING * cellicon->num_marks);
646 calc_width += xpad * 2;
647 calc_height += ypad * 2;
649 if (x_offset) *x_offset = 0;
650 if (y_offset) *y_offset = 0;
652 if (cell_area && calc_width > 0 && calc_height > 0)
656 *x_offset = (xalign * (cell_area->width - calc_width - 2 * xpad));
657 *x_offset = MAX(*x_offset, 0) + xpad;
661 *y_offset = (yalign * (cell_area->height - calc_height - 2 * ypad));
662 *y_offset = MAX(*y_offset, 0) + ypad;
666 if (width) *width = calc_width;
667 if (height) *height = calc_height;
670 #if GTK_CHECK_VERSION(3,0,0)
671 static void gqv_cell_renderer_icon_render(GtkCellRenderer *cell,
674 const GdkRectangle *background_area,
675 const GdkRectangle *cell_area,
676 GtkCellRendererState flags)
679 GtkStyleContext *context = gtk_widget_get_style_context(widget);
682 gqv_cell_renderer_icon_render(GtkCellRenderer *cell,
685 GdkRectangle *background_area,
686 GdkRectangle *cell_area,
687 GdkRectangle *expose_area,
688 GtkCellRendererState flags)
691 cairo_t *cr = gdk_cairo_create(window);
693 GQvCellRendererIcon *cellicon = (GQvCellRendererIcon *) cell;
696 GdkRectangle cell_rect;
697 #if GTK_CHECK_VERSION(3,0,0)
705 pixbuf = cellicon->pixbuf;
706 text = cellicon->text;
708 if (!pixbuf && !text)
710 #if !GTK_CHECK_VERSION(3,0,0)
716 gtk_cell_renderer_get_padding(cell, &xpad, &ypad);
718 gqv_cell_renderer_icon_get_size(cell, widget, cell_area,
719 &cell_rect.x, &cell_rect.y,
720 &cell_rect.width, &cell_rect.height);
724 cell_rect.width -= xpad * 2;
725 cell_rect.height -= ypad * 2;
727 if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
729 if (gtk_widget_has_focus(widget))
730 #if GTK_CHECK_VERSION(3,0,0)
731 state = GTK_STATE_FLAG_SELECTED;
733 state = GTK_STATE_FLAG_ACTIVE;
735 state = GTK_STATE_SELECTED;
737 state = GTK_STATE_ACTIVE;
742 if (gtk_widget_get_state(widget) == GTK_STATE_INSENSITIVE)
743 #if GTK_CHECK_VERSION(3,0,0)
744 state = GTK_STATE_FLAG_INSENSITIVE;
746 state = GTK_STATE_FLAG_NORMAL;
748 state = GTK_STATE_INSENSITIVE;
750 state = GTK_STATE_NORMAL;
754 #if GTK_CHECK_VERSION(3,0,0)
755 gtk_style_context_set_state(context, state);
760 GdkRectangle pix_rect;
761 GdkRectangle draw_rect;
763 pix_rect.width = gdk_pixbuf_get_width(pixbuf);
764 pix_rect.height = gdk_pixbuf_get_height(pixbuf);
766 pix_rect.x = cell_area->x + (cell_area->width - pix_rect.width) / 2;
768 if (cellicon->fixed_height > 0)
770 pix_rect.y = cell_area->y + ypad + (cellicon->fixed_height - pix_rect.height) / 2;
774 pix_rect.y = cell_area->y + cell_rect.y;
777 if (gdk_rectangle_intersect(cell_area, &pix_rect, &draw_rect)
778 #if !GTK_CHECK_VERSION(3,0,0)
779 && gdk_rectangle_intersect(expose_area, &draw_rect, &draw_rect)
783 gdk_cairo_set_source_pixbuf(cr, pixbuf, pix_rect.x, pix_rect.y);
794 if (cellicon->show_text && text)
797 PangoRectangle text_rect;
798 GdkRectangle pix_rect;
799 GdkRectangle draw_rect;
800 layout = gqv_cell_renderer_icon_get_layout(cellicon, widget, TRUE);
801 pango_layout_get_pixel_extents(layout, NULL, &text_rect);
803 pix_rect.width = text_rect.width;
804 pix_rect.height = text_rect.height;
805 pix_rect.x = cell_area->x + xpad + (cell_rect.width - text_rect.width + 1) / 2;
806 pix_rect.y = cell_area->y + ypad + (cell_rect.height - text_rect.height);
808 if (cellicon->show_marks)
810 pix_rect.y -= TOGGLE_SPACING;
813 if (gdk_rectangle_intersect(cell_area, &pix_rect, &draw_rect)
814 #if !GTK_CHECK_VERSION(3,0,0)
815 && gdk_rectangle_intersect(expose_area, &draw_rect, &draw_rect)
819 #if GTK_CHECK_VERSION(3,0,0)
820 gtk_render_layout(context, cr, pix_rect.x - text_rect.x, pix_rect.y, layout);
823 gtk_paint_layout(gtk_widget_get_style(widget), window,
827 pix_rect.x - text_rect.x, pix_rect.y,
831 g_object_unref(layout);
834 if (cellicon->show_marks)
836 GdkRectangle pix_rect;
837 GdkRectangle draw_rect;
840 pix_rect.width = TOGGLE_SPACING * cellicon->num_marks;
841 pix_rect.height = TOGGLE_SPACING;
842 pix_rect.x = cell_area->x + xpad + (cell_rect.width - pix_rect.width + 1) / 2 + (TOGGLE_SPACING - TOGGLE_WIDTH) / 2;
843 pix_rect.y = cell_area->y + ypad + (cell_rect.height - pix_rect.height) + (TOGGLE_SPACING - TOGGLE_WIDTH) / 2;
845 if (gdk_rectangle_intersect(cell_area, &pix_rect, &draw_rect)
846 #if !GTK_CHECK_VERSION(3,0,0)
847 && gdk_rectangle_intersect(expose_area, &draw_rect, &draw_rect)
851 for (i = 0; i < cellicon->num_marks; i++)
853 #if GTK_CHECK_VERSION(3,0,0)
854 #if GTK_CHECK_VERSION(3,14,0)
855 state &= ~(GTK_STATE_FLAG_CHECKED);
857 if ((cellicon->marks & (1 << i)))
858 state |= GTK_STATE_FLAG_CHECKED;
860 state &= ~(GTK_STATE_FLAG_ACTIVE);
862 if ((cellicon->marks & (1 << i)))
863 state |= GTK_STATE_FLAG_ACTIVE;
868 pix_rect.x + i * TOGGLE_SPACING + (TOGGLE_WIDTH - TOGGLE_SPACING) / 2,
870 TOGGLE_WIDTH, TOGGLE_WIDTH);
873 gtk_style_context_save(context);
874 gtk_style_context_set_state(context, state);
876 gtk_style_context_add_class(context, GTK_STYLE_CLASS_CHECK);
878 gtk_style_context_add_class(context, "marks");
879 GtkStyleProvider *provider;
880 provider = (GtkStyleProvider *)gtk_css_provider_new();
881 gtk_css_provider_load_from_data(GTK_CSS_PROVIDER(provider),
883 "border-color: #808080;\n"
884 "border-style: solid;\n"
885 "border-width: 1px;\n"
886 "border-radius: 0px;\n"
889 gtk_style_context_add_provider(context, provider,
890 GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
892 gtk_render_check(context, cr,
893 pix_rect.x + i * TOGGLE_SPACING + (TOGGLE_WIDTH - TOGGLE_SPACING) / 2,
895 TOGGLE_WIDTH, TOGGLE_WIDTH);
896 gtk_render_frame(context, cr,
897 pix_rect.x + i * TOGGLE_SPACING + (TOGGLE_WIDTH - TOGGLE_SPACING) / 2,
899 TOGGLE_WIDTH, TOGGLE_WIDTH);
901 if (cellicon->focused && gtk_widget_has_focus(widget))
903 gtk_render_focus(context, cr,
904 pix_rect.x + i * TOGGLE_SPACING + (TOGGLE_WIDTH - TOGGLE_SPACING) / 2,
905 pix_rect.y, TOGGLE_WIDTH, TOGGLE_WIDTH);
907 gtk_style_context_restore(context);
911 gtk_paint_check(gtk_widget_get_style(widget), window,
912 state, (cellicon->marks & (1 << i)) ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
913 cell_area, widget, "cellcheck",
914 pix_rect.x + i * TOGGLE_SPACING + (TOGGLE_WIDTH - TOGGLE_SPACING) / 2,
916 TOGGLE_WIDTH, TOGGLE_WIDTH);
922 #if !GTK_CHECK_VERSION(3,0,0)
923 if (cellicon->focused && gtk_widget_has_focus(widget))
925 gtk_paint_focus(gtk_widget_get_style(widget), window,
929 cell_area->x, cell_area->y,
930 cell_area->width, cell_area->height);
936 #if GTK_CHECK_VERSION(3,0,0)
937 static gboolean gqv_cell_renderer_icon_activate(GtkCellRenderer *cell,
941 const GdkRectangle *background_area,
942 const GdkRectangle *cell_area,
943 GtkCellRendererState flags)
945 static gboolean gqv_cell_renderer_icon_activate(GtkCellRenderer *cell,
949 GdkRectangle *background_area,
950 GdkRectangle *cell_area,
951 GtkCellRendererState flags)
954 GQvCellRendererIcon *cellicon = (GQvCellRendererIcon *) cell;
955 GdkEventButton *bevent = &event->button;
957 if (cellicon->show_marks &&
958 event->type == GDK_BUTTON_PRESS &&
959 !(bevent->state & GDK_SHIFT_MASK ) &&
960 !(bevent->state & GDK_CONTROL_MASK ))
963 GdkRectangle cell_rect;
967 gtk_cell_renderer_get_padding(cell, &xpad, &ypad);
969 gqv_cell_renderer_icon_get_size(cell, widget, cell_area,
970 &cell_rect.x, &cell_rect.y,
971 &cell_rect.width, &cell_rect.height);
975 cell_rect.width -= xpad * 2;
976 cell_rect.height -= ypad * 2;
978 rect.width = TOGGLE_WIDTH;
979 rect.height = TOGGLE_WIDTH;
980 rect.y = cell_area->y + ypad + (cell_rect.height - TOGGLE_SPACING) + (TOGGLE_SPACING - TOGGLE_WIDTH) / 2;
981 for (i = 0; i < cellicon->num_marks; i++)
983 rect.x = cell_area->x + xpad + (cell_rect.width - TOGGLE_SPACING * cellicon->num_marks + 1) / 2 + i * TOGGLE_SPACING;
985 if (bevent->x >= rect.x && bevent->x < rect.x + rect.width &&
986 bevent->y >= rect.y && bevent->y < rect.y + rect.height)
988 cellicon->toggled_mark = i;
989 g_signal_emit(cell, toggle_cell_signals[TOGGLED], 0, path);
996 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */