{ GTK_CMCTREE_POS_AFTER, "GTK_CMCTREE_POS_AFTER", "after" },
{ 0, NULL, NULL }
};
-#if GLIB_CHECK_VERSION(2,10,0)
etype = g_enum_register_static (g_intern_static_string ("GtkCMCTreePos"), values);
-#else
- etype = g_enum_register_static ("GtkCMCTreePos", values);
-#endif
}
return etype;
}
{ GTK_CMCTREE_LINES_NONE, "GTK_CMCTREE_LINES_NONE", "none" },
{ 0, NULL, NULL }
};
-#if GLIB_CHECK_VERSION(2,10,0)
etype = g_enum_register_static (g_intern_static_string ("GtkCMCTreeLineStyle"), values);
-#else
- etype = g_enum_register_static ("GtkCMCTreeLineStyle", values);
-#endif
}
return etype;
}
{ GTK_CMCTREE_EXPANDER_TRIANGLE, "GTK_CMCTREE_EXPANDER_TRIANGLE", "triangle" },
{ 0, NULL, NULL }
};
-#if GLIB_CHECK_VERSION(2,10,0)
etype = g_enum_register_static (g_intern_static_string ("GtkCMCTreeExpanderStyle"), values);
-#else
- etype = g_enum_register_static ("GtkCMCTreeExpanderStyle", values);
-#endif
}
return etype;
}
{ GTK_CMCTREE_EXPANSION_TOGGLE_RECURSIVE, "GTK_CMCTREE_EXPANSION_TOGGLE_RECURSIVE", "toggle-recursive" },
{ 0, NULL, NULL }
};
-#if GLIB_CHECK_VERSION(2,10,0)
- etype = g_enum_register_static (g_intern_static_string ("GtkCMCTreeExpansionType"), values);
-#else
- etype = g_enum_register_static ("GtkCMCTreeExpansionType", values);
-#endif
+ etype = g_enum_register_static (g_intern_static_string ("GtkCMCTreeExpansionType"), values);
}
return etype;
}
sizeof (GtkCMCTree),
0, /* n_preallocs */
(GInstanceInitFunc) gtk_cmctree_init,
+
+ (const GTypeValueTable *) NULL /* value table */
};
ctree_type = g_type_register_static (GTK_TYPE_CMCLIST, "GtkCMCTree", &ctree_info, (GTypeFlags)0);
/* 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]);
+ gdk_cairo_set_source_color(cr, >k_widget_get_style(GTK_WIDGET(ctree))->text[GTK_STATE_NORMAL]);
if (ctree_row->expanded)
{
gint tmp3 = PM_SIZE / 2;
cm_return_if_fail (clist != NULL);
widget = GTK_WIDGET (clist);
+
+ /* if the function is passed the pointer to the row instead of null,
+ * it avoids this expensive lookup */
+ if (!clist_row)
+ clist_row = (g_list_nth (clist->row_list, row))->data;
+
style = clist_row->style ? clist_row->style : gtk_widget_get_style (widget);
if (greybg.pixel == 0 &&
ctree = GTK_CMCTREE (clist);
- /* if the function is passed the pointer to the row instead of null,
- * it avoids this expensive lookup */
- if (!clist_row)
- clist_row = (g_list_nth (clist->row_list, row))->data;
-
/* rectangle of the entire row */
row_rectangle.x = 0;
row_rectangle.y = ROW_TOP_YPIXEL (clist, row);
if (clist_row->fg_set && state != GTK_STATE_SELECTED)
fgcolor = &clist_row->foreground;
else
- fgcolor = &style->fg[clist_row->state];
+ fgcolor = &style->text[clist_row->state];
/* draw the cell borders */
if (area)
{
gdk_cairo_rectangle(cr, &cell_rectangle);
gdk_cairo_set_source_color(cr, &style->base[GTK_STATE_NORMAL]);
cairo_fill(cr);
+ cairo_rectangle(cr, cell_rectangle.x, cell_rectangle.y + row_rectangle.height + 1,cell_rectangle.width,cell_rectangle.height);
+ cairo_fill(cr);
}
}
else
gdk_cairo_rectangle(cr, &cell_rectangle);
gdk_cairo_set_source_color(cr, &style->base[GTK_STATE_NORMAL]);
cairo_fill(cr);
+ cairo_rectangle(cr, cell_rectangle.x, cell_rectangle.y + row_rectangle.height + 1,cell_rectangle.width,cell_rectangle.height);
+ cairo_fill(cr);
}
/* the last row has to clear its bottom cell spacing too */
else
gdk_cairo_set_source_color(cr, &style->base[state]);
cairo_fill(cr);
-
layout = create_cell_layout (clist, clist_row, i);
if (layout)
{
cairo_move_to(cr, offset, row_rectangle.y + row_center_offset + clist_row->cell[i].vertical);
gdk_cairo_set_source_color(cr, fgcolor);
pango_cairo_show_layout(cr, 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))
+ gtk_widget_get_can_focus (widget) && gtk_widget_has_focus (widget)
+ && state == GTK_STATE_SELECTED)
{
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);
+ gdk_cairo_set_source_color(cr, &style->text[GTK_STATE_NORMAL]);
+ cairo_move_to (cr, row_rectangle.x, row_rectangle.y + 0.5);
+ cairo_line_to (cr, row_rectangle.x + row_rectangle.width, row_rectangle.y + 0.5);
+ cairo_move_to (cr, row_rectangle.x, row_rectangle.y + row_rectangle.height - 0.5);
+ cairo_line_to (cr, row_rectangle.x + row_rectangle.width, row_rectangle.y + row_rectangle.height - 0.5);
cairo_stroke(cr);
}
}
switch (arg_id)
{
case ARG_N_COLUMNS: /* construct-only arg, only set at construction time */
-#if !GLIB_CHECK_VERSION(2,10,0)
- cm_return_if_fail (clist->row_mem_chunk == NULL);
-#endif
clist->columns = MAX (1, g_value_get_uint (value));
-#if !GLIB_CHECK_VERSION(2,10,0)
- clist->row_mem_chunk = g_mem_chunk_new ("ctree row mem chunk",
- sizeof (GtkCMCTreeRow),
- sizeof (GtkCMCTreeRow)
- * CLIST_OPTIMUM_SIZE,
- G_ALLOC_AND_FREE);
- clist->cell_mem_chunk = g_mem_chunk_new ("ctree cell mem chunk",
- sizeof (GtkCMCell) * clist->columns,
- sizeof (GtkCMCell) * clist->columns
- * CLIST_OPTIMUM_SIZE,
- G_ALLOC_AND_FREE);
-#endif
ctree->tree_column = CLAMP (ctree->tree_column, 0, clist->columns);
break;
case ARG_TREE_COLUMN: /* construct-only arg, only set at construction time */
ctree->tree_column = g_value_get_uint (value);
-#if !GLIB_CHECK_VERSION(2,10,0)
- if (clist->row_mem_chunk)
-#endif
ctree->tree_column = CLAMP (ctree->tree_column, 0, clist->columns);
break;
case ARG_INDENT:
return GTK_WIDGET_CLASS (parent_class)->button_press_event (widget, event);
}
-static gint
-gtk_cmctree_get_offset(GtkCMCTree *ctree,
- GtkCMCTreeRow *ctree_row,
- gint column,
- GdkRectangle *clip_rectangle)
-{
- gint justify_right = (GTK_CMCLIST (ctree)->column[column].justification == GTK_JUSTIFY_RIGHT);
-
- if (justify_right)
- return (clip_rectangle->x + clip_rectangle->width - 1 -
- ctree->tree_indent * (ctree_row->level - 1));
-
- return clip_rectangle->x + ctree->tree_indent * (ctree_row->level - 1);
-}
-
static GtkCMCTreeNode *
gtk_cmctree_last_visible (GtkCMCTree *ctree,
GtkCMCTreeNode *node)
list_end->next = work->next;
if (work->next)
- list = work->next->prev = list_end;
+ work->next->prev = list_end;
work->next = (GList *)node;
list = (GList *)node;
list->prev = work;
int i;
clist = GTK_CMCLIST (ctree);
-#if GLIB_CHECK_VERSION(2,10,0)
ctree_row = g_slice_new (GtkCMCTreeRow);
ctree_row->row.cell = g_slice_alloc (sizeof (GtkCMCell) * clist->columns);
-#else
- ctree_row = g_chunk_new (GtkCMCTreeRow, (GMemChunk *)clist->row_mem_chunk);
- ctree_row->row.cell = g_chunk_new (GtkCMCell, (GMemChunk *)clist->cell_mem_chunk);
-#endif
for (i = 0; i < clist->columns; i++)
{
dnotify (ddata);
}
-#if GLIB_CHECK_VERSION(2,10,0)
g_slice_free1 (sizeof (GtkCMCell) * clist->columns, ctree_row->row.cell);
g_slice_free (GtkCMCTreeRow, ctree_row);
-#else
- g_mem_chunk_free ((GMemChunk *)clist->cell_mem_chunk, ctree_row->row.cell);
- g_mem_chunk_free ((GMemChunk *)clist->row_mem_chunk, ctree_row);
-#endif
}
static void
GtkCMCList *clist;
gint xl;
gint yu;
-
+ gint hotspot_size;
+
cm_return_val_if_fail (GTK_IS_CMCTREE (ctree), FALSE);
cm_return_val_if_fail (node != NULL, FALSE);
tree_row = GTK_CMCTREE_ROW (node);
- yu = (ROW_TOP_YPIXEL (clist, row) + (clist->row_height - PM_SIZE) / 2 -
+ hotspot_size = clist->row_height-2;
+ if (hotspot_size > clist->column[ctree->tree_column].area.width - 2)
+ hotspot_size = clist->column[ctree->tree_column].area.width - 2;
+
+ yu = (ROW_TOP_YPIXEL (clist, row) + (clist->row_height - hotspot_size) / 2 -
(clist->row_height - 1) % 2);
if (clist->column[ctree->tree_column].justification == GTK_JUSTIFY_RIGHT)
xl = (clist->column[ctree->tree_column].area.x +
clist->column[ctree->tree_column].area.width - 1 + clist->hoffset -
- (tree_row->level - 1) * ctree->tree_indent - PM_SIZE);
+ (tree_row->level - 1) * ctree->tree_indent - hotspot_size);
else
xl = (clist->column[ctree->tree_column].area.x + clist->hoffset +
(tree_row->level - 1) * ctree->tree_indent);
- return (x >= xl && x <= xl + PM_SIZE && y >= yu && y <= yu + PM_SIZE);
+ return (x >= xl && x <= xl + hotspot_size && y >= yu && y <= yu + hotspot_size);
}
/***********************************************************