Cell renderers -- "ypad" lower limit unpractical



	Let`s say i want to achieve extremely space-efficient list views.

	Let`s say i want CellRendererText to be $FONT_HEIGHT_MAX + 2
 pixels high, so that no pixels are wasted at all.

	How do i do this?

	Ok, we have the "ypad" g_object property of the CellRenderer. And the
 expected way to drop the wasted pixels is to set this property to zero.
 And yes, it by default equals to 2 (which is a perfect default, but remember,
 we go for extreme space saving).

	However setting it to zero still leaves more than 5 pixels wasted for
 no apparent reason.


	Below is a test program which shows this deficiency. But somehow it is
 not the only one.

	Its seems to be impossible to set the size of a cell renderer below 10
 pixels high. And this is very frustrating because given some ultra small fonts
 this could be extremely cool. Think XMMS playlist for example.


---------------8<----------------
#include <gtk/gtk.h>


int main(int argc, char **argv)
{
	GtkTreeViewColumn *col;
	GtkCellRenderer *rend;
	GtkListStore *store;
	GtkTreeIter iter;
	GtkWidget *window;
	GtkWidget *view;

	gtk_init(&argc, &argv);

	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

	store = gtk_list_store_new(1, G_TYPE_STRING, -1);
	view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));

	rend = gtk_cell_renderer_text_new();
	g_object_set(G_OBJECT(rend), "ypad", 0, NULL);
	col = gtk_tree_view_column_new_with_attributes ("hrmph", rend, "text", 0, NULL);
	gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);

	gtk_container_add(GTK_CONTAINER(window), view);
	gtk_widget_show(view);
	gtk_widget_show(window);

	gtk_list_store_append(store, &iter);
	gtk_list_store_set(store, &iter, 0, "1. ABC123T", -1);
	gtk_list_store_append(store, &iter);
	gtk_list_store_set(store, &iter, 0, "2. DEF345T", -1);
	gtk_list_store_append(store, &iter);
	gtk_list_store_set(store, &iter, 0, "3. GHI678T", -1);

	gtk_main();

	return 0;
}
---------------8<----------------

regards, Samium Gromoff



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]