views:

198

answers:

5

Can web technologies be used for a desktop application written in a traditional language like C++? I'd guess that they can, though I've not been able to find any evidence of this. I understand Adobe Air can make desktop apps using Flash, but it uses web languages like php etc. What I'd like to do is to be able to build my GUI elements - edit boxes, sliders, menus and so on, using html/CSS - instead of native widgets - in an application that is otherwise built in the conventional way - using Visual Studio for example.

Does anyone know if this has been done, if there's any software that makes it easier, or if there are any objections to this approach?

+1  A: 

xul uses xml and CSS to define the GUI elements.

danio
+2  A: 

Qt is moving in this direction, with CSS-like styling and a forthcoming "declarative" UI mechanism.

In addition, you can drive your app with Javascript via QtScript.

You could also use QtWebKit to provide an HTML based UI, it's possible to bridge between C++ code and Javascript too.

Paul Dixon
QtWebKit sounds interesting - but I'd like to have a GUI that's doesn't need a powerful external library - just a standards-compliant web renderer.
Roderick
You can link with Qt statically if that's important to you.
Paul Dixon
A: 

As a sideline, I have built an effictive application using an IE form control, basically embedding a web browser into my app, which served my purposes at the time.

Edit:

http://msdn.microsoft.com/en-ca/library/aa770041(VS.85).aspx

http://stackoverflow.com/questions/tagged/mshtml

Antony Carthy
This sounds like the sort of thing. How did your form communicate with your app?
Roderick
I was uisng C# .Net and as far as I recall, I imported shdocview.dll, but I had to convert it to a managed assembly or some such thing. Give it a try, once I got started it was easy. It's possible that .Net form controls now include the web browser control? Or are you using VC6 ?
Antony Carthy
A: 

An application I've been involved in , TomTom HOME 2 is built as a big C++ plugin in the Mozilla XulRunner framework. This framework is shared with Mozilla FireFox so there is a lot of commonality. TomTom HOME is a free (as in beer) download and the model part is in readable Javascript, so you can have a look to see how it works.

Its predecessor, TomTom HOME 1.x was built like Antony Carthy describes, wrapping the MSHTML(IE) ActiveX control, or Safari on Mac. (Disclaimer: TomTom has filed a number of patent applications to communicate with the embedded browser; the ActiveX interfaces to the JS engine are rather limited)

It's fairly easy if you have a proper MVC design, and it makes it also easy to keep the Model/View seperation clean during the implementation. You can't put in a "quick hack" in the model to expose some internal detail of the model. The View code is Javascript and it can access the C++ model only via defined interfaces.

MSalters
A: 

Thanks for all your responses. I think the answer here is - surprisingly - what I'm looking for doesn't exist, or isn't generally done. Maybe I'll write it.

Roderick