Request for GtkTable to allow reattachment of child widget
- From: Ang Bodhi <angbodhi pacific net sg>
- To: gtk-list gnome org
- Subject: Request for GtkTable to allow reattachment of child widget
- Date: Wed, 08 Aug 2001 22:12:35 +0800
Hi
I'm writing an application using Gtk, in which I use a GtkTable
widget. On a table with a few widgets attached, I need to be able
to dynamically change the attachment position of the child widgets.
Current Gtk table implementation (1.2.8 and 1.2.10) don't allow this.
I find that the reattachment feature can be supported by just the
following changes to the gtk_table_attach() function:
507c507
< g_return_if_fail (child->parent == NULL);
---
> g_return_if_fail (child->parent == NULL || child->parent == table);
520,521c520,535
< table_child = g_new (GtkTableChild, 1);
< table_child->widget = child;
---
> if (child->parent == NULL) {
> table_child = g_new (GtkTableChild, 1);
> table_child->widget = child;
> }
> else {
> GList *list;
>
> table_child = NULL;
> for (list = table->children; list; list = list->next)
> if (((GtkTableChild *)list->data)->widget == child) {
> table_child = (GtkTableChild *)list->data;
> break;
> }
>
> g_return_if_fail (table_child != NULL);
> }
533a548,550
>
> if (child->parent == NULL) {
> table->children = g_list_prepend (table->children, table_child);
535,537c552,553
< table->children = g_list_prepend (table->children, table_child);
<
< gtk_widget_set_parent (child, GTK_WIDGET (table));
---
> gtk_widget_set_parent (child, GTK_WIDGET (table));
> }
I think this feature is quite useful generally and wonder if you
can support it?
Thanks,
Ang Bodhi
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]