GtkTreeView change.



In an attempt to close 59032 and 50344 (as well as 50062), I changed the
way events are passed to cells in the tree view.  This involved adding a
new interface (GtkCellEditable) and changing the interface to
GtkCellRenderer.

In particular, we used to have an "event" virtual function on
GtkCellRenderer that was called when the user clicked on a cell (mostly
for GtkCellRendererToggle).  Now, GtkCellRenderer has two properties,
"can_activate", and "can_edit".  These two properties are mutually
exclusive.  If "can_activate" is TRUE, then the GtkTreeView will call
gtk_cell_renderer_activate on the renderer, and pass in either the
GdkEvent (in the case of a button-press event) or NULL.

On the other hand, if "can_edit" is TRUE, then
gtk_cell_renderer_start_editing is called.  This will return a
GtkCellEditable object (which is also a floating GtkWidget).  The
GtkTreeView will take this reparent it over the cell.  When done, the
widget can emit "editing_done", or the GtkTreeView itself can call
gtk_cell_editable_stop_editing.  The GtkCellEditable then emits a
remove_widget signal, letting the GtkTreeView know to destroy that
widget.

Anyway, I'm going to try to write a simple editable text interface later
tonight to test it out.

-Jonathan

Here's the interface:

struct _GtkCellEditableIface
{
  GTypeInterface g_iface;

  /* signals */
  void (* editing_done)  (GtkCellEditable *cell_editable);
  void (* remove_widget) (GtkCellEditable *cell_editable);

  /* virtual table */
  void (* start_editing) (GtkCellEditable *cell_editable,
			  GdkEvent        *event);
  void (* stop_editing)  (GtkCellEditable *cell_editable);
};


GType gtk_cell_editable_get_type      (void) G_GNUC_CONST;

void  gtk_cell_editable_start_editing (GtkCellEditable *cell_editable,
				       GdkEvent        *event);
void  gtk_cell_editable_stop_editing  (GtkCellEditable *cell_editable);
void  gtk_cell_editable_editing_done  (GtkCellEditable *cell_editable);
void  gtk_cell_editable_remove_widget (GtkCellEditable *cell_editable);







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