How to draw GtkCellRendererCombo in (inside) a custom cell renderer?
- From: Osmo Antero <osmoma gmail com>
- To: gtk-app-devel-list gnome org
- Subject: How to draw GtkCellRendererCombo in (inside) a custom cell renderer?
- Date: Tue, 5 Jun 2012 20:38:52 +0200
Hello,
I want to create my own cell-renderer for a treeview widget.
This custom cell will contain a text string and a combobox with some
values.
So my custom cell (row) contains both GtkCellRendererText and
GtkCellRendererCombo widgets.
The cell renderer works well that it displays the text string, but the
combobox is *invisible*.
In cell-renderer.c, I carefully get the size of the combobox:
gtk_cell_renderer_get_preferred_size(p->combo_renderer, widget, NULL,
&size);
combo_area.width = size.width;
combo_area.height = size.height;
And then render it to cell with:
combo_area.x = title_area.x + title_area.width + GUI_PAD;
combo_area.y = fill_area.y + (fill_area.height - combo_area.height )/2;
gtk_cell_renderer_render(p->combo_renderer, window, widget,
background_area, &combo_area, flags);
See the render_row(...) function in "cell-renderer.c" file.
But the p->combo_renderer (of type GtkCellRendererCombo) will not show up.
The treeview row should display:
"Node 1-0 text [Combobox with values]"
"Node 1-1 text [Combobox with values]"
"Node 1-2 text [Combobox with values]"
...
What could be wrong with my code?
Here is a complete example of this:
http://www.futuredesktop.org/tmp/Test6.tar.gz
Use the "m.sh" script to compile it:
$ ./m.sh
Then run:
$ ./main
You should see this:
http://bildr.no/view/1197631
Ref: http://developer.gnome.org/gtk3/stable/GtkCellRendererCombo.html
GtkCellRendererCombo
Thanks for all comments.
Kindly
Osmo Antero
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]