[Gambas-devel] New GTK+ features

Daniel Campos daniel.campos at ...103...
Thu Mar 3 13:44:10 CET 2005


Hi:

Here's gb.gtk 050303. Two new features added:

1) I've implemented then "MovieBox" widget, it is fully functional, so
MovieBox could be removed from gb.qt.ext and added to gb.qt.

2) I've added a new (experimental) feature, that I think is very important,
trying to make it as simple and intuitive as possible:

I've added a new widget called "Plugin" which embeeds a X-window (mainly 
from
another process, but could be from the same process). This has been done
using the XEMBED protocol specification, which is managed by the 
GtkPlugin and
GtkSocket classes when using GTK+, and can be easily implemented with
QtXembedContainer and QtXembedClient ( 
http://www.trolltech.com/products/solutions/catalog/Widgets/qtxembed/ )
when using QT ... Benoît? Thanks to the XEMBED protocol, both client 
(plugin) and
server (main application) can work together, without the problems of the 
old system:
just using a remote XID without any coordination between the two apps:

A plugin is just a Form. Now gb.gtk forms have an optional parameter 
called "Plug". If you load
a Form using the "normal way":


Form1.Load()
Form1.Show()


Form is shown as usual, allowing to work with the plugin as a 
stand-alone application, and to
debug the program without problems. But if you ser the "Plug" parameter:

Form1.Load(NULL,true)
Form1.Show()

The Form is hidden (it is really a GtkPlug window instead of a main 
window). Then we obtain
the Form ID:

PRINT Form1.ID

(We print it on stdout, or we can write in a file, or send it using a 
Socket, or whatever)

We receive the ID in the main application, and we pass the Form ID from 
the plugin application to
the "Plugin" widget:

...
READ #hProcess,Id,-255
...
MyPlugin.Plug (Id)
...

Then, the Plugin widget shows the Form embeed into the main application.

"Plugin" has two signals: "Plugged" when a remoted XID is sucessfully 
loaded, and "Unplugged" when
the plugin application frees or closes then Form.

Then, the programmer can create any communication system between both 
applications.

As XEMBED protocol is a standard, you can even mix GTK+,QT, Motif, 
FOX... applications, written in
any programming language (python, for example).

This feature would allow to write, for example, a control panel adding 
new features using plugins,
(writting plugins for the Mandrake control center?), and to work with 
these plugins as stand-alone
applications when you do not want to use the centralized control panel. 
This would allow also to
run applications from different computers (that are using the same 
X-Server), and to show them
as one big application to the user.

I send a little example, with a little communication system. You've 
create a "plugintest" folder into
your home folder. Then compile and place there the "Plugin1" and 
"Plugin2" applications. Now
run the "MainApplication" and enjoy! (do not place "MainApp" at plugins 
folder, it will not run!)

Regards,

D. Campos




-------------- next part --------------
A non-text attachment was scrubbed...
Name: MainApp.tar.gz
Type: application/x-gzip
Size: 1914 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20050303/2e81f7a7/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Plugin1.tar.gz
Type: application/x-gzip
Size: 1008 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20050303/2e81f7a7/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Plugin2.tar.gz
Type: application/x-gzip
Size: 1013 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20050303/2e81f7a7/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gtk-050303-gb1.9.tar.bz2
Type: application/x-bzip
Size: 61010 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20050303/2e81f7a7/attachment-0003.bin>


More information about the Devel mailing list