Whither DWT?

Anders F Björklund afb at algonet.se
Wed Apr 19 23:43:34 PDT 2006

DBloke wrote:

>> wxD is intended for Linux (GTK+), Mac OS X (Carbon), as well as Windows.
> I thought wxWidgets was a C++ library, and that it was next to 
> impossible to interface to C++ in D ???
> So does wxD build a lib for D or does wxD provide a layer on top of 
> wxWidgets to access wxWidgets library?

There is a wrapping layer (called "wxc"), written in C++, that
exports all the methods as "C" functions. The wxD class library
(called "wxd"), written in D, then calls to these C functions.
It's much easier to explain if you look at the wxD source code...

> Also how easy is it going to be to keep wxD synced with the main 
> wxWidgets branches?

We're currently at 2.6.1, but there are not that many API changes
for 2.6.3 - so we can just "diff" those in to the wxD bindings...

It's on the roadmap, but for now we're using 2.6.1 as static libs.
In the future we probably want to be using the latest wx as shared.

> The above is even better when it generates the C++ code ;) not much use 
> in D though, but XRC is probably more portable than C++ code especially 
> when used with wxPython or wxLua

XRC can be used from wxD, and there is a demo with the main download.

>> wxD comes with both several image formats, and support for sound (0.05)
>> And drawing on canvases is supported, as well as using OpenGL canvases.
> So out of interest just how much is possible with wxD compared with 
> wxWidgets, i.e TreeViews RichText Events etc?

Most of it... See the demos, but at least Trees and HTML with Events.

>> Some complexity comes from the mish-mash of languages used, though...
> I thought wxWidgets was developed in C++ ??

wxWidgets is done in C++. wxD is written in both C++ and D, but the
D classes are in turn based on the wx.NET project - written in C#...

So you end up with something reminding a little of C# (like: "IntPtr")
calling C++ methods exported as C functions, and your app written in D.


>> I've been working on such a list for wxD 0.05, but it's a lot of demos 
>> and I'm testing them on three platforms - so it amounts to some work...
> Well I have a Mac and x64 PC so I may be able to lend a hand testing if 
> you like?

Sure! There's "only" wxD 0.04 at the site at the moment, but I might as
well upload wxD 0.05 too as a "Release Candidate" or something similar ?

D doesn't do 64-bit yet, but I guess you could run regular X86 too ?
Start with the instructions at http://wxd.sourceforge.net/#installation

>> In the long run there needs to be a tutorial or longer documentation,
>> explaining how to get started - with more words than just a Readme...
> Could it be possible to use wxWidgets docs for wxD?

Definitely! Especially the excellent whole book on wxWidgets:
http://www.wxwidgets.org/book/, we just need to highlight the
syntax differences - but the classes and the API are the same...

For a simple C++ vs D comparison, see http://wxd.sf.net/Hello.html
The biggest difference is all the missing macros and header files ?
One can also follow the wx.NET docs at http://wxnet.sf.net/docs.html

> I must have missed something somewhere I thought it was not possible to 
> port C++ to D I am sure I read a post somewhere or on the D site saying 
> that it is almost impossible to port C++ to D ??

You shouldn't believe all those people telling you what you can't do ;-)

> Been readin up on SDL this could be a good base with wxD for multimedia 
> framework ??

Yes, at least when you bundle it with GL (and AL) for hardware features.


More information about the Digitalmars-d-dwt mailing list