|PHPCompris, an edukational tool
|Home | Develop | Contacts |Links
properly not a Object Oriented Programming vision, but a container-wrapper vision:
in that gtkfixed, i place all the widgets.
- the gcompris widgets are:
- a vbox that includes 2 (or 3) areas:
- canvas (the place where plugins put their objects)
- canvas_bar (obviously, the bar on bottom of window)
- porting of gnome code to GTK1 (php-gtk).
the map that links gnome items to php-gtk items is this:
- pixmap: an extension of GtkButton (with a pixmap into it)..
- group: gtkfixed
- button: gtkbutton
- text: gtktext (but i think that is a label... i don't know).
- vbox: gtkvbox (but not used).
- every gnome item is "embedded" into a class, CanvasItem.
in the constructor of these items, the original functions have
variable arguments; i used an hash as the third argument (with
the key->value data as x=>100, y=>200).
the pixmaps used into the canvasitem are returned from a gdk_pixbuf_new_from_filename
that returns 3 elements: picture, mask, and the dimensions (loaded from the 4th line of
xpm file, that contains width and height).
- xml stuff.
i used domxml for reading xml data, loading completely the tree in memory.
i didn't reach to use the xpath section (for specify queries into xml), things should be more easy.
gnome uses xml files for preferences so you can found gnome.xml in this directory. (but it's not used totally).
the files and naming of plugins:
all plugins are into the directory specified into gcompris_main.php
plugins are classes.
if i have a plugin named "pippo", the classname is pippo_plugin and it is stored in a file (in the path of plugins) named
the initialization of plugins is made by the function init on every classes. the only argument is a reference to BoardPlugin, in the
file plugins.php; it is used to call all the functions of the plugin (if configured) from the "plugin manager".
in c this is done by creating a struct with variable functions (callbacks).
You can find out an early version of php code in this link: phpcompris-early1.zip. For using that you must download
gcompris sources, copy all the data/ directory in that source and convert all png and jpg files into xpm files.