Re: GtkComboBox aesthetics (more)



On Sat, 30 Jul 2005 16:13:23 -0300
John Coppens <john jcoppens com> wrote:

Now, for some reason, GtkComboBox by default uses a height of 32-odd
pixels, while an entry has only 23 or so. This makes for a very ugly
combination... Strangely, a GtkComboBoxEntry does have the same height
as the normal entry, but I don't want to permit editing...
...

Ok - I since detected that I had to use the cell_layout interface.
Here's what I tried to do:

As I create the interface with glade, I attached a callback to the
'realize' event, and put the following in the function:

  GtkCellRenderer *renderer;

  renderer = gtk_cell_renderer_text_new();
  g_object_set(G_OBJECT(renderer), "ypad", 0, NULL);
  g_object_set(G_OBJECT(widget), "can-focus", FALSE, NULL);
  gtk_cell_layout_clear(GTK_CELL_LAYOUT(widget));
  gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(widget), renderer, TRUE);
  gtk_cell_layout_add_attribute(GTK_CELL_LAYOUT(widget), renderer, "text",
       0);

I know this is complicated. I create a new renderer, as I cannot find how
to get to the original one in the ComboBox widget.

The result of this? When the widget is used, suddenly all comboboxes on
the pages change size, probably because they share the same cell_layout.
The ComboBoxes get smaller as desired, but one of the boxes doesn't have
the text centered anymore.

The boxes were still heigher than the entry widget, so I added the
'can-focus' line, hoping to make the space around text+icon disappear.
Nothing happened - the widget can still receive focus, and the size is
still the same...

Help!
John




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