non window widgets as GtkEditable



Hi,

I'm trying to put a ComboBoxEntry inside a TreeView (and inside my Grid)
so I made a CellRendererCombo for this purpose. I also added a minimal
implementation of the GtkCellEditable interface to GtkComboBox. By the
way, I'm using GTK+-2.4.0.

So, in the start_editing method of CellRendererCombo I create a new
GtkComboBox and return it. Then GtkTreeViewColumn gets it and gives it
to GtkTreeView, which make that combo box its own child (via the
gtk_tree_view_put method). This is exactly the same that the
GtkCellRendererText does with GtkEntry. And it also worked for me for a
CellRendererSpin with a GtkSpinButton.

But, GtkComboBox is a no (gdk) window widget and I think that's why I'm
not getting good results [1].

[1] http://www.sicem.biz/personal/lgs/hacks/combo-problem.jpg

The problem is that the expose method of GtkComboBox is not being called
and that's why the button with the arrow is not drawn.

I didn't give up and I tried the following code in the start_editing of
the ComboBox (not the start_editing method of the CellRendererCombo):

static void
gtk_combo_box_start_editing (GtkCellEditable *cell_editable,
			     GdkEvent        *event)
{
  GtkWidget *widget;
  widget = GTK_WIDGET (cell_editable);
  gdk_window_invalidate_rect (widget->window, &widget->allocation,
FALSE);
}

I also tried with gtk_widget_queue_draw (widget) instead of
gdk_window_invalidate but none of them worked.

Now I'm pretty lost as I don't really know how drawing works in GTK+ for
non window widgets. I just know that they use the gdk window of their
parent to draw themselves but this knowledge doesn't help too much.

Any clue?

Thanks in advance

Lorenzo






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