Glade and widget-cherry-picking ^_^
| From: | Sky | Date: | Fri, 12 Dec 2003 03:57:50 +0000 |
| Subject: | Glade and widget-cherry-picking ^_^ | ||
| Groups: | php.gtk.general | ||
| Request: | Send a blank email to php-gtk-general+get-4291@lists.php.net to get a copy of this message | ||
For a while now, I've had my eye on using glade for my program. I've been
slightly worried, though, since, I want my app to be extensible in most
areas.... and modifying the GUI could be a problem. But, I've come to the
conclusion that it won't be.
Anyway... As is my style, I wrote my code before hand - in this case a
helper class - then made my interface.
One of the problems I thought of... was that some of my windows were created
dynamically... Or re-constructed every call, you could say. Now, with glade,
I thought this would be quite... Either impractical, or impossible. I didn't
want to end up half and half though...
So I came up with what I think is a solution.
In my helper class, there are two glade load functions. One loads a entire
glade file (I didn't like having to "prissy-foot" around names and name
every widget uniquely. So I implimented a name parser. Each widget's name -
except ones with massive amounts of children, like menubars for example -
starts with it's owner window's abbreviation (like, preferences -> prefs)
and a |. So, say, prefs|window and prefs|buttonChange). The function opens
up and does a preg-match-all on the glade file, and gets all the names.
After loading the glade, it goes through the list, and assigns each
top-level (by name) to a variable in the object. So, that prefs window would
be reffered to with something like: $glade->prefs['window'].)
-And one is designed to load a glade file, then "surgically extract" a
widget and it's children, if any, by name. Then it strips the toplevel name
(why have it?) and puts the widgets in the object.
This, in theory, will solve my problem. Each time I want a widget, I get the
glade, get the widget. But, in my mind, I'm yelling at myself for taking
what seems like a shortcut. So...
(Yes, this post does actually have a question)
Is there a copy method? It would be much simpler if I constructed the entire
interface in glade, then hid and copied the windows and or widgets I needed
to create dynamically, then modify them.
This is my delemma, Hear my plea! ^_^
Also, how is php-gtk2 coming? I have linux, yes, but php-gtk was hell to
install, and I'm not doing it again.... Not going to risk messing it up.. no
way. Is it past "hello world"? I'm really eager, after playing around with
Glade2... Lotsa fun stuff, and that's only Gtk+2... (or are they the same?
gah...)