Re: GailTreeView Changes Proposal



Marc & Others:

I just had a long discussion with Bill and I think we have a workable
solution for how GailTreeView should support its flyweights.

The proposed solution is to implement the various GailCell's (like
GailCellText, etc.) as follows:

1. They cache their data value.
2. They are ignorant of their parent object.  For example they contain
   no row/column information.
3. They implement the appropriate interface (GailCellText would implement
   AtkText for example).
4. They contain a pointer to a GailTreeViewCellInterface (described below).
5. The ability for the cell to update it's cached data value from its
   parent after it receives a "value-changed" notification.

Any object that uses cells (like GailTreeView) will have a single instance
of a GailTreeViewCellInterface object which serves all of its cell children.
This interface object provides the following:

1. A cache of every cell that is currently active.  Also cached will be any
   specific data it needs in order to calculate its children's values.
   In the case of GailTreeView this would include the GtkTreeRowReference
   and the GtkTreeViewColumn pointer.
2. Notification of state changed to "defunct" and "stale"
3. Notification of when the value has been changed.
   
This is nice for the following reasons:

1. GailTreeViewCellInterface hides all row/col info from the actual
   GailCell implementation.  This is nice if GailCell's are reused in
   different Gtk widgets (which may not use row/col to reference the
   cell).
2. Registrys can be set up to build the various GailCells based upon
   the renderer type.  So the "atk_registry_get_factory" type can use
   the renderer type to determine the proper factory to use.
3. The GtkTreeView code just needs to build one interface object when
   it is first instantiated.  Then it just shares this among all cells.
   In other words, the GtkTreeView ref_at function currently has this
   code:
  
      gail_cell_init (GAIL_CELL (cell), GTK_WIDGET (view), row, column);
 
   Instead of passing in the view, row, column information it would add
   the GailCell and it's row/column information to the caches in the
   GailTreeViewCellInterface and then pass the GailTreeViewCellInterface
   into the gail_cell_init function.
   
Brian





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