V—A Free C++ GUI Framework for X
V is a C++ framework, and therefore, consists of several C++ base classes you can use to derive your own classes. The core class is vApp, which is used as the main foundation of the rest of the application. A minimal application has a command window derived from the vCommandWindow class containing at least a menu and a drawing canvas. The command window can also contain tool and status bars. When the user selects menu items or activates command objects on the tool bar, V sends messages to your derived vCommandWindow object which your program then interprets. Your program usually shows its output on a canvas object, derived from a vCanvas class. Mouse input is handled by sending messages to your derived canvas class.
While it is possible to build an application using only the vApp, vCommandWindow, and vCanvas classes, most applications will also use dialogs. The dialog controls supported by V currently include:
standard push button
push button with icon and color
toggle frames (similar to tabs)
The layout of controls in a dialog is determined by specifying a position for each control relative to other controls in the dialog. For example, you might specify one control is to the right and below another control. All dialog controls can also be used on the tool bar of a command window.
V also includes several standard dialogs that implement common operations. One of the most useful is the file open dialog, which lets the user select files and directories interactively. Since no standard X file open dialog exists, V implements its own. The MS-Windows version of V uses the standard Windows file dialog. Other standard dialogs include font selection, yes/no response and a message box. Using standard dialogs helps ensure that your application will match the look and feel of the native platform.
The first step to using V is obtaining the latest release. The primary source for V is my web page, http://www.cs.unm.edu/~wampler/. V is also available for anonymous ftp from ftp://ftp.cs.unm.edu/pub/wampler. Unpack the distribution, decide where you want to keep the source and libraries, modify the makefile to reflect this decision and execute make.
After you've built V, read the documentation. You can either print it, or use xdvi or ghostscript to view the provided dvi or ps files. You then typically start your own application by modifying one of the examples provided. Most new V users find it very easy to modify the example to get a good start on their own. The entire process of downloading, building, reading the manual and building a first custom V application has been done by several current V users (already familiar with the Internet, Linux and C++) in just four or five hours.
Since its release to the world in February 1996, V has been in use by my software engineering class and received considerable interest and positive response from the user community. If you've put off writing a GUI application because X programming is just too hard to learn, V may be the solution you need. If you've been putting off learning C++, again V may be just what you need. V is a very elegant, small and well-designed C++ class library. GUIs are one of the most naturally object-oriented applications around and are a good way to get started with object-oriented programming.
Bruce E. Wampler, PhD (email@example.com) has been involved in the PC industry since its earliest days. In fact, he founded two successful software companies, Aspen Software and Reference Software International, and was the principal designer and author of the well-known grammar checker Grammatik. He is currently an Adjunct Professor of Computer Science at the University of New Mexico.
Special Reports: DevOps
Have projects in development that need help? Have a great development operation in place that can ALWAYS be better? Regardless of where you are in your DevOps process, Linux Journal can help!
With deep focus on Collaborative Development, Continuous Testing and Release & Deployment, we offer here the DEFINITIVE DevOps for Dummies, a mobile Application Development Primer, advice & help from the experts, plus a host of other books, videos, podcasts and more. All free with a quick, one-time registration. Start browsing now...
- Non-Linux FOSS: Code Your Way To Victory!
- Vagrant Simplified
- Disney's Linux Light Bulbs (Not a "Luxo Jr." Reboot)
- Libreboot on an X60, Part I: the Setup
- Dealing with Boundary Issues
- System Status as SMS Text Messages
- Bluetooth Hacks
- New Products
- October 2015 Issue of Linux Journal: Raspberry Pi
- Linux and the Internet of Things