Click here to Skip to main content
15,868,016 members
Articles / Web Development / HTML
Tip/Trick

GT: A C++ Graphical User Interface Library and System

Rate me:
Please Sign up or sign in to vote.
4.45/5 (16 votes)
13 Feb 2017LGPL35 min read 76.1K   3.9K   43   23
GT is a compact, efficient, and customizable graphical user interface (GUI) library for the Windows environment.

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.

Image 1

GtTest_02_Simple Application
 
Image 2
GtScientific Controls Sample

Image 3

GtTest_03_ToolBox Application

Image 4

GtTest_07_ListView Application

Image 5

GtTest_10_OpenGL Application

Image 6

GtTest_12_LogChart Application

Image 7

GtTest_14_PieChart Application

Image 8

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.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionAre "Skins" , or bitmap backgrounds possible Pin
frqftgbdafr22-Feb-17 11:03
frqftgbdafr22-Feb-17 11:03 
AnswerRe: Are "Skins" , or bitmap backgrounds possible Pin
trident9923-Feb-17 14:44
trident9923-Feb-17 14:44 
QuestionLook and feel is 1980 Pin
D. Infuehr22-Feb-17 4:39
D. Infuehr22-Feb-17 4:39 
AnswerRe: Look and feel is 1980 Pin
trident9929-Aug-19 14:39
trident9929-Aug-19 14:39 
QuestionHow does this compare with CopperSpice? Pin
Zebedee Mason27-Jan-17 2:18
Zebedee Mason27-Jan-17 2:18 
AnswerRe: How does this compare with CopperSpice? Pin
trident994-Feb-17 14:28
trident994-Feb-17 14:28 
QuestionLGPL and Embedding is an oxymoron Pin
jacmoe24-Apr-15 6:38
jacmoe24-Apr-15 6:38 
AnswerRe: LGPL and Embedding is an oxymoron Pin
trident9924-Apr-15 7:22
trident9924-Apr-15 7:22 
GeneralRe: LGPL and Embedding is an oxymoron Pin
jacmoe24-Apr-15 7:34
jacmoe24-Apr-15 7:34 
GeneralRe: LGPL and Embedding is an oxymoron Pin
0xC000005425-Apr-15 2:40
0xC000005425-Apr-15 2:40 
GeneralRe: LGPL and Embedding is an oxymoron Pin
jacmoe25-Apr-15 3:35
jacmoe25-Apr-15 3:35 
GeneralRe: LGPL and Embedding is an oxymoron Pin
0xC000005425-Apr-15 4:51
0xC000005425-Apr-15 4:51 
GeneralRe: LGPL and Embedding is an oxymoron Pin
jacmoe25-Apr-15 5:05
jacmoe25-Apr-15 5:05 
QuestionBest Racing Sim Game Ever... Pin
thund3rstruck23-Apr-15 10:37
thund3rstruck23-Apr-15 10:37 
SuggestionGood vehicle for Google Material Design Pin
Gnawme23-Apr-15 8:33
Gnawme23-Apr-15 8:33 
GeneralUI looks primitive Pin
Sharjith20-Apr-15 2:06
professionalSharjith20-Apr-15 2:06 
GeneralRe: UI looks primitive Pin
Kochise20-Apr-15 6:20
Kochise20-Apr-15 6:20 
GeneralRe: UI looks primitive Pin
trident9920-Apr-15 6:44
trident9920-Apr-15 6:44 
GeneralRe: UI looks primitive Pin
Shao Voon Wong20-Apr-15 17:46
mvaShao Voon Wong20-Apr-15 17:46 
GeneralRe: UI looks primitive Pin
Sharjith20-Apr-15 19:45
professionalSharjith20-Apr-15 19:45 
GeneralRe: UI looks primitive Pin
Kochise20-Apr-15 20:37
Kochise20-Apr-15 20:37 
GeneralRe: UI looks primitive Pin
trident9923-Nov-16 6:42
trident9923-Nov-16 6:42 
I have made modifications to the basic controls to make them look more sophisticated. The current code base allows for the use of images for controls. So you limit is what you can do in Photoshop. However the current code base is a good representation of what Windows GDI+ is capable of.
Questionhave you consider to post this as a tip? Pin
Nelek17-Apr-15 12:27
protectorNelek17-Apr-15 12:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.