[Glade-users] [Glade-users][Re] ? on lookup widget(...)

I imagin that widgets in the same hierarchy are linked by a linked-list. So
to get a pointer to a particular widget, the first, one has to tell the code
which linked list (because there might be a number of instances, i.e. array
of linked-list) is the target, and then find the parent of that list, and
finally determine whether the second argument is on the list or not. Right?

Mike Huang 

-----Original Message-----
From: J. Seo [mailto:liberta kldp org]
Sent: Monday, August 27, 2001 6:25 PM
To: glade-users ximian com
Subject: [Glade-users] [Glade-users][Re] ? on lookup widget(...)

No, the first parameter doesn't mean the pointer to the parent widget.
It could be any widget which is in the same hierarchy, of course, with the
second parameter.

Refer to the definition for lookup_widget ();  (comment lines included)

/* In "support.c" generated by Glade */
lookup_widget                          (GtkWidget       *widget,
                                        const gchar     *widget_name)
  GtkWidget *parent, *found_widget;

  for (;;)     // finding "Root (Parent)" by the first param.
      if (GTK_IS_MENU (widget))
        parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
        parent = widget->parent;
      if (parent == NULL)
      widget = parent;

  found_widget = (GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget),
                                                   widget_name);  // 
finding the requested widget
       // with its name.
  if (!found_widget)
    g_warning ("Widget not found: %s", widget_name);
  return found_widget;
/* ... */

ps. Sorry for my poor English  :-)

Glade-users maillist  -  Glade-users ximian com

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