Ideal D GUI Toolkit

Diggory diggsey at googlemail.com
Mon May 20 13:40:06 PDT 2013


UI toolkits are a lot of work but they're not as unreasonably big 
as everyone seems to be suggesting... I've written a couple 
myself in a procedural language using Direct3D to draw 
everything. Had all the standard controls, various layout 
options, even a syntax highlighted code editor, clipboard 
interaction, keyboard focus, etc.

The main difficulties with doing the same thing in opengl and 
making it cross platform seem to be:
- Font rendering, especially with support for the combining 
unicode characters and RTL languages. It would probably be worth 
finding an existing library for this.
- Making it consistent with the host OS, it would be possible to 
have a number of skins for each OS but that would probably be 
breaking all sorts of copyright rules. Generating the skin on the 
fly using the native drawing commands shouldn't be too hard...

On the other hand you get the advantages of hardware acceleration 
and pretty much unlimited custom drawing capabilities and I'd 
expect to see a lot of interesting custom controls out there. I'd 
definitely favour this option!

A native OS UI would be less work - although you'd effectively 
need to write an implementation specifically for each OS, the OS 
would take care of most of it for you. The main problems here 
would be getting consistent behaviour across all OSes and also it 
would be a lot of work to add controls that don't already exist 
in the OS.


What would be neat is if there was a CTFE based compiler which 
took some form of markup describing part of the UI and converted 
it to D code. That way you could mixin bits of UI markup either 
from files or string literals, directly into your classes and it 
would be really easy to hook up events and things.


More information about the Digitalmars-d mailing list