Features of the new GUI classes in a nutshell:
Originally written by Hector Peraza
Complete set of widgets:
label, icon, button, check button, radio button, picture button, list box, combo box, list view, icon view, text entry, text view, tree view, tab view, scrollbar, slider, menubar, popup menu, cascading menu, statusbar, toolbar, message dialogs, file selection dialog, ...
The widgets are shown in frames:
frame, composite frame, main frame, transient frame, group frame
And arranged by layout managers:
horizontal layout, vertical layout, row layout, list layout, tile layout, matrix layout, ...
Using a combination of layout hints:
left, center x, right, top, center y, bottom, expand x, expand y and fixed offsets
Event handling by messaging (as opposed to callbacks):
in response to actions widgets send messages
(SendMessage()) to associated frames (ProcessMessage())
Replaced all calls to X11 by calls to the ROOT abstract graphics base class TGXW
Currently concrete implementations of TGXW exist for:

Concrete implementations of TGXW are TGX11, for X Windows, TGWin32 for Win95/NT. The TGXClient implementation provides a network interface allowing for remote display via the rootdisp servers.
Further changes:
// File: main.cxx #include <TApplication.h> #include <TGClient.h> #include "MyMain.h"
int main(int argc, char **argv)
{
TApplication theApp("App", &argc, argv);
MyMainFrame mainWin(gClient->GetRoot(), 200, 220);
theApp.Run();
return 0;
}
Compile example using:
g++ `root-config --cflags --glibs` -o main main.cxx MyMain.cxx
// File: MyMain.h #include <TGClient.h> #include <TGButton.h>
class MyMainFrame : public TGMainFrame {
private: TGTextButton *fButton1, *fButton2; TGPictureButton *fPicBut; TGCheckButton *fChkBut; TGRadioButton *fRBut1, *fRBut2; TGLayoutHints *fLayout;
public:
MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h);
~MyMainFrame() { } // need to delete here created widgets
Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
};
// File: MyMain.cxx
#include "MyMain.h"
MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h)
: TGMainFrame(p, w, h)
{
// Create a main frame with a number of different buttons.
fButton1 = new TGTextButton(this, "&Version", 1);
fButton1->SetCommand("printf(\"This is ROOT version %s\\n\","
"gROOT->GetVersion());");
fButton2 = new TGTextButton(this, "&Exit", 2);
fButton2->SetCommand(".q" );
fPicBut = new TGPictureButton(this, gClient->GetPicture("world.xpm"), 3);
fPicBut->SetCommand("printf(\"hello world!\\n\");");
fChkBut = new TGCheckButton(this, "Check Button", 4);
fRBut1 = new TGRadioButton(this, "Radio Button 1", 5);
fRBut2 = new TGRadioButton(this, "Radio Button 2", 6);
fLayout = new TGLayoutHints(kLHintsCenterX | kLHintsCenterY);
AddFrame(fButton1, fLayout); AddFrame(fPicBut, fLayout); AddFrame(fButton2, fLayout); AddFrame(fChkBut, fLayout); AddFrame(fRBut1, fLayout); AddFrame(fRBut2, fLayout);
MapSubwindows();
Layout();
SetWindowName("Button Example");
SetIconName("Button Example");
MapWindow(); }
// Continuation of MyMain.cxx
Bool_t MyMainFrame::ProcessMessage(Long_t msg, Long_t parm1, Long_t)
{
// Process events generated by the buttons in the frame.
switch (GET_MSG(msg)) {
case kC_COMMAND:
switch (GET_SUBMSG(msg)) {
case kCM_BUTTON:
printf("text button id %ld pressed\n", parm1);
break;
case kCM_CHECKBUTTON:
printf("check button id %ld pressed\n", parm1);
break;
case kCM_RADIOBUTTON:
if (parm1 == 5)
fRBut2->SetState(kButtonUp);
if (parm1 == 6)
fRBut1->SetState(kButtonUp);
printf("radio button id %ld pressed\n", parm1);
break;
default:
break;
}
default:
break;
}
return kTRUE;
}