That GTK_GRID bit is a macro that evaluates at runtime and will chuck out runtime errors if the widget doesn't match. It supports inheritance. If you have for example a gtk_combo_box_text, you can use gtk_combo_box_set_active(GTK_COMBO_BOX(my_combo_box_text), 0) and it will select the first entry in the gtk_combo_box_text because gtk_combo_box_text inherits from gtk_combo_box like any good object oriented system.
Motif/libxm is very similar to that. With two important exceptions: the user code does not use type-checking macros and “stringly-typed” API for set a property to something is more or less a part of the overall ecosystem (well, Xm is just an layer built on top of Xt).
Gtk+ was originally an implementation of whatever parts of Motif were used by Gimp, built on an underlying object model that has nothing to do with Xt (which has both good and bad implications).
I'm a huge academic fan of what GTk has accomplished (thanks to their GObject type system), and as much as I know the C89 crowd who thinks macros are all evil probably abhor this kind of thing, I think GTk is one of the most epic, impressive, ambitious C codebases in existence. Witness as non-OO C matches, rivals, and quite often beats Qt on equivalent classes/features in plain C... It's even above "just C++ style C," as they have added features like a property and signal system...
I'm such a fanboy it inspired my own type system and massive core library, libgimbal, which uses a type system similar to GObject and targets game consoles like the Sega Dreamcast: https://github.com/gyrovorbis/libgimbal.
I remember writing a GTK extension widget many years ago, and yes, it was very much like this. The macros end up making your very own hand-coded vtable-equivalent, so that function calls get dispatched to the appropriate point in the inheritance chain. It was pretty eye-opening!
It looks like this when you program it:
That GTK_GRID bit is a macro that evaluates at runtime and will chuck out runtime errors if the widget doesn't match. It supports inheritance. If you have for example a gtk_combo_box_text, you can use gtk_combo_box_set_active(GTK_COMBO_BOX(my_combo_box_text), 0) and it will select the first entry in the gtk_combo_box_text because gtk_combo_box_text inherits from gtk_combo_box like any good object oriented system.