Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can web technology be used for a C++ application GUI?

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?

like image 700
Roderick Avatar asked Jul 08 '09 13:07

Roderick


4 Answers

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.

like image 188
Paul Dixon Avatar answered Oct 19 '22 00:10

Paul Dixon


xul uses xml and CSS to define the GUI elements.

like image 29
danio Avatar answered Oct 18 '22 22:10

danio


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.

like image 23
MSalters Avatar answered Oct 19 '22 00:10

MSalters


Check out the Awesomium SDK. It's based on Chromium that powers Google Chrome. It's a bridge for your native app in C++ or .NET with an html5/js/css web UI.

like image 22
mckinoti Avatar answered Oct 18 '22 22:10

mckinoti