gint x)
{
GtkCMCList *clist;
- GdkPoint points[3];
gint justification_factor;
gint y;
return x + justification_factor * (PM_SIZE + 3);
}
+ /* pixel offsets +/- 1 or +/- justification_factor here and there ..
+ * to fill correctly, somewhat ... what do I do wrong?
+ */
+ gdk_cairo_set_source_color(cr, >k_widget_get_style(GTK_WIDGET(ctree))->fg[GTK_STATE_NORMAL]);
if (ctree_row->expanded)
{
- points[0].x = x;
- points[0].y = y + (PM_SIZE + 2) / 6;
- points[1].x = points[0].x + justification_factor * (PM_SIZE + 2);
- points[1].y = points[0].y;
- points[2].x = (points[0].x +
- justification_factor * (PM_SIZE + 2) / 2);
- points[2].y = y + 2 * (PM_SIZE + 2) / 3;
+ gint tmp3 = PM_SIZE / 2;
+ gint tmp6 = PM_SIZE / 6;
+ cairo_move_to(cr, x + justification_factor * (tmp3 + tmp6) + (PM_SIZE / 2), y + 1);
+ cairo_rel_line_to(cr, 0, tmp3 + tmp6 + 1);
+ cairo_rel_line_to(cr, -justification_factor * (tmp3 + tmp6) - justification_factor, -1);
}
else
{
- points[0].x = x + justification_factor * ((PM_SIZE + 2) / 6 + 2);
- points[0].y = y - 1;
- points[1].x = points[0].x;
- points[1].y = points[0].y + (PM_SIZE + 2);
- points[2].x = (points[0].x +
- justification_factor * (2 * (PM_SIZE + 2) / 3 - 1));
- points[2].y = points[0].y + (PM_SIZE + 2) / 2;
+ gint tmp3 = PM_SIZE / 2;
+ gint tmp6 = PM_SIZE / 6;
+ cairo_move_to(cr, x + tmp6 - justification_factor + (PM_SIZE / 2), y + tmp6 - 1);
+ cairo_rel_line_to(cr, justification_factor * tmp3, tmp3);
+ cairo_rel_line_to(cr, -justification_factor * tmp3, tmp3);
}
-
-
- cairo_new_path(cr);
- cairo_set_source_rgb(cr, 255, 255, 255);
- cairo_set_line_width(cr, 1);
- cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
- cairo_move_to(cr, points[0].x, points[0].y);
- cairo_line_to(cr, points[1].x, points[1].y);
- cairo_line_to(cr, points[2].x, points[2].y);
- cairo_close_path(cr);
cairo_fill(cr);
-
- cairo_new_path(cr);
- gdk_cairo_set_source_color(cr, >k_widget_get_style(ctree)->fg[GTK_STATE_NORMAL]);
- cairo_set_line_width(cr, 1);
- cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
- cairo_move_to(cr, points[0].x, points[0].y);
- cairo_line_to(cr, points[1].x, points[1].y);
- cairo_line_to(cr, points[2].x, points[2].y);
- cairo_close_path(cr);
- cairo_stroke(cr);
- cairo_set_antialias(cr, CAIRO_ANTIALIAS_DEFAULT);
x += justification_factor * (PM_SIZE + 3);
GtkWidget *widget;
GtkStyle *style;
GtkCMCTree *ctree;
- GdkRectangle *rect;
GdkRectangle *crect;
GdkRectangle row_rectangle;
GdkRectangle cell_rectangle;
GdkRectangle clip_rectangle;
GdkRectangle intersect_rectangle;
gint last_column;
- gint column_left = 0;
- gint column_right = 0;
gint offset = 0;
gint state;
gint i;
static GdkColor greybg={0, 0, 0, 0};
static gboolean color_change = TRUE;
cairo_t *cr;
- GdkColor *fgcolor, *bgcolor, *focuscolor;
+ GdkColor *fgcolor, *bgcolor;
cm_return_if_fail (clist != NULL);
widget = GTK_WIDGET (clist);
- style = gtk_widget_get_style (widget);
+ style = clist_row->style ? clist_row->style : gtk_widget_get_style (widget);
if (greybg.pixel == 0 &&
greybg.red == 0 &&
if (prefs_common.use_stripes_everywhere && GTK_SCTREE(ctree)->show_stripes
&& color_change && row % 2) {
bgcolor = &greybg;
- focuscolor = &greybg;
} else {
bgcolor = &style->base[GTK_STATE_NORMAL];
- focuscolor = &style->base[GTK_STATE_NORMAL];
}
state = clist_row->state;
cr = gdk_cairo_create(clist->clist_window);
- fgcolor = &style->fg[clist_row->state];
+
+ if (clist_row->fg_set && state != GTK_STATE_SELECTED)
+ fgcolor = &clist_row->foreground;
+ else
+ fgcolor = &style->fg[clist_row->state];
/* draw the cell borders */
if (area)
{
- rect = &intersect_rectangle;
crect = &intersect_rectangle;
if (gdk_rectangle_intersect (area, &cell_rectangle, crect)) {
- gdk_cairo_rectangle(cr, crect);
+ gdk_cairo_rectangle(cr, &cell_rectangle);
gdk_cairo_set_source_color(cr, &style->base[GTK_STATE_NORMAL]);
cairo_fill(cr);
}
}
else
{
- rect = &clip_rectangle;
crect = &cell_rectangle;
- gdk_cairo_rectangle(cr, crect);
+ gdk_cairo_rectangle(cr, &cell_rectangle);
gdk_cairo_set_source_color(cr, &style->base[GTK_STATE_NORMAL]);
cairo_fill(cr);
}
pixbuf_width = 0;
height = 0;
- gdk_cairo_rectangle(cr, &cell_rectangle);
- if (state == GTK_STATE_NORMAL)
- gdk_cairo_set_source_color(cr, bgcolor);
- else
- gdk_cairo_set_source_color(cr, &style->base[state]);
- cairo_fill(cr);
if (area && !gdk_rectangle_intersect (area, &cell_rectangle,
&intersect_rectangle))
{
}
else
{
+ gdk_cairo_rectangle(cr, &cell_rectangle);
+ if (state == GTK_STATE_NORMAL)
+ gdk_cairo_set_source_color(cr, bgcolor);
+ else
+ gdk_cairo_set_source_color(cr, &style->base[state]);
+ cairo_fill(cr);
+
layout = create_cell_layout (clist, clist_row, i);
if (layout)
{
g_object_unref (G_OBJECT (layout));
}
}
+ /* draw focus rectangle */
+ if (clist->focus_row == row &&
+ gtk_widget_get_can_focus (widget) && gtk_widget_has_focus (widget))
+ {
+ if (!area || gdk_rectangle_intersect (area, &row_rectangle,
+ &intersect_rectangle))
+ {
+ cairo_set_line_width(cr, 1.0);
+ cairo_set_antialias(cr, CAIRO_ANTIALIAS_NONE);
+ gdk_cairo_set_source_color(cr, &style->fg[GTK_STATE_NORMAL]);
+ cairo_rectangle(cr, row_rectangle.x, row_rectangle.y,
+ row_rectangle.width + 1,
+ row_rectangle.height);
+ cairo_stroke(cr);
+ }
+ }
cairo_destroy(cr);
}
GtkCMCList *clist;
GtkCMCTreeNode *node;
GtkCMCTreeNode *child;
- GtkStyle *style;
gint i;
cm_return_if_fail (GTK_IS_CMCTREE (widget));
gtk_cmctree_pre_recursive (ctree, child, ctree_attach_styles, NULL);
node = GTK_CMCTREE_NODE_NEXT (node);
}
-
- style = gtk_widget_get_style(widget);
}
static void
GdkDragContext *context)
{
GtkCMCList *clist;
- GtkCMCTree *ctree;
gboolean use_icons;
cm_return_if_fail (GTK_IS_CMCTREE (widget));
cm_return_if_fail (context != NULL);
clist = GTK_CMCLIST (widget);
- ctree = GTK_CMCTREE (widget);
use_icons = GTK_CMCLIST_USE_DRAG_ICONS (clist);
GTK_CMCLIST_UNSET_FLAG (clist, CMCLIST_USE_DRAG_ICONS);
if (use_icons)
{
- GtkCMCTreeNode *node;
-
GTK_CMCLIST_SET_FLAG (clist, CMCLIST_USE_DRAG_ICONS);
- node = GTK_CMCTREE_NODE (g_list_nth (clist->row_list,
- clist->click_cell.row));
gtk_drag_set_icon_default (context);
}
}