www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Another GUI alternative?

reply Nilo <Nilo_member pathlink.com> writes:
Hi all,

There's a GUI framework, portable and with active development called Fox (
www.fox-toolkit.org ).

Fox is written in C++ and has a makefile for dmc, so I suppose that's working.

My question is: has someone tried to use fox from D? Would be possible for D
call a library written in C++? If it is possible, what sould I do to port that
library in a D's usable manner?

Hints?

TIA

Nilo
Apr 17 2006
next sibling parent reply clayasaurus <clayasaurus gmail.com> writes:
Nilo wrote:
 My question is: has someone tried to use fox from D? Would be possible for D
 call a library written in C++? 

Yes. If it is possible, what sould I do to port that
 library in a D's usable manner?

Create a C wrapper for it, then call the C wrapper from D.
Apr 17 2006
parent reply Nilo <Nilo_member pathlink.com> writes:
In article <e20mc9$bc5$1 digitaldaemon.com>, clayasaurus says...
Nilo wrote:
 My question is: has someone tried to use fox from D? Would be possible for D
 call a library written in C++? 

Yes. If it is possible, what sould I do to port that
 library in a D's usable manner?

Create a C wrapper for it, then call the C wrapper from D.

What are the steps involved in creating a wrapper from C++? Is there a simple tutorial or how-to? Or samples? I've done a search but could not find... I would like to start these port. Maybe I can do it... ;-) TIA Nilo
Apr 17 2006
parent reply clayasaurus <clayasaurus gmail.com> writes:
Nilo wrote:
 In article <e20mc9$bc5$1 digitaldaemon.com>, clayasaurus says...
 Nilo wrote:
 My question is: has someone tried to use fox from D? Would be possible for D
 call a library written in C++? 

If it is possible, what sould I do to port that
 library in a D's usable manner?


What are the steps involved in creating a wrapper from C++? Is there a simple tutorial or how-to? Or samples? I've done a search but could not find... I would like to start these port. Maybe I can do it... ;-) TIA Nilo

#1) First compile a foktk.lib of this library with DMC. #2) The 'C' wrapper will be done in C++, but is called the C wrapper because you wrap the classes into C functions. First you have to locate the important classes in the library, and then you must create wrappers for them. It may go something like... ------------------------------------------------ #include "foxtk.h" Window *window; void window_Start(char[] title, int x, int y) { window = new Window("Title", x,y); } void window_Close() { window.close(); delete window; } ------------------------------------------------ Compile this with DMC as well, we'll name it foxtkglue.lib. #3) The D interface. You can so something like... module window; // pretty it up void start() { window_Start() } void close() { window_Close() } // C-functions extern(C) { void window_Start(...); void window_Close(...); } #4) Using Compile your D code with your two .lib's, and do something like... import window; main() { window.start(..,..,..); window.close(..,..,..); } ---------------------------- Here's a C interface example I created with RakNet. http://www.dsource.org/projects/bindings/browser/trunk/raknet/rakglue Goodluck. ~ Clay
Apr 17 2006
parent reply Nilo <Nilo_member pathlink.com> writes:
In article <e20qrb$h1c$1 digitaldaemon.com>, clayasaurus says...
Nilo wrote:
 In article <e20mc9$bc5$1 digitaldaemon.com>, clayasaurus says...
 Nilo wrote:
 My question is: has someone tried to use fox from D? Would be possible for D
 call a library written in C++? 

If it is possible, what sould I do to port that
 library in a D's usable manner?


What are the steps involved in creating a wrapper from C++? Is there a simple tutorial or how-to? Or samples? I've done a search but could not find... I would like to start these port. Maybe I can do it... ;-) TIA Nilo

#1) First compile a foktk.lib of this library with DMC. #2) The 'C' wrapper will be done in C++, but is called the C wrapper because you wrap the classes into C functions. First you have to locate the important classes in the library, and then you must create wrappers for them. It may go something like... ------------------------------------------------ #include "foxtk.h" Window *window; void window_Start(char[] title, int x, int y) { window = new Window("Title", x,y); } void window_Close() { window.close(); delete window; } ------------------------------------------------ Compile this with DMC as well, we'll name it foxtkglue.lib. #3) The D interface. You can so something like... module window; // pretty it up void start() { window_Start() } void close() { window_Close() } // C-functions extern(C) { void window_Start(...); void window_Close(...); } #4) Using Compile your D code with your two .lib's, and do something like... import window; main() { window.start(..,..,..); window.close(..,..,..); } ---------------------------- Here's a C interface example I created with RakNet. http://www.dsource.org/projects/bindings/browser/trunk/raknet/rakglue Goodluck. ~ Clay

Thanks a lot, Clay, for your prompt responses. I'll study your suggestions and code later. Maybe I can do something about Fox... Thanks. I'll keep you ( and the list ) informed about any progress. Obviously I'll share any code that cames from these... ;-) Nilo
Apr 17 2006
parent clayasaurus <clayasaurus gmail.com> writes:
Nilo wrote:
 
 Thanks a lot, Clay, for your prompt responses. I'll study your suggestions and
 code later.
 
 Maybe I can do something about Fox...
 
 Thanks. I'll keep you ( and the list ) informed about any progress. Obviously
 I'll share any code that cames from these... ;-)
 
 Nilo
 

Your welcome. Sorry for the typo's as I was kind of in a rush when I wrote that. If you need any sort of clarification, let me know. ~ Clay
Apr 17 2006
prev sibling parent reply Mike Parker <aldacron71 yahoo.com> writes:
Nilo wrote:
 Hi all,
 
 There's a GUI framework, portable and with active development called Fox (
 www.fox-toolkit.org ).

 If it is possible, what sould I do to port that
 library in a D's usable manner?

I'm almost certain someone started on a wrapper for Fox some time ago. You might want to nose around Wiki4D or ask Google and see if anything turns up. It might save you some effort.
Apr 17 2006
parent reply Justin C Calvarese <technocrat7 gmail.com> writes:
Mike Parker wrote:
 Nilo wrote:
 Hi all,

 There's a GUI framework, portable and with active development called 
 Fox (
 www.fox-toolkit.org ).

 If it is possible, what sould I do to port that
 library in a D's usable manner?

I'm almost certain someone started on a wrapper for Fox some time ago. You might want to nose around Wiki4D or ask Google and see if anything turns up. It might save you some effort.

It could be that someone has done something with the Fox toolkit, but I don't remember anything. (I'm pretty sure people have mentioned Fox before, but that's not the same as starting a project.) If such a project has been started, this page is one place that I'd expect it to be mentioned: http://www.prowiki.org/wiki4d/wiki.cgi?AvailableGuiLibraries But obviously I could have missed the post or whatever where someone mentioned a Fox projects, so Googling isn't a bad idea. -- jcc7
Apr 17 2006
next sibling parent Rémy Mouëza <Rémy_member pathlink.com> writes:
I like Fox toolkit. Fast and efficient, not too big. But I didn't do anything
valuable in it. Making a wrapper by hand for such a huge library will take a lot
of time. I don't want to be discourageing: you simply should use a wrapper
generator. I made one once, it is still available on remy.moueza.free.fr and
needs python and gccxml. Currently I no longer manage to compile gccxml. The
python code was written either at 6.00am when I was trying to wake up or after a
long day at 10pm when I was starting to sleep... Looking back at it, it's really
badly done. Too much spagetthi code. I shouldn't have based my entire design on
a visitor pattern. 
However I managed to port a subset of the FLTK library to D with it. It wasn't
working well, because of a bad memory management but it was very encourageing.
For the moment, you should have a glance to the perl script used to generate the
wx.net wx_c lib. I think it's the most promising tool for the moment. 
I am currently making a new (quite) small and simple wrapper generator, written
entirely in D and only using phobos regexp lib, but it won't be valuable any
soon. If you feel adventurous (and smart enough), you may wish to try to make an
even smaller and simpler generator using Peri Hankey's language machine on
languagemachine.sourceforge.net.

Best wishes and good luck !
Apr 21 2006
prev sibling parent Robert Jones <robertjones21 HotPOP.com> writes:
Justin C Calvarese said the following on 4/18/2006 1:52 AM:
 Mike Parker wrote:
 Nilo wrote:
 Hi all,

 There's a GUI framework, portable and with active development called 
 Fox (
 www.fox-toolkit.org ).

 If it is possible, what sould I do to port that
 library in a D's usable manner?

I'm almost certain someone started on a wrapper for Fox some time ago. You might want to nose around Wiki4D or ask Google and see if anything turns up. It might save you some effort.

It could be that someone has done something with the Fox toolkit, but I don't remember anything. (I'm pretty sure people have mentioned Fox before, but that's not the same as starting a project.) If such a project has been started, this page is one place that I'd expect it to be mentioned: http://www.prowiki.org/wiki4d/wiki.cgi?AvailableGuiLibraries But obviously I could have missed the post or whatever where someone mentioned a Fox projects, so Googling isn't a bad idea.

shelved it after the frustration with the shear amount of preprocessor instructions, in the source files, that I could not make sense of. I still plan to return to it eventually. If someone does get a C wrapper working I'll use that instead and abandon the port. -- Robert Jones robertjones21 hotpop.com
May 26 2006