What are the methods to implemnt a GUI in C++?What are the extra heder
files to be added?
Currently there is no standard way to implement a GUI in C++. There are
various commercial and non-commercial GUI libraries available, but IMO
the most satisfactory solution (from we the users point of view rather
than anyone elses) would seem to me to be to have a standard C++ GUI.
I have asked about the lack of a C++ GUI in comp.lang.c++.moderated.
The opinion of the powers that be seems to be that a standard C++ GUI
is desirable. The problem is in someone taking the time to get such a
project running.
I enclose a thin paper that I put in the Vault at
http://www.boost.org
just because I felt that doing very little about the situation was
better than doing nothing. Here is the main text of the current version
------------------------------------
A standard graphical user interface for C++?
Newcomers to C++ often wonder why C++ doesnt have a standard GUI.
Posing the question on comp.lang.c++.moderated recently, the reasons
seem to be that C++ missed the boat around the 1990's. The C+ committee
seems to be suggesting that they would like a standard GUI in an ideal
world but that they are unlikely to have the resources to look into
this themselves. A C++ GUI is not traditional standard library
territory nor even on the horizon it seems.
In informal discussions so far the main issues that came up are:
* boost.org is the best place for such a library could be developed.
Not everyone around boost is in favour of trying to produce such a
library, (Nor is there a specific majority against) nevertheless the
know how, tools (especially cross platform tools and test facilities)
etc to do this are here. Boost excels in cross-platform development.
Recently boost libraries have started to push outside the traditional
single-threaded sealed application model that the C++ standard is based
on with libraries such as Boost.Threads, Boost.Asio, and Boost.Shmem
all of which I would think break the current model.
* Must be seamlessly cross-platform.
Write once run anywhere. Sounds simple right? In practise Graphical
output devices are a wide spectrum of sizes and hardware. There will
probably have to be various hardware models, minimal hardware
requirements etc, for example classification by gross number of pixels
with the broad intent to distinguish desktop and laptop pc's from
mobile phones and down from there to wristwatch sized screens. Is there
a need for desktop applications to be ported to devices with smaller
screens or is the paradigm sufficiently different that the refactoring
the code would be more work than reworking it. There are reports from
various GUI libraries that they have ben ported to small devices. It
would be interesting to find out how this works out in practise.
* Abstracting away hardware.
The physical problems of output devices have been previously been
tackled by interposing a layer of abstraction between the programmer
and the hardware. The obvious example that springs to mind is Windows
GDI , now augmented by GDI+. I would expect identifying suitable
abstractions to be a common methodology for solving many platform
dependent GUI problems.
* Must be capable of (at least) local platform look'n feel.
Comes up time and time again. Existing practise of interest are
Java.AWT and Swing as well as current C++ GUI's. There are two ways to
achieve native look and Feel. The first is just to call the platform
dependent API's and let the platform do it for you. This approach is
taken in WxWidgets and AWT. Its fine but not very flexible. Java Swing
does it the other way by simulating everything from the ground up. This
is very flexible (1 platform can be made to look like another for
example or individual skin can be used) but it has been criticised for
not getting it quite right. It would seem that some suitable pictorial
evidence might help to identify fact and fiction here.
* Must use existing standard libraries.
This sounds obvious but in many pre-existing GUI libraries this is not
the case. For example in case of Ultimate++ GUI<url
http://upp.sourceforge.net/www$uppweb$overview$en-us.html> they say
that it isnt really feasible to use the standard containers for a GUI
because they require a type with a copy-constructor.
* Arguments against a standard GUI
The main argument against a standard C++ GUI is that there is a wide
range of GUI libraries out there already that are adequate to do the
job or that a standard GUI library would not be agile enough to keep up
with developments. I think that the basic elements of a GUI are quite
well established and may be tweaked but are fairly stable. Newer
elements such as docking windows can be built out of these more basic
building blocks.
I hope try to enumerate some of the major hardware graphics/ GUI layers
and identify some common GUI building blocks and features in the next
version of this document
Links to further Information about at least a boost GUI.
Boost Wiki on GUI
http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?BoostGUI
Boost Wiki on Threads about GUI on the boost developers list.
http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?BoostDevelGuiThreads
Keep dragging n' dropping!
regards
Andy Little
------------------------------------------------------------------------------
(Thats it so far on my contribution to a standard C++ GUI)
Is C++ as strong as Java in animation and graphics?
I would guess no because of the lack of common standard components.
What about the Linux
compiler's compatibility in graphic programes?
Linux OS has good graphics hardware support AFAIK.
cheers
Andy Little