How to build native C++ apps with HTML/CSS UI? [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 months ago.
The community reviewed whether to reopen this question 3 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
Is it possible to develop a C++ program while using HTML and CSS for the user interface? I know about programming with Javascript using a Webkit container, but I am really interested in C++ development.
I felt in love with C# WPF when I developed under Windows, but now I moved to Linux and I haven't found a good tool for using markup for interfaces. For this, I would like to mix HTML and CSS, which are very lightweight and easy to use, with C++ code, with something like WPF.
Oh, one more thing: I'm looking for desktop development, not web.

Yes, it is possible. What you want is a C++ web framework. You could start by looking at CppCMS—a Free High Performance Web Development Framework (not a CMS) aimed for Rapid Web Application Development.
Edit: After the question has been clarified, I think Awesomium would be a good fit for your needs.
You can achieve the same functionality by embedding WebKit (or Gecko) but as far as I know that is exactly what Awesomium does behind the scenes.
An alternative is librocket—a C++ interface middleware package designed for game applications. As you can guess from the description it is a good fit for games or real-time applications.

Sciter is exactly that - embeddable HTML/CSS engine with C/C++ API. Compact and multi-platform.
And check this article.
Sciter has the same feature set as WPF but uses HTML/CSS instead of XAML and uses native API.
Features out of the box:
HTML, CSS, SVG, aPNG (animated PNGs), image sprites,
<plaintext> - editor with syntax highlighting,
<htmlarea> - WYSIWYG HTML editor,
<frame type=pager> - print preview and HTML/CSS print,
animations,
HTTP client, REST/JSON client, WebSocket's, DataSockets,
etc.
The same application with Sciter UI running on Windows, MacOS and Linux from the same sources:
Disclaimer: I am an author of Sciter Engine.
2021 update: you can also use Sciter.JS that is version of Sciter that uses standard JavaScript (ES2020) script engine.

I think Electron would be a nice addition to the other answers.
It uses NodeJS to run a Webkit Window. Electron itself is only html/css/js, but you can use any Node Module within your Electron App - including custom, natively compiled C++ code. A possible Module to embed your C++ code would be node-gyp.
Be aware, however, that this workflow may include a little bit more JS than you would have with the other answers.
My favourite text editor, Atom, was made with Electron.

You can use Chromium Embedded Framework to embed HTML5 content in your app.
You'll get might and speed of Chromium and ability to build GUI apps the same way you develop web applications.

I suggest checking out Ultralight HTML UI Engine
Not Open Source, Available for C++. OpenGL and DirectX rendering supported.
Ultralight is the lighter, faster option to integrate HTML UI in your
C++ app.
It's made by the creator of Awesomium, who unfortunately decided to delete Awesomium.
If you need something more heavy weight I recommend taking a look at CEF. It’s a very powerful (and open source) tool.

I would suggest RmlUI
Its an active fork of librocket with more features. Its very modular, you can handle rendering, event handling and user input yourself (or copy one from provided examples).
Note: RmlUI doesn't support full HTML5/CSS3 specifications, but only a subset of it. Animations are supported tho.

Related

Offscreen & embeddable browsers comparison (for use in a game) [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
We've been looking at adding decent browser support to our C++ application; this question is about GUI-independent browser libraries since our project involves 3D rendering and doesn't quite fit a normal GUI.
The two I've seen so far are Berkelium and Awesomium. Both seem to work in a similar way from my quick investigation, rendering to an offscreen-buffer which you blt into your own window/game/anything. Awesomium is proprietary and costs a fair amount ($5k), Berkelium is open-source and free. Has anyone compared these (and other) such tools? Cross-platform is a benefit but not 100% essential.
Take a look at the Chromium Embedded Framework. CEF 3 supports off-screen rendering on all operating systems: Windows/Mac/Linux.
Disclaimer: I created Awesomium. Nevertheless, I will practice the utmost objectivity in my response.
Awesomium does cost a bit of money but it is definitely the best tool for the job, I'll defend my reasons with a bulleted list:
Simple, well-documented API; we've tried our best to keep the API as intuitive and readable as possible. That's really important when you're embedded something as large and complex as an entire browser framework. (Believe me, you don't want to embed WebKit directly-- that's like swallowing the sun.)
Windowless rendering; the library was designed from the outset to be used outside of a standard "windowing framework". We make it really easy to render a WebView to a texture:
void update()
{
if(webView->isDirty())
webView->render()->copyTo(texture, width * bpp, bpp, false);
}
Solid Javascript integration; if you use Awesomium as an HTML GUI renderer for your 3D game, you'll definitely want to take advantage of our Javascript <-> C++ integration. You can call Javascript functions directly from C++ and vice-versa, set callbacks, expose global properties, and more. I wrote up a big guide on my blog here.
Well-supported; we use the money we get from our top-tier commercial licenses to fund support and development of the library. If you need help, please visit http://support.awesomium.com and we'll be glad to lend a hand.
The library is free for non-commercial use and very affordable for indie developers. If you'd like to use Awesomium in your next project and are worried about the price-point, please email me at adam#khrona.com and I'll see if I can't help you out. :-)
Berkelium is really painless to use. I integrated it into my game in 6 days, you can read all about it (and some other options) here: http://www.onemanmmo.com/index.php?cmd=newsitem&comment=news.1.31.0
The only downside is no debug build and 40MB of binaries.

Using Google Chromium's Views Project as an Application Framework in C++ [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I have had contact with Google Chromium Code and that’s terrific for building applications with. The problem now lies that no-one has tried to use it outside Google Chromium Project. What I have in mind is to develop an open source project which may be used for this purpose. The fundamental goals would be:
Guarantee Linux-Windows support for the same code.
Take advantage of all resources available like thread control, stats, unit test…
Make it clearer how to use Skia for graphic effects and customizations.
Present a useful application doing the most of this.
Integrate C++ and JavaScript code using V8
Use Webkit for rendering html content
There’s a chance of it get off the paper. What do YOU think?
Claudio M. Souza Junior
Developer.
see https://github.com/lianliuwei/chromium_base
I create it for the same reason like you.
chromium is great project. It's code could be useful to using in other project. but It need time to extract it. I see one project to extract the ui part, but it change too many for noreason for example it change the .cc to .cpp. my project extract the base, ui, view part for the origin project, rm the ICU (it's so big) and gurl(you can add it quick) keep the gyp, gclient, grit-i18n, gtest, gmock... change the code little. and keep the extract history. I add a new type of messageloop for using it in the MFC(for company project :( ) now it can only work on Windows but it's no so hard to make it work on linux.(google do it all)
for use the browser in you project you can see the http://code.google.com/p/chromium/ for help.
It's great this project help you a litte. I at first think it's a no one care project.
I'm assuming you have looked at the extensively documented and developed QtWebkit and know why you don't want to use that?
I'm sure it will be easier to use V8 in a QtWebkit application than to somehow tear out Chromium's "View project".
Qt has the bonus that as long as you operate within the framework, everything will work on a lot of different platforms (more than Chomium now supports I think).

What to use when building a desktop application? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I'm making desktop application for my own use.
I can't decide on whcih language/toolkit/framework to use.
I would like a good User experience and a not so bad Performance.
The choices in my mind are:
wxPython
Titanium
Adobe AIR
any other suggestions that would fit
-- EDIT
I would also like it to be cross-platform
Experience, I've got some experience in Java, Python, HTML/JS. (Haven't done much .net stuff).
I would live to learn if needed.
There are a lot of other considerations.
What platform? What OS? What level of backward compatibility? What runtimes are on the clients?
What sort of graphics support do you need? 3D? 2D?
What kind of interoperability do you need?
What are your deployment scenarios?
What languages do you want to write this in?
There are literally hundreds of technologies out there. You can only come up with a design when you have specified what your main constraints are.
The first thing I'll say is that I would favour Web applications where possible. Of course for many things you can't—Web browsers for example. :) But where you can you should. Sure you have cross-browser issues but the OS/library cost of a desktop app is really high now.
That being said, if what you're doing needs to be done as a desktop app or you simply want to do it that way as a personal preference I would choose:
.Net (C# or VB.NET) if you only need to run on Windows or
Java (Swing, SWT, etc) if you want to run on non-Windows platforms.
I would choose from these two for no other reason than they're the most proven. Sure there are other options Adobe Air, Python, etc. Python in particular has real apps written in it so it would be my third choice. Overall though, these stacks are just less proven for this particular task.
depending on your desktop OS. For Windows, you may get Microsoft Visual Studio Express Edition of C# or VB.Net. For Mac computer intel based computer, you have free XCODE available to do it or use JavaScript to build widget applications.
Another option to look at would be QT. It's a cross platform C++ framework with Java & Python Bindings. It really does boil down to what type of application you want to build though and which platform(s) you want to target it at. If you're aiming at Windows specifically, you might want to consider using .NET and C# to take advantage of native support, on OSX, Objective-C and Cocoa, or on Linux C/C++ & whichever API set your targeted distro uses. And for cross-platform, which platforms would you like to target? Windows? OSX? Linux (Ubuntu, OpenSuse, Fedora etc.)? That will also dictate your choice.
Try Flexonrails
then convert with adobeAir
:)
it will be good
im doing my desktop application with that
Depending on what skills and tools you have available to you, as others have pointed out.
If you're on windows one simple accessable option is HTA applications.
http://msdn.microsoft.com/en-us/library/ms536496(VS.85).aspx
if you're on a mac, dashcode is a similar option for, not just authoring widgets, but also full on web applications.
both options give you access to many more api's than typical javascript has access to, such as filesystem access, or the ability to execute system commands.
There's a zillion others, but those options come for for free with their respective operating systems.
Dependes on what kind of application you would like to build, but you definitely should put in your list of tools to evaluate (at least) Delphi.
It compiles to native win32, is a rapid application development tool and has support for a lot of areas like databases, internet, com and many many others. Also, is built into Object Pascal, a very simple to learn language.
Up to some point, you can make it's applications cross platform using others IDEs like Lazarus in Linux.
As of 20 march-2018 almost everything has shifted to javascript. Have a look at Electron.js . Its usefull to build cross platform desktop apps in javascript , html and css.

GUI Framework/Lib for C++ under Windows [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I was wondering is there an Microsoft alternative to MFC, except WinForms in GUI programming for Windows operating system ?
I dont want to use thirdparty (Borland/Qt/wxWindows) libraries. WinForms require .NET which is major problem (can't install .NET in destination machines) and MFC is traumatic to me...
Any alternative which would be close to Qt but Microsoft branded ?
I would appreciate any suggestions!
I too suggest WTL. Here is a list with some useful WTL links:
MSDN's ATL 3.0 Window Classes: An Introduction - for the basics.
WTL Articles by Chris Sells, Dharma Shukla, and Nenad Stefanovic part1 and part2. Nenad Stefanovic is the father of WTL.
Bjarke Viksoe's WTL projects. Bjarne has summed many of his small projects into a whole application, an IDE - BVRDE.
Code Project's WTL page. Watch out especially the articles written by Michael Dunn. VMware Workstation uses WTL and Michael Dunn works for VMware.
Clipcode's WTL Developer’s Guide (doc, pdf, source code).
WTL opensource applications, which one can study to see various implementation tricks:
Google's Chromium, source code here. The windows version uses WTL. I don't know if somebody has tried to extract the WTL framework from Chromium.
Programmer's Notepad uses WTL, source code here.
InfraRecorder uses WTL, source code here.
Try WTL. This library was originally created by Microsoft and then went open source. On the contrary with MFC, many developers report good experiences with it. It builds lighter executables, it is better structured than MFC, but also not so feature rich.
I don't think there's any. You can use pure WinAPI, ATL, WTL (in this case good luck!).
Why don't you want to use Qt? Its free, open source and very flexible tool.
Although I love it and have used it extensively, WTL is quite an effort to learn as the documentation isn't great. There are some great 'WTL for MFC Programmers' articles on Code Project which are an absolute must-read.
However, if you want something Qt-like from MS, then you're only left with MFC I'm afraid. OK, it's long in the tooth but with the addition of the VS2008 SP1 MFC Feature Pack you can create Office 2007-like apps complete with ribbons. This might be your best solution if only MS non-.NET tech is allowed.
There is not any. Do not waste your time for searching.
Any alternative which would be close to Qt but Microsoft branded
If by "close to Qt" you mean similar in design to Qt, then no - there is not. I use WTL and like it, but it is very different from Qt.
You could always go with the Windows API directly and bypass MFC.
I don't get it. If it isn't Win32 or MFC or Windows.Forms, then what you are looking for is by definition 3rd party.
All these people recommending WTL are recommending you download some third party project's toolkit and use it. That's fine, if that's what you are looking for. But if you do that, then I strongly suggest looking at Qt or wxWidget. The former for the most full-featured set you can get and the latter for drawing native widgets using a "more sane" API.
Aside: WTL may be downloadable from MS server, but its a far, far cry from a MS-supported technology. It is an unsupported add-on.

C++/Qt vs Adobe AIR [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have to choose a platform for our product. I have to decide between The Qt Framework and Adobe's AIR. I am well versed with Qt as I have worked for the last two years. I looked up at the Adobe's site but all the info about flex, flash, ability to coding in HTML/ActionScript is overwhelming and confusing. I cannot understand the following about the Adobe ecosystem.
I have the following questions on Adobe AIR:
What language do I use for coding my application? (not just defining the looks of UI)
Like in Qt I use C++. Is it Actionscript?
Can we say AIR is only for making UI's for apps.
Where is the doc for the utility classes along with AIR?
e.g. http://qt-project.org/doc/ for Qt
Qt ships with a huge set of premade widgets that one can use. Does Adobe ship with any such widget set and if so where can i see it as in url?
I understand flex SDK is open source. Can I make commerical apps and ship them ? Does flex SDK ship everything (compiler, utility classes/widgets)
How much does AIR cost in terms of licensing?
Is there something in AIR that is equivalent to QGraphicsView of QT?
If you needs to access a lot of native libraries, you'll need to stay within your QT environment. Keep in mind that AIR is single-threaded and is run on the Flash Player (something that was originally designed for frame-based animations.)
However, depending on the style of application you're building, AIR might suit you just fine.
Beware that AIR can get confusing because there's a few different developer paths to creating AIR applications: 1) using html/javascript and the AIR SDK, 2) using Flash/Actionscript and 3) using Flex SDK and/or Flex builder. The last one is the most capable as far as coming from traditional desktop development background.
Small apps that are Web 2.0 for hooking into web services are good candidates for AIR applications. Things like the IM client Digsby would be great. My favorite AIR app that I've seen thus far is Basamiq Mockups. Other useful apps are TweetDeck. These are good examples of the types of things that are well-suited to solve with AIR.
You should visit the Adobe Showcase and look at some applications: http://www.adobe.com/products/air/showcase/
Also, if you're looking to just get out of the C++ game, I believe QT has some java bindings now...also I remember some python bindings, but never look at those myself.
As far as QGraphicsView, people have done similar things in Flex. I tried Googling right now but couldn't find them initially, but people have taken things like A large image, and then only displayed a current region in the window. Also, in the next version of Flex, they're acutaly building an official ViewPort component:
http://opensource.adobe.com/wiki/display/flexsdk/Gumbo+Viewport
Go spend some time with this AIR application and then ask yourself if Adobe Flex and AIR are worth investing your time in mastering (be prepared to ask yourself why something comparable doesn't exist for the likes of C++/QT):
Tour de Flex
Tour de Flex is a desktop application
for exploring Flex capabilities and
resources, including the core Flex
components, Adobe AIR and data
integration, as well as a variety of
third-party components, effects,
skins, and more.
Some of your questions:
Flex can be coded in MXML and
ActionScript3. AIR additionally
supports HTML/DOM/JavaScript
programming as webkit HTML render engine is built into
the AIR runtime.
MXML is an XML declarative DSL that
gets compiled into ActionScript3
imperative code. It is quite good,
though, for declaratively coding the
graphical forms of the UI (i.e., the
views of the MVC pattern).
ActionScript3 has a heratige that is
founded on JavaScript, but it has
been embelished to the point it more
resembles Java or C#. It has package
namespace, classes and interfaces
with inheritance, class member
access protection keywords,
constructors, static members, and
some very nice additions over Java:
properties, events, data-binding,
and closures.
Flex style programming is also a single-threaded model that relies on asynchronous I/O interactions. This is a simpler model to program than multi-threaded Java Swing or C# .NET Winform apps, yet permits achieving the same net results of program behavior. I elaborate on that here:
Flex Async I/O vs Java and C# Explicit Threading
Flex is open source, you can download the SDK for free, there are no licensing costs associated with it. (see their FAQ)
They do ship a 'flex builder', which is some custom Eclipse I think, and which costs money, but you can perfectly work without it.
The docs can be found at adobe's livedoc pages. (which to some, is enough reason in itself to dislike Adobe ;))
I do wonder, if you are well versed in QT, why are you considering something else? Which advantages do you expect AIR to give you over QT?
I have some experience with both QT and Flex, but not nearly enough to weight one versus the other. I do know QT/C++ is much, much more mature than Flex/ActionScript.
If you already know QT, I don't think the time spend learning a new framework (and programming language) will gain you enough to be honest...
I've used QT and Flex (not so much Air itself though) and have found that Flex is faster for getting apps up and running as well as modifying, while QT gives you more control -- particularly in the installer. The Air app installer is pretty awkward, or at least it was when I tried it, though it may have been improved since then.
The big advantage of Air is that much of the code for it can be run in Flash inside web pages. You can't access the local file system etc. from the web for security reasons but just about everything else is portable.
I made the opposite move. I started working on Adobe stuff and moved to QT. The main reason for doing it was about Adobe framework limitations. When you are using Adobe stuff, you are limited to the tools that they produce, it is hard to introduce external frameworks or libraries, if can not do what you want with Adobe stuff. Usually, the solution to do this is to use sockets, which transforms a supposed "stand-alone" application on a client-server architecture. In addition, if you are using many external stuff it can be hard to manage so many different clients.
Using QT you can code in C++ and add any external framework or lib you want. Even though, some times it can not be easy to code it, is doable and with no "strange" system architecture.
If your looking for some examples of "fun" UIs using Qt and SVG, take a look at the KDEGames [1][2] and KDEEdu [3][4] projects. There's lot's of nice code there that uses QGraphicsView and SVG to created scalable interfaces. Of course note that's it's GPL so be careful what you "borrow" if your app isn't.
[1] http://games.kde.org/
[2] http://websvn.kde.org/trunk/KDE/kdegames/
[3] http://edu.kde.org/
[4] http://websvn.kde.org/trunk/KDE/kdeedu/
I'll second #Pieter's comment - if you already know QT, moving to a whole new environment is going to take a LOT longer.
QT has the advantage of being cross-platform, and very mature: there are libraries for Windows, Linux, and Mac OS X. I'm not extremely familiar with AIR beyond knowing it's from Adobe, but the product site seems to indicate that it's for rich internet apps (http://www.adobe.com/products/air/). If that's true, then QT would be the far better choice if you're developing a desktop application.