Re: signal/properties/enums/flags defs



On Wed, 2001-10-10 at 09:41, Murray Cumming wrote:
> Here is a program to generate the .defs sections for signals,
> properties, enums, and flags. You can get it by checking out the
> gtkmm-1.3 module.
> 
> http://cvs.gnome.org/bonsai/cvsblame.cgi?file=gtkmm-root/tools/generate_extra_defs.cc&rev=&root=/cvs/gnome
> 
> And here's a sample .defs file, for GtkButton and GtkContainer. Does
> anyone know how I can dynamically get a list of all the GTK/GDK types,
> instead of having to hand-code gtk_button_get_type(),
> gtk_container_get_type() etc?

Unfortunately you can't really get a list of all the types at runtime
and then loop through them. Non-fundamental types have to be registered
with the type system by calling name_get_type() so you have to call all
of those functions somehow. You can get a list of all those function
names by looking at the .def files distributed with the source. Then you
could write a simple script to generate a program which calls all of
them.
 
> http://www.murrayc.com/temp/gtk_extra.defs
> 
> It only does signals and properties at the moment. Does anyone know how
> I can ask a GObject, or glib itself, for it's enums and flags?

You can't query a GObject for the enum and flags it uses, but you can
use the .def files mentioned above to find them. They are all in
uppercase and look like GTK_TYPE_WIDGET_FLAGS or similar. Then you can
turn them into the type name, GtkWidgetFlags easily. (You could also
parse gtkenums.h to get the type names) From that you can
get the GType and use the g_enum funcs to get all the nicks and values.

Mark




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