Re: [gtk-list] Datalists in GtkTypes



On Tue, May 02, 2000 at 10:22:49PM +0100, Dominic Ludlam wrote:
> I would like to be able to associate arbitrary data
> with GtkTypes for the equivalent of static data members
> in C++ classes.

It depends on what you are trying to do, I guess.

If you want specific "static data" to be associated with classes that
you are defining, you'd add it to the class struct.  i.e.

struct GtkFoo {
  GtkBase base;
};

struct GtkFooClass {
  GtkBaseClass base_class;
  gchar* my_static;
  gint more_static;
  gpointer even_more_static;
};

If you want to attach arbitrary data to arbitrary types (including
existing types), why not make a GHash of GHashed, keyed on GtkTypes
and identifying strings.

If you explain exactly what you are trying to do, we may be able to
offer better advice...

-JT

-- 
GNU/Linux: Free your mind and your OS will follow.



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