Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
guitest.C File Reference

Detailed Description

Test program for ROOT native GUI classes Exactly like $ROOTSYS/test/guitest.cxx but using the new signal and slots communication mechanism.

It is now possible to run this entire test program in the interpreter. Do either:

.x guitest.C
.x guitest.C++
#include <cstdlib>
#include <TROOT.h>
#include <TClass.h>
#include <TApplication.h>
#include <TVirtualX.h>
#include <TGResourcePool.h>
#include <TGListBox.h>
#include <TGListTree.h>
#include <TGFSContainer.h>
#include <TGClient.h>
#include <TGFrame.h>
#include <TGIcon.h>
#include <TGLabel.h>
#include <TGButton.h>
#include <TGTextEntry.h>
#include <TGNumberEntry.h>
#include <TGMsgBox.h>
#include <TGMenu.h>
#include <TGCanvas.h>
#include <TGComboBox.h>
#include <TGTab.h>
#include <TGSlider.h>
#include <TGDoubleSlider.h>
#include <TGFileDialog.h>
#include <TGTextEdit.h>
#include <TGShutter.h>
#include <TGProgressBar.h>
#include <TGColorSelect.h>
#include <RQ_OBJECT.h>
#include <TCanvas.h>
#include <TColor.h>
#include <TH1.h>
#include <TH2.h>
#include <TRandom.h>
#include <TSystem.h>
#include <TEnv.h>
#include <TFile.h>
#include <TKey.h>
#include <TGFontDialog.h>
enum ETestCommandIdentifiers {
M_FILE_OPEN,
M_FILE_SAVE,
M_FILE_SAVEAS,
M_FILE_PRINT,
M_FILE_PRINTSETUP,
M_FILE_EXIT,
M_TEST_DLG,
M_TEST_MSGBOX,
M_TEST_SLIDER,
M_TEST_SHUTTER,
M_TEST_DIRLIST,
M_TEST_FILELIST,
M_TEST_PROGRESS,
M_TEST_NUMBERENTRY,
M_TEST_FONTDIALOG,
M_TEST_NEWMENU,
M_VIEW_ENBL_DOCK,
M_VIEW_ENBL_HIDE,
M_VIEW_DOCK,
M_VIEW_UNDOCK,
M_HELP_CONTENTS,
M_HELP_SEARCH,
M_HELP_ABOUT,
M_CASCADE_1,
M_CASCADE_2,
M_CASCADE_3,
M_NEW_REMOVEMENU,
VId1,
HId1,
VId2,
HId2,
VSId1,
HSId1,
VSId2,
HSId2
};
Int_t mb_button_id[13] = { kMBYes, kMBNo, kMBOk, kMBApply,
const char *filetypes[] = { "All files", "*",
"ROOT files", "*.root",
"ROOT macros", "*.C",
"Text files", "*.[tT][xX][tT]",
nullptr, nullptr };
struct shutterData_t {
const char *pixmap_name;
const char *tip_text;
};
shutterData_t histo_data[] = {
{ "h1_s.xpm", "TH1", 1001, nullptr },
{ "h2_s.xpm", "TH2", 1002, nullptr },
{ "h3_s.xpm", "TH3", 1003, nullptr },
{ "profile_s.xpm", "TProfile", 1004, nullptr },
{ nullptr, nullptr, 0, nullptr }
};
shutterData_t function_data[] = {
{ "f1_s.xpm", "TF1", 2001, nullptr },
{ "f2_s.xpm", "TF2", 2002, nullptr },
{ nullptr, nullptr, 0, nullptr }
};
shutterData_t tree_data[] = {
{ "ntuple_s.xpm", "TNtuple", 3001, nullptr },
{ "tree_s.xpm", "TTree", 3002, nullptr },
{ "chain_s.xpm", "TChain", 3003, nullptr },
{ nullptr, nullptr, 0, nullptr }
};
const char *editortxt1 =
"This is the ROOT text edit widget TGTextEdit. It is not intended as\n"
"a full developers editor, but it is relatively complete and can ideally\n"
"be used to edit scripts or to present users editable config files, etc.\n\n"
"The text edit widget supports standard emacs style ctrl-key navigation\n"
"in addition to the arrow keys. By default the widget has under the right\n"
"mouse button a popup menu giving access to several built-in functions.\n\n"
"Cut, copy and paste between different editor windows and any other\n"
"standard text handling application is supported.\n\n"
"Text can be selected with the mouse while holding the left button\n"
"or with the arrow keys while holding the shift key pressed. Use the\n"
"middle mouse button to paste text at the current mouse location."
;
const char *editortxt2 =
"Mice with scroll-ball are properly supported.\n\n"
"This are the currently defined key bindings:\n"
"Left Arrow\n"
" Move the cursor one character leftwards.\n"
" Scroll when cursor is out of frame.\n"
"Right Arrow\n"
" Move the cursor one character rightwards.\n"
" Scroll when cursor is out of frame.\n"
"Backspace\n"
" Deletes the character on the left side of the text cursor and moves the\n"
" cursor one position to the left. If a text has been marked by the user"
;
const char *editortxt3 =
" (e.g. by clicking and dragging) the cursor will be put at the beginning\n"
" of the marked text and the marked text will be removed.\n"
"Home\n"
" Moves the text cursor to the left end of the line. If mark is TRUE text\n"
" will be marked towards the first position, if not any marked text will\n"
" be unmarked if the cursor is moved.\n"
"End\n"
" Moves the text cursor to the right end of the line. If mark is TRUE text\n"
" will be marked towards the last position, if not any marked text will\n"
" be unmarked if the cursor is moved.\n"
"Delete"
;
const char *editortxt4 =
" Deletes the character on the right side of the text cursor. If a text\n"
" has been marked by the user (e.g. by clicking and dragging) the cursor\n"
" will be put at the beginning of the marked text and the marked text will\n"
" be removed.\n"
"Shift - Left Arrow\n"
" Mark text one character leftwards.\n"
"Shift - Right Arrow\n"
" Mark text one character rightwards.\n"
"Control-A\n"
" Select the whole text.\n"
"Control-B\n"
" Move the cursor one character leftwards."
;
const char *editortxt5 =
"Control-C\n"
" Copy the marked text to the clipboard.\n"
"Control-D\n"
" Delete the character to the right of the cursor.\n"
"Control-E\n"
" Move the cursor to the end of the line.\n"
"Control-F\n"
" Start Search Dialog.\n"
"Control-H\n"
" Delete the character to the left of the cursor.\n"
"Control-K\n"
" Delete marked text if any or delete all\n"
" characters to the right of the cursor.\n"
"Control-L\n"
" Start GoTo Line Dialog"
;
const char *editortxt6 =
"Control-U\n"
" Delete all characters on the line.\n"
"Control-V\n"
" Paste the clipboard text into line edit.\n"
"Control-X\n"
" Cut the marked text, copy to clipboard.\n"
"Control-Y\n"
" Paste the clipboard text into line edit.\n"
"Control-Z\n"
" Undo action.\n\n"
"All other keys with valid ASCII codes insert themselves into the line.";
class TileFrame;
class TestMainFrame {
RQ_OBJECT("TestMainFrame")
private:
TGMainFrame *fMain;
TGDockableFrame *fMenuDock;
TGCompositeFrame *fStatusFrame;
TGCanvas *fCanvasWindow;
TileFrame *fContainer;
TGTextEntry *fTestText;
TGButton *fTestButton;
TGColorSelect *fColorSel;
TGMenuBar *fMenuBar;
TGPopupMenu *fMenuFile, *fMenuTest, *fMenuView, *fMenuHelp;
TGPopupMenu *fCascadeMenu, *fCascade1Menu, *fCascade2Menu;
TGPopupMenu *fMenuNew1, *fMenuNew2;
TGLayoutHints *fMenuBarLayout, *fMenuBarItemLayout, *fMenuBarHelpLayout;
public:
TestMainFrame(const TGWindow *p, UInt_t w, UInt_t h);
virtual ~TestMainFrame();
// slots
void CloseWindow();
void DoButton();
void HandleMenu(Int_t id);
void HandlePopup() { printf("menu popped up\n"); }
void HandlePopdown() { printf("menu popped down\n"); }
void Created() { Emit("Created()"); } //*SIGNAL*
void Welcome() { printf("TestMainFrame has been created. Welcome!\n"); }
};
class TestDialog {
RQ_OBJECT("TestDialog")
private:
TGCompositeFrame *fFrame1, *fF1, *fF2, *fF3, *fF4, *fF5;
TGGroupFrame *fF6, *fF7;
TGButton *fOkButton, *fCancelButton, *fStartB, *fStopB;
TGButton *fBtn1, *fBtn2, *fChk1, *fChk2, *fRad1, *fRad2;
TGPictureButton *fPicBut1;
TGCheckButton *fCheck1;
TGCheckButton *fCheckMulti;
TGListBox *fListBox;
TGComboBox *fCombo;
TGTab *fTab;
TGTextEntry *fTxt1, *fTxt2;
TGLayoutHints *fL1, *fL2, *fL3, *fL4;
TRootEmbeddedCanvas *fEc1, *fEc2;
Int_t fFirstEntry;
Int_t fLastEntry;
Bool_t fFillHistos;
TH1F *fHpx;
TH2F *fHpxpy;
void FillHistos();
public:
TestDialog(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h,
UInt_t options = kVerticalFrame);
virtual ~TestDialog();
// slots
void DoClose();
void CloseWindow();
void DoOK();
void DoCancel();
void DoTab(Int_t id);
void HandleButtons(Int_t id = -1);
void HandleEmbeddedCanvas(Int_t event, Int_t x, Int_t y, TObject *sel);
};
class TestMsgBox {
RQ_OBJECT("TestMsgBox")
private:
TGCompositeFrame *f1, *f2, *f3, *f4, *f5;
TGButton *fTestButton, *fCloseButton;
TGPictureButton *fPictButton;
TGRadioButton *fR[4];
TGCheckButton *fC[13];
TGGroupFrame *fG1, *fG2;
TGLayoutHints *fL1, *fL2, *fL3, *fL4, *fL5, *fL6, *fL21;
TGTextEntry *fTitle, *fMsg;
TGTextBuffer *fTbtitle, *fTbmsg;
TGLabel *fLtitle, *fLmsg;
TGGC fRedTextGC;
public:
TestMsgBox(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h,
UInt_t options = kVerticalFrame);
virtual ~TestMsgBox();
// slots
void TryToClose();
void CloseWindow();
void DoClose();
void DoRadio();
void DoTest();
};
class TestSliders {
RQ_OBJECT("TestSliders")
private:
TGVerticalFrame *fVframe1, *fVframe2;
TGLayoutHints *fBly, *fBfly1;
TGHSlider *fHslider1, *fHslider2;
TGVSlider *fVslider1;
TGDoubleVSlider *fVslider2;
TGTextEntry *fTeh1, *fTev1, *fTeh2, *fTev2;
TGTextBuffer *fTbh1, *fTbv1, *fTbh2, *fTbv2;
public:
TestSliders(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h);
virtual ~TestSliders();
// slots
void CloseWindow();
void DoText(const char *text);
void DoSlider(Int_t pos = 0);
};
class TestShutter {
RQ_OBJECT("TestShutter")
private:
TGShutter *fShutter;
TGLayoutHints *fLayout;
const TGPicture *fDefaultPic;
public:
TestShutter(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h);
~TestShutter();
void AddShutterItem(const char *name, shutterData_t *data);
// slots
void CloseWindow();
void HandleButtons();
};
class TestDirList {
RQ_OBJECT("TestDirList")
protected:
TGListTree *fContents;
const TGPicture *fIcon;
TString DirName(TGListTreeItem* item);
public:
TestDirList(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h);
virtual ~TestDirList();
// slots
void OnDoubleClick(TGListTreeItem* item, Int_t btn);
void CloseWindow();
};
class TestFileList {
RQ_OBJECT("TestFileList")
protected:
TGFileContainer *fContents;
TGPopupMenu *fMenu;
void DisplayFile(const TString &fname);
void DisplayDirectory(const TString &fname);
void DisplayObject(const TString& fname,const TString& name);
public:
TestFileList(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h);
virtual ~TestFileList();
// slots
void OnDoubleClick(TGLVEntry*,Int_t);
void DoMenu(Int_t);
void CloseWindow();
};
class TestProgress {
private:
TGHorizontalFrame *fHframe1;
TGVerticalFrame *fVframe1;
TGLayoutHints *fHint1, *fHint2, *fHint3, *fHint4, *fHint5;
TGHProgressBar *fHProg1, *fHProg2, *fHProg3;
TGVProgressBar *fVProg1, *fVProg2;
Bool_t fClose;
public:
TestProgress(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h);
virtual ~TestProgress();
// slots
void CloseWindow();
void DoClose();
void DoGo();
};
class EntryTestDlg {
private:
TGLabel *fLabel[13];
TGNumberEntry *fNumericEntries[13];
TGCheckButton *fLowerLimit;
TGCheckButton *fUpperLimit;
TGNumberEntry *fLimits[2];
TGCheckButton *fPositive;
TGCheckButton *fNonNegative;
TGButton *fSetButton;
TGButton *fExitButton;
// static const char *const numlabel[13];
// static const Double_t numinit[13];
public:
EntryTestDlg(const TGWindow *p, const TGWindow *main);
virtual ~EntryTestDlg();
// slots
void CloseWindow();
void SetLimits();
void DoOK();
};
class Editor {
private:
TGTransientFrame *fMain; // main frame of this widget
TGTextEdit *fEdit; // text edit widget
TGTextButton *fOK; // OK button
TGLayoutHints *fL1; // layout of TGTextEdit
TGLayoutHints *fL2; // layout of OK button
public:
Editor(const TGWindow *main, UInt_t w, UInt_t h);
virtual ~Editor();
void LoadFile(const char *file);
void LoadBuffer(const char *buffer);
void AddBuffer(const char *buffer);
TGTextEdit *GetEditor() const { return fEdit; }
void SetTitle();
void Popup();
// slots
void CloseWindow();
void DoOK();
void DoOpen();
void DoSave();
void DoClose();
};
class TileFrame {
RQ_OBJECT("TileFrame")
private:
TGCanvas *fCanvas;
public:
TileFrame(const TGWindow *p);
virtual ~TileFrame() { delete fFrame; }
TGFrame *GetFrame() const { return fFrame; }
void SetCanvas(TGCanvas *canvas) { fCanvas = canvas; }
void HandleMouseWheel(Event_t *event);
};
TileFrame::TileFrame(const TGWindow *p)
{
// Create tile view container. Used to show colormap.
fFrame = new TGCompositeFrame(p, 10, 10, kHorizontalFrame,
fFrame->Connect("ProcessedEvent(Event_t*)", "TileFrame", this,
"HandleMouseWheel(Event_t*)");
fCanvas = nullptr;
fFrame->SetLayoutManager(new TGTileLayout(fFrame, 8));
gVirtualX->GrabButton(fFrame->GetId(), kAnyButton, kAnyModifier,
}
void TileFrame::HandleMouseWheel(Event_t *event)
{
// Handle mouse wheel to scroll.
if (event->fType != kButtonPress && event->fType != kButtonRelease)
return;
Int_t page = 0;
if (event->fCode == kButton4 || event->fCode == kButton5) {
if (!fCanvas) return;
if (fCanvas->GetContainer()->GetHeight())
page = Int_t(Float_t(fCanvas->GetViewPort()->GetHeight() *
fCanvas->GetViewPort()->GetHeight()) /
fCanvas->GetContainer()->GetHeight());
}
if (event->fCode == kButton4) {
//scroll up
Int_t newpos = fCanvas->GetVsbPosition() - page;
if (newpos < 0) newpos = 0;
fCanvas->SetVsbPosition(newpos);
}
if (event->fCode == kButton5) {
// scroll down
Int_t newpos = fCanvas->GetVsbPosition() + page;
fCanvas->SetVsbPosition(newpos);
}
}
TestMainFrame::TestMainFrame(const TGWindow *p, UInt_t w, UInt_t h)
{
// Create test main frame. A TGMainFrame is a top level window.
fMain = new TGMainFrame(p, w, h);
// use hierarchical cleaning
fMain->SetCleanup(kDeepCleanup);
fMain->Connect("CloseWindow()", "TestMainFrame", this, "CloseWindow()");
// Create menubar and popup menus. The hint objects are used to place
// and group the different menu widgets with respect to eachother.
fMenuDock = new TGDockableFrame(fMain);
fMain->AddFrame(fMenuDock, new TGLayoutHints(kLHintsExpandX, 0, 0, 1, 0));
fMenuDock->SetWindowName("GuiTest Menu");
fMenuBarLayout = new TGLayoutHints(kLHintsTop | kLHintsExpandX);
fMenuBarItemLayout = new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0);
fMenuBarHelpLayout = new TGLayoutHints(kLHintsTop | kLHintsRight);
fMenuFile = new TGPopupMenu(gClient->GetRoot());
fMenuFile->AddEntry("&Open...", M_FILE_OPEN);
fMenuFile->AddEntry("&Save", M_FILE_SAVE);
fMenuFile->AddEntry("S&ave as...", M_FILE_SAVEAS);
fMenuFile->AddEntry("&Close", -1);
fMenuFile->AddSeparator();
fMenuFile->AddEntry("&Print", M_FILE_PRINT);
fMenuFile->AddEntry("P&rint setup...", M_FILE_PRINTSETUP);
fMenuFile->AddSeparator();
fMenuFile->AddEntry("E&xit", M_FILE_EXIT);
fMenuFile->DisableEntry(M_FILE_SAVEAS);
fMenuFile->HideEntry(M_FILE_PRINT);
fCascade2Menu = new TGPopupMenu(gClient->GetRoot());
fCascade2Menu->AddEntry("ID = 2&3", M_CASCADE_1);
fCascade2Menu->AddEntry("ID = 2&4", M_CASCADE_2);
fCascade2Menu->AddEntry("ID = 2&5", M_CASCADE_3);
fCascade1Menu = new TGPopupMenu(gClient->GetRoot());
fCascade1Menu->AddEntry("ID = 4&1", 41);
fCascade1Menu->AddEntry("ID = 4&2", 42);
fCascade1Menu->AddEntry("ID = 4&3", 43);
fCascade1Menu->AddSeparator();
fCascade1Menu->AddPopup("Cascade&d 2", fCascade2Menu);
fCascadeMenu = new TGPopupMenu(gClient->GetRoot());
fCascadeMenu->AddEntry("ID = 5&1", 51);
fCascadeMenu->AddEntry("ID = 5&2", 52);
fCascadeMenu->AddEntry("ID = 5&3", 53);
fCascadeMenu->AddSeparator();
fCascadeMenu->AddPopup("&Cascaded 1", fCascade1Menu);
fMenuTest = new TGPopupMenu(gClient->GetRoot());
fMenuTest->AddLabel("Test different features...");
fMenuTest->AddSeparator();
fMenuTest->AddEntry("&Dialog...", M_TEST_DLG);
fMenuTest->AddEntry("&Message Box...", M_TEST_MSGBOX);
fMenuTest->AddEntry("&Sliders...", M_TEST_SLIDER);
fMenuTest->AddEntry("Sh&utter...", M_TEST_SHUTTER);
fMenuTest->AddEntry("&List Directory...", M_TEST_DIRLIST);
fMenuTest->AddEntry("&File List...", M_TEST_FILELIST);
fMenuTest->AddEntry("&Progress...", M_TEST_PROGRESS);
fMenuTest->AddEntry("&Number Entry...", M_TEST_NUMBERENTRY);
fMenuTest->AddEntry("F&ont Dialog...", M_TEST_FONTDIALOG);
fMenuTest->AddSeparator();
fMenuTest->AddEntry("Add New Menus", M_TEST_NEWMENU);
fMenuTest->AddSeparator();
fMenuTest->AddPopup("&Cascaded menus", fCascadeMenu);
fMenuView = new TGPopupMenu(gClient->GetRoot());
fMenuView->AddEntry("&Dock", M_VIEW_DOCK);
fMenuView->AddEntry("&Undock", M_VIEW_UNDOCK);
fMenuView->AddSeparator();
fMenuView->AddEntry("Enable U&ndock", M_VIEW_ENBL_DOCK);
fMenuView->AddEntry("Enable &Hide", M_VIEW_ENBL_HIDE);
fMenuView->DisableEntry(M_VIEW_DOCK);
fMenuDock->EnableUndock(kTRUE);
fMenuDock->EnableHide(kTRUE);
fMenuView->CheckEntry(M_VIEW_ENBL_DOCK);
fMenuView->CheckEntry(M_VIEW_ENBL_HIDE);
// When using the DockButton of the MenuDock,
// the states 'enable' and 'disable' of menus have to be updated.
fMenuDock->Connect("Undocked()", "TestMainFrame", this, "HandleMenu(=M_VIEW_UNDOCK)");
fMenuHelp = new TGPopupMenu(gClient->GetRoot());
fMenuHelp->AddEntry("&Contents", M_HELP_CONTENTS);
fMenuHelp->AddEntry("&Search...", M_HELP_SEARCH);
fMenuHelp->AddSeparator();
fMenuHelp->AddEntry("&About", M_HELP_ABOUT);
fMenuNew1 = new TGPopupMenu();
fMenuNew1->AddEntry("Remove New Menus", M_NEW_REMOVEMENU);
fMenuNew2 = new TGPopupMenu();
fMenuNew2->AddEntry("Remove New Menus", M_NEW_REMOVEMENU);
// Menu button messages are handled by the main frame (i.e. "this")
// HandleMenu() method.
fMenuFile->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fMenuFile->Connect("PoppedUp()", "TestMainFrame", this, "HandlePopup()");
fMenuFile->Connect("PoppedDown()", "TestMainFrame", this, "HandlePopdown()");
fMenuTest->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fMenuView->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fMenuHelp->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fCascadeMenu->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fCascade1Menu->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fCascade2Menu->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fMenuNew1->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fMenuNew2->Connect("Activated(Int_t)", "TestMainFrame", this,
"HandleMenu(Int_t)");
fMenuBar = new TGMenuBar(fMenuDock, 1, 1, kHorizontalFrame);
fMenuBar->AddPopup("&File", fMenuFile, fMenuBarItemLayout);
fMenuBar->AddPopup("&Test", fMenuTest, fMenuBarItemLayout);
fMenuBar->AddPopup("&View", fMenuView, fMenuBarItemLayout);
fMenuBar->AddPopup("&Help", fMenuHelp, fMenuBarHelpLayout);
fMenuDock->AddFrame(fMenuBar, fMenuBarLayout);
// Create TGCanvas and a canvas container which uses a tile layout manager
fCanvasWindow = new TGCanvas(fMain, 400, 240);
fContainer = new TileFrame(fCanvasWindow->GetViewPort());
fContainer->SetCanvas(fCanvasWindow);
fCanvasWindow->SetContainer(fContainer->GetFrame());
// use hierarchical cleaning for container
fContainer->GetFrame()->SetCleanup(kDeepCleanup);
// Fill canvas with 256 colored frames
for (int i=0; i < 256; ++i)
fCanvasWindow->AddFrame(new TGFrame(fCanvasWindow->GetContainer(),
32, 32, 0, TColor::RGB2Pixel(0,0,(i+1)&255)),
fMain->AddFrame(fCanvasWindow, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
0, 0, 2, 2));
// Create status frame containing a button and a text entry widget
fStatusFrame = new TGCompositeFrame(fMain, 60, 20, kHorizontalFrame |
fTestButton = new TGTextButton(fStatusFrame, "&Open editor...", 150);
fTestButton->Connect("Clicked()", "TestMainFrame", this, "DoButton()");
fTestButton->SetToolTipText("Pops up\ntext editor");
fStatusFrame->AddFrame(fTestButton, new TGLayoutHints(kLHintsTop |
kLHintsLeft, 2, 0, 2, 2));
fTestText = new TGTextEntry(fStatusFrame, new TGTextBuffer(100));
fTestText->SetToolTipText("This is a text entry widget");
fTestText->Resize(300, fTestText->GetDefaultHeight());
fStatusFrame->AddFrame(fTestText, new TGLayoutHints(kLHintsTop | kLHintsLeft,
10, 2, 2, 2));
Pixel_t yellow;
gClient->GetColorByName("yellow", yellow);
fColorSel = new TGColorSelect(fStatusFrame, yellow, 0);
fStatusFrame->AddFrame(fColorSel, new TGLayoutHints(kLHintsTop |
kLHintsLeft, 2, 0, 2, 2));
fMain->AddFrame(fStatusFrame, new TGLayoutHints(kLHintsBottom | kLHintsExpandX,
0, 0, 1, 0));
fMain->SetWindowName("GuiTest Signal/Slots");
fMain->MapSubwindows();
// we need to use GetDefault...() to initialize the layout algorithm...
fMain->Resize();
fMain->MapWindow();
fMain->Print();
Connect("Created()", "TestMainFrame", this, "Welcome()");
Created();
}
TestMainFrame::~TestMainFrame()
{
// Delete all created widgets.
delete fMenuFile;
delete fMenuTest;
delete fMenuView;
delete fMenuHelp;
delete fCascadeMenu;
delete fCascade1Menu;
delete fCascade2Menu;
delete fMenuNew1;
delete fMenuNew2;
delete fContainer;
delete fMain;
}
void TestMainFrame::CloseWindow()
{
// Got close message for this MainFrame. Terminates the application.
}
void TestMainFrame::DoButton()
{
// Handle button click.
Editor *ed = new Editor(fMain, 600, 400);
ed->LoadBuffer(editortxt1);
ed->AddBuffer(editortxt2);
ed->AddBuffer(editortxt3);
ed->AddBuffer(editortxt4);
ed->AddBuffer(editortxt5);
ed->AddBuffer(editortxt6);
ed->Popup();
}
void TestMainFrame::HandleMenu(Int_t id)
{
// Handle menu items.
switch (id) {
case M_FILE_OPEN:
{
static TString dir(".");
fi.fFileTypes = filetypes;
fi.SetIniDir(dir);
printf("fIniDir = %s\n", fi.fIniDir);
new TGFileDialog(gClient->GetRoot(), fMain, kFDOpen, &fi);
printf("Open file: %s (dir: %s)\n", fi.fFilename, fi.fIniDir);
dir = fi.fIniDir;
}
break;
case M_FILE_SAVE:
printf("M_FILE_SAVE\n");
break;
case M_FILE_PRINT:
printf("M_FILE_PRINT\n");
printf("Hiding itself, select \"Print Setup...\" to enable again\n");
fMenuFile->HideEntry(M_FILE_PRINT);
break;
case M_FILE_PRINTSETUP:
printf("M_FILE_PRINTSETUP\n");
printf("Enabling \"Print\"\n");
fMenuFile->EnableEntry(M_FILE_PRINT);
break;
case M_FILE_EXIT:
CloseWindow(); // terminate theApp no need to use SendCloseMessage()
break;
case M_TEST_DLG:
new TestDialog(gClient->GetRoot(), fMain, 400, 200);
break;
case M_TEST_MSGBOX:
new TestMsgBox(gClient->GetRoot(), fMain, 400, 200);
break;
case M_TEST_SLIDER:
new TestSliders(gClient->GetRoot(), fMain, 400, 200);
break;
case M_TEST_SHUTTER:
new TestShutter(gClient->GetRoot(), fMain, 400, 200);
break;
case M_TEST_DIRLIST:
new TestDirList(gClient->GetRoot(), fMain, 400, 200);
break;
case M_TEST_FILELIST:
new TestFileList(gClient->GetRoot(), fMain, 400, 200);
break;
case M_TEST_PROGRESS:
new TestProgress(gClient->GetRoot(), fMain, 600, 300);
break;
case M_TEST_NUMBERENTRY:
new EntryTestDlg(gClient->GetRoot(), fMain);
break;
case M_TEST_FONTDIALOG:
{
new TGFontDialog(gClient->GetRoot(), fMain, &prop);
if (prop.fName != "")
printf("Selected font: %s, size %d, italic %s, bold %s, color 0x%lx, align %u\n",
prop.fName.Data(), prop.fSize, prop.fItalic ? "yes" : "no",
prop.fBold ? "yes" : "no", prop.fColor, prop.fAlign);
}
break;
case M_TEST_NEWMENU:
{
if (fMenuTest->IsEntryChecked(M_TEST_NEWMENU)) {
HandleMenu(M_NEW_REMOVEMENU);
return;
}
fMenuTest->CheckEntry(M_TEST_NEWMENU);
TGPopupMenu *p = fMenuBar->GetPopup("Test");
fMenuBar->AddPopup("New 1", fMenuNew1, fMenuBarItemLayout, p);
p = fMenuBar->GetPopup("Help");
fMenuBar->AddPopup("New 2", fMenuNew2, fMenuBarItemLayout, p);
fMenuBar->MapSubwindows();
fMenuBar->Layout();
TGMenuEntry *e = fMenuTest->GetEntry("Add New Menus");
fMenuTest->AddEntry("Remove New Menus", M_NEW_REMOVEMENU, nullptr, nullptr, e);
}
break;
case M_NEW_REMOVEMENU:
{
fMenuBar->RemovePopup("New 1");
fMenuBar->RemovePopup("New 2");
fMenuBar->Layout();
fMenuTest->DeleteEntry(M_NEW_REMOVEMENU);
fMenuTest->UnCheckEntry(M_TEST_NEWMENU);
}
break;
case M_VIEW_ENBL_DOCK:
fMenuDock->EnableUndock(!fMenuDock->EnableUndock());
if (fMenuDock->EnableUndock()) {
fMenuView->CheckEntry(M_VIEW_ENBL_DOCK);
fMenuView->EnableEntry(M_VIEW_UNDOCK);
} else {
fMenuView->UnCheckEntry(M_VIEW_ENBL_DOCK);
fMenuView->DisableEntry(M_VIEW_UNDOCK);
}
break;
case M_VIEW_ENBL_HIDE:
fMenuDock->EnableHide(!fMenuDock->EnableHide());
if (fMenuDock->EnableHide()) {
fMenuView->CheckEntry(M_VIEW_ENBL_HIDE);
} else {
fMenuView->UnCheckEntry(M_VIEW_ENBL_HIDE);
}
break;
case M_VIEW_DOCK:
fMenuDock->DockContainer();
fMenuView->EnableEntry(M_VIEW_UNDOCK);
fMenuView->DisableEntry(M_VIEW_DOCK);
break;
case M_VIEW_UNDOCK:
fMenuDock->UndockContainer();
fMenuView->EnableEntry(M_VIEW_DOCK);
fMenuView->DisableEntry(M_VIEW_UNDOCK);
break;
default:
printf("Menu item %d selected\n", id);
break;
}
}
TestDialog::TestDialog(const TGWindow *p, const TGWindow *main, UInt_t w,
UInt_t h, UInt_t options)
{
// Create a dialog window. A dialog window pops up with respect to its
// "main" window.
fMain = new TGTransientFrame(p, main, w, h, options);
fMain->Connect("CloseWindow()", "TestDialog", this, "DoClose()");
fMain->DontCallClose(); // to avoid double deletions.
// use hierarchical cleaning
fMain->SetCleanup(kDeepCleanup);
fFrame1 = new TGHorizontalFrame(fMain, 60, 20, kFixedWidth);
fOkButton = new TGTextButton(fFrame1, "&Ok", 1);
fOkButton->Connect("Clicked()", "TestDialog", this, "DoOK()");
fCancelButton = new TGTextButton(fFrame1, "&Cancel", 2);
fCancelButton->Connect("Clicked()", "TestDialog", this, "DoCancel()");
2, 2, 2, 2);
fL2 = new TGLayoutHints(kLHintsBottom | kLHintsRight, 2, 2, 5, 1);
fFrame1->AddFrame(fOkButton, fL1);
fFrame1->AddFrame(fCancelButton, fL1);
fFrame1->Resize(150, fOkButton->GetDefaultHeight());
fMain->AddFrame(fFrame1, fL2);
//--------- create Tab widget and some composite frames for Tab testing
fTab = new TGTab(fMain, 300, 300);
fTab->Connect("Selected(Int_t)", "TestDialog", this, "DoTab(Int_t)");
fL3 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5);
TGCompositeFrame *tf = fTab->AddTab("Tab 1");
fF1 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
fF1->AddFrame(new TGTextButton(fF1, "&Test button", 0), fL3);
fF1->AddFrame(fTxt1 = new TGTextEntry(fF1, new TGTextBuffer(100)), fL3);
fF1->AddFrame(fTxt2 = new TGTextEntry(fF1, new TGTextBuffer(100)), fL3);
tf->AddFrame(fF1, fL3);
fTxt1->Resize(150, fTxt1->GetDefaultHeight());
fTxt2->Resize(150, fTxt2->GetDefaultHeight());
tf = fTab->AddTab("Tab 2");
200, 2, 2, 2);
fF2 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
fF2->AddFrame(fBtn1 = new TGTextButton(fF2, "&Button 1", 61), fL1);
fF2->AddFrame(fBtn2 = new TGTextButton(fF2, "B&utton 2", 62), fL1);
fF2->AddFrame(fChk1 = new TGCheckButton(fF2, "C&heck 1", 71), fL1);
fF2->AddFrame(fChk2 = new TGCheckButton(fF2, "Chec&k 2", 72), fL1);
fF2->AddFrame(fRad1 = new TGRadioButton(fF2, "&Radio 1", 81), fL1);
fF2->AddFrame(fRad2 = new TGRadioButton(fF2, "R&adio 2", 82), fL1);
fCombo = new TGComboBox(fF2, 88);
fF2->AddFrame(fCombo, fL3);
tf->AddFrame(fF2, fL3);
int i;
char tmp[20];
for (i = 0; i < 20; i++) {
sprintf(tmp, "Entry %i", i+1);
fCombo->AddEntry(tmp, i+1);
}
fCombo->Resize(150, 20);
fBtn1->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
fBtn2->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
fChk1->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
fChk2->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
fRad1->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
fRad2->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
//-------------- embedded canvas demo
fFillHistos = kFALSE;
fHpx = nullptr;
fHpxpy = nullptr;
tf = fTab->AddTab("Tab 3");
fF3 = new TGCompositeFrame(tf, 60, 20, kHorizontalFrame);
fStartB = new TGTextButton(fF3, "Start &Filling Hists", 40);
fStopB = new TGTextButton(fF3, "&Stop Filling Hists", 41);
fStartB->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
fStopB->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
fF3->AddFrame(fStartB, fL3);
fF3->AddFrame(fStopB, fL3);
fF5 = new TGCompositeFrame(tf, 60, 60, kHorizontalFrame);
kLHintsExpandY, 5, 5, 5, 5);
fEc1 = new TRootEmbeddedCanvas("ec1", fF5, 100, 100);
fF5->AddFrame(fEc1, fL4);
fEc2 = new TRootEmbeddedCanvas("ec2", fF5, 100, 100);
fF5->AddFrame(fEc2, fL4);
tf->AddFrame(fF3, fL3);
tf->AddFrame(fF5, fL4);
fEc1->GetCanvas()->SetBorderMode(0);
fEc2->GetCanvas()->SetBorderMode(0);
fEc1->GetCanvas()->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
"TestDialog", this,
"HandleEmbeddedCanvas(Int_t,Int_t,Int_t,TObject*)");
// make tab yellow
Pixel_t yellow;
gClient->GetColorByName("yellow", yellow);
TGTabElement *tabel = fTab->GetTabTab("Tab 3");
tabel->ChangeBackground(yellow);
//-------------- end embedded canvas demo
tf = fTab->AddTab("Tab 4");
fF4 = new TGCompositeFrame(tf, 60, 20, kVerticalFrame);
fF4->AddFrame(bt = new TGTextButton(fF4, "A&dd Entry", 90), fL3);
bt->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
fF4->AddFrame(bt = new TGTextButton(fF4, "Remove &Entry", 91), fL3);
bt->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
fF4->AddFrame(fListBox = new TGListBox(fF4, 89), fL3);
fF4->AddFrame(fCheckMulti = new TGCheckButton(fF4, "&Mutli Selectable", 92), fL3);
fCheckMulti->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
tf->AddFrame(fF4, fL3);
for (i = 0; i < 20; ++i) {
sprintf(tmp, "Entry %i", i);
fListBox->AddEntry(tmp, i);
}
fFirstEntry = 0;
fLastEntry = 20;
fListBox->Resize(150, 80);
//--- tab 5
tf = fTab->AddTab("Tab 5");
fF6 = new TGGroupFrame(tf, "Options", kVerticalFrame);
fF6->SetTitlePos(TGGroupFrame::kRight); // right aligned
tf->AddFrame(fF6, fL3);
// 2 column, n rows
fF6->SetLayoutManager(new TGMatrixLayout(fF6, 0, 2, 10));
char buff[100];
int j;
for (j = 0; j < 4; j++) {
sprintf(buff, "Module %i", j+1);
fF6->AddFrame(new TGLabel(fF6, new TGHotString(buff)));
TGTextBuffer *tbuf = new TGTextBuffer(10);
tbuf->AddText(0, "0.0");
TGTextEntry *tent = new TGTextEntry(fF6, tbuf);
tent->Resize(50, tent->GetDefaultHeight());
tent->SetFont("-adobe-courier-bold-r-*-*-14-*-*-*-*-*-iso8859-1");
fF6->AddFrame(tent);
}
fF6->Resize();
// another matrix with text and buttons
fF7 = new TGGroupFrame(tf, "Tab Handling", kVerticalFrame);
tf->AddFrame(fF7, fL3);
fF7->SetLayoutManager(new TGMatrixLayout(fF7, 0, 1, 10));
fF7->AddFrame(bt = new TGTextButton(fF7, "Remove Tab", 101));
bt->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
bt->Resize(90, bt->GetDefaultHeight());
fF7->AddFrame(bt = new TGTextButton(fF7, "Add Tab", 103));
bt->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
bt->Resize(90, bt->GetDefaultHeight());
fF7->AddFrame(bt = new TGTextButton(fF7, "Remove Tab 5", 102));
bt->Connect("Clicked()", "TestDialog", this, "HandleButtons()");
bt->Resize(90, bt->GetDefaultHeight());
fF7->Resize(fF6->GetDefaultSize());
//--- end of last tab
kLHintsExpandY, 2, 2, 5, 1);
fMain->AddFrame(fTab, fL5);
fMain->MapSubwindows();
fMain->Resize();
// position relative to the parent's window
fMain->CenterOnParent();
fMain->SetWindowName("Dialog");
fMain->MapWindow();
//gClient->WaitFor(fMain); // otherwise canvas contextmenu does not work
}
TestDialog::~TestDialog()
{
// Delete test dialog widgets.
fMain->DeleteWindow(); // deletes fMain
}
void TestDialog::FillHistos()
{
// Fill histograms till user clicks "Stop Filling" button.
static int cnt;
if (!fHpx) {
fHpx = new TH1F("hpx","This is the px distribution",100,-4,4);
fHpxpy = new TH2F("hpxpy","py vs px",40,-4,4,40,-4,4);
cnt = 0;
}
const int kUPDATE = 1000;
float px, py;
TCanvas *c1 = fEc1->GetCanvas();
TCanvas *c2 = fEc2->GetCanvas();
while (fFillHistos) {
gRandom->Rannor(px,py); //px and py will be two gaussian random numbers
fHpx->Fill(px);
fHpxpy->Fill(px,py);
cnt++;
if (!(cnt % kUPDATE)) {
if (cnt == kUPDATE) {
c1->cd();
fHpx->Draw();
c2->cd();
fHpxpy->Draw("cont");
}
c1->Modified();
c1->Update();
c2->Modified();
c2->Update();
gSystem->ProcessEvents(); // handle GUI events
}
}
}
void TestDialog::DoClose()
{
printf("\nTerminating dialog: via window manager\n");
if (fFillHistos) {
fFillHistos = kFALSE;
TTimer::SingleShot(150, "TestDialog", this, "CloseWindow()");
} else
CloseWindow();
// Close the Ged editor if it was activated.
}
void TestDialog::CloseWindow()
{
// Called when window is closed via the window manager.
delete this;
}
void TestDialog::DoOK()
{
fFillHistos = kFALSE;
printf("\nTerminating dialog: OK pressed\n");
// Add protection against double-clicks
fCancelButton->SetState(kButtonDisabled);
// Send a close message to the main frame. This will trigger the
// emission of a CloseWindow() signal, which will then call
// TestDialog::CloseWindow(). Calling directly CloseWindow() will cause
// a segv since the OK button is still accessed after the DoOK() method.
// This works since the close message is handled synchronous (via
// message going to/from X server).
//fMain->SendCloseMessage();
// The same effect can be obtained by using a singleshot timer:
TTimer::SingleShot(150, "TestDialog", this, "CloseWindow()");
// Close the Ged editor if it was activated.
}
void TestDialog::DoCancel()
{
fFillHistos = kFALSE;
printf("\nTerminating dialog: Cancel pressed\n");
// Add protection against double-clicks
fCancelButton->SetState(kButtonDisabled);
TTimer::SingleShot(150, "TestDialog", this, "CloseWindow()");
// Close the Ged editor if it was activated.
}
void TestDialog::HandleButtons(Int_t id)
{
// Handle different buttons.
if (id == -1) {
id = btn->WidgetId();
}
printf("DoButton: id = %d\n", id);
char tmp[20];
static int newtab = 0;
switch (id) {
case 40: // start histogram filling
fFillHistos = kTRUE;
FillHistos();
break;
case 41: // stop histogram filling
fFillHistos = kFALSE;
break;
case 61: // show item 1 in the combo box
fCombo->Select(1);
break;
case 62: // show item 2 in the combo box
fCombo->Select(2);
break;
case 90: // add one entry in list box
fLastEntry++;
sprintf(tmp, "Entry %i", fLastEntry);
fListBox->AddEntry(tmp, fLastEntry);
fListBox->MapSubwindows();
fListBox->Layout();
break;
case 91: // remove one entry in list box
if (fFirstEntry <= fLastEntry) {
fListBox->RemoveEntry(fFirstEntry);
fListBox->Layout();
fFirstEntry++;
}
break;
case 101: // remove tabs
{
TString s = fTab->GetTabTab(0)->GetString();
if ((s == "Tab 3") && (fMain->MustCleanup() != kDeepCleanup)) {
// Need to delete the embedded canvases
// since RemoveTab() will Destroy the container
// window, which in turn will destroy the embedded
// canvas windows.
delete fEc1; fEc1 = nullptr;
delete fEc2; fEc2 = nullptr;
}
fTab->RemoveTab(0);
fTab->Layout();
}
break;
case 102: // remove tab 5
{
int nt = fTab->GetNumberOfTabs();
for (int i = 0 ; i < nt; i++) {
TString s = fTab->GetTabTab(i)->GetString();
if (s == "Tab 5") {
fTab->RemoveTab(i);
fTab->Layout();
break;
}
}
}
break;
case 103: // add tabs
sprintf(tmp, "New Tab %d", ++newtab);
fTab->AddTab(tmp);
fTab->MapSubwindows();
fTab->Layout();
break;
case 81:
break;
case 82:
break;
case 92:
fListBox->SetMultipleSelections(fCheckMulti->GetState());
break;
default:
break;
}
}
void TestDialog::DoTab(Int_t id)
{
printf("Tab item %d activated\n", id);
}
void TestDialog::HandleEmbeddedCanvas(Int_t event, Int_t x, Int_t y,
{
// Handle events in the left embedded canvas.
if (event == kButton3Down)
printf("event = %d, x = %d, y = %d, obj = %s::%s\n", event, x, y,
sel->IsA()->GetName(), sel->GetName());
}
TestMsgBox::TestMsgBox(const TGWindow *p, const TGWindow *main,
UInt_t w, UInt_t h, UInt_t options) :
fRedTextGC(TGButton::GetDefaultGC())
{
// Create message box test dialog. Use this dialog to select the different
// message dialog box styles and show the message dialog by clicking the
// "Test" button.
fMain = new TGTransientFrame(p, main, w, h, options);
fMain->Connect("CloseWindow()", "TestMsgBox", this, "CloseWindow()");
fMain->DontCallClose(); // to avoid double deletions.
// use hierarchical cleaning
fMain->SetCleanup(kDeepCleanup);
//------------------------------
// Set foreground color in graphics context for drawing of
// TGlabel and TGButtons with text in red.
Pixel_t red;
gClient->GetColorByName("red", red);
fRedTextGC.SetForeground(red);
//---------------------------------
int i;
fMain->ChangeOptions((fMain->GetOptions() & ~kVerticalFrame) | kHorizontalFrame);
f1 = new TGCompositeFrame(fMain, 60, 20, kVerticalFrame | kFixedWidth);
f2 = new TGCompositeFrame(fMain, 60, 20, kVerticalFrame);
f3 = new TGCompositeFrame(f2, 60, 20, kHorizontalFrame);
f4 = new TGCompositeFrame(f2, 60, 20, kHorizontalFrame);
f5 = new TGCompositeFrame(f2, 60, 20, kHorizontalFrame);
fTestButton = new TGTextButton(f1, "&Test", 1, fRedTextGC());
fTestButton->Connect("Clicked()", "TestMsgBox", this, "DoTest()");
// Change background of fTestButton to green
Pixel_t green;
gClient->GetColorByName("green", green);
fTestButton->ChangeBackground(green);
fCloseButton = new TGTextButton(f1, "&Close", 2);
fCloseButton->Connect("Clicked()", "TestMsgBox", this, "DoClose()");
fPictButton = new TGPictureButton(f1, gClient->GetPicture("mb_stop_s.xpm"));
f1->Resize(fTestButton->GetDefaultWidth()+40, fMain->GetDefaultHeight());
2, 2, 3, 0);
2, 5, 0, 2);
2, 5, 10, 0);
f1->AddFrame(fTestButton, fL1);
f1->AddFrame(fCloseButton, fL1);
f1->AddFrame(fPictButton, fL1);
fMain->AddFrame(f1, fL21);
//--------- create check and radio buttons groups
fG1 = new TGGroupFrame(f3, new TGString("Buttons"),kVerticalFrame|kRaisedFrame);
fG2 = new TGGroupFrame(f3, new TGString("Icons"),kVerticalFrame|kRaisedFrame);
2, 2, 2, 2);
0, 0, 5, 0);
fC[0] = new TGCheckButton(fG1, new TGHotString("Yes"), -1);
fC[1] = new TGCheckButton(fG1, new TGHotString("No"), -1);
fC[2] = new TGCheckButton(fG1, new TGHotString("OK"), -1);
fC[3] = new TGCheckButton(fG1, new TGHotString("Apply"), -1);
fC[4] = new TGCheckButton(fG1, new TGHotString("Retry"), -1);
fC[5] = new TGCheckButton(fG1, new TGHotString("Ignore"), -1);
fC[6] = new TGCheckButton(fG1, new TGHotString("Cancel"), -1);
fC[7] = new TGCheckButton(fG1, new TGHotString("Close"), -1);
fC[8] = new TGCheckButton(fG1, new TGHotString("Yes to All"), -1);
fC[9] = new TGCheckButton(fG1, new TGHotString("No to All"), -1);
fC[10] = new TGCheckButton(fG1, new TGHotString("Newer Only"), -1);
fC[11] = new TGCheckButton(fG1, new TGHotString("Append"), -1);
fC[12] = new TGCheckButton(fG1, new TGHotString("Dismiss"), -1);
for (i=0; i<13; ++i) fG1->AddFrame(fC[i], fL4);
fR[0] = new TGRadioButton(fG2, new TGHotString("Stop"), 21);
fR[1] = new TGRadioButton(fG2, new TGHotString("Question"), 22);
fR[2] = new TGRadioButton(fG2, new TGHotString("Exclamation"), 23);
fR[3] = new TGRadioButton(fG2, new TGHotString("Asterisk"), 24);
for (i = 0; i < 4; ++i) {
fG2->AddFrame(fR[i], fL4);
fR[i]->Connect("Clicked()", "TestMsgBox", this, "DoRadio()");
}
f3->AddFrame(fG1, fL3);
f3->AddFrame(fG2, fL3);
fLtitle = new TGLabel(f4, new TGString("Title:"), fRedTextGC());
fLmsg = new TGLabel(f5, new TGString("Message:"));
fTitle = new TGTextEntry(f4, fTbtitle = new TGTextBuffer(100));
fMsg = new TGTextEntry(f5, fTbmsg = new TGTextBuffer(100));
fTbtitle->AddText(0, "MsgBox");
fTbmsg->AddText(0, "This is a test message box.");
fTitle->Resize(300, fTitle->GetDefaultHeight());
fMsg->Resize(300, fMsg->GetDefaultHeight());
3, 5, 0, 0);
0, 2, 0, 0);
f4->AddFrame(fLtitle, fL5);
f4->AddFrame(fTitle, fL6);
f5->AddFrame(fLmsg, fL5);
f5->AddFrame(fMsg, fL6);
f2->AddFrame(f3, fL1);
f2->AddFrame(f4, fL1);
f2->AddFrame(f5, fL1);
fMain->AddFrame(f2, fL2);
fMain->MapSubwindows();
fMain->Resize();
// position relative to the parent's window
fMain->CenterOnParent();
fMain->SetWindowName("Message Box Test");
fMain->MapWindow();
gClient->WaitFor(fMain);
}
// Order is important when deleting frames. Delete children first,
// parents last.
TestMsgBox::~TestMsgBox()
{
// Delete widgets created by dialog.
fMain->DeleteWindow(); // deletes fMain
}
void TestMsgBox::CloseWindow()
{
// Close dialog in response to window manager close.
delete this;
}
void TestMsgBox::DoClose()
{
// Handle Close button.
CloseWindow();
}
void TestMsgBox::DoTest()
{
// Handle test button.
int i, buttons, retval;
buttons = 0;
for (i = 0; i < 13; i++)
if (fC[i]->GetState() == kButtonDown)
buttons |= mb_button_id[i];
for (i = 0; i < 4; i++)
if (fR[i]->GetState() == kButtonDown) {
icontype = mb_icon[i];
break;
}
// Since the message dialog box is created, we disable the
// signal/slot communication mechanism, in order to ensure we
// can't close the fMain window while the message box is open.
fMain->Disconnect("CloseWindow()");
fMain->Connect("CloseWindow()", "TestMsgBox", this, "TryToClose()");
new TGMsgBox(gClient->GetRoot(), fMain,
fTbtitle->GetString(), fTbmsg->GetString(),
icontype, buttons, &retval);
fMain->Disconnect("CloseWindow()");
fMain->Connect("CloseWindow()", "TestMsgBox", this, "CloseWindow()");
}
void TestMsgBox::TryToClose()
{
// The user try to close the main window,
// while a message dialog box is still open.
printf("Can't close the window '%s' : a message box is still open\n", fMain->GetWindowName());
}
void TestMsgBox::DoRadio()
{
// Handle radio buttons.
Int_t id = btn->WidgetId();
if (id >= 21 && id <= 24) {
for (int i = 0; i < 4; i++)
if (fR[i]->WidgetId() != id)
fR[i]->SetState(kButtonUp);
}
}
TestSliders::TestSliders(const TGWindow *p, const TGWindow *main,
{
// Dialog used to test the different supported sliders.
fMain = new TGTransientFrame(p, main, w, h);
fMain->Connect("CloseWindow()", "TestSliders", this, "CloseWindow()");
fMain->DontCallClose(); // to avoid double deletions.
// use hierarchical cleaning
fMain->SetCleanup(kDeepCleanup);
fMain->ChangeOptions((fMain->GetOptions() & ~kVerticalFrame) | kHorizontalFrame);
fVframe1 = new TGVerticalFrame(fMain, 0, 0, 0);
fTeh1 = new TGTextEntry(fVframe1, fTbh1 = new TGTextBuffer(10), HId1);
fTev1 = new TGTextEntry(fVframe1, fTbv1 = new TGTextBuffer(10), VId1);
fTbh1->AddText(0, "0");
fTbv1->AddText(0, "0");
fTeh1->Connect("TextChanged(char*)", "TestSliders", this, "DoText(char*)");
fTev1->Connect("TextChanged(char*)", "TestSliders", this, "DoText(char*)");
fHslider1 = new TGHSlider(fVframe1, 100, kSlider1 | kScaleBoth, HSId1);
fHslider1->Connect("PositionChanged(Int_t)", "TestSliders", this, "DoSlider(Int_t)");
fHslider1->SetRange(0,50);
fVslider1 = new TGVSlider(fVframe1, 100, kSlider2 | kScaleBoth, VSId1);
fVslider1->Connect("PositionChanged(Int_t)", "TestSliders", this, "DoSlider(Int_t)");
fVslider1->SetRange(0,8);
fVframe1->Resize(100, 100);
fVframe2 = new TGVerticalFrame(fMain, 0, 0, 0);
fTeh2 = new TGTextEntry(fVframe2, fTbh2 = new TGTextBuffer(10), HId2);
fTev2 = new TGTextEntry(fVframe2, fTbv2 = new TGTextBuffer(10), VId2);
fTbh2->AddText(0, "0");
fTbv2->AddText(0, "0");
fTeh2->Connect("TextChanged(char*)", "TestSliders", this, "DoText(char*)");
fTev2->Connect("TextChanged(char*)", "TestSliders", this, "DoText(char*)");
fHslider2 = new TGHSlider(fVframe2, 150, kSlider2 | kScaleBoth, HSId2);
fHslider2->Connect("PositionChanged(Int_t)", "TestSliders", this, "DoSlider(Int_t)");
fHslider2->SetRange(0,3);
fVslider2 = new TGDoubleVSlider(fVframe2, 100, kDoubleScaleBoth, VSId2);
fVslider2->SetRange(-10,10);
fVslider2->Connect("PositionChanged()", "TestSliders", this, "DoSlider()");
fVframe2->Resize(100, 100);
//--- layout for buttons: top align, equally expand horizontally
fBly = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 0, 0, 3, 0);
//--- layout for the frame: place at bottom, right aligned
fBfly1 = new TGLayoutHints(kLHintsTop | kLHintsRight, 20, 10, 15, 0);
fVframe1->AddFrame(fHslider1, fBly);
fVframe1->AddFrame(fVslider1, fBly);
fVframe1->AddFrame(fTeh1, fBly);
fVframe1->AddFrame(fTev1, fBly);
fVframe2->AddFrame(fHslider2, fBly);
fVframe2->AddFrame(fVslider2, fBly);
fVframe2->AddFrame(fTeh2, fBly);
fVframe2->AddFrame(fTev2, fBly);
fMain->AddFrame(fVframe2, fBfly1);
fMain->AddFrame(fVframe1, fBfly1);
fMain->SetWindowName("Slider Test");
TGDimension size = fMain->GetDefaultSize();
fMain->Resize(size);
fMain->SetWMSize(size.fWidth, size.fHeight);
fMain->SetWMSizeHints(size.fWidth, size.fHeight, size.fWidth, size.fHeight, 0, 0);
// position relative to the parent's window
fMain->CenterOnParent();
fMain->MapSubwindows();
fMain->MapWindow();
gClient->WaitFor(fMain);
}
TestSliders::~TestSliders()
{
// Delete dialog.
fMain->DeleteWindow(); // deletes fMain
}
void TestSliders::CloseWindow()
{
// Called when window is closed via the window manager.
delete this;
}
void TestSliders::DoText(const char * /*text*/)
{
// Handle text entry widgets.
Int_t id = te->WidgetId();
switch (id) {
case HId1:
fHslider1->SetPosition(atoi(fTbh1->GetString()));
break;
case VId1:
fVslider1->SetPosition(atoi(fTbv1->GetString()));
break;
case HId2:
fHslider2->SetPosition(atoi(fTbh2->GetString()));
break;
case VId2:
fVslider2->SetPosition(atoi(fTbv2->GetString()),
atoi(fTbv2->GetString())+2);
break;
default:
break;
}
}
void TestSliders::DoSlider(Int_t pos)
{
// Handle slider widgets.
if (frm->IsA()->InheritsFrom(TGSlider::Class())) {
TGSlider *sl = (TGSlider*) frm;
id = sl->WidgetId();
} else {
id = sd->WidgetId();
}
char buf[32];
sprintf(buf, "%d", pos);
#ifdef CINT_FIXED
switch (id) {
case HSId1:
#else
if (id == HSId1) {
#endif
fTbh1->Clear();
fTbh1->AddText(0, buf);
// Re-align the cursor with the characters.
fTeh1->Deselect();
gClient->NeedRedraw(fTeh1);
#ifdef CINT_FIXED
break;
case VSId1:
#else
}
else if (id == VSId1) {
#endif
fTbv1->Clear();
fTbv1->AddText(0, buf);
fTev1->Deselect();
gClient->NeedRedraw(fTev1);
#ifdef CINT_FIXED
break;
case HSId2:
#else
}
else if (id == HSId2) {
#endif
fTbh2->Clear();
fTbh2->AddText(0, buf);
fTeh2->Deselect();
gClient->NeedRedraw(fTeh2);
#ifdef CINT_FIXED
break;
case VSId2:
#else
}
else if (id == VSId2) {
#endif
sprintf(buf, "%f", fVslider2->GetMinPosition());
fTbv2->Clear();
fTbv2->AddText(0, buf);
fTev2->Deselect();
gClient->NeedRedraw(fTev2);
#ifdef CINT_FIXED
break;
default:
break;
#endif
}
}
TestShutter::TestShutter(const TGWindow *p, const TGWindow *main,
{
// Create transient frame containing a shutter widget.
fMain = new TGTransientFrame(p, main, w, h);
fMain->Connect("CloseWindow()", "TestShutter", this, "CloseWindow()");
fMain->DontCallClose(); // to avoid double deletions.
// use hierarchical cleaning
fMain->SetCleanup(kDeepCleanup);
fDefaultPic = gClient->GetPicture("folder_s.xpm");
fShutter = new TGShutter(fMain, kSunkenFrame);
AddShutterItem("Histograms", histo_data);
AddShutterItem("Functions", function_data);
AddShutterItem("Trees", tree_data);
fMain->AddFrame(fShutter, fLayout);
fMain->MapSubwindows();
fMain->Resize(80, 300);
// position relative to the parent's window
fMain->CenterOnParent();
fMain->SetWindowName("Shutter Test");
fMain->MapWindow();
//gClient->WaitFor(fMain);
}
void TestShutter::AddShutterItem(const char *name, shutterData_t *data)
{
TGCompositeFrame *container;
const TGPicture *buttonpic;
static int id = 5001;
5, 5, 5, 0);
item = new TGShutterItem(fShutter, new TGHotString(name), id++);
container = (TGCompositeFrame *) item->GetContainer();
for (int i=0; data[i].pixmap_name != nullptr; i++) {
buttonpic = gClient->GetPicture(data[i].pixmap_name);
if (!buttonpic) {
printf("<TestShutter::AddShutterItem>: missing pixmap \"%s\", using default",
data[i].pixmap_name);
buttonpic = fDefaultPic;
}
button = new TGPictureButton(container, buttonpic, data[i].id);
container->AddFrame(button, l);
button->Connect("Clicked()", "TestShutter", this, "HandleButtons()");
button->SetToolTipText(data[i].tip_text);
data[i].button = button;
}
fShutter->AddItem(item);
}
TestShutter::~TestShutter()
{
// dtor
gClient->FreePicture(fDefaultPic);
fMain->DeleteWindow(); // deletes fMain
}
void TestShutter::CloseWindow()
{
delete this;
}
void TestShutter::HandleButtons()
{
printf("Shutter button %d\n", btn->WidgetId());
}
TestDirList::TestDirList(const TGWindow *p, const TGWindow *main,
{
// Create transient frame containing a dirlist widget.
fMain = new TGTransientFrame(p, main, w, h);
fMain->Connect("CloseWindow()", "TestDirList", this, "CloseWindow()");
fMain->DontCallClose(); // to avoid double deletions.
fIcon = gClient->GetPicture("rootdb_t.xpm");
// use hierarchical cleaning
fMain->SetCleanup(kDeepCleanup);
TGCanvas* canvas = new TGCanvas(fMain, 500, 300);
fContents = new TGListTree(canvas, kHorizontalFrame);
fMain->AddFrame(canvas,lo);
fContents->Connect("DoubleClicked(TGListTreeItem*,Int_t)","TestDirList",this,
"OnDoubleClick(TGListTreeItem*,Int_t)");
fContents->Connect("Clicked(TGListTreeItem*,Int_t)","TestDirList",this,
"OnDoubleClick(TGListTreeItem*,Int_t)");
#ifdef R__WIN32
fContents->AddItem(0,"c:\\"); // browse the upper directory
#else
fContents->AddItem(nullptr,"/"); // browse the upper directory
#endif
// position relative to the parent's window
fMain->CenterOnParent();
fMain->SetWindowName("List Dir Test");
fMain->MapSubwindows();
fMain->Resize();
fMain->MapWindow();
}
TestDirList::~TestDirList()
{
// Cleanup.
gClient->FreePicture(fIcon);
delete fContents;
fMain->DeleteWindow(); // delete fMain
}
void TestDirList::CloseWindow()
{
delete this;
}
TString TestDirList::DirName(TGListTreeItem* item)
{
// Returns an absolute path.
TGListTreeItem* parent;
TString dirname = item->GetText();
while ((parent = item->GetParent())) {
gSystem->PrependPathName(parent->GetText(),dirname);
item = parent;
}
return dirname;
}
void TestDirList::OnDoubleClick(TGListTreeItem* item, Int_t btn)
{
// Show contents of directory.
if ((btn!=kButton1) || !item || (Bool_t)item->GetUserData()) return;
// use UserData to indicate that item was already browsed
item->SetUserData((void*)1);
TSystemDirectory dir(item->GetText(),DirName(item));
TList *files = dir.GetListOfFiles();
if (files) {
TIter next(files);
TSystemFile *file;
TString fname;
while ((file=(TSystemFile*)next())) {
fname = file->GetName();
if (file->IsDirectory()) {
if ((fname!="..") && (fname!=".")) { // skip it
fContents->AddItem(item,fname);
}
} else if (fname.EndsWith(".root")) { // add root files
fContents->AddItem(item,fname,fIcon,fIcon);
}
}
delete files;
}
}
TestFileList::TestFileList(const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h)
{
// Create transient frame containing a filelist widget.
fMain = new TGTransientFrame(p, main, w, h);
fMain->Connect("CloseWindow()", "TestDirList", this, "CloseWindow()");
fMain->DontCallClose(); // to avoid double deletions.
// use hierarchical cleaning
fMain->SetCleanup(kDeepCleanup);
TGMenuBar* mb = new TGMenuBar(fMain);
fMain->AddFrame(mb, lo);
fMenu = mb->AddPopup("&View");
fMenu->AddEntry("Lar&ge Icons",kLVLargeIcons);
fMenu->AddEntry("S&mall Icons",kLVSmallIcons);
fMenu->AddEntry("&List", kLVList);
fMenu->AddEntry("&Details", kLVDetails);
fMenu->AddSeparator();
fMenu->AddEntry("&Close", 10);
fMenu->Connect("Activated(Int_t)","TestFileList",this,"DoMenu(Int_t)");
TGListView* lv = new TGListView(fMain, w, h);
fMain->AddFrame(lv,lo);
Pixel_t white;
gClient->GetColorByName("white", white);
fContents = new TGFileContainer(lv, kSunkenFrame,white);
fContents->Connect("DoubleClicked(TGFrame*,Int_t)", "TestFileList", this,
"OnDoubleClick(TGLVEntry*,Int_t)");
// position relative to the parent's window
fMain->CenterOnParent();
fMain->SetWindowName("File List Test");
fMain->MapSubwindows();
fMain->MapWindow();
fContents->SetDefaultHeaders();
fContents->DisplayDirectory();
fContents->AddFile(".."); // up level directory
fContents->Resize();
fContents->StopRefreshTimer(); // stop refreshing
fMain->Resize();
}
TestFileList::~TestFileList()
{
// Cleanup.
delete fContents;
fMain->DeleteWindow(); // deletes fMain
}
void TestFileList::DoMenu(Int_t mode)
{
// Switch view mode.
if (mode<10) {
fContents->SetViewMode((EListViewMode)mode);
} else {
delete this;
}
}
void TestFileList::DisplayFile(const TString &fname)
{
// Display content of ROOT file.
TFile file(fname);
fContents->RemoveAll();
fContents->AddFile(gSystem->WorkingDirectory());
fContents->SetPagePosition(0,0);
fContents->SetColHeaders("Name","Title");
TIter next(file.GetListOfKeys());
TKey *key;
while ((key=(TKey*)next())) {
TString name = key->GetName();
TGLVEntry *entry = new TGLVEntry(fContents,name,cname);
entry->SetSubnames(key->GetTitle());
fContents->AddItem(entry);
// user data is a filename
entry->SetUserData((void*)StrDup(fname));
}
fMain->Resize();
}
void TestFileList::DisplayDirectory(const TString &fname)
{
// Display content of directory.
fContents->SetDefaultHeaders();
fContents->ChangeDirectory(fname);
fContents->DisplayDirectory();
fContents->AddFile(".."); // up level directory
fMain->Resize();
}
void TestFileList::DisplayObject(const TString& fname,const TString& name)
{
// Browse object located in file.
static TFile *file = nullptr;
if (file) delete file; // close
file = new TFile(fname); // reopen
TObject* obj = file->Get(name);
if (obj) {
if (!obj->IsFolder()) {
obj->Browse(nullptr);
} else obj->Print();
}
gDirectory = sav;
}
void TestFileList::OnDoubleClick(TGLVEntry *f, Int_t btn)
{
// Handle double click.
if (btn != kButton1) return;
// set kWatch cursor
ULong_t cur = gVirtualX->CreateCursor(kWatch);
gVirtualX->SetCursor(fContents->GetId(), cur);
TString name(f->GetTitle());
const char* fname = (const char*)f->GetUserData();
if (fname) {
DisplayObject(fname, name);
} else if (name.EndsWith(".root")) {
DisplayFile(name);
} else {
DisplayDirectory(name);
}
// set kPointer cursor
cur = gVirtualX->CreateCursor(kPointer);
gVirtualX->SetCursor(fContents->GetId(), cur);
}
void TestFileList::CloseWindow()
{
delete this;
}
TestProgress::TestProgress(const TGWindow *p, const TGWindow *main,
{
// Dialog used to test the different supported progress bars.
fClose = kTRUE;
fMain = new TGTransientFrame(p, main, w, h);
fMain->Connect("CloseWindow()", "TestProgress", this, "DoClose()");
fMain->DontCallClose();
// use hierarchical cleaning
fMain->SetCleanup(kDeepCleanup);
fMain->ChangeOptions((fMain->GetOptions() & ~kVerticalFrame) | kHorizontalFrame);
fHframe1 = new TGHorizontalFrame(fMain, 0, 0, 0);
fVProg1 = new TGVProgressBar(fHframe1, TGProgressBar::kFancy, 300);
fVProg1->SetBarColor("purple");
fVProg2 = new TGVProgressBar(fHframe1, TGProgressBar::kFancy, 300);
fVProg2->SetFillType(TGProgressBar::kBlockFill);
fVProg2->SetBarColor("green");
fHframe1->Resize(300, 300);
fVframe1 = new TGVerticalFrame(fMain, 0, 0, 0);
fHProg1 = new TGHProgressBar(fVframe1, 300);
fHProg1->ShowPosition();
fHProg2 = new TGHProgressBar(fVframe1, TGProgressBar::kFancy, 300);
fHProg2->SetBarColor("lightblue");
fHProg2->ShowPosition(kTRUE, kFALSE, "%.0f events");
fHProg3 = new TGHProgressBar(fVframe1, TGProgressBar::kStandard, 300);
fHProg3->SetFillType(TGProgressBar::kBlockFill);
fGO = new TGTextButton(fVframe1, "Go", 10);
fGO->Connect("Clicked()", "TestProgress", this, "DoGo()");
fVframe1->Resize(300, 300);
fHint1 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY, 5, 10, 5, 5);
fHint2 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 5, 5, 5, 10);
fHint3 = new TGLayoutHints(kLHintsTop | kLHintsRight, 0, 50, 50, 0);
fHint4 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandY, 0, 0, 0, 0);
fHint5 = new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX, 0, 0, 0, 0);
fHframe1->AddFrame(fVProg1, fHint1);
fHframe1->AddFrame(fVProg2, fHint1);
fVframe1->AddFrame(fHProg1, fHint2);
fVframe1->AddFrame(fHProg2, fHint2);
fVframe1->AddFrame(fHProg3, fHint2);
fVframe1->AddFrame(fGO, fHint3);
fMain->AddFrame(fHframe1, fHint4);
fMain->AddFrame(fVframe1, fHint5);
fMain->SetWindowName("Progress Test");
TGDimension size = fMain->GetDefaultSize();
fMain->Resize(size);
// position relative to the parent's window
fMain->CenterOnParent();
fMain->MapSubwindows();
fMain->MapWindow();
gClient->WaitFor(fMain);
}
TestProgress::~TestProgress()
{
// Delete dialog.
fMain->DeleteWindow(); // deletes fMain
}
void TestProgress::CloseWindow()
{
// Called when window is closed via the window manager.
delete this;
}
void TestProgress::DoClose()
{
// If fClose is false we are still in event processing loop in DoGo().
// In that case, set the close flag true and use a timer to call
// CloseWindow(). This gives us change to get out of the DoGo() loop.
// Note: calling SendCloseMessage() will not work since that will
// bring us back here (CloseWindow() signal is connected to this method)
// with the fClose flag true, which will cause window deletion while
// still being in the event processing loop (since SendCloseMessage()
// is directly processed in ProcessEvents() without exiting DoGo()).
if (fClose)
CloseWindow();
else {
fClose = kTRUE;
TTimer::SingleShot(150, "TestProgress", this, "CloseWindow()");
}
}
void TestProgress::DoGo()
{
// Handle Go button.
fClose = kFALSE;
fVProg1->Reset(); fVProg2->Reset();
fHProg1->Reset(); fHProg2->Reset(); fHProg3->Reset();
fVProg2->SetBarColor("green");
int cnt1 = 0, cnt2 = 0, cnt3 = 0, cnt4 = 0;
int inc1 = 4, inc2 = 3, inc3 = 2, inc4 = 1;
while (cnt1 < 100 || cnt2 < 100 || cnt3 < 100 || cnt4 <100) {
if (cnt1 < 100) {
cnt1 += inc1;
fVProg1->Increment(inc1);
}
if (cnt2 < 100) {
cnt2 += inc2;
fVProg2->Increment(inc2);
if (cnt2 > 75)
fVProg2->SetBarColor("red");
}
if (cnt3 < 100) {
cnt3 += inc3;
fHProg1->Increment(inc3);
}
if (cnt4 < 100) {
cnt4 += inc4;
fHProg2->Increment(inc4);
fHProg3->Increment(inc4);
}
gSystem->Sleep(100);
// if user closed window return
if (fClose) return;
}
fClose = kTRUE;
}
// TGNumberEntry widget test dialog
//const char *const EntryTestDlg::numlabel[] = {
const char *numlabel[] = {
"Integer",
"One digit real",
"Two digit real",
"Three digit real",
"Four digit real",
"Real",
"Degree.min.sec",
"Min:sec",
"Hour:min",
"Hour:min:sec",
"Day/month/year",
"Month/day/year",
"Hex"
};
//const Double_t EntryTestDlg::numinit[] = {
const Double_t numinit[] = {
12345, 1.0, 1.00, 1.000, 1.0000, 1.2E-12,
90 * 3600, 120 * 60, 12 * 60, 12 * 3600 + 15 * 60,
19991121, 19991121, (Double_t) 0xDEADFACEU
};
EntryTestDlg::EntryTestDlg(const TGWindow *p, const TGWindow *main)
{
// build widgets
fMain = new TGTransientFrame(p, main, 10, 10, kHorizontalFrame);
fMain->Connect("CloseWindow()", "EntryTestDlg", this, "CloseWindow()");
fMain->DontCallClose(); // to avoid double deletions.
// use hierarchical cleaning
fMain->SetCleanup(kDeepCleanup);
TGGC myGC = *gClient->GetResourcePool()->GetFrameGC();
TGFont *myfont = gClient->GetFont("-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
if (myfont) myGC.SetFont(myfont->GetFontHandle());
fF1 = new TGVerticalFrame(fMain, 200, 300);
fL1 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2);
fMain->AddFrame(fF1, fL1);
fL2 = new TGLayoutHints(kLHintsCenterY | kLHintsLeft, 2, 2, 2, 2);
for (int i = 0; i < 13; i++) {
fF[i] = new TGHorizontalFrame(fF1, 200, 30);
fF1->AddFrame(fF[i], fL2);
fNumericEntries[i] = new TGNumberEntry(fF[i], numinit[i], 12, i + 20,
fF[i]->AddFrame(fNumericEntries[i], fL2);
fLabel[i] = new TGLabel(fF[i], numlabel[i], myGC(), myfont->GetFontStruct());
fF[i]->AddFrame(fLabel[i], fL2);
}
fF2 = new TGVerticalFrame(fMain, 200, 500);
fL3 = new TGLayoutHints(kLHintsTop | kLHintsLeft, 2, 2, 2, 2);
fMain->AddFrame(fF2, fL3);
fLowerLimit = new TGCheckButton(fF2, "lower limit:", 4);
fF2->AddFrame(fLowerLimit, fL3);
fLimits[0] = new TGNumberEntry(fF2, 0, 12, 10);
fLimits[0]->SetLogStep(kFALSE);
fF2->AddFrame(fLimits[0], fL3);
fUpperLimit = new TGCheckButton(fF2, "upper limit:", 5);
fF2->AddFrame(fUpperLimit, fL3);
fLimits[1] = new TGNumberEntry(fF2, 0, 12, 11);
fLimits[1]->SetLogStep(kFALSE);
fF2->AddFrame(fLimits[1], fL3);
fPositive = new TGCheckButton(fF2, "Positive", 6);
fF2->AddFrame(fPositive, fL3);
fNonNegative = new TGCheckButton(fF2, "Non negative", 7);
fF2->AddFrame(fNonNegative, fL3);
fSetButton = new TGTextButton(fF2, " Set ", 2);
fSetButton->Connect("Clicked()", "EntryTestDlg", this, "SetLimits()");
fF2->AddFrame(fSetButton, fL3);
fExitButton = new TGTextButton(fF2, " Close ", 1);
fExitButton->Connect("Clicked()", "EntryTestDlg", this, "DoOK()");
fF2->AddFrame(fExitButton, fL3);
// set dialog box title
fMain->SetWindowName("Number Entry Test");
fMain->SetIconName("Number Entry Test");
fMain->SetClassHints("NumberEntryDlg", "NumberEntryDlg");
// resize & move to center
fMain->MapSubwindows();
UInt_t width = fMain->GetDefaultWidth();
UInt_t height = fMain->GetDefaultHeight();
fMain->Resize(width, height);
fMain->CenterOnParent();
// make the message box non-resizable
fMain->SetWMSize(width, height);
fMain->SetWMSizeHints(width, height, width, height, 0, 0);
fMain->MapWindow();
gClient->WaitFor(fMain);
}
EntryTestDlg::~EntryTestDlg()
{
// dtor
fMain->DeleteWindow();
}
void EntryTestDlg::CloseWindow()
{
delete this;
}
void EntryTestDlg::DoOK()
{
// Handle ok button.
fMain->SendCloseMessage();
}
void EntryTestDlg::SetLimits()
{
Double_t min = fLimits[0]->GetNumber();
Bool_t low = (fLowerLimit->GetState() == kButtonDown);
Double_t max = fLimits[1]->GetNumber();
Bool_t high = (fUpperLimit->GetState() == kButtonDown);
if (low && high) {
} else if (low) {
} else if (high) {
} else {
}
Bool_t pos = (fPositive->GetState() == kButtonDown);
Bool_t nneg = (fNonNegative->GetState() == kButtonDown);
if (pos) {
} else if (nneg) {
} else {
}
for (int i = 0; i < 13; i++) {
fNumericEntries[i]->SetFormat(fNumericEntries[i]->GetNumStyle(), attr);
fNumericEntries[i]->SetLimits(lim, min, max);
}
}
Editor::Editor(const TGWindow *main, UInt_t w, UInt_t h)
{
// Create an editor in a dialog.
fMain = new TGTransientFrame(gClient->GetRoot(), main, w, h);
fMain->Connect("CloseWindow()", "Editor", this, "CloseWindow()");
fMain->DontCallClose(); // to avoid double deletions.
// use hierarchical cleaning
fMain->SetCleanup(kDeepCleanup);
fEdit = new TGTextEdit(fMain, w, h, kSunkenFrame | kDoubleBorder);
fL1 = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 3, 3, 3, 3);
fMain->AddFrame(fEdit, fL1);
fEdit->Connect("Opened()", "Editor", this, "DoOpen()");
fEdit->Connect("Saved()", "Editor", this, "DoSave()");
fEdit->Connect("Closed()", "Editor", this, "DoClose()");
// set selected text colors
Pixel_t pxl;
gClient->GetColorByName("#3399ff", pxl);
fEdit->SetSelectBack(pxl);
fEdit->SetSelectFore(TGFrame::GetWhitePixel());
fOK = new TGTextButton(fMain, " &OK ");
fOK->Connect("Clicked()", "Editor", this, "DoOK()");
fL2 = new TGLayoutHints(kLHintsBottom | kLHintsCenterX, 0, 0, 5, 5);
fMain->AddFrame(fOK, fL2);
SetTitle();
fMain->MapSubwindows();
fMain->Resize();
// editor covers right half of parent window
fMain->CenterOnParent(kTRUE, TGTransientFrame::kRight);
}
Editor::~Editor()
{
// Delete editor dialog.
fMain->DeleteWindow(); // deletes fMain
}
void Editor::SetTitle()
{
// Set title in editor window.
TGText *txt = GetEditor()->GetText();
Bool_t untitled = !strlen(txt->GetFileName()) ? kTRUE : kFALSE;
char title[256];
if (untitled)
sprintf(title, "ROOT Editor - Untitled");
else
sprintf(title, "ROOT Editor - %s", txt->GetFileName());
fMain->SetWindowName(title);
fMain->SetIconName(title);
}
void Editor::Popup()
{
// Show editor.
fMain->MapWindow();
}
void Editor::LoadBuffer(const char *buffer)
{
// Load a text buffer in the editor.
fEdit->LoadBuffer(buffer);
}
void Editor::LoadFile(const char *file)
{
// Load a file in the editor.
fEdit->LoadFile(file);
}
void Editor::AddBuffer(const char *buffer)
{
// Add text to the editor.
TGText txt;
txt.LoadBuffer(buffer);
fEdit->AddText(&txt);
}
void Editor::CloseWindow()
{
// Called when closed via window manager action.
delete this;
}
void Editor::DoOK()
{
// Handle ok button.
CloseWindow();
}
void Editor::DoOpen()
{
SetTitle();
}
void Editor::DoSave()
{
SetTitle();
}
void Editor::DoClose()
{
// Handle close button.
CloseWindow();
}
void guitest()
{
new TestMainFrame(gClient->GetRoot(), 400, 220);
}
//---- Main program ------------------------------------------------------------
#ifdef STANDALONE
int main(int argc, char **argv)
{
TApplication theApp("App", &argc, argv);
if (gROOT->IsBatch()) {
fprintf(stderr, "%s: cannot run in batch mode\n", argv[0]);
return 1;
}
guitest();
theApp.Run();
return 0;
}
#endif
@ kButton3Down
Definition Buttons.h:17
@ kButtonRelease
Definition GuiTypes.h:60
@ kButtonPress
Definition GuiTypes.h:60
@ kWatch
Definition GuiTypes.h:375
@ kPointer
Definition GuiTypes.h:375
const Mask_t kButtonPressMask
Definition GuiTypes.h:161
const Mask_t kAnyModifier
Definition GuiTypes.h:210
const Mask_t kPointerMotionMask
Definition GuiTypes.h:163
@ kRaisedFrame
Definition GuiTypes.h:384
@ kSunkenFrame
Definition GuiTypes.h:383
@ kVerticalFrame
Definition GuiTypes.h:381
@ kDoubleBorder
Definition GuiTypes.h:385
@ kFixedWidth
Definition GuiTypes.h:387
@ kHorizontalFrame
Definition GuiTypes.h:382
const Handle_t kNone
Definition GuiTypes.h:88
const Mask_t kButtonReleaseMask
Definition GuiTypes.h:162
ULong_t Pixel_t
Pixel value.
Definition GuiTypes.h:40
@ kButton4
Definition GuiTypes.h:215
@ kButton5
Definition GuiTypes.h:215
@ kButton1
Definition GuiTypes.h:214
@ kAnyButton
Definition GuiTypes.h:214
int main()
Definition Prototype.cxx:12
#define RQ_OBJECT(sender_class)
Definition RQ_OBJECT.h:87
#define f(i)
Definition RSha256.hxx:104
#define h(i)
Definition RSha256.hxx:106
#define e(i)
Definition RSha256.hxx:103
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
unsigned long ULong_t
Definition RtypesCore.h:55
unsigned int UInt_t
Definition RtypesCore.h:46
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
@ kRed
Definition Rtypes.h:66
R__EXTERN TApplication * gApplication
#define gDirectory
Definition TDirectory.h:384
@ kButtonDown
Definition TGButton.h:54
@ kButtonDisabled
Definition TGButton.h:56
@ kButtonUp
Definition TGButton.h:53
#define gClient
Definition TGClient.h:156
@ kDoubleScaleBoth
@ kFDOpen
@ kMWMDecorResizeH
Definition TGFrame.h:65
@ kMWMFuncAll
Definition TGFrame.h:49
@ kMWMFuncResize
Definition TGFrame.h:50
@ kMWMDecorMaximize
Definition TGFrame.h:69
@ kMWMDecorMinimize
Definition TGFrame.h:68
@ kMWMDecorMenu
Definition TGFrame.h:67
@ kMWMDecorAll
Definition TGFrame.h:63
@ kMWMFuncMaximize
Definition TGFrame.h:53
@ kMWMInputModeless
Definition TGFrame.h:57
@ kMWMFuncMinimize
Definition TGFrame.h:52
@ kDeepCleanup
Definition TGFrame.h:42
@ kLHintsRight
Definition TGLayout.h:26
@ kLHintsExpandY
Definition TGLayout.h:31
@ kLHintsLeft
Definition TGLayout.h:24
@ kLHintsCenterY
Definition TGLayout.h:28
@ kLHintsCenterX
Definition TGLayout.h:25
@ kLHintsBottom
Definition TGLayout.h:29
@ kLHintsTop
Definition TGLayout.h:27
@ kLHintsExpandX
Definition TGLayout.h:30
EListViewMode
Definition TGListView.h:21
@ kLVDetails
Definition TGListView.h:25
@ kLVSmallIcons
Definition TGListView.h:23
@ kLVList
Definition TGListView.h:24
@ kLVLargeIcons
Definition TGListView.h:22
@ kMBNo
Definition TGMsgBox.h:32
@ kMBIgnore
Definition TGMsgBox.h:36
@ kMBApply
Definition TGMsgBox.h:34
@ kMBNoAll
Definition TGMsgBox.h:41
@ kMBClose
Definition TGMsgBox.h:38
@ kMBYes
Definition TGMsgBox.h:31
@ kMBAppend
Definition TGMsgBox.h:42
@ kMBRetry
Definition TGMsgBox.h:35
@ kMBCancel
Definition TGMsgBox.h:37
@ kMBOk
Definition TGMsgBox.h:33
@ kMBYesAll
Definition TGMsgBox.h:40
@ kMBNewer
Definition TGMsgBox.h:43
@ kMBDismiss
Definition TGMsgBox.h:39
EMsgBoxIcon
Definition TGMsgBox.h:21
@ kMBIconExclamation
Definition TGMsgBox.h:24
@ kMBIconAsterisk
Definition TGMsgBox.h:25
@ kMBIconStop
Definition TGMsgBox.h:22
@ kMBIconQuestion
Definition TGMsgBox.h:23
@ kScaleBoth
Definition TGSlider.h:36
@ kSlider2
Definition TGSlider.h:31
@ kSlider1
Definition TGSlider.h:30
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h prop
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char cname
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t attr
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t width
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t button
Option_t Option_t TPoint TPoint const char text
char name[80]
Definition TGX11.cxx:110
@ kNoContextMenu
Definition TObject.h:375
R__EXTERN void * gTQSender
Definition TQObject.h:46
#define gROOT
Definition TROOT.h:406
R__EXTERN TRandom * gRandom
Definition TRandom.h:62
char * StrDup(const char *str)
Duplicate the string str.
Definition TString.cxx:2557
R__EXTERN TSystem * gSystem
Definition TSystem.h:555
#define gVirtualX
Definition TVirtualX.h:337
This class creates the ROOT Application Environment that interfaces to the windowing system eventloop...
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
Definition TAttFill.h:37
The Canvas class.
Definition TCanvas.h:23
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
Definition TClass.cxx:4874
static ULong_t RGB2Pixel(Int_t r, Int_t g, Int_t b)
Convert r,g,b to graphics system dependent pixel value.
Definition TColor.cxx:2294
TObject * Get(const char *namecycle) override
Return pointer to object identified by namecycle.
Describe directory structure in memory.
Definition TDirectory.h:45
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
Definition TFile.h:53
A button abstract base class.
Definition TGButton.h:68
virtual void SetToolTipText(const char *text, Long_t delayms=400)
Set tool tip text associated with this button.
Definition TGButton.cxx:445
virtual EButtonState GetState() const
Definition TGButton.h:112
virtual void SetState(EButtonState state, Bool_t emit=kFALSE)
Set button state.
Definition TGButton.cxx:235
A frame containing two scrollbars (a horizontal and a vertical) and a viewport.
Definition TGCanvas.h:192
Selects different options.
Definition TGButton.h:264
void SetState(EButtonState state, Bool_t emit=kFALSE) override
Set check button state.
Like a checkbutton but instead of the check mark there is color area with a little down arrow.
A combobox (also known as a drop down listbox) allows the selection of one item out of a list of item...
Definition TGComboBox.h:47
virtual void AddEntry(TGString *s, Int_t id)
Definition TGComboBox.h:86
virtual void Select(Int_t id, Bool_t emit=kTRUE)
Make the selected item visible in the combo box window and emit signals according to the second param...
The base class for composite widgets (menu bars, list boxes, etc.).
Definition TGFrame.h:287
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
Definition TGFrame.cxx:1000
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=nullptr)
Add frame to the composite frame using the specified layout hints.
Definition TGFrame.cxx:1117
void MapSubwindows() override
Map all sub windows that are part of the composite frame.
Definition TGFrame.cxx:1164
void Layout() override
Layout the elements of the composite frame.
Definition TGFrame.cxx:1257
void RemoveAll() override
Remove all items from the container.
Definition TGCanvas.cxx:641
virtual void SetPagePosition(const TGPosition &pos)
Set page position.
Definition TGCanvas.cxx:764
A frame with handles that allow it to be undocked (i.e.
DoubleSlider widgets allow easy selection of a min and a max value out of a range.
virtual Float_t GetMinPosition() const
virtual void SetRange(Float_t min, Float_t max)
virtual void SetPosition(Float_t min, Float_t max)
Dragging the slider will generate the event:
This class creates a file selection dialog.
char * fFilename
selected file name
const char ** fFileTypes
file types used to filter selectable files
char * fIniDir
on input: initial directory, on output: new directory
void SetIniDir(const char *inidir)
Set directory name.
Font selection dialog, allowing to select one in the list of available fonts in the system.
Encapsulate fonts used in the GUI system.
Definition TGFont.h:140
FontStruct_t GetFontStruct() const
Definition TGFont.h:184
FontH_t GetFontHandle() const
Definition TGFont.h:183
A subclasses of TGWindow, and is used as base class for some simple widgets (buttons,...
Definition TGFrame.h:80
void Resize(UInt_t w=0, UInt_t h=0) override
Resize the frame.
Definition TGFrame.cxx:605
static Pixel_t GetWhitePixel()
Get white pixel value.
Definition TGFrame.cxx:709
virtual UInt_t GetDefaultWidth() const
Definition TGFrame.h:190
virtual UInt_t GetDefaultHeight() const
Definition TGFrame.h:191
TClass * IsA() const override
Definition TGFrame.h:283
virtual void DeleteWindow()
Delete window.
Definition TGFrame.cxx:276
virtual void ChangeBackground(Pixel_t back)
Change frame background color.
Definition TGFrame.cxx:293
Encapsulate a graphics context used in the low level graphics.
Definition TGGC.h:22
void SetFont(FontH_t v)
Set font.
Definition TGGC.cxx:411
void SetForeground(Pixel_t v)
Set foreground color.
Definition TGGC.cxx:278
A composite frame with a border and a title.
Definition TGFrame.h:522
TGDimension GetDefaultSize() const override
Returns default size.
Definition TGFrame.cxx:2131
virtual void SetTitlePos(ETitlePos pos=kLeft)
Definition TGFrame.h:564
Concrete class for horizontal slider.
Definition TGSlider.h:119
A composite frame that layout their children in horizontal way.
Definition TGFrame.h:385
TGHotString is a string with a "hot" character underlined.
Definition TGString.h:42
virtual void SetSubnames(const char *n1="", const char *n2="", const char *n3="", const char *n4="", const char *n5="", const char *n6="", const char *n7="", const char *n8="", const char *n9="", const char *n10="", const char *n11="", const char *n12="")
Sets new subnames.
void SetUserData(void *userData)
Definition TGListView.h:94
This class handles GUI labels.
Definition TGLabel.h:24
This class describes layout hints used by the layout classes.
Definition TGLayout.h:50
A listbox is a box, possibly with scrollbar, containing entries.
Definition TGListBox.h:221
virtual void RemoveEntry(Int_t id=-1)
remove entry with id.
void Resize(UInt_t w, UInt_t h) override
Resize the listbox widget.
virtual void AddEntry(TGString *s, Int_t id)
Add entry with specified string and id to listbox.
void Layout() override
Layout the listbox components.
virtual void SetMultipleSelections(Bool_t multi=kTRUE)
Definition TGListBox.h:259
virtual const char * GetText() const =0
TGListTreeItem * GetParent() const
Definition TGListTree.h:58
virtual void * GetUserData() const =0
virtual void SetUserData(void *, Bool_t=kFALSE)
Definition TGListTree.h:79
A list tree is a widget that can contain a number of items arranged in a tree structure.
Definition TGListTree.h:195
void AddItem(TGListTreeItem *parent, TGListTreeItem *item)
Add given item to list tree.
A list view is a widget that can contain a number of items arranged in a grid or list.
Definition TGListView.h:115
Defines top level windows that interact with the system Window Manager.
Definition TGFrame.h:397
This layout managers does not make use of TGLayoutHints.
Definition TGLayout.h:269
The TGMenu.h header contains all different menu classes.
Definition TGMenu.h:282
virtual void AddPopup(TGHotString *s, TGPopupMenu *menu, TGLayoutHints *l, TGPopupMenu *before=nullptr)
Add popup menu to menu bar.
Definition TGMenu.cxx:418
This class contains all information about a menu entry.
Definition TGMenu.h:57
TGNumberEntry is a number entry input widget with up/down buttons.
@ kNEAPositive
Positive number.
@ kNEANonNegative
Non-negative number.
@ kNEAAnyNumber
Attributes of number entry field.
@ kNELNoLimits
Limit selection of number entry field.
@ kNELLimitMax
Upper limit only.
@ kNELLimitMin
Lower limit only.
@ kNELLimitMinMax
Both lower and upper limits.
Handle_t GetId() const
Definition TGObject.h:41
Yield an action as soon as it is clicked.
Definition TGButton.h:228
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Definition TGPicture.h:25
Pixmap_t GetPicture() const
Definition TGPicture.h:54
This class creates a popup menu object.
Definition TGMenu.h:110
Selects different options.
Definition TGButton.h:321
void SetState(EButtonState state, Bool_t emit=kFALSE) override
Set radio button state.
TGFrame * GetContainer() const
Definition TGShutter.h:45
A shutter widget contains a set of shutter items that can be open and closed like a shutter.
Definition TGShutter.h:55
virtual void AddItem(TGShutterItem *item)
Add shutter item to shutter frame.
Definition TGShutter.cxx:73
Slider widgets allow easy selection of a range.
Definition TGSlider.h:40
virtual void SetPosition(Int_t pos)
Set slider position.
Definition TGSlider.cxx:110
static TClass * Class()
virtual void SetRange(Int_t min, Int_t max)
Set slider range.
Definition TGSlider.cxx:99
TGString wraps a TString and adds some graphics routines like drawing, size of string on screen depen...
Definition TGString.h:20
Service classes of the tab widget.
Definition TGTab.h:117
const char * GetString() const
Definition TGTab.h:146
A tab widget contains a set of composite frames each with a little tab with a name (like a set of fol...
Definition TGTab.h:46
TGTabElement * GetTabTab(Int_t tabIndex) const
Return the tab element of tab with index tabIndex.
Definition TGTab.cxx:663
Int_t GetNumberOfTabs() const
Return number of tabs.
Definition TGTab.cxx:709
virtual void RemoveTab(Int_t tabIndex=-1, Bool_t storeRemoved=kTRUE)
Remove container and tab of tab with index tabIndex.
Definition TGTab.cxx:427
virtual TGCompositeFrame * AddTab(TGString *text)
Add a tab to the tab widget.
Definition TGTab.cxx:376
A text buffer is used in several widgets, like TGTextEntry, TGFileDialog, etc.
void AddText(Int_t pos, const char *text)
const char * GetString() const
Yield an action as soon as it is clicked.
Definition TGButton.h:142
A TGTextEdit is a specialization of TGTextView.
Definition TGTextEdit.h:22
A TGTextEntry is a one line text input widget.
Definition TGTextEntry.h:24
Int_t GetCursorPosition() const
void Deselect()
Deselects all text (i.e.
virtual void SetCursorPosition(Int_t pos)
Set the cursor position to newPos.
virtual void SetFont(TGFont *font, Bool_t local=kTRUE)
Changes text font specified by pointer to TGFont object.
A TGText is a multi line text buffer.
Definition TGText.h:57
Bool_t LoadBuffer(const char *txtbuf)
Load a 0 terminated buffer. Lines will be split at ' '.
Definition TGText.cxx:513
const char * GetFileName() const
Definition TGText.h:88
This is a layout manager for the TGListView widget.
Definition TGLayout.h:303
Defines transient windows that typically are used for dialogs windows.
Definition TGFrame.h:498
Concrete class for vertical slider.
Definition TGSlider.h:92
A composite frame that layout their children in vertical way.
Definition TGFrame.h:374
Int_t WidgetId() const
Definition TGWidget.h:68
ROOT GUI Window base class.
Definition TGWindow.h:23
1-D histogram with a float per channel (see TH1 documentation)
Definition TH1.h:621
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
Definition TH1.cxx:3340
void Draw(Option_t *option="") override
Draw this histogram with options.
Definition TH1.cxx:3062
2-D histogram with a float per channel (see TH1 documentation)
Definition TH2.h:295
Int_t Fill(Double_t) override
Invalid Fill method.
Definition TH2.cxx:350
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Definition TKey.h:28
const char * GetTitle() const override
Returns title (title can contain 32x32 xpm thumbnail/icon).
Definition TKey.cxx:1540
virtual const char * GetClassName() const
Definition TKey.h:75
A doubly linked list.
Definition TList.h:38
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
Mother of all ROOT objects.
Definition TObject.h:41
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
Definition TObject.cxx:555
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
Definition TObject.cxx:198
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:780
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
Definition TObject.cxx:636
void SetBorderMode(Short_t bordermode) override
Definition TPad.h:322
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Definition TQObject.cxx:869
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
Definition TRandom.cxx:507
This class creates a TGCanvas in which a TCanvas is created.
TCanvas * GetCanvas() const
Basic string class.
Definition TString.h:139
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
Definition TString.cxx:2244
Describes an Operating System directory for the browser.
A TSystemFile describes an operating system file.
Definition TSystemFile.h:29
virtual Bool_t IsDirectory(const char *dir=nullptr) const
Check if object is a directory.
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
Definition TSystem.cxx:1081
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
Definition TSystem.cxx:862
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
Definition TSystem.cxx:437
virtual const char * WorkingDirectory()
Return working directory.
Definition TSystem.cxx:871
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
Definition TSystem.cxx:416
static void SingleShot(Int_t milliSec, const char *receiver_class, void *receiver, const char *method)
This static function calls a slot after a given time interval.
Definition TTimer.cxx:258
static TVirtualPadEditor * GetPadEditor(Bool_t load=kTRUE)
Returns the pad editor dialog. Static method.
static void Terminate()
Close the global pad editor. Static method.
Double_t y[n]
Definition legend1.C:17
return c1
Definition legend1.C:41
Double_t x[n]
Definition legend1.C:17
TF1 * f1
Definition legend1.C:11
return c2
Definition legend2.C:14
__device__ AFloat max(AFloat x, AFloat y)
Definition Kernels.cuh:207
const char * cnt
Definition TXMLSetup.cxx:75
Event structure.
Definition GuiTypes.h:174
EGEventType fType
of event (see EGEventType)
Definition GuiTypes.h:175
UInt_t fCode
key or button code
Definition GuiTypes.h:180
TLine lv
Definition textalign.C:5
TLine l
Definition textangle.C:4
Authors
Ilka Antcheva, Bertrand Bellenot, Fons Rademakers, Valeri Onuchin

Definition in file guitest.C.