V—A Free C++ GUI Framework for X
I love Linux as a development platform—it has all the Unix tools I've been using for years. Linux has been a superior development platform in every way except for development of graphical user interfaces (GUIs) with X. For some time, programmers using Microsoft Windows have had the option of using either Microsoft's MFC or Borland's OWL to develop C++ GUI applications. However, Linux has caught up in the graphics area as some very good freeware C++ GUI frameworks are now available for X and Linux. This article is about V, the GUI framework I've written.
I first developed V as a tutorial example for a C++ book I'm writing. My tutorial has turned into a very complete, easy-to-use C++ GUI framework suitable for developing almost any GUI application. It works with X and Linux, and uses the standard X Athena toolkit, so that everything remains free. V uses some customized versions of the free Athena 3D widget set, so V applications have a very handsome 3D look. V also works with Microsoft Windows, so applications you build on Linux with V are easily ported to MS-Windows, as well as other X platforms. V is distributed under the GNU Library General Public License, so you can freely use V to develop either other freeware or proprietary applications (as long as you make the source of V available to the end user).
Two other good frameworks are wxWindows and YACL. While these two programs have their strong points, I think V is much simpler to use and has applications that are more user friendly. For more details, a comparison of V and the other frameworks is posted on my web page (http://www.cs.unm.edu/~wampler/). All three programs provide much of the functionality of commercial frameworks such as MFC or OWL.
If you don't use a GUI library or framework, you are stuck using the native X toolkits to develop your GUI, either by using X directly (very hard) or using the Xt Athena or Motif widget sets (just a bit easier). While you can develop very nice interfaces using these toolkits directly, there is a steep learning curve. A good programmer needs at least a month of steady effort to be able to write programs using either Xt Athena or Motif, and the applications are limited to X platforms. One of the problems with the native X toolkits is that they are designed to be totally flexible, and to handle almost any interface design. This very generality makes them hard to learn and to use. For most applications, you simply don't need that much flexibility.
V, on the other hand, has been designed from the start with ease of programming in mind. I have received reports from new V users saying they were able to get their first V applications up and running in just four or five hours from downloading the V distribution to ending with a running application. Within a week, programmers are able to fully use almost every feature of V. Even the inexperienced programmers in my classes at the University of New Mexico have learned to program with V in a week.
The cost for this ease of programming is rather small. For one thing, you must use V's definition of the GUI elements. When you use V, you end up with interfaces that conform closely to standard Motif or Microsoft Windows applications. Also, you lose some of the low level access and flexibility you have when using the low-level toolkits. For the vast majority of applications, this loss is not significant. V does provides hooks for getting at some of the low-level details, but the only use I've heard made of them is to interface with OpenGL and Mesa.
Figure 1 shows the V Icon Editor included with the V distribution. The Icon Editor is representative of a typical V application. The main user interface element is the command window. The command window has a menu bar that is the standard drop-down menu found on most Motif and Windows applications. Below the menu bar are one or more tool bars that allow you to make the most commonly used commands readily available to the user. The current trend is to place buttons with small icons on the tool bar; with V you can use any standard control object on the tool bar. Under the tool bar is the drawing canvas where your application shows data, such as text information, graphical information, or, in this case, the icon to edit. The drawing canvas can have scroll bars, and the user interacts with the data displayed on the canvas using the mouse or keyboard. Below the drawing canvas is a status bar, used to show useful information, like the mouse position.
Dialogs are an important part of most GUI programs. Figure 2 shows the color selection modeless dialog used with the V Icon Editor. V supports both modal and modeless dialogs with a complete set of controls.
I hope you agree that the appearance of this V application is as good as any other X application you've seen on Linux. Icon Editor also compiles in Microsoft Windows without a single #ifdef and will look just like a standard Windows application.
|Designing Electronics with Linux||May 22, 2013|
|Dynamic DNS—an Object Lesson in Problem Solving||May 21, 2013|
|Using Salt Stack and Vagrant for Drupal Development||May 20, 2013|
|Making Linux and Android Get Along (It's Not as Hard as It Sounds)||May 16, 2013|
|Drupal Is a Framework: Why Everyone Needs to Understand This||May 15, 2013|
|Home, My Backup Data Center||May 13, 2013|
- New Products
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Using Salt Stack and Vagrant for Drupal Development
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Nice article, thanks for the
2 hours 35 min ago
- I once had a better way I
8 hours 21 min ago
- Not only you I too assumed
8 hours 38 min ago
- another very interesting
10 hours 31 min ago
- Reply to comment | Linux Journal
12 hours 25 min ago
- Reply to comment | Linux Journal
19 hours 19 min ago
- Reply to comment | Linux Journal
19 hours 35 min ago
- Favorite (and easily brute-forced) pw's
21 hours 26 min ago
- Have you tried Boxen? It's a
1 day 3 hours ago
- seo services in india
1 day 7 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi
It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?