Re: [gtk-list] signals, objects, user_data and stuff.
- From: Martin Kestel <mka mppmu mpg de>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] signals, objects, user_data and stuff.
- Date: Tue, 28 Mar 2000 10:54:08 +0200 (MET DST)
Hi,
I would like to suggest something similar to what sby had been suggesting
earlier on this list:
Define a struct like
struct MYTHINGY {
GtkWidget *window;
GtkWidget *buttonone, *buttontwo, *label;
GtkWidget *whateverotherwidget;
/* The trick comes here: */
GList *list_of_nodes;
};
struct MYNODE {
GtkWidget *somenodehoweveryoudefineit;
GList *list_of_connectors;
};
When booking a new node, you add a pointer to the (struct MYNODE *)mynode to
((struct MYTHINGY *)mythingy)->list_of_nodes
Whenever now some user (just curious: is it LabView-like?) connects two nodes
with a connector, you add pointers to (yet another struct CONNECTOR
*)connector into the (GList *)mynode->list_of_connectors ... in each of the
two.
[You want the lines go in a grid. Fine; define some Gridpoints or however you
want to do it and add some more structs and pointers to structs.]
What you save in such an approach is messing around with files to read in and
such ugly things like fileformats and so on. ....and say it goes boom at some
point you are left with some MB of junk files around...nonono.
Just use all the nice GList - features. You create loops over your lists with
length = (int) g_list_length((GList *)LIST);
or use g_list_foreach( args ). Just things you lookup with ingo glib and look
into doubly linked lists or singly linked lists.
And, btw, the testgtk.c program and some of the examples may serve as examples
for the GList usage as well.
If you want to see some code, please ask me privately for sth, I dont want to
take the time to strip it and post it here, sorry, too busy!
cheers,
Martin
On 28 Mar 2000, Thomas Mailund wrote:
>
>Hi all.
>
[ I may cut your mail and leave the question I have tried to answer]
[...]
>
>It's not nice, but it would work. But if I add bend points to
>connectors it gets tricky. Then I need a special callback for each
>bend point, just to pass an integer parameter along. If I don't know
>the number of bend points statically (which I don't, since the
>connectors are read in from a file) I don't see how I can do this.
>
>Does anyone have any suggestions on how to achieve what I want here?
>Either getting the extra parameter passed along or perhaps redesigning
>it all and do something more clever?
>
> /mailund
>
>--
>To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]