It is now possible to run this entire test program in the interpreter. Do either:
#include <stdlib.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
};
const char *filetypes[] = { "All files", "*",
"ROOT files", "*.root",
"ROOT macros", "*.C",
"Text files", "*.[tT][xX][tT]",
0, 0 };
struct shutterData_t {
const char *pixmap_name;
const char *tip_text;
};
shutterData_t histo_data[] = {
{ "h1_s.xpm", "TH1", 1001, 0 },
{ "h2_s.xpm", "TH2", 1002, 0 },
{ "h3_s.xpm", "TH3", 1003, 0 },
{ "profile_s.xpm", "TProfile", 1004, 0 },
{ 0, 0, 0, 0 }
};
shutterData_t function_data[] = {
{ "f1_s.xpm", "TF1", 2001, 0 },
{ "f2_s.xpm", "TF2", 2002, 0 },
{ 0, 0, 0, 0 }
};
shutterData_t tree_data[] = {
{ "ntuple_s.xpm", "TNtuple", 3001, 0 },
{ "tree_s.xpm", "TTree", 3002, 0 },
{ "chain_s.xpm", "TChain", 3003, 0 },
{ 0, 0, 0, 0 }
};
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 {
private:
TileFrame *fContainer;
TGPopupMenu *fMenuFile, *fMenuTest, *fMenuView, *fMenuHelp;
TGPopupMenu *fCascadeMenu, *fCascade1Menu, *fCascade2Menu;
TGLayoutHints *fMenuBarLayout, *fMenuBarItemLayout, *fMenuBarHelpLayout;
public:
virtual ~TestMainFrame();
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()"); }
void Welcome() { printf("TestMainFrame has been created. Welcome!\n"); }
};
class TestDialog {
private:
TGButton *fOkButton, *fCancelButton, *fStartB, *fStopB;
TGButton *fBtn1, *fBtn2, *fChk1, *fChk2, *fRad1, *fRad2;
void FillHistos();
public:
virtual ~TestDialog();
void DoClose();
void CloseWindow();
void DoOK();
void DoCancel();
void HandleButtons(
Int_t id = -1);
};
class TestMsgBox {
private:
public:
virtual ~TestMsgBox();
void TryToClose();
void CloseWindow();
void DoClose();
void DoRadio();
void DoTest();
};
class TestSliders {
private:
public:
virtual ~TestSliders();
void CloseWindow();
void DoText(const
char *
text);
void DoSlider(
Int_t pos = 0);
};
class TestShutter {
private:
public:
~TestShutter();
void AddShutterItem(const
char *
name, shutterData_t *data);
void CloseWindow();
void HandleButtons();
};
class TestDirList {
protected:
public:
virtual ~TestDirList();
void CloseWindow();
};
class TestFileList {
protected:
void DisplayFile(const
TString &fname);
void DisplayDirectory(const
TString &fname);
public:
virtual ~TestFileList();
void CloseWindow();
};
class TestProgress {
private:
public:
virtual ~TestProgress();
void CloseWindow();
void DoClose();
void DoGo();
};
class EntryTestDlg {
private:
public:
virtual ~EntryTestDlg();
void CloseWindow();
void SetLimits();
void DoOK();
};
class Editor {
private:
public:
virtual ~Editor();
void LoadFile(
const char *
file);
void LoadBuffer(const char *buffer);
void AddBuffer(const char *buffer);
void SetTitle();
void Popup();
void CloseWindow();
void DoOK();
void DoOpen();
void DoSave();
void DoClose();
};
class TileFrame {
private:
public:
virtual ~TileFrame() { delete fFrame; }
TGFrame *GetFrame()
const {
return fFrame; }
void SetCanvas(
TGCanvas *canvas) { fCanvas = canvas; }
void HandleMouseWheel(
Event_t *event);
};
{
fFrame->Connect("ProcessedEvent(Event_t*)", "TileFrame", this,
"HandleMouseWheel(Event_t*)");
fCanvas = 0;
}
void TileFrame::HandleMouseWheel(
Event_t *event)
{
return;
if (!fCanvas) return;
if (fCanvas->GetContainer()->GetHeight())
fCanvas->GetViewPort()->GetHeight()) /
fCanvas->GetContainer()->GetHeight());
}
Int_t newpos = fCanvas->GetVsbPosition() - page;
if (newpos < 0) newpos = 0;
fCanvas->SetVsbPosition(newpos);
}
Int_t newpos = fCanvas->GetVsbPosition() + page;
fCanvas->SetVsbPosition(newpos);
}
}
{
fMain->Connect("CloseWindow()", "TestMainFrame", this, "CloseWindow()");
fMenuDock->SetWindowName("GuiTest Menu");
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->AddEntry("ID = 2&3", M_CASCADE_1);
fCascade2Menu->AddEntry("ID = 2&4", M_CASCADE_2);
fCascade2Menu->AddEntry("ID = 2&5", M_CASCADE_3);
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->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->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->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);
fMenuDock->Connect("Undocked()", "TestMainFrame", this, "HandleMenu(=M_VIEW_UNDOCK)");
fMenuHelp->AddEntry("&Contents", M_HELP_CONTENTS);
fMenuHelp->AddEntry("&Search...", M_HELP_SEARCH);
fMenuHelp->AddSeparator();
fMenuHelp->AddEntry("&About", M_HELP_ABOUT);
fMenuNew1->AddEntry("Remove New Menus", M_NEW_REMOVEMENU);
fMenuNew2->AddEntry("Remove New Menus", M_NEW_REMOVEMENU);
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->AddPopup("&File", fMenuFile, fMenuBarItemLayout);
fMenuBar->AddPopup("&Test", fMenuTest, fMenuBarItemLayout);
fMenuBar->AddPopup("&View", fMenuView, fMenuBarItemLayout);
fMenuBar->AddPopup("&Help", fMenuHelp, fMenuBarHelpLayout);
fMenuDock->AddFrame(fMenuBar, fMenuBarLayout);
fCanvasWindow =
new TGCanvas(fMain, 400, 240);
fContainer = new TileFrame(fCanvasWindow->GetViewPort());
fContainer->SetCanvas(fCanvasWindow);
fCanvasWindow->SetContainer(fContainer->GetFrame());
for (int i=0; i < 256; ++i)
fCanvasWindow->AddFrame(
new TGFrame(fCanvasWindow->GetContainer(),
0, 0, 2, 2));
fTestButton =
new TGTextButton(fStatusFrame,
"&Open editor...", 150);
fTestButton->
Connect(
"Clicked()",
"TestMainFrame",
this,
"DoButton()");
fTestText->SetToolTipText("This is a text entry widget");
fTestText->Resize(300, fTestText->GetDefaultHeight());
10, 2, 2, 2));
gClient->GetColorByName(
"yellow", yellow);
0, 0, 1, 0));
fMain->SetWindowName("GuiTest Signal/Slots");
fMain->MapSubwindows();
fMain->Resize();
fMain->MapWindow();
fMain->Print();
Connect("Created()", "TestMainFrame", this, "Welcome()");
Created();
}
TestMainFrame::~TestMainFrame()
{
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()
{
}
void TestMainFrame::DoButton()
{
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)
{
switch (id) {
case M_FILE_OPEN:
{
printf(
"fIniDir = %s\n", 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();
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:
{
printf("Selected font: %s, size %d, italic %s, bold %s, color 0x%lx, align %u\n",
}
break;
case M_TEST_NEWMENU:
{
if (fMenuTest->IsEntryChecked(M_TEST_NEWMENU)) {
HandleMenu(M_NEW_REMOVEMENU);
return;
}
fMenuTest->CheckEntry(M_TEST_NEWMENU);
fMenuBar->AddPopup("New 1", fMenuNew1, fMenuBarItemLayout, p);
p = fMenuBar->GetPopup("Help");
fMenuBar->
AddPopup(
"New 2", fMenuNew2, fMenuBarItemLayout, p);
fMenuBar->MapSubwindows();
fMenuBar->Layout();
fMenuTest->AddEntry(
"Remove New Menus", M_NEW_REMOVEMENU, 0, 0,
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;
}
}
{
fMain->Connect("CloseWindow()", "TestDialog", this, "DoClose()");
fMain->DontCallClose();
fOkButton->
Connect(
"Clicked()",
"TestDialog",
this,
"DoOK()");
fCancelButton->
Connect(
"Clicked()",
"TestDialog",
this,
"DoCancel()");
2, 2, 2, 2);
fMain->AddFrame(fFrame1, fL2);
fTab =
new TGTab(fMain, 300, 300);
fTab->
Connect(
"Selected(Int_t)",
"TestDialog",
this,
"DoTab(Int_t)");
200, 2, 2, 2);
int i;
char tmp[20];
for (i = 0; i < 20; i++) {
sprintf(tmp, "Entry %i", i+1);
}
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()");
fHpx = 0;
fHpxpy = 0;
fStartB =
new TGTextButton(fF3,
"Start &Filling Hists", 40);
fStartB->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
fStopB->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
"TestDialog", this,
"HandleEmbeddedCanvas(Int_t,Int_t,Int_t,TObject*)");
gClient->GetColorByName(
"yellow", yellow);
bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
fCheckMulti->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
for (i = 0; i < 20; ++i) {
sprintf(tmp, "Entry %i", i);
}
fFirstEntry = 0;
fLastEntry = 20;
char buff[100];
int j;
for (j = 0; j < 4; j++) {
sprintf(buff, "Module %i", j+1);
tent->
SetFont(
"-adobe-courier-bold-r-*-*-14-*-*-*-*-*-iso8859-1");
}
bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
bt->
Connect(
"Clicked()",
"TestDialog",
this,
"HandleButtons()");
fMain->AddFrame(fTab, fL5);
fMain->MapSubwindows();
fMain->Resize();
fMain->CenterOnParent();
fMain->SetWindowName("Dialog");
fMain->MapWindow();
}
TestDialog::~TestDialog()
{
fMain->DeleteWindow();
}
void TestDialog::FillHistos()
{
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);
}
float px, py;
while (fFillHistos) {
}
}
}
}
void TestDialog::DoClose()
{
printf("\nTerminating dialog: via window manager\n");
if (fFillHistos) {
} else
CloseWindow();
}
void TestDialog::CloseWindow()
{
delete this;
}
void TestDialog::DoOK()
{
printf("\nTerminating dialog: OK pressed\n");
}
void TestDialog::DoCancel()
{
printf("\nTerminating dialog: Cancel pressed\n");
}
void TestDialog::HandleButtons(
Int_t id)
{
if (id == -1) {
}
printf("DoButton: id = %d\n", id);
char tmp[20];
static int newtab = 0;
switch (id) {
case 40:
FillHistos();
break;
case 41:
break;
case 61:
break;
case 62:
break;
case 90:
fLastEntry++;
sprintf(tmp, "Entry %i", fLastEntry);
break;
case 91:
if (fFirstEntry <= fLastEntry) {
fFirstEntry++;
}
break;
case 101:
{
delete fEc1; fEc1 = 0;
delete fEc2; fEc2 = 0;
}
}
break;
case 102:
{
for (int i = 0 ; i < nt; i++) {
break;
}
}
}
break;
case 103:
sprintf(tmp, "New Tab %d", ++newtab);
break;
case 81:
break;
case 82:
break;
case 92:
break;
default:
break;
}
}
void TestDialog::DoTab(
Int_t id)
{
printf("Tab item %d activated\n", id);
}
{
printf(
"event = %d, x = %d, y = %d, obj = %s::%s\n", event,
x,
y,
}
{
fMain->Connect("CloseWindow()", "TestMsgBox", this, "CloseWindow()");
fMain->DontCallClose();
gClient->GetColorByName(
"red", red);
int i;
fTestButton->
Connect(
"Clicked()",
"TestMsgBox",
this,
"DoTest()");
gClient->GetColorByName(
"green", green);
fCloseButton->
Connect(
"Clicked()",
"TestMsgBox",
this,
"DoClose()");
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);
2, 2, 2, 2);
0, 0, 5, 0);
for (i=0; i<13; ++i) fG1->
AddFrame(fC[i], fL4);
for (i = 0; i < 4; ++i) {
fR[i]->
Connect(
"Clicked()",
"TestMsgBox",
this,
"DoRadio()");
}
fTbmsg->
AddText(0,
"This is a test message box.");
3, 5, 0, 0);
0, 2, 0, 0);
fMain->AddFrame(f2, fL2);
fMain->MapSubwindows();
fMain->Resize();
fMain->CenterOnParent();
fMain->SetWindowName("Message Box Test");
fMain->MapWindow();
}
TestMsgBox::~TestMsgBox()
{
fMain->DeleteWindow();
}
void TestMsgBox::CloseWindow()
{
delete this;
}
void TestMsgBox::DoClose()
{
CloseWindow();
}
void TestMsgBox::DoTest()
{
int i, buttons, retval;
buttons = 0;
for (i = 0; i < 13; i++)
buttons |= mb_button_id[i];
for (i = 0; i < 4; i++)
icontype = mb_icon[i];
break;
}
fMain->Disconnect("CloseWindow()");
fMain->Connect("CloseWindow()", "TestMsgBox", this, "TryToClose()");
icontype, buttons, &retval);
fMain->Disconnect("CloseWindow()");
fMain->Connect("CloseWindow()", "TestMsgBox", this, "CloseWindow()");
}
void TestMsgBox::TryToClose()
{
printf("Can't close the window '%s' : a message box is still open\n", fMain->GetWindowName());
}
void TestMsgBox::DoRadio()
{
if (id >= 21 && id <= 24) {
for (int i = 0; i < 4; i++)
if (fR[i]->WidgetId() !=
id)
}
}
{
fMain->Connect("CloseWindow()", "TestSliders", this, "CloseWindow()");
fMain->DontCallClose();
fTeh1->
Connect(
"TextChanged(char*)",
"TestSliders",
this,
"DoText(char*)");
fTev1->
Connect(
"TextChanged(char*)",
"TestSliders",
this,
"DoText(char*)");
fHslider1->
Connect(
"PositionChanged(Int_t)",
"TestSliders",
this,
"DoSlider(Int_t)");
fVslider1->
Connect(
"PositionChanged(Int_t)",
"TestSliders",
this,
"DoSlider(Int_t)");
fTeh2->
Connect(
"TextChanged(char*)",
"TestSliders",
this,
"DoText(char*)");
fTev2->
Connect(
"TextChanged(char*)",
"TestSliders",
this,
"DoText(char*)");
fHslider2->
Connect(
"PositionChanged(Int_t)",
"TestSliders",
this,
"DoSlider(Int_t)");
fVslider2->
Connect(
"PositionChanged()",
"TestSliders",
this,
"DoSlider()");
fMain->AddFrame(fVframe2, fBfly1);
fMain->AddFrame(fVframe1, fBfly1);
fMain->SetWindowName("Slider Test");
fMain->Resize(size);
fMain->CenterOnParent();
fMain->MapSubwindows();
fMain->MapWindow();
}
TestSliders::~TestSliders()
{
fMain->DeleteWindow();
}
void TestSliders::CloseWindow()
{
delete this;
}
void TestSliders::DoText(const char * )
{
switch (id) {
case HId1:
break;
case VId1:
break;
case HId2:
break;
case VId2:
break;
default:
break;
}
}
void TestSliders::DoSlider(
Int_t pos)
{
} else {
}
char buf[32];
sprintf(buf, "%d", pos);
#ifdef CINT_FIXED
switch (id) {
case HSId1:
#else
if (id == HSId1) {
#endif
#ifdef CINT_FIXED
break;
case VSId1:
#else
}
else if (id == VSId1) {
#endif
#ifdef CINT_FIXED
break;
case HSId2:
#else
}
else if (id == HSId2) {
#endif
#ifdef CINT_FIXED
break;
case VSId2:
#else
}
else if (id == VSId2) {
#endif
#ifdef CINT_FIXED
break;
default:
break;
#endif
}
}
{
fMain->Connect("CloseWindow()", "TestShutter", this, "CloseWindow()");
fMain->DontCallClose();
fDefaultPic =
gClient->GetPicture(
"folder_s.xpm");
AddShutterItem("Histograms", histo_data);
AddShutterItem("Functions", function_data);
AddShutterItem("Trees", tree_data);
fMain->AddFrame(fShutter, fLayout);
fMain->MapSubwindows();
fMain->Resize(80, 300);
fMain->CenterOnParent();
fMain->SetWindowName("Shutter Test");
fMain->MapWindow();
}
void TestShutter::AddShutterItem(
const char *
name, shutterData_t *data)
{
static int id = 5001;
5, 5, 5, 0);
for (int i=0; data[i].pixmap_name != 0; 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->
Connect(
"Clicked()",
"TestShutter",
this,
"HandleButtons()");
data[i].button = button;
}
}
TestShutter::~TestShutter()
{
fMain->DeleteWindow();
}
void TestShutter::CloseWindow()
{
delete this;
}
void TestShutter::HandleButtons()
{
printf(
"Shutter button %d\n", btn->
WidgetId());
}
{
fMain->Connect("CloseWindow()", "TestDirList", this, "CloseWindow()");
fMain->DontCallClose();
fIcon =
gClient->GetPicture(
"rootdb_t.xpm");
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 G__WIN32
#else
#endif
fMain->CenterOnParent();
fMain->SetWindowName("List Dir Test");
fMain->MapSubwindows();
fMain->Resize();
fMain->MapWindow();
}
TestDirList::~TestDirList()
{
delete fContents;
}
void TestDirList::CloseWindow()
{
delete this;
}
{
item = parent;
}
return dirname;
}
{
TList *files = dir.GetListOfFiles();
if (files) {
if (
file->IsDirectory()) {
if ((fname!="..") && (fname!=".")) {
}
fContents->
AddItem(item,fname,fIcon,fIcon);
}
}
delete files;
}
}
{
fMain->Connect("CloseWindow()", "TestDirList", this, "CloseWindow()");
fMain->DontCallClose();
fMain->AddFrame(mb, lo);
fMenu->AddSeparator();
fMenu->AddEntry("&Close", 10);
fMenu->Connect("Activated(Int_t)","TestFileList",this,"DoMenu(Int_t)");
gClient->GetColorByName(
"white", white);
fContents->
Connect(
"DoubleClicked(TGFrame*,Int_t)",
"TestFileList",
this,
"OnDoubleClick(TGLVEntry*,Int_t)");
fMain->CenterOnParent();
fMain->SetWindowName("File List Test");
fMain->MapSubwindows();
fMain->MapWindow();
fContents->SetDefaultHeaders();
fContents->DisplayDirectory();
fContents->AddFile("..");
fContents->StopRefreshTimer();
}
TestFileList::~TestFileList()
{
delete fContents;
}
void TestFileList::DoMenu(
Int_t mode)
{
if (mode<10) {
} else {
delete this;
}
}
void TestFileList::DisplayFile(
const TString &fname)
{
fContents->SetColHeaders("Name","Title");
while ((key=(
TKey*)next())) {
}
fMain->Resize();
}
void TestFileList::DisplayDirectory(
const TString &fname)
{
fContents->SetDefaultHeaders();
fContents->ChangeDirectory(fname);
fContents->DisplayDirectory();
fContents->AddFile("..");
}
{
if (obj) {
}
}
{
const char* fname = (
const char*)
f->GetUserData();
if (fname) {
DisplayObject(fname,
name);
}
else if (
name.EndsWith(
".root")) {
} else {
}
}
void TestFileList::CloseWindow()
{
delete this;
}
{
fMain->Connect("CloseWindow()", "TestProgress", this, "DoClose()");
fMain->DontCallClose();
fVProg1->SetBarColor("purple");
fVProg2->SetBarColor("green");
fHframe1->Resize(300, 300);
fHProg1->ShowPosition();
fHProg2->SetBarColor("lightblue");
fGO->Connect("Clicked()", "TestProgress", this, "DoGo()");
fHframe1->AddFrame(fVProg1, fHint1);
fHframe1->AddFrame(fVProg2, fHint1);
fMain->AddFrame(fHframe1, fHint4);
fMain->AddFrame(fVframe1, fHint5);
fMain->SetWindowName("Progress Test");
fMain->Resize(size);
fMain->CenterOnParent();
fMain->MapSubwindows();
fMain->MapWindow();
}
TestProgress::~TestProgress()
{
fMain->DeleteWindow();
}
void TestProgress::CloseWindow()
{
delete this;
}
void TestProgress::DoClose()
{
if (fClose)
CloseWindow();
else {
}
}
void TestProgress::DoGo()
{
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);
}
if (fClose) return;
}
}
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"
};
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
};
{
fMain->Connect("CloseWindow()", "EntryTestDlg", this, "CloseWindow()");
fMain->DontCallClose();
TGFont *myfont =
gClient->GetFont(
"-adobe-helvetica-bold-r-*-*-12-*-*-*-*-*-iso8859-1");
fMain->AddFrame(fF1, fL1);
for (int i = 0; i < 13; i++) {
fNumericEntries[i] =
new TGNumberEntry(fF[i], numinit[i], 12, i + 20,
fF[i]->AddFrame(fNumericEntries[i], fL2);
fF[i]->AddFrame(fLabel[i], fL2);
}
fMain->AddFrame(fF2, fL3);
fLimits[0]->SetLogStep(
kFALSE);
fLimits[1]->SetLogStep(
kFALSE);
fSetButton->Connect("Clicked()", "EntryTestDlg", this, "SetLimits()");
fExitButton->Connect("Clicked()", "EntryTestDlg", this, "DoOK()");
fMain->SetWindowName("Number Entry Test");
fMain->SetIconName("Number Entry Test");
fMain->SetClassHints("NumberEntryDlg", "NumberEntryDlg");
fMain->MapSubwindows();
UInt_t height = fMain->GetDefaultHeight();
fMain->Resize(
width, height);
fMain->CenterOnParent();
fMain->SetWMSize(
width, height);
fMain->SetWMSizeHints(
width, height,
width, height, 0, 0);
fMain->MapWindow();
}
EntryTestDlg::~EntryTestDlg()
{
fMain->DeleteWindow();
}
void EntryTestDlg::CloseWindow()
{
delete this;
}
void EntryTestDlg::DoOK()
{
fMain->SendCloseMessage();
}
void EntryTestDlg::SetLimits()
{
if (low && high) {
} else if (low) {
} else if (high) {
} else {
}
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);
}
}
{
fMain->Connect("CloseWindow()", "Editor", this, "CloseWindow()");
fMain->DontCallClose();
fMain->AddFrame(fEdit, fL1);
fEdit->Connect("Opened()", "Editor", this, "DoOpen()");
fEdit->Connect("Saved()", "Editor", this, "DoSave()");
fEdit->Connect("Closed()", "Editor", this, "DoClose()");
gClient->GetColorByName(
"#3399ff", pxl);
fEdit->SetSelectBack(pxl);
fOK->Connect("Clicked()", "Editor", this, "DoOK()");
fMain->AddFrame(fOK, fL2);
SetTitle();
fMain->MapSubwindows();
fMain->Resize();
}
Editor::~Editor()
{
fMain->DeleteWindow();
}
void Editor::SetTitle()
{
TGText *txt = GetEditor()->GetText();
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()
{
fMain->MapWindow();
}
void Editor::LoadBuffer(const char *buffer)
{
fEdit->LoadBuffer(buffer);
}
void Editor::LoadFile(
const char *
file)
{
}
void Editor::AddBuffer(const char *buffer)
{
fEdit->AddText(&txt);
}
void Editor::CloseWindow()
{
delete this;
}
void Editor::DoOK()
{
CloseWindow();
}
void Editor::DoOpen()
{
SetTitle();
}
void Editor::DoSave()
{
SetTitle();
}
void Editor::DoClose()
{
CloseWindow();
}
void guitest()
{
new TestMainFrame(
gClient->GetRoot(), 400, 220);
}
#ifdef STANDALONE
int main(
int argc,
char **argv)
{
fprintf(stderr, "%s: cannot run in batch mode\n", argv[0]);
return 1;
}
guitest();
theApp.Run();
return 0;
}
#endif
const Mask_t kButtonPressMask
const Mask_t kAnyModifier
const Mask_t kPointerMotionMask
const Mask_t kButtonReleaseMask
#define RQ_OBJECT(sender_class)
R__EXTERN TApplication * gApplication
include TDocParser_001 C image html pict1_TDocParser_001 png width
R__EXTERN void * gTQSender
R__EXTERN TRandom * gRandom
char * StrDup(const char *str)
Duplicate the string str.
R__EXTERN TSystem * gSystem
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.
static ULong_t RGB2Pixel(Int_t r, Int_t g, Int_t b)
Convert r,g,b to graphics system dependent pixel value.
Describe directory structure in memory.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
virtual void AddEntry(TGString *s, Int_t id)
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...
virtual void SetLayoutManager(TGLayoutManager *l)
Set the layout manager for the composite frame.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
virtual void Layout()
Layout the elements of the composite frame.
virtual void MapSubwindows()
Map all sub windows that are part of the composite frame.
virtual void RemoveAll()
Remove all items from the container.
virtual void SetPagePosition(const TGPosition &pos)
Set page position.
virtual Float_t GetMinPosition() const
virtual void SetRange(Float_t min, Float_t max)
virtual void SetPosition(Float_t min, Float_t max)
void SetIniDir(const char *inidir)
Set directory name.
FontStruct_t GetFontStruct() const
FontH_t GetFontHandle() const
static Pixel_t GetWhitePixel()
Get white pixel value.
virtual UInt_t GetDefaultWidth() const
virtual UInt_t GetDefaultHeight() const
virtual void DeleteWindow()
Delete window.
virtual void ChangeBackground(Pixel_t back)
Change frame background color.
virtual void Resize(UInt_t w=0, UInt_t h=0)
Resize the frame.
void SetFont(FontH_t v)
Set font.
void SetForeground(Pixel_t v)
Set foreground color.
virtual TGDimension GetDefaultSize() const
Returns default size.
virtual void SetTitlePos(ETitlePos pos=kLeft)
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)
virtual void Resize(UInt_t w, UInt_t h)
Resize the listbox widget.
virtual void RemoveEntry(Int_t id=-1)
remove entry with id.
virtual void AddEntry(TGString *s, Int_t id)
Add entry with specified string and id to listbox.
virtual void SetMultipleSelections(Bool_t multi=kTRUE)
virtual void Layout()
Layout the listbox components.
virtual const char * GetText() const =0
TGListTreeItem * GetParent() const
virtual void * GetUserData() const =0
virtual void SetUserData(void *, Bool_t=kFALSE)
void AddItem(TGListTreeItem *parent, TGListTreeItem *item)
Add given item to list tree.
TGFrame * GetContainer() const
virtual void AddItem(TGShutterItem *item)
Add shutter item to shutter frame.
virtual void SetPosition(Int_t pos)
virtual void SetRange(Int_t min, Int_t max)
const char * GetString() const
TGTabElement * GetTabTab(Int_t tabIndex) const
Return the tab element of tab with index tabIndex.
Int_t GetNumberOfTabs() const
Return number of tabs.
virtual void RemoveTab(Int_t tabIndex=-1, Bool_t storeRemoved=kTRUE)
Remove container and tab of tab with index tabIndex.
virtual TGCompositeFrame * AddTab(TGString *text)
Add a tab to the tab widget.
void AddText(Int_t pos, const char *text)
const char * GetString() const
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.
Bool_t LoadBuffer(const char *txtbuf)
Load a 0 terminated buffer. Lines will be split at ' '.
const char * GetFileName() const
1-D histogram with a float per channel (see TH1 documentation)}
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual void Draw(Option_t *option="")
Draw this histogram with options.
2-D histogram with a float per channel (see TH1 documentation)}
Int_t Fill(Double_t)
Invalid Fill method.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
virtual const char * GetClassName() const
virtual const char * GetTitle() const
Returns title (title can contain 32x32 xpm thumbnail/icon).
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
virtual Bool_t IsFolder() const
Returns kTRUE in case object contains browsable objects (like containers or lists of other objects).
virtual const char * GetName() const
Returns name of object.
virtual void Browse(TBrowser *b)
Browse object. May be overridden for another default action.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual void Print(Option_t *option="") const
This method must be overridden when a class wants to print itself.
virtual void SetBorderMode(Short_t bordermode)
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.
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
TCanvas * GetCanvas() const
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
const char * Data() const
Describes an Operating System directory for the browser.
A TSystemFile describes an operating system file.
virtual const char * PrependPathName(const char *dir, TString &name)
Concatenate a directory and a file name.
virtual Bool_t ChangeDirectory(const char *path)
Change directory.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual const char * WorkingDirectory()
Return working directory.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
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.
static TVirtualPadEditor * GetPadEditor(Bool_t load=kTRUE)
Returns the pad editor dialog. Static method.
static void Terminate()
Close the global pad editor. Static method.
int main(int argc, char **argv)
static constexpr double s