Re: How to determine the type of a widget?

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

 



On Sunday 28 November 2004 01:26, you wrote:
> Hi,
>
> "Marc K." <marc@xxxxxxxxxxxxxx> writes:
> > Question: how can I determine the type of a widget
> > when all I know is that it is a GtkWidget? i.e. it may
> > be a GtkButton, GtkFrame, etc.
> >
> > I tried to dig into the manual for an easy solution but
> > I cant seem to find any. Or maybe I miss something?
>
> You should make yourself familiar with GObject. You are probably
> looking for G_TYPE_FROM_INSTANCE().

What I want to achieve is to collect some IDs (or something similar)
when I create the internal classes. At this point, I have not created
any instances. So I think I cant use G_TYPE_FROM_INSTANCE.

Class *ButtonClass = ClassNew ("Button", BinClass, ....
klass = get_the_class_of (GtkButton)
id = the_id_of_class (klass)
set_class_id (ButtonClass, id)
...
then later (stupid code but i hope it makes the point)
....
id = get_id_of_this_widget_instance (w)
Class c = get_class_from_id (id)
if (c == ButtonClass)
   ...
else if (c == FrameClass)
   ...
etc.

marc

_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux