GT
A C++ Graphical User Interface Library and System
Author: Anthony Daniels
email: AnthonyDaniels99@gmail.com
Download source
Download GTTestApps_20170213.zip
Introduction
GT is a compact, efficient, and customizable graphical user interface (GUI) library for the Windows environment (eventually Linux and Mac will be added). The majority of the code is platform independent, only relying directly on the Operating System’s graphics, threading, and clipboard APIs (these features are encapsulated). With the number of GUI systems growing, one might ask why make another system. GT was made to address shortcomings in some of the major competitors in addition to being really compact (GT currently has approx. 90,000 lines of code, or LOC, including comments). With the LOC count this low, GT is possible to embed directly into your application solution or project files. Its major competitors are MFC, QT, GIMP Toolkit, wxWidgets, Fox Toolkit. GT most closely tracks with QT in design and function, but here are some of the differences.
Comparison to Competitors
First and foremost, the entire GT framework is built on top of the HPC Template Library (HTL). The HTL is a supplement to the Standard Template Library (STL) that provides thread safe objects geared towards multi-thread and multi-process programming. While GT makes use of almost the whole HTL, three of the HTL packages are relied on most heavily. These are the containers, signals and slots, and threading packages. GT uses only thread safe containers for all critical functions in the objects of the library. GT is also a signal and slot based system like QT. Unlike the macro based event coupling to code used in MFC and Fox Toolkit (which is not debug traceable), signals and slots provide a much cleaner means of connecting events to code. GT has a few improvements over the QT version of signals and slots. First, you can have public, protected, and private signals, whereas QT only allows protected. Second, connection is not done with a macro like in QT. Third, there is no need for the Q_OBJECT
meta-object and code, providing for a cleaner package (no meta-object compiler step). Fourth, any function in a GtObject
can be attached to a signal of same prototype (QT’s most recent version does this as well, but the author wanted to mention it anyways); there is no declaration of “slots:” required. Every member function is a potential slot.
Another major difference is that GT does not draw native controls. If you really drill down into the code of some of the other packages (QT for example), you will find that they are drawing API native controls in most cases. This many levels of indirection to a single monolithic painter that draws all the different controls is different than the approach taken by GT. Every GtWidget
has an OnPaint()
method and the widget is responsible for drawing itself. The graphics are simpler than most current generation operating systems controls, but that choice was in line with the compactness feature of GT. Users are fully encouraged to change the paint algorithms if they want a more sophisticated look.
GT, like QT, has an abstract item model system available for displaying in the GUI collections of objects and their data. QT has the design philosophy that lists, tables, and trees all use the same abstract item model. However GT employs individual abstract item models for lists, tables, and trees. The choice to have a listmodel
, tablemodel
, and treemodel
was made because the author believes that the code is simpler and easier to use and build on top of. This fundamental shift in abstract item model design was the reason GT was created. The author is a long time user and fan of QT.
Gt Library Structure
GT currently has four libraries, GtCore
, GtGui
, GtOpenGL
, and GtChart
. GtCore
contains all of the core classes for the GT system. It has the following packages; GtBase
, GtEvent
, GtGeometry
, GtGraphic
, GtInputOutput
, GtItemModel
, GtMath
, GtProcess
, GtSorting
, GtStateMachine
. Descriptions of these packages and their constituent classes will be in the class overview document. GtGui
contains all of the classes for basic GUI development. It has the following packages; GtBasicControls
, GtGridView
, GtModelView
, GtScientific
, GtTextView
, GtWinForms
. GtOpenGL
contains the necessary classes to allow for 3D object visualization via the OpenGL library. GtChart
contains the classes required for scientific plotting and charting.
Sample GUIs
The sample pack has 15 different GUI projects that illustrate the use of every type of control in GT. In order to build the sample pack, have the GT2013 and GT_TEST_2013 folders at the same level in the file hierarchy. Copy the libraries from the GT2013 Debug or Release folder into the target folder for the sample pack. You should now be able to build and run the sample pack. The sample applications are as follows:
Name | Description |
GtTest_02_Simple | This application illustrates most of the basic controls of GT. |
GtTest_03_ToolBox | This application illustrates the use of the toolbox Control. |
GtTest_04_TabView | This application illustrates the use of the tab view control. |
GtTest_05_ScrollArea | This application illustrates the use of the scrollable area control. |
GtTest_06_Modal | This application illustrates the use of modal and modeless dialogs. |
GtTest_07_ListView | This application illustrates the use of the abstract item list view. |
GtTest_08_TableView | This application illustrates the use of the abstract item table view. |
GtTest_09_TreeView | This application illustrates the use of the abstract item tree view. |
GtTest_10_OpenGL | This application illustrates the use of the 3D viewer. |
GtTest_11_SimpleChart | This application illustrates the use of the basic plot2D. |
GtTest_12_LogChart | This application illustrates the use of the logarithm scales. |
GtTest_13_BarColumn | This application illustrates the use of the bar and column charts. |
GtTest_14_PieChart | This application illustrates the use of the pie chart. |
GtTest_15_MultiPlot | This application illustrates the use of the generic multiplot. |
Sample GUIs Screenshots
Here are some of the sample GUI screenshots.
GtTest_02_Simple Application
GtScientific Controls Sample
GtTest_03_ToolBox Application
GtTest_07_ListView Application
GtTest_10_OpenGL Application
GtTest_12_LogChart Application
GtTest_14_PieChart Application
GtTest_15_MultiPlot Application
Known Issues
Any bugs, report to the author and if you are interested in helping with GT development, let me know. I intend on setting up a GitHub repository for the project.