Re: copy a widget



Thats a really cool idea.
        You might even be able to do that
from the GObject level.


-------------------------------------------------
(you can skip to the PS if you're not interested)
-------------------------------------------------

gpointer new_widget = G_OBJECT(widget_to_copy)->dup();


of course there are complications, every widget/object
would have to implement a dup() "method". (or thats the
way its done in other OOP environments). you would have your
special GObject->dup() that sets up the object's memory
space using all the dup()'s from each child type

e.g.

GObject would allocate enough
space to hold a "GtkType gtk_button_get_type()"
and then do something like:

gpointer *child = GTK_OBJECT(gobject_to_copy)->dup();

and then memcpy it into GTK_OBJECT(new_gobject);

and loop through all the children untill you
have one encapsulated Gobject like the button below.

        +--------------+
        | GObject      |
        +--------------+
        | GtkObject    |
        +--------------+
        | GtkWidget    |
        +--------------+
        | GtkContainer |
        +--------------+
        | GtkBin       |
        +--------------+
        | GtkButton    |
        +--------------+
        
Of course there are alot of complications;
i.e. you want to construct classes "intact"
while copying instances like mirror images
exept for new file descriptors and pointers
to allocated memory.

-------------------------------------------
   END OF PROBABLY USELESS BRAINSTORM
-------------------------------------------

PS:
        there are some duplicating methods
for various types of widgets (I think GdkPixbuf
does that or maybe GdkPixmap). I dont think
it exists for GtkTable.

Anyway I thought it was a really cool idea
but unfortunatly It doesn't seem to be a 
one man job.

Cheers and good luck!
        -Tristan

Jacob Perkins wrote:

Is there a way to construct a new widget from a current widget?
Specifically, I'd like to copy a table and all of its children so that I
have two identical, but separate, tables.
--
pub  1024D/57DDD9E3 2002-05-24 Jacob (Direct to Home)
<jap1 rig dyndns ws>
Key fingerprint = 1E02 A5FD 8162 4322 C674  6E67 05EB 30F1 57DD D9E3
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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