Getting widgets object data from its parent.



        One thing I've been attempting to do is get a widget by knowing its
parent.  I'll give you a c example;

GtkWidget*
lookup_widget                          (GtkWidget       *widget,
                                        const gchar     *widget_name)
{
  GtkWidget *parent, *found_widget;

  for (;;)
    {
      if (GTK_IS_MENU (widget))
        parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
      else
        parent = widget->parent;
      if (parent == NULL)
        break;
      widget = parent;
    }

  found_widget = (GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget),
                                                   widget_name);
  if (!found_widget)
    g_warning ("Widget not found: %s", widget_name);
  return found_widget;
}

This goodie when given the parent widget and the name of the child one is
looking for, it returns a GtkWidget.  How can I acomplish this in perl?

gtk_object_get_data isnt avaible in Gtk-Perl.  Any Ideas?

Rick




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