Re: IS_A Type Question.



Pat Suwalski wrote:
Hello,

I'm trying to recycle a callback function. The UI element comes in as a GtkWidget*.

The possible types I'm looking at right now are GtkCheckButton and GtkCheckMenuItem. Specifically, I'm looking at an attribute they have in common, "active."

So, where the attribute is accessed, I'd like to assert if the object is of one type or the other, and read the attribute accordingly. In a language like Java, I can easily find the is_a relationship. Is there something in the gtk library that will do the same? It seems like I've looked everywhere! :)
In the header files of every object are the convenience macros
provided for that purpose.

There is probably a strict naming convention concerning this
but I still say consult the header is best.

usualy something like "GtkButton" type will translate to
GTK_IS_BUTTON(object) to be used as a boolean truth value.

GtkHScale    --> gtk+/gtkhscale.h -->   GTK_IS_HSCALE()
GtkLabel     --> gtk+/gtklabel.h  -->   GTK_IS_LABEL()

and so on ;-)


Cheers,
                        -Tristan




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